Twilio(TwiML):拨另一个电话
我想在该流程中连接两个电话号码: 有人在接电话。播放语音信息,询问他是否愿意参加电话会议。只有在以下情况下,才会启动接受电话会议的人员_1: 这就是我想做的: Intro.chtml:Twilio(TwiML):拨另一个电话,twilio,twilio-twiml,Twilio,Twilio Twiml,我想在该流程中连接两个电话号码: 有人在接电话。播放语音信息,询问他是否愿意参加电话会议。只有在以下情况下,才会启动接受电话会议的人员_1: 这就是我想做的: Intro.chtml: <Response> <Gather numDigits="1" action="StartConferenceCall.chtml" method="GET"> <Say>Press 1 to start the conference call</S
<Response>
<Gather numDigits="1" action="StartConferenceCall.chtml" method="GET">
<Say>Press 1 to start the conference call</Say>
</Gather>
</Response>
@{
var digits = Request["Digits"];
if(digits == "1")
{
<Response>
<Dial> // I would like to dial the second person
<Conference beep="false" record="record-from-start"
Room 1234
</Conference>
</Dial>
</Response>
}
else
{
<Hangup/>
}
}
按1开始电话会议
StartConferenceCall.chtml:
<Response>
<Gather numDigits="1" action="StartConferenceCall.chtml" method="GET">
<Say>Press 1 to start the conference call</Say>
</Gather>
</Response>
@{
var digits = Request["Digits"];
if(digits == "1")
{
<Response>
<Dial> // I would like to dial the second person
<Conference beep="false" record="record-from-start"
Room 1234
</Conference>
</Dial>
</Response>
}
else
{
<Hangup/>
}
}
@{
变量数字=请求[“数字”];
如果(数字==“1”)
{
//我想拨第二个人
这里是Twilio开发者福音传道者
因为你改变了原来的问题,我删除了我以前的答案,并为你准备了另一个例子
由于您希望自己启动呼叫,并让用户按1
,以防他们接受问题,因此您需要使用。具体而言,您希望这样做将提示用户按下按钮。下面的代码是C#
在上面的代码中,我发起了两个呼叫。一个是给客户的,另一个是给应该在线的人的。如果你愿意,你可以更改逻辑,但是为了简化事情,我同时发起两个呼叫
然后,第一次通话会将用户放在菜单上,用户可以按1键加入通话
public IActionResult Call()
{
var twiml = new TwilioResponse();
return TwiML(twiml.BeginGather(new { action = "/Conference", numDigits = "1" }).Say("Press 1 to start the conference call").EndGather());
}
然后,两个呼叫都被重定向到/conference
,在这里创建或加入会议室。您可以通过逻辑检查用户是否在此处拨打了1
public IActionResult Conference()
{
var twiml = new TwilioResponse();
return TwiML(twiml.DialConference("Room 1234"));
}
希望这对您有所帮助为我的答案添加了一个新链接,其中包含发起新呼叫的文档。希望这对您有所帮助,我在这里找到了它: