How to detect Touch-tones (DTMF) in a Twilio video room

这一生的挚爱 提交于 2020-12-14 12:04:52

问题


After following this document I can successfully add PSTN callers to a video room (Small Room type). What I haven't been able to do is to detect DTMF tones from the person calling in.

I tried two different approaches, both have failed

1) The one that I used before with a different provider and worked, but not with Twilio, was to have one of the other users in the room (not the PSTN caller but a javascript client) detect the DTMF client-side. This doesn't work with twilio because it sounds to me like twilio is manipulating the audio stream to remove the DTMFs before they reach the other users in the room (when the PSTN caller presses a number, you only hear a short "click" on the other side)

2) Inspired by this answer, I tried to reply with a TWIML

<Response>
  <Connect>
    <Room>my-room</Room>
  </Connect>
  <Gather input="dtmf">
  </Gather>
</Response>

This would not be ideal since it wouldn't detect the DTMF while in the room; you would have to leave the room, but I tried it anyway to see if I could come up with a way to terminate the call to move on to the gather verb like in the linked answer. It looks like the call doesn't move to the gather part after the room ends (i tried completing the room and the PSTN call immediately ends)

Are there any other approaches that anyone has used for this? The simplest to me would be a way to tell twilio not to remove the DTMFs from the audio stream so my solution #1 would work, but I'm open to other ideas maybe leveraging twilio's gather


回答1:


Twilio developer evangelist here.

It doesn't look like it's currently directly possible to detect DTMF tones in a phone call that has been connected to a video room.

One possibility is to use the new Media Stream capability to direct the live audio to your own server to detect the tones.

I have asked the team to see if there are other options though.



来源:https://stackoverflow.com/questions/57666508/how-to-detect-touch-tones-dtmf-in-a-twilio-video-room

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!