[asterisk-users] Dialplan, Extensions, etc. Worksheet

Roderick A. Anderson raanders at acm.org
Mon May 5 16:33:34 CDT 2008


Thank you Erik.  I'll use it for building my worksheets.  Small number 
of phones/extensions doing a very nice, minimal, batch of features.


Rod
--
info at tripple-o.nl wrote:
> Rod,
> 
> I've made a very basic dialplan for an Asterisk for beginners  
> presentati on a seminar kind of event  last year.
> 
> This are the config files involved:
> -/etc/asterisk/  
> extensions.conf                                          : the file  
> with the dialplan and the includings  of other files that are part of  
> the dialplan
> -/etc/asterisk/extensions.d/plaza_voiceprompts.conf  : a quick and  
> dirty routine to record and listen to your own voiceprompts
> -/etc/asterisk/ 
> sip.conf                                                          :  
> the file with the sip entries for the different sip phones
> - /etc/asterisk/ 
> voicemail.conf                                             : the  
> voicemail boxes for the different phones
> 
> 
> This is not a ready to go dialplan but (if I haven't made too many  
> typos translating the stuff from Dutch to English) for practicing it  
> will do I think. This is the scene:
> 
> A company with 4 phones, one for the reception and one for each  
> department (registration, communication and finance) Each phone has it  
> own context that sets the permissions for making calls (only internal,  
> national, international).  There is one phone number that can be  
> called and the caller wil enter a menu. If a department is chosen and  
> the phone isn't picked up after 10 seconds the reception phone will  
> ring. If the reception doesn't pick up the phone the call is  
> transfered to an external number and if this is picked up either the  
> caller can leave a message.   There is one incoming number that is  
> routed into a menu so the caller can make a choice.
> 
> The IAX2 trunk is just a fake. You have to configure a SIP, IAX2 or  
> ZAP trunk to be able to make or receive phone calls and adjust the  
> incoming number and adjust the Dial() line to your own trunk.
> 
> The voiceprompt routine is just a quick ad dirty but very handsome  
> routine to record your own voiceprompts and listen to them. The idea  
> is that you use a numbered list of the voiceprompts and adjust the  
> routine to that list. The hard part is to make the voiceprompts that  
> are used by the routine itself ("enter the voiceprompt number" and  
> "press 1 to make a recordig or 2 to listen") . Number 07 is "press 1  
> for recording or 2 for listening" and number 08 is "please enter the  
> voieprompt number".
> 
> The recordings are saved in /var/lib/asterisk/sounds/plaza but you can  
> change it to any directory you like as long as it is available.
> 
> 
> Don't panic if you don't understand all of it at once. This example  
> contains the most basic issues for making a dialplan:
> - menu
> - routing calls to phones
> - routing calls to voicemail boxes
> - number matching (routing calls based on the number dialed and/or the  
> cid of the one that makes an inbound call)
> - including contexts
> - including config files
> - set permissions on a per phones base
> - voicemail settings
> - parking of  a call (transfer a call to number 700, you hear a number  
> (f.i. 701) and you can call or shout to a co-worker that a call is  
> parked on 701, he/she
>    calls 701 and takes over the call) for the settings see /etc/ 
> asterisk/features.conf
> 
> 
> 
> There is much more to do and to learn but if you understand this  
> example I'm sure you will be able to make a very neat dialplan for  
> yourself. Succes!
> 
> 
> Erik de Wild
> Tripple-o
> Your Asterisk migration partner
> 
> 
>  >>>>>>>>>>>>>
> extensions.conf
> 
> [global]
> 
> 
> [general]
> ;
> ;
> 
> ;;;;;;;;;;;;;;;;
> ; this is just an example. every phone number has its own context with  
> its own permissions. With just a couple of phones this can be used
> ; in real life, otherwise you have to work with categories
> ;;;;;;;;;;;;;;
> 
> [5000]                                      ; reception
>   include => plaza_all_rights     ; the reception has permissions for  
> everything
> 
> 
> [5001]  ;                                       ; registration  
> department (internal and national outbound)
> include => plaza_intern
> include => plaza_outbound_nl
> 
> 
> [5002]                                      ; information department  
> (internal and national outbound)
> 
> include => plaza_intern
> include => plaza_outbound_nl
> 
> [5003]                                      ; financial department
> 
> include => plaza_intern       ; the finance guys/girls are just  
> allowed to make internal calls
> 
> 
> [plaza_all_rights]                   ; a context with all the  
> permissions included.
> include => plaza_intern
> include => plaza_outbound_nl
> include => plaza_outbound_int
> include => plaza_no_autorisation
> 
> 
> [plaza_intern]
> include => parkedcalls       ; this enables parking calls
> ;;;;;;;;;;;;;;;
> ;5000 =reception
> ;5001 = registration department
> ;5002 = information department
> ;5003 = financial department
> ;;;;;;;;;;;;;;;
> exten => _5XXX,1,Dial(SIP/${EXTEN}, 
> 20,rT)                              ; example number matching, only  
> wth 4 digits ad with the first dgit being a "5" this wil match
> exten => _5XXX,n(noanswer),n,Playback(plaza/no_answer)  ; a message  
> that the phone isn't answered
> exten => _5XXX,n,Hangup()
> 
> 
> exten => 6000/5000,1,Answer()                      ; ex girlfriend  
> extension example. Only the reception can  call the voiceprompt routine
> exten => 6000/5000,n,Goto(recording,s,1)   ; calling extension 6000
> 
> exten => 6001,1,Answer()                                 ; just to  
> test the proper working of music on hold
> exten => 6001,n,MusicOnHold()
> exten => 6001,n,Hangup()
> 
> #include "extensions.d/*.conf"       ; some additional .conf are in / 
> etc/asterisk/extensions.d/ just to keep the oversight of the dialplan  
> configuration
>                                                               ;  
> without ending up with one large extensions.conf
> 
> [plaza_inbound]
> 
> ;;;;;;;;;;;
> ; numbers don't exist anymore
> ;;;;;;;;;;;
> 
> exten => 0307114197,1,Answer()                                   ;  
> incoming line on number 0307114197
> exten => 0307114197,n,Goto(inbound_menu,s,1)      ; jump to menu
> 
> [inbound_menu]
> exten => s,1,BackGround(plaza/menu)         ; press 1 for reception, 2  
> fr registration department , 3 for info department
>                                                                                 ; or 
>   for for the fiancial department
> 			
> 
> ;;;;;;;;;;;;;;;;
> ;reception
> ;;;;;;;;;;;;;;;;			
> exten => 1,1,Dial(SIP/5000,10,t)
> exten => 1,n,Playback(plaza/no_answer)
> exten => 1,n,Hangup()			
> ;;;;;;;;;;;;;;;;
> ;registration department
> ;;;;;;;;;;;;;;;;					
> exten => 2,1,Dial(SIP/ 
> 5001,10,t)                                                 ; phone  
> 5001 rings for 10 seconds
> exten => 2,n,Dial(SIP/ 
> 5000,10,t)                                                 ;  phone  
> 5000 (reception) rings 10 seconden
> 
> exten => 2,n,Playback(plaza/external_transfer)                      ;
> exten => 2,n,Dial(IAX2/OOO50608 at OOO_plaza/0621831234,10,t)  ; using  
> iax2 trunk OOO50608 external number 0621831234 is called for 10 seconds
> 
> exten =>  
> 2 
> ,n 
> ,VoiceMail(5001)                                                     ;  
> if no phone answered the caller can leave a message in mailbox 5001
> exten => 2,n,Hangup()
> ;;;;;;;;;;;;;;;;
> ;information department
> ;;;;;;;;;;;;;;;;
> exten => 3,1,Dial(SIP/ 
> 5002,10,r)                                              ; phone rings  
> for 10 seconds;
> exten => 3,2,Dial(SIP/ 
> 5000,10,t)                                              ; phone of  
> reception rings for 10 seconds
> exten => 3,3,Dial(IAX2/OOO50608 at OOO_plaza/0621832345,10,t) sing iax2  
> trunk OOO50608 external number 0621832345 is called for 10 seconds
>   exten =>  
> 3,4 
> ,VoiceMail(5002)                                                  ;   
> no phone answered the callee can leave a message in mailbox 5002
> exten => 3,5,Hangup()
> 
> ;;;;;;;;;;;;;;
> ; finance department
> ;;;;;;;;;;;;;
> exten =>  
> 4,1 
> ,Voicemail(5003)                                                   ;  
> the finance guys/girl only communicate by voicemail
> exten => 4,2,Hangup()
> 
> 
> ; i = invalid
> 
> exten => i,1,Playback(plaza/ 
> invallid_input)                            ; when a digit other the 1,  
> 2, 3 or 4 is entered the input is invalid so "the invalid" message is  
> played
> exten => i,2,Goto,(s, 
> 1)                                                                 ;  
> and then the ibound call  returns back to the menu
> 
> ; t =  time-out
> exten => t,1,Playback(plaza/ 
> goodbye)                                    ; caller waited to long
> exten => t, 
> 3 
> ,Hangup 
>                                                                      ;  
> not very customer friendly but the line hangs up
> 
> [plaza_outbound_nl 
> ]                                                                   ;  
> only national outbound calls
> 
> exten => _0Z.,1,Dial(IAX2/OOO50608 at voop_plaza/${EXTEN},20,rt)  ; iax2  
> trunk OOO50608 calls out, be aware of the numbermatching _0Z.
> exten => _0Z., 
> 2 
> ,Hangup 
> ()                                                                               ; Z 
>   =[123456789]
> 
> [plaza_outbound_int]
> exten => _00Z.,1,Dial(IAX2/OOO50698 at voop_plaza/${EXTEN},20,rt) ;  
> number match _00X. allows international calls
> exten => _00Z.,2,Hangup()
> 
> [plaza_no_autorisation]
> exten => _X.,1,Playback(plaza/no_autorisation)  ; in case you enter a  
> number that doesn't fit any other available extension (depends on what  
> is included)
> exten => _X.,n,Hangup
> 
>  >>>>>>>>>>>>
> 
> /etc/asterisk/extension.d/plaza_voiceprompts.conf
> 
> ;;;;;;;;;;;;;;;
> ; Erik de Wild
> ; quick and dirty routine for recording Media Plaza demo voiceprompts
> ; 26-05-2007
> ;;;;;;;;;;;;;;;
> 
> [recording]
> exten => s,1,Read(VOICEPROMPT_NUMMER|plaza/voiceprompt_nummer|2| 
> noanswer|1|15)                    ; enter the voiceprompt number
> exten => s,n,Read(OPNEMEN_AFLUISTEREN|plaza/opnemen_afluisteren|1| 
> noanswer|1|15)                     ; OPNEMEN_AFLUSTEREN=LISTEN_RECORD
>                                                                                                                                                                                               ; press 
>   1 for recording or 2 for listening
> 
> exten => s,n,Macro(bestandsnaam,$ 
> {VOICEPROMPT_NUMMER 
> })                                                                     ; calling 
>   macro that finds the file name by the
>                                                                                                                                                                                               ; voiceprompt 
>   number
> exten => s,n,NoOp($ 
> {MACRO_RESULT 
> })                                                                                                                  ;
> exten => s,n,Macro(play_recording,${MACRO_RESULT},$ 
> {OPNEMEN_AFLUISTEREN})                             ; calling macro  
> that records or plays the choosen
>                                                                                                                                                                                               ; voiceprompt
> exten => s,n,Goto(s,1)
> 
> [macro-play_recording]
> ;;;;;;;;;;;
> ; ARG1 = file name
> ; ARG2 = 1 record 2 play
> exten => s,1,Goto(s-${ARG2}, 
> 1 
> )                                                                                                                                    ; goto 
>   the proper extension based on the choice
>                                                                                                                                                                                               ; between 
>   recording or playing
> 
> exten => s-1,1,Playback(beep)
> exten => s-1,n,Wait(1)
> exten => s-1,n,Playback(beep)
> exten => s-1,n,Record(plaza/$ 
> {ARG1 
> }:alaw 
> )                                                                                                              ; after 
>   2 beeps the recording starts
> 
> exten => s-2,1,Playback(plaza/$ 
> {ARG1 
> })                                                                                                                     ; the 
>   chosen file is played
> 
> 
> [macro-bestandsnaam]      ; this macro matches the voiceprompt number  
> with the voiceprompt file name. You can adjust this macro to your own  
> needs
> ;;;;;;;;;;;;;;;;;
> ; ARG1= number on the voiceprompt list
> ;;;;;;;;;;;;;;;;;
> 
> exten => s,1,Goto(s-${ARG1},1)
> 
> 
> exten => s-afspelen,1,Playback(plaza/${ARG1})
> exten => s-opnemen,1,Record(plaza/${MACRO_RESULT})
> 
> exten => s-01,1,Set(MACRO_RESULT=welkom)                      ; welcome
> exten => s-02,1,Set(MACRO_RESULT=menu)                          ;  
> Please press 1 for receptions, 2 for the registration department, 3  
> for communcation and 4 for
>                                                                               finance
> exten => s-03,1,Set(MACRO_RESULT=external_transfer)     ; the call  
> will be transfered to an external phone
> 
> exten => s-04,1,Set(MACRO_RESULT=invalid_input)             ; invalid  
> input
> exten => s-05,1,Set(MACRO_RESULT=goodbye)                    ; goodbye
> exten => s-06,1,Set(MACRO_RESULT=no_autorisation)        ; the number  
> you dialed doesn't exist or you do not have the proper permissions to  
> dial this
>                                                                                                                ; number
> exten => s-07,1,Set(MACRO_RESULT=record_listen)             ; press 1  
> for recording or 2 for listening
> exten => s-08,1,Set(MACRO_RESULT=voiceprompt_nummer) ; please enter  
> the voiceprompt number
> 
> exten => s-09,1,Set(MACRO_RESULT=not_answered)           ; the call is  
> not answered
> 
> exten => _s-ZX,1,Playback(plaza/invalid_input)     ; when the number  
> is not in the above list
> 
> 
>  >>>>>>>>>>>>>>>>>>>
> ;sip.conf
> ; the sip phones entries
> ; most phones will work with this setup I think
> ;;;;;;;;;;;;;;;;;;;;;
> 
> [5000]
> ;;;;;;;;;;;;;
> ; receptie
> ; sipura ata
> ;;;;;;;;;;;;;
> type=friend
> context=5000
> secret=plaza
> host=dynamic
> dtmfmode=rfc2833
> callerid="5000" <5000>
> disallow=all
> allow=alaw
> 
> [5001]
> ;;;;;;;;;;;
> ;afdeling registratie
> ; E61
> ;;;;;;;;;;;
> type=friend
> context=5001
> secret=plaza
> host=dynamic
> dtmfmode=rfc2833
> callerid="5001" <5001>
> disallow=all
> allow=alaw
> 
> [5002]
> ;;;;;;;;;;;;;;
> ;zyxel w2000 1
> ;;;;;;;;;;;;;
> type=friend
> context=5002
> secret=plaza
> dtmfmode=rfc2833
> host=dynamic
> callerid="5002" <5002>
> disallow=all
> allow=alaw
> 
> [5003]
> ;;;;;;;;;;;;;;;;
> ;zyxel w2000 2
> ;;;;;;;;;;;;;;;;
> type=friend
> username=5003
> context=5003
> secret=plaza
> dtmfmode=rfc2833
> host=dynamic
> callerid="5003" <5003>
> disallow=all
> allow=alaw
> 
> 
> ;>>>>>>>>>>>>>>>>
> 
> 
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list