Limit to 1 call with BUSY signal. ChanIsAvail() not working


I’m using SIP phones and limit them to make only 1 outbound call at a time. I set in In sip.conf I set call-limit = 1.

The problem is Asterisk doesn’t send proper signals to the caller:

  • busy when busy
  • some connection error when phone disconnected

call-limit = 1 limits also inbound calls and when phone is busy for all inbound calls I get an error:

NOTICE[14861] chan_sip.c: Call to peer 'XXX' rejected due to usage limit of 1 VERBOSE[14861] app_dial.c: -- Couldn't call SIP/XXX VERBOSE[14861] app_dial.c: == Everyone is busy/congested at this time (0:0/0/0)and variable ${DIALSTATUS} = CHANUNAVAIL, not BUSY. Caller gets connection error message instead of simple busy tone.

If I check for ${DIALSTATUS}=CHANUNAVAIL and use Busy(10) command in dialplan I get wrong signal when SIP phone is disconnected (busy instead of connection error).

I thought of checking peer status before Dial() command with ChanIsAvail() but it doesn’t work for me at all.
ChanIsAvail(SIP/XXX) always sets ${AVAILSTATUS} = 0 when peer is available, busy, disconnected or congested (by call-limit).


[XXX] type = friend context = from-local callerid = "Wywolanie" <XXX> call-limit = 1 username = XXX secret = gay dtmfmode = rfc2833 host = dynamic nat = yes qualify = yes qualifyfreq = 60 deny = permit =
Version: Asterisk

You can check the extension status prior to dialing it with a function DEVICE_STATE(SIP/peer).
Once you have this information, you can route the call accordingly.