> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Request siprec session for a call

> Starts siprec session with specified parameters for call idientified by call_sid.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/texml/siprec.yml post /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json
openapi: 3.1.0
info:
  title: Telnyx TeXML Siprec API
  version: 2.0.0
  description: API for managing TeXML Siprec.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
tags:
  - name: Command
    description: TeXML command operations
  - name: Callbacks
    description: Webhook callbacks for call events
paths:
  /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json:
    post:
      tags:
        - TeXML REST Commands
      summary: Request siprec session for a call
      description: >-
        Starts siprec session with specified parameters for call idientified by
        call_sid.
      operationId: StartTeXMLSiprecSession
      parameters:
        - $ref: '#/components/parameters/AccountSid'
        - $ref: '#/components/parameters/CallSid'
      requestBody:
        $ref: '#/components/requestBodies/TexmlCreateSiprecSessionRequest'
      responses:
        '200':
          $ref: '#/components/responses/TexmlCreateSiprecSessionResponse'
        '404':
          $ref: '#/components/responses/call-scripting_NotFoundResponse'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            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);
        - lang: Python
          source: |-
            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)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Texml.Accounts.Calls.SiprecJson(\n\t\tcontext.TODO(),\n\t\t\"call_sid\",\n\t\ttelnyx.TexmlAccountCallSiprecJsonParams{\n\t\t\tAccountSid: \"account_sid\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.AccountSid)\n}\n"
        - lang: Java
          source: >-
            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);
                }
            }
        - lang: Ruby
          source: >-
            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)
        - lang: PHP
          source: >-
            <?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();
            }
        - lang: CLI
          source: |-
            telnyx texml:accounts:calls siprec-json \
              --api-key 'My API Key' \
              --account-sid account_sid \
              --call-sid call_sid
components:
  parameters:
    AccountSid:
      name: account_sid
      in: path
      required: true
      description: The id of the account the resource belongs to.
      schema:
        type: string
    CallSid:
      name: call_sid
      in: path
      required: true
      description: The CallSid that identifies the call to update.
      schema:
        type: string
  requestBodies:
    TexmlCreateSiprecSessionRequest:
      content:
        application/x-www-form-urlencoded:
          schema:
            $ref: '#/components/schemas/TexmlCreateSiprecSessionRequestBody'
      description: Starts a SIPREC session.
  responses:
    TexmlCreateSiprecSessionResponse:
      description: Successful SIPREC session create response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TexmlCreateSiprecSessionResponseBody'
    call-scripting_NotFoundResponse:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/call-scripting_ResourceNotFoundError'
  schemas:
    TexmlCreateSiprecSessionRequestBody:
      type: object
      title: Create Siprec Session Request
      properties:
        ConnectorName:
          description: The name of the connector to use for the SIPREC session.
          example: my_connector
          type: string
        Name:
          description: >-
            Name of the SIPREC session. May be used to stop the SIPREC session
            from TeXML instruction.
          example: my_siprec_session
          type: string
        Track:
          description: >-
            The track to be used for siprec session. Can be `both_tracks`,
            `inbound_track` or `outbound_track`. Defaults to `both_tracks`.
          example: both_tracks
          type: string
          enum:
            - both_tracks
            - inbound_track
            - outbound_track
        IncludeMetadataCustomHeaders:
          description: >-
            When set, custom parameters will be added as metadata
            (recording.session.ExtensionParameters). Otherwise, they’ll be added
            to sip headers.
          example: true
          type: boolean
          enum:
            - true
            - false
        Secure:
          description: >-
            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.
          example: true
          type: boolean
          enum:
            - true
            - false
        SessionTimeoutSecs:
          description: >-
            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.
          example: 900
          type: integer
          default: 1800
        SipTransport:
          description: Specifies SIP transport protocol.
          example: tcp
          enum:
            - udp
            - tcp
            - tls
          type: string
          default: udp
        StatusCallback:
          description: >-
            URL destination for Telnyx to send status callback events to for the
            siprec session.
          example: https://www.example.com/callback
          type: string
        StatusCallbackMethod:
          description: HTTP request type used for `StatusCallback`.
          example: GET
          type: string
          enum:
            - GET
            - POST
    TexmlCreateSiprecSessionResponseBody:
      type: object
      title: Create Siprec Session Response
      properties:
        account_sid:
          type: string
          description: The id of the account the resource belongs to.
          example: 61bf923e-5e4d-4595-a110-56190ea18a1b
        call_sid:
          type: string
          description: The id of the call the resource belongs to.
          example: v3:9X2vxPDFY2RHSJ1EdMS0RHRksMTg7ldNxdjWbVr9zBjbGjGsSe-aiQ
        sid:
          description: The SID of the siprec session.
          example: 61bf923e-5e4d-4595-a110-56190ea18123
          type: string
        date_created:
          description: The date and time the siprec session was created.
          example: Fri, 11 Aug 2023 19:12:11 +0000
          type: string
        date_updated:
          description: The date and time the siprec session was last updated.
          example: Fri, 11 Aug 2023 19:12:11 +0000
          type: string
        start_time:
          description: The date and time the siprec session was started.
          example: Fri, 11 Aug 2023 19:12:11 +0000
          type: string
        status:
          description: The status of the siprec session.
          example: in-progress
          type: string
          enum:
            - in-progress
            - stopped
        track:
          description: The track used for the siprec session.
          example: both_tracks
          type: string
          enum:
            - both_tracks
            - inbound_track
            - outbound_track
        uri:
          description: The URI of the siprec session.
          example: >-
            https://api.telnyx.com/v2/texml/Accounts/61bf923e-5e4d-4595-a110-56190ea18123/Calls/v3:9X2vxPDFY2RHSJ1EdMS0RHRksMTg7ldNxdjWbVr9zBjbGjGsSe-ai/Siprec/61bf923e-5e4d-4595-a110-56190ea18123
          type: string
        error_code:
          description: The error code of the siprec session.
          type: string
    call-scripting_ResourceNotFoundError:
      type: object
      title: Resource not found
      example:
        errors:
          - detail: Resource not found
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              detail:
                type: string
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````