我想在 1 号和 2 号之间进行实时对话。我的代码如下 -
<?php
require 'twilio-php-master/Twilio/autoload.php';
use Twilio\Rest\Client;
$sid = "******************";
$token = "***************";
$client = new Client($sid, $token);
try {
// Initiate a new outbound call
$call = $client->account->calls->create(
// Step 4: Change the 'To' number below to whatever number you'd like
// to call.
"Number 2",
// Step 5: Change the 'From' number below to be a valid Twilio number
// that you've purchased or verified with Twilio.
"Number 1",
// Step 6: Set the URL Twilio will request when the call is answered.
array("url" => "twiml_url")
);
echo "Started call: " . $call->sid;
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
?>
下面给出了我的 twiML -
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="Number 1">
<Number>Number 2</Number>
</Dial>
</Response>
当我在浏览器中点击此 REST api 时,我在手机中接到电话,但在试用帐户消息后电话断开连接。请帮我。