php - 将多人添加到来自调用者 Twilio 的电话 session

标签 php twilio twilio-api twilio-php twilio-twiml

我阅读了很多关于 Twilio 电话 session 的文章。我创建了一个 php 函数,它创建了一个 Twilio session ,它可以将任何有权访问该链接的人添加到带有 this 链接的 session 。于是我阅读了 this 文章,内容是使用 Twilio 同时调用多个号码。

本文介绍了如何同时调用多个客户端或号码,但第一个接听电话的人将接通而其他人将被挂断。

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial>
    <Number>877-555-1212</Number>
    <Number>877-999-1234</Number>
    <Number>877-123-4567</Number>
  </Dial>
</Response>

现在我的问题是,我可以通过 twilio php 函数将所有这些添加到电话 session 中吗?

我还检查了关于堆栈溢出的 this 问题,但不同的是我使用的是 TwiML,然后我想也许有一个函数可以在他/她调用客户端列表时将所有客户端添加到同一个房间。

 $dial->conference('My conference', array(
            'startConferenceOnEnter' => True,
            'endConferenceOnExit' => True
            ));

最佳答案

我在 twilio 中打开了一张票,其中一位开发人员说通过 REST api 进行调用并将所有客户或号码添加到同一个 session 但就我而言,我的 android 应用程序指向 twilML,因此我决定将调用者本身添加到电话 session 中,然后将我的 REST 调用拨入该电话 session 。

所以现在它适用于我的情况。

这是我的代码

......
//some php codes to configure the Twilio and get the from and to caller ids 


//this part belongs to my caller. I added this php file url to my TwiML app
//so when my user hit the dial button it will sent the caller to this conference room and waits for others.
$response = new Twiml;
$dial = $response->dial();
$dial->conference('Room 123', array(
                'startConferenceOnEnter' => True,
                'endConferenceOnExit' => True
                ));
print $response;


//this is the part that make a call other participants and will  add them to the same conference room that caller is.
$call = $client->calls->create(
    "yourClient", "youtwiliophonenumber",
    array("url" => "http://domain/conference.xml")
);

然后我将这个 xml 文件添加到 REST 调用 api 的 url 这是我的 XML 文件

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial>
    <Conference startConferenceOnEnter="true" endConferenceOnExit="true">Room 123</Conference>
  </Dial>
</Response>

关于php - 将多人添加到来自调用者 Twilio 的电话 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43885628/

相关文章:

php - 在 laravel 5.3 的一页中注册和登录表单

php - 如何使用 php 和 mysql 将 xml 响应解析为变量并存储到表中?

PHP if/else 开关不工作

apple-push-notifications - Twilio Notify 是否支持推送到 Apple 的 PassKit?

node.js - 如何阅读发送到我的 Twilio 电话号码的 SMS 消息?

php - PDO 透视表

c# - 如何使用 TwiML 在 session 中同时拨号

javascript - twilio错误 "accountSid must start with AC"

javascript - 我无法从我的网站播放 twilio 录音

Twilio 录音