0
我正在使用Twilio API。我的要求是打电话给客户。 1.客户收到来电后会听到一些短信。短信将如下所示:“按1呼叫客户端按2呼叫帮助热线按3再次收听信息等。” 我可以单独做这件事。我可以接受这是由客户通过按下“收集标签是关键,但我不能做进一步。Twilio调用并因此与客户的响应一起工作
下面是代码
$call = $client->account->calls->create($number, $sender_number, 'http://www.mysiteurl.com/outbound.xml', array(
"Method" => "GET",
"StatusCallback" => "http://www.mysiteurl.com/outbound.xml",
"StatusCallbackMethod" => "POST",
"StatusCallbackEvent" => array("initiated", "ringing", "answered", "completed"),
));
在outbound.xml
<=Response=>
<=Gather action="http://www.mysiteurl.com/outbound.php" method="GET" timeout="20"=>
<=Say=>Press 1 to dial the customer's phone number. Press 2 to dial support hotline. Press 3 to listen the message again.</Say>
<=/Gather=>
<=/Response=>
在出站.PHP
$AccountSid = "XXXXX";
$AuthToken = "YYY";
$client = new Services_Twilio($AccountSid, $AuthToken);
$response = $_REQUEST['Digits'];
if($response == 1)
{
$call = $client->account->calls->create($number, $sender_number, 'http://www.mysiteurl.com/one.xml', array(
"Method" => "GET",
"StatusCallback" => "http://www.mysiteurl.com/test.php",
"StatusCallbackMethod" => "POST",
"StatusCallbackEvent" => array("initiated", "ringing", "answered", "completed"),
));
}
在one.xml
<=Response=>
<=Dial=>+1234567890<=/Dial=>
<=Say=>Thank you for calling the customer. Hope you enjoy the call. Goodbye<=/Say=>
<=/Response=>