System information

exten => start,1,VoiceMail(${ARG1}@${ARG2},${ARG3})
same => n,Hangup()
In this version we’ve made just the one change: Return() to Return(${DIALSTATUS}).
Now we can modify extension 101 to use the ${GOSUB_RETVAL} channel variable, which
will be set by Return():
exten => 101,1,GoSub(subDialer,start,1(${JOHN},30))
same => n,Set(VoicemailMessage=${IF($[${GOSUB_RETVAL} = BUSY]?b:u)})
same => n,GoSub(subVoicemail,start,1(${EXTEN},default,${VoicemailMessage}))
Our dialplan now has a new line that sets the ${VoicemailMessage} channel variable to
a value of u or b, using the IF() dialplan function and the value of ${GOSUB_RETVAL}. We
then pass the value of ${VoicemailMessage} as the third argument to our subVoice
mail subroutine.
Before moving on, you might want to go back and review “Macros” on page 204
and“GoSub()” on page 207. We’ve given you a lot to digest here, but these concepts
will save you a lot of work as you start building your dialplans.
Local Channels
Local channels are a method of executing dialplans from the Dial() application. They
may seem like a bit of a strange concept when you first start using them, but believe us
when we tell you they are a glorious and extremely useful feature that you will almost
certainly want to make use of when you start writing advanced dialplans. The best way
to illustrate the use of Local channels is through an example. Let’s suppose we have a
situation where we need to ring multiple people, but we need to provide delays of
different lengths before dialing each of the members. The use of Local channels is the
only solution to the problem.
With the Dial() application, you can certainly ring multiple endpoints, but all three
channels will ring at the same time, and for the same length of time. Dialing multiple
channels at the same time is done like so:
[LocalSets]
exten => 107,1,Verbose(2,Dialing multiple locations simultaneously)
same => n,Dial(SIP/0000FFFF0001&DAHDI/g0/14165551212&SIP/MyITSP/12565551212,30)
same => n,Hangup()
This example dials three destinations for a period of 30 seconds. If none of those lo-
cations answers the call within 30 seconds, the dialplan continues to the next line and
the call is hung up.
However, let’s say we want to introduce some delays, and stop ringing locations at
different times. Using Local channels gives us independent control over each of the
channels we want to dial, so we can introduce delays and control the period of time for
which each channel rings independently. We’re going to show you how this is done in
the dialplan, both within a table that shows the delays visually, and all together in a
Local Channels | 211