How to use Asterisk Dialplan Context Priority Label on Oracle Linux 9.3
To Use Asterisk Dialplan Context Priority Label On Oracle Linux 9.3
Introduction:
Asterisk's common practice is to assign text labels to priorities. This is to ensure that you can refer to a priority by something other than its number, which probably isn’t known, given that dialplans now generally use unnumbered priorities. To assign a text label to a priority, simply add the label inside parentheses after the priority.
Procedure:
Step 1: Check the OS version by using the below command.
[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.3"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.3
Step 2: Check the Asterisk status by using the below command.
[root@linuxhelp ~]# systemctl status asterisk.service
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/rc.d/init.d/asterisk; generated)
Active: active (running) since Sat 2024-03-23 13:09:47 IST; 15min ago
Docs: man:systemd-sysv-generator(8)
Process: 6279 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
Main PID: 6308 (asterisk)
Tasks: 40 (limit: 21739)
Memory: 43.6M
CPU: 9.344s
CGroup: /system.slice/asterisk.service
├─6306 /bin/sh /usr/sbin/safe_asterisk
└─6308 /usr/sbin/asterisk -f -vvvg -c
Mar 23 13:09:47 linuxhelp systemd[1]: Starting LSB: Asterisk PBX...
Mar 23 13:09:47 linuxhelp asterisk[6279]: Starting asterisk:
Mar 23 13:09:47 linuxhelp systemd[1]: asterisk.service: Can't open PID file /run/asterisk/asterisk.pid (yet?) after start: Operation not permitted
Mar 23 13:09:47 linuxhelp systemd[1]: asterisk.service: Supervising process 6308 which is not our child. We'll most likely not notice when it exits.
Mar 23 13:09:47 linuxhelp systemd[1]: Started LSB: Asterisk PBX.
Step 3: Go to the following location by using the below command.
[root@linuxhelp ~]# cd /etc/asterisk/
[root@linuxhelp asterisk]#
Step 4: Edit extension.conf file for making dialplan using priority label by using the below command.
[root@linuxhelp asterisk]# vim extensions.conf
Add the following line
[internal]
exten => _XXX,1,NoOp(Call started for ${EXTEN})
exten => _XXX,n,Goto(skip)
exten => _XXX,n,Playback(hello)
exten => _XXX,n(skip),Dial(PJSIP/${EXTEN})
Step 5: Next login to the asterisk CLI Mode by using the below command.
[root@linuxhelp asterisk]# asterisk -rvvvvvvvvvvvvvvvvvvv
Asterisk 20.5.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.5.0 currently running on linuxhelp (pid = 6308)
linuxhelp*CLI>
Step 6: Reload the dialplan by using the below command.
linuxhelp*CLI> dialplan reload
Dialplan reloaded.
-- Time to scan old dialplan and merge leftovers back into the new: 0.000005 sec
-- Time to restore hints and swap in new dialplan: 0.000007 sec
-- Time to delete the old dialplan: 0.000005 sec
-- Total time merge_contexts_delete: 0.000017 sec
-- pbx_config successfully loaded 1 contexts (enable debug for details).
Output
-- Executing [167@internal:1] NoOp("PJSIP/168-00000006", "Call started for 167") in new stac
-- Executing [167@internal:2] Goto("PJSIP/168-00000006", "skip") in new stack
-- Goto (internal,167,4)
-- Executing [167@internal:4] Dial("PJSIP/168-00000006", "PJSIP/167") in new stack
-- Called PJSIP/167
-- PJSIP/167-00000007 is ringing
== Spawn extension (internal, 167, 4) exited non-zero on 'PJSIP/168-00000006'
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required how to use priority label on Asterisk dialplan context on Oracle Linux 9.3. Your feedback is much welcome.
Comments ( 0 )
No comments available