ステータス・コールバック
概要
Status Callbacks allow you to receive events related to the REST resources managed by Twilio: Rooms, Recordings and Compositions.
すべてのHTTPリクエストの「Content-Type」ヘッダーは“application/x-www-form-urlencoded”
に設定されます。
目次
Rooms ステータスコールバック
Rooms Status Callbacks allow you to receive events related to your Rooms via HTTP request. Configure a StatusCallback
URL when creating a Room using the REST API, and Twilio will make an HTTP request (webhook) to that URL whenever an event takes place in the Room.
Rooms APIは下記のステータスコールバックイベントを生成します。
Rooms ステータスコールバックイベント
The following events are dispatched to webhook URL specified at Room creation.
イベント | 概要 |
---|---|
room-created | Room created. |
room-ended | Room completed. (Note: Rooms created by the REST API will fire a room-ended event when the room is empty for the amount of time configured as the "unused room timeout" or "empty room timeout" value. Both the unused room timeout and empty room timeout values are 5 minutes by default. See Understanding Video Rooms for more information.) |
participant-connected | Participant joined the Room. |
participant-disconnected | Participant left the Room. |
track-added | Participant added a Track. |
track-removed | Participant removed a Track. |
track-enabled | Participant unpaused a Track. |
track-disabled | Participant paused a Track. |
recording-started | Trackに対するRecordingが開始されました |
recording-completed | Trackに対するRecordingが完了しました |
recording-failed | レコーディング操作のリクエスト中に処理が失敗しました |
例
A curl example of configuring the StatusCallback URL.
curl -XPOST 'https://video.twilio.com/v1/Rooms' \
-u '{API Key SID}:{API Secret}' \
-d 'UniqueName=DailyStandup' \
-d 'StatusCallback=https://hooks.yoursite.com/room-events' \
-d 'StatusCallbackMethod=POST' \
-d 'Type=peer-to-peer'
Roomsステータスコールバックリクエストパラメーター
Twilio passes the following parameters in each of the above-listed events whenever it makes an HTTP request to the StatusCallback
URL you've set:
パラメーター | イベント | 概要 |
---|---|---|
AccountSid | すべて | The AccountSid associated with this Room |
Room Name | すべて | The UniqueName of the Room generating this event. |
RoomSid | すべて | The Sid of the Room generating this event. |
RoomStatus | すべて | The Status of the Room generating this event. |
roomType | すべて | The Type of the Room generating this event. |
StatusCallbackEvent | すべて | Roomイベント 例えば、room-created です。 完全なリストについては、Roomsステータスコールバックイベントを参照してください。 |
Timestamp | すべて | イベントの時間です。 UTC ISO 8601タイムスタンプに適合しています。 |
ParticipantSid | All Participant and Track Events | The Sid for the Participant generating this event. |
ParticipantStatus | All Participant and Track Events | このイベントを生成したParticipantの現在のStatus です - connected またはdisconnected のいずれかです。 |
ParticipantDuration | Only on participant-disconnected event |
The total duration the Participant remained connected to the Room. |
ParticipantIdentity | All Participant and Track Events | The Identity of the Participant generating this event. Participant identities are set via the Participant's Access Token |
RoomDuration | Only on room-ended |
The total duration of the Room, in seconds. |
SequenceNumber | すべて | This is an internal field and does not represent the true order of this event in the Room. Use the Timestamp field to track the order of this event in relation to other Room events. |
TrackSid | Trackの全イベント | TrackのSid です。 |
TrackKind | Trackの全イベント | The Kind of the Track (data , audio or video ). |
Recordingsステータスコールバックのリクエストパラメーター
The parameters below are included only in events related to Recordings.
パラメーター | EventType | 概要 |
---|---|---|
AccountSid | recording-* の全イベント |
TwilioのアカウントSID |
RecordingSid | recording-* の全イベント |
RecordingSID. |
Timestamp | recording-* の全イベント |
イベントの時間です。 UTC ISO 8601タイムスタンプに適合しています。 |
StatusCallbackEvent | recording-* の全イベント |
Roomのイベントです。 たとえば、recording-started などです。 |
RoomSid | recording-* の全イベント |
The Sid of the Room generating this recording. |
Room Name | recording-* の全イベント |
The given name of the Room generating this recording. |
roomType | すべて | The Type of the Room generating this event. |
ParticipantSid | recording-* の全イベント |
The Sid of the Participant generating this recording. |
SourceSid | recording-* の全イベント |
This recording’s source TrackSID, MTxxx . |
RecordingUri | recording-* の全イベント |
The relative URL to retrieve this recording's metadata. |
MediaUri | Only on recording-completed |
生成されたメディアを取得するためのURLです。 |
Duration | Only on recording-completed |
レコーディングの長さです。 |
Size | Only on recording-completed |
レコーディングされた総バイト数です。 |
MediaExternalLocation | Only on recording-completed |
URL to fetch the generated media if stored in external storage. |
Container | recording-* の全イベント |
Container of the recording. Container used are mka for audio recordings and mkv for video recordings. |
Codec | recording-* の全イベント |
Codec used for this recording. This could be PCMU or OPUS for audio recordings, and VP8 or H264 for video recordings. |
ParticipantIdentity | recording-* の全イベント |
The Identity of the Participant generating this event. Participant identities are set via the Participant's Access Token. |
TrackName | recording-* の全イベント |
The name that was given to the source track of this recording. If no name is given, the SourceSid is used. |
Type | recording-* の全イベント |
The type of track for this recording, audio or video . |
FailedOperation | Only on recording-failed |
失敗した操作: RecordingStart | RecordingComplete | RecordingUpload |
Compositions Status Callbacks
Composition Status Callbacks allow you to receive events related to your Compositions via HTTP request. You can configure the StatusCallback
URL to receive your callbacks using two mechanisms:
- When you create a Composition using directly the REST API, you can set the
StatusCallback
URL as a POST parameter. In this case, at that URL you will only receive events related to that specific Composition. - When you create a Composition Hook, you can set the
StatusCallback
URL at such Hook. In this case, at that URL you will receive events regarding that Hook as well as events regarding all Compositions created by such Hook.
Twilio will generate the following Status Callback events regarding your Compositions and Composition Hooks.
Compositions Status Callback Events
The following events are dispatched to Compositions and Composition Hooks StatusCallback
URLs.
イベント | 概要 |
---|---|
composition-enqueued | A new Composition has been created and enqueued for processing, but processing has not yet started. This event is only fired when the Composition is created through a Composition Hook. |
composition-hook-failed | The Hook failed to create a new Composition. |
composition-started | The media processing task started. |
composition-available | The media processing tasks completed and the Composition media file can be downloaded. |
composition-progress | Progress report for the media composition task, sent approximately every 10%. |
composition-failed | The media processing task failed. |
Compositions Status Callback request parameters
The parameters below are included in the composition-*
events.
パラメーター | EventType | 概要 |
---|---|---|
AccountSid | composition-* の全イベント |
TwilioのアカウントSID |
RoomSid | composition-* の全イベント |
SID of the Group Room being the source of tracks for this Composition |
HookSid | composition-enqueued and composition-hook-failed |
SID of the Composition Hook |
HookUri | composition-enqueued and composition-hook-failed |
The relative URL to retrieve the Composition Hook metadata. |
HookFriendlyName | composition-enqueued and composition-hook-failed |
The friendly name of the Composition Hook. |
CompositionSid | All composition-* events except for composition-hook-failed |
SID of the Composition. |
CompositionUri | All composition-* events except for composition-hook-failed |
The relative URL to retrieve the Composition's metadata. |
MediaUri | Only on composition-available |
The relative URL to fetch the composed media. |
Duration | Only on composition-available |
Duration of the composition. |
Size | Only on composition-available |
Total number of bytes of the resulting composition. |
MediaExternalLocation | Only on composition-available |
URL to fetch the generated media if stored in external storage. |
PercentageDone | Only on composition-progress |
Percentage of composition done. |
SecondsRemaining | Only on composition-progress |
Estimated time remaining for the composition job to be finished (in seconds). |
FailedOperation | composition-failed and composition-hook-failed |
Operation that failed. |
ErrorMessage | composition-failed and composition-hook-failed |
Human-readable message that provides more information about the error. |
StatusCallbackEvent | composition-* の全イベント |
The Composition event. For example, composition-started . |
Timestamp | composition-* の全イベント |
イベントの時間です。 UTC ISO 8601タイムスタンプに適合しています。 |
ヘルプが必要ですか?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.