sendDTMF: POST /channels/{channelId}/dtmf

Hello,

I’m trying to send DTMF tones to a channel via ARI client (Java or NodeJS) and none seems to work. It gives me no errors but also no websocket events from asterisk. But if I press a key on the phone, asterisk responds with a ChannelDtmfReceived event as expected. What am I doing wrong?

I am using Asterisk 13 and 16 and Yate as softphone and CHAN_SIP extensions.

Here are my logs after invoking the above URL:

[2019-11-04 08:37:31] DEBUG[28468]: http.c:1405 handle_uri: HTTP Request URI is /ari/channels/f1414263-d73f-4fab-afc7-9ee190cbd97a/dtmf?dtmf=5&before=100&between=100&duration=100&after=100

[2019-11-04 08:37:31] DEBUG[28468]: res_ari.c:502 ast_ari_invoke: Checking dtmf
[2019-11-04 08:37:31] DEBUG[28468]: res_ari.c:522 ast_ari_invoke: Got it!
[2019-11-04 08:37:31] DEBUG[28436]: channel.c:5405 set_format: Set channel SIP/703-0000002d to write format slin
[2019-11-04 08:37:31] DEBUG[28436]: channel.c:3419 ast_settimeout_full: Scheduling timer at (50 requested / 50 actual) timer ticks per second
[2019-11-04 08:37:31] DEBUG[28436]: channel.c:7822 ast_channel_start_silence_generator: Started silence generator on ‘SIP/703-0000002d’
[2019-11-04 08:37:31] DEBUG[28436]: channel.c:3083 ast_waitfor_nandfds: Thread 0x7f4a140db700 is blocking ‘SIP/703-0000002d’, already blocked by thread 0x7f49bc874700 in procedure ast_waitfor_nandfds
[2019-11-04 08:37:31] DEBUG[28468]: res_ari.c:1000 ast_ari_callback: Examining ARI response:
204 No Content

Any help will be appreciated. Thank you!!

BR,
JB

What is the channel doing at the time? As well I don’t believe that will generate events, because it’s not DTMF coming from the channel. It’s DTMF being sent to the channel.

Thank you for your answer.

I have 2 channels connected to the same bridge and I want to simulate sending a DTMF tone using ARI as if I pressed a phone key, but I need to know witch tone was sent… Is this possible?

I need this to implement push-to-talk functionality. There is another way to achieve this?

Regards,

JB

Sending DTMF when bridged is not supported and may not work properly, and no event exists for when a DTMF is being sent. Things don’t really work as you need in order to do as you wish.

I am a bit confused now with your answer because within the same bridged channels when I press a key on the softphone I can see DTFM being printed in the logs and in fact I receive the ChannelDtmfReceived event from the asterisk…

Thanks again.

Bridges:
[
{
“id”: “018f245f-6ddb-4d44-bc7e-a80de3df100e”,
“technology”: “simple_bridge”,
“bridge_type”: “mixing”,
“bridge_class”: “stasis”,
“creator”: “Stasis”,
“name”: “432513d0-ff0a-11e9-be62-27c4219368a6”,
“channels”: [
“0e5212d0-4b97-4f0d-a569-3982e3fc7bad”,
“3ecf659e-1f13-4509-932a-755c9ead6534”
]
}
]

Channels:
[
{
“id”: “0e5212d0-4b97-4f0d-a569-3982e3fc7bad”,
“name”: “SIP/703-00000010”,
“state”: “Up”,
“caller”: {
“name”: “Teste3”,
“number”: “703”
},
“connected”: {
“name”: “Teste4”,
“number”: “704”
},
“accountcode”: “”,
“dialplan”: {
“context”: “from-internal”,
“exten”: “”,
“priority”: 1
},
“creationtime”: “2019-11-04T12:47:22.688+0000”,
“language”: “en”
},
{
“id”: “3ecf659e-1f13-4509-932a-755c9ead6534”,
“name”: “SIP/704-0000000f”,
“state”: “Up”,
“caller”: {
“name”: “Teste4”,
“number”: “704”
},
“connected”: {
“name”: “Teste3”,
“number”: “703”
},
“accountcode”: “”,
“dialplan”: {
“context”: “from-internal”,
“exten”: “”,
“priority”: 1
},
“creationtime”: “2019-11-04T12:47:22.688+0000”,
“language”: “en”
}
]

Logs (when I press a key on the softphone):
[2019-11-04 12:51:24] DTMF[4501]: channel.c:4050 __ast_read: DTMF begin ‘’ received on SIP/703-00000010
[2019-11-04 12:51:24] DTMF[4501]: channel.c:4054 __ast_read: DTMF begin ignored '
’ on SIP/703-00000010
[2019-11-04 12:51:24] DTMF[4501]: channel.c:3964 __ast_read: DTMF end ‘’ received on SIP/703-00000010, duration 200 ms
[2019-11-04 12:51:24] DTMF[4501]: channel.c:4034 __ast_read: DTMF end passthrough '
’ on SIP/703-00000010

That’s because it is DTMF received from the channel, there is an event for that.

The “dtmf” route doesn’t behave that way. It means “send DTMF to this channel”. Since there is no DTMF received on a channel in that case, then there is no event.

Ok, got it.

Thank you very much for your time!

Best Regards,
JB

1 Like

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