Question : Limit the call duration.

Hi all.

I am scripting a bit on my box here. Does anyone know if I can limit all incoming calls on a SIP-trunk to 30 mins? It could either be on the trunk settings or in the dialplan somehow?

I would prefer if it was in my dialplan, then the callers would get a message saying that the time is up, and then be disconnected.

Thank you.

Answer : Limit the call duration.

Here's a different approach that works well for me. Asterisk has a built in Limit feature you can use from the dialplan suring the dial command:

L(x[:y][:z]): Limit the call to 'x' ms, warning when 'y' ms are left, repeated every 'z' ms) Only 'x' is required, 'y' and 'z' are optional. The following special variables are optional for limit calls: (from app_dial.c)

    * LIMIT_PLAYAUDIO_CALLER - yes|no (default yes) - Play sounds to the caller.
    * LIMIT_PLAYAUDIO_CALLEE - yes|no - Play sounds to the callee.
    * LIMIT_TIMEOUT_FILE - File to play when time is up.
    * LIMIT_CONNECT_FILE - File to play when call begins.
    * LIMIT_WARNING_FILE - File to play as warning if 'y' is defined. If LIMIT_WARNING_FILE is not defined, then the default behaviour is to announce ("You have [XX minutes] YY seconds").

And example would be:

      exten => 960,2,dial(SIP/960|55|L(1800000:60000:30000))

This example would call SIP extension 960 (and wait 55 seconds for an answer). If answered would limit the call to 30 minutes, telling the called party when there's 1 minute left for the call. To do it without the announcement it would be:

      exten => 960,2,dial(SIP/960|55|L(1800000))

Since Limit uses ms, 30 minutes was converted to 1800000 ms.
Random Solutions  
 
programming4us programming4us