Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

SIPREC



Start/Stop SIPREC

startstop-siprec page anchor

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(link takes you to an external page). 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.

(information)

Info

Connectors are configured via the Marketplace Add-on in the Twilio Stream Connectors Console page(link takes you to an external 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.

(warning)

Warning

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(link takes you to an external page).
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.

(information)

Info

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.

(warning)

Warning

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.

sidSID<SR>
Not PII

The SID of the Siprec resource.

Pattern: ^SR[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>

The SID of the Account(link takes you to an external page) that created this Siprec resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

call_sidSID<CA>

The SID of the Call(link takes you to an external page) the Siprec resource is associated with.

Pattern: ^CA[0-9a-fA-F]{32}$Min length: 34Max length: 34

namestring

The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec.


statusenum<string>

The status - one of stopped, in-progress

Possible values:
in-progressstopped

date_updatedstring<date-time-rfc-2822>

The date and time in GMT that this resource was last updated, specified in RFC 2822(link takes you to an external page) format.


uristring

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 Pathpost sid<AC> Not PII The SID of the Account that created this Siprec resource.
CallSid Pathpost sid<CA> Not PII The SID of the Call the Siprec resource is associated with.
Name Optionalpost 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 Optionalpost string Not PII Unique name used when configuring the connector via Marketplace Add-on.
Track Optionalpost ienum
Not PII One of inbound_track, outbound_track, both_tracks.
StatusCallback Optionalpost url Not PII Absolute URL of the status callback.
StatusCallbackMethod Optionalpost http_method Not PII The http method for the status_callback (one of GET, POST).
Parameter1.Name Optionalpost string Not PII Parameter name
Parameter1.Value Optionalpost string Not PII Parameter value

Using the SIPREC status callback

using-the-siprec-status-callback page anchor

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:


_10
<Start>
_10
<Siprec name="my-first-siprec" connectorName="Gridspace1" statusCallback="https://87b252436d40.ngrok.app" statusCallbackMethod="GET"/>
_10
</Start>

From Start/Stop SIPREC API, for example:


_10
curl -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 \
_10
"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 Pathpost sid<AC> Not PII The SID of the Account that created this Siprec resource.
CallSid Pathpost sid<CA> Not PII The SID of the Call the Siprec resource is associated with.
SiprecSid Pathpost string Not PII The SID of the Siprec resource is associated with.
SiprecName Pathpost string Not PII The Name of the Siprec resource is associated with.
SiprecEvent Pathpost string Not PII The Event of the Siprec callback. Values can be: siprec-started, siprec-stopped, siprec-error
Timestamp Pathpost string Not PII The timestamp of when the Siprec callback was made.

If an error has occurred, additional params SiprecError, SiprecErrorCode will be set as well. These params will provide context on the error that has occurred with the SIPREC resouce.


Update a Siprec resource

update-a-siprec-resource page anchor
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Siprec/{Sid}.json

Path parameters

path-parameters page anchor
AccountSidSID<AC>required

The SID of the Account(link takes you to an external page) that created this Siprec resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

CallSidSID<CA>required

The SID of the Call(link takes you to an external page) the Siprec resource is associated with.

Pattern: ^CA[0-9a-fA-F]{32}$Min length: 34Max length: 34

Sidstringrequired

The SID of the Siprec resource, or the name used when creating the resource

Statusenum<string>required

The status. Must have the value stopped

Possible values:
stopped

Update a Siprec

update-a-siprec page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.siprec('SRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.update({status: 'stopped'})
_11
.then(siprec => console.log(siprec.name));

Output

_10
{
_10
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"call_sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"sid": "SRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"name": null,
_10
"status": "stopped",
_10
"date_updated": "Thu, 30 Jul 2015 20:00:00 +0000",
_10
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Siprec/SRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
_10
}


Rate this page: