Summary:ASTERISK-05195: [patch] ChanIsAvail CVSHEAD not functining with option 's'
Reporter:Shane Spencer (whardier)Labels:
Date Opened:2005-09-29 21:40:32Date Closed:2011-06-07 14:10:07
Versions:Frequency of
Environment:Attachments:( 0) app_chanisavail_fixup_1-21.txt
Description:ChanIsAvail with option 's' never completed successfully when querying a not in use Sip phone devicestate (with ast_device_state()) which returns of course AST_DEVICE_NOT_INUSE (1).

Only if the device state is AST_DEVICE_UNKNOWN (0) which never will happen would it continue on with the 's' option enabled.

This quicky patch should be taken under concideration, or I need to be bullwhipped for possibly not understanding the ramifications of this simple change to allow it to work.  I suppose the author wanted it to continue if the variable 'inuse' were equal to AST_DEVICE_UNKNOWN, now it will continue if it equals AST_DEVICE_NOT_INUSE as well, which I assumed was the purpose of the 's' option. Now our non-interrupting intercomming works perfectly after this change has been made.


Index: apps/app_chanisavail.c
RCS file: /usr/cvsroot/asterisk/apps/app_chanisavail.c,v
retrieving revision 1.21
diff -r1.21 app_chanisavail.c
<                       if ((inuse < 1) && (tempchan = ast_request(tech, chan->nativeformats, number, &status))) {
>                       if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, number, &status))) {
Comments:By: Clod Patry (junky) 2005-10-04 18:42:22

reported said he faxed his disclaimer (Shane Spencer).

he's using app_chanisavail.c Rev 1.21.

By: Shane Spencer (whardier) 2005-10-04 19:15:22

This is the dialplan entry.. Even when the SNOM 360 or any phone is in the Available state it will never return AVAILSTATUS due to seemingly updated device status code not yet realized in app_chanisavail.c for the 's' option.

exten => _*[123]xxx,1,SipAddHeader(Call-Info:\; answer-after=0)
exten => _*[123]xxx,n,ChanIsAvail(Sip/${EXTEN:1}|s)
exten => _*[123]xxx,n,NoOp(${AVAILSTATUS})
exten => _*[123]xxx,n,Cut(ICHANNEL=AVAILCHAN,,1)
exten => _*[123]xxx,n,Dial(${ICHANNEL},12,Tt)
exten => _*[123]xxx,n,Hangup()
exten => _*[123]xxx,103,Busy(2)

By: twisted (twisted) 2005-10-17 23:32:57

You are correct...  we only will pass if were state 0, and should be fine at 1.

By: twisted (twisted) 2005-10-17 23:35:34

Fixed in CVS HEAD, Thanks!

By: Russell Bryant (russell) 2005-11-04 00:15:00.000-0600

This option is not present in 1.0