Skip to content

Instantly share code, notes, and snippets.

@bertrand-lupart
Last active January 31, 2018 11:03
Show Gist options
  • Save bertrand-lupart/1757fb89b973c2a7dea4506a7cd1a00d to your computer and use it in GitHub Desktop.
Save bertrand-lupart/1757fb89b973c2a7dea4506a7cd1a00d to your computer and use it in GitHub Desktop.
Asterisk dialplan fragment to check span/group connectivity and voice quality from the asterisk console
; This dialplan fragment allow to dial a given number from the asterisk console on a given span :
; 1- check span ability to place a call
; 2- check logical group ability to place a call, as well as group allocation strategy
; 3- check caller ID presentation
; 4- check outgoing voice quality by announcing ${SYSTEMNAME} via speech synthesis
; 5- check incoming voice quality by Echo()'ing the called party
;
; Usage:
; $ sudo asterisk -rv
;
; acme-pbx*CLI> console dial 0123456789@span1
; ....
; acme-pbx*CLI> console hangup
;
; acme-pbx*CLI> console dial 0123456789@group1
; ....
; acme-pbx*CLI> console hangup
;
; Requirements :
;
; 0- current file should be #include'd from /etc/asterisk/asterisk.conf
;
; 1- ${SYSTEMNAME} should be defined, either :
; 1.1- autosystemname=yes in /etc/asterisk/asterisk.conf
; 1.2- systemname = acme-pbx in /etc/asterisk/asterisk.conf
; 1.3- SYSTEMNAME=acme-pbx (better in the [global] section of /etc/asterisk/extensions.conf)
;
; 2- ${SPAN1} should be defined
; 2.1- spans are configured in /etc/dahdi/system.conf - usually generated by dahdi_genconf(8)
; 2.2- SPAN1=DAHDI/i1 (better in the [global] section of /etc/asterisk/extensions.conf)
; DAHDI/i[/extension[/options]] :
; * i – ISDN span channel restriction.
;
; 3- ${GROUP1} should be defined
; 3.1- logical groups are defined in /etc/asterisk/chan_dahdi.conf
; 3.2- GROUP1=DAHDI/g1 (better in the [global] section of /etc/asterisk/extensions.conf)
; About group allocation strategy DAHDI/(g|G|r|R)[c|r|d][/extension[/options]] :
; * g – channel group allocation search forward
; * G – channel group allocation search backward
; * r – channel group allocation round robin search forward
; * R – channel group allocation round robin search backward
;
; 4- ${NUM_TEST_PRES} should be defined
; 4.1- NUM_TEST_PRES=0123456789 (better in the [global] section of /etc/asterisk/extensions.conf)
;
; Multiple span/group section can be factorized using a macro, left as an exercise to the reader
[span1]
exten => _X.,1,Noop()
same => n,Set(CALLERID(num)=${NUM_TEST_PRES})
same => n,Verbose(${CALLERID(num)} calls ${EXTEN} in ${CONTEXT})
same => n,Dumpchan()
same => n,Dial(${SPAN1}/${EXTEN},30,G(sayecho^${EXTEN}^1))
;[spanx]
;exten => _X.,1,Noop()
; same => n,Set(CALLERID(num)=${NUM_TEST_PRES})
; same => n,Verbose(${CALLERID(num)} calls ${EXTEN} in ${CONTEXT})
; same => n,Dumpchan()
; same => n,Dial(${SPANX}/${EXTEN},30,G(sayecho^${EXTEN}^1))
[group1]
exten => _X.,1,Noop()
same => n,Set(CALLERID(num)=${NUM_TEST_PRES})
same => n,Verbose(${CALLERID(num)} calls ${EXTEN} in ${CONTEXT})
same => n,Dumpchan()
same => n,Dial(${GROUP1}/${EXTEN},30,G(sayecho^${EXTEN}^1))
;[groupx]
;exten => _X.,1,Noop()
; same => n,Set(CALLERID(num)=${NUM_TEST_PRES})
; same => n,Verbose(${CALLERID(num)} calls ${EXTEN} in ${CONTEXT})
; same => n,Dumpchan()
; same => n,Dial(${GROUPX}/${EXTEN},30,G(sayecho^${EXTEN}^1))
[sayecho]
exten => _X.,1,Dumpchan()
same => n,Wait(2)
same => n,SayPhonetic(${SYSTEMNAME})
same => n,Echo()
same => n,Hangup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment