问题
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