Channel Status in Asterisk 1.8


I am using an asterisk install for paging system in conjunction with two line ATAs, Viking auto answer devices attached to loudspeakers and analogue phone stations. I have the system configured so that the vikings are paged when an extension in the 200-210 range is dialed and if extension in the 100-110 range is dialed it goes to one of the phone stations. I would like to have it so if say 200 (a viking with a loudspeaker) is dialed and 100 (the phone at the same location as the loudspeaker) is in use–the call will not be routed to 200. I have tried using ChanIsAvail() on 100 and a GotoIf on the ${AVAILSTATUS} but that is not working. I have also tried using SIPPEER. Does anyone have a suggestion of how to accomplish this?

Thank you

You need to set call limits to get in use statuses (I’m not sure that IsAvail is the right test, either).

By default, Asterisk assumes that SIP end points can take indefinitely large numbers of simultaneous calls (there is no distinction between trunk and extension in SIP and extensions might allow many held calls).

I have read conflicting information on ChanIsAvail() and it is supposed to expose a variable with the status of a channel. But the variable contains what seems to be an identifier for the channel–it is a string of numbers and is the same each time. The documentation says this problem is fixed in 1.8 and it is supposed to expose two variables–one that holds the string and one that holds the status code. but it seems to still be overwritten. I tried to use SIPPEER after I set limits for each sip channel but that is not working either. I am about to just write an AGI script in perl to set the output of sip show channels to an array and check teh status that way. I do not want to as this will be terribly inefficient. Do you have any suggestions?

I would have used ${DEVICE_STATE()}. My original confusion is that the UNAVAILABLE state is not the same as BUSY or INUSE.

Like this?

exten => 200,1,Set(inuse=${DEVICE_STATE(SIP/100)})
exten => 200,n,GotoIf($[${inuse} = NOT_INUSE]?Page(SIP/200))
exten => 200,n,Hangup()

ExecIf I mean. and it does work as expected. Thanks for the tip!