在 twilio 中未注册的两个号码之间拨打电话

Make a call between two numbers not registered in twilio

有什么方法可以在我的两个用户之间进行通话?我的意思是......我有一个带有注册号码的 twilio 帐户,我必须打电话给我的客户 "Bill" 所以当他回答时,电话应该被重定向到 Bill 选择的另一个客户,比方说"Joe"。因此,Bill 单击一个按钮,然后他 phone 响铃,他接听并开始呼叫 Joe。当他们中的一些人挂断电话时,all call 应该结束了。有人做过吗?帮我!我很抱歉我的英语不好 (哦,是的,我为此使用 php)

这只是让你开始的简单事情,你也可以看看连接到会议室 https://www.twilio.com/docs/api/twiml/conference

您需要使用从 https://www.twilio.com/docs/libraries/php#install-via-zip-file[=16 下载的 Twilio PHP Helper Library(那里的 "Services" 文件夹) =]

项目结构

/
/Services
/callBill.php
/callJoe.php

callBill.php

<?php
    header("content-type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>

<Response>
    <!-- // calling Bill -->
</Response>

<?php
    // Include the Twilio PHP library
    require 'Services/Twilio.php';

    // Twilio REST API version
    $version = "2010-04-01";

    // Set our Account SID and AuthToken
    $sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
    $token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

    // A phone number you have at Twilio
    $phonenumber = '5557779999';

    // The URL Twilio will request when the call is answered            
    $twilioRequestUrl = "http://somewebsite.xyz/callJoe.php";

    // Instantiate a new Twilio Rest Client
    $client = new Services_Twilio($sid, $token, $version);

    try {

        // Initiate a new outbound call
        $call = $client->account->calls->create(
            $phonenumber, // The number of the phone initiating the call
            '7779995555', // call Bill at 7779995555
            $twilioRequestUrl 
        );
        //echo 'Started call: ' . $call->sid;
    } catch (Exception $e) {
        //echo 'Error: ' . $e->getMessage();
    }

?>

callJoe.php

<?php

    header("content-type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>

<!-- call and connect Joe at 9995557777 -->
<Response>
    <Pause length="2"/>
    <Say>Please wait, I'm calling Joe.</Say>
    <Dial>9995557777</Dial>
</Response>

使用浏览器或单击按钮请求 http://somewebsite.xyz/callBill.php