Request siprec session for a call
Starts siprec session with specified parameters for call idientified by call_sid.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.texml.accounts.calls.siprecJson('call_sid', {
account_sid: 'account_sid',
});
console.log(response.account_sid);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.texml.accounts.calls.siprec_json(
call_sid="call_sid",
account_sid="account_sid",
)
print(response.account_sid)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Texml.Accounts.Calls.SiprecJson(
context.TODO(),
"call_sid",
telnyx.TexmlAccountCallSiprecJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.texml.accounts.calls.CallSiprecJsonParams;
import com.telnyx.sdk.models.texml.accounts.calls.CallSiprecJsonResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CallSiprecJsonParams params = CallSiprecJsonParams.builder()
.accountSid("account_sid")
.callSid("call_sid")
.build();
CallSiprecJsonResponse response = client.texml().accounts().calls().siprecJson(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.texml.accounts.calls.siprec_json("call_sid", account_sid: "account_sid")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->texml->accounts->calls->siprecJson(
'call_sid',
accountSid: 'account_sid',
connectorName: 'my_connector',
includeMetadataCustomHeaders: true,
name: 'my_siprec_session',
secure: true,
sessionTimeoutSecs: 900,
sipTransport: 'tcp',
statusCallback: 'https://www.example.com/callback',
statusCallbackMethod: 'GET',
track: 'both_tracks',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx texml:accounts:calls siprec-json \
--api-key 'My API Key' \
--account-sid account_sid \
--call-sid call_sidcurl --request POST \
--url https://api.telnyx.com/v2/texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data ConnectorName=my_connector \
--data Name=my_siprec_session \
--data Track=both_tracks \
--data IncludeMetadataCustomHeaders=true \
--data Secure=true \
--data SessionTimeoutSecs=900 \
--data SipTransport=tcp \
--data StatusCallback=https://www.example.com/callback \
--data StatusCallbackMethod=GET{
"account_sid": "61bf923e-5e4d-4595-a110-56190ea18a1b",
"call_sid": "v3:9X2vxPDFY2RHSJ1EdMS0RHRksMTg7ldNxdjWbVr9zBjbGjGsSe-aiQ",
"sid": "61bf923e-5e4d-4595-a110-56190ea18123",
"date_created": "Fri, 11 Aug 2023 19:12:11 +0000",
"date_updated": "Fri, 11 Aug 2023 19:12:11 +0000",
"start_time": "Fri, 11 Aug 2023 19:12:11 +0000",
"status": "in-progress",
"track": "both_tracks",
"uri": "https://api.telnyx.com/v2/texml/Accounts/61bf923e-5e4d-4595-a110-56190ea18123/Calls/v3:9X2vxPDFY2RHSJ1EdMS0RHRksMTg7ldNxdjWbVr9zBjbGjGsSe-ai/Siprec/61bf923e-5e4d-4595-a110-56190ea18123",
"error_code": "<string>"
}{
"errors": [
{
"detail": "Resource not found"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The id of the account the resource belongs to.
The CallSid that identifies the call to update.
Body
Starts a SIPREC session.
The name of the connector to use for the SIPREC session.
"my_connector"
Name of the SIPREC session. May be used to stop the SIPREC session from TeXML instruction.
"my_siprec_session"
The track to be used for siprec session. Can be both_tracks, inbound_track or outbound_track. Defaults to both_tracks.
both_tracks, inbound_track, outbound_track "both_tracks"
When set, custom parameters will be added as metadata (recording.session.ExtensionParameters). Otherwise, they’ll be added to sip headers.
true, false true
Controls whether to encrypt media sent to your SRS using SRTP and TLS. When set you need to configure SRS port in your connector to 5061.
true, false true
Sets Session-Expires header to the INVITE. A reinvite is sent every half the value set. Usefull for session keep alive. Minimum value is 90, set to 0 to disable.
900
Specifies SIP transport protocol.
udp, tcp, tls "tcp"
URL destination for Telnyx to send status callback events to for the siprec session.
"https://www.example.com/callback"
HTTP request type used for StatusCallback.
GET, POST "GET"
Response
Successful SIPREC session create response
The id of the account the resource belongs to.
"61bf923e-5e4d-4595-a110-56190ea18a1b"
The id of the call the resource belongs to.
"v3:9X2vxPDFY2RHSJ1EdMS0RHRksMTg7ldNxdjWbVr9zBjbGjGsSe-aiQ"
The SID of the siprec session.
"61bf923e-5e4d-4595-a110-56190ea18123"
The date and time the siprec session was created.
"Fri, 11 Aug 2023 19:12:11 +0000"
The date and time the siprec session was last updated.
"Fri, 11 Aug 2023 19:12:11 +0000"
The date and time the siprec session was started.
"Fri, 11 Aug 2023 19:12:11 +0000"
The status of the siprec session.
in-progress, stopped "in-progress"
The track used for the siprec session.
both_tracks, inbound_track, outbound_track "both_tracks"
The URI of the siprec session.
"https://api.telnyx.com/v2/texml/Accounts/61bf923e-5e4d-4595-a110-56190ea18123/Calls/v3:9X2vxPDFY2RHSJ1EdMS0RHRksMTg7ldNxdjWbVr9zBjbGjGsSe-ai/Siprec/61bf923e-5e4d-4595-a110-56190ea18123"
The error code of the siprec session.
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.texml.accounts.calls.siprecJson('call_sid', {
account_sid: 'account_sid',
});
console.log(response.account_sid);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.texml.accounts.calls.siprec_json(
call_sid="call_sid",
account_sid="account_sid",
)
print(response.account_sid)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Texml.Accounts.Calls.SiprecJson(
context.TODO(),
"call_sid",
telnyx.TexmlAccountCallSiprecJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.texml.accounts.calls.CallSiprecJsonParams;
import com.telnyx.sdk.models.texml.accounts.calls.CallSiprecJsonResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CallSiprecJsonParams params = CallSiprecJsonParams.builder()
.accountSid("account_sid")
.callSid("call_sid")
.build();
CallSiprecJsonResponse response = client.texml().accounts().calls().siprecJson(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.texml.accounts.calls.siprec_json("call_sid", account_sid: "account_sid")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->texml->accounts->calls->siprecJson(
'call_sid',
accountSid: 'account_sid',
connectorName: 'my_connector',
includeMetadataCustomHeaders: true,
name: 'my_siprec_session',
secure: true,
sessionTimeoutSecs: 900,
sipTransport: 'tcp',
statusCallback: 'https://www.example.com/callback',
statusCallbackMethod: 'GET',
track: 'both_tracks',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx texml:accounts:calls siprec-json \
--api-key 'My API Key' \
--account-sid account_sid \
--call-sid call_sidcurl --request POST \
--url https://api.telnyx.com/v2/texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data ConnectorName=my_connector \
--data Name=my_siprec_session \
--data Track=both_tracks \
--data IncludeMetadataCustomHeaders=true \
--data Secure=true \
--data SessionTimeoutSecs=900 \
--data SipTransport=tcp \
--data StatusCallback=https://www.example.com/callback \
--data StatusCallbackMethod=GET{
"account_sid": "61bf923e-5e4d-4595-a110-56190ea18a1b",
"call_sid": "v3:9X2vxPDFY2RHSJ1EdMS0RHRksMTg7ldNxdjWbVr9zBjbGjGsSe-aiQ",
"sid": "61bf923e-5e4d-4595-a110-56190ea18123",
"date_created": "Fri, 11 Aug 2023 19:12:11 +0000",
"date_updated": "Fri, 11 Aug 2023 19:12:11 +0000",
"start_time": "Fri, 11 Aug 2023 19:12:11 +0000",
"status": "in-progress",
"track": "both_tracks",
"uri": "https://api.telnyx.com/v2/texml/Accounts/61bf923e-5e4d-4595-a110-56190ea18123/Calls/v3:9X2vxPDFY2RHSJ1EdMS0RHRksMTg7ldNxdjWbVr9zBjbGjGsSe-ai/Siprec/61bf923e-5e4d-4595-a110-56190ea18123",
"error_code": "<string>"
}{
"errors": [
{
"detail": "Resource not found"
}
]
}