PlayDTMF in AMI on Agent channel

Hi,

I’ve been developing an html toolbar to interact with Asterisk through the AMI over TCP.

It’s great, I can send commands, make calls, receive call notifications etc etc.

One of the things I can’t get working is playing a dtmf tone on the Agent channel when an agent is logged in.

We are running Asterisk 1.8.7 and when i play a DTMF tone I get a response back in the AMI saying that the DTMF tone has been queued. However, I don’t get a corresponding AMI action saying that it received the DTMF tone. The other side of the conversation can’t hear the DTMF tone being played but I can on my side.

I’ve tried this on an existing phone line with an IVR and it is unresponsive, this is also the case when getting through to voicemail on asterisk.

Ignore the formatting as I have written a layer in node.js to interpret these commands and send them off in the correct format, and vice versa for receiving them.

DTMF recieved from SIP softphone
Tue, 18 Oct 2011 15:41:12 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:“3”,“direction”:“Received”,“begin”:“Yes”,“end”:“No”}
Tue, 18 Oct 2011 15:41:12 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:“3”,“direction”:“Received”,“begin”:“No”,“end”:“Yes”}
Tue, 18 Oct 2011 15:41:13 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:“4”,“direction”:“Received”,“begin”:“Yes”,“end”:“No”}
Tue, 18 Oct 2011 15:41:13 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:“4”,“direction”:“Received”,“begin”:“No”,“end”:“Yes”}
Tue, 18 Oct 2011 15:41:14 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:“6”,“direction”:“Received”,“begin”:“Yes”,“end”:“No”}
Tue, 18 Oct 2011 15:41:14 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:“6”,“direction”:“Received”,“begin”:“No”,“end”:“Yes”}
Tue, 18 Oct 2011 15:41:14 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:“7”,“direction”:“Received”,“begin”:“Yes”,“end”:“No”}
Tue, 18 Oct 2011 15:41:14 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:“7”,“direction”:“Received”,“begin”:“No”,“end”:“Yes”}
Tue, 18 Oct 2011 15:41:15 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:"#",“direction”:“Received”,“begin”:“Yes”,“end”:“No”}
Tue, 18 Oct 2011 15:41:15 GMT - Uncaught event: DTMF - {“event”:“DTMF”,“privilege”:“dtmf,all”,“channel”:“SIP/3467-0000000a”,“uniqueid”:“1318952467.36”,“digit”:"#",“direction”:“Received”,“begin”:“No”,“end”:“Yes”}

DTMF sent from AMI

{ action: ‘PlayDTMF’,
channel: ‘Agent/3467’,
digit: ‘5’,
ActionID: 97253236221149570 }

DTMF response to prior action

{“response”:“Success”,“actionid”:“97253236221149570”,“message”:“DTMF successfully queued”}

But I don’t get a DTMF event fired at me to tell me asterisk has received and acted upon the tone.

I’ve tried tying it up to the agent channel that the agent is logged in with, ie a SIP channel but this has the same issue.

If anyone can help me I’d really appreciate it. The AMI user has full write privileges.

Dan Jenkins

Playing it on that channel will simply play it on the outgoing side of the real channel associated with the agent, which is what you are getting. We had to interpose a local channel to allow us acknowledge incoming agent calls manually when using always on agents.

Real channel calls into local channel, which then logs into agent. You need to inject the DTMF on the ;1 side, in order for it to be directed to the DTMF receiver for the agent channel.

Hi David55,

Thanks but I don’t quite understand, I can get the agent to login etc, but say if I make an outbound phone call using the AMI from within the Agent Channel, I can’t play DTMF tones within that phone call. Is there any way around this issue? To me, the phone call is placed on the Agent Channel so I should be able to play a DTMF tone on that channel, or even play it on the channel that the agent is logged in with, in my case a SIP channel from a softphone which is setup as an extension. But neither of these seem to work. I guess the only one I haven’t tried is playing the tone on the other side of the conversation, on say a DAHDI channel but I guess this wouldn’t work either.

I haven’t seen whether or not you can specify a direction when playing the DTMF tone in the AMI,

Any help would be greatly appreciated,

Dan

You have to direct the DTMF to the channel on which you want it output. In this respect, an Agent channel is just a proxy for the whoever is logged in to the agent. In fact, I seem to remember that the physical implementation short cuts the agent and forwards directly to the logged in user’s channel.

If you want to send DTMF out of the channel to which the agent is connected, rather than the one for which it proxies, you have to send it to that channel, not to the agent.

As described above, there are tricks that can be used, by adding a local channel.

Agent’s phone ----- (proxy relationship) -----Agent ------(Bridge) ---- Other party.

Agent’s phone ------(Bridge)-----Local channel side 1 ---- (relayed) -----Local channel side 2 ----(proxy relationship) ---- Agent --------(Bridge)-----Other party.

If you want DTMF to go out to the right, you must inject it at a channel to the right of one of the bridges.

Hi David,

Sorry to be a pain, and than you for answering. I think I understand the reasoning behind it but I don’t have a clue how I’d go about putting this into place. Also, do you have to manually allow the call to come through to the agent or does this happen automatically, exactly the same as the default behaviour as always connected agents (hear a beep and call comes through)?

Thanks in advance,

Dan

Bump??

If you use AgentLogin, it definitely works. If you use AgentCallbackLogin, you shouldn’t because it is deprecated and the code is frozen, but I don’t see why it wouldn’t work, although you would have to set the local channel up the other way round.

Up!

I have same problem in Asterisk 11. The PlayDTMF still not working.

UPDATE: The PlayDTMF command “works”.The passed digit can be heard (the tone is arrive), BUT the Asterisk can not handle the digit.

Action: PlayDTMF
ActionID: 12345
Channel: Agent/1234
Digit: #

Has somebody any idea or suggestion how could be fix it?

Thanks!

The DTMF is injected on the outgoing side. You have to interpose an incoming side, which would generally mean that you need to have a local channel.

Thank you David!

This “cheat” works fine! :smiley: