Question on dialplan - only works sometimes


#1

I’m running Asterisk 1.2.7 and using the following dialplan code in an attempt to control the number of simultaneous calls that can come in at one time. I like to be able to change this limit on the fly by simply editing the GROUP_COUNT line and reloading.

This seems to work, but only some of the time. Other times the limit seems to have no effect. Can anyone shed light on why that might be, suggest how to diagnose or maybe offer an alternate solution?

[incoming_exgn]
exten => 8001111111,1,Goto(iax_limit,s,1)
exten => 8001112222,1,Goto(iax_limit,s,1)

[iax_limit]
;check if limit is exceeded
exten => s,1,Set(GROUP()=exgn)
exten => s,2,GotoIf($[${GROUP_COUNT()} > 3]?333
exten => s,3, ring phones…

; Play busy and hangup if incoming limit is exceeded
exten => s,333,Answer
exten => s,334,Playtones(busy)
exten => s,335,Wait(5)
exten => s,336,Hangup


#2

what about using call-limit in sip.conf? as long as you have the type set to peer, it works great…

pre 1.2.3, there was a bug that wasn’t properly incrementing/decrementing the call-limit variable, but it’s working wonderfully now.


#3

I’m using IAX2 and not SIP - is there a similar option in IAX.conf?


#4

yes, i believe so…it wouldn’t make sense if there wasn’t.

it’s easy enough to test, try adding call-limit=1 to iax.conf for the device you’re using, reload, and try to make two concurrent calls at once…most likely, the second call will be rejected and you will get some info on the CLI (if you have verbosity turned up).