# Manage Call with `callLeg`

This method is used to manage ongoing, connected calls. This method is only used when using the `PlayFiles` and `Say` instructions in the request body. This method uses SVAML in the request body to perform various tasks related to the call. For more information about SVAML, see the [Callback API](https://developers.sinch.com/docs/voice/api-reference/svaml/) documentation.
Note: You can only use this method for calls that originate from or terminate to PSTN or SIP networks.

Endpoint: PATCH /calling/v1/calls/id/{callId}/leg/{callLeg}
Version: 1.0.1
Security: Basic, Signed

## Security:

  - `Basic` (unknown)
    http basic

  - `Signed` (unknown)
    apiKey in header Authorization

## Path parameters:

  - `callId` (string, required)
    The unique identifier of the call. This value is generated by the system.

  - `callLeg` (string, required)
    Specifies which part of the call will be managed. This option is used only by the `PlayFiles` and `Say` instructions to indicate which channel the sound will be played on. Valid options are `caller`, `callee` or `both`. If not specified, the default value is `caller`.<br><Warning>The `callLeg` identifier is ignored for calls that are part of a conference and calls initiated using the Callout API.</Warning>

## Request fields (application/json):

  - `instructions` (array)
    The collection of instructions that can perform various tasks during the call. You can include as many instructions as necessary.

  - `instructions.name` (string, required)
    The `name` property. Must have the value `playFiles`.
    Enum: "playFiles"

  - `instructions.ids` (array, required)
    The IDs of the files which will be played. These can be a URL to a file, SSML commands using the `#ssml[]` element, or text using the `#tts[]` element.
    Example: ["#ssml[Thank you for calling Sinch!]"]

  - `instructions.locale` (string)
    If using SSML or TTS, this is a required field. The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](https://developers.sinch.com/docs/voice/api-reference/voice-locales).
    Example: en-US

  - `instructions.name` (string, required)
    The `name` property. Must have the value `say`.
    Enum: "say"

  - `instructions.text` (string)
    Contains the message that will be spoken. Default maximum length is 600 characters. To change this limit, please contact support.
    Example: Hello, thank you for calling Sinch!

  - `instructions.locale` (string)
    The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](https://developers.sinch.com/docs/voice/api-reference/voice-locales).
    Example: en-US

  - `instructions.name` (string, required)
    The `name` property. Must have the value `sendDtmf`.
    Enum: "sendDtmf"

  - `instructions.value` (string)
    A string that determines the DTMF tones to play to the callee when the call is picked up.
Valid characters are: `0-9`, `#`, and `w`. `w` renders a 500ms pause. For example, the string `ww1234#w#`, plays a 1 second pause, the DTMF tones for `1`, `2`, `3`, `4`, and `#`, followed by a 500ms pause and finally the `#` tone.
This is useful if the callout destination requires a conference PIN code or an extension. If there is a calling party, it will hear progress while the DTMF is sent.
    Example: ww1234#w#

  - `instructions.name` (string, required)
    The `name` property. Must have the value `setCookie`.
    Enum: "setCookie"

  - `instructions.key` (string)
    The name of the cookie you want to set.
    Example: cookie_name

  - `instructions.value` (string)
    The value of the cookie you want to set.
    Example: cookie_value

  - `instructions.name` (string, required)
    The `name` property. Must have the value `answer`.
    Enum: "answer"

  - `instructions.name` (string, required)
    The `name` property. Must have the value `startRecording`.
    Enum: "startRecording"

  - `instructions.options` (object)

  - `instructions.options.destinationUrl` (string)

  - `instructions.options.credentials` (string)

  - `instructions.options.format` (string)

  - `instructions.options.notificationEvents` (boolean)

  - `instructions.options.transcriptionOptions` (object)

  - `instructions.options.transcriptionOptions.enabled` (boolean)

  - `instructions.options.transcriptionOptions.locale` (string)

  - `instructions.name` (string, required)
    The `name` property. Must have the value `stopRecording`.
    Enum: "stopRecording"

  - `action` (object)
    The action that will control the call. Each SVAML object can only include one action.

  - `action.name` (string, required)
    The name property. Must have the value `hangup`.
    Enum: "hangup"

  - `action.name` (string, required)
    The name property. Must have the value `continue`.
    Enum: "continue"

  - `action.name` (string, required)
    The name property. Must have the value `park`.
    Enum: "park"

  - `action.locale` (string)
    The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed [here](https://developers.sinch.com/docs/voice/api-reference/voice-locales).
    Example: en-US

  - `action.introPrompt` (string)
    That prompt that is played when the call is first answered. You can use text-to-speech using the `#tts[]` element, SSML commands using the `#ssml[]` element.
    Example: #tts[Welcome]

  - `action.holdPrompt` (string)
    The prompt that is played on repeat until the call is unparked or the until the `maxDuration` value is reached. You can use text-to-speech using the `#tts[]` element, SSML commands using the `#ssml[]` element.
    Example: #tts[Thank you for your patience, your call is very important to us.]

  - `action.maxDuration` (integer)
    The maximum amount of time in seconds that the `holdPrompt` will be played.
    Example: 180

## Request examples:

  - `hangupExample` (unknown)

  - `continue example` (unknown)
    The `continue` action.

  - `park example` (unknown)
    The `park` action.

  - `playFiles example` (unknown)
    The `playFiles` instruction.

  - `say example` (unknown)
    The `say` instruction.

  - `sendDtmf example` (unknown)
    The `sendDtmf` instruction.

  - `setCookie example` (unknown)
    The `setCookie` instruction.

  - `answer example` (unknown)
    The `answer` instruction.

  - `startRecording example` (unknown)
    The `startRecording` instruction.

  - `stopRecording example` (unknown)
    The `stopRecording` instruction.

  - `ivrExample` (unknown)

## Response 200:

  - `200` (unknown)
    A success response, or an [Error](https://developers.sinch.com/docs/voice/api-reference/errors/).

