Код: Выделить всё
*CLI> core show application ChanIsAvail
-= Info about application 'ChanIsAvail' =-
[Synopsis]
Check channel availability
[Description]
This application will check to see if any of the specified channels are
available.
This application sets the following channel variables:
${AVAILCHAN}: The name of the available channel, if one exists
${AVAILORIGCHAN}: The canonical channel name that was used to create the
channel
${AVAILSTATUS}: The device state for the device
${AVAILCAUSECODE}: The cause code returned when requesting the channel
[Syntax]
ChanIsAvail([Technology2/Resource2[&...]][,options])
[Arguments]
Technology2/Resource2
Optional extra devices to check
If you need more than one enter them as Technology2/Resource2&Technology3/R
source3&.....
Technology/Resource
Specification of the device(s) to check. These must be in the format of
'Technology/Resource', where <Technology> represents a particular channel
driver, and <Resource> represents a resource available to that particular
channel driver.
options
a: Check for all available channels, not only the first one
s: Consider the channel unavailable if the channel is in use at all
t: Simply checks if specified channels exist in the channel list
Код: Выделить всё
[dial-cell]
exten => _X.,1,NoOp()
same => n,Set(LINE=${RAND(1,5)})
same => n,Goto(line${LINE})
same => n(line1),GotoIF($[ "${DEVICE_STATE(SIP/goip9-12)}" != "NOT_INUSE" ]?d2)
same => n(d1),Dial(SIP/goip9-12/12${EXTEN},60)
same => n,Hangup
same => n(line2),GotoIF($[ "${DEVICE_STATE(SIP/goip9-13)}" != "NOT_INUSE" ]?d3)
same => n(d2),Dial(SIP/goip9-13/13${EXTEN},60)
same => n,Hangup
same => n(line3),GotoIF($[ "${DEVICE_STATE(SIP/goip9-14)}" != "NOT_INUSE" ]?d4)
same => n(d3),Dial(SIP/goip9-14/14${EXTEN},60)
same => n,Hangup
same => n(line4),GotoIF($[ "${DEVICE_STATE(SIP/goip9-15)}" != "NOT_INUSE" ]?d5)
same => n(d4),Dial(SIP/goip9-15/15${EXTEN},60)
same => n,Hangup
same => n(line5),GotoIF($[ "${DEVICE_STATE(SIP/goip9-16)}" != "NOT_INUSE" ]?d1)
same => n(d5),Dial(SIP/goip9-16/16${EXTEN},60)
same => n,Hangup