Hi guys
I have scenario in which i have 2 SIP Trunks for outbound calling.
Each Trunk is limited at the far end to only allow 60 calls max (at call 61 it fails)
Now my current setup allows to dial out via these 2 Trunks after first checking if they are UP/Available
so if one trunk is down it will Dynamically chose the other trunk.
This is working perfectly.
What I need now is the ability to check the status of each trunk before attempting to call out on it, but also check if the trunk currently has 60 or less calls on it, if the trunk reaches 60 calls, it should be marked as busy/unavailable and my dial plan should then dynamically chose the second trunk.
I am kind of new to dial plans in Asterisk which seem very programtical (and I’m not a programmer ) and I’m struggling to work out the logic to implement this.
It would be extremely helpful if i could get some working examples of how to achieve this.
My current sip.conf (stripped down to just include a single Extension and my 2 Trunks)
[1100]
secret=123456
context=local
callerid=1100
type=friend
host=dynamic
nat=force_rtport,comedia
transport=tcp,udp
[trunk_1] ; Max allowed calls 60
type=peer
host=10.10.10.10
canreinvite=no
allow=all
qualify=yes
insecure=port,invite
autocreatepeer=yes
context=incoming
[trunk_2] ; Max allowed calls 60
type=peer
host=10.10.10.11
canreinvite=no
allow=all
qualify=yes
insecure=port,invite
autocreatepeer=yes
context=incoming
and my current extensions.conf
; Context for incoming calls
[incoming]
exten => _X.,1,Dial(SIP/${EXTEN},300)
exten => _X.,n,Congestion(10)
; Context for outgoing calls
[local]
exten => _X.,1,GotoIf($[${DB_EXISTS(SIP/Registry/${EXTEN})}]?10:15)
exten => _X.,10,Dial(SIP/${EXTEN},300)
exten => _X.,15,ChanIsAvail(SIP/trunk_cucm1&SIP/trunk_cucm2)
exten => _X.,16,Set(AVAILCHAN=${CUT(AVAILCHAN,-,1)})
exten => _X.,17,Dial(${AVAILCHAN}/${EXTEN},300)
exten => _X.,n,Congestion(10)
Many thanks