How to limit call duration

I want to put a limit on the length of a phone call, specifically inbound calls. I recently ran into a situation where a customer has a conference room setup with a DID and is password protected. they held their conference call, but one of the participants apparently walked away and never hung up his phone so he was in the conference room for 12 hours. any suggestions?
this is a freepbx system
FreePBX 2.11.0.37
5.211.65-11

1 Like

For inbound calls, you could have something like

exten => s,1,Set(TIMEOUT(absolute)=3600)

in a context in extensions_custom.conf

[from-pstn-custom]

1 Like

edit - edited since it was first posted. Inexperienced users should never use the from-pstn-custom context.

There may be other ways, but one way is to put lines like this in /etc/asterisk/extensions_custom.conf:

[from-pstn-limited]
exten => _.,1,noop(Limiting maximum call duration)
exten => _.,n,Set(TIMEOUT(absolute)=3600)
exten => _.,n,Goto(from-pstn,${EXTEN},1)

Then set the trunk context to from-pstn-limited in the trunk peer details with the line:

context=from-pstn-limited
1 Like

similar contexts [-custom] are looked for in most parts of the dialplan (/etc/asterisk/extensions.conf), choose the one you want, to suit

1 Like

I appreciate the help

Sorry to bring back this very old topic, but I have a related question. I’ve successfully set up a call length limit thanks to the above suggestions, but now I’d like to add a custom recording triggered just before a call is dropped due to the length limit. The recording would say, “Call length limit reached” or something like that, followed by a hangup. The idea is to provide some feedback to the caller rather than just dropping the call. How can I implement this? I can make the recording myself, I just need to know how to trigger it.

Thanks!

That is built into the asterisk dial() command

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Dial

L( x:y:z ) - Limit the call to x milliseconds. Play a warning when y milliseconds are left. Repeat the warning every z milliseconds until time expires.
This option is affected by the following variables:
LIMIT_PLAYAUDIO_CALLER - If set, this variable causes Asterisk to play the prompts to the caller.
YES default: (true)
NO
LIMIT_PLAYAUDIO_CALLEE - If set, this variable causes Asterisk to play the prompts to the callee.
YES
NO default: (true)
LIMIT_TIMEOUT_FILE - If specified, filename specifies the sound prompt to play when the timeout is reached. If not set, the time remaining will be announced.
FILENAME
LIMIT_CONNECT_FILE - If specified, filename specifies the sound prompt to play when the call begins. If not set, the time remaining will be announced.
FILENAME
LIMIT_WARNING_FILE - If specified, filename specifies the sound prompt to play as a warning when time x is reached. If not set, the time remaining will be announced.
FILENAME
x - Maximum call time, in milliseconds
y - Warning time, in milliseconds
z - Repeat time, in milliseconds

Mr Dicko thank you a lot for your continuous support can you write please an example of this L (x:y:z) function in order to play a warning instead of suddently hanging up the call?

i have now this custom extension: (in extensions_custom.conf)

[from-pstn-custom]
exten => _X.,1,noop(Limiting maximum call duration)
exten => _X.,n,Set(TIMEOUT(absolute)=900)

what will be the new code in order to play a warning tone?
THANK YOU!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.