Asterisk does not hear dtmf sounds

When I call asterisk from the softphone, it hears dtmf sounds, but when I call from PSTN, it doesn’t. This is the output of dongle.conf:
[general]
interval=10000000
jbenable=no

[defaults]
context=from-trunk
group=0
rxgain=0
txgain=0
autodeletesms=no
resetdongle=yes
u2diag=-1
usecallingpres=yes
callingpres=allowed_passed_screen
disablesms=yes
language=en
smsaspdu=yes
mindtmfgap=45
mindtmfduration=10
mindtmfinterval=100
callwaiting=auto
disable=no
initstate=start
exten=+36209238100
dtmf=relax

[Dongle1]
audio=/dev/ttyUSB1
data=/dev/tnt1

I’ve posted this on 194 websites already😡, but I hope there will be an answer here😊

Expected behaviour for GSM networks. Probably also expected for other mobile phone technologies.

The support of this facility in the land to mobile direction is for further study

Mobile phone networks use vocal tract model based codecs, that can’t accurately represent combination of two unrelated pure tones. In the mobile to fixed direction, the key presses are sent out of band. In the intended use of mobile networks, there is no need for DTMF in the fixed to mobile direction, as the mobile user is expected to be a human, not a machine.

I wonder why so many people have come unstuck on this one in the current year.

Also note that chan_dongle is abandonware. No-one is maintaining it.

Unfortunately, I’m still quite a beginner at this, so I don’t really understand. (When I call from a zoiper to a PSTN network, the voice menu system of Vodafone customer service hears dtmf sounds)

The PSTN supports inband DTMF. GSM supports out of band DTMF from mobile (a dongle is considered a mobile) to PSTN, and the dongle may encode this from out of band indications, or by decoding in band DTMF. GSM does not support DTMF from the PSTN to the mobile. Any DTMF is likely to be badly garbled and not decode reliably.

Making some assumptions about your configuration, Zoiper is probably sending the DTMF key presses as out of band signals, using RFC 2833. The dongle translates these to out of band key press signals, according the ETSI specification I quoted, if GSM. As a mobile network operator, Vodafone may have access to these directly, but more likely their base station converts these into actual DTMF tones and transmits them over a PSTN-like connection, using G.711 codecs, which do support DTMF. They arrive at Vodafones contact centre.

Going the other way, once the tones reach the base station, they are not treated specially. The base station tries to encode them using a GSM codec. When Asterisk receives them, it tries to undo the GSM coding, but the result doesn’t accurately represent the DTMF tones. Asterisk fails to recognize them.

1 Like

OK, but could you explain point by point how I could make asterisk detect dtmf sounds coming from the pstn network, unfortunately I’m still pretty new to this, so I don’t understand much😔

Most people will use an internet telephony service provider, to provide access via SIP. The service provider will typically connect by ISDN, although most countries are moving to the use of SIP within the PSTN itself. The UK, where I suspect you are, was planning to have completed that by 2025, although it has been delayed.

You can also directly connect with ISDN, or even with analogue lines. Asterisk can handle DTMF on analogue, but doesn’t handle call supervision well so may have difficulty detecting calls being answered and ended, and in ending calls it didn’t start.

Hello, when I call the FreePBX from Skype, the dtmf detection is working, but when I call from Vodafone, Yettel, Telekom, Digi or DirectOne the dtmf detection is not working. What can I do in this case?

Please supply:

relevant channel_driver configuration, for each source (NB the .conf file, not a FreePBX screen shot);

Asterisk verbose or full log, with protocol debugging enabled, as far as possible for the channel drivers used (e.g. “pjsip set logger on” , and/or “sip. set debug on”, as appropriate for SIP channel drivers), and verbosity at least 5.

Asterisk DTMF log.

rtp set debug on logs, to the extent that you are suing RTP.

Please detail any cloud and/or local gateways in use.

