Как я могу получить Twilio callStatus, используя STATUS CALLBACK URL
Я делаю VoIP-вызов через Twilio на основе TwiML, который динамически генерируется с сервера. Иногда, когда я звоню пользователю, а пользователь недоступен, я не получаю никакого статуса от Twilio. В соответствии с документацией Twilio я установил "STATUS CALLBACK URL" в моем приложении Twilio и установил для него URL обратного вызова (POST Requst). Теперь я запутался, как мне узнать статус вызова, например, по каким параметрам я получу Twilio CallStaus?
[System.Web.Http.HttpPost]
public void TwilioCallbackEvent()
{
}
это пример метода, в котором я хочу получить callStatus от Twilio.
1 ответ
Twilio разработчик евангелист здесь.
Когда Twilio отправляет запрос webhook на ваш URL-адрес обратного вызова, вы получаете следующие параметры в application/x-www-form-urlencoded
формат:
Parameter Description
---------------------------------------------------------------------------
CallStatus A descriptive status for the call. The value is one of queued, initiated, ringing, in-progress, busy, failed, or no-answer.
CallDuration The duration in seconds of the just-completed call. Only present in the completed event.
SipResponseCode The SIP code that resulted in a failed call. For instance 404 for a number that was unreachable or 487 if the Timeout value was reached before the call connected. Only present in the completed event if the CallStatus is failed or no-answer.
RecordingUrl The URL of the phone call's recorded audio. This parameter is included only if Record=true is set on the REST API request and does not include recordings initiated in other ways. RecordingUrl is only present in the completed event. The recording file may not yet be accessible when the Status Callback is sent. Use RecordingStatusCallback for reliable notification on when the recording is available for access.
RecordingSid The unique ID of the Recording from this call. RecordingSid is only present in the completed event.
RecordingDuration The duration of the recorded audio (in seconds). RecordingDuration is only present in the completed event. To get a final accurate recording duration after any trimming of silence, use RecordingStatusCallback.
Timestamp The timestamp when the event was fired, given as UTC in RFC 2822 format.
CallbackSource A string that describes the source of the webhook. This is provided to help disambiguate why the webhook was made. On Status Callbacks, this value is always call-progress-events.
SequenceNumber The order in which the events were fired, starting from 0. Although events are fired in order, they are made as separate HTTP requests and there is no guarantee they will arrive in the same order.
Есть больше информации о CallStatus
параметр в документации.
Вы также получаете все обычные параметры, которые отправляются как часть синхронного обратного вызова TwiML.
Дайте мне знать, если это поможет.