对所有会议参与者使用说动词 [英] Use Say verb to all Conference participants

查看:24
本文介绍了对所有会议参与者使用说动词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置一个非常简单的电话会议系统,用户在其中输入 PIN 并连接到与之关联的会议.我也在设置,以便他们在进入房间之前记录他们的名字.

I'm setting up a pretty simple conference call system, where the user enters a PIN and is connected to a conference associated with that. I'm also setting it up so they record their name before entering the room.

我的计划是获取录音 URL,然后获取参与者列表,并对每个调用者进行 REST API 调用,将他们的调用修改为说现在进入",然后播放录音 URL.我想在那之后我也得把他们送回房间,我不确定.

My plan is to take the recording URL, then get the list of participants and make the REST API call to each caller modifying their call to to the Say "Now entering", then Play the recording url. I think I'm going to have to send them back into the room after that as well, I'm not sure.

我认为修改每个电话都会使他们离开会议室,这并不理想.是否有更简单的方法可以对 REST API 中内置的会议的所有成员使用 Say/Play?

I think that modifying each call will take them out of the Conference room, which is not ideal. Is there an easier way to use Say/Play to all members of a conference built into the REST API?

推荐答案

自 2018 年 7 月 13 日th起,Twilio 现在允许您将 POST 请求发送到 POSTa href="https://www.twilio.com/docs/voice/api/conference#update-a-conference-resource" rel="nofollow noreferrer">会议(向整个会议宣布一些事情) 或 会议参与者(到向单个调用者宣布某些内容)具有链接到以下任一者的 AnnounceUrl 属性的资源:

As of July 13th 2018, Twilio now allows you to send a POST request to the Conference (to announce something to the whole conference) or Conference Participant (to announce something to a single caller) resources with an AnnounceUrl property that links to either:

  • WAV 或 MP3 音频文件,或
  • 使用 和/或 动词的 TwiML 文档.
  • a WAV or MP3 audio file, or
  • a TwiML document that uses the <Say /> and/or <Play /> verbs.

除了该属性外,您还可以指定 AnnounceMethod 属性,让您指定是 GET 还是 POST(默认)网址.

Along with that property, you can also specify an AnnounceMethod property that lets you specify whether to GET or POST (the default) that URL.

发送上述 POST 以播放您录制​​的名称的好地方可能是在您使用 <Conference/> 动词时设置的状态回调中将每个用户放入会议,如下所示:

A good place to send the aforementioned POST to play back your recorded name might be in a status callback that's set when you use the <Conference /> verb to put each user into the conference, like so:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial>
    <Conference statusCallback="/conference/join-callback"
                statusCallbackEvent="join">
      {conference ID}
    </Conference>
  </Dial>
</Response>

旧的解决方法保留在下面以供后代使用.

The old workaround remains below for posterity.

Twilio 论坛上有人对同样的问题感兴趣,并且答案是目前没有直接的 REST API 调用.

Someone on the Twilio forums was interested in the very same question, and the answer is currently that there isn't a direct REST API call for that.

您需要做的是,当参与者加入会议时,您将使用 REST API 使 Twilio 拨回您的应用程序.您可以根据自己的喜好选择如何检测您正在呼叫自己的会议(例如,比较呼出和呼入电话号码是否相等);检测到这一点后,您可以直接将该呼叫加入会议并使用 TwiML 动词为大家回放介绍.

What you'll need to do is, when a participant joins the conference, you'll use the REST API to make Twilio dial back in to your application. You can choose how to detect that you're calling into your own conference however you like (for example, comparing the outbound and inbound phone numbers for equality); once you've detected that, you can join that call directly to the conference and use the TwiML <Say /> and <Play /> verbs to play back the introduction for everybody.

这有点令人费解,但这样您就不会将每个参与者从会议中删除(阻止他们暂时听到对方的声音),然后又重新加入.

It's a little bit convoluted, but this way you won't be removing each participant from the conference (preventing them from hearing each other for a moment) and then rejoining them.

这应该类似于一个好的端到端解决方案.

Here's something that should resemble a good end-to-end solution.

首先,用户拨入,然后您按照标准提示获取会议室的 PIN 码和他们的姓名.

First, the user dials in and you go through the standard prompts to get the PIN for the conference room and their name.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Gather action="/conference/pin" finishOnKey="#">
        <Say>Please the conference pin number followed by the pound key.</Say>
    </Gather>
</Response>

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say>Say your name and then press the pound key.</Say>
    <Record action="/conference/name" finishOnKey="#" />
</Response>

现在,一旦您拥有用户的 pin 和录音,就会发生两件事;帖子对 /conference/name 的响应将包含 动词,将用户置于房间中:

Now, once you have the user's pin and recording, two things will happen; the response from the post to /conference/name will contain the <Conference> verb, placing the user in the room:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial>
    <Conference>{conference ID}</Conference>
  </Dial>
</Response>

...并且,与此异步,它将使用 REST API 发起一个新的回会议室呼叫.

...and, asynchronous to that, it will use the REST API to initiate a new call back into the conference room.

POST /2010-04-01/Accounts/{AccountSid}/Calls
From = {your conference phone number}
To = {your conference phone number}
SendDigits = wwww{conference PIN}#
Url = /conference/announce?name={name ID}

现在,下一点令人困惑.现在,Twilio 将与呼叫传入端的回调 URL 以及您在上面指定的呼叫传出端的 URL 进行通信.您的来电处理程序需要检测会议线路是否正在回拨自身并表现出不同的行为;它首先需要使用简单的 TwiML 进行响应,允许呼叫的传出端输入会议室的 PIN.

Now, the next bit gets confusing. Twilio will now be talking to your callback URL for the incoming end of the call, and the URL you specified above for the outgoing end of the call. Your incoming call handler will need to detect that the conference line is calling back into itself and behave differently; it will first need to respond with simple TwiML that allows the outgoing end of the call to enter the pin for the conference room.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Gather action="/conference/announce-pin" finishOnKey="#" />
</Response>

POST 的 SendDigits 参数将提供 TwiML 位期望的数字.然后,该操作应通过在新呼叫中召开会议来做出响应.

The SendDigits parameter of the POST will provide the digits that bit of TwiML is expecting. That action should then respond by conferencing in the new call.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial>
    <Conference>{conference ID}</Conference>
  </Dial>
</Response>

最后一块拼图是您在 POST 中指定的 URL 发出的 TwiML.这是将环回调用添加到会议后将运行的标记.

The last piece of the puzzle is the TwiML emitted by the URL you specified in the POST. That's the markup that will run once the loopback call is added to the conference.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Play>/conference/name-recordings/{name ID}</Play>
    <Say>has joined the call.</Say>
    <Hangup />
</Response>

该标记运行,在会议室播放来电者的姓名和一条消息,然后挂断.

That markup runs, plays the caller's name and a message into the conference room, and then hangs up.

这篇关于对所有会议参与者使用说动词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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