0

我正在使用Twilio REST API进行提醒调用,但我没有得到正确的CallStatus.

当一个调用被忽略或没有收到应答时,我仍然会在这两个状态$_POST['CallStatus']以及/2010-04-01/Accounts/XXX/Calls/XXX.json我调用StatusCallbackAPI 请求的参数中作为一个状态完成。

下面是我的代码:

$client = new Services_Twilio($account_sid, $auth_token);
try
{
    $options = array("StatusCallback" => site_url()."/callsms/endofcall/");
    $call = $client->account->calls->create(
                   '+1xxxxxxxxxx', // From a valid Twilio number
                   '+1xxxxxxxxxx', // Call this number
                   site_url()."/callsms/call_user_xml/",
                   $options
            );
           //return $call->sid;
} catch (Exception $e) {
   echo 'Error starting phone call: ' . $e->getMessage() . "\n";
}

在我写的 endofcall 页面中:

$twilio_configs = $this->config->item('twilio');
$account_sid = $twilio_configs['account_sid'];
$auth_token = $twilio_configs['auth_token'];
// set URL and other appropriate options
$curl = 'https://'.$account_sid.':'.$auth_token.'@api.twilio.com/2010-04-01/Accounts/'.$account_sid.'/Calls/'.$csid.'.json';
$content = file_get_contents($curl);
$result = json_decode($content);
if($result->status=='completed')
{
      //DATABASE ENTRY
}

请帮忙!

4

1 回答 1

0

如果呼叫转到语音信箱,它仍将显示为completed。它只会显示为no-answer好像您没有配置语音邮件并忽略呼叫。

于 2012-07-06T16:58:09.840 回答