Summary:ASTERISK-03783: ChanISAvail not working properly
Reporter:Wojtek (virterm)Labels:
Date Opened:2005-03-27 07:20:19.000-0600Date Closed:2008-01-15 15:29:00.000-0600
Versions:Frequency of
Environment:Attachments:( 0) 20050327__test_chanisavail.diff.txt
Description:ChanISAvail is not working anymore, at least for IAX2 channels. The return code is always false and the priority taken is n+101. It used to work a month ago and it is still fine with 1.0.7

****** STEPS TO REPRODUCE ******

exten => _1416NXXXXXX,1,ChanIsAvail(IAX2/voipjet)
exten => _1416NXXXXXX,2,Dial,IAX2/blah@voipjet/${EXTEN}
exten => _1416NXXXXXX,102,ChanIsAvail(IAX2/NuFone)
exten => _1416NXXXXXX,103,Dial,IAX2/blah@NuFone/${EXTEN}
exten => _1416NXXXXXX,203,ChanIsAvail(IAX2/gafachi)
exten => _1416NXXXXXX,204,Dial,IAX2/blah@gafachi/${EXTEN}
exten => _1416NXXXXXX,304,Congestion
Comments:By: Clod Patry (junky) 2005-03-27 09:58:55.000-0600

It's not working for which version? latest CVS HEAD?
Can you provide any informations that would help us more on this bug?
At least, please past your ChanIsAvail line.

By: thecowstir (thecowstir) 2005-03-27 10:23:06.000-0600

I too am having the same problem.

I am trying to use this to check the status of my VoicePulse and NuFone IAX connections.

Here are the variables (slightly modified to protect the inocent) in extensions.conf:
TRUNK=SIP/volzsip00-pstn                        ; Trunk interface
TRUNK2=Zap/1                                    ; Trunk interface
TRUNKMSD=1                                      ; MSD digits to strip
MYNAME=<My Name>

Here is my test extensions (exten 7002 doesn't work, _9NXXXXX does work as the ZAP channel is available):
exten => _9NXXXXXX,1,ChanIsAvail(${TRUNK}&${TRUNK2})
exten => _9NXXXXXX,2,Cut(theChannel=AVAILCHAN,,1)
exten => _9NXXXXXX,3,Dial(${theChannel}/${EXTEN:${TRUNKMSD}})
exten => _9NXXXXXX,4,Hangup
exten => _9NXXXXXX,102,Congestion
exten => _9NXXXXXX,103,Hangup
exten => 7002,1,SetCallerID(${MYNUMBER})
exten => 7002,2,SetCIDName(${MYNAME})
exten => 7002,3,ChanIsAvail(${IAXTRUNK1})
exten => 7002,3,Dial(${IAXTRUNK1}/16417845401)
exten => 7002,4,Hangup
exten => 7002,104,ChanIsAvail(${IAXTRUNK2})
exten => 7002,105,Dial(${IAXTRUNK2}/16417845401)
exten => 7002,106,Hangup
exten => 7002,205,Congestion

Here is asterisk remote console logging for exten 7002:
   -- Executing SetCallerID("SIP/volzsip00-1-a129", "<phnumber>") in new stack
   -- Executing SetCIDName("SIP/volzsip00-1-a129", "<My Name>") in new stack
   -- Executing ChanIsAvail("SIP/volzsip00-1-a129", "IAX2/voicepulse1") in new stack
   -- Executing ChanIsAvail("SIP/volzsip00-1-a129", "IAX2/voicepulse2") in new stack
   -- Executing Congestion("SIP/volzsip00-1-a129", "") in new stack
 == Spawn extension (longdistance, 7002, 205) exited non-zero on 'SIP/volzsip00-1-a129'
   -- Executing Hangup("SIP/volzsip00-1-a129", "") in new stack
 == Spawn extension (longdistance, h, 1) exited non-zero on 'SIP/volzsip00-1-a129'

Here is the asterisk remote console logging for exten _9NXXXXXX:
   -- Executing ChanIsAvail("SIP/volzsip00-1-d8cc", "SIP/volzsip00-pstn&Zap/1") in new stack
   -- Hungup 'Zap/1-1'
   -- Executing Cut("SIP/volzsip00-1-d8cc", "theChannel=AVAILCHAN||1") in new stack
   -- Executing Dial("SIP/volzsip00-1-d8cc", "Zap/1/4144060") in new stack
   -- Called 1/4144060
   -- Zap/1-1 answered SIP/volzsip00-1-d8cc
   -- Hungup 'Zap/1-1'
 == Spawn extension (longdistance, 94144060, 3) exited non-zero on 'SIP/volzsip00-1-d8cc'
   -- Executing Hangup("SIP/volzsip00-1-d8cc", "") in new stack
 == Spawn extension (longdistance, h, 1) exited non-zero on 'SIP/volzsip00-1-d8cc'

I am Running on Suse 9.2 Pro with Kernel 2.6.8-24.13 (Suse provided Asterisk modules have been removed from /lib/modules/2.6.8-24.13-smp/extra/)

By: Tilghman Lesher (tilghman) 2005-03-27 11:17:49.000-0600

Could both of you having the problem apply this patch, recompile, and tell us if you receive any additional output?  This will help us determine which bit of code is not working within ChanIsAvail.

By: Wojtek (virterm) 2005-03-27 13:28:14.000-0600

It's not working as of yesterdays CVS HEAD.
Here is an example:
exten => _1416NXXXXXX,1,ChanIsAvail(IAX2/voipjet)
exten => _1416NXXXXXX,2,Dial,IAX2/blah@voipjet/${EXTEN}
exten => _1416NXXXXXX,102,ChanIsAvail(IAX2/NuFone)
exten => _1416NXXXXXX,103,Dial,IAX2/blah@NuFone/${EXTEN}
exten => _1416NXXXXXX,203,ChanIsAvail(IAX2/gafachi)
exten => _1416NXXXXXX,204,Dial,IAX2/blah@gafachi/${EXTEN}
exten => _1416NXXXXXX,304,Congestion

It always returns n+101. Obviously, the IAX channels have corresponding "qualify" statements in iax.conf

By: Mark Spencer (markster) 2005-03-27 17:08:10.000-0600

Fixed in CVS head.  Thanks.

By: Russell Bryant (russell) 2005-04-05 04:52:22

reporter indicated that this is not an issue for 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:29:00.000-0600

Repository: asterisk
Revision: 5282

U   trunk/apps/app_chanisavail.c

r5282 | markster | 2008-01-15 15:28:59 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix chanisavail typo that forced "state" mode (bug ASTERISK-3783)