Reputation: 2766
I'm setting up some automated tests to ensure that our bot is working.
Currently I'm sending .wav files into the call and it's working fine, but at some point we use gather
to receive DTMF input from the user. This is working using connect
with stream
so I can send and receive data from the call in real time during the test.
Sending the DTMF as audio doesn't work though(as expected, since the docs explain that this data goes through a different channel).
Is is possible to to this in a simple way ? Right now I'm thinking of starting a conference with USER + BOT (SUT) + another bot that will send the DTMF with play
when necessary. But this is getting too complex.
Upvotes: 2
Views: 1182
Reputation: 443
I ran into the same issue. All my attempts to send the DTMF wav as a "media" message into the <Stream>
yielded distorted noise instead of a clear tone, and thus didn't work to trigger the IVR action. And, yes, I made sure the wav was 8000 hz, mu-law, base64-encoded without the wav header (as discussed here: How to send a Media message to Twilio in a bidirectional stream that Twilio can play?).
I reached out to Twilio support and they replied saying: "...at the moment, Twilio does not support passing of DTMF tones through media streams. This requirement has been raised by multiple customers and there is already a feature request for this. Our engineering team is still working on this to achieve this, Once this becomes available, you should be able to find this out here (https://www.twilio.com/en-us/changelog). Unfortunately, there is no ETA on this."
So, for now the workaround described above (to <Play>
and immediately <Connect>
again) is probably the best workaround.
Upvotes: 2
Reputation: 2766
The solution that I found was to update the current call TwiML to play digits and then recreate the stream. Something like:
<Response>
<Play digits="<DTMF>"> </Play>
<Connect>
<Stream url="wss://<websocket server url>"> </Stream>
</Connect>
</Response>
It did work but its a little slow because of the reconnection phase.
I'll leave the question unanswered to check for some other solutions.
Upvotes: 2