The SIPREC Resource 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. You can also stop streams started via the <Siprec> TwiML instruction.
Conceptually, 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.
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.
You can control which Twilio edge your SIPREC connections egress by appending an edge parameter to the Session Recording Server address in the SIPREC Connector Configuration.
For example, sip:srs@foo.com:5060;edge=dublin
would egress from the Dublin edge, and sip:srs@foo.com:5060;edge=umatilla
would egress from Oregon.
The Twilio Debugger is still the best way to get information about any communication issues encountered while streaming media to the partner. However, you can now also use status callbacks to receive detailed information about the status of a SIPREC session, such as if it has failed or stopped unexpectedly. This provides an additional method for tracking and monitoring the status of your SIPREC sessions.
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.
The SID of the Siprec resource.
^SR[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created this Siprec resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Call the Siprec resource is associated with.
^CA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec.
The status - one of stopped
, in-progress
in-progress
stopped
The date and time in GMT that this resource was last updated, specified in RFC 2822 format.
The URI of the resource, relative to https://api.twilio.com
.
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Siprec.json
Parameters
Parameters in REST API format | |
---|---|
AccountSid Path | post sid<AC> Not PII The SID of the Account that created this Siprec resource. |
CallSid Path | post sid<CA> Not PII The SID of the Call the Siprec resource is associated with. |
Name Optional | post string Not PII The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. |
ConnectorName Optional | post string Not PII Unique name used when configuring the connector via Marketplace Add-on. |
Track Optional | post ienum:track Not PII One of inbound_track , outbound_track , both_tracks . |
StatusCallback Optional | post url Not PII Absolute URL of the status callback. |
StatusCallbackMethod Optional | post http_method Not PII The http method for the status_callback (one of GET , POST ). |
Parameter1.Name Optional | post string Not PII Parameter name |
Parameter1.Value Optional | post string Not PII Parameter value |
SIPREC is a protocol that enables recording and sending streams to one of the available partners via the SIPREC connector configuration. With the addition of a status callback, you can now get detailed information about the status of a SIPREC session. This feature can be used to quickly detect and troubleshoot any unexpected issues with a SIPREC session, such as an unexpected failure or interruption.
There are two ways to use SIPREC status callback:
From <Siprec> TwiML, for example:
1<Start>2<Siprec name="my-first-siprec" connectorName="Gridspace1" statusCallback="https://87b252436d40.ngrok.app" statusCallbackMethod="GET"/>3</Start>
From Start/Stop SIPREC API, for example:
1curl -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN -XPOST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Siprec.json --data-urlencode \2"Name=my-first-siprec" --data-urlencode "ConnectorName=Gridspace1" --data-urlencode "StatusCallback=https://XXXXXXXX.ngrok.app" --data-urlencode "StatusCallbackMethod=GET"
Parameters
Parameters in REST API format | |
---|---|
AccountSid Path | post sid<AC> Not PII The SID of the Account that created this Siprec resource. |
CallSid Path | post sid<CA> Not PII The SID of the Call the Siprec resource is associated with. |
SiprecSid Path | post string Not PII The SID of the Siprec resource is associated with. |
SiprecName Path | post string Not PII The Name of the Siprec resource is associated with. |
SiprecEvent Path | post string Not PII The Event of the Siprec callback. Values can be: siprec-started , siprec-stopped , siprec-error |
Timestamp Path | post string Not PII The timestamp of when the Siprec callback was made. |
If an error has occurred, additional parameters SiprecError
, SiprecErrorCode
will be set as well. These params will provide context on the error that has occurred with the SIPREC resource.
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Siprec/{Sid}.json
The SID of the Account that created this Siprec resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Call the Siprec resource is associated with.
^CA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Siprec resource, or the name
used when creating the resource
application/x-www-form-urlencoded
The status. Must have the value stopped
stopped
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateSiprec() {11const siprec = await client12.calls("CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.siprec("Sid")14.update({ status: "stopped" });1516console.log(siprec.sid);17}1819updateSiprec();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"call_sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"sid": "Sid",5"name": null,6"status": "stopped",7"date_updated": "Thu, 30 Jul 2015 20:00:00 +0000",8"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Siprec/SRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"9}