How to Create an Asterisk Dialplan Context on Debian 12
To Create An Asterisk Dialplan Context On Debian 12
The Dialplan is truly the heart of any Asterisk system, as it defines how Asterisk handles inbound and outbound calls. In a nutshell, it consists of a list of instructions or steps that Asterisk will follow. Unlike traditional phone systems, Asterisk’s Dialplan is fully customizable. To successfully set up your own Asterisk system, you will need to understand the Dialplan.
Creation Steps:
Step 1: Check the System OS version by using following command.
root@ linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
Step 2: Go to the following Location by using following command.
root@ linuxhelp:~# cd /etc/asterisk/
Step 3: Edit the extensions.conf file for create dialplan context by using following command.
root@ linuxhelp:/etc/asterisk# vim extensions.conf
Step 4: Login to the Asterisk Console by using following command.
root@ linuxhelp:/etc/asterisk# sudo asterisk -rvvvvvvvvvvvvvvv
Asterisk 20.4.0, Copyright (C) 1999 - 2022, Sangoma Technologies Corporation and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 20.4.0 currently running on debian (pid = 930)
linuxhelp *CLI>
Step 5: Reload the Dialplan by using following command.
linuxhelp *CLI> dialplan reload
Dialplan reloaded.
== Setting global variable 'CONSOLE' to 'Console/dsp'
== Setting global variable 'IAXINFO' to 'guest'
== Setting global variable 'TRUNK' to 'DAHDI/G2'
== Setting global variable 'TRUNKMSD' to '1'
-- Including switch 'DUNDi/e164' in context 'dundi-e164-switch'
-- Including switch 'Lua/' in context 'local'
-- Including switch 'Lua/' in context 'demo'
-- Including switch 'Lua/' in context 'public'
-- Including switch 'Lua/' in context 'default'
-- Including switch 'DUNDi/e164' in context 'ael-dundi-e164-switch'
-- Time to scan old dialplan and merge leftovers back into the new: 0.000536 sec
-- Time to restore hints and swap in new dialplan: 0.000005 sec
-- Time to delete the old dialplan: 0.000089 sec
-- Total time merge_contexts_delete: 0.000630 sec
-- pbx_config successfully loaded 51 contexts (enable debug for details).
[Sep 6 21:06:05] WARNING[2785]: pbx.c:8797 ast_context_verify_includes: Context 'local' tries to include nonexistent context 'iaxtel700'
Step 6: Make a call from one extension to another extension by using softphone softwares as shown in below image.
Step 7: Able to see the dialplan context on asterisk console as shown in below image.
Step 8: Go to the asterisk default sound location by using following command.
root@ linuxhelp:/etc/asterisk# cd /var/lib/asterisk/sounds/en
Step 9: list the files and copy any one sound file name by using following command.
root@ linuxhelp:/var/lib/asterisk/sounds/en# ls
1-for-am-2-for-pm.alaw
1-for-am-2-for-pm.g722
1-for-am-2-for-pm.g729
1-for-am-2-for-pm.gsm
1-for-am-2-for-pm.siren14
1-for-am-2-for-pm.siren7
1-for-am-2-for-pm.sln16
1-for-am-2-for-pm.ulaw
1-for-am-2-for-pm.wav
1-yes-2-no.alaw
1-yes-2-no.g722
1-yes-2-no.g729
1-yes-2-no.gsm
1-yes-2-no.siren14
1-yes-2-no.siren7
1-yes-2-no.sln16
1-yes-2-no.ulaw
Step 10: Edit the extensions.conf file for insert the sound file name inside of the playback application using following command.
root@ linuxhelp:/var/lib/asterisk/sounds/en# vim /etc/asterisk/extensions.conf
Step 11: Go to Asterisk console and Reload the Dialplan by using following command.
root@ linuxhelp:~# sudo asterisk -rvvvvvvvvvvvvvvv
Asterisk 20.4.0, Copyright (C) 1999 - 2022, Sangoma Technologies Corporation and others.
Created by Mark Spencer
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 20.4.0 currently running on debian (pid = 930)
linuxhelp *CLI>
linuxhelp*CLI> dialplan reload
Dialplan reloaded.
== Setting global variable 'CONSOLE' to 'Console/dsp'
== Setting global variable 'IAXINFO' to 'guest'
== Setting global variable 'TRUNK' to 'DAHDI/G2'
== Setting global variable 'TRUNKMSD' to '1'
-- Including switch 'DUNDi/e164' in context 'dundi-e164-switch'
-- Including switch 'DUNDi/e164' in context 'ael-dundi-e164-switch'
-- Including switch 'Lua/' in context 'default'
-- Including switch 'Lua/' in context 'public'
-- Including switch 'Lua/' in context 'demo'
-- Including switch 'Lua/' in context 'local'
-- Time to scan old dialplan and merge leftovers back into the new: 0.000529 sec
-- Time to restore hints and swap in new dialplan: 0.000004 sec
-- Time to delete the old dialplan: 0.000088 sec
-- Total time merge_contexts_delete: 0.000621 sec
-- pbx_config successfully loaded 51 contexts (enable debug for details).
[Sep 6 21:07:33] WARNING[2792]: pbx.c:8797 ast_context_verify_includes: Context 'local' tries to include nonexistent context 'iaxtel700'
Step 12: Again Make a call from one extension to another extension by using softphone softwares as shown in below image.
Step 13: Able to hear the sound after the call automatically ended and Able to see the dialplan context on asterisk console as shown in below image.
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to Create Dial plan Context on Debian 12. Your feedback is much welcome.