Page 162 - Asterisk™: The Future of Telephony
P. 162
exten => 2,n,Hangup()
exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(incoming,123,1)
exten => t,1,Playback(vm-goodbye)
exten => t,n,Hangup()
[employees]
exten => 101,1,Dial(Zap/1)
exten => 102,1,Dial(SIP/Jane)
In this example, we have added two new extensions to the [employees] context. This
way, the person using channel Zap/1 can pick up the phone and dial the person at
channel SIP/Jane by dialing 102. By that same token, the phone registered as SIP/
Jane can dial Zap/1 by dialing 101.
We’ve arbitrarily decided to use extensions 101 and 102 for our examples, but feel free
to use whatever numbering convention you wish for your extensions. You should also
be aware that you’re not limited to three-digit extensions; you can use as few or as many
digits as you like. (Well, almost. Extensions must be shorter than 80 characters long,
and you shouldn’t use single-character extensions for your own use, as they’re re-
served.) Don’t forget that you can use names as well, like so:
[incoming]
exten => 123,1,Answer()
exten => 123,n,Background(enter-ext-of-person)
exten => 123,n,WaitExten()
exten => 1,1,Dial(Zap/1,10)
exten => 1,n,Playback(vm-nobodyavail)
exten => 1,n,Hangup()
exten => 2,1,Dial(SIP/Jane,10)
exten => 2,n,Playback(vm-nobodyavail)
exten => 2,n,Hangup()
exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(incoming,123,1)
exten => t,1,Playback(vm-goodbye)
exten => t,n,Hangup()
[employees]
exten => 101,1,Dial(Zap/1)
exten => john,1,Dial(Zap/1)
exten => 102,1,Dial(SIP/Jane)
exten => jane,1,Dial(SIP/Jane)
It certainly wouldn’t hurt to add named extensions if you think your users might be
dialed via a VoIP protocol such as SIP that supports dialing by name. You can also see
134 | Chapter 5: Dialplan Basics