メニュー

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

TwiML™️ Voice: <Siprec>

The <Siprec> instruction allows you to start a stream on a phone call and send that stream to one of the available partners via the SIPREC connector configuration.

The most basic use of <Siprec>:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
   <Start>
       <Siprec connectorName="my_addon_connector" />
   </Start>
</Response>

This TwiML will instruct Twilio to fork the audio stream of the current call and send it in real-time over SIPREC to a partner using the configured connector.

<Siprec> starts the audio stream asynchronously and immediately continues with the next TwiML instruction. If there is no instruction, the call will be disconnected. In order to avoid this, provide a TwiML instruction to continue the call.

Connectors are configured via the Marketplace Add-on in the Twilio Stream Connectors Console page. Connectors cannot be configured outside of the console via TwiML. This requirement is in place to ensure that the credentials needed to send the stream to a partner are stored securely.

Any communication issues encountered while streaming media to the partner will be reported in the Twilio Debugger with additional information about the failure.

There are a maximum of 4 forked streams allowed per call. <Siprec> by default uses 2 forked streams for both the inbound and outbound tracks.

属性

<Siprec> supports the following attributes:

属性名 許容値 初期値
name Optional. Unique name for the Stream none
connectorName Unique name used when configuring the connector via Marketplace Add-on. 初期値
track Optional. inbound_track, outbound_track, both_tracks both_tracks

name

Providing a name will allow you to reference the SIPREC stream directly. This name must be unique per Call.

For instance by naming the Stream my_first_siprec_stream.

<Start>
    <Siprec name="my_first_siprec_stream" connectorName="my_addon_connector" />
</Start>

You can later use the unique name of my_first_siprec_stream to stop the stream.

<Stop>
   <Siprec name="my_first_siprec_stream" />
</Stop>

connectorName

The connectorName attribute must contain a unique name corresponding to the siprec Stream Connector installed via Twilio Stream Connectors console page.

For example, to use Gridspace Connector, use connectorName="Gridspace_1", where Gridspace_1 is the unique name specified when configuring Gridspace Connector in the Stream Connectors page. In order to start a SIPREC session, you must first configure the appropriate SIPREC connector via console.

track

The track attribute allows you to optionally request to receive a specific track of a call. On any given active call within Twilio there are inbound and outbound tracks, the former represents the audio Twilio receives from the call, and the later represents the audio generated by Twilio to the call. By default Twilio always streams the inbound track of a call. To request Twilio to stream audio it generates use outbound_track, or to receive both tracks of a call use both_tracks. If both_tracks is used, you will receive both the inbound media event and outbound media event.

If you'd like to use a specific partner and do not find them in the available Stream Connectors list, please write to us at support@twilio.com and include details about your desired partner.

Passing Custom Parameters

SIPREC partners often require additional metadata along with the audio stream. You can provide custom data by using <Parameter>

<Start>
    <Siprec name="my_stream_1" connectorName="Gridspace_1" track="outbound_track">
        <Parameter name=”Custom1” value =”Bob” />
        <Parameter name=”Custom2” value =”Blah” />
        <Parameter name=”Custom3” value =”Alice” /> 
     </Siprec>
</Start>

The exact names of parameters vary from partner to partner, so please refer to the appropriate partner tile in the Stream Connectors page to identify the custom parameters that need to be passed.

サンプル

Start a new SIPREC stream with the name of My SIPREC Stream and a connector of Gridspace_1.

        
        
        
        

        IP Ranges to Allow

        To receive Media Streams, please ensure to include the following regions in your allow list (IP address whitelist).

        オーストラリア

        13.54.63.192/27 
        54.252.254.64/26
        3.104.90.0/24
        103.146.214.64/26
        

        ブラジル

        54.233.191.160/27
        177.71.206.192/26
        18.228.249.0/24
        

        ドイツ

        35.158.63.0/24
        35.156.191.128/25
        3.122.181.0/24
        185.194.136.64/26
        185.194.137.0/24
        

        ヨーロッパ

        52.213.63.192/26
        52.215.127.0/24
        54.171.127.192/26
        185.187.132.64/26
        

        インド

        52.66.193.128/25
        

        日本

        52.199.127.160/27
        54.65.63.192/26
        3.112.80.0/24
        103.144.142.64/26
        

        シンガポール

        52.221.221.96/27
        54.169.127.128/26
        3.1.77.0/24
        103.75.151.64/27
        

        United States - 1

        34.195.254.0/23
        34.207.255.0/24
        34.203.250.0/23
        54.172.60.0/23
        208.78.113.0/24
        208.78.112.64/26
        208.78.115.0/25
        

        United States - 2

        35.163.255.192/26
        44.229.12.0/23
        54.244.51.0/24
        67.213.137.0/24
        67.213.136.64/26
        
        Rate this page:

        ヘルプが必要ですか?

        誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。