(edited) Paging and ChanIsAvail

I am trying to develop a macro for paging multiple phones through the phone’s speaker. We have created a 2nd line on each phone that is the number 5 with the last 4 digits of that phone’s telephone number. The macro gets called with a list of TNs to page.

The macro loops through each argument and if the channel is on hook, it is added to the dial string, otherwise it is ignored. The reason for this is that we have found that the page application has weird results if a phone is off hook and is called with the page application.

The variable ${AVAILSTATUS} returns 0 whether the phone is on hook or off hook - ChanIsAvail doesn’t populate this variable correctly and I have since seen a bug report for this.

Does anyone have a suggestion on how to make this work? What I am looking for is a way to tell if a phone is off hook from a macro.

Here’s the extension calling the page macro:

exten =>51567,n,Macro(epage,SIP/5555555550,SIP/5555555551,SIP/5555555552,SIP/5555555553,SIP/5555555554,SIP/5555555555)

Here’s the macro (I have several Noops in there for debugging and the dial string building part isn’t in there yet):

exten => s,1,Noop(Start-Page-Macro)
exten => s,2,Set(DIALSTR="")
exten => s,3,Set(Count=1)
exten => s,4,While($[${LEN(${ARG${Count}})} > 0 ])
exten => s,5,Noop(${ARG${Count}})
exten => s,6,Noop(${LEN(${ARG${Count}})})
exten => s,7,ChanIsAvail(${ARG${Count}})
exten => s,n,Noop(${AVAILSTATUS})
exten => s,n,NoOp(NoOp(length of arg is ${LEN(${ARG${Count}})} )
exten => s,n,Gotoif($[${AVAILSTATUS} = 0]?avail:continue)
exten => s,n(avail),NoOp(put code to build dial string here)
exten => s,n(avail),Goto(continue)
exten => s,108,NoOp(Priority jumped! because channel doesnt exist)
exten => s,109,NoOp(length of arg is ${LEN(${ARG${Count}})} )
exten => s,110(continue),Set(Count=$[${Count} + 1])
exten => s,n(continue),EndWhile()
exten => s,n,Noop(${DIALSTR})
exten => s,n,Answer()
exten => s,n,Hangup()

Anyone have any suggestions? I added hints, but I don’t think that the hint information is available to a dialplan.

I am having the same problem. The people in #asterisk were generally not helpful in fixing this problem. There is a script on voip-info.org called Page.agi that essentially does what your macro does, however, it is not fully compatible with Asterisk 1.4 Since I don’t know Perl, I can’t figure out a way to edit the script.

I do believe ChanIsAvail is broken right now, but I don’t know how to properly search for a bug on Bugs.digium.com to see if it has been addressed.

Let me know if you figure anything out…


Has anyone found any solutions to this problem? It still exists in Asterisk 1.4.6!