B.17. ChanIsAvail()

Indicates whether the specified channel is available.
Verifies that the one or more of the queried channels is available, in the order specified. Returns 0 on success or -1 on failure.
If the s (state) option is given, Asterisk will treat the channel as unavailable if it is in use, even if it is capable of taking another call. Option j sets priority jumping to n+101 if the channel is unavailable.


The mere fact of a channel being available does not automatically mean that it is free for use or that the device on the channel will accept a call. That is determined using a Dial() to the channel.
ChanIsAvail() sets the following channel variables:
The name of the accessible channel, including the session number of the call.
The canonical channel name (i.e., the channel name without session number).
Status code of the channel:
Status of the channel is unknown. It is a valid channel, but we don't know about its state.
The channel is not in use.
The channel is in use.
The channel is busy.
The channel is unknown.
The channel is not available and not registered.
The channel is ringing.


This application does not behave as expected on MGCP channels.
; Check the availability of Zap/1 and Zap/2:
exten => 123,1,ChanIsAvail(Zap/1&Zap/2,j)
; As an exception, using priority jumping, because we want to announce
; something to the caller if no channel is available

; at least one channel is available - dial this channel:
exten => 123,2,NoOp(${AVAILORIGCHAN} is available)
exten => 123,3,Dial(${AVAILORIGCHAN}/123456)

; if the call goes to priority 102 landen, neither Zap/1 nor Zap/2 is available
exten => 123,102,Playback(all-channels-busy)


Internal help for this application in Asterisk 1.4:
  -= Info about application 'ChanIsAvail' =- 

Check channel availability

This application will check to see if any of the specified channels are
available. The following variables will be set by this application:
  ${AVAILCHAN}     - the name of the available channel, if one exists
  ${AVAILORIGCHAN} - the canonical channel name that was used to create the channel
  ${AVAILSTATUS}   - the status code for the available channel
    s - Consider the channel unavailable if the channel is in use at all
    j - Support jumping to priority n+101 if no channel is available
diff output to internal help in Asterisk 1.2:
- none -