It is possible that when the freepbx in Ercsi connects to the 2g network, it detects dtmf sounds, but when it connects to the 3g network in Budapest, it does not detect it?:thinking:

When DTMF tones are detected from pstn (maybe at 2g), The asterisk CLI said: Using SIP RTP Audio TOS bits 184
== Using SIP RTP Audio TOS bits 184 in TCLASS field.
== Using SIP RTP Audio CoS mark 5
When the dtmf sounds were not detected, the asterisk CLI did not print anything!

This is the pjsip debug
" varjasi-virtual-machine*CLI> pjsip set logger on
PJSIP Logging enabled
<— Transmitting SIP request (483 bytes) to UDP:192.168.41.1:63218 —>
OPTIONS sip:1000@192.168.41.1:63218;rinstance=5cbc8c1eba64e0eb SIP/2.0
Via: SIP/2.0/UDP 192.168.41.136:5060;rport;branch=z9hG4bKPj9f8eeeb9-f881-45c6-9336-a234139c4821
From: <sip:1000@192.168.41.136>;tag=61931e12-48c5-42dd-a44a-6f938560f4d9
To: <sip:1000@192.168.41.1;rinstance=5cbc8c1eba64e0eb>
Contact: <sip:1000@192.168.41.136:5060>
Call-ID: 6d4bb816-75a7-4d79-86a3-0ea20b94dbdf
CSeq: 28020 OPTIONS
Max-Forwards: 70
User-Agent: FPBX-15.0.23(16.26.1)
Content-Length: 0

<— Received SIP response (692 bytes) from UDP:192.168.41.1:63218 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.41.136:5060;rport=5060;branch=z9hG4bKPj9f8eeeb9-f881-45c6-9336-a234139c4821
Contact: sip:[192.168.41.1:63218](http://192.168.41.1:63218/)
To: <sip:1000@192.168.41.1;rinstance=5cbc8c1eba64e0eb>;tag=fd77ee03
From: <sip:1000@192.168.41.136>;tag=61931e12-48c5-42dd-a44a-6f938560f4d9
Call-ID: 6d4bb816-75a7-4d79-86a3-0ea20b94dbdf
CSeq: 28020 OPTIONS
Accept: application/sdp, application/sdp
Accept-Language: en
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
User-Agent: Z 5.5.10 v2.10.17.3
Allow-Events: presence, kpml, talk
Content-Length: 0

varjasi-virtual-machine*CLI> set rtp debug
No such command ‘set rtp debug’ (type ‘core show help set rtp’ for other possible commands)
<— Received SIP request (875 bytes) from UDP:192.168.41.1:63218 —>
REGISTER sip:192.168.41.136;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 192.168.41.1:63218;branch=z9hG4bK-524287-1—2b2b385e47eb86da;rport
Max-Forwards: 70
Contact: sip:1000@192.168.41.1:63218;rinstance=5cbc8c1eba64e0eb;transport=UDP
To: <sip:1000@192.168.41.136;transport=UDP>
From: <sip:1000@192.168.41.136;transport=UDP>;tag=58763171
Call-ID: n905KUG0blqmnD4snmmJkg…
CSeq: 35 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
User-Agent: Z 5.5.10 v2.10.17.3
Authorization: Digest username=“1000”,realm=“asterisk”,nonce=“1654172237/ad3997e92cca757186ebcf4c33a3dc4c”,uri=“sip:192.168.41.136;transport=UDP”,response=“c73a708775ef4d9c909ab855005d3d6d”,cnonce=“52f55929a2f3ebd5e27ae287b82e83b3”,nc=00000002,qop=auth,algorithm=MD5,opaque=“6caae0fa40df599b”
Allow-Events: presence, kpml, talk
Content-Length: 0

<— Transmitting SIP response (521 bytes) to UDP:192.168.41.1:63218 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.41.1:63218;rport=63218;received=192.168.41.1;branch=z9hG4bK-524287-1—2b2b385e47eb86da
Call-ID: n905KUG0blqmnD4snmmJkg…
From: <sip:1000@192.168.41.136>;tag=58763171
To: <sip:1000@192.168.41.136>;tag=z9hG4bK-524287-1—2b2b385e47eb86da
CSeq: 35 REGISTER
WWW-Authenticate: Digest realm=“asterisk”,nonce=“1654172290/4bd49254c636eaf9be7bb499cea327a6”,opaque=“74d900766d7101ef”,stale=true,algorithm=MD5,qop=“auth”
Server: FPBX-15.0.23(16.26.1)
Content-Length: 0

<— Received SIP request (875 bytes) from UDP:192.168.41.1:63218 —>
REGISTER sip:192.168.41.136;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 192.168.41.1:63218;branch=z9hG4bK-524287-1—9b47f55a1ab717e1;rport
Max-Forwards: 70
Contact: sip:1000@192.168.41.1:63218;rinstance=5cbc8c1eba64e0eb;transport=UDP
To: <sip:1000@192.168.41.136;transport=UDP>
From: <sip:1000@192.168.41.136;transport=UDP>;tag=58763171
Call-ID: n905KUG0blqmnD4snmmJkg…
CSeq: 36 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
User-Agent: Z 5.5.10 v2.10.17.3
Authorization: Digest username=“1000”,realm=“asterisk”,nonce=“1654172290/4bd49254c636eaf9be7bb499cea327a6”,uri=“sip:192.168.41.136;transport=UDP”,response=“35945b460619cf038ae96020c76c3330”,cnonce=“4f3c25b0c3fc1982f776207445c236e4”,nc=00000001,qop=auth,algorithm=MD5,opaque=“74d900766d7101ef”
Allow-Events: presence, kpml, talk
Content-Length: 0

<— Transmitting SIP response (482 bytes) to UDP:192.168.41.1:63218 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.41.1:63218;rport=63218;received=192.168.41.1;branch=z9hG4bK-524287-1—9b47f55a1ab717e1
Call-ID: n905KUG0blqmnD4snmmJkg…
From: <sip:1000@192.168.41.136>;tag=58763171
To: <sip:1000@192.168.41.136>;tag=z9hG4bK-524287-1—9b47f55a1ab717e1
CSeq: 36 REGISTER
Date: Thu, 02 Jun 2022 12:18:10 GMT
Contact: sip:1000@192.168.41.1:63218;rinstance=5cbc8c1eba64e0eb;expires=59
Expires: 60
Server: FPBX-15.0.23(16.26.1)
Content-Length: 0"

Huawei modem sometimes connects to 3g, but if the signal is weak, it connects to 2g and works😂

That is irrelevant, except that it may mean you are using a different channel driver, possibly not even a SIP one, when you don’t get those messages.

To the extent that you are using SIP over mobile data, rather than mobile voice, the mobile network is irrelevant to the ability to handle DTMF, which depends only on the provider, the dtmfmode, and the codecs. IP is IP, regardless of the physical layer implementation.

OK, but do you know how to switch chan_dongle from 3g to 2g gsm network only on ubuntu?

Because the 3g network has not been completely phased out in Hungary :sweat_smile:

chan_dongle is essentially dead. Very few people know anything about it.

If GitHub - jstasiak/asterisk-chan-dongle: Mirror of SVN-based "asterisk's huawei 3g dongle channel driver" project with my Asterisk 10 and 11 compatibility patches (asterisk10 and asterisk11 branches) is the correct repository, it hasn’t been touched in 9 years!

The read me suggests you can apply restrictions using AT command, but doesn’t seem to say how you inject them. It may be assuming you are familiar with configuring the dongles outside of the Asterisk environment.

However, it is third party code and was never officially supported on this forum and is probably not supported at all, now.

As note above, it is voice versus data, rather than GSM versus CDMA that is likely to affect the ability to reproduce DTMF.

What is wrong with using landline IP connection?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.