TwiML™ Voice: <Conference>
The <Dial>
verb's <Conference>
noun allows you to connect to a conference room. Much like how the <Number>
noun allows you to connect to another phone number, the <Conference>
noun allows you to connect to a named conference room and talk with the other callers who have also connected to that room. Conference is commonly used as a container for calls when implementing hold, transfer, and barge.
Twilioは、世界規模に分散された低遅延な電話会議システムを提供しています。 電話会議は大多数の参加者にもっとも近い地域でホストされ、最大の参加者キャパシティーは250人です。 通常の音声通話の分単位の料金に加え、参加者単位、分単位の料金も適用されます。 Conferenceの料金体系についてさらに詳しく
カスタマイズが可能な機能
自由にルームの名前をつけることができます。この名前はアカウント内でのみ有効です。これは、あなたのアカウント経由で room1234
に入室する発信者は全員同じカンファレンスルームに入室することになりますが、別のアカウント経由で接続している発信者はそこには入室できないことを意味します。
コンプライアンス上の理由から、電話番号、メールアドレス、または個人名やその他の機密情報のような個人データ(個人識別情報とも呼ばれます)をカンファレンスの命名に使用しないでください。
デフォルトでは、Twilioカンファレンスルームはあなたのニーズに合わせてルームを 有効・無効 にすることができます。
- カンファレンスは 2名以上の参加が無ければ始まりません。
- 待機中は、カスタマイズ可能な音楽を再生します。
- 参加者が入室したり退出したりする時に、通知音を出して他の参加者に知らせます。
- イベントを構成してアプリケーションに対して電話会議の状態変化を知らせるアラートを発することができます。
- Receive a webhook when a participant speaks or stops speaking
これらの機能は、ユーザーのニーズに合わせて設定したり、無効化したりできます。
名詞の属性
この名詞<Conference>
は振る舞いを変更する属性をサポートします。
属性名 | 許容値 | 初期値 |
---|---|---|
muted | true, false | false |
beep | true, false, onEnter, onExit | true |
startConferenceOnEnter | true, false | true |
endConferenceOnExit | true, false | false |
participantLabel | a label for the conference participant | なし |
jitterBufferSize | small, medium, large, off | large |
waitUrl | TwiML の URL、空文字列 | デフォルトの Twilio 保留音 |
waitMethod | GET または POST | POST |
maxParticipants | 250以下の正の整数です | 250 |
record | do-not-record もしくは record-from-start | do-not-record |
region | us1, ie1, de1, sg1, br1, au1, jp1 | なし |
trim | trim-silence (無音部分を削除する) もしくはdo-not-trim | trim-silence |
coach | 通話SIDです | none |
statusCallbackEvent | start end join leave mute hold modify speaker announcement | なし |
statusCallback | 相対または絶対 URL | なし |
statusCallbackMethod | GET, POST | POST |
recordingStatusCallback | 相対または絶対 URL | なし |
recordingStatusCallbackMethod | GET, POST | POST |
recordingStatusCallbackEvent | in-progress, completed, absent | completed |
eventCallbackUrl | 相対または絶対 URL | なし |
muted
muted
属性は参加者がカンファレンスで話すことができるかを指定します。true
に設定された場合、参加者はカンファレンスで音声を聞くことだけができます。デフォルトはfalse
です。
To change a conference participant's muted attribute during a call use to the Conference Participant API.
beep
beep
属性は参加者がカンファレンスに参加、退出した際に通知音を出すか否かを設定できます。デフォルトはtrue
です。
値 | 動作 |
---|---|
true | デフォルト設定。参加者が参加、退出した歳、ビープ音を再生します。 |
false | 参加者が参加、退出した際のビープ音を無効にします。 |
onEnter | 参加者がカンファレンスに参加した時のみビープ音を再生します。参加者が退出したした時はビープ音を再生しません。 |
onExit | 参加者がカンファレンスを退出した時のみビープ音を再生します。参加者が参加した時はビープ音を再生しません。 |
startConferenceOnEnter
参加者がいて、まだカンファレンスが始まっていない場合、カンファレンスのスタートを伝える属性です。デフォルトはtrue
です。設定値がfalse
で且つ参加者がいるがカンファレンスが始まっていない場合、参加者はミュートになり、バックグランドミュージックが流れます。startConferenceOnEnterがtrue
である特定の参加者が参加するまで続きます。司会者が存在するカンファレンスで便利です。
endConferenceOnExit
true
に設定されている場合、該当の参加者が退出するとカンファレンスは終了し、他の参加者全員が強制的に退出させられます。デフォルトはfalse
です。2つのコールをブリッジし、片方が切断してもTwiMLを実行し続ける場合、且つ司会者がいるカンファレンスを作る場合に便利です。
participantLabel
A unique label for the participant which will be added into the conference as a result of executing the TwiML. The label provided here can be used subsequently to read or update participant attributes using the Twilio REST API. The participantLabel must be unique across all participants in the conference, and there is a max limit of 128 characters.
If a participant with the same label already exists in the conference, 16025 error notification will be reported, and visible on Twilio Console. The call will not be added into the conference and instead continue to the next TwiML verb.
jitterBufferSize
The jitterBufferSize
attribute lets you set the jitter buffer behavior for a conference participant. Twilio Conference uses a jitter buffer to smooth out irregularity in media packet arrival times when mixing audio for conference participants. This buffer results in fewer audio artifacts, but introduces a fixed delay for the audio of each participant.
Setting the jitterBufferSize
value to small
will create a 20ms buffer that results in average latency of ~150ms - ~200ms on a stream with max jitter of ~20ms.
Setting the value to medium
will create a 40ms buffer that results in average latency of ~200ms - ~360ms on a stream with max jitter of ~20ms.
The large
setting, which is the default jitter buffer behavior, will create a 60ms buffer that results in average latency between ~300ms - ~1000ms on a stream with max jitter of ~20ms.
Spikes of extremely high jitter can result in the maximum latency exceeding the average latency by as much as 50%.
The off
setting completely disables the buffer and packets with relatively low jitter ( <=20ms) will be completely dropped, but Twilio will add no extra latency when mixing.
The buffer value is a particpant-level setting, the value for participant A does not apply to participant B.
waitUrl
The waitUrl
attribute lets you specify a URL for music that plays before the conference has started. The URL may be an MP3, a WAV or a TwiML document that uses <Play>
or <Say>
for content. This defaults to a selection of Creative Commons licensed background music, but you can replace it with your own music and messages. If the waitUrl
responds with TwiML, Twilio will only process <Play>
, <Say>
, and <Redirect>
verbs. <Record>
, <Dial>
, and <Gather>
verbs are not allowed. If you do not wish anything to play while waiting for the conference to start, specify the empty string (set waitUrl
to ''
).
If no waitUrl
is specified, Twilio will use its own HoldMusic Twimlet that reads a public AWS S3 Bucket for audio files. The default waitUrl
is: http://twimlets.com/holdmusic?Bucket=com.twilio.music.classical
Please note, if the request to your waitUrl fails, the Conference will not be fully established. To avoid the call being disconnected, you can either add additional TwiML after the initial <Dial>
<Conference>
, or programmatically provide fallback behavior via the action callback.
この URL は、クリエイティブ コモンズ のクラシック音楽を格納した S3 バケット com.twilio.music.classical を示しています。 次のリストの S3 バケットが用意されています。いろいろなジャンルの音楽から選べます。
waitMethod
This attribute indicates which HTTP method to use when requesting waitUrl
. It defaults to 'POST'. Be sure to use 'GET' if you are directly requesting static audio files such as WAV or MP3 files so that Twilio properly caches the files.
maxParticipants
この属性は、名前のついた電話会議室に許容したい最大参加者数を表します。 最大参加者数は250です。
record
The record
attribute lets you record an entire <Conference>
. When set to record-from-start
, the recording begins when the first two participants are bridged. The hold music is never recorded. If a recordingStatusCallback
URL is given, Twilio will make a request to the specified URL with recording details when the recording is available to access.
region
The region
attribute specifies the region where Twilio should mix the conference. Specifying a value for region overrides Twilio's automatic region selection logic and should only be used if you are confident you understand where your conferences should be mixed. Twilio sets the region parameter from the first participant that specifies the parameter and will ignore the parameter from subsequent participants.
trim
The trim
attribute lets you specify whether to trim leading and trailing silence from your audio files. trim
defaults to trim-silence
, which removes any silence at the beginning or end of your recording. This may cause the duration of the recording to be slightly less than the duration of the call.
coach
Coach accepts a call SID of a call that is currently connected to an in-progress conference. Specifying a call SID that does not exist or is no longer connected to the conference will result in the call failing to the action URL and throwing a 13240 error.
statusCallbackEvent
The statusCallbackEvent
attribute allows you to specify which conference state changes should generate a Webhook to the URL specified in the statusCallback
attribute. The available values are start
, end
, join
, leave
, mute
, hold
, modify
, speaker
, and announcement
. To specify multiple values separate them with a space. Events are set by the first Participant to join the conference, subsequent statusCallbackEvents will be ignored. If you specify conference events you can see a log of the events fired for a given conference in the conference logs in the console.
イベント | 概要 |
---|---|
start | The conference has begun and audio is being mixed between all participants. This occurs when there are at least two participants in the conference, and at least one of the participants has startConferenceOnEnter="true" . |
end | 最後の参加者がカンファレンスから退出したか、または endConferenceOnExit="true" の参加者がカンファレンスから退出しました。 |
join | 参加者がカンファレンスに参加しました。 |
leave | 参加者がカンファレンスから退出しました。 |
mute | 参加者がミュートまたはミュート解除されています。 |
Hold | 参加者が保留、または保留解除しました。 |
modify | At least one of a participant's attributes has been modified: BeepOnExit , EndConferenceOnExit , Coaching , WaitUrl |
speaker | A participant has started or stopped speaking. |
announcement | A participant or conference announcement has ended or failed. Currently, the announcement-fail event will only be sent if there is an internal Twilio error. We are working to add more failures to the announcement-fail event to allow developers to debug the issue. |
statusCallback
The statusCallback
attribute takes a URL as an argument. Conference events specified in the statusCallbackEvent
parameter will be sent to this URL.
The statusCallback
URL is set by the first Participant to join the conference, subsequent setting of the statusCallback
will be ignored.
The parameters contained in the events requests are detailed below.
statusCallbackMethod
上述の URL へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。初期値は POST です。
リクエストパラメーター
Twilio will pass the following parameters with its request to the statusCallback
URL. For participant announcement events, Twilio will pass additional participant-related request parameters if the participant being announced to is still present in the conference.
パラメーター | 例 | 送信時 |
---|---|---|
ConferenceSid | CFe08c870b500f6e44a9ad184defd1f391 | 送信時:すべて |
FriendlyName | MyConf | 送信時:すべて |
AccountSid | AC25e16e9a716a4a8617a7c83f58e30482 | 送信時:すべて |
SequenceNumber | 1 | 送信時:すべて |
Timestamp | Thu, 1 Jun 2017 20:48:32 +0000 | 送信時:すべて |
StatusCallbackEvent | conference-end conference-start participant-leave participant-join participant-mute participant-unmute participant-hold participant-unhold participant-modify participant-speech-start participant-speech-stop announcement-end announcement-fail |
Sent on: join leave start end mute hold modify speaker announcement |
CallSid | CA25e16e9a716a4a1786a7c83f58e30482 | Sent on: join leave mute hold modify speaker announcement (for participant announcements) |
muted | true, false | Sent on: join leave mute hold modify speaker announcement (for participant announcements) |
Hold | true, false | Sent on: join leave mute hold modify speaker announcement (for participant announcements) |
Coaching | true, false | Sent on: join leave mute hold modify speaker announcement (for participant announcements) |
endConferenceOnExit | true, false | Sent on: join leave mute hold modify speaker announcement (for participant announcements) |
startConferenceOnEnter | true, false | Sent on: join leave mute hold modify speaker announcement (for participant announcements) |
CallSidEndingConference | Call SID of the participant who ended the conference (if applicable) | Sent on: end |
ParticipantLabelEndingConference | Label of the participant who ended the conference (if applicable) | Sent on: end |
ReasonConferenceEnded | conference-ended-via-api last-participant-kicked last-participant-left participant-with-end-conference-on-exit-kicked participant-with-end-conference-on-exit-left |
Sent on: end |
reason | A message indicating why the conference ended | Sent on: end |
ReasonAnnouncementFailed | A message indicating why the announcement failed | Sent on: announcement |
AnnounceUrl | The URL used for the announcement | Sent on: announcement |
EventName* | conference-record-end | 送信時: conference-record-end |
RecordingUrl* | https://api.twilio.com/2010-04-01/Accounts/AC123/Recordings/RE234 | 送信時: conference-record-end |
Duration* | 6 | 送信時: conference-record-end |
RecordingFileSize* | 90786 | 送信時: conference-record-end |
All conference-record-end
parameters above have been deprecated in favor of recordingStatusCallback
, which is the preferred approach to receive recording related information. Providing a recordingStatusCallback
will result in no conference-record-end
callbacks.
recordingStatusCallback
The recordingStatusCallback
attribute takes a relative or absolute URL as an argument.
If a conference recording was requested via the record attribute and a recordingStatusCallback
URL is given, Twilio will make a GET or POST request to the specified URL when the recording is available to access.
リクエストパラメーター
Twilio は recordingStatusCallback
URL に、このリクエストと共に下記のパラメーターを渡します。
パラメーター | 概要 |
---|---|
AccountSid | この録音の属するアカウントの一意な識別子です。 |
ConferenceSid | 録音の関連づけられた電話会議の一意な識別子です。 |
RecordingSid | この録音のユニークな識別子です。 |
RecordingUrl | 録音された音声の URL。 |
RecordingStatus | The status of the recording. Possible values are: in-progress , completed ,absent . |
RecordingDuration | この録音の長さ(秒)です。 |
RecordingChannels | 最終的な録音ファイルのチャンネル数を示す整数です。 電話会議の録音では、1 チャンネルのみがサポートされます。 |
RecordingStartTime | The timestamp of when the recording started. |
RecordingSource | The initiation method used to create this recording. Conference is returned for Conference recordings. |
recordingStatusCallbackMethod
This attribute indicates which HTTP method to use when requesting recordingStatusCallback
. It defaults to 'POST'.
recordingStatusCallbackEvent
This attribute allows you to specify which recording status changes should generate a webhook to the URL specified in the recordingStatusCallback
attribute. The available values are in-progress
, completed
, absent
. To specify multiple values separate them with a space. Default is completed
.
既定でのステータス変更イベントは以下の通りです:
パラメーター | 概要 |
---|---|
in-progress | 録音が開始されました |
completed | 録音が完了しアクセス可能です |
absent | The recording is absent and not accessible |
To pause or resume conference recordings, see the Recording API Docs.
eventCallbackUrl
このパラメーターは recordingStatusCallbackに取って代わられ、廃止予定となりました。
'eventCallbackUrl' 属性は引数にURLをとります。 電話会議が終了すると、TwilioはstatusCallbackの conference-record-end
イベント・パラメーターを伴うPOSTリクエストをこのURLに発行します。
サンプル
例 1: カンファレンスをする
この TwiML を実行する最初の発信者が Room 1234 という名前のカンファレンス ルームに入室すると、デフォルトの保留音が聞こえてきます。 次の発信者がこの TwiML を実行すると、2 人の発信者が同じカンファレンス ルームに入室し、カンファレンスが始まります。 保留音は終了し、通知音が鳴り、すべての参加者が会話できる状態になります。
例 2: モデレーターがいるカンファレンス
まず、カンファレンスがまだ始まらないように指定して、参加者をカンファレンス ルームに入室させます。
参加者は保留音を聞きながら待機します。 カンファレンスを主催する「モデレーター」が電話をかけてきたらカンファレンスが始まるように指定します。
また、このモデレーターには endConferenceOnExit='true' が指定されているので、モデレーターが電話を切ると、カンファレンスが終了し、参加者の <Dial>
は終了します。
例 3:イベント付きカンファレンスに参加する
このプログラム・コードでは、参加者の電話会議への入退室、消音、保留、および電話会議の開始と終了にイベントが呼び出される電話会議に接続します。
例 4:ミュートでカンファレンスに参加する
このコードでは、マイクをミュートにして、カンファレンスに参加できます。この参加者は、ミュートにされていない参加者の会話を聞くことはできますが、自分の発言は他の参加者には聞こえません。muted 属性は、REST API でリアルタイムに有効化または無効化できます。
例 5:通話をブリッジする
単に 2 つの通話をブリッジしたいだけ、という場合があります。 このような最小限のカンファレンスでは、バックグラウンド音楽も通知音も再生せず、参加者は入室後すぐに会話を始めて、どちらかの参加者が電話を切るとカンファレンスがただちに終了します。 Dial をするように、既存の 2 つの通話をブリッジするケースなどで役立ちます。
このコードでは、最初の発信者は待合室に入り、バックグラウンド音楽を聞きます。 担当者やオペレーターを待っている間、発信者を保留中にするのと同じです。
オペレーターや担当者の準備ができると、彼らの通話は次のコードを実行します。
このコードで、オペレーターが保留していた人とつながります。 カンファレンスは 2 人が入室すると始まるので、最初の人が聞いていた保留音は終わり、2 人は会話を始めます。 beep='false' が設定されているため、担当者が電話に出た時の通知音は、発信者には聞こえません。このケースではその方が適切でしょう。 オペレーターが電話を切ると、endConferenceOnExit でカンファレンスが終了します。
例 7: Dial の属性との組み合わせ
Conference は Dial の要素なので、すべての Dial の属性は Conference と組み合わせて使えます (ただし、callerId と timeout には影響しません)。 timeLimit を設定し、これを超えるとカンファレンスから退出させることができます。 hangupOnStar を有効にし、* キーを押すとカンファレンスを退出するように設定できます。 action を指定すると、カンファレンス ルームを退出した時に Twilio が action へリクエストを送信し、ユーザーのウェブ サーバーが新しい TwiML レスポンスで応答して、通話を継続させることができます。
例 8:カンファレンスを録音する
このコードは、最初の2人の参加者が接続されたときに開始される電話会議の完全な録音を可能にし、電話会議の録音がアクセス可能になったら recordingStatusCallback を送信します。
ヘルプが必要ですか?
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.