Using SIPREC client for Voice API and TeXML calls
What is a SIPREC client?
SIPREC client (SRC) is a component within the SIPREC framework. The SRC is responsible for initiating and managing the recording session, which communicates to the Session Recording Server (SRS) to send the media streams and metadata for recording.
Creating a SIPREC server connector
To create an SIPREC recording session, you need to define an SIPREC server connector that will be used to establish a connection. It can be done using an API request as follows:
curl --request POST \
--url https://api.telnyx.com/v2/siprec_connectors \
--header 'Authorization: Bearer XXX' \
--header 'Content-Type: application/json' \
--data '{
"name": "siprec-server-connector",
"host": "siprec.telnyx.com",
"port": 5060
}'
Creating a SIPREC recording session for Voice API calls
To start a SIPREC recording session you can use the following request:
curl --request POST \
--url https://api.telnyx.com/v2/{call_control_id}/actions/siprec_start \
--header 'Accept: application/json' \
--header 'Authorization: Bearer XXX' \
--header 'Content-Type: application/json' \
--data '{
"connector_name": "siprec-server-connector",
"direction": "both_tracks"
}'
The session can be stopped at any point using the siprec_stop
endpoint:
curl --request POST \
--url https://api.telnyx.com/v2/{call_control_id}/actions/siprec_stop \
--header 'Accept: application/json' \
--header 'Authorization: Bearer XXX' \
--header 'Content-Type: application/json'
Creating a SIPREC recording session for TeXML calls
To initialize the SIPREC recording session the following TeXML instruction can be used:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Start>
<Siprec track="both_tracks" connectorName="siprec-server-connector" statusCallback="https://example.com/siprec_callback" />
</Start>
</Response>
It can be stopped in the following way:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Stop>
<Siprec/>
</Stop>
</Response>