benoit plessis
2008-Jun-05 06:55 UTC
[asterisk-users] handling SIP trunk with limited concurent calls
Hi, Now that we have a working asterisk server, i'm looking toward cost optimization :) We are actually testing a SIP provider, which has an interessting limitation: each account support at max only two concurrent calls. My problem is how to combine multiple accounts and fail back to PSTN lines if all accounts are 'full'. I've added a "call-limit=2" in the sip.conf entry, but i dont really now how to use it in the dialplan. ChanIsAvail() was my first try but didn't work. I've tried chaining Dial() calls: Dial(SIP/line1/${EXTEN}) Dial(SIP/line2/${EXTEN}) ... but when an error condition occurs (busy/unavailable/whatever) it dial the same number on every line, which can take a while at the end. So, is there a way with the DIALSTATUS variable to detect a 'full' peer ? -- Benoit
Gordon Henderson
2008-Jun-05 15:52 UTC
[asterisk-users] handling SIP trunk with limited concurent calls
On Thu, 5 Jun 2008, benoit plessis wrote:> Hi, > > Now that we have a working asterisk server, i'm looking > toward cost optimization :) > > We are actually testing a SIP provider, which has an interessting > limitation: each account support at max only two concurrent calls. > > My problem is how to combine multiple accounts and fail back to PSTN > lines if all accounts are 'full'. I've added a "call-limit=2" in the > sip.conf entry, but i dont really now how to use it in the dialplan. > ChanIsAvail() was my first try but didn't work. > > I've tried chaining Dial() calls: > Dial(SIP/line1/${EXTEN}) > Dial(SIP/line2/${EXTEN}) > ... > but when an error condition occurs (busy/unavailable/whatever) it > dial the same number on every line, which can take a while at the end. > > So, is there a way with the DIALSTATUS variable to detect a 'full' peer > ?Yes. You need to check for CONGESTION. something like: n,Dial(SIP/line1/{EXTEN}) n,Noop(Dial line1 failed - we got ${DIALSTATUS}) n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?tryNext) n,Hangup n(tryNext),Dial(SIP/line2/${EXTEN}) But do check that the SIP provider does indeed return CONGESTION ... (You may not need the call-limit=2, if they check for you, then if at a later date, they increase the limit, then you don't need to change anything) Gordon