Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在twilio中使用StatusCallbackURL_Twilio - Fatal编程技术网

如何在twilio中使用StatusCallbackURL

如何在twilio中使用StatusCallbackURL,twilio,Twilio,第三个参数应该是URL,而不是'60'。呼叫结束后,所有数据将作为正常的POST或GET参数(取决于您在帐户中的设置)传递到回调URL。您忘记指定状态回调URL的方法 我已经在代码中包含了它 <?php $options = array( "StatusCallback" => 'http://173.203.104.63/call/out/log-callback.php? id='.$id ); $client = new Services_Twilio($sid, $t

第三个参数应该是URL,而不是
'60'
。呼叫结束后,所有数据将作为正常的
POST
GET
参数(取决于您在帐户中的设置)传递到回调URL。

您忘记指定状态回调URL的方法

我已经在代码中包含了它

<?php
$options = array(
  "StatusCallback" => 'http://173.203.104.63/call/out/log-callback.php?  id='.$id
);

$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
    $cphonenumber, // The number of the phone receiving call
    '60',
    'http://173.203.104.63/call/out/three.php?id='.$id, // The URL Twilio will request when the call is answered
    $options
  );
...
“获取”,
“状态回调”=>“https://www.myapp.com/events",
“StatusCallbackMethod”=>“POST”,
“StatusCallbackEvent”=>数组(“已启动”、“正在鸣响”、“已应答”、“已完成”),
));
echo$call->sid;

请参见

Hi,只有在呼叫完成时才会请求
StatusCallback
URL。当呼叫连接时,您应该使用
Url
请求该Url。您应该能够知道调试器中请求了哪个URL。为什么要查看那个URL?因为发布的代码是从示例4复制的?它有什么作用?你认为这有什么帮助?OP代码的关键点是什么?
    <?php
//"StatusCallbackMethod" can be "POST" or "GET", depends on the way you recieve it on your StatusCallback,
    $options = array(
      "StatusCallbackMethod"=>"GET",
      "StatusCallback" => 'http://173.203.104.63/call/out/log-callback.php?  id='.$id
    );

$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
    $cphonenumber, // The number of the phone receiving call
    '60',
    'http://173.203.104.63/call/out/three.php?id='.$id, // The URL Twilio will request when the call is answered
    $options
  );
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); //  

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "AC5ef8732a3c49700934481addd5ce1659";
$token = "{{ auth_token }}";
$client = new Services_Twilio($sid, $token);
$call = $client->account->calls->create("+18668675309", "+14155551212",      "http://demo.twilio.com/docs/voice.xml", array(
    "Method" => "GET",
   "StatusCallback" => "https://www.myapp.com/events",
   "StatusCallbackMethod" => "POST",
   "StatusCallbackEvent" => array("initiated", "ringing", "answered", "completed"),
));
echo $call->sid;