• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to get DTMF Input with Background Audio on Asterisk on Oracle Linux 9.3

  • 00:41 cat /etc/os-release
  • 00:55 systemctl status asterisk
  • 01:11 cd /etc/asterisk/
  • 01:23 vim extensions.conf
  • 04:07 asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvvvv
  • 04:27 dialplan reload
  • 05:12 vim extensions.conf
  • 05:38 asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvvvv
  • 05:43 dialplan reload
{{postValue.id}}

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.

Tags:
matthew
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is DTMF and how is it used in Asterisk?

A

DTMF stands for Dual-Tone Multi-Frequency. It is the signal that your phone sends when you press a telephone's touch keys. In Asterisk, DTMF is used to interact with menus and perform various functions like navigating IVR systems.

Q

How do I play background audio and still detect DTMF inputs?

A

You can use the Background() application to play an audio file and wait for DTMF input simultaneously
exten => 123,1,Answer()
same => n,Background(welcome-message)
same => n,WaitExten()

Q

Can background noise affect DTMF detection?

A

Yes, background noise can sometimes cause false detections or missed DTMF inputs. Ensuring high-quality audio files and using appropriate gain levels can help minimize these issues.

Q

How to enter into Asterisk CLI?

A

By using the following command
asterisk –rvvvvvvvvvvvv

Q

How to change the dialplan in an Asterisk?

A

By editing the extensions.conf file to change the dialplan

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 Owen ?
How to add SSH key to my Gitlab account

I need to add the SSH key in my gitlab account. How to do so ????

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.