How do I limit maximum call duration on v17

I found some old threads how to do this but my understanding is the script language has changed in v17. Does anyone know how I would do it in 17? From what I can tell it should be the same but I could not find any info on how to use hooks with gosub anywhere.

This is apparently how you would do it in previous versions.

in extensions_custom.conf

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

I think this just limits inbound, which is a good start. However, I would like to try limit outbound as well.

This is related to Asterisk, not FreePBX.

Per the documentation, the TIMEOUT() function is still present in Asterisk v21 and v22.

https://docs.asterisk.org/Asterisk_21_Documentation/API_Documentation/Dialplan_Functions/TIMEOUT/

With that being said, I like using the L Dial() option since it gives you the ability to notify the caller that this call will end in x amount of time.

https://docs.asterisk.org/Asterisk_21_Documentation/API_Documentation/Dialplan_Applications/Dial/

I actually sent them here, as it’s not just Asterisk but “how do you do this in FreePBX”.

Don’t use from-pstn-custom. You will find references here in the forum to its existence, but it should not be used. A supportable way of adding your own dialplan on the inbound leg of a call is to create your own context that looks something like this

[form-pstn-preprocess]
exten => _.,1,Noop()
exten => _.,n,Set(TIMEOUT(absolute)=900)
exten => _.,n,GoTo(from-pstn,${EXTEN},1)

then set the context of your trunk(s) to the above context instead of from-pstn.

For outbound calls use the predial hook explained in this thread

1 Like

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