Switch supervisor role
Switch the supervisor role for a bridged call. This allows switching between different supervisor modes during an active call
POST
/
calls
/
{call_control_id}
/
actions
/
switch_supervisor_role
JavaScript
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.calls.actions.switchSupervisorRole('call_control_id', {
role: 'barge',
});
console.log(response.data);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.calls.actions.switch_supervisor_role(
call_control_id="call_control_id",
role="barge",
)
print(response.data)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.Calls.Actions.SwitchSupervisorRole(
context.TODO(),
"call_control_id",
telnyx.CallActionSwitchSupervisorRoleParams{
Role: telnyx.CallActionSwitchSupervisorRoleParamsRoleBarge,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.calls.actions.ActionSwitchSupervisorRoleParams;
import com.telnyx.sdk.models.calls.actions.ActionSwitchSupervisorRoleResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionSwitchSupervisorRoleParams params = ActionSwitchSupervisorRoleParams.builder()
.callControlId("call_control_id")
.role(ActionSwitchSupervisorRoleParams.Role.BARGE)
.build();
ActionSwitchSupervisorRoleResponse response = client.calls().actions().switchSupervisorRole(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.calls.actions.switch_supervisor_role("call_control_id", role: :barge)
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->calls->actions->switchSupervisorRole(
'call_control_id', role: 'barge'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx calls:actions switch-supervisor-role \
--api-key 'My API Key' \
--call-control-id call_control_id \
--role bargecurl --request POST \
--url https://api.telnyx.com/v2/calls/{call_control_id}/actions/switch_supervisor_role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": "barge"
}
'{
"data": {
"result": "ok"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier and token for controlling the call
Body
application/json
Switch supervisor role request
The supervisor role to switch to. 'barge' allows speaking to both parties, 'whisper' allows speaking to caller only, 'monitor' allows listening only.
Available options:
barge, whisper, monitor Example:
"barge"
Response
Successful response upon making a call control command.
Show child attributes
Show child attributes
Example:
{ "result": "ok" }
Was this page helpful?
⌘I
JavaScript
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.calls.actions.switchSupervisorRole('call_control_id', {
role: 'barge',
});
console.log(response.data);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.calls.actions.switch_supervisor_role(
call_control_id="call_control_id",
role="barge",
)
print(response.data)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.Calls.Actions.SwitchSupervisorRole(
context.TODO(),
"call_control_id",
telnyx.CallActionSwitchSupervisorRoleParams{
Role: telnyx.CallActionSwitchSupervisorRoleParamsRoleBarge,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.calls.actions.ActionSwitchSupervisorRoleParams;
import com.telnyx.sdk.models.calls.actions.ActionSwitchSupervisorRoleResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionSwitchSupervisorRoleParams params = ActionSwitchSupervisorRoleParams.builder()
.callControlId("call_control_id")
.role(ActionSwitchSupervisorRoleParams.Role.BARGE)
.build();
ActionSwitchSupervisorRoleResponse response = client.calls().actions().switchSupervisorRole(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.calls.actions.switch_supervisor_role("call_control_id", role: :barge)
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->calls->actions->switchSupervisorRole(
'call_control_id', role: 'barge'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx calls:actions switch-supervisor-role \
--api-key 'My API Key' \
--call-control-id call_control_id \
--role bargecurl --request POST \
--url https://api.telnyx.com/v2/calls/{call_control_id}/actions/switch_supervisor_role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": "barge"
}
'{
"data": {
"result": "ok"
}
}