gpt4 book ai didi

twilio - 在 twilio 中未注册的两个号码之间调用电话

转载 作者:行者123 更新时间:2023-12-05 02:20:43 28 4
gpt4 key购买 nike

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

最佳答案

这只是让您开始的简单操作,您还可以查看连接到 session 室 https://www.twilio.com/docs/api/twiml/conference

您将需要使用从 https://www.twilio.com/docs/libraries/php#install-via-zip-file 下载的 Twilio PHP Helper Library(那里的“服务”文件夹)

项目结构

/
/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();
}

?>

调用乔.php

<?php

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

<!-- call and connect Joe at 9995557777 with Bill's caller ID-->
<Response>
<Pause length="2"/>
<Say>Please wait, I'm calling Joe.</Say>
<Dial callerId="7779995555">9995557777</Dial>
</Response>

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

关于twilio - 在 twilio 中未注册的两个号码之间调用电话,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37979664/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com