• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Create Asterisk Dialplan Context

  • 00:32 lsb_release -a
  • 00:52 systemctl status asterisk
  • 01:27 asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvv
  • 01:35 pjsip show endpoints
  • 02:23 vim /etc/asterisk/extensions.conf
  • 04:56 asterisk -rvvvvvvvvvvvvvvvvvvv
  • 05:07 dialplan reload
  • 07:01 cd /var/lib/asterisk/sounds/en
  • 07:06 ls
7598

To create Asterisk Dialplan Context

Introduction:

Asterisk Dialplans are responsible for routing calls, so they are often called the system's heart. The Dialplan is written using a scripting language, so it is incredibly powerful. Asterisk is far more than just a phone system capable of accepting and connecting calls.

Installation Steps:

Step 1: Check the OS version by using the below command

root@linuxhelp1:~# lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:    22.04
Codename:    jammy

Step 2 : Check the status of the Asterisk by using the below command

root@linuxhelp1:~# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: active (running) since Thu 2023-07-20 10:32:35 IST; 9h ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 74 (limit: 4537)
     Memory: 139.0M
        CPU: 5min 27.132s
     CGroup: /system.slice/asterisk.service
             └─17969 /usr/sbin/asterisk

Jul 20 10:32:35 linuxhelp1 systemd[1]: Starting LSB: Asterisk PBX...
Jul 20 10:32:35 linuxhelp1 asterisk[17956]:  * Starting Asterisk PBX: asterisk
Jul 20 10:32:35 linuxhelp1 asterisk[17956]:    ...done.
Jul 20 10:32:35 linuxhelp1 systemd[1]: Started LSB: Asterisk PBX.
Jul 20 10:32:36 linuxhelp1 asterisk[17969]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusc>
Jul 20 10:32:36 linuxhelp1 asterisk[17969]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusc>

Step 3 : Login to the Asterisk CLI mode by using the below command

root@linuxhelp1:~# asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvv
Asterisk 20.3.1, 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.3.1 currently running on linuxhelp1 (pid = 17969)

Step 4 : Show the endpoints by using the below command

linuxhelp1*CLI> pjsip show endpoints

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  167/167                                              Not in use    0 of inf
     InAuth:  167/167
        Aor:  167                                                1
      Contact:  167/sip:167@192.168.6.101:51508;transport= c4d06cbc16 Avail         1.257
  Transport:  tcp_transport             tcp      3     96  0.0.0.0:5060

 Endpoint:  168/168                                              Not in use    0 of inf
     InAuth:  168/168
        Aor:  168                                                1
      Contact:  168/sip:168@192.168.6.101:51507;transport= 04e351bc0d Avail         0.881
  Transport:  tcp_transport             tcp      3     96  0.0.0.0:5060

 Endpoint:  169/169                                              Not in use    0 of inf
     InAuth:  169/169
        Aor:  169                                                1
      Contact:  169/sip:169@192.168.6.101:51796;transport= bf4652f8f3 Avail         0.974
  Transport:  tcp_transport             tcp      3     96  0.0.0.0:5060


Objects found: 3

Step 5 : Exit from the Asterisk CLI mode by using the below command

Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups

Step 6: Edit the extensions.conf file to modify the dialplan

root@linuxhelp1:~# vim /etc/asterisk/extensions.conf

Step 7: Again login to the Asterisk CLI mode

root@linuxhelp1:~# asterisk -rvvvvvvvvvvvvvvvvvvv
Asterisk 20.3.1, 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.3.1 currently running on linuxhelp1 (pid = 17969)

Step 8 : Reload the Dialplan by using the below command

linuxhelp1*CLI> dialplan reload
Dialplan reloaded.
    -- Including switch 'Lua/' in context 'public'
    -- Including switch 'Lua/' in context 'demo'
    -- Including switch 'Lua/' in context 'local'
    -- 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.001776 sec
    -- Time to restore hints and swap in new dialplan: 0.000063 sec
    -- Time to delete the old dialplan: 0.000103 sec
    -- Total time merge_contexts_delete: 0.001942 sec
    -- pbx_config successfully loaded 27 contexts (enable debug for details).


    -- Executing [167@internal:1] NoOp("PJSIP/169-00000057", "Call started for 167") in new stack
    -- Executing [167@internal:2] Dial("PJSIP/169-00000057", "PJSIP/167,10") in new stack
    -- Called PJSIP/167
    -- PJSIP/167-00000058 is ringing
    -- Nobody picked up in 10000 ms
    -- Executing [167@internal:3] Playback("PJSIP/169-00000057", "") in new stack
[Jul 20 20:24:31] WARNING[27422][C-00000026]: app_playback.c:464 playback_exec: Playback requires an argument (filename)
  == Spawn extension (internal, 167, 3) exited non-zero on 'PJSIP/169-00000057'

Step 9: Exit from the Asterisk CLI mode by using the below command

Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups

Step 10: Move to the directory to find the sounds for playback by using the below command

root@linuxhelp1:~# cd /var/lib/asterisk/sounds/en
root@linuxhelp1:/var/lib/asterisk/sounds/en#
root@linuxhelp1:/var/lib/asterisk/sounds/en#
root@linuxhelp1:/var/lib/asterisk/sounds/en# ls
1-for-am-2-for-pm.alaw                       north.siren14
1-for-am-2-for-pm.g722                       north.siren7
1-for-am-2-for-pm.g729                       north.sln16
1-for-am-2-for-pm.gsm                        north.ulaw
1-for-am-2-for-pm.siren14                    north.wav
1-for-am-2-for-pm.siren7                     not-auth-pstn.alaw
1-for-am-2-for-pm.sln16                      not-auth-pstn.g722
1-for-am-2-for-pm.ulaw                       not-auth-pstn.g729
1-for-am-2-for-pm.wav                        not-auth-pstn.gsm
1-yes-2-no.alaw                              not-auth-pstn.siren14
1-yes-2-no.g722                              not-auth-pstn.siren7
1-yes-2-no.g729                              not-auth-pstn.sln16
1-yes-2-no.gsm                               not-auth-pstn.ulaw
1-yes-2-no.siren14                           not-auth-pstn.wav
1-yes-2-no.siren7                            not-enough-credit.alaw
1-yes-2-no.sln16                             not-enough-credit.g722
1-yes-2-no.ulaw                              not-enough-credit.g729
1-yes-2-no.wav                               not-enough-credit.gsm
abandon-all-hope.alaw                        not-enough-credit.siren14
abandon-all-hope.g722                        not-enough-credit.siren7
abandon-all-hope.g729                        not-enough-credit.sln16
abandon-all-hope.gsm                         not-enough-credit.ulaw
abandon-all-hope.siren14                     not-enough-credit.wav
abandon-all-hope.siren7                      nothing-recorded.alaw
abandon-all-hope.sln16                       nothing-recorded.g722

Step 11: Add any of the above sound to the extensions.conf file to add the playback sound to the channel by using the below command

root@linuxhelp1:/var/lib/asterisk/sounds/en# vim /etc/asterisk/extensions.conf

Step 12 : Login to the Asterisk CLI mode and reload the Dialplan by using the below command

root@linuxhelp1:/var/lib/asterisk/sounds/en# asterisk -rvvvvvvvvvvvvvvvvvvv
Asterisk 20.3.1, 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.3.1 currently running on linuxhelp1 (pid = 17969)

linuxhelp1*CLI> dialplan reload
Dialplan reloaded.
    -- Including switch 'DUNDi/e164' in context 'ael-dundi-e164-switch'
    -- Including switch 'Lua/' in context 'default'
    -- Including switch 'Lua/' in context 'local'
    -- Including switch 'Lua/' in context 'demo'
    -- Including switch 'Lua/' in context 'public'
    -- Time to scan old dialplan and merge leftovers back into the new: 0.005825 sec
    -- Time to restore hints and swap in new dialplan: 0.000022 sec
    -- Time to delete the old dialplan: 0.000652 sec
    -- Total time merge_contexts_delete: 0.006499 sec
    -- pbx_config successfully loaded 27 contexts (enable debug for details).

Messages while the call from one extension to another

    -- Executing [167@internal:1] NoOp("PJSIP/169-00000059", "Call started for 167") in new stack
    -- Executing [167@internal:2] Dial("PJSIP/169-00000059", "PJSIP/167,10") in new stack
    -- Called PJSIP/167
    -- PJSIP/167-0000005a is ringing
    -- Nobody picked up in 10000 ms
    -- Executing [167@internal:3] Playback("PJSIP/169-00000059", "you-must-first-dial") in new stack
       > 0x7fb13c069630 -- Strict RTP learning after remote address set to: 192.168.6.101:4068
    -- <PJSIP/169-00000059> Playing 'you-must-first-dial.ulaw' (language 'en')
       > 0x7fb13c069630 -- Strict RTP switching to RTP target address 192.168.6.101:4068 as source
    -- Executing [167@internal:4] Hangup("PJSIP/169-00000059", "") in new stack
  == Spawn extension (internal, 167, 4) exited non-zero on 'PJSIP/169-00000059'

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to create Asterisk Dialplan context. Your feedback is much welcome.

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

Where is Asterisk dialplan located?

A

/etc/asterisk/extensions.conf

Q

What is the Asterisk dialplan for internal calls?

A

The Asterisk dialplan is responsible for routing calls, so it is often referred to as the heart of an Asterisk system.

Q

How to load dialplan in Asterisk?

A

If you change the dialplan, you can use the Asterisk CLI command "dialplan reload" to load the new dialplan without disrupting service in your PBX.

Q

What is the application to hangup the call in asterisk?

A

Hangup application

Q

What is the application to call from one end point to another?

A

Dial application

Related Tutorials in How to Create Asterisk Dialplan Context

Related Tutorials in How to Create Asterisk Dialplan Context

How to install Meld tool in Ubuntu
How to install Meld tool in Ubuntu
Feb 25, 2017
How to install Dconf-Editor on Ubuntu 18.04
How to install Dconf-Editor on Ubuntu 18.04
Jul 14, 2018
How to install and update OpenSSL on Ubuntu 16.04
How to install and update OpenSSL on Ubuntu 16.04
Mar 9, 2017
How to install GLib 2.0 on Ubuntu 17.04
How to install GLib 2.0 on Ubuntu 17.04
May 22, 2017
How to Install Android Emulator on Ubuntu 20.4.1
How to Install Android Emulator on Ubuntu 20.4.1
Jul 13, 2021
How To Install AnyDesk on Ubuntu 16.04
How To Install AnyDesk on Ubuntu 16.04
Apr 4, 2018
How to install Genymotion 2.12.1 on Ubuntu 18.04
How to install Genymotion 2.12.1 on Ubuntu 18.04
Jul 9, 2018
How to install Timeshift 18.4 on Ubuntu 18.04
How to install Timeshift 18.4 on Ubuntu 18.04
Jul 6, 2018

Related Forums in How to Create Asterisk Dialplan Context

Related Forums in How to Create Asterisk Dialplan Context

Ubuntu
matthew class=
Failed to enable unit: Refusing to operate on linked unit file sshd.service
Apr 15, 2019
Ubuntu
mason class=
Passwd: You may not view or modify password information for root On Ubuntu 19.04
May 27, 2019
Ubuntu
isaac class=
/etc/apt/sources.list Permission denied
May 18, 2017
Ubuntu
yousuf class=
lsb_release command not working : Debian
Jan 18, 2018
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Ubuntu
mason class=
"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1
Mar 15, 2021
NFS
luke class=
clnt_create: RPC: Program not registered
Apr 25, 2017
Apache
isaac class=
How to disable apache welcome page on Ubuntu
Dec 15, 2018

Related News in How to Create Asterisk Dialplan Context

Related News in How to Create Asterisk Dialplan Context

How To Install Mixxx on Ubuntu 16.04
How To Install Mixxx on Ubuntu 16.04
Oct 11, 2017
Ubuntu 17.04 released with greater expectations
Ubuntu 17.04 released with greater expectations
Apr 15, 2017
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Mar 1, 2017
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Sep 2, 2017
Ubuntu Unity is no more: One Linux dream has been axed
Ubuntu Unity is no more: One Linux dream has been axed
Apr 7, 2017
What’s next for Ubuntu Linux Desktop?
What’s next for Ubuntu Linux Desktop?
Apr 11, 2017
Say Hi to Ubuntu's new mascot
Say Hi to Ubuntu's new mascot
Mar 22, 2019
KDE Connect App was removed from Google Play Store and brought back in 24 hours
KDE Connect App was removed from Google Play Store and brought back in 24 hours
Mar 22, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help David Lopez Guillen ?
Ayuda urgente instale SSL para servidor Opensuse y ahora no funciona tengo servicio web

hola segui este tutorial para tener un certificado ssl y ahora no se ve mi app en la red, espero alguien pueda ayudarme, tengo M9oodle en3.5 en un servidor open suse y ahora no funciona por favor ayuda.

https://www.linuxhelp.com/how-to-create-ssl-certificate-in-opensuse

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.