ChanisAvail - Question on how to handle

Hi all

I am trying to apply an action based on the check if a channel is available.

My problem is that I don’t know what to expect on return.

For example, here is what I want to do

  1. Check if a channel is not in use first, if it is not, use it
  2. If all channels are not in use, find one where a global is not set on it and hang that line up and use it
  3. If all channels are global set, set to wait and play a message

Basically, I’m trying to do a 911 control in the system.

Right now, I have this working, but now, I need to check on multiple channels and I figure using a ChanIsAvail is going to be needed to walk through this, but first, I must look for an unused channel before dropping calls

exten => 955,1,Goto(emergcall,s,1)

exten => s,1,Set(GLOBAL(EMERGENCY)=0)
exten => s,2,Set(SET_EMERG_FLAG=0)
exten => s,3,GotoIf($[${GLOBAL(EMERGENCY)} = 1]?inprogress)
exten => s,4,SoftHangup(Zap/5,a)
exten => s,5,Set(GLOBAL(EMERGENCY)=1)
exten => s,6,Set(SET_EMERG_FLAG=1)
exten => s,7,Wait(2)
exten => s,8,Dial(Zap/5/5555555)
exten => s,9(inprogress),Congestion
exten => h,1,GotoIf($[${SET_EMERG_FLAG} = 1]?3)
exten => h,3,Set(GLOBAL(EMERGENCY)=0)