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

How to use Variables and Global Variables on Asterisk Dialplan Context

  • 00:34 lsb_release -a
  • 00:50 systemctl status asterisk
  • 01:28 cd /etc/asterisk/
  • 01:35 vim pjsip.conf
  • 02:02 vim extensions.conf
  • 04:08 asterisk -rvvvvvvvvvvvvvvvvvvvvvv
  • 04:23 dialplan reload
  • 04:54 vim extensions.conf
  • 06:02 asterisk -rvvvvvvvvvvvvvvvvvvvvvv
  • 06:11 dialplan reload
7601

TO USE VARIABLES AND GLOBAL VARIABLES ON ASTERISK DIALPLAN CONTEXT

Introduction:

Asterisk can help you define your own patterns for call flow that will help regulate any unforeseen changes and optimize your communication system. Asterisk can use global, shared, and channel-specific variables for arguments to commands. There are variables that Asterisk automatically introduces.

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:~# lsb_release -a
root@linuxhelp1:~# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: active (running) since Tue 2023-07-25 07:27:52 IST; 21min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1408 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS)
      Tasks: 71 (limit: 4537)
     Memory: 131.6M
        CPU: 16.600s
     CGroup: /system.slice/asterisk.service
             └─1432 /usr/sbin/asterisk

Jul 25 07:27:52 linuxhelp1 systemd[1]: Starting LSB: Asterisk PBX...
Jul 25 07:27:52 linuxhelp1 asterisk[1408]:  * Starting Asterisk PBX: asterisk
Jul 25 07:27:52 linuxhelp1 asterisk[1408]:    ...done.
Jul 25 07:27:52 linuxhelp1 systemd[1]: Started LSB: Asterisk PBX.
Jul 25 07:27:59 linuxhelp1 asterisk[1432]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/>
Jul 25 07:27:59 linuxhelp1 asterisk[1432]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/>

Step 3: Move to the Asterisk directory by using the below command

root@linuxhelp1:~# cd /etc/asterisk/

Step 4: Show the endpoints in the pjsip.conf file by using the below command

root@linuxhelp1:/etc/asterisk# vim pjsip.conf

Step 5: Open extensions.conf file to edit the dialplan using variables by using the below command

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

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

root@linuxhelp1:/etc/asterisk# asterisk -rvvvvvvvvvvvvvvvvvvvvvv
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 = 1432)

Step 7: Reload the dialplan by using the below command

linuxhelp1*CLI> dialplan reload
Dialplan reloaded.
[Jul 25 07:55:00] WARNING[6905]: pbx_config.c:1955 pbx_load_config: ==!!== Unknown directive: ringtime at line 3 of extensions.conf -- IGNORING!!!
    -- Including switch 'Lua/' in context 'local'
    -- Including switch 'Lua/' in context 'demo'
    -- Including switch 'Lua/' in context 'default'
    -- Including switch 'Lua/' in context 'public'


    -- Including switch 'DUNDi/e164' in context 'ael-dundi-e164-switch'
    -- Time to scan old dialplan and merge leftovers back into the new: 0.000680 sec
    -- Time to restore hints and swap in new dialplan: 0.000045 sec
    -- Time to delete the old dialplan: 0.000163 sec
    -- Total time merge_contexts_delete: 0.000888 sec
    -- pbx_config successfully loaded 27 contexts (enable debug for details).

Step 8: Exit from the Asterisk CLI by using the below command

linuxhelp1*CLI>
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups

Step 9: Again, login to the extension.conf to use channel variable by using the below command

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

Step 10: Login to the Asterisk CLI mode and reload the dialplan by using the below command

root@linuxhelp1:/etc/asterisk# asterisk -rvvvvvvvvvvvvvvvvvvvvvv
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 = 1432)

linuxhelp1*CLI> dialplan reload
Dialplan reloaded.
[Jul 25 07:57:43] WARNING[7246]: pbx_config.c:1955 pbx_load_config: ==!!== Unknown directive: ringtime at line 3 of extensions.conf -- IGNORING!!!
    -- Including switch 'DUNDi/e164' in context 'ael-dundi-e164-switch'
    -- Including switch 'Lua/' in context 'public'
    -- Including switch 'Lua/' in context 'default'
    -- 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.000437 sec
    -- Time to restore hints and swap in new dialplan: 0.000007 sec
    -- Time to delete the old dialplan: 0.000091 sec
    -- Total time merge_contexts_delete: 0.000535 sec
    -- pbx_config successfully loaded 27 contexts (enable debug for details).

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps how to use Variables and Global Variables on Asterisk Dialplan Context. Your feedback is much welcome.

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What are the different types of Asterisk variables?

A

There are three types of variables: global variables, channel variables, and environment variables.

Q

What is the channel in the Asterisk?

A

A channel is an entity inside Asterisk that acts as a channel of communication between Asterisk and another device.

Q

What is dialplan in Asterisk?

A

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

Q

What is the variable used for Caller ID?

A

${CALLERID(all)}

Q

What is the variable used for the current extension?

A

${EXTEN} Variable

Related Tutorials in How to use Variables and Global Variables on Asterisk Dialplan Context

Related Tutorials in How to use Variables and Global Variables on 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 use Variables and Global Variables on Asterisk Dialplan Context

Related Forums in How to use Variables and Global Variables on 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 use Variables and Global Variables on Asterisk Dialplan Context

Related News in How to use Variables and Global Variables on 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 Isaac ?
How to run windows application in linux

I need to run the windows application in my Linux machine, instead of installing from yum repo or any other repos. How to do that..??

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.