如何检测 Twilio 视频室中的按键音 (DTMF) [英] How to detect Touch-tones (DTMF) in a Twilio video room

查看:35
本文介绍了如何检测 Twilio 视频室中的按键音 (DTMF)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在遵循本文档之后我可以成功将 PSTN 呼叫者添加到视频房间(小房间类型).我无法做的是检测来电者的 DTMF 音调.

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) 我之前在其他提供商处使用过的一个,但不是与 Twilio 一起使用的,是让房间中的其他用户之一(不是 PSTN 呼叫者,而是 javascript 客户端)检测 DTMF 客户端.这对 twilio 不起作用,因为在我看来 twilio 正在操纵音频流以在它们到达房间中的其他用户之前删除 DTMF(当 PSTN 呼叫者按下一个号码时,您只会听到一个简短的点击"另一边)

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) 受到这个答案的启发,我尝试用 TWIML 回复

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

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

这并不理想,因为它不会在房间内检测到 DTMF;您将不得不离开房间,但无论如何我都尝试过,看看我是否可以想出一种方法来终止呼叫以继续使用 gather 动词,就像链接的答案中那样.看起来房间结束后呼叫没有移动到收集部分(我尝试完成房间并且PSTN呼叫立即结束)

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)

有没有其他人为此使用过其他方法?对我来说最简单的方法是告诉 twilio 不要从音频流中删除 DTMF,这样我的解决方案 #1 就可以工作,但我对其他可能利用 twilio 的 gather

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

推荐答案

Twilio 开发人员布道者在这里.

Twilio developer evangelist here.

目前似乎无法直接检测已连接到视频室的电话中的 DTMF 音调.

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.

这篇关于如何检测 Twilio 视频室中的按键音 (DTMF)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