我正在过渡到twilio库的第5版。
我正在成功发送短信:
/* attempt to send the message */
$twilio_client->messages->create(
"+1".$recipient,
array (
'From' => "+1".$org,
'Body' => $txtmsg,
'StatusCallback' => CALLBACK_LINK
)
);
我已成功发送语音电话:
$client->calls->create(
"1".$recipient, "1"+$org
array (
'Url' => MSG_XML,
'StatusCallback' => CALLBACK_LINK,
"StatusCallbackEvent" => array(
"initiated", "ringing", "answered", "completed", "failed"
)
)
);
在这两种情况下,如何在通话后立即获得消息SID?在Twilio调用任何回调网址之前,我需要SID。
答案 0 :(得分:2)
你可以这样得到答案:
$msg = $twilio_client->messages->create(
"+1".$recipient,
array (
'From' => "+1".$org,
'Body' => $txtmsg,
'StatusCallback' => CALLBACK_LINK
)
);
echo $msg->sid;