Rate this page:

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.

Twilio operates as a Session Recording Client (SRC) for SIPREC.

Twilio's partners, e.g. Gridspace operate as Session Recording Server (SRS)

Alternately, a customer may provision their own SRS via configuration in the Twilio/Generic SIPREC connector

The SRC sends the SIPREC media to be recorded to the SRS. The SRS is responsible for storing/processing the media.

The most basic use of <Siprec>:

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

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:

Attribute Name Allowed Values Default Value
name Optional. Unique name for the Stream none
connectorName Unique name used when configuring the connector via Marketplace Add-on. Default
track Optional. inbound_track, outbound_track, both_tracks both_tracks


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.

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

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

   <Siprec name="my_first_siprec_stream" />


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.

The Twilio SIPREC Connector provides some additional SIP features.

You can configure these in your Connector instance. The SIP URI supports additional parameters, secure which enables Secure Real-time Transport Protocol (SRTP), as well as, edge which allows you to specify a specific edge location.

For instance, to enable SRTP and set the edge location to the ashburn edge, you would provide a similar SIP URI:;secure=true&edge=ashburn

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 and include details about your desired partner.


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.

Passing Custom Parameters

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

    <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" /> 

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).








        United States - 1

        United States - 2
        Rate this page:

        Need some help?

        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 Community Forums or browsing the Twilio tag on Stack Overflow.


              Thank you for your feedback!

              We are always striving to improve our documentation quality, and your feedback is valuable to us. Please select the reason(s) for your feedback or provide additional information about how we can improve:

              Sending your feedback...
              🎉 Thank you for your feedback!
              Something went wrong. Please try again.

              Thanks for your feedback!

              Refer us and get $10 in 3 simple steps!

              Step 1

              Get link

              Get a free personal referral link here

              Step 2

              Give $10

              Your user signs up and upgrade using link

              Step 3

              Get $10

              1,250 free SMSes
              OR 1,000 free voice mins
              OR 12,000 chats
              OR more