Asterisk 1.8 multiple sip trunk connections to same provider

Hi, I have a new install of Asterisk 1.8. The server I am using has 4 network connections
1-LAN
2-Wan1
3-Wan2
4-Wan3

Each wan connection is a dedicated DSL connection for voice. The reason there are 3 is the amount of simultaneous calls required will need more bandwidth then 1dsl connection can handle. We would usually drop in a T1 or fiber, but these option are not available at this site. I would like to start by grabbing trunks from connection 4 then 3 then 2. I would like to set a call limit of 8 call per connection. I was looking at the SIP/devicename/Extension/IPorHost option in 1.8, but am not exactly sure how it works. Since my Sip provider gateway address will be the same for all 3 trunks how can I specify which gateway to use for calls based on a call-limit.

The provider says for inbound they will deliver calls via connection 1 and one they receive a “busy here” from asterisk they will move to connection 2 and then 3
I need some help with a sample sip.conf and extensions.conf.

Thank you,
Chris

A better approach would be to handle this at the IP level and bind the connections together. A good ISP should be able to do this from their end. I’m fairly sure that Linux has some support, but have never investigated it.

Hi David55,
Are you referring to MLPPP bonded DSL? If so where this location is we are not able to get that service.

You could just track the calls with a variable, if one comes in, it gets incremented upward, then wherever it gets hungup, you decrement the var again, so you’d do an “execif” to check if the variable on new calls coming in, and to send a busy signal if it’s 8 or more.

alternatively you could set a cron-job running every minute (or less) to do a “core show channels”, then do a few greps to find out how many calls have come in on each trunk, and then to set a var that’s checked by each trunk to let it through or send a busy signal back.

1st ways easier as you do everything in the dialplan, but harder depending how big your dialplan is, 2nd ways not as accurate, but you won’t have to worry about catching the hangup in your dialplan.
*you could do both, with the 2nd way as a fail-safe

Hi Riva_00,
Thank you. How would I solve the outgoing calls out multiple links to the same sip gateway. I was thinking of using the call-limit option in sip.conf for the limit of calls per link. But my issue is specifying which link to use once the first link is full.

Thank you,
Chris

You’d do the same thing but in reverse, so as a rough sketch you’d noop the number to debug (i know i never get it right 1st time), then take the var and increment in the dialplan according to what trunk your dialing, then decrement in the hangup (h), not sure about this, but you may want to put the increment of the var in a sub or macro within “Dial” to execute once the called channel answers, depending on your preference.

so, very roughly :smile:, something like this

exten => s,1,NoOp(var of outgoing calls on this trunk -trunk1- = ${trunk1var})
***if trunk1var is less or equal to 7, goto dialtrunk1 label, if not then keep going
exten => s,n,Execif($["${trunk1var}" <= “7”]?Goto(dialtrunk1))
***if trunk2var is less or equal to 7, goto dialtrunk2 label, if not then keep going
exten => s,n,Execif($["${trunk2var}" <= “7”]?Goto(dialtrunk2))
exten => s,n,NoOp(No trunks to dial out from)
*****if no trunks available, might want to playback something
exten => s,n,Playback(notrunks)
exten => s,n,Hangup()

***set the trunk your dialing out from for use in the “h” context
exten => s,n(dialtrunk1),Set(trunkyvar=trunk1var)
***set the “trunk1var” to +1
exten => s,n,Set($[${trunk1var} + 1])
***dial trunk 1
exten => s,n,Dial(Tech(trunk1)/Num)

***check the trunk1var number, and the var your decrementing
exten => h,1,NoOp(Decrementing ${trunkyvar} - currently at ${trunk1var})
***-1 the trunk var
exten => h,n,Set($["${trunk1var}" - “1”])