Twilio - why i get in call status is in-progress also completed and my phone not ringing yet

别等时光非礼了梦想. 提交于 2019-12-08 11:37:55

问题


this is my code :

require_once 'library/Twilio/autoload.php'
use Twilio\Rest\Client
account_sid ='ACXXXXXXX'
auth_token ='xxxxx'
twilio_number ='+1xxxx'
to_number = "+212xxxx"
client = new Client($account_sid, $auth_token)
client->account->calls->create(  
    to_number,
    twilio_number,
    array("method" => "GET","statusCallback" => "https://xxx.php",
        "statusCallbackEvent" => array('initiated', 'ringing', 
        'answered','completed'),
        "statusCallbackMethod" => "POST",
        "url" => "http://xxx.php" 
    )
)

And this is the results of callstatus: 1-initiated 2-in-progress 3-completed


回答1:


Twilio developer evangelist here.

In your final comment you show that you are using array('queued','initiated', 'ringing', 'answered', 'completed') as your statusCallbackEvent parameter. When making calls with the REST API the only available events that you can subscribe to are initiated, ringing, answered and completed.

You may find that the CallStatus parameter you receive is one of queued, initiated, ringing, in-progress, busy, failed, or no-answer but those are the available statuses, not the available events to subscribe to.

Ensure that you are only requesting the events initiated, ringing, answered and completed and your call should be fine.



来源:https://stackoverflow.com/questions/53299011/twilio-why-i-get-in-call-status-is-in-progress-also-completed-and-my-phone-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!