How to get DTMF Input with Background Audio on Asterisk on Oracle Linux 9.3
To Get DTMF Input With Background Audio On Asterisk On Oracle Linux 9.3
Introduction
Dual-tone multi-frequency (DTMF) refers to the auditory signals produced by a telephone keypad when numbers are pressed. These tones are conveyed through the voice channel and serve to operate automated systems and indicate user input, such as the desired phone number. Each key on the keypad corresponds to a unique pair of tones at distinct frequencies.
Procedure Steps
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 status of the Asterisk by using the below command
[root@linuxhelp ~]# cat /etc/os-releasesystemctl status asterisk.service
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/rc.d/init.d/asterisk; generated)
Active: active (running) since Mon 2024-07-01 00:33:42 IST; 1min 31s ago
Docs: man:systemd-sysv-generator(8)
Process: 6259 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
Main PID: 6289 (asterisk)
Tasks: 42 (limit: 21739)
Memory: 38.8M
CPU: 806ms
CGroup: /system.slice/asterisk.service
├─6287 /bin/sh /usr/sbin/safe_asterisk
└─6289 /usr/sbin/asterisk -f -vvvg -c
Jul 01 00:33:42 linuxhelp systemd[1]: Starting LSB: Asterisk PBX...
Jul 01 00:33:42 linuxhelp asterisk[6259]: Starting asterisk:
Jul 01 00:33:42 linuxhelp systemd[1]: asterisk.service: Can't open PID file /run/asterisk/asterisk.pid (yet?) after start: >
Jul 01 00:33:42 linuxhelp systemd[1]: asterisk.service: Supervising process 6289 which is not our child. We'll most likely >
Jul 01 00:33:42 linuxhelp systemd[1]: Started LSB: Asterisk PBX.
Step 3: Move to the Asterisk directory by using the below command
[root@linuxhelp ~]# cd /etc/asterisk/
Step 4: Edit the extensions.conf file to modify the dialplan by using the below command
[root@linuxhelp ~]# vim extensions.conf
Add those Following Lines
exten => _XXX,1,playback(hello)
exten => _XXX,n, playback(zombies)
exten => _XXX,n,WaitExten()
exten => 1,1,NoOp(you entered extension 1)
exten => 2,1,NoOp(you entered extension 2)
exten => i,1,Playback(invalid)
Step 5: Login to the Asterisk CLI mode by using the below command
[root@linuxhelp ~]# asterisk -rvvvvvvvvvvvvvv
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 = 5831)
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.000003 sec
-- Time to restore hints and swap in new dialplan: 0.000004 sec
-- Time to delete the old dialplan: 0.000002 sec
-- Total time merge_contexts_delete: 0.000009 sec
-- pbx_config successfully loaded 1 contexts (enable debug for details).
Output of the DTMF get input in asterisk dialplan context by using playback application.
xecuting [167@internal:1] Playback("PJSIP/168-00000000", "hello") in new stack
> 0x7ffaa0044ff0 -- Strict RTP learning after remote address set to: 192.168.6.101:4002
-- <PJSIP/168-00000000> Playing 'hello.ulaw' (language 'en')
> 0x7ffaa0044ff0 -- Strict RTP switching to RTP target address 192.168.6.101:4002 as source
-- Executing [167@internal:2] Playback("PJSIP/168-00000000", "zombies") in new stack
-- <PJSIP/168-00000000> Playing 'zombies.ulaw' (language 'en')
> 0x7ffaa0044ff0 -- Strict RTP learning complete - Locking on source address 192.168.6.101:4002
== Spawn extension (internal, 167, 2) exited non-zero on 'PJSIP/168-00000000'
Step 7: Edit the extensions.conf file to use Background application by using the below command
[root@linuxhelp ~]# vim extensions.conf
Add the following lines
exten => _XXX,1,playback(hello)
exten => _XXX,n,Background(zombies)
exten => _XXX,n,WaitExten()
exten => 1,1,NoOp(you entered extension 1)
exten => 2,1,NoOp(you entered extension 2)
exten => i,1,Playback(invalid)
Step 8: Again login to the Asterisk CLI mode by using the below command.
[root@linuxhelp ~]# asterisk -rvvvvvvvvvvvvvv
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 = 5831)
linuxhelp*CLI>
Step 9: 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.000004 sec
-- Time to restore hints and swap in new dialplan: 0.000003 sec
-- Time to delete the old dialplan: 0.000004 sec
-- Total time merge_contexts_delete: 0.000011 sec
-- pbx_config successfully loaded 1 contexts (enable debug for details).
Output of the DTMF get input in asterisk dialplan context by using background application
executing [168@internal:1] Playback("PJSIP/167-00000001", "hello") in new stack
> 0x7ffaa0056b80 -- Strict RTP learning after remote address set to: 192.168.6.101:8000
> 0x7ffaa0056b80 -- Strict RTP switching to RTP target address 192.168.6.101:8000 as source
-- <PJSIP/167-00000001> Playing 'hello.ulaw' (language 'en')
-- Executing [168@internal:2] BackGround("PJSIP/167-00000001", "zombies") in new stack
-- <PJSIP/167-00000001> Playing 'zombies.ulaw' (language 'en')
> 0x7ffaa0056b80 -- Strict RTP learning complete - Locking on source address 192.168.6.101:8000
== Spawn extension (internal, 168, 2) exited non-zero on 'PJSIP/167-00000001'
-- Added contact 'sip:168@192.168.6.101:55160;ob' to AOR '168' with expiration of 300 seconds
-- Removed contact 'sip:168@192.168.6.101:65485;ob' from AOR '168' due to remove existing
== Contact 168/sip:168@192.168.6.101:65485;ob has been deleted
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps to get DTMF input on Asterisk Dialplan Context on Oracle Linux 9.3. Your feedback is much welcome.
Comments ( 0 )
No comments available