Limit call time on a specific trunk [SOLVED] (in my way ....)

(Claudio Pelosi) #1

I want to limit the call time of a trunk both inbound and outbound

I put this in the registration string both inbound and outbound of the trunk that I want to limit:
“context = from-pstn-toheader”

I have when edited:
“vi /etc/asterisk/sip_custom.conf”

And I inserted these lines:
exten = _.,1,noop(Limiting maximum call duration)
exten = _.,n,Set(TIMEOUT(absolute)=3600)
exten = _.,n,Goto(from-pstn,${EXTEN},1)

I then rebooted with:
“rasterisk -x” core reload "

But it doesn’t seem to work
Where am I wrong?


Logs? We always need logs.

(Lorne Gaetz) #3

Don’t use from-pstn-toheader as a user defined context, it already exists. Use from-pstn-limit or something else.

(Claudio Pelosi) #4

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

(Lorne Gaetz) #5

The context param in trunk setup only applies to inbound calls.

(Claudio Pelosi) #6

I think I’m wrong to write the context.
I need to create a construct that closes the call after n seconds

(Claudio Pelosi) #7

I need to limit the time a call remains active, and I have to do it for the trunks I want, it doesn’t seem complicated yet I can’t.
Possible that no one has already dealt with it …

(Lorne Gaetz) #8

It’s not clear from what you’ve provided whether you want limits on inbound or outbound calls (or both).

(Claudio Pelosi) #9

Both, starting from a trunk I have to limit the number of minutes of conversation, for outgoing calls and for incoming calls …

(Lorne Gaetz) #10

Your technique in post one will work for inbound provided you use a different name for your context. For outbound calls, you will need to use a dialplan hook and filter for specific trunk name.


You can also be polite and for outbound calls use the L(x,y,z) parameters for the dial command where L is Limit

You could also do that for inbound calls by replacing the goto() with a dial() if and when appropriate

(Claudio Pelosi) #12

Everything is struggling to manage the outgoing and incoming thing makes me want to pass
Probably because I’m more capable in one way and less in another … But I prefer to do it via AMI:
I create a small program in memory that will monitor the open calls and if they exceed a certain amount of time I will send a command to close the call “Action: Hangup”
Thank you very much for your collaboration, if I decide to make the software I will put more information here