ChanIsAvail doesn't seem to be working

Hello all,

I’m running Asterisk 1.6.2.0. I’m attempting to use ChanIsAvail to determine if a SIP agent is currently peered with a PBX. The routine seems to be working, but it constantly returns true regardless of whether or not the agent is peered. I have it configured as follows:

exten => _3XX,1,ChanIsAvail(SIP/${EXTEN},sj) exten => _3XX,n,Dial(SIP/${EXTEN}) exten => _3XX,n,Hangup exten => _3XX,102,Goto(dundi_priv_lookup,${EXTEN},1) exten => _3XX,n,Dial(IAX2/iax/${EXTEN}) exten => _3XX,n,Hangup

According to the documentation, if it returns true, the routine will continue unfettered, however, if it returns false, it will jump to step 101+n. The DUNDi portion and IAX portion work fine by themselves (if I statically define where to route the call rather than relying on ChanIsAvail to tell me).

I went so far as to establish a test scenario where the PBX would simply play one sound if ChanIsAvail returned true and another if it returned false, I was never able to get it to play the sound associated with the latter. As far as I can tell, it returns true no matter what the circumstance is.

Has anybody seen this before? Thanks!

I was not able to get this working the way documentation suggests, I was able to find a workaround though. After much trial-and-error, I found that ChanIsAvail set the variable $AVAILSTATUS from null to 20 if the SIP device was not registered, and from null to 0 if it was registered (also contradictory to documentation). It did this reliably enough to write a GotoIf based on the $AVAILSTATUS.

So that’s what I ended up doing, and it works for me.