Latest Legacy

Overview

The Plivo Voice API uses HTTP verbs and standard HTTP status codes to make it easier for you to integrate communications into your code. To secure your requests to our servers, we serve our API calls over HTTPS.

Note: The current version of the API is v1, and the server SDKs are versioned as latest and legacy.

API Endpoint

POST https://api.plivo.com/{version}/

API requests

Plivo exposes a list of REST APIs to perform various actions. You can use these APIs in combination with XML documents to create voice and SMS applications.

POST https://api.plivo.com/v1/

Authentication

All requests to Plivo API are authenticated with BasicAuth using the values of AUTH ID and AUTH TOKEN that appear on the Overview page of the console.

Example Request

1
2
3
4
5
6
7
import plivo

proxies = {
    'http': 'https://username:password@proxyurl:proxyport',
    'https': 'https://username:password@proxyurl:proxyport'
    }
client = plivo.RestClient('<auth_id>', '<auth_token>', proxies=proxies,timeout=5)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
require 'rubygems'
require 'plivo'

proxy = {
	proxy_host: "https://proxyurl",
	proxy_port: "proxyport",
	proxy_user: "username",
	proxy_pass: "password"
}
api = RestClient.new("<auth_id>", "<auth_token>", proxy, timeout=5)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');
let options = {
	'timeout': 5000, //ms
	'host': 'https://proxyurl',
	'port': 'proxyport',
	auth: {
		username: 'my-user',
		password: 'my-password'
	}
}

var client = new plivo.Client("<auth_id>", "<auth_token>", options);

Was this code helpful

1
2
3
4
5
6
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;

$client = new RestClient("<auth_id>", "<auth_token>", "<https://proxyurl>", "<proxyport>", "<username>", "<password>");
$client->client->setTimeout(5)

Was this code helpful

1
2
3
4
5
6
7
8
9
package com.plivo.api.samples.application;

import com.plivo.api.Plivo;

class AutheExample {
  public static void main(String [] args) {
    Plivo.init();
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
using System;
using System.Collections.Generic;
using Plivo;

namespace PlivoExamples {
  internal class Program {
    public static void Main(string[] args) {
      var api = new PlivoApi(
        "<auth_id>", "<auth_token>",
        "<https://proxyurl>", "<proxyport>", "<username>", "<password>");
      api.Client.SetTimeout(10);
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
package main

import "github.com/plivo/plivo-go/v7"

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
}

Was this code helpful

Content-Type

Plivo only accepts input of the type application/json.

All POST request arguments must be passed as text in JSON format with the Content-Type set as application/json.

All GET and DELETE request arguments must be passed in the query string.

Timeouts and proxies

Plivo’s server SDKs let you specify timeouts and proxy settings to be used when making API requests. Select the programming language of your choice and view the latest version to see how to specify these settings.

Pagination

Plivo uses offset-based pagination to list resources.

For instance, if your search request has a result of 100 objects with limit = 10 and offset = 5, then objects with indices 51 through 60 are returned.

Parameters used for pagination

limit integer

A limit on the number of results to be returned. limit can range between 1 and 20, and the default is 20.

offset integer

A pagination cursor to denote the number of objects by which the results should be offset.

Asynchronous requests

All requests to Plivo APIs can be made asynchronous by adding the parameters listed below. When you make an asynchronous API call, Plivo returns a generic response with the api_id, and sends the API responses to the specified callback URL.

Arguments

callback_url

The URL notified by the API response is available and to which the response is sent.

callback_method

The method used to notify the callback_url.

Defaults to POST.

Response

{
"message": "async api spawned",
"api_id": "63f0761a-e0ed-11e1-8ea7-12313924e3a6"
}

API responses

Plivo API endpoints return responses in JSON format. Plivo sets an api_id in each response to uniquely identify your request. Each API call returns one of these HTTP status codes depending on whether the call succeeds or fails.

200

Request has been executed

201

Resource created

202

Resource changed

204

Resource deleted

400

A parameter is missing or is invalid

401

Authentication failed

404

Resource cannot be found

405

HTTP method not allowed

429

Too many requests, rate limited

500

Server error

Note: Casing convention of the responses:
  • Python: Snake case
  • Node.js: Camel case
  • Go: Camel case
  • Java: Camel case
  • .NET: Pascal case
  • Ruby: Snake case
  • PHP: Camel case

Response examples

Response attributes

api_idstring

Identifies the request.

errorstring

Indicates an error and provides information regarding the error.

messagestring

Provides information regarding the request.

Response

Success

{
  "api_id": "97ceeb52-58b6-11e1-86da-77300b68f8bb",
  "message": "call fired",
  "request_uuid": "75b26856-8638-11e0-802c-6d99d509954e"
}

Error

{
  "api_id": "97ceeb52-58b6-11e1-86da-77300b68f8bb",
  "error": "answer_url parameter is missing",
  "request_uuid": "56hf4856-8638-11e0-802c-65j6gd39954e"
}

Call

A Call object is created when an outbound call is initiated or when an inbound call is received. You can use a Call object to interact with ongoing calls, retrieve details about completed calls, and transfer ongoing calls, thereby building custom call flows.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Call/

The Call object

A Call object is created when an outbound call is initiated or when an inbound call is received. You can use the Call object to interact with ongoing calls, retrieve details about completed calls, and transfer ongoing calls, thereby building custom call flows.

Attributes

answer_time string

The timestamp when the call was answered.
Timezone: Local timezone as updated in the Plivo console
Format: yyyy-MM-dd HH:mm:ss

bill_duration integer

The duration of the call in seconds.

billed_duration integer

The duration for which the call was billed in seconds. This might be different from the bill_duration based on the billing interval of the prefix called.

call_direction string

Indicates whether the call was outbound or inbound.

call_duration integer

The duration of the call in seconds.

call_uuid string

The unique identifier used to identify the call.

end_time string

The timestamp when the call ended.
Timezone: Local timezone as updated in the Plivo console
Format: yyyy-MM-dd HH:mm:ss

from_number string

The caller ID using which the call was initiated.

initiation_time string

The timestamp when the call was initiated.
Timezone: Local timezone as updated in the Plivo console
Format: yyyy-MM-dd HH:mm:ss

parent_call_uuid string

The call UUID of the A leg of the call.

resource_uri string

The URI of the resource requested.

stir_verification string

For outbound calls: Gives details about the attestation assigned to the call by Plivo

For inbound calls: Gives details about the attestation received on the inbound call to your Plivo phone number.

Possible values:

  • Verified means the call is from a verified caller who has authorized access to the customer’s caller ID, and hence should be treated with confidence. Verified is equivalent to attestation level A.
  • Not Verified means that, for this call, either the caller is not verified, or it’s uncertain whether they have access to the caller ID used, or both. Not Verified means the call received attestation level B or C.
  • Not Applicable means STIR/SHAKEN doesn’t apply to this call, as would be the case if a call is not addressed to a US number or if it’s a cloud call (WebRTC or SIP).

Read more about STIR/SHAKEN.

to_number string

The number to which the call was initiated.

total_amount string

The total amount charged for the call.

total_rate string

The per-minute rate charged based on the destination number.

hangup_cause_name

The reason for the call hangup. Refer to our list of hangup causes and sources.

hangup_cause_code

The integer code for the hangup cause. Refer to our list of hangup causes and sources.

hangup_source

The entity that triggered the call hangup. Possible hangup sources are: Caller, Callee, Plivo, API Request, Answer XML, Error, and Unknown.

Refer to our list of hangup causes and sources.

source_ipstring

The source_ip field returns the IP address from which the call request originated. We recommend you monitor this field as a method to identify any potential account misuse and unauthorized access attempts.

Example Object

{
  "answer_time": "2022-06-28 19:39:05+05:30", // Local time zone as updated in the Plivo console
  "bill_duration": 11,
  "billed_duration": 60,
  "call_direction": "inbound",
  "call_duration": 11,
  "call_uuid": "57a1b60a-5c0b-11e7-9082-ef888d0400e9",
  "end_time": "2022-06-28 19:39:15+05:30", // Local time zone as updated in the Plivo console
  "from_number": "12025551111",
  "initiation_time": "2022-06-28 19:39:04+05:30", // Local time zone as updated in the Plivo console
  "parent_call_uuid": null,
  "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Call/57a1b60a-5c0b-11e7-9082-ef888d0400e9/",
  "to_number": "19172592277",
  "total_amount": "0.00850",
  "total_rate": "0.00850",
  "hangup_cause_name": "End Of XML Instructions",
  "hangup_cause_code":4010,
  "hangup_source":"Plivo",
  "source_ip": "92.168.0.1"
}

Make an outbound call

This method lets you initiate an outbound call to a PSTN number or a SIP endpoint, and make simultaneous bulk calls.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Call/

Arguments

fromRequired

The phone number to be used as the caller ID for the call. The format should be the country code followed by the number. Example: 14157654321 (for the United States)

toRequired

The destination to be called. The destination can be either a regular number or a SIP endpoint.

A regular number should be specified with the country code followed by the number. Example: 14157654321

If you’re calling a SIP endpoint, the to field should be a valid SIP URI. Example: sip:john1234@phone.plivo.com

You can initiate calls to multiple numbers and endpoints at once (bulk calls) by using the delimiter <. For example, if you want to call two numbers and one SIP endpoint, specify in the to field: 14157654321<14153464321<sip:john1234@phone.plivo.com

Note: The maximum number of unique destinations accepted in the "to" field is 1000.
answer_urlRequiredCallback-retry configurable

The URL invoked by Plivo when the call is answered. This URL should return an XML element with valid Plivo XML to perform the desired actions.

answer_method

The HTTP verb that should be used to invoke the answer_url.

Defaults to POST.

ring_url
Callback-retry configurable

An optional URL that Plivo notifies when the call starts ringing.

ring_method

The HTTP verb that should be used to invoke the ring_url.

Defaults to POST.

hangup_url
Callback-retry configurable

An optional URL that Plivo notifies when the call is hung up.

hangup_method

The HTTP verb that should be used to invoke the hangup_url.

Defaults to POST.

fallback_url
Callback-retry configurable

The URL that’s tried if the answer_url is not reachable. We retry answer_url three times to fetch a valid XML file. If all three attempts fail to return a valid XML file, or after a timeout of 60 seconds, whichever is earlier, fallback_url is invoked.

fallback_method

The HTTP verb that should be used to invoke the fallback_url.

Defaults to POST.

caller_name

If set to a string, caller name will be set to this string value.

Allowed values: Any string. Character limit — 50 characters.

Defaults to Caller's caller_name.

send_digits

Flag that lets you send digits once the call is connected. The common use case is to dial to an extension. Plivo can dial a number, and when the automated system picks up, send the DTMF tones to connect to the extension.

You can choose how long to wait before sending the digits. Using character w waits for 0.5 seconds and W waits for 1 seconds.

For example, setting this parameter to 1w2W3 sends digit 1, waits for 0.5 seconds, sends digit 2, waits for 1 second, and sends digit 3.

You can configure the duration of the tone when the digit is sent by appending the duration (in milliseconds) with the @ character. For example, setting 123@1000 will send the digits 123 with a tone duration of 1,000 milliseconds

send_on_preanswer

Applicable only if send_digits is set. If set to true, the digits are sent at the preanswer stage.

Defaults to false.

time_limit

Sets a limit on the maximum duration of a call in seconds. The limit is calculated starting from the time the call is answered. The time_limit must be a positive integer.

Defaults to 14,400 seconds (4 hours).

Note: If the value set is >=86400 seconds, calls will be disconnected after 24 hours.
hangup_on_ring

Sets a limit on the maximum duration of the call in seconds, similar to time_limit, but instead of calculating the limit from the time call is answered, this parameter calculates the limit from the time call starts ringing. The hangup_on_ring value must be a positive integer.

machine_detection

Detects whether the call has been answered by a machine.

Allows values: true, hangup

If set to true, then if a machine is detected at the beginning of the call, any URL that is invoked by the call (answer_url, hangup_url, etc.) will be POSTed with the machine parameter set to true.

If you want to hang up the call if a machine is detected, set this parameter to hangup. This will hang up the call and POST to the hangup_url with the machine parameter set to machine_detection.

machine_detection_time

Defines the time allotted, in milliseconds, to decide whether a machine is detected.

Allowed values: 2000 through 10000
Defaults to 5000.

machine_detection_url
Callback-retry configurable

The URL invoked with machine detection parameters. The list of parameters sent with the request are described in asynchronous machine detection section below. These parameters should be used to make machine detection asynchronous.

machine_detection_method

The HTTP verb that should be used to invoke the machine_detection_url.

Defaults to POST.

machine_detection_maximum_speech_length

The number of milliseconds used to measure the length of speech activity. Note that machine_detection_maximum_speech_length must be a positive integer.

Durations greater than this value will be detected as machine.

Default: 5000
Allowed values: Between 1000 to 6000

machine_detection_initial_silence

The duration of initial silence when the call is answered, expressed in milliseconds. Note that machine_detection_initial_silence must be a positive integer.

“Unknown” will be returned after the specified value.

Default: 4500
Allowed values: Between 2000 to 10000

Machine_detection_maximum_words

The maximum number of sentences detected. Machine_detection_maximum_words must be a positive integer.

Values greater than the threshold you set will be classified as a machine.

Default: 3
Allowed values: Between 2 to 10

Machine_detection_initial_greeting

Indicates the maximum length of the initial greeting in milliseconds. Machine_detection_initial_greeting must be a positive integer.

Duration longer than this value will be detected as a machine.

Default: 1500
Allowed values: Between 1000 to 5000

Machine_detection_silence

The silence after the initial greeting, expressed in milliseconds. Machine_detection_silence must be a positive integer.

Durations greater than this value will be detected as a human.

Default: 800
Allowed values: Between 500 to 5000

sip_headers

List of SIP headers in the form of key=value pairs, separated by commas — for example, head1=val1,head2=val2,head3=val3,...,headN=valN.

The SIP headers specified are automatically prefixed with “X-PH-” and these headers will be present for all the HTTP requests that are being made

Valid values for SIP header keys and values are integers and uppercase and lowercase letters.

ring_timeout

Defines how long in seconds an unanswered call should ring before hanging up.

Defaults to 120.

parent_call_uuid

The call_uuid of the first leg in an ongoing conference. This parameter is helpful in minimizing the delay of adding a new member to a conference.

Note: This parameter is honored only for single calls and not for bulk calls. See this post for more information.
error_if_parent_not_found

Defines the behavior of how to use parent_call_uuid. If set to true, then if parent_call_uuid is not found, the call is not initiated and it returns an error. If set to false, then the call is initiated ignoring any errors with the parent_call_uuid.

Defaults to false.

Callbacks

For every single voice call you make and receive, Plivo sends a status update to your URL configured as a callback. You can read and store the information on your server for analysis, and you can change the flow of ongoing calls based on the values received in the callback events.

Callbacks involve URLs such as answer_url, fallback_url, hangup_url, and ring_url.

List of parameters sent to ring_url

Fromstring The from number used as the caller ID to initiate the call.
Tostring The destination that’s called.
RequestUUIDstring An identifier that can uniquely identify a request.
ALegRequestUUIDstring Identifies the first leg of the call in case there are multiple legs.
CallUUIDstring The identifier of the call.
Directionstring The direction of the call. This will have the value “outbound” since this is an outbound API call.
Eventstring The event that triggered this notification. This will have the value “Ring”.
CallStatusstring The status of the call. This will have the value “ringing”.
SessionStartstring A timestamp that indicates when early media started. Format: YYYY-MM-DD HH:mm:ss.sssss Timezone: UTC
STIRAttestationstring Gives details about the attestation assigned to the call by Plivo.

List of parameters sent to answer_url and fallback_url

Fromstring The from number used as the caller ID to initiate the call.
Tostring The destination that’s called.
RequestUUIDstring An identifier that can uniquely identify a call.
ALegRequestUUIDstring Identifies the first leg of the call in case there are multiple legs.
CallUUIDstring The identifier of the call.
Directionstring The direction of the call. This will have the value “outbound” since this is an outbound API call.
ALegUUIDstring An unique identifier for the A leg of the call.
Eventstring The event that triggered this notification. This will have the value “StartApp”.
stir_verification string

For outbound calls: Gives details about the attestation assigned to the call by Plivo

For inbound calls: Gives details about the attestation received on the inbound call to your Plivo phone number.

Possible values:

  • Verified means the call is from a verified caller who has authorized access to the customer’s caller ID, and hence should be treated with confidence. Verified is equivalent to attestation level A.
  • Not Verified means that, for this call, either the caller is not verified, or it’s uncertain whether they have access to the caller ID used, or both. Not Verified means the call received attestation level B or C.
  • Not Applicable means STIR/SHAKEN doesn’t apply to this call, as would be the case if a call is not addressed to a US number or if it’s a cloud call (WebRTC or SIP).

Read more about STIR/SHAKEN.

CallStatusstring The status of the call. This will have the value “in-progress”.
SessionStartstring A timestamp that indicates when early media started. Format: YYYY-MM-DD HH:mm:ss.sssss Timezone: UTC
STIRAttestationstring Gives details about the attestation assigned to the call by Plivo.

List of parameters sent to hangup_url

Fromstring The from number used as the caller ID to initiate the call.
Tostring The destination that’s called.
RequestUUIDstring An identifier that can uniquely identify a call.
ALegRequestUUIDstring Identifies the first leg of the call in case there are multiple legs
CallUUIDstring The identifier of the call.
Directionstring The direction of the call. This will be “outbound” since this is an outbound API call.
ALegUUIDstring An unique identifier for the A leg of the call.
Eventstring The event that triggered this notification. This will have the value “Hangup”.
stir_verification string

For outbound calls: Gives details about the attestation assigned to the call by Plivo

For inbound calls: Gives details about the attestation received on the inbound call to your Plivo phone number.

Possible values:

  • Verified means the call is from a verified caller who has authorized access to the customer’s caller ID, and hence should be treated with confidence. Verified is equivalent to attestation level A.
  • Not Verified means that, for this call, either the caller is not verified, or it’s uncertain whether they have access to the caller ID used, or both. Not Verified means the call received attestation level B or C.
  • Not Applicable means STIR/SHAKEN doesn’t apply to this call, as would be the case if a call is not addressed to a US number or if it’s a cloud call (WebRTC or SIP).

Read more about STIR/SHAKEN.

CallStatusstring The status of the call. This will have the value “completed”.
StartTimestring A timestamp that indicates when the call was initiated. Timezone: Local timezone as updated in your Plivo Console Format: yyyy-MM-dd HH:mm:ss.
AnswerTimestring A timestamp that indicates when the call was answered. Timezone: Local timezone as updated in your Plivo Console Format: yyyy-MM-dd HH:mm:ss.
SessionStartstring A timestamp that indicates when early media started. Format: YYYY-MM-DD HH:mm:ss.sssss Timezone: UTC
EndTimestring A timestamp that indicates when the call ended. Timezone: Local timezone as updated in your Plivo Console Format: yyyy-MM-dd HH:mm:ss.
STIRAttestationstring Gives details about the attestation assigned to the call by Plivo.

Example Request

1
2
3
4
5
6
7
8
9
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.calls.create(
    from_='+12025550000',
    to_='+12025551111',
    answer_url='https://s3.amazonaws.com/static.plivo.com/answer.xml',
    answer_method='GET', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.create(
    '+12025550000',
    ['+12025551111'],
    'https://s3.amazonaws.com/static.plivo.com/answer.xml',
     {
            answer_method: "GET",
     },
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Example for Call create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.create(
        "+12025550000", // from
        "+12025551111", // to
        "https://s3.amazonaws.com/static.plivo.com/answer.xml", // answer url
        {
            answerMethod: "GET",
        },
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
/**
 * Example for Call create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    $response = $client->calls->create(
        '+12025550000',
        ['+12025551111'],
        'https://s3.amazonaws.com/static.plivo.com/answer.xml',
        [
            'answer_method' => 'GET'
        ]
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.plivo.api.samples.call;

import java.io.IOException;
import java.util.Collections;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.CallCreateResponse;

/**
* Example for Call create
*/
class CallCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            CallCreateResponse response = Call.creator("+12025550000", Collections.singletonList("+12025551111"), "https://s3.amazonaws.com/static.plivo.com/answer.xml")
                .answerMethod("GET")
                .create();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * Example for Call Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.Create(
                    to:new List<String>{"+12025551111"},
                    from:"+12025550000",
                    answerMethod:"GET",
                    answerUrl:"https://s3.amazonaws.com/static.plivo.com/answer.xml"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"to": "+12025551111","from": "+12025550000", "answer_url": "https://s3.amazonaws.com/static.plivo.com/answer.xml", "answer_method": "GET"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Call/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Example for Call create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Calls.Create(
		plivo.CallCreateParams{
			From:         "+12025550000",
			To:           "+12025551111",
			AnswerURL:    "https://s3.amazonaws.com/static.plivo.com/answer.xml",
			AnswerMethod: "GET",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Asynchronous machine detection

You can take action on detecting an answering machine during a call by setting the machine_detection_url parameter when firing an outbound call API. Plivo will detect an answering machine in the background and invoke the machine_detection_url with these parameters.

Parameters sent to machine_detection_url

From string

The from number used to initiate the call.

Machine boolean

Set to true if a machine is detected.

To string

The destination of the call.

RequestUUID string

An identifier that can uniquely identify a call.

ALegRequestUUID string

Identifies the first leg of the call in case there are multiple legs.

CallUUID string

The identifier used to identify the call.

IfMachine string

This parameter can be either continue or hangup depending on the machine_detection parameter set while initiating the call.

Direction string

The direction of the call. This will be “outbound” since we support machine detection only on outbound calls.

ALegUUID string

An unique identifier for the A leg of the call

Event string

The event that triggered this notification. This will have the value “MachineDetection”.

CallStatus string

The status of the call. This will have the value “in-progress”.

Returns

If successful, this endpoint returns a unique identifier that can be used to identify the call.

Response

HTTP Status Code: 200

Response for a successful call

{
  "message": "call fired",
  "request_uuid": "9834029e-58b6-11e1-b8b7-a5bd0e4e126f",
  "api_id": "97ceeb52-58b6-11e1-86da-77300b68f8bb"
}

Response for a queued call

{
  "message": "call queued",
  "request_uuid": "9834029e-58b6-11e1-b8b7-a5bd0e4e126f",
  "api_id": "97ceeb52-58b6-11e1-86da-77300b68f8bb"
}

Get call detail record (CDR) of a call

This method lets you retrieve the call detail record (CDR) of a call.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/

Arguments

No arguments need to be passed.

Returns

Returns the call detail record of the call identified using the given call UUID as the Call object.

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.get(
    call_uuid='10f0cb68-7533-45ed-acb5-87ceac29ee48', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Call Get
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.get(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Call get

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.get(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Call get
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->get(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.call;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.Call;

/**
* Example for Call get
*/
class CallGet {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Call response = Call.getter("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                .get();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Call Get
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.Get(
                    callUuid:"ffa23c86-87ed-4fd5-8310-59594df8ae11"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for Call get
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Calls.Get(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

{
    "answer_time": "2022-10-12 21:57:47+05:30",
    "api_id": "52cd2e1d-2bfd-11ec-a7bd-0242ac110005",
    "bill_duration": 1,
    "billed_duration": 1,
    "call_direction": "outbound",
    "call_duration": 1,
    "call_state": "ANSWER",
    "call_uuid": "5607532d-5037-4066-befc-a8b40218dd4f",
    "conference_uuid": null,
    "end_time": "2022-10-12 21:57:47+05:30",
    "from_number": "+12025551111",
    "hangup_cause_code": 8011,
    "hangup_cause_name": "Invalid Answer XML",
    "hangup_source": "Error",
    "initiation_time": "2022-10-12 21:57:40+05:30",
    "parent_call_uuid": null,
    "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Call/5607532d-5037-4066-befc-a8b40218dd4f/",
    "stir_verification": "Not Applicable",
    "to_number": "sip:sam9461399937766203278@phone.plivo.com",
    "total_amount": "0.01667",
    "total_rate": "1.00000",
    "Stir_attestation":"A",
    "voice_network_group": "",
    "source_ip": "92.168.0.1"
}

Transfer a call

This API enables an in-progress or ongoing call to fetch and execute XML from a different URL. If the call (the A leg) is in a Dial, you can also transfer the other party (the B leg) at the same time, or only transfer the B leg to a URL. This is useful for applications where you want to asynchronously change the behavior of a live call. For example, you can play music while a call is on hold, queue calls, or transfer calls.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/

Arguments

legs

Valid values are aleg, bleg, or both. aleg transfers call_uuid. bleg transfers the bridged leg of call_uuid. both transfers both legs.

aleg_url Callback-retry configurable

The URL to fetch XML from for the A leg. This argument needs to be specified if the legs parameter is either aleg or both.

aleg_method

The HTTP verb to invoke the aleg_url.

Defaults to POST.

bleg_url Callback-retry configurable

The URL to fetch XML from for the B leg. This need to be specified if the legs parameter is either bleg or both.

bleg_method

The HTTP verb to invoke the bleg_url.

Defaults to POST.

Returns

Returns an acknowledgement that the call is transferred.

Example Request

1
2
3
4
5
6
7
8
9
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.transfer(
    legs='aleg',
    aleg_url='https://aleg.url',
    call_uuid='1ed7fd89-df77-4ebf-8196-d5cf7222c918', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Example for Call Update
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.update(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8',
    legs: 'aleg',
    aleg_url: 'https://aleg.url'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Example for Call update

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.transfer(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
        {
            legs: "aleg",
            alegUrl: "https://aleg.url",
        },
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
/**
 * Example for Call update
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->transfer(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8',
        [
        	'legs' => 'aleg',
        	'aleg_url' => 'https://ALEG.URL'
        ]
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.plivo.api.samples.call;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.CallUpdateResponse;
import com.plivo.api.models.call.LegSpecifier;

/**
* Example for Call update
*/
class CallUpdate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            CallUpdateResponse response = Call.updater("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                .legs(LegSpecifier.ALEG)
                .alegUrl("https://aleg.url")
                .update();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * Example for Call Update
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.Transfer(
                    alegUrl:"https://aleg.url",
                    callUuid:"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
                    legs:"aleg"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"legs": "optional_param"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Example for Call update
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Calls.Update(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
		plivo.CallUpdateParams{
			Legs:    "aleg",
			AlegURL: "https://aleg.url",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
"message": "call transferred",
"api_id": "08c94608-58bd-11e1-86da-adf28403fe48"
}

Hang up a specific call

This method lets you hang up an ongoing call or cancel a queued outbound call. If you want to hang up an incoming call without answering it, see the documentation on the Hangup XML element.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/
Note: If CallUUID is not specified, all ongoing calls in that account will get disconnected.

Arguments

No arguments need to be passed.

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.delete(
    call_uuid='3a2e4c90-dcee-4931-8a59-f123ab507e60', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Call Delete
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.delete(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Call delete

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.hangup(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Call delete
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->delete(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.call;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;

/**
* Example for Call delete
*/
class CallDelete {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Call.deleter("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                .delete();

            System.out.println("Deleted successfully.");
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Call Delete
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.Delete(
                    callUuid:"10c94053-73b4-46fe-b74a-12159d1d3d60"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X DELETE \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for Call delete
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.Calls.Delete(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Println("Deleted successfully.")
}

Was this code helpful

Response

HTTP Status Code: 204

Posting call quality feedback using the API

This method lets you post feedback for calls. You can access call quality feedback information received through this API on the Call Debug UI, and view aggregated reports on the Call Insights Reporting dashboard.

API Endpoint

POST https://stats.plivo.com/v1/Call/{call_uuid}/Feedback/

Arguments

call_uuidRequiredThe call UUID of the call for which feedback is being posted.
ratingRequired

Quality rating for the call.

Allowed values: float between [1,5]. PS: for integer values both ‘x’ or ‘x.`0’ are accepted.

issuesRequired only if rating is <5List of issues observed on the call. One or more of the following:

AUDIO_LAG, BROKEN_AUDIO, CALL_DROPPED, CALLERID_ISSUE, DIGITS_NOT_CAPTURED, ECHO, HIGH_CONNECT_TIME, LOW_AUDIO_LEVEL, ONE_WAY_AUDIO, OTHERS, ROBOTIC_AUDIO

NotesOptional free text field that can be used to send descriptive feedback for the call.

HTTP responses we send

HTTP Status Code Message
201 Feedback has been posted
401 Authentication failed
404 Resource cannot be found*
404 Please check the Call UUID**
405 HTTP method not allowed
422 Rating has to be a float between 1 -5
422 Issues have to be an array of one or more than one of the following: AUDIO_LAG, BROKEN_AUDIO, CALL_DROPPPED, CALLERID_ISSUES, DIGITS_NOT_CAPTURED, ECHO, HIGH_CONNECT_TIME, LOW_AUDIO_LEVEL, ONE_WAY_AUDIO, OTHERS, ROBOTIC_AUDIO
500 Server error

* Generic response indicating error in resource used in the Post API call

** Specific response indicating the error in call UUID used in Post API call

Response attributes

HTTP status code HTTP status code from the list above
api_id Identifies the request
error Indicates there’s an error and provides information regarding the error
message Provides information regarding the feedback post

Example Request

1
2
3
4
5
6
7
8
9
10
11
12
#
# Example for Call Feedback creation
#
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.call_feedback.create(
    call_uuid="b38149eb-b8fe-45d5-85b2-78ee4424788f", 
    rating="4", 
    issues=["AUDIO_LAG"], 
    notes="Call quality was good")
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Call Feedback creation
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.call_feedback.create('f28149eb-b8fe-45d5-85b2-78ee4424788f', 
      4, 
      ["AUDIO_LAG"], 
      "Call quality was good")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Call Feedback creation

var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.callFeedback.create('f18149eb-b8fe-45d5-85b2-78ee4424788f',
        4,
        issues = ["AUDIO_LAG"],
        notes = "Call quality was good").then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Call Feedback creation
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    $response = $client->callFeedback->create('f18149eb-b8fe-45d5-85b2-78ee4424788f', 
        4, 
        ["AUDIO_LAG"], 
        "Call quality was good");
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.callfeedback.CallFeedback;
import com.plivo.api.models.callfeedback.CallFeedbackCreateResponse;

import java.io.IOException;
import java.util.Collections;

/**
 * Example for Call Feedback creation
 */
class CallFeedbackCreate {
    public static void main(String[] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            CallFeedbackCreateResponse response = CallFeedback
                    .creator("f18149eb-b8fe-45d5-85b2-78ee4424788f", (float) 4)
                    .issues(Collections.singletonList("AUDIO_LAG")).notes("Call quality was good").create();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * Example for Call Feedback Creation
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.CallFeedback.Create(
                    callUUID: "a18149eb-b8fe-45d5-85b2-78ee4424788f",
                    rating: 4,
                    issues: new List<string> { "AUDIO_LAG" },
                    notes: "Call quality was good");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"issues": ["AUDIO_LAG"], "rating": "4", "notes": "Call quality was good"}' \
    https://stats.plivo.com/v1/Call/f6bf3c48-afdf-4e42-a30e-9e00fda351d/Feedback/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Example for Call Feedback creation
package main

import "fmt"
import "github.com/plivo/plivo-go/v7"

func main() {

	client, err := plivo.NewClient("<auth_id>","<auth_token>", &plivo.ClientOptions{})
	if err != nil {
			fmt.Print("Error", err.Error())
			return
		}
  issuesArr := []string{**"AUDIO_LAG"**}
	response, err := client.CallFeedback.Create(
  plivo.CallFeedbackParams{
  CallUUID: "f18149eb-b8fe-45d5-85b2-78ee442478", 
  Rating: "4", 
  Issues: issuesArr, 
  Notes: "Call quality was good"})
	if err != nil {
			fmt.Print("Error", err.Error())
			return
		}
	fmt.Printf("Response: %#v\n", response)

}

Was this code helpful

Response

HTTP Status Code: 201

{
  "message": "Feedback has been posted",
  "api_id": "97ceeb52-58b6-11e1-86da-77300b68f8bb",
  "status": "success"
}

Retrieve details of all calls

This method lets you retrieve details of all completed calls. The maximum number of results that you can fetch with a single API call is 20.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Call/

Arguments

subaccount optional

The ID of a subaccount, if you want to retrieve only calls made from a specific subaccount.

call_direction optional

The direction of the call, if you want to filter results by call direction.

Allowed values: inbound, outbound

from_number optional

The number from which the calls were made, if you want to filter results by source number. You can filter the details by using the exact number or the prefix.

to_number optional

The destination number to which the calls were made, if you want to filter results by destination. You can filter the details by using the exact number or the prefix.

parent_call_uuid optional

Set this request parameter to the call UUID of an A leg to fetch all the B legs associated with it.

bill_duration optional

Filters calls by billed duration in seconds. The filter can be used in these five forms:

  • bill_duration: Input the exact value. For example, to retrieve calls that were exactly three minutes long, use bill_duration=180

  • bill_duration__gt: gt stands for greater than. To retrieve calls that were more than two hours long, use bill_duration__gt=7200

  • bill_duration__gte: gte stands for greater than or equal to. To retrieve calls that were two hours or more in duration, use bill_duration__gte=7200

  • bill_duration__lt: lt stands for less than. To retrieve calls that were less than seven minutes long, use bill_duration__lt=420

  • bill_duration__lte: lte stands for lesser than or equal to. To retrieve calls that were two hours or less in duration, use bill_duration__lte=7200

end_time optional

Filters calls by their completion time. The time format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. The filter can be used in these five forms:

  • end_time: To get all calls that ended at 2021-03-21 11:47[:30], use end_time=2021-03-21 11:47[:30]

  • end_time__gt: gt stands for greater than. To get all calls that ended after 2021-03-21 11:47, use end_time__gt=2021-03-21 11:47

  • end_time__gte: gte stands for greater than or equal to. To get all calls that ended after or exactly at 2021-03-21 11:47[:30], use end_time__gte=2021-03-21 11:47[:30]

  • end_time__lt: lt stands for less than. To get all calls that ended before 2021-03-21 11:47, use end_time__lt=2021-03-21 11:47

  • end_time__lte: lte stands for less than or equal to. To get all calls that ended before or exactly at 2021-03-21 11:47[:30], use end_time__lte=2021-03-21 11:47[:30]

Note: Calls made only in the last 90-days can be retrieved via APIs.

You can combine these filters to get call detail records that were added during a particular time range.

If you don’t use the end_time filter when you search, Plivo uses a search window of the last seven days from the current date. Alternatively, you can use end_time__[lt|lte] and end_time__[gt|gte] to search a range of times for CDRs of up to 30 days of search boundary. If the provided range exceeds the 30-day boundary, the API will return a 400 response code, signaling an error.


Timestamp values need to be specified as UTC.

hangup_cause_code optional

Retrieves calls that were hung up with a specific hangup cause. Refer to our list of hangup causes and sources.

hangup_source optional

Retrieves calls that were hung up by a specific hangup source. Refer to our list of hangup causes and sources.

limit optional

Limits the number of results retrieved. The maximum it can be set to is 20.

Defaults to 20.

offset optional

Denotes the number of value items by which the results should be offset. For example, if the results contains 1,000 values and limit is set to 10 and offset is set to 705, then values 706 through 715 are displayed in the results. This parameter is also used for pagination of the results.

stir_verification optional

For outbound calls: Gives details about the attestation assigned to the call by Plivo

For inbound calls: Gives details about the attestation received on the inbound call to your Plivo phone number.

Allowed values:

  • Verified means the call is from a verified caller who has authorized access to the customer’s caller ID, and hence should be treated with confidence. Verified is equivalent to attestation level A.
  • Not Verified means that, for this call, either the caller is not verified, or it’s uncertain whether they have access to the caller ID used, or both. Not Verified means the call received attestation level B or C.
  • Not Applicable means STIR/SHAKEN doesn’t apply to this call, as would be the case if a call is not addressed to a US number or if it’s a cloud call (WebRTC or SIP).

Read more about STIR/SHAKEN.

Returns

Returns the call objects that match the filters specified in the request.

Example Request

1
2
3
4
5
6
7
8
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.list(
    limit=5,
    offset=0, )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Call List
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.list(
    limit: 5,
    offset: 0
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Example for Call list

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.list(
        {
            limit: 5,
            offset: 0,
        },
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/**
 * Example for Call list
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->list(
        [
        	'limit' => 5,
        	'offset' => 2
        ]
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.plivo.api.samples.call;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.base.ListResponse;

/**
* Example for Call list
*/
class CallList {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            ListResponse<Call> response = Call.lister()
                .limit(5)
                .offset(0)
                .list();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Example for Call List
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.List(
                    limit:5,
                    offset:0
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
  https://api.plivo.com/v1/Account/{auth_id}/Call/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Example for Call list
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Calls.List(
		plivo.CallListParams{
			Limit:  5,
			Offset: 0,
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

{
"api_id": "8299d094-dc72-11e5-b56c-22000ae90795",
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 4
},
"objects": [
{
    "answer_time": "2022-10-12 21:57:47+05:30",
    "api_id": "52cd2e1d-2bfd-11ec-a7bd-0242ac110005",
    "bill_duration": 1,
    "billed_duration": 1,
    "call_direction": "outbound",
    "call_duration": 1,
    "call_state": "ANSWER",
    "call_uuid": "5607532d-5037-4066-befc-a8b40218dd4f",
    "conference_uuid": null,
    "end_time": "2022-10-12 21:57:47+05:30",
    "from_number": "+12025551111",
    "hangup_cause_code": 8011,
    "hangup_cause_name": "Invalid Answer XML",
    "hangup_source": "Error",
    "initiation_time": "2022-10-12 21:57:40+05:30",
    "parent_call_uuid": null,
    "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Call/5607532d-5037-4066-befc-a8b40218dd4f/",
    "stir_verification": "Not Applicable",
    "to_number": "sip:sam9461399937766203278@phone.plivo.com",
    "total_amount": "0.01667",
    "total_rate": "1.00000",
    "Stir_attestation":"A",
    "voice_network_group": "",
    "source_ip": "92.168.0.1"
},
{
    "answer_time": "2022-10-12 21:57:47+05:30",
    "api_id": "52cd2e1d-2bfd-11ec-a7bd-0242ac110005",
    "bill_duration": 1,
    "billed_duration": 1,
    "call_direction": "outbound",
    "call_duration": 1,
    "call_state": "ANSWER",
    "call_uuid": "5607532d-5037-4066-befc-a8b40218dd4f",
    "conference_uuid": null,
    "end_time": "2022-10-12 21:57:47+05:30",
    "from_number": "+12025551111",
    "hangup_cause_code": 8011,
    "hangup_cause_name": "Invalid Answer XML",
    "hangup_source": "Error",
    "initiation_time": "2022-10-12 21:57:40+05:30",
    "parent_call_uuid": null,
    "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Call/5607532d-5037-4066-befc-a8b40218dd4f/",
    "stir_verification": "Not Applicable",
    "to_number": "sip:sam9461399937766203278@phone.plivo.com",
    "total_amount": "0.01667",
    "total_rate": "1.00000",
    "Stir_attestation":"A",
    "voice_network_group": "",
    "source_ip": "92.168.0.1"
}
]
}

Get details of a specific ongoing call

This method lets you retrieve details of a specific ongoing call.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/?status=live

Arguments

No arguments need to be passed.

Returns

Returns the details of the specific call as a Call object.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.live_calls.get('10f0cb68-7533-45ed-acb5-87ceac29ee48')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Live Call Get
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.get_live(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for LiveCall get

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.getLiveCall(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

/**
 * Example for Call get
 */

require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    $response = $client->calls->getLive(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.livecall;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.LiveCall;

/**
 * Example for LiveCall get
 */
class LiveCallGet {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            LiveCall response = LiveCall.getter("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                    .get();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Live Call Get
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.GetLive(
                    liveCallUuid:"ffa23c86-87ed-4fd5-8310-59594df8ae11"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/?status=live

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for LiveCall get
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.LiveCalls.Get(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

{
  "direction": "inbound",
  "from": "15856338537",
  "call_status": "in-progress",
  "api_id": "45223222-74f8-11e1-8ea7-12313806be9a",
  "to": "14154290945",
  "caller_name": "+15856338537",
  "call_uuid": "6653422-91b6-4716-9fad-9463daaeeec2",
  "Stir_attestation": "A",
  "session_start": "2021-03-23 14:49:39.722551" // Format: YYYY-MM-DD HH:mm:ss.sssss Timezone: UTC
}

Get details of all ongoing calls

This method lets you retrieve details of all ongoing calls made from an account.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Call/?status=live

Arguments

call_direction optional

The direction of the call, if you want to filter results by call direction.

Allowed values: inbound, outbound

from_number optional

The number from which the calls were made, if you want to filter results by source number. You can filter the details by using the exact number or the prefix.

to_number optional

The number to which the calls were made, if you want to filter results by destination called. You can filter the details by using the exact number or the prefix.

Returns

Returns the call UUIDs of all ongoing calls.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.live_calls.list_ids(from_number=123456789, to_number=123456789, call_direction=Inbound)
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Example for Call List
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.list_live(
	from_number: 123456789,
	to_number: 123456789,
	call_direction: outbound
)
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Example for LiveCall list

(function main() {
   'use strict';

  // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
   var client = new plivo.Client("<auth_id>", "<auth_token>")
   client.calls.listLiveCalls(
       {
           to_number : "9880156119",
           from_number : "9880156119",
           call_direction : "outbound"
       }
   ).then(function (response) {
       console.log(response);
   }, function (err) {
       console.error(err);
   });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/**
 * Example for Call list
 */
 require 'vendor/autoload.php';
 use Plivo\RestClient;
 use Plivo\Exceptions\PlivoRestException;
 $client = new RestClient("<auth_id>","<auth_token>");
 try {
     $response = $client->calls->listLive(
 [
 	to_number => 123456789,
 	from_number => 123456789,
 	call_direction => inbound
 ]
 );
     print_r($response);
 }
 catch (PlivoRestException $ex) {
     print_r($ex);
 }

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.plivo.api.samples.livecall;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.LiveCall;
import com.plivo.api.models.call.LiveCallListResponse;

class LiveCallList {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            LiveCallListResponse response = LiveCall.listGetter().callDirection(CallDirection.INBOUND).fromNumber("123456789").toNumber("123456789").get();


            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Example for Live Call List
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
   internal class Program
   {
       public static void Main(string[] args)
       {
           var api = new PlivoApi("<auth_id>","<auth_token>");
           try
           {
               var response = api.Call.ListLive(callDirection: Inbound, fromNumber: 123456789, toNumber: 123456789);
Console.WriteLine(response);
           }
           catch (PlivoRestException e)
           {
               Console.WriteLine("Exception: " + e.Message);
           }
       }
   }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/?status=live

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Example for LiveCall list
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.LiveCalls.IDList()
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

{
  "api_id": "c9527676-5839-11e1-86da-6ff39efcb949",
  "calls": [
"eac94337-b1cd-499b-82d1-b39bca50dc31",
"0a70a7fb-168e-4944-a846-4f3f4d2f96f1"
  ]
}

Retrieve All Live Calls v2

The method outlined below allows you to retrieve the details of all ongoing calls from an account.

API Endpoint

GET https://api.plivo.com/v2/Account/{auth_id}/Call/?status=live

Arguments

call_direction optional

The direction of the call, if you want to filter results by call direction.

Allowed values: inbound, outbound

number optional

The number from/to which the calls were made. You can filter results by source & destination number using the exact number or the prefix.

Returns

Returns the call UUIDs along with the call details of all ongoing calls.

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v2/Account/{auth_id}/Call/?status=live

Was this code helpful

Response

{
  "api_id": "2bfa4869-babb-4926-bca0-b2d226cfbc44",
  "meta": {
    "count": 2,
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null
  },
  "objects": [
    {
      "call_status": "in-progress",
      "call_uuid": "d144ed7e-f677-4017-a79e-5094f8a0b854",
      "caller_name": "PLIVO54115552876164304265638",
      "direction": "outbound",
      "from": "+15732629XXX",
      "request_uuid": "d144ed7e-f677-4017-a79e-5094f8a0b854",
      "session_start": "2024-02-07 13:55:28.141067",
      "stir_attestation": "Not Applicable",
      "stir_verification": "Not Applicable",
      "to": "919003459XXX"
    },
    {
      "call_status": "in-progress",
      "call_uuid": "19334e79-f40c-48a9-81e6-0ba47eb00610",
      "caller_name": "PLIVO",
      "direction": "inbound",
      "from": "sip:PLIVO43042XXXX@phone.plivo.com",
      "request_uuid": "19334e79-f40c-48a9-81e6-0ba47eb00610",
      "session_start": "2024-02-07 13:55:23.959929",
      "stir_attestation": "Not Applicable",
      "stir_verification": "Not Applicable",
      "to": "919003459XXX"
    }
  ]
}

Retrieve a queued call

This method lets you retrieve details of a specific queued call. The maximum number of results that you can fetch with a single API call is 20.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/?status=queued

Arguments

No arguments need to be passed.

Returns

Returns the call objects that match the filters specified in the request.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.queued_calls.get('10f0cb68-7533-45ed-acb5-87ceac29ee48')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for QueuedCall Get
#
require 'rubygems'
require 'plivo'

	include Plivo
	include Plivo::Exceptions

	api = RestClient.new("<auth_id>","<auth_token>")

	begin
			response = api.calls.get_queued(
  			'd6b00702-f7e2-49c9-9a90-5921c6602788'
			)
			puts response
	rescue PlivoRESTError => e
			puts 'Exception: ' + e.message
	end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for QueuedCall get

var plivo = require('plivo');

		(function main() {
    			'use strict';

    		// As the auth_id and auth_token are unspecified, Plivo will fetch them from the PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN environment variables.
    			var client = new plivo.Client("<auth_id>","<auth_token>");
    			client.calls.getQueuedCall(
       			 "d6b00702-f7e2-49c9-9a90-5921c6602788", // call uuid
    			).then(function (response) {
        				console.log(response);
    			}, function (err) {
        			console.error(err);
    			});
		})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
/**
 * Example for QueuedCall get
 */
require 'vendor/autoload.php';
		use Plivo\RestClient;
		use Plivo\Exceptions\PlivoRestException;
		$client = new RestClient("<auth_id>","<auth_token>");
		try {
   			$response = $client->calls->getQueued(
       			'd6b00702-f7e2-49c9-9a90-5921c6602788'
   			);
   			print_r($response);
		}
		catch (PlivoRestException $ex) {
   			print_r($ex);
		}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.livecall;

	import java.io.IOException;
	import com.plivo.api.Plivo;
	import com.plivo.api.exceptions.PlivoRestException;
	import com.plivo.api.models.call.LiveCall;

	/**
	 * Example for QueuedCall get
 	*/
	class QueuedCallGet {
    		public static void main(String [] args) {
        		Plivo.init("<auth_id>","<auth_token>");
        		try {
            		QueuedCall response = QueuedCall.getter("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                    		.get();

            		System.out.println(response);
        		} catch (PlivoRestException | IOException e) {
            		e.printStackTrace();
        		}
    	}
	}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * Example for QueuedCall get
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.GetQueued("d6b00702-f7e2-49c9-9a90-5921c6602788"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
   https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/?status=queued/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Example for QueuedCall get
package main

	import "fmt"
	import "github.com/plivo/plivo-go/v7"

	func main() {
	client, err := plivo.NewClient("<auth_id>","<auth_token>", &plivo.ClientOptions{})
	if err != nil {
			fmt.Print("Error", err.Error())
			return
		}
	response, err := client.QueuedCalls.Get
(
		"d6b00702-f7e2-49c9-9a90-5921c6602788",
	)
	if err != nil {
			fmt.Print("Error", err.Error())
			return
		}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

{
  "direction": "outbound",
  "from": "15856338537",
  "call_status": "queued",
  "api_id": "45223222-74f8-11e1-8ea7-12313806be9a",
  "to": "14154290945",
  "caller_name": "+15856338537",
  "call_uuid": "6653422-91b6-4716-9fad-9463daaeeec2",
  "request_uuid": "6653422-91b6-4716-9fad-9463daaeeec2"
}

Retrieve all queued calls

This method lets you retrieve details of all queued calls. The maximum number of results that can be fetched with a single API call is 20.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Call/?status=queued

Arguments

No extra arguments need to be passed.

Returns

Returns the call objects that match the filters specified in the request.

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')


response = client.queued_calls.list_ids()
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#
# Example for Retrieve all Queued Calls
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
		response = api.calls.list_queued()
		  puts response
rescue PlivoRESTError => e
		  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Example for Retrieve all Queued Calls

var plivo = require('plivo');

(function main() {
  		'use strict';

		// As the auth_id and auth_token are unspecified, Plivo will fetch them from the PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN environment variables.
			var client = new plivo.Client("<auth_id>","<auth_token>");
			client.calls.listQueuedCalls(
  		).then(function (response) {
 			   console.log(response);
  		}, function (err) {
 		   	console.error(err);
		 	});
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
/**
 * Example for Retrive all Queued Calls
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
			$response = $client->calls->listQueued();
			print_r($response);
}
catch (PlivoRestException $ex) {
			print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.livecall;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.QueuedCall;
import com.plivo.api.models.call.QueuedCallListResponse;

/**
 * Example for QueuedCall list
	*/
class QueuedCallList {
			public static void main(String [] args) {
    				Plivo.init("<auth_id>","<auth_token>");
    				try {
        				QueuedCallListResponse response = QueuedCall.listGetter()
                				.get();

        				System.out.println(response);
    				} catch (PlivoRestException | IOException e) {
        				e.printStackTrace();
    				}
			}
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Example for Retrieve all Queued Calls
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
			internal class Program
			{
   			public static void Main(string[] args)
   			{
       		var api = new PlivoApi("<auth_id>","<auth_token>");
       		try
       		{
           			var response = api.Call.ListQueued();
           			Console.WriteLine(response);
       		}
       		catch (PlivoRestException e)
       		{
           			Console.WriteLine("Exception: " + e.Message);
       		}
   			}
			}
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/?status=queued/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Example for Retrieve all Queued Calls
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	response, err := client.QueuedCalls.IDList()
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

{
  "api_id": "c9527676-5839-11e1-86da-6ff39efcb949",
  "calls": [
    "eac94337-b1cd-499b-82d1-b39bca50dc31",
    "0a70a7fb-168e-4944-a846-4f3f4d2f96f1"
  ]
}

Record calls

The Record endpoint lets you start and stop recording specific portions of an active call. You can use this API to create multiple recordings on the same call.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Record/

Start recording a call

This endpoint lets you start recording a call.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Record/

Arguments

time_limit integer

Sets the maximum duration, in seconds, of the recording.

Defaults to 60.

file_format string

The file format for the recording.

Allowed values: mp3 and wav
Default is mp3.

transcription_type string

auto: Transcription is automated; the turnaround time is under 5 minutes which linearly increases with call duration.

Transcription charges and details are available on our pricing page.

Note: Transcription service is available only in English, and limited to calls with a duration greater than 500 milliseconds and less than 4 hours, with a recording file size smaller than 2GB.
transcription_url stringCallback-retry configurable

The URL to which the transcription should be posted.

Note: The transcription information is sent to this URL via an HTTP POST callback.
callback_url stringCallback-retry configurable

The URL to be invoked when the recording ends. The details to be posted to the URL are documented in the Callback URL section below.

callback_method string

The HTTP verb used to invoke the callback_url.

Allowed values: GET, POST
Defaults to POST.

Callback URL

These details are posted when the callback URL is invoked after the recording ends.

List of parameters sent to the callback URL

api_id

The API ID that was returned by the Record API.

record_url

The URL where the recorded file can be accessed.

call_uuid

The call_uuid of the call on which this recording was made.

recording_id

The recording_id returned by the Record API.

recording_duration

The recording duration in seconds.

recording_duration_ms

The recording duration in milliseconds.

recording_start_ms

The start time of the recording since epoch in milliseconds.

recording_end_ms

The end time of the recording since epoch in milliseconds.

List of parameters sent to the transcription URL

transcription_charge

The credit deducted for the transcription.

transcription

The transcribed text of the recording.

duration

The duration in seconds of the recording.

call_uuid

The call UUID of the call that was transcribed.

transcription_rate

The rate of the transcription per minute.

recording_id

The recording ID of the transcribed recording.

error May be Recording duration too long for transcription or Recording file size too large for transcription. Empty if transcription is successful.
Note: .mp3 files are smaller in size than .wav files. Consider changing the recording file format to .mp3 if you see this error.

Returns

If successful, this endpoint returns an acknowledgement that the recording has started along with a URL to access the recording.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.calls.record(
    call_uuid='3a2e4c90-dcee-4931-8a59-f123ab507e60', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Call Record Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.record(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Call Record create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.record(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Call Record create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->startRecording(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.call.record;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.actions.CallRecordCreateResponse;

/**
* Example for Call Record create
*/
class RecordCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            CallRecordCreateResponse response = Call.recorder("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                .record();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Call Record Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.StartRecording(
                    callUuid:"10c94053-73b4-46fe-b74a-12159d1d3d60"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"time_limit":"optional param in seconds"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Record/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Example for Call Record create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Calls.Record(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
		plivo.CallRecordParams{},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
  "url": "http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3",
  "message": "call recording started",
  "recording_id": "48dfaf60-3b2a-11e3",
  "api_id": "c7b69074-58be-11e1-86da-adf28403fe48"
}

Stop currently active recording

This endpoint lets you stop active recordings on a call. Since a call can have multiple ongoing recordings, this endpoint lets you choose a specific recording to stop, or you can stop all ongoing recordings.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Record/

Arguments

URLstring

You can specify a record URL to stop only one record. By default, all recordings are stopped.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.calls.record_stop(
    call_uuid='3a2e4c90-dcee-4931-8a59-f123ab507e60', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Call Record Delete
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.stop_record(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Call Record delete

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.stopRecording(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Call Record delete
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->stopRecording(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.call.record;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;

/**
* Example for Call Record delete
*/
class RecordDelete {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Call.recordStopper("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                .recordStop();

            System.out.println("Deleted successfully.");
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Call Record Delete
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.StopRecording(
                    callUuid:"93b35e56-5b28-47fc-95aa-8536625d3ac1"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Record/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for Call Record delete
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.Calls.StopRecording(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Println("Deleted successfully.")
}

Was this code helpful

Response

HTTP Status Code: 204

Play audio on calls

The Play endpoint lets you play an audio file to users in an ongoing call. The common use case for this object is to play automated notifications or music while someone is waiting on a call.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Play/

Play audio on a call

This endpoint allows you to play an audio file during an active call. Plivo supports .mp3 and .wav audio files.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Play/

Arguments

urls Required

A URL or a list of comma-separated URLs linking to an .mp3 or .wav file.

length integer

The maximum length, in seconds, to play this audio file.

legs string

The call leg in which the audio is to be played.

Allowed values: aleg (first leg of the call), bleg (second leg of the call), or both.

Defaults to aleg.

loop boolean

When set to true, audio file plays indefinitely.

Defaults to false.

mix boolean

Used to determine the behavior of current call audio when the file is being played. If set to false, then participants cannot hear anyone speaking in the call until the play audio stops. If set to true, call audio and play audio are mixed and played.

Defaults to true.

Returns

Returns the acknowledgement that the audio file has started playing.

Example Request

1
2
3
4
5
6
7
8
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.play(
    call_uuid='bc480f62-6d99-469e-b80e-090e620de824',
    urls='https://s3.amazonaws.com/plivocloud/music.mp3', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Example for Call Play Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.play(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8',
    ['https://s3.amazonaws.com/plivocloud/Trumpet.mp3'],
    loop: true
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example for Call Play create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.playMusic(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
        "https://s3.amazonaws.com/plivocloud/Trumpet.mp3", // urls
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
/**
 * Example for Call Play create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->startPlaying(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8',
        [
        	'https://s3.amazonaws.com/plivocloud/Trumpet.mp3',
        	'https://www.ANOTHER.ONE/SOUND.MP3'
        ]
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.plivo.api.samples.call.play;

import java.io.IOException;
import java.util.Collections;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.actions.CallPlayCreateResponse;

/**
* Example for Call Play create
*/
class PlayCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            CallPlayCreateResponse response = Call.player("eba53b9e-8fbd-45c1-9444-696d2172fbc8", Collections.singletonList("https://s3.amazonaws.com/plivocloud/Trumpet.mp3"))
                .play();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Example for Call Play Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.StartPlaying(
                    callUuid:"93b35e56-5b28-47fc-95aa-8536625d3ac1",
                    urls:new List<string>() {"https://s3.amazonaws.com/plivocloud/music.mp3"}
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"urls":"https://s3.amazonaws.com/plivocloud/Trumpet.mp3"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Play/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Example for Call Play create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Calls.Play(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
		plivo.CallPlayParams{
			URLs: "https://s3.amazonaws.com/plivocloud/Trumpet.mp3",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
  "message": "play started",
  "api_id": "07abfd94-58c0-11e1-86da-adf28403fe48"
}

Stop playing audio on a call

This endpoint lets you stop an already playing audio file during an active call.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Play/

Arguments

No arguments need to be passed.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.calls.play_stop(
    call_uuid='bc480f62-6d99-469e-b80e-090e620de824', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Call Play Delete
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.stop_play(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8',
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Call Play delete

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.stopPlayingMusic(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Call Play delete
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->stopPlaying(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.call.play;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;

/**
* Example for Call Play delete
*/
class PlayDelete {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Call.playStopper("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                .playStop();

            System.out.println("Deleted successfully.");
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Call Play Delete
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.StopPlaying(
                    callUuid:"10c94053-73b4-46fe-b74a-12159d1d3d60"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Play/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for Call Play delete
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.Calls.StopPlaying(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Println("Deleted successfully.")
}

Was this code helpful

Response

HTTP Status Code: 204

Speak text on calls

The Speak API lets you play spoken versions of text during ongoing calls. It uses Plivo’s text-to-speech engine to convert written text and speak it. You can use it to play notifications to customer while they’re waiting on hold.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Speak/

Play text during a call

This endpoint lets you speak text in an active call.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Speak/

Arguments

text Required

The text that needs to be spoken.

voice string

The voice in which the text should be spoken.

Allowed values: MAN, WOMAN.
Defaults to WOMAN.

language string

The language used to speak the text. The default language is US English (en-US). You can see the list of supported languages below.

legs string

The call leg in which the text is to be spoken.

Allowed values: aleg (first leg of the call), bleg (second leg of the call), or both
Defaults to aleg.

loop boolean

If set to true, the text will be spoken repeatedly unless stopped.

Defaults to false.

mix boolean

This flag determines the behavior of current call audio when the file is being played. If set to false, then call participants cannot hear anyone speaking in the call until play is stopped. If set to true, both call audio and played audio are mixed and played.

Defaults to true.

List of languages supported

Arabicarb

Only WOMAN voice

Chinese Mandarincmn-CN

Only WOMAN voice

Danish (Denmark)da-DK

Both WOMAN and MAN voices

Dutch (Netherlands)nl-NL

Both WOMAN and MAN voices

English (Australia)en-AU

Both WOMAN and MAN voices

English (India)en-IN

Only WOMAN voice

English (UK)en-GB

Both WOMAN and MAN voices

English (US)en-US

Both WOMAN and MAN voices

English (Welsh)en-GB-WLS

only MAN voice

French (Canada)fr-CA

Only WOMAN voice

French (France)fr-FR

Both WOMAN and MAN voices

German (Germany)de-DE

Both WOMAN and MAN voices

Hindi (India)hi-IN

Only WOMAN voice

Icelandic (Iceland)is-IS

Both WOMAN and MAN voices

Italian (Italy)it-IT

Both WOMAN and MAN voices

Japanese (Japan)ja-JP

Both WOMAN and MAN voices

Korean (South Korea)ko-KR

Only WOMAN voice

Norwegian (Norway)nb-NO

Only WOMAN voice

Polish (Poland)pl-PL

Both WOMAN and MAN voices

Portuguese (Brazil)pt-BR

Both WOMAN and MAN voices

Portuguese (Portugal)pt-PT

Both WOMAN and MAN voices

Romanian (Romania)ro-RO

Only WOMAN voice

Russian (Russia)ru-RU

Both WOMAN and MAN voices

Spanish (Mexico)es-MX

Only WOMAN voice

Spanish (Spain)es-ES

Both WOMAN and MAN voices

Spanish (US)es-US

Both WOMAN and MAN voices

Swedish (Sweden)sv-SE

Only WOMAN voice

Turkish (Turkey)tr-TR

Only WOMAN voice

Welsh (Wales)cy-GB

Only WOMAN voice

Returns

If successful, this endpoint returns an acknowledgement that the written text is being spoken in the call

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.calls.speak(
    call_uuid='3a2e4c90-dcee-4931-8a59-f123ab507e60',
    text='Hello World', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Call Speak Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.speak(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8',
    'Hello World'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example for Call Speak create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.speakText(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
        "Hello World", // text
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
 * Example for Call Speak create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->startSpeaking(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8',
        'Hello World'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.call.speak;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.actions.CallSpeakCreateResponse;

/**
* Example for Call Speak create
*/
class SpeakCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            CallSpeakCreateResponse response = Call.speaker("eba53b9e-8fbd-45c1-9444-696d2172fbc8", "Hello World")
                .speak();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Example for Call Speak Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.StartSpeaking(
                    callUuid:"93b35e56-5b28-47fc-95aa-8536625d3ac1",
                    text:"Hello World"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"text":"Hey, How aryou?"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Speak/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Example for Call Speak create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Calls.Speak(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
		plivo.CallSpeakParams{
			Text: "Hello World",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
  "message": "speak started",
  "api_id": "07abfd94-58c0-11e1-86da-adf28403fe48"
}

Stop speaking text during a call

This endpoint lets you stop active text being spoken during a call.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Speak/

Arguments

No arguments need to be passed.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.calls.speak_stop(
    call_uuid='3a2e4c90-dcee-4931-8a59-f123ab507e60', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Call Speak Delete
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.stop_speak(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Call Speak delete

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.stopSpeakingText(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Call Speak delete
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->stopSpeaking(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.call.speak;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;

/**
* Example for Call Speak delete
*/
class SpeakDelete {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Call.speakStopper("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                .speakStop();

            System.out.println("Deleted successfully.");
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Call Speak Delete
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.StopSpeaking(
                    callUuid:"10c94053-73b4-46fe-b74a-12159d1d3d60"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Speak/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for Call Speak delete
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.Calls.StopSpeaking(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Println("Deleted successfully.")
}

Was this code helpful

Response

HTTP Status Code: 204

{
    "message" : "speak stopped",
    "api_id" : "cf2359c8-f4d6-11e6-b886-067c5485c240"
}

DTMF

DTMF is the tone that’s generated whenever a key is pressed in an active call. This resource allows you to send DTMF digits in an active call. The common use case for using this object is to automate sending of specific digits to a receiver in an outbound call.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/DTMF/

Send digits on an active call

This endpoint lets you send DTMF digits on an active call.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/DTMF/

Arguments

digitsRequired

Set of digits that need to be sent over the call.

legstring

This is the leg of the call in which the DTMF should be sent. This can take the values aleg (the current call) or bleg (the other party in a call).

Defaults to aleg.

Returns

Returns the acknowledgement that the DTMF is sent.

Example Request

1
2
3
4
5
6
7
8
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.send_digits(
    call_uuid='eba53b9e-8fbd-45c1-9444-696d2172fbc8',
    digits='123', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Example for Call DTMF Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.send_digits(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8',
    '123',
    'bleg'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example for Call DTMF create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.calls.sendDigits(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
        "123", // digits
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
/**
 * Example for Call DTMF create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->calls->dtmf(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8',
        '123',
        'bleg'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.call.dtmf;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.actions.CallDtmfCreateResponse;

/**
* Example for Call DTMF create
*/
class DTMFCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            CallDtmfCreateResponse response = Call.digitSender("eba53b9e-8fbd-45c1-9444-696d2172fbc8", "123")
                .sendDigits();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Example for Call DTMF Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.SendDigits(
                    callUuid:"10c94053-73b4-46fe-b74a-12159d1d3d60",
                    digits:"123"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"digits":"8743#"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/DTMF/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Example for Call DTMF create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Calls.SendDigits(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
		plivo.CallDTMFParams{
			Digits: "123",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
  "message": "digits sent",
  "api_id": "07abfd94-58c0-11e1-86da-adf28403fe48"
}

Multiparty call

A multiparty call (MPC) allows multiple users with specific roles to dial into a single call. While conferences also allow multiple users to join a single call, multiparty calls are better suited for call centers or sales dialer use cases such as:

  • Assigning a specific role to each call participant — agent, customer, or supervisor.
  • Discreetly allowing supervisors to coach agents without being heard by customers. Check our Supervisor coaching guide for more information.
  • Dialing members out of the MPC using API requests.
  • Transferring calls into an MPC with a single API request.

For traditional “meeting” use cases where more participants may need to be connected, please checkout our conference offering.

An MPC can be initiated using either Add a Participant API or MPC XML with one or more participants. Also, participants can be added to an existing/ongoing MPC using the Add a Participant API or MPC XML.

Note: To initiate an MPC, at least 1 participant should be added to the call.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/
Note: In all APIs related to MPC, you can use mpc_uuid instead of mpc_name — for example, https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/uuid_{mpc_uuid}/

The Multiparty Call Object

Arguments

UUIDstring

UUID of this MPC object.

Account Idstring

Account/subaccount associated with the MPC.

Subaccount Idstring

Subaccount associated with the MPC.

Creation Timetimestamp

Date and time at which the MPC was created in the account.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm

Start Timetimestamp

Timestamp of when this MPC was started.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm

End Timetimestamp

Timestamp of when this MPC ended. YYYY-MM-DD HH:mm:ss+|-hh:mm This value is null if the MPC has not ended.

Friendly Namestring

Name given to this MPC by the user.This name must be unique for the account across all live MPCs.

Statusstring

Current status of the MPC. Possible values are:

- Initialized: The MPC has been initialized.

- Active: Participants have joined the MPC and the MPC has started.

- Ended: The MPC has ended.

Max Participantsstring

Maximum number of participants that can be part of an MPC at any given time.

Max Durationstring

Maximum period (in seconds) for which this MPC can run. Max Duration is counted from the call initiation time.

Stay Aloneboolean

Whether any participant can remain alone in the MPC.

Durationstring

Total duration of the MPC.This value is null if the MPC has not ended.

Wait Music URLstring

Music that should be played for waiting participants if the MPC has not yet started.

Wait Music Methodstring

HTTP verb that should be used to invoke the URL configured as wait_music_url.

Agent Hold Music URLstring

Hold music that should be played to participants that have the role Agent when they’re on hold.

Agent Hold Music Methodstring

HTTP verb that should be used to invoke the URL configured as agent_hold_music_url.

Customer Hold Music URLstring

Hold music that should be played to participants that have the role Customer when they’re on hold.

Customer Hold Music Methodstring

HTTP verb that should be used to invoke the URL configured as customer_hold_music_url.

Durationstring

Total duration in seconds of the MPC from start to end. This value is null if the MPC has not ended.billed duration

Billed Durationstring

Duration in seconds for which all participants in the MPC were billed. This value is null if the MPC has not ended.

Billed Amountstring

Amount charged for this call for all participants, in USD. This value is null if the MPC has not ended.

Termination Causestring

The reason for the MPC termination. Refer to this page for a comprehensive list of termination causes and sources.

Termination Cause Codestring

A unique integer code for the termination cause. Refer to this page for a comprehensive list of hangup causes and sources.

Participantsstring

URL pointing to the list of participants associated with this MPC.

Example Object

{
"billed_amount": null,
"billed_duration": null,
"creation_time": "2020-12-24 09:20:03+00:00",
"duration": null,
"end_time": null,
"friendly_name": "test_mpc",
"mpc_uuid": "8742d531-292a-46aa-8754-836be1092885",
"participants": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/name_test_mpc/Participant/",
"recording": "not-recording",
"resource_uri": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/name_test_mpc/",
"start_time": "2020-12-24 09:20:03+00:00",
"status": "Active",
"stay_alone": false,
"sub_account": null,
"termination_cause": null,
"termination_cause_code": null
}

Activate a Multiparty Call

You can trigger this request to activate an MPC initialized with at least one participant.

Note: This API is only used to activate an MPC that is created in initialized state with one or more participants (participants with start_mpc_on_enter set to false). To start a new MPC, use Add a Participant API or MPC XML.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/

Arguments

statusCurrent status of the MPC. Allowed value: Active.

Returns

Returns 404 Not Found if the MPC is not found for the given name or UUID in the initiated state. Else, returns 204 without content.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.start(friendly_name='mpc_name')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.start("friendly_name":"mpc_name")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.multiPartyCalls.start('<mpc_name>').then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->start(["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

public class Start {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
    {
      MultiPartyCall.starter(MultiPartyCallUtils.friendlyName("<mpc_name>")).update();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.Start(friendlyName: "mpc_name")
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X POST \
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.MultiPartyCall.Start(plivo.MultiPartyCallBasicParams{FriendlyName: "MPC_Name"})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("MPC start Success")
}

Was this code helpful

Response

HTTP Status Code: 204

Retrieve a multiparty call

Allows you to retrieve details of a specific multiparty call.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/

Arguments

No arguments need to be passed.

Returns

Returns the details of the specific multiparty call.

Note: You can fetch the details of an MPC using its name only for an ongoing multiparty call. For details of a call that has ended, specify the UUID instead of the name.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.get("6bce28b8-ca38-4998-bd05-25fd8ed0f227")
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.get("friendly_name":"mpc_name")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.multiPartyCalls.get('6bce28b8-ca38-4998-bd05-25fd8ed0f227').then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->get(["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

class GetMPC {

    public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
            MultiPartyCall mpc = MultiPartyCall.getter(MultiPartyCallUtils.mpcUuid("<YOUR-MPC-UUID>")).get();
            System.out.println((mpc.getMpcUuid().equals("<YOUR-MPC-UUID>")));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.Get(mpcUuid: "mpc_uuid");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
    "fmt"

    "github.com/plivo/plivo-go/v7"
)

func main() {
    client, err: = plivo.NewClient("<auth_id>", "<auth_token>", & plivo.ClientOptions {})
    if err != nil {
        panic(err)
    }
    response, err: = client.MultiPartyCall.Get(plivo.MultiPartyCallBasicParams {
        FriendlyName: "MPC_Name"
    })
    if err != nil {
        panic(err)
    }
    fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

{
"api_id": "3c45f7da-45c9-11eb-8575-0242ac11000a",
"billed_amount": null,
"billed_duration": null,
"creation_time": "2020-12-24 09:20:03+00:00",
"duration": null,
"end_time": null,
"friendly_name": "test_mpc",
"mpc_uuid": "8742d531-292a-46aa-8754-836be1092885",
"participants": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/name_test_mpc/Participant/",
"recording": "not-recording",
"resource_uri": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/name_test_mpc/",
"start_time": "2020-12-24 09:20:03+00:00",
"status": "Active",
"stay_alone": false,
"sub_account": null,
"termination_cause": null,
"termination_cause_code": null
}

Retrieve all multiparty calls

Lets you retrieve details of a list of multiparty calls made from an account.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/

Arguments

friendly_name

MPC name provided during the creation of the MPC.

status

The current status of the MPC.

Allowed values: initialized, active, ended

termination_cause_code

A unique integer code for the termination cause.

Possible cause codes are:

  • 1000: No Active Participants

  • 1010: Stay Alone Not Permitted

  • 2000: Max Duration Reached

  • 3000: Hangup API Triggered

end_time optional

Filters MPC by their completion time. The time format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. The filter can be used in these four forms:

  • end_time__gt: gt stands for greater than. To get all calls that ended after 2021-03-21 11:47, use end_time__gt=2021-03-21 11:47

  • end_time__gte: gte stands for greater than or equal to. To get all calls that ended after or exactly at 2021-03-21 11:47[:30], use end_time__gte=2021-03-21 11:47[:30]

  • end_time__lt: lt stands for less than. To get all calls that ended before 2021-03-21 11:47, use end_time__lt=2021-03-21 11:47

  • end_time__lte: lte stands for less than or equal to. To get all calls that ended before or exactly at 2021-03-21 11:47[:30], use end_time__lte=2021-03-21 11:47[:30]

Note: You can combine these filters to get calls that ended in a particular time range.

When no end_time filter is specified, Plivo uses a default search window of the last seven days.

When only end_time__[gt|gte] or end_time__[lt|lte] is specified, Plivo uses a search window of 30 days from/to the specified end_time__[gt|gte] / end_time__[lt|lte].

Timestamps need to be UTC timestamps.

creation_time

Filters MPC by creation time. The time format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. The filter can be used in these four forms:

  • creation_time__gt: gt stands for greater than. To get all calls that created after 2021-03-21 11:47, use creation_time__gt=2021-03-21 11:47

  • creation_time__gte: gte stands for greater than or equal to. To get all calls that created after or exactly at 2021-03-21 11:47[:30], use creation_time__gte=2021-03-21 11:47[:30]

  • creation_time__lt: lt stands for less than. To get all calls that created before 2021-03-21 11:47, use creation_time__lt=2021-03-21 11:47

  • creation_time__lte: lte stands for less than or equal to. To get all calls that created before or exactly at 2021-03-21 11:47[:30], use creation_time__lte=2021-03-21 11:47[:30]

limit

Limits the number of results retrieved. The maximum it can be set to is 20.

Defaults to 20.

offset

Denotes the number of value items by which the results should be offset. For example, if the results contains 1,000 values and limit is set to 10 and offset is set to 705, then values 706 through 715 are displayed in the results. This parameter is also used for pagination of the results.

Returns

Returns the details of a list of multiparty calls.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.list()
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.list()
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.multiPartyCalls.list().then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->getList();
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.base.ListResponse;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;
import com.plivo.api.util.PropertyFilter;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;


class ListMPC {

    public static void main(String [] args) throws IOException, PlivoRestException, PlivoValidationException
    {
        Plivo.init("<auth_id>", "<auth_token>");
        try
        {
          ListResponse<MultiPartyCall> allMPC = MultiPartyCall.lister().list();
          System.out.println(allMPC.getMeta().getCount());
        }
	       catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.List();
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	response, err := client.MultiPartyCall.List(
		plivo.MultiPartyCallListParams{})
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

Response for a successful request

{
  "api_id": "ed93aea0-45cd-11eb-8530-0242ac110006",
  "meta": {
    "count": 2,
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null
  },
  "objects": [
    {
      "billed_amount": "0.05000",
      "billed_duration": 60,
      "creation_time": "2020-12-24 15:23:38+05:30",
      "duration": 2,
      "end_time": "2020-12-24 15:23:40+05:30",
      "friendly_name": "test_mpc_1",
      "mpc_uuid": "4ed623a5-9f3e-45e0-9e7e-3d19a94b3bd3",
      "participants": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/uuid_4ed623a5-9f3e-45e0-9e7e-3d19a94b3bd3/Participant/",
      "recording": null,
      "resource_uri": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/uuid_4ed623a5-9f3e-45e0-9e7e-3d19a94b3bd3/",
      "start_time": "2020-12-24 15:23:38+05:30",
      "status": "Ended",
      "stay_alone": false,
      "sub_account": null,
      "termination_cause": "No Active Participants",
      "termination_cause_code": 1000
    },
    {
      "billed_amount": "0.05000",
      "billed_duration": 60,
      "creation_time": "2020-12-24 14:50:03+05:30",
      "duration": 27,
      "end_time": "2020-12-24 14:50:30+05:30",
      "friendly_name": "test_mpc",
      "mpc_uuid": "8742d531-292a-46aa-8754-836be1092885",
      "participants": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/uuid_8742d531-292a-46aa-8754-836be1092885/Participant/",
      "recording": null,
      "resource_uri": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/uuid_8742d531-292a-46aa-8754-836be1092885/",
      "start_time": "2020-12-24 14:50:03+05:30",
      "status": "Ended",
      "stay_alone": false,
      "sub_account": null,
      "termination_cause": "No Active Participants",
      "termination_cause_code": 1000
    }
  ]
}

End a multiparty call

You can trigger this request to end an ongoing MPC.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{Auth Id}/MultiPartyCall/name_{mpc_name}/


For participant call legs that were added to the MPC using the <MultipartyCall> XML element:

  • If onExitActionUrl is not specified: the participants will be disconnected and the call will proceed to the next element in the XML document.
  • If onExitActionUrl is specified: the participants will be disconnected and the call will proceed to the XML document returned by the onExitActionUrl.

For participant call legs that were added to the MPC using the Add Participant API:

  • If on_exit_action_url is not specified: MPC will be terminated with the hangup cause “Multiparty Call Ended” (hangup cause code 4020) and hangup cause will be API Request.
  • If on_exit_action_url is specified: the participants will be disconnected and the call will proceed to the XML document returned by the on_exit_action_url.

Arguments

No arguments need to be passed.

Returns

Returns an acknowledgement that the MPC has ended.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.stop(uuid='uuid')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.stop("friendly_name":"mpc_name")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.multiPartyCalls.stop('mpc_name').then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->stop(["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

public class StopMPC {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
    {
      MultiPartyCall.stopper(MultiPartyCallUtils.friendlyName("myOngoingMPC1")).delete();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.Stop(friendlyName: "mpc_name")
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X DELETE \
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.MultiPartyCall.Stop(plivo.MultiPartyCallBasicParams{FriendlyName: "MPC_Name"})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("MPC Ended")

}

Was this code helpful

Response

HTTP Status Code: 204

Multiparty call participants

This resource lets you perform actions on the participants of a multiparty call (MPC), such as managing call transfers and member states.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Participant/

The Participants object

Arguments

Member Idstring

ID for this participant.

Multiparty Call UUIDstring

UUID of the parent multiparty call.

Call UUIDstring

UUID of the call resource. Note that there can be more than one participant entry for the same call UUID if that caller entered/exited the MPC more than once.

Rolestring

The participant’s role. Once a participant's role is set, it cannot be updated.

Allowed values: Agent, Customer, Supervisor

Coach Modeboolean

Only applies to participants with the role Supervisor. Always false for other member roles. Controls whether the supervisor is audible to customers.

Join Timetimestamp

Timestamp at which the member joined the MPC.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm

Exit Timetimestamp

Timestamp at which the member left the MPC.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm.

Statusstring

Current status of the MPC. Possible values are:

  • Initialized: The MPC has been initialized.
  • Active: Participants have joined the MPC and the MPC has started.
  • Ended: The MPC has ended.
Durationinteger

Duration in seconds for which the participant was part of the MPC.

Billed Durationinteger

Duration in seconds for which the MPC was billed.

Billed Amountstring

Total amount charged to the customer’s account for the MPC participant.

Mutestring

Indicates whether audio from the participant is muted.

Allowed values: true, false, null

If set to true, audio from this participant will be muted.

Returns null for ended/exited participants.

Holdstring

Indicates whether hold music is played to participants on hold.

Allowed values: true, false, null

If set to true, the participant will be muted and will hear the hold music.

null indicates participant has left the call.

Start MPC On Enterboolean

Indicates whether the MPC should begin when the participant enters the call.

End MPC On Exitboolean

Indicates whether the MPC should end when the participant leaves the call.

Participant Exit Causestring

The reason for this participant’s exit from the MPC.

Possible values are:

  • Participant Call Hangup
  • Kicked Out of Multiparty Call
  • Multiparty Call Ended
  • Participant Call Transferred

This parameter should be null for participants that are still active in an ongoing MPC.

Example object

{
  "billed_amount": null,
  "billed_duration": null,
  "call_uuid": "dd473c48-34a6-4d67-a033-af590b41c23f",
  "coach_mode": false,
  "duration": null,
  "end_mpc_on_exit": false,
  "exit_cause": null,
  "exit_time": null,
  "hold": false,
  "join_time": "2020-12-24 10:01:56+00:00",
  "member_id": "355",
  "mpc_uuid": "4e9ae3f1-a29c-4524-a1b4-4758922e589b",
  "mute": false,
  "resource_uri": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/name_test_mpc_1/Participant/355/",
  "role": "agent",
  "start_mpc_on_enter": true
}

Add a participant to a multiparty call using API

Use the Participant API to add a participant to an ongoing multiparty call (MPC) or to start a new multiparty call and add the participant to it.

API Endpoint

POSThttps://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Participant/

You can add a participant to a multiparty call in two ways:

  1. Using the <MultiPartyCall> element in the Answer URL
  2. Using MultiPartyCall REST API

Note: Plivo initiates a new multiparty call if no ongoing MPC is found in the account (or subaccount) with the given friendly name.

Arguments

from
Required — Conditional
The “from” number to use as the caller ID for this outbound call.
to
Required — Conditional
A single destination or a list of destinations (numbers or endpoints) to call. The first destination to answer (and accept) the call should be added to the MPC. Other destinations should be automatically hung up with the hangup cause LOST RACE.

Note that parallel dialing is supported only when dialing out to Agent role users. The API will return an error if multiple destination numbers are specified and the role is not Agent.

Note that these outbound calls are queued and dequeued as per the calls per second (CPS) configured for your account. You can find more details in the account limits guide.

Multiple “to” numbers must be delimited by “<” — for example, 14156667777<14156667778<sip:john1234@phone.plivo.com.
call_uuid
Required — Conditional
The UUID of the call that should be transferred to the MPC specified in the API request.

If an MPC with a given name does not exist, then Plivo will create a new MPC and add the participant.
role
Required
Allowed values: Agent, Supervisor, Customer
caller_name
string

If set to a string, caller name will be set to this string value.

Allowed values: Any string.
Defaults to Caller's caller_name.
Character limit — 50 characters.

call_status_callback_url
string
Plivo invokes this URL when the call state changes. Only events for newly initiated calls are transmitted.

Events are not generated for existing calls being transferred into this MPC.
call_status_callback_method
string
The HTTP verb that should be used to invoke the URL configured as call_status_callback_url.
 

Allowed values: GET, POST
Defaults to POST.

confirm_key
string

If a value is provided, the call recipient must enter the key specified to be bridged into the MPC.

If the call recipient fails to provide the correct input within 30 seconds, then the call will be disconnected with hangup cause code 9110.

Allowed values: One of 0,1,2,3,4,5,6,7,8,9,#,*

confirm_key_sound_url
string
Remote URL fetched with GET HTTP request that must return an XML document with Play, Wait, and/or Speak elements only (all others are ignored).

The sound indicated by the XML document is played to the called party when the call is answered.

If not provided, then Plivo will play this message on the call: “Please enter {{confirm_key}} to accept the call.”
confirm_key_sound_method
string
HTTP verb that should be used to invoke the URL configured as confirm_key_sound_url.
 

Allowed values: GET, POST
Defaults to GET.

ring_timeout
integer
The number of seconds to wait for the call to be answered, counted from the call initiation time.
 

Allowed values: 15 to 120
Defaults to 45.

delay_dial
integer

The number of seconds to wait before dialing out the ‘to’ destination(s).
Counted from the call initiation time.
For multiple dial destinations in the ‘to’ parameter, a single or multiple delay values can be passed separated by ‘<’.
If a single value is passed then it applies to all destinations
If multiple values are passed, then they will be applied to the destinations in the same order as they appear.
In line with expected parallel dial behavior, if one of the dialed destinations is answered before this delay is over then the corresponding destination(s) should not be dialed at all.

Allowed values: Integer between 0 to 120

Defaults to 0.

max_duration
integer
Sets the maximum duration (in seconds) of the MPC resource. The MPC will end after this period.

Maximum duration is counted from the call initiation time.
 

Allowed values: 300 (five minutes) to 28,800 (eight hours)
Defaults to 14,400 (four hours).

max_participants
integer
The maximum number of participants. Sets the Max Participants property of the MPC resource.
 

Allowed values: 2 to 10
Defaults to 10.

wait_music_url
string
Remote URL fetched with HTTP GET request. The URL must return an XML document with Play, Speak, and/or Wait elements only. All other elements are ignored.

This audio is played in a loop to participants waiting for the MPC to begin.

Defaults to Plivo’s default wait music.

If the URL is not reachable or does not return a valid XML document, no music will be played.
wait_music_method
string
The HTTP verb that should be used to invoke the URL configured as wait_music_url.
 

Allowed values: GET, POST
Defaults to GET.

agent_hold_music_url
string
Remote URL fetched with HTTP GET request. The URL must return an XML document with Play, Speak, and/or Wait elements only. All other elements are ignored.

This audio is played to Agents while they’re on hold. Sets the Agent Hold Music URL property of the MPC resource.

Defaults to Plivo’s default hold music.

If the URL is not reachable or does not return a valid XML document, no music will be played.
agent_hold_music_method
string
The HTTP verb that should be used to invoke the URL configured as agent_hold_music_url.
 

Allowed values: GET, POST
Defaults to GET.

customer_hold_music_url
string
Remote URL fetched with HTTP GET request. The URL must return an XML document with Play, Speak, and/or Wait elements only. All other elements are ignored.

This audio is played to customers while they’re on hold. Sets the Customer Hold Music URL property of the MPC resource.

Default is Plivo’s default hold music.

If the URL is not reachable or does not return a valid XML document, no music will be played.
customer_hold_music_method
string
The HTTP verb that should be used to invoke the URL configured as customer_hold_music_url.
 

Allowed values: GET, POST
Defaults to GET.

record
boolean
Indicates whether the MPC should be recorded. Recording will be initiated the first time a participant joins the MPC with record set to true.

Another participant joining with record set to false will not stop the recording. Note: Supervisor’s voice will be present in the recording regardless of whether coach mode is on or off.

Defaults to false.
record_file_format
string
Specifies the audio format for the recording.
 

Allowed values: mp3, wav
Defaults to mp3.

recording_callback_url
string
The URL to which the MPC recording events are to be posted.
recording_callback_method
string
The HTTP verb that should be used to invoke the URL configured as recording_callback_url.
 

Allowed values: GET, POST
Defaults to POST.

record_min_member_count
string

Starts MPC recording when count is reached. Applies only when `record` is set to true in the MultiPartyCall element.

Allowed values: 1, 2
Defaults to 1.

When set to 1, recording will start as soon as one member has entered the MPC.

When set to 2, recording will start only when two members have joined the MPC. Recording will not start for a single member in MPC even if `record` is set to true in the MultiPartyCall element.

record_participant_track
Boolean

Indicates whether single-track or participant-level recording will be initiated when the participant joins the MPC bridge. The generated recording file will contain only the audio of the specified participant.

Default: false

status_callback_url
string
The URL to which MPC status change events should be sent.
status_callback_method
string
The HTTP verb that should be used to invoke the URL configured as status_callback_url.
 

Allowed values: GET, POST
Defaults to POST.

status_callback_events
string
Controls which of the following events, generated over the course of the multiparty call, should be pushed to the specified status_callback_url:
 
  • MPCInitialized
  • MPCStart
  • MPCEnd
  • ParticipantJoin
  • ParticipantExit
  • ParticipantMute
  • ParticipantUnmute
  • ParticipantHold
  • ParticipantUnhold
  • ParticipantSpeakStart
  • ParticipantSpeakStop
  • ParticipantCoachModeStart
  • ParticipantCoachModeStop
  • ParticipantDigitInput
  • AddParticipantByAPIActionInitiated
  • AddParticipantByAPIActionCompleted

Allowed values: mpc-state-changes, participant-state-changes, participant-digit-input-events, participant-speak-events, add-participant-api-events, participant-audio-events (in any order, with multiple values separated by commas)

Note
  • When mpc-state-changes is included, events for MPCInitialized, MPCStart, and MPCEnd are sent.
  • When participant-state-changes is included, events for ParticipantJoin, ParticipantExit, ParticipantMute,ParticipantUnmute, ParticipantHold, ParticipantUnhold, ParticipantCoachModeStart, ParticipantCoachModeStop are sent.
  • When participant-speak-events is included, events for ParticipantSpeakStart and ParticipantSpeakStop are sent whenever any participant begins or stops speaking.
  • When participant-digit-input-events is included, ParticipantDigitInput events are sent whenever any participant provides a DTMF input.
  • When add-participant-api-events is included, AddParticipantByAPIActionInitiated and AddParticipantByAPIActionCompleted events are sent when an Add Participant By API Action is carried out.
  • When participant-audio-events is included, the following callbacks will be posted to "status_callback_url"

    ParticipantAudioPlayed : When audio starts playing for a participant

    ParticipantAudioStopped : When audio stops playing for a participant

Defaults to mpc-state-changes,participant-state-changes.

stay_alone
boolean
Indicates whether a participant should be removed from the call if they are the only member remaining in the call.
 

Allowed values: true, false
Defaults to false.

coach_mode
boolean
Only applies to participants with the role Supervisor.

Defaults to true (by default, supervisors are in coach mode).
mute
boolean
Indicates whether the participant should join muted or not.
 

Allowed values: true, false
Defaults to false.

hold
boolean
Indicates whether the participant should join on hold or not.
 

Allowed values: true, false
Defaults to false.

start_mpc_on_enter
boolean
Indicates whether the MPC should start, if not already started, when this participant joins.
 

Allowed values: true, false
Defaults to true.

end_mpc_on_exit
boolean
Indicates whether the MPC should be ended when this participant exits the call.
 

Allowed values: true, false
Defaults to false.

enter_sound
string
The sound to play on the bridge when the participant enters the MPC. Note that enter_sound should never be played for supervisors entering when coach mode is set to true.
 

Allowed values: none, beep:1, beep:2, URL that returns an XML document with Play, Speak, and/or Wait elements only
Defaults to beep:1.

enter_sound_method
string
The HTTP verb that should be used to invoke the URL configured as enter_sound.
 

Allowed values: GET, POST
Defaults to GET.

exit_sound
string
The sound to play when the participant exits the MPC.

This sound should be played even if the call is hung up while in MPC.

Note that exit_sound should never be played for supervisors exiting with coach mode set to true.
 

Allowed values: none, beep:1, beep:2, URL that returns an XML document with Play, Speak, and/or Wait elements only
Defaults to beep:2.

exit_sound_method
string
The HTTP verb that should be used to invoke the URL configured as exit_sound.
 

Allowed values: GET, POST
Defaults to GET.

on_exit_action_url
string
Action URL invoked when this participant exits the MPC. If the participant call hangs up while in the MPC or if the call has been transferred to another XML document, then a request to this URL will not be invoked.

If onExitActionUrl is provided, an XML document to control the flow of the call from here on is expected in the response.
on_exit_action_method
string
The HTTP verb that should be used to invoke the URL configured as on_exit_action_url.
 

Allowed values: GET, POST
Defaults to POST.

relay_dtmf_inputs
boolean
Indicates whether DTMF inputs pressed by one of the participants should be transmitted to other participants on the MPC.
 

Allowed values: true, false
Defaults to false.

sip_headers
string
List of SIP headers in the form of key=value pairs, separated by commas.

For example, head1=val1,head2=val2,head3=val3,...,headN=valN.

The SIP headers specified are automatically prefixed with “X-PH-” and these headers will be present for all the HTTP requests that are being made.

Only [A-Z], [a-z], and [0-9] characters are allowed for SIP header key names and values, so that you can URL-encode the values.

Valid values for SIP header keys and values are integers and uppercase and lowercase letters.

Note

For Multiple "to" numbers "sip_headers" must be delimited by "<" — for examplesip_headers=key1=value1<key2=value2<key3=value3.

List of events and parameters sent to the status_callback_url

Refer to status_callback_events for the events that are sent to status_callback_url:

This information is sent to the URL when an event is triggered:

   
DigitInput string A list of digits pressed by the participant.
EventName string Event that triggered this notification. This parameter has values from the events list.
EventTimestamp string Timestamp at which the event occurred.Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
MPCBilledAmount string Amount charged for this call, in USD. This value is null if the MPC has not ended.
MPCBilledDuration string Duration in seconds for which the MPC was billed. This value is null if the MPC has not ended.
MPCCreationTime string Timestamp at which the MPC was created. Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
MPCDuration string Total duration in seconds of the MPC.This value is null if the MPC has not ended.
MPCEndTime string Timestamp at which the MPC ended.Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
MPCName string Friendly name provided during the creation of the MPC.
MPCStartTime string Timestamp at which the MPC was started. Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
MPCTerminationCause string Reason for MPC termination. Refer to our list of termination causes and sources. This value is null if the MPC has not ended.
MPCTerminationCauseCode string A unique integer code for the termination cause. Refer to our list of termination causes and sources. This value is null if the MPC has not ended.
MPCUUID string Unique ID of the multiparty call.
MemberAddress string Phone number or the endpoint username of the participant added to the MPC.
MemberID string Unique identifier of the participant whose event triggered this callback in the MPC.
ParticipantCallDirection string Indicates the direction of the call (inbound or outbound) through which the participant was added to the MPC.
ParticipantCallFrom string Phone number or the endpoint username of the participant that added the respective participant to MPC.
ParticipantCallTo string Phone number or the endpoint username of the participant added to the MPC.
ParticipantCallUUID string Call UUID of the respective participant’s call leg.
ParticipantCoachMode string Indicates whether the Participant is in coach mode. Allowed values: true, false
ParticipantExitCause string Cause of the participant’s termination from the MPC.
ParticipantExitTime string Timestamp at which the participant was terminated from the MPC. Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
ParticipantJoinTime string Timestamp at which the participant was added to the MPC. Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
ParticipantRole string Identifies the role of the participant in the MPC. Can be be one of: Agent, Supervisor, Customer
SequenceNumber string Indicates the sequence of the callback. Helpful to sort the callback events posted to the status_callback_url.
STIRVerification string

For outbound calls: Gives details about the attestation assigned to the call by Plivo.

For inbound calls: Gives details about the attestation received on the inbound call to your Plivo phone number.

Possible values:

  • Verified means the call is from a verified caller who has authorized access to the customer’s caller ID, and hence should be treated with confidence. Verified is equivalent to attestation level A.
  • Not Verified means that, for this call, either the caller is not verified, or it’s uncertain whether they have access to the caller ID used, or both. Not Verified means the call received attestation level B or C.
  • Not Applicable means STIR/SHAKEN doesn’t apply to this call, as would be the case if a call is not addressed to a US number or if it’s a cloud call (WebRTC or SIP).

Read more about STIR/SHAKEN.
   

List of events and parameters sent to the call_status_callback_url

These events are sent to this URL:

  • Initiated
  • Ringing
  • Answered
  • Hangup

This information is sent to the URL when an event is triggered:

   
AnswerTime
string
Timestamp at which the participant entered the MPC. Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
This value is null for Initiated and Ringing events.
BilledDuration
string
Duration in seconds for which the MPC was billed.
This value is null if the participant is still in a live MPC.
CallUUID
string
UUID of the call resource. Note that there can be more than one participant entry for the same call UUID if a participant entered and exited the MPC more than once.
Duration
string
Duration in seconds for which the participant was part of the MPC. This value is null if the participant is still in a live MPC.
EventName
string
Event that triggered this notification. This parameter may have the values Initiated, Ringing, Answered, Hangup.
From
string
The “from” number that’s used as the caller ID to initiate the call to add the participant to the MPC.
HangupTime
string
Timestamp at which the member left the MPC. Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
This value is null if the participant is still in a live MPC.
InitiationTime
string
Timestamp at which the member joined the MPC. Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
MPCUUID
string
Unique ID of the MPC.
PlivoHangupCause
string
Reason for the MPC termination. Refer to our list of hangup causes and sources.

This value is null if the participant is still in a live MPC.
PlivoHangupCauseCode
string
A unique integer code for the termination cause. Refer to our list of hangup causes and sources. This value is null if the participant is still in a live MPC.
PlivoHangupSource
string
Entity that triggered the call hangup. Possible hangup sources are: Caller, Callee, Plivo, API Request, Answer XML, Error, and Unknown. Refer to our list of hangup causes and sources.
Rate
string
Per-minute rate charged based on the destination number.
RingTime
string
Duration in seconds for which the destination was ringing before the call was answered.
To
string
Destination called during the call.
TotalAmount
string
Total amount charged to the customer’s account for the MPC participant. This value is null if the participant is still in a live MPC.

List of events and parameters sent to the recording_callback_url

These events are generated:

  • MPCRecordingInitiated
  • MPCRecordingPaused
  • MPCRecordingResumed
  • MPCRecordingCompleted
  • MPCRecordingFailed

This information is sent to the URL when an event is triggered:

   
EventName
string
Event that triggered this notification. This parameter will have one of the values from the list of events above.
EventTimestamp
string
Timestamp at which the event occurred.
Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
MPCName
string
Friendly name provided during the creation of the MPC.
MPCUUID
string
Unique ID of the MPC.
RecordingDuration
string
Duration of the recording in seconds.
RecordingEndTime
string
Timestamp at which the recording ended.
Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
RecordingFormat
string
Format of the recording.
RecordingResourceURL
string
Resource URL of the recording file. You can use this URL to fetch the recording details later.
RecordingStartTime
string
Timestamp at which the recording started.
Format: YYYY-MM-DD HH:mm:ss+|-hh:mm
RecordingURL
string
Complete path to the recorded file URL.
RecordingUUID
string
Unique identifier to identify the file.
SequenceNumber
string
Indicates the sequence of the callback. Helpful to sort the callback events posted to the recording_callback_url.

Returns

Returns a Participant object.

Example Request

1
2
3
4
5
6
7
8
9
10
11
12
13
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

call_params = {
    'role': "Agent",
    'start_mpc_on_enter': True,
    'from_': "<caller_id>", # Caller ID for the outbound call
    'to_': "<destination_number>", # The destination phone number or endpoint username of the participant to be added
    "enter_sound": "none"
}
response = client.multi_party_calls.add_participant(friendly_name="testmpc", **call_params)
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.add_participant(
    "role":"agent",
    "friendly_name":"my_mpc",
    "from":"<caller_id>",
    "to":"<destination_number>",
    "start_mpc_on_enter":true)
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.multiPartyCalls.addParticipant('Agent', { 'friendlyName': 'testmpc', 'from': '<caller_id>', 'to': '<destination_number>' }).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->addParticipant("agent", ["friendly_name" => "mpc_name", "from" => "<caller_id>", "to" => "<destination_number>"]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.CallCreateResponse;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallParticipantAddResponse;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.TimeUnit;

class AddParticipant {
    public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
            MultiPartyCallParticipantAddResponse resp = MultiPartyCall.addParticipant(MultiPartyCallUtils.friendlyName("myMPC"),
                    MultiPartyCallUtils.customer, "<caller_id>", Collections.singletonList("<destination_number>"))
                .update();

            System.out.println(resp.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.AddParticipant(
                friendlyName: "mpc_name",
                from: "<caller_id>",
                to: "<destination_number>",
                role: "Agent"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"to": "+12025551111","from": "+12025550000", "role": "Agent", "start_mpc_on_enter": true}' \
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Participant/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main

import (
    "fmt"

    "github.com/plivo/plivo-go/v7"
)

func main() {
    client, err: = plivo.NewClient("<auth_id>", "<auth_token>", & plivo.ClientOptions {})
    if err != nil {
        panic(err)
    }
    response, err: = client.MultiPartyCall.AddParticipant(plivo.MultiPartyCallBasicParams {
        FriendlyName: "<mpc_name>"
    }, plivo.MultiPartyCallAddParticipantParams {
        Role: "Agent",
        From: "<caller_id>",
        To: "<destination_number>"
    })
    if err != nil {
        panic(err)
    }
    fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

The API response differs depending on whether this API is initiated to add participants through a new call or a call transfer.

If new call(s): ToNum = toNumber1<toNumber2 FromNum = fromNumber

{
   "api_id":"bfe372c0-b451-11ea-815a-1094bbeb5c2c",
   "calls":[
  {
     "to":"toNumber1",
     "from":"fromNumber",
     "call_uuid":"0b7b4242-8ee8-4872-b447-81b4ce972eae"
  },
  {
     "to":"toNumber2",
     "from":"fromNumber",
     "call_uuid":"67c882e3-833b-4eb8-bdbc-6efcb806938a"
  }
   ],
   "message":"add participant action initiated",
   "request_uuid":"8420cdb1-f1d8-44a4-8c2a-556d156f1ffa"
}

For a single toNumber only one object is inside the calls list.

If existing call being transferred: CallUUID = 0b7b4242-8ee8-4872-b447-81b4ce972eae


{
   "api_id":"bfe372c0-b451-11ea-815a-1094bbeb5c2c",
   "calls":[
  {
     "to":"<to_number_of_given_callUUID>",
     "from": "<from_number_of_given_callUUID>",
     "call_uuid":"67c882e3-833b-4eb8-bdbc-6efcb806938a"
  }
   ],
   "message":"add participant action initiated",
   "request_uuid":"8420cdb1-f1d8-44a4-8c2a-556d156f1ffa"
}

For queued action, the message says “add participant action queued.”

Retrieve participant details

This method retrieves the details of a particular multiparty call (MPC) participant.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Participant/{Member Id}/

Arguments

No arguments need to be passed.

Returns

Returns the details of the specific ongoing MPC participant.

Note: Returns a null value if the MPC has ended or the participant is no longer active in (has exited from) the MPC.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.get_participant(participant_id=member_id, uuid=uuid)
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.get_participant(
    "friendly_name":"mpc_name",
    "member_id":"memberid")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.multiPartyCalls.getParticipant(2132, '7503f05f-2d6e-4ab3-b9e6-3b0d81ae9087', null).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->getParticipant("member_id", ["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

public class GetParticipant {

    public static void main(String[] args) throws PlivoValidationException, IOException, PlivoRestException {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
            MultiPartyCall.participantGetter(MultiPartyCallUtils.mpcUuid("<YOUR-MPC-UUID>"), "member_id").get();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.GetParticipant(
                friendlyName: "mpc_name",
                participantId: "member_id"
                );
                Console.WriteLine(response);
            }

            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \         
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Participant/{Member Id}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
    "fmt"

    "github.com/plivo/plivo-go/v7"
)

func main() {
    client, err: = plivo.NewClient("<auth_id>", "<auth_token>", & plivo.ClientOptions {})
    if err != nil {
        panic(err)
    }
    response, err: = client.MultiPartyCall.GetParticipant(plivo.MultiPartyCallParticipantParams {
        FriendlyName: "MPC_Name",
        ParticipantId: "member_id"
    })
    if err != nil {
        panic(err)
    }
    fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

{
  "api_id": "3eecec6d-45cf-11eb-9014-0242ac110003",
  "billed_amount": null,
  "billed_duration": null,
  "call_uuid": "dd473c48-34a6-4d67-a033-af590b41c23f",
  "coach_mode": false,
  "duration": null,
  "end_mpc_on_exit": false,
  "exit_cause": null,
  "exit_time": null,
  "hold": false,
  "join_time": "2020-12-24 10:01:56+00:00",
  "member_address": "sip:randomEndpoint524139428185758@phone.plivo.com",
  "member_id": "355",
  "mpc_uuid": "4e9ae3f1-a29c-4524-a1b4-4758922e589b",
  "mute": false,
  "resource_uri": "/v1/Account/MAOTE1OWE0MDK0MTLHYW/MultiPartyCall/name_test_mpc_1/Participant/355/",
  "role": "agent",
  "start_mpc_on_enter": true
}

Retrieve all participant details

This method retrieves details of a list of participants in an ongoing multiparty call.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Participant/

Arguments

No arguments need to be passed.

Returns

Returns the details of all the participants in the specified ongoing multiparty call.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.list_participants(friendly_name=mpc_name, uuid=mpc_uuid)
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.list_participants("friendly_name":"mpc_name")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.multiPartyCalls.listParticipants('6bce28b8-ca38-4998-bd05-25fd8ed0f227', null).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->listParticipants(["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.base.ListResponse;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallParticipant;
import com.plivo.api.models.multipartycall.MultiPartyCallParticipantList;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

public class ListParticipants {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");

    try
    {
      MultiPartyCallParticipantList participantList1 = MultiPartyCall.participantList(MultiPartyCallUtils.mpcUuid("myMPCUuid1"));
      ListResponse<MultiPartyCallParticipant> resp1 = participantList1.list();
      System.out.println(resp1);
    }
      catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.ListParticipants(friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Participant/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.MultiPartyCall.ListParticipants(plivo.MultiPartyCallBasicParams{MpcUuid: "mpc_uuid"}, plivo.MultiPartyCallListParticipantParams{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)

}

Was this code helpful

Response

HTTP Status Code: 200

{
  "api_id": "2de9cf75-9606-11eb-8ca5-0242ac110006",
  "meta": {
    "count": 3,
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null
  },
  "objects": [
    {
      "billed_amount": null,
      "billed_duration": null,
      "call_uuid": "58e76e86-54b8-402e-9d83-a16e29b6582c",
      "coach_mode": true,
      "duration": null,
      "end_mpc_on_exit": false,
      "exit_cause": null,
      "exit_time": null,
      "hold": false,
      "join_time": "2021-04-05 11:57:51+00:00",
      "member_address": "sip:randomEndpoint524139428185758@phone.plivo.com",
      "member_id": "229",
      "mpc_uuid": "d5c8be43-87d0-4ba6-90a1-011bb6ab0a00",
      "mute": false,
      "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4QA/MultiPartyCall/name_test_mpc_1/Participant/229/",
      "role": "supervisor",
      "start_mpc_on_enter": true
    },
    {
      "billed_amount": null,
      "billed_duration": null,
      "call_uuid": "9def1955-870f-4052-84ca-02063d24105d",
      "coach_mode": false,
      "duration": null,
      "end_mpc_on_exit": false,
      "exit_cause": null,
      "exit_time": null,
      "hold": false,
      "join_time": "2021-04-05 11:57:32+00:00",
      "member_address": "sip:randomEndpoint524139428185758@phone.plivo.com",
      "member_id": "228",
      "mpc_uuid": "d5c8be43-87d0-4ba6-90a1-011bb6ab0a00",
      "mute": false,
      "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4QA/MultiPartyCall/name_test_mpc_1/Participant/228/",
      "role": "customer",
      "start_mpc_on_enter": true
    },
    {
      "billed_amount": null,
      "billed_duration": null,
      "call_uuid": "b4e8210e-9cd5-4d92-b989-2ff889ee0e1f",
      "coach_mode": false,
      "duration": null,
      "end_mpc_on_exit": false,
      "exit_cause": null,
      "exit_time": null,
      "hold": false,
      "join_time": "2021-04-05 11:56:38+00:00",
      "member_address": "sip:randomEndpoint524139428185758@phone.plivo.com",
      "member_id": "226",
      "mpc_uuid": "d5c8be43-87d0-4ba6-90a1-011bb6ab0a00",
      "mute": false,
      "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4QA/MultiPartyCall/name_test_mpc_1/Participant/226/",
      "role": "agent",
      "start_mpc_on_enter": true
    }
  ]
}

Update participant state

Perform actions on the participants in a multiparty call to mute, unmute, hold, and unhold.

API Endpoint

POSThttps://api.plivo.com/v1/Account/{Auth Id}/MultiPartyCall/name_{mpc_name}/Participant/{all | member_id}/

Arguments

   
mute
boolean
Allowed values: true, false
hold
boolean
Allowed values: true, false
coach_mode
boolean
Allowed values: true, false
If coach_mode is false for a supervisor, then a beep:1 will be played on the multiparty call and the supervisor will become audible to all participants, including the customer.

If coach_mode is updated from false to true for a supervisor, then a beep:1 will be played on the multiparty call and the supervisor will become audible only to agents.

Updating coach_mode is permitted only when invoking the API on a specific participant’s member ID. Triggering the API on all participants returns a 400 Bad Request error response.

Returns

Returns an acknowledgement that the participant’s (member_id) state has been updated in the specific ongoing multiparty call.

Example Request

1
2
3
4
5
6
7
8
9
10
11
12
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.update_participant(
            participant_id = member_id,
            uuid = mpc_uuid,
            coach_mode = True,
            mute = True,
            hold = True
        )
print(response) 

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.update_participant(
    "friendly_name":"mpc_name",
    "member_id":"memberid",
    "mute":true)
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");

    client.multiPartyCalls.updateParticipant(memberId, uuid = mpc_uuid, friendlyName = mpc_name, { 'coachMode': True, 'mute': True, 'hold': False}).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->updateParticipant("member_id", ["friendly_name" => "mpc_name", "mute" => true]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.*;
import com.plivo.api.util.Utils;

import java.io.IOException;

public class UpdateParticipant {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
    {
      MultiPartyCallParticipant participant = MultiPartyCall.participantGetter(MultiPartyCallUtils.friendlyName("myMPC"), "member_id").get();
      participant.kick();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }

  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.UpdateParticipant(participantId: "member_id", friendlyName: "mpc_name")
              Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
 -H "Content-Type: application/json" \
 -d '{"mute": true, "hold": true, "coach_mode": true}' \
 https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Participant/{all |member_id}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	var mutePointer = true
	response, err := client.MultiPartyCall.UpdateParticipant(plivo.MultiPartyCallParticipantParams{}, plivo.MultiPartyCallUpdateParticipantParams{Mute: &mutePointer})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

Success response if all three parameters are passed:

{
  "api_id": "03042285-45d9-11eb-9014-0242ac110003",
  "coach_mode": "MPC: test_mpc_1 coach_mode enable/disable succeeded",
  "hold": "MPC: test_mpc_1 hold/unhold member(s) succeeded",
  "mute": "MPC: test_mpc_1 mute/unmute member(s) succeeded"
}

Kick out a participant

You can trigger this request to disconnect a participant from an ongoing multiparty call.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{Auth Id}/MultiPartyCall/name_{mpc_name}/Participant/{all | member_id}/


**For participant call legs that were added to the multiparty call using the <MultipartyCall> XML element: **

  • If onExitActionUrl is not specified the participants will be disconnected and the call will proceed to the next element in the XML document.
  • If onExitActionUrl is specified the participants will be disconnected and the call will proceed to the XML document returned by the onExitActionUrl.

For participant call legs that were added to the multiparty call using the Add Participant API:

  • If on_exit_action_url is not specified the multiparty call will be terminated with the hangup cause “Multiparty Call Ended” (hangup cause code 4020) and hangup cause will be API Request.
  • If on_exit_action_url is specified the participants will be disconnected and the call will proceed to the XML document returned by the on_exit_action_url.

Arguments

No arguments need to be passed.

Returns

Returns an acknowledgement that the participant was disconnected from the multiparty call.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.start_recording(friendly_name='mpc_name', file_format='wav', status_callback_url='https://plivo.com/status')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.kick_participant(
    "friendly_name":"mpc_name",
    "member_id":"memberid")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client('<auth_id>', '<auth_token>');
    client.multiPartyCalls.kickParticipant(10, {uuid: '12345678-90123456'}).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->kickParticipant("member_id", ["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.*;
import com.plivo.api.util.Utils;

import java.io.IOException;

public class KickParticipant {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
      {
        MultiPartyCallParticipant participant = MultiPartyCall.participantGetter(MultiPartyCallUtils.friendlyName("myMPC"), "member_id").get();
        participant.kick();
      }
    catch (Exception e)
    {
     e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.KickParticipant(participantId: "member_id", friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN  -X DELETE \
https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Participant/{all | member_id}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.MultiPartyCall.KickParticipant(plivo.MultiPartyCallParticipantParams{FriendlyName: "MPC_Name", ParticipantId: "member_id"})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("disconnected a participant successfully.")
}

Was this code helpful

Response

HTTP Status Code: 204

Participant-level recording

Participant call recording endpoints allow users to manage participant-level call recordings. Using this endpoint, users can start, stop, pause, and resume recordings at a participant level.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/{mpc_name/UUID}/Participant/{Member_Id}/Record/

Start participant-level recording

This endpoint lets you start recording for a particular participant.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/{mpc_name/UUID}/Participant/{Member_Id}/Record/

Arguments

file_format

Format of the recording.

  • Allowed values: mp3, wav.
  • Defaults to mp3.
recording_callback_url URL to which status update events for this recording should be posted.
recording_callback_method

HTTP verb used to invoke the URL configured as recording_callback_url.

  • Allowed values: GET, POST.
  • Defaults to POST.
record_track_typestring

Indicates if the recording track is at the participant level or includes all channels.

Possible values: participant / all / both

participant: Initiates single-track or participant-level recording for the provided member_id.

all: Initiates multi-channel recording for the specified participant.

both: Initiates both single-track/participant-level and all-channel recordings.

Default: all

List of events and parameters sent to the recording_callback_url

These events are generated:

  • ParticipantRecordingInitiated
  • ParticipantRecordingPaused
  • ParticipantRecordingResumed
  • ParticipantRecordingCompleted
  • ParticipantRecordingFailed

This information is sent to the URL when an event is triggered:

EventNamestring Event that triggered this notification. This parameter will have one of the values from the list of events above.
EventTimestampstring Timestamp at which the event occurred.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm

MemberIDstring The ID of the participant in the MPC. This ID is unique for each participant.
RecordingDurationstring Duration of recording in seconds.
RecordingEndTimestring Timestamp at which the recording ended.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm

RecordingFormatstring Format of the recording.
RecordingResourceURLstring Resource URL of the recording file. You can use this URL to fetch the recording details later.
RecordingStartTimestring Timestamp at which the recording started.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm

RecordingURLstring Complete path to the recorded file URL.
RecordingUUIDstring Unique identifier to identify the file.
SequenceNumberstring Indicates the sequence of the callback. Helpful to sort the callback events posted to the recording_callback_url.

Returns

If successful, this endpoint returns an acknowledgement that the recording has started, along with a URL to access the recording.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.start_participant_recording(memberid,uuid='uuid',file_format='mp3')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.start_participant_recording(
    "friendly_name":"mpc_name",
    "member_id":"memberid")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var plivo = require('plivo');

(function main() {
  'use strict';

  var client = new plivo.Client("<auth_id>","<auth_token>");
  client.multiPartyCalls.startParticipantRecording("memberid","mpc_uuid"/null,null/"mpc_friendlyName",
     {
        'file_format':'mp3',
     }).then(function(response)
     {
        console.log(response);
     }, function (err)
     {
        console.error(err);
     });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->startParticipantRecording("member_id", ["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallParticipantRecordingStart;
import com.plivo.api.models.multipartycall.MultiPartyCallRecordingStartResponse;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

class MultiPartyCallParticipantRecordingStart {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");

    try
    {
      MultiPartyCallRecordingStartResponse response = MultiPartyCall.participantRecordStarter("name_MPCname","member_id").update();
      System.out.println(response);
    }
    catch (Exception e)
    {
       e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.StartParticipantRecording(participantId: "member_id", friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"file_format": "mp3"}' \                     
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/{mpc_name/UUID}/Participant/{Member_Id}/Record/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.MultiPartyCall.StartParticipantRecording(plivo.MultiPartyCallParticipantParams{FriendlyName: "MPC_Name"}, plivo.MultiPartyCallStartRecordingParams{FileFormat: "", RecordingCallbackUrl: ""})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)

}

Was this code helpful

Response

{
  "api_id": "e05b5263-45dc-11eb-9014-0242ac110003",
  "message": "MPC: test_mpc_1 record started",
  "recording_id": "e06ac332-45dc-11eb-94fe-06dd7f581a50",
  "recording_url": "https://media.plivo.com/v1/Account/MAOTE1OWE0MDK0MTLHYW/Recording/e06ac332-45dc-11eb-94fe-06dd7f581a50.mp3"
}

Stop participant-level recording

This endpoint lets you stop an ongoing participant recording.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/{mpc_name/UUID}/Participant/{Member_Id}/Record/

Arguments

record_track_type string

Indicates if the recording should be stopped for participant-level or all-channel recordings.

Possible values: participant / all / both

participant: Stops single-track/participant-level recording for the provided member_id.

all: Stops multi-channel recording for the specified participant.

both: Stops both single-track/participant-level and all-channel recordings.

Default: all

Returns

Returns an acknowledgement that the recording has been stopped.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.stop_participant_recording(memberid,uuid='uuid')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.stop_participant_recording(
    "friendly_name":"mpc_name",
    "member_id":"memberid")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var plivo = require('plivo');

(function main() {
  'use strict';

  var client = new plivo.Client("<auth_id>","<auth_token>");
  client.multiPartyCalls.stopParticipantRecording("memberid","mpc_uuid"/null,null/"mpc_friendlyName"
     ).then(function(response)
     {
        console.log(response);
     }, function (err)
     {
        console.error(err);
     });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->stopParticipantRecording("member_id", ["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallParticipantRecordingStart;
import com.plivo.api.models.multipartycall.MultiPartyCallRecordingStartResponse;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

class MultiPartyCallParticipantRecordingStop {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");

    try
    {
      MultiPartyCallRecordingStartResponse response = MultiPartyCall.participantRecordStopper("name_MPCname","member_id").update();
      System.out.println(response);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.StopParticipantRecording(participantId: "member_id", friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X DELETE \
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/{mpc_name/UUID}/Participant/{Member_Id}/Record/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.MultiPartyCall.StopParticipantRecording(plivo.MultiPartyCallParticipantParams{FriendlyName: "MPC_Name"}, plivo.MultiPartyCallStartRecordingParams{FileFormat: "", StatusCallbackUrl: ""})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)

}

Was this code helpful

Response

HTTP Status Code: 204

Pause participant-level recording

This endpoint lets you pause on ongoing participant recording. A paused recording can be resumed at a later time.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/{mpc_name/UUID}/Participant/{Member_Id}/Record/Pause/

Arguments

record_track_typestring

Indicates if the recording should be paused for participant-level or all-channel recordings.

Possible values: participant / all / both

participant: Pauses single-track/participant-level recording for the provided member_id.

all: Pauses multi-channel recording for the specified participant.

both: Pauses both single-track/participant-level and all-channel recordings.

Default: all

Returns

If successful, this endpoint returns an acknowledgement that the recording was successfully paused.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.pause_participant_recording(memberid,uuid='uuid')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.pause_participant_recording(
    "friendly_name":"mpc_name",
    "member_id":"memberid")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var plivo = require('plivo');

(function main() {
  'use strict';

  var client = new plivo.Client("<auth_id>","<auth_token>");
  client.multiPartyCalls.pauseParticipantRecording("memberid","mpc_uuid"/null,null/"mpc_friendlyName"
     ).then(function(response)
     {
        console.log(response);
     }, function (err)
     {
        console.error(err);
     });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->pauseParticipantRecording("member_id", ["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallParticipantRecordingStart;
import com.plivo.api.models.multipartycall.MultiPartyCallRecordingStartResponse;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

class MultiPartyCallParticipantRecordingPause {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");

    try
    {
      MultiPartyCallRecordingStartResponse response = MultiPartyCall.participantRecordPause("name_MPCname","member_id").update();
      System.out.println(response);
    }
    catch (Exception e)
    {
       e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.PauseParticipantRecording(participantId: "member_id", friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X POST \  
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/{mpc_name/UUID}/Participant/{Member_Id}/Record/Pause/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.MultiPartyCall.PauseParticipantRecording(plivo.MultiPartyCallParticipantParams{FriendlyName: "MPC_Name", ParticipantId: "member_id"})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Paused Participant Recording Successfully")

}

Was this code helpful

Response

HTTP Status Code: 204

Resume participant-level recording

This endpoint lets you resume a paused participant recording.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/{mpc_name/UUID}/Participant/{Member_Id}/Record/Resume/

Arguments

record_track_typestring

Indicates if the recording should be resumed for participant-level or all-channel recordings.

Possible values: participant / all / both

participant: Resumes single-track/participant-level recording for the provided member_id.

all: Resumes multi-channel recording for the specified participant.

both: Resumes both single-track/participant-level and all-channel recordings.

Returns

If successful, this endpoint returns an acknowledgement that the recording was successfully resumed.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.resume_participant_recording(memberid,uuid='uuid')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.resume_participant_recording(
    "friendly_name":"mpc_name",
    "member_id":"memberid")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var plivo = require('plivo');

(function main() {
  'use strict';

  var client = new plivo.Client("<auth_id>","<auth_token>");
  client.multiPartyCalls.resumeParticipantRecording("memberid","mpc_uuid"/null,null/"mpc_friendlyName"
     ).then(function(response)
     {
        console.log(response);
     }, function (err)
     {
        console.error(err);
     });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->resumeParticipantRecording("member_id", ["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallParticipantRecordingStart;
import com.plivo.api.models.multipartycall.MultiPartyCallRecordingStartResponse;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

class MultiPartyCallParticipantRecordingResume {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");

    try
    {
      MultiPartyCallRecordingStartResponse response = MultiPartyCall.participantRecordResume("name_MPCname","member_id").update();
      System.out.println(response);
    }
    catch (Exception e)
    {
       e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.ResumeParticipantRecording(participantId: "member_id", friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X POST \ 
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/{mpc_name/UUID}/Participant/{Member_Id}/Record/Resume/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.MultiPartyCall.ResumeParticipantRecording(plivo.MultiPartyCallParticipantParams{FriendlyName: "MPC_Name", ParticipantId: "member_id"})
	if err != nil {
		panic(err)
	}
	fmt.Printf("Paused Participant Successfully")
}

Was this code helpful

Response

HTTP Status Code: 204

Play audio on calls

The Play endpoint lets you play an audio file to users in an ongoing call. The common use case for this object is to play automated notifications or music while someone is waiting on a call.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_Id}/MultiPartyCall/{[name|uuid]_[<name|uuid>]}/Member/{member_id}/Play/

Play audio on a MPC call

This endpoint allows you to play an audio file during an active call. Plivo supports .mp3 and .wav audio files.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Play/


The member_id attribute that’s passed in the URL can be a member_id, a comma-separated list of member IDs on which this operation will be performed, or the string all. In the latter case, the play audio action is performed on all members of the MPC.

Arguments

urls Required

URL of the sound file to be played in .mp3 or .wav file.

Returns

Returns an acknowledgement that the audio is played to the MPC.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.start_play_audio(
    "friendly_name":"mpc_name",
    "member_id":"memberid",
    "url":"https://s3.amazonaws.com/plivocloud/music.mp3")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client('<auth_id>', '<auth_token>');
    client.multiPartyCalls.startPlayAudio(memberid,"https://s3.amazonaws.com/plivocloud/music.mp3",{'friendlyName': 'testmpc'}).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>","<auth_token>");
try {
      $response = $client->multiPartyCalls->startPlayAudio
	     (
         "member_id",
         "https://s3.amazonaws.com/plivocloud/music.mp3",
          [
            "friendly_name" => "mpc_name"
          ]
        );
    print_r($response);
    }
catch (PlivoRestException $ex)
 {
   print_r($ex);
 }

print_r($response);
?>

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.*;
import com.plivo.api.util.Utils;

import java.io.IOException;

public class UpdateParticipant {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
    {
      MultiPartyCall.startPlayAudio(MultiPartyCallUtils.friendlyName("mpc_name"),"member_id").url("https://s3.amazonaws.com/plivocloud/music.mp3").update();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }

  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
          var api = new PlivoApi("<auth_id>", "<auth_token>");
            var response = api.MultiPartyCall.StartPlayAudio(
                participantId:"member_id",
                friendlyName: "mpc_name",
                url: "https://s3.amazonaws.com/plivocloud/music.mp3"
             );
            Console.WriteLine(response);
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN -X POST \
 -H "Content-Type: application/json" \
 -d '{"url":"https://s3.amazonaws.com/plivocloud/music.mp3"}' \
 https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Member/{member_id}/Play/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	var mutePointer = true
	response, err := client.MultiPartyCall.StartPlayAudio(plivo.MultiPartyCallParticipantParams{FriendlyName: "mpc_name", ParticipantId: "member_id"}, plivo.MultiPartyCallAudioParams{Url: "https://s3.amazonaws.com/plivocloud/music.mp3"})
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
    "api_id": "e05b5263-45dc-11eb-9014-0242ac110003",
    "message": "play queued into MPC",
    "mpcMemberId": [
        "1"
    ],
    "mpcName": "test_mpc_1"
}

Stop playing audio on a MPC call

This endpoint lets you stop an already playing audio file during an active call.

API Endpoint

DELETE https://api.plivo.com/v1/DELETE/Account/{auth_id}/MultiPartyCall/{[name|uuid]_[<name|uuid>]}/Member/{member_id}/Play/


The member_id attribute that’s passed in the URL can be a member_id, a comma-separated list of member IDs on which this operation will be performed, or the string all. In the latter case, the audio stops playing for all members of the conference.

Note: Use either member_id or all the same way you did to start playing audio to a member. If you initiated the play using member_id, calling the stop API with all will not stop the audio.

Arguments

No arguments need to be passed.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id='<auth_id>', auth_token='<auth_token>')
response = client.multi_party_calls.stop_play_audio('participant_id',
        friendly_name='mpc_name')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.stop_play_audio(
    "friendly_name":"mpc_name",
    "member_id":"memberid")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client('<auth_id>', '<auth_token>');
    client.multiPartyCalls.stopPlayAudio(memberid,{'friendlyName': 'testmpc'}).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>","<auth_token>");
try {
      $response = $client->multiPartyCalls->stopPlayAudio
	     (
         "member_id",
          [
            "friendly_name" => "mpc_name"
          ]
        );
    print_r($response);
    }
catch (PlivoRestException $ex)
 {
   print_r($ex);
 }

print_r($response);
?>

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.*;
import com.plivo.api.util.Utils;

import java.io.IOException;

public class UpdateParticipant {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
    {
      MultiPartyCall.stopPlayAudio(MultiPartyCallUtils.friendlyName("mpc_name"),"member_id").delete();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }

  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
          var api = new PlivoApi("<auth_id>", "<auth_token>");
            var response = api.MultiPartyCall.StopPlayAudio(
                participantId:"member_id",
                friendlyName: "mpc_name"
             );
            Console.WriteLine(response);
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X DELETE \  
https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Member/{member_id}/Play/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	var mutePointer = true
	response, err := client.MultiPartyCall.StopPlayAudio(plivo.MultiPartyCallParticipantParams{FriendlyName: "mpc_name", ParticipantId: "member_id"})
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 204

Multiparty Call Recording

The Multiparty Call Record endpoint allows you to start, pause, resume, and stop recording specific portions of an active Multiparty call.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Record/

Start Recording a Multiparty Call

This endpoint starts recording a Multiparty Call.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Record/

Arguments

file_format

Format of the recording.

  • Allowed values: mp3, wav.
  • Defaults to mp3.
recording_callback_url URL to which status update events for this recording should be posted.
recording_callback_method

HTTP verb used to invoke the URL configured as status_callback_url.

  • Allowed values: GET, POST.
  • Defaults to POST.
Note: A Supervisor’s voice will be recorded regardless of the coach_mode setting.

List of events and parameters sent to the recording_callback_url

These events are generated:

  • MPCRecordingInitiated
  • MPCRecordingPaused
  • MPCRecordingResumed
  • MPCRecordingCompleted
  • MPCRecordingFailed

This information is sent to the URL when an event is triggered:

EventNamestring Event that triggered this notification. This parameter will have one of the values from the list of events above.
EventTimestampstring Timestamp at which the event occurred.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm

MPCNamestring Friendly name provided during the creation of the MPC.
MPCUUIDstring Unique ID of the Multiparty call.
RecordingDurationstring Duration of recording in seconds.
RecordingEndTimestring Timestamp at which the recording ended.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm

RecordingFormatstring Format of the recording.
RecordingResourceURLstring Resource URL of the recording file. You can use this URL to fetch the recording details later.
RecordingStartTimestring Timestamp at which the recording started.

Format: YYYY-MM-DD HH:mm:ss+|-hh:mm

RecordingURLstring Complete path to the recorded file URL.
RecordingUUIDstring Unique identifier to identify the file.
SequenceNumberstring Indicates the sequence of the callback. Helpful to sort the callback events posted to the recording_callback_url.

Returns

If successful, this endpoint returns an acknowledgement that the recording has started, along with a URL to access the recording.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.start_recording(friendly_name='mpc_name', file_format='wav', recording_callback_url='https://plivo.com/status')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.start_recording("friendly_name":"mpc_name")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.multiPartyCalls.startRecording(
        {
            'file_format':'wav',
            'recordingCallbackUrl':'https://plivo.com/status'
            
        }, 
        'mpc_name').then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->startRecording(["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallRecordingStart;
import com.plivo.api.models.multipartycall.MultiPartyCallRecordingStartResponse;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

public class StartMPCRecording {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try{
      MultiPartyCallRecordingStart recordingStart1 = MultiPartyCall.recordStarter(MultiPartyCallUtils.friendlyName("myMPC1"));
      MultiPartyCallRecordingStartResponse resp1 = recordingStart1.fileFormat("wav").recordingCallbackUrl("https://<yourdomain.com>/status/recording/").update();
      System.out.println(resp1.getRecordingUrl());
      System.out.println(resp1.getRecordingId());
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.StartRecording(friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"file_format": "mp3"}' \                     
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Record/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.MultiPartyCall.StartRecording(plivo.MultiPartyCallBasicParams{FriendlyName: "MPC_Name"}, plivo.MultiPartyCallStartRecordingParams{FileFormat: "", RecordingCallbackUrl: ""})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)

}

Was this code helpful

Response

{
  "api_id": "e05b5263-45dc-11eb-9014-0242ac110003",
  "message": "MPC: test_mpc_1 record started",
  "recording_id": "e06ac332-45dc-11eb-94fe-06dd7f581a50",
  "recording_url": "https://media.plivo.com/v1/Account/MAOTE1OWE0MDK0MTLHYW/Recording/e06ac332-45dc-11eb-94fe-06dd7f581a50.mp3"
}

Stop Recording a Multiparty Call

This endpoint stops recording a Multiparty Call.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Record/

Arguments

No arguments need to be passed.

Returns

Returns an acknowledgement that the recording has been stopped.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.stop_recording(friendly_name='mpc_name')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.stop_recording("friendly_name":"mpc_name")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.multiPartyCalls.stopRecording('mpc_name').then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->stopRecording(["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

public class StopMPCRecording {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
    {
      MultiPartyCall.recordStopper(MultiPartyCallUtils.friendlyName("myRecordingMPC1")).delete();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.StopRecording(friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X DELETE \
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Record/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.MultiPartyCall.StopRecording(plivo.MultiPartyCallBasicParams{FriendlyName: "MPC_Name"})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("MPC recording stopped")

}

Was this code helpful

Response

HTTP Status Code: 204

Pause Recording a Multiparty Call

This endpoint pauses ongoing recording of a Multiparty Call.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Record/Pause/

Arguments

No arguments need to be passed.

Returns

If successful, this endpoint returns an acknowledgement that the recording was successfully paused.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.pause_recording(friendly_name='mpc_name')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.pause_recording("friendly_name":"mpc_name")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.multiPartyCalls.pauseRecording('mpc_name').then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->pauseRecording(["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

public class PauseMPCRecording {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
    {
      MultiPartyCall.recordPause(MultiPartyCallUtils.friendlyName("myRecordingMPC1")).update();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.PauseRecording(friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X POST \  
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Record/Pause/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.MultiPartyCall.PauseRecording(plivo.MultiPartyCallBasicParams{FriendlyName: "MPC_Name"})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Paused MPC recording Successfully")

}

Was this code helpful

Response

HTTP Status Code: 204

Resume Recording a Multiparty Call

This endpoint resumes recording an ongoing Multiparty Call.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Record/Resume/

Arguments

No arguments need to be passed.

Returns

If successful, this endpoint returns an acknowledgement that the recording was successfully resumed.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

response = client.multi_party_calls.resume_recording(friendly_name='mpc_name')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.resume_recording("friendly_name":"mpc_name")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.multiPartyCalls.resumeRecording('mpc_name').then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>", "<auth_token>");
try
{
    $response = $client
        ->multiPartyCalls
        ->resumeRecording(["friendly_name" => "mpc_name", ]);
    print_r($response);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.MultiPartyCall;
import com.plivo.api.models.multipartycall.MultiPartyCallUtils;

import java.io.IOException;

public class ResumeMPCRecording {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
    {
      MultiPartyCall.recordResume(MultiPartyCallUtils.friendlyName("myPausedRecordingMPC1")).update();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>", "<auth_token>");

            try
            {
                var response = api.MultiPartyCall.ResumeRecording(friendlyName: "mpc_name");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X POST \ 
    https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Record/Resume/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.MultiPartyCall.ResumeRecording(plivo.MultiPartyCallBasicParams{FriendlyName: "MPC_Name"})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Resumed MPC recording Successfully")

}

Was this code helpful

Response

HTTP Status Code: 204

Conference

Conferences let you involve multiple participants in a single call. Using Plivo’s Conference API, you can manage ongoing and completed conferences in your account, terminate ongoing conferences, and retrieve details of an ongoing or completed conference.

Conferences are suited for traditional “meeting” use cases. If you need more control over a call, for example for advanced contact center or sales dialer use cases, consider multiparty calls.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Conference/

The Conference object

Attributes

conference_name string

The name used to identify the conference.

conference_run_time string

Time in seconds since the conference was initiated.

conference_member_count string

Number of members currently active in the conference.

Note: Along with the above attributes, the response includes the following attributes for each member active in the conference.
member_id string

The ID of the member in the conference. This ID is unique for each conference.

muted boolean

Set to true if the member is currently muted.

deaf boolean

Set to true if the member cannot hear the conversations taking place in the conference.

from string

The source from which the call was made to the conference. This can either be a PSTN number or a SIP endpoint.

to string

The conference bridge number. This can either be a Plivo number or an application URL.

caller_name string

The name of the caller, if the call was made from a SIP endpoint. This field is empty if no caller name is specified while making the call.

direction string

The direction of the call. This can either be inbound or outbound.

call_uuid string

The call_uuid that uniquely identifies the call.

join_time string

The time in seconds since the call joined the conference.

Response

{
  "conference_name": "My Conf Room",
  "conference_run_time": "590",
  "conference_member_count": "1",
  "members": [
{
  "muted" : false,
  "member_id" : "17",
  "deaf" : false,
  "from" : "1456789903",
  "to" : "1677889900",
  "caller_name" : "John",
  "direction" : "inbound",
  "call_uuid" : "acfbf0b5-12e0-4d74-85f7-fce15f8f07ec",
  "join_time" : "590"
}
  ]
}

Retrieve a conference

Retrieves the details of a particular conference.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/

Arguments

No arguments need to be passed.

Returns

Returns the details of the conference associated with the name specified.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.get(
    conference_name='testing', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Conference Get
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.get(
    'My Conf Room'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Conference get

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.get(
        "My Conf Room", // conference name
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Conference get
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->conferences->get(
        'My Conf Room'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.conference;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;
import com.plivo.api.models.conference.Conference;

/**
* Example for Conference get
*/
class ConferenceGet {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Conference response = Conference.getter("My Conf Room")
                .get();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Conference Get
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.Get(
                    conferenceName:"My Conf Room"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for Conference get
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.Get(
		"My Conf Room",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

{
  "conference_name": "My Conf Room",
  "conference_run_time": "590",
  "conference_member_count": "1",
  "members": [
	{
	  "muted" : false,
	  "member_id" : "17",
	  "deaf" : false,
	  "from" : "1456789903",
	  "to" : "1677889900",
	  "caller_name" : "John",
	  "direction" : "inbound",
	  "call_uuid" : "acfbf0b5-12e0-4d74-85f7-fce15f8f07ec",
	  "join_time" : "590"
	}
  ],
  "api_id": "816e903e-58c4-11e1-86da-adf28403fe48"
}

Hang up a specific conference

This method lets you hang up a conference using the conference name.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/

Arguments

No arguments need to be passed.

Response

HTTP Status Code: 204

{
  "message": "conference hung up",
  "api_id": "2867b6e2-58c3-11e1-86da-adf28403fe48"
}

List all conferences

Retrieves a list of all ongoing conferences for your account and returns their names.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Conference/

Arguments

No arguments need to be passed.

Returns

Returns the names of all ongoing conferences associated with the account.

Example Request

1
2
3
4
5
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.list()
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#
# Example for Conference Get
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.list()
  
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Example for Conference get

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.list(
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
/**
 * Example for Conference get
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->conferences->list(
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.conference;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;
import com.plivo.api.models.conference.ConferenceList;

/**
* Example for Conference get
*/
class ConferenceListGet {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            ConferenceList response = Conference.listGetter()
                .get();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * Example for Conference Get
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.List(
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Example for Conference get
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.IDList()
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 200

{
  "api_id": "2867b6e2-58c3-11e1-86da-adf28403fe48",
  "conferences": [
    "My Conf Room"
  ]
}

Hang up all conferences

This API lets you hang up all ongoing conferences running on your account.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Conference/

Arguments

No arguments need to be passed.

Example Request

1
2
3
4
5
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.delete_all()
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#
# Example for Conference Delete All
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.delete_all()
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Example for Conference delete

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.hangupAll(
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
/**
 * Example for Conference delete all
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    $response = $client->conferences->deleteAll();
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.conference;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;

/**
 * Example for Conference delete all
 */
class ConferenceDeleteAll {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Conference.allDeleter()
                    .delete();

            System.out.println("Deleted successfully.");
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Example for Conference Delete
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.DeleteAll();
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Example for Conference delete
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.Conferences.DeleteAll()
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Println("Deleted successfully.")
}

Was this code helpful

Response

HTTP Status Code: 204

Conference member

This resource lets you perform actions on members of a conference.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member

Hang up a member

This method lets you hang up a particular member of a conference. The member to be disconnected needs to be identified using the member_id.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/


The member_id attribute that’s passed in the URL can be either a member_id or the string all. In the latter case, the hangup action is performed on all members of the conference.

Arguments

No arguments need to be passed.

Response

HTTP Status Code: 204

Disconnect a member from a conference

This method lets you disconnect a member in a conference. When the member is disconnected, the next action to be performed depends on the next element in the XML.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Kick/


Here’s an example. If the XML code below starts the conference, Plivo will play the text in the <Speak> tag after the member is disconnected.

<Response>
    <Conference enterSound="beep:1">MyConference</Conference>
    <Speak>You have been disconnected from the conference</Speak>
</Response>

The member_id attribute that’s passed in the URL can be either a member_id or the string all. In the latter case, the disconnect action is performed on all members of the conference.

Attributes

No arguments need to be passed.

Returns

Returns an acknowledgement that the member has been disconnected from the conference.

Response

HTTP Status Code: 202

{
  "message": "kicked",
  "member_id": "10",
  "api_id": "2867b6e2-58c3-11e1-86da-adf28403fe48"
}

Mute Member

This API lets you mute members of a conference. Audio from their device will be muted, and other members in the conference will not be able to hear the caller.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Mute/


The member_id attribute that’s passed in the URL can be a member_id, a comma-separated list of member IDs on which this operation will be performed, or the string all. In the latter case, the mute action is performed on all members of the conference.

No arguments need to be passed.

Returns

Returns an acknowledgement that the member is muted.

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.member_mute(
    conference_name='testing',
    member_id=29283, )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Conference Member Mute Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.mute_member(
    'My Conf Room',
    [10]
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example for Conference Member Mute create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.muteMember(
        "My Conf Room", // conference name
        10, // member id
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>","<auth_token>");
try {
    $response = $client->conferences->muteMember(
        'My Conf Room',
        [10,11,14]
    );
}
catch (PlivoRestException $ex)
 {
   print_r($ex);
 }

print_r($response);
?>

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.conference.member.mute;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;
import com.plivo.api.models.conference.ConferenceMemberActionResponse;

/**
* Example for Conference Member Mute create
*/
class MuteCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            ConferenceMemberActionResponse response = Conference.memberMuter("My Conf Room", "10")
                .mute();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Example for Conference Member Mute Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.MuteMember(
                    memberId:new List<string>(){"28720"},
                    conferenceName:"testing"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{}' \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Mute/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Example for Conference Member Mute create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.MemberMute(
		"My Conf Room",
		"10",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
  "message": "muted",
  "member_id": "10",
  "api_id": "2867b6e2-58c3-11e1-86da-adf28403fe48"
}

Unmute Member

This API lets you unmute members that have been muted by the Mute Member API.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Mute/


The member_id attribute that’s passed in the URL can be a member_id, a comma-separated list of member IDs on which this operation will be performed, or the string all. In the latter case, the unmute action is performed on all members of the conference.

Attributes

No arguments need to be passed.

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.member_mute_stop(
    conference_name='testing',
    member_id=29283, )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Conference Member Mute Delete
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.unmute_member(
    'My Conf Room',
    [10]
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example for Conference Member Mute delete

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.unmuteMember(
        "My Conf Room", // conference name
        10, // member id
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
 * Example for Conference Member Mute delete
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->conferences->unMuteMember(
        'My Conf Room',
        [10,11,14]
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.conference.member.mute;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;

/**
* Example for Conference Member Mute delete
*/
class MuteDelete {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Conference.memberMuteStopper("My Conf Room", "10")
                .stop();

            System.out.println("Deleted successfully.");
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Conference Member Mute Delete
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                api.Conference.UnmuteMember(
                    memberId:new List<string>(){"29568"},
                    conferenceName:"testing"
                );
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Mute/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Example for Conference Member Mute delete
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.MemberUnmute(
		"My Conf Room",
		"10",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 204

Deaf a conference member

This method allows you to deaf a particular member in the conference. When this operation is made on a conference member, the member will not be able to hear any audio from the conference.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Deaf/


The member_id attribute which is passed in the URL can be one of the following three forms:

  1. Member ID: The member specified by the member_id.

  2. Comma separated list of member IDs: List of member IDs on which this operation will be performed.

  3. ‘all’: The string ‘all’, this action will be performed on all members of the conference.

Attributes

No arguments need to be passed.

Returns

Returns an acknowledgement that the members specified would not be able to hear any audio from the conference

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.member_deaf(
    conference_name='testing',
    member_id=27697, )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Conference Member Deaf Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.deaf_member(
    'My Conf Room',
    [10]
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example for Conference Member Deaf create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.deafMember(
        "My Conf Room", // conference name
        10, // member id
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/**
 * Example for Conference Member Deaf create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->conferences->makeDeaf(
        'My Conf Room',
        [
        	10, 11, 14
        ]
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.conference.member.deaf;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;
import com.plivo.api.models.conference.ConferenceMemberActionResponse;

/**
* Example for Conference Member Deaf create
*/
class DeafCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            ConferenceMemberActionResponse response = Conference.memberDeafer("My Conf Room", "10")
                .deaf();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Example for Conference Member Deaf Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.DeafMember(
                    memberId: new List<string>(){"28720"},
                    conferenceName:"testing"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{}' \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Deaf/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Example for Conference Member Deaf create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.MemberDeaf(
		"My Conf Room",
		"10",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
  "message": "deaf",
  "member_id": "10",
  "api_id": "2867b6e2-58c3-11e1-86da-adf28403fe48"
}

Undeaf a conference member

This method lets you un-deaf a member in a conference. When this operation is performed on a conference member it will reverse the effects of the Deaf a conference member API

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Deaf/


The member_id attribute which is passed in the URL can be one of the following three forms:

  1. Member ID: The member specified by the member_id.

  2. Comma separated list of member IDs: List of member IDs on which this operation will be performed.

  3. ‘all’: The string ‘all’, this action will be performed on all members of the conference.

Attributes

No arguments need to be passed.

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.member_deaf_stop(
    conference_name='testing',
    member_id=27697, )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Conference Member Deaf Delete
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.undeaf_member(
    'My Conf Room',
    [10]
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example for Conference Member Deaf delete

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.undeafMember(
        "My Conf Room", // conference name
        10, // member id
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
 * Example for Conference Member Deaf delete
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->conferences->enableHearing(
        'My Conf Room',
        [10]
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.conference.member.deaf;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;

/**
* Example for Conference Member Deaf delete
*/
class DeafDelete {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Conference.memberDeafStopper("My Conf Room", "10")
                .stop();

            System.out.println("Deleted successfully.");
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Example for Conference Member Deaf Delete
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.UnDeafMember(
                    memberId:new List<string>(){"28720"},
                    conferenceName:"testing",
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Deaf/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Example for Conference Member Deaf delete
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.MemberUndeaf(
		"My Conf Room",
		"10",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 204

Play audio to a member

This API lets you play a .mp3 or .wav file to a member in the conference.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Play/

The member_id attribute that’s passed in the URL can be a member_id, a comma-separated list of member IDs on which this operation will be performed, or the string all. In the latter case, the play audio action is performed on all members of the conference.

Attributes

url Required

URL of the sound file to be played.

Returns

Returns an acknowledgement that the audio is played to the conference.

Example Request

1
2
3
4
5
6
7
8
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.member_play(
    conference_name='testing',
    member_id=28485,
    url='https://s3.amazonaws.com/plivocloud/music.mp3')
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Example for Conference Member Play Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.play_member(
    'My Conf Room',
    [10],
    'https://s3.amazonaws.com/plivocloud/Trumpet.mp3'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Example for Conference Member Play create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.playAudioToMember(
        "My Conf Room", // conference name
        10, // member id
        "https://s3.amazonaws.com/plivocloud/Trumpet.mp3", // url
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
/**
 * Example for Conference Member Play create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->conferences->startPlaying(
        'My Conf Room',
        [10,11],
        'https://s3.amazonaws.com/plivocloud/Trumpet.mp3'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.conference.member.play;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;
import com.plivo.api.models.conference.ConferenceMemberActionResponse;

/**
* Example for Conference Member Play create
*/
class PlayCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            ConferenceMemberActionResponse response = Conference.memberPlayer("My Conf Room", "10", "https://s3.amazonaws.com/plivocloud/Trumpet.mp3")
                .create();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * Example for Conference Member Play Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.PlayMember(
                    url:"https://s3.amazonaws.com/plivocloud/Trumpet.mp3",
                    memberId:new List<string>(){"10","11"},
                    conferenceName:"My Conf Room"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"url":"https://s3.amazonaws.com/plivocloud/Trumpet.mp3"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Play/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Example for Conference Member Play create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.MemberPlay(
		"My Conf Room",
		"10",
		"https://s3.amazonaws.com/plivocloud/Trumpet.mp3",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
  "message" : "play queued into conference",
  "api_id" : "4e44bd4e-f830-11e6-b886-067c5485c240",
  "member_id" : "[u'160005', u'160004', u'160003', u'160002']"
}

Stop playing audio to a member

This API stops the file that’s being played to a member after it was initiated by the Play API.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Play/


The member_id attribute that’s passed in the URL can be a member_id, a comma-separated list of member IDs on which this operation will be performed, or the string all. In the latter case, the audio stops playing for all members of the conference.

Note: Use either member_id or all the same way you did to start playing audio to a member. If you initiated the play using member_id, calling the stop API with all will not stop the audio.

Attributes

No arguments need to be passed.

Response

HTTP Status Code: 204

{
  "message": "playing in conference stopped",
  "member_id": "10",
  "api_id": "2867b6e2-58c3-11e1-86da-adf28403fe48"
}

Speak text to a member

This API plays spoken text to a member in a conference.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Speak/


The member_id attribute that’s passed in the URL can be a member_id, a comma-separated list of member IDs on which this operation will be performed, or the string all. In the latter case, the speak text action is performed for all members of the conference.

Arguments

text Required

The text that should be spoken to the members in the conference.

voice string

The voice to be used.

Allowed values: MAN, WOMAN
Defaults to WOMAN.

language string

The language that needs to be used to speak the text. The default language is US English (en-US). See the list of supported languages below.

List of supported languages

Danish da-DK

Only WOMAN voice

Dutch nl-NL

Both WOMAN and MAN voices

English — Australian en-AU

Both WOMAN and MAN voices

English — British en-GB

Both WOMAN and MAN voices

English — USA en-US

Both WOMAN and MAN voices

French fr-FR

Both WOMAN and MAN voices

French — Canadian fr-CA

Only WOMAN voice

German de-DE

Both WOMAN and MAN voices

Italian it-IT

Both WOMAN and MAN voices

Polish pl-PL

Both WOMAN and MAN voices

Portuguese pt-PT

Only MAN voice

Portuguese — Brazilian pt-BR

Both WOMAN and MAN voices

Russian ru-RU

Only WOMAN voice

Spanish es-ES

Both WOMAN and MAN voices

Spanish — USA es-US

Both WOMAN and MAN voices

Swedish sv-SE

Only WOMAN voice

Returns

Returns an acknowledgement that the text will be played to the members specified in the conference.

Example Request

1
2
3
4
5
6
7
8
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.member_speak(
    conference_name='testing',
    member_id=27800,
    text='Hello World!', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#
# Example for Conference Member Speak Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.speak_member(
    'My Conf Room',
    [10],
    'Hello World!',
    voice: 'MAN'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Example for Conference Member Speak create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.speakTextToMember(
        "My Conf Room", // conference name
        10, // member id
        "Hello World!", // text
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
/**
 * Example for Conference Member Speak create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->conferences->startSpeaking(
        'My Conf Room',
        [10,11],
        'TEXT_TO_SPEAK'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.conference.member.speak;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;
import com.plivo.api.models.conference.ConferenceMemberActionResponse;

/**
* Example for Conference Member Speak create
*/
class SpeakCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            ConferenceMemberActionResponse response = Conference.memberSpeaker("My Conf Room", "10", "Hello World!")
                .speak();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * Example for Conference Member Speak Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.SpeakMember(
                    memberId:new List<string>(){"10","11"},
                    text:"Hello World!",
                    conferenceName:"My Conf Room"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"text":"Hey, How are you?"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Speak/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Example for Conference Member Speak create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.MemberSpeak(
		"My Conf Room",
		"10",
		plivo.ConferenceMemberSpeakParams{
			Text: "Hello World!",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
  "message" : "speak queued into conference",
  "api_id" : "8dd6820e-fe83-11e6-b6f4-061564b78b75",
  "member_id" : "[u'all']"
}

Stop speaking text to a member

This API stops spoken text from being spoken to a member after it was initiated by the Speak API.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Speak/

The member_id attribute that’s passed in the URL can be a member_id, a comma-separated list of member IDs on which this operation will be performed, or the string all. In the latter case, the text will no longer be spoken for all members of the conference.

Note: Use either member_id or all the same way you did to start speaking text. If you initiated the play using member_id, calling the stop API with all will not stop the text from being spoken.

Attributes

No arguments need to be passed.

Returns

Returns an acknowledgement that speaking the text file is stopped for the members specified.

Response

HTTP Status Code: 204

{
  "message": "speak stopped",
  "member_id": "10",
  "api_id": "2867b6e2-58c3-11e1-86da-adf28403fe48"
}

Record a conference

The conference record method lets you start and stop recording a conference.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Record/

Start recording a conference

This API lets you start recording an ongoing conference after the conference is initiated. Alternatively, you can record a conference by using the recording capabilities of the Conference XML element.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Record/

Attributes

file_format

The file format for the recording.

Allowed values: mp3, wav.
Defaults to mp3.

transcription_type

auto: Transcription is automated; the turnaround time is under 5 minutes which linearly increases with call duration.

Transcription charges and details are available on our pricing page.

Note:

Transcription service is available only in English, and limited to calls with a duration greater than 500 milliseconds and less than 4 hours, with a recording file size smaller than 2GB.

transcription_url Callback-retry configurable

The URL to which the transcription should be posted.

Note:

The transcription information will be sent to this URL via an HTTP POST callback.

callback_url Callback-retry configurable

The URL invoked when the recording ends. The parameters to be posted to the URL are documented in the table below.

callback_method

The HTTP verb used to invoke the callback_url.

Defaults to POST.

List of parameters sent to the callback URL

These details are posted when the callback URL is invoked after the recording ends.

api_id

The API ID that was returned by the conference record API.

record_url

The URL where the recorded file can be accessed.

recording_id

The recording ID associated with the recording file.

conference_name

The name of the conference recorded.

recording_duration

The recording duration in seconds.

recording_duration_ms

The recording duration in milliseconds.

recording_start_ms

The start time of the recording since epoch in milliseconds.

recording_end_ms

The end time of the recording since epoch in milliseconds.

List of parameters sent to the transcription URL

transcription_charge

The credit deducted for the transcription.

transcription

The transcribed text of the recording.

duration

The duration in seconds of the recording.

call_uuid

The call UUID of the call that was transcribed.

transcription_rate

The rate of the transcription per minute.

recording_id

Recording ID of the transcribed recording.

errorMay be Recording duration too long for transcription or Recording file size too large for transcription. Empty if transcription is successful.
Note: .mp3 files are smaller in size than .wav files. Consider changing the recording file format to .mp3 if you see this error.

Returns

If successful, returns an acknowledgement that conference recording has started along with a URL to access the recording.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.record(
    conference_name='testing', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Conference Record Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.record(
    'my conf'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Conference Record create

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.record(
        "My Conf Room", // conference name
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
/**
 * Example for Conference record create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    $response = $client->conferences->startRecording(
        'My conference'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.plivo.api.samples.conference.record;

import java.io.IOException;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;
import com.plivo.api.models.conference.ConferenceRecordCreateResponse;

/**
 * Example for Conference Record create
 */
class RecordCreate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            ConferenceRecordCreateResponse response = Conference.recorder("My Conf Room")
                    .record();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Record Create
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.StartRecording(
                    "conf name"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"file_format":"mp3"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Record/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Example for Conference Record create
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.Record(
		"My Conf Room",
		plivo.ConferenceRecordParams{},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

HTTP Status Code: 202

{
"api_id": "2867b6e2-58c3-11e1-86da-adf28403fe48",
"message": "conference recording started",
"recording_id": "93bc7c6a-3b2b-11e3",
"url": "https://media.plivo.com/v1/Account/<Auth_ID>/Recording/93bc7c6a-3b2b-11e3.mp3",
}

Stop recording a conference

If the recording was initiated by the Record API method, you can use this method to stop recording the conference. This can be useful when, for example, you don’t want to record parts of a conference during which critical details are being discussed.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Record/

Attributes

No arguments need to be passed.

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.conferences.record_stop(
    conference_name='testing', )
print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Conference Record Delete
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.conferences.stop_record(
    'my conf'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Conference Record delete

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.conferences.stopRecording(
        "My Conf Room", // conference name
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
/**
 * Example for Conference record delete
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    $response = $client->conferences->stopRecording(
        'My conference'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.plivo.api.samples.conference.record;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;

/**
 * Example for Conference Record delete
 */
class RecordDelete {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Conference.recordStopper("My Conf Room")
                    .stop();

            System.out.println("Deleted successfully.");
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Endpoint Delete
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Conference.StopRecording(
                    "conf name"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Record/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for Conference Record delete
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.Conferences.RecordStop(
		"My Conf Room",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Println("Deleted successfully.")
}

Was this code helpful

Response

HTTP Status Code: 204

Audio Stream

Plivo’s audio streaming resource lets you receive raw audio input over WebSocket (wss or ws) URLs from live phone calls in near real time.

API Endpoint

POSThttps://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/

Response

{
    "api_id": "f7615566-13c5-11ee-b552-0242ac110005",
    "audio_track": "both",
    "bidirectional": false,
    "bill_duration": 27,
    "billed_amount": "0.00300",
    "call_uuid": "78737f83-4660-490d-98e1-025dfe4b5c8f",
    "created_at": "2023-06-21 13:23:44.136962+00:00",
    "end_time": "2023-06-21 18:53:43+05:30",
    "plivo_auth_id": "MAY2RJNZKZNJMWOXXX",
    "resource_uri": "/v1/Account/MAY2RJNZKZNJMWOXXX/Call/78737f83-4660-490d-98e1-025dfe4b5c8f/Stream/20170ada-f610-433b-8758-c02a2aab3662/",
    "rounded_bill_duration": 60,
    "service_url": "wss://socketsbay.com/wss/v2/1/demo/",
    "start_time": "2023-06-21 18:53:16+05:30",
    "stream_id": "20170ada-f610-433b-8758-c02a2aab3662"
}

The audio Stream object

The audio Steam object lets you receive the raw audio of a live phone call over a configured WebSocket in near real time.

Attributes

Service_urlstringrequired

WebSocket URL to which the audio stream is to be initiated.

Example: wss://mystream.ngrok.io/audiostream

If a qualified URL is not present, or an active stream is already supplied to the URL, a 400 error is returned.

bidirectionalboolean

Specifies whether the audio being streamed over the WebSocket is bidirectional (the service can both read and write audio over the WebSocket) or one-way (read-only).

If the bidirectional attribute is set to true, then Plivo accepts the below parameters to accept the audio stream from your application over the WebSockets.

 

Allowed values:

event: Takes playAudio as the value
media: Takes a JSON input of the key values below
contentType: raw, wav
sampleRate: 8000 and 16000
payload: Base64-encoded raw audio
audio_trackstring

The audio track (inbound or outbound) of the underlying call that Plivo will fork and stream to the WebSocket service.

Allowed values: inbound (only audio received by Plivo from call participants is streamed over WebSocket), outbound (only audio transmitted by Plivo to call participants is streamed over WebSocket), both(both the audio streams received and transmitted by Plivo are streamed over WebSocket) Default is inbound

Note: When the bidirectional value is set to true, the audio_track value should not be set to outbound or both.
stream_timeoutinteger

The maximum duration, in seconds, for which audio will be streamed once streaming starts. At the end of the specified duration, streaming will stop. The stream timeout has no impact on the rest of the call flow. Must be a positive integer if provided. Defaults to 86,400 (24 hours).

status_callback_urlstring

URL notified by Plivo when one of the following events occurs:

  • audio stream is connected and audio begins streaming (first packet is sent)
  • audio stream is stopped intentionally
  • audio stream timeout is reached
  • audio stream failed to connect or got disconnected for any reason during an ongoing call

status_callback_methodstring

The HTTP verb used to invoke the status_callback_url.

Allowed values: GET, POST Defaults to POST.

content_typestring

Preferred audio codec and sampling rate.

Allowed values: audio/x-l16;rate=8000, audio/x-l16;rate=16000, audio/x-mulaw;rate=8000 Defaults to audio/x-l16;rate=8000.

extra_headersstring

Key-value pairs passed to the WebSocket service along with the audio stream. These extra headers will be passed with every HTTP request made by the call.

Takes a string of key-value pairs as input. Example: “test1=12,test2=123”. Total length of the string being passed should be no more than 512 bytes.
Only [A-Z], [a-z], and [0-9] characters are allowed in both key and value.

Response

{
    "api_id": "f7615566-13c5-11ee-b552-0242ac110005",
    "audio_track": "both",
    "bidirectional": false,
    "bill_duration": 27,
    "billed_amount": "0.00300",
    "call_uuid": "78737f83-4660-490d-98e1-025dfe4b5c8f",
    "created_at": "2023-06-21 13:23:44.136962+00:00",
    "end_time": "2023-06-21 18:53:43+05:30",
    "plivo_auth_id": "MAY2RJNZKZNJMWOXXX",
    "resource_uri": "/v1/Account/MAY2RJNZKZNJMWOXXX/Call/78737f83-4660-490d-98e1-025dfe4b5c8f/Stream/20170ada-f610-433b-8758-c02a2aab3662/",
    "rounded_bill_duration": 60,
    "service_url": "wss://mysocket.com/wss/v2/1/demo/",
    "start_time": "2023-06-21 18:53:16+05:30",
    "stream_id": "20170ada-f610-433b-8758-c02a2aab3662"
}

Initiate an audio Stream

This method lets you initiate an audio stream for an active call and send that stream to a secure WebSocket URL.

API Endpoint

POSThttps://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/

Attributes

Service_urlstringrequired

WebSocket URL to which the audio stream is to be initiated.

Example: wss://mystream.ngrok.io/audiostream

If a qualified URL is not present, or an active stream is already supplied to the URL, a 400 error is returned.

bidirectionalboolean

Specifies whether the audio being streamed over the WebSocket is bidirectional (the service can both read and write audio over the WebSocket) or one-way (read-only).

If the bidirectional attribute is set to true, then Plivo accepts the below parameters to accept the audio stream from your application over the WebSockets.

 

Allowed values:

event: Takes playAudio as the value
media: Takes a JSON input of the key values below
contentType: audio/x-l16, audio/x-l16, audio/x-mulaw
sampleRate: 8000 and 16000
payload: Base64-encoded raw audio
audio_trackstring

The audio track (inbound or outbound) of the underlying call that Plivo will fork and stream to the WebSocket service.

Allowed values: inbound (only audio received by Plivo from call participants is streamed over WebSocket), outbound (only audio transmitted by Plivo to call participants is streamed over WebSocket), both (both inbound and outbound audio is streamed over the WebSocket). Default is inbound.

Note: When the bidirectional value is set to true, the audio_track value should not be set to outbound or both.
stream_timeoutinteger

The maximum duration, in seconds, for which audio will be streamed once streaming starts. At the end of the specified duration, streaming will stop. This will have no impact on the rest of the call flow.
Needs to be a positive integer if provided. Defaults to 86,400 (24 hours).

status_callback_urlstring

URL notified by Plivo when one of the following events occurs:

  • audio stream is connected and audio begins streaming (first packet is sent)
  • audio stream is stopped intentionally or when audio stream timeout is reached
  • audio stream failed to connect or got disconnected for any reason during an ongoing call

status_callback_methodstring

The HTTP verb used to invoke the status_callback_url.
Allowed values: GET, POST
Defaults to POST.

content_typestring

Preferred audio codec and sampling rate.

Allowed values: audio/x-l16;rate=8000, audio/x-l16;rate=16000, audio/x-mulaw;rate=8000 Defaults to audio/x-l16;rate=8000

extra_headersstring

Key-value pairs passed to the WebSocket service along with the audio stream. These extra headers will be passed with every HTTP request made by the call.

Takes string of key-value pairs as input. Example: “test1=12,test2=123”. Total length of the string being passed should be no more than 512 bytes.
Only [A-Z], [a-z], and [0-9] characters are allowed in both key and value.

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response= client.calls.start_stream(call_uuid='506f0d9f-5961-4c3f-b595-732b36c24e29',service_url='wss://8309-49-36-97-128.mywebsocket.io',bidirectional=False, audio_track='both',stream_timeout=86400,status_callback_url='https://<yourdomain>.com/events/',status_callback_method='POST',content_type='audio/x-l16;rate=16000',extra_headers="Test1=Test2,Test3=Test4")

print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.start_stream( "227ff3c3-1562-4316-819f-217f638890f6","wss://www.example.com/socketserver",
      {
        
        bidirectional: false,
        audio_track: "both",
        stream_timeout: 86400,
        status_callback_url: "https://<yourdomain>.com/events/",
        status_callback_method: "POST",
        content_type: "audio/x-l16;rate=16000",
        extra_headers: "Test1=Test2,Test3=Test4"
        }
    )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Create an audio stream on a call

'use strict';

var plivo = require('plivo');

(function main() {
    var client = new plivo.Client(<auth_id>, <auth_token>);
    client.calls.stream(<call_uuid>, "wss://www.example.com/socketserver",
        {
            bidirectional: false,
            audioTrack: "both",
            streamTimeout: 86400,
            statusCallbackMethod: "POST",
            contentType: "audio/x-l16;rate=16000"
        }
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
 * Create an audio stream on a call
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    
    $response = $client->calls->startStream(
        "d08b6798-c8eb-4dad-b8c5-4e8d2bdb718a",
        array('service_url'=>"wss://www.example.com/socketserver",
        'bidirectional' => false,
        'audio_track' => "both",
        'stream_timeout' => 86400,
        'status_callback_url' => "https://<yourdomain>.com/confevents/",
        'status_callback_method' => "POST",
        'content_type' => "audio/x-l16;rate=16000",
        'extraheaders' =>"Test1=Test2,Test3=Test4"

    )
    );

    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.plivo.examples.audioStream;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.CallCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreator;

/**
 * Create an audio stream on a call
 */
class createStreamAPI {

  public static void main(String [] args) {

    Plivo.init("MANWVLYTK4ZWU1YTY4QA", "ZDI4ZTc3ZWNmMzJhM2M2OGI4MGVjZmJmNmFjNDRl");

    Map map=new HashMap();
    map.put(1,"Amit");


    try {
      CallStreamCreateResponse response = Call.streamer("874a6bfa-da76-4279-b8c5-2d12743c045b","wss://ea22-120-138-116-194.ngrok.io")
        .streamTimeout(23).bidirectional(false).audioTrack("both").statusCallbackUrl("http://plivobin.non-prod.plivops.com/1pdc8e11").statusCallbackMethod("POST").contentType("audio/x-l16;rate=16000").extraHeaders("Test1=Test2,Test3=Test4").stream();
      System.out.println(response);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * Create an audio stream on a call
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.StartStream(callUuid: "d08b6798-c8eb-4dad-b8c5-4e8d2bdb718a", serviceUrl: "wss://www.example.com/socketserver",
                                    bidirectional: "False", audioTrack: "both",
                                    streamTimeout: "86400",statusCallbackMethod: "POST", statusCallbackUrl: "https://<yourdomain>.com/confevents/", contentType: "audio/x-l16;rate=16000",
                                    extraHeaders: "Test1=Test2,Test3=Test4");
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"service_url": "wss://mystream.ngrok.io/audiostream","bidirectional": true,"status_callback_url": "https://webhook.site/22ffd771-4337-4f5e-b9e0-00c24bd2c119"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package Audio_Streaming

import (
"fmt"
"github.com/plivo/plivo-go/v7"
)

// Create an audio stream on a call
//package main

func main() {
client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
if err != nil {
fmt.Print("Error", err.Error())
return
}
//Method for create Stream
response , err := client.Calls.Stream("14885f81-ecb5-477d-a361-930276352966", plivo.CallStreamParams{

ServiceUrl: "wss://a33b-120-138-116-194.ngrok.io",
Bidirectional: false,
AudioTrack: "both",
StreamTimeout: 300,
StatusCallbackMethod: "POST",
StatusCallbackUrl: "http://plivobin.non-prod.plivops.com/1pdc8e11",
ContentType: "audio/x-l16;rate=16000",
ExtraHeaders : "Test1=Test2,Test3=Test4"
},
)
if err != nil {
fmt.Print("Error", err.Error())
return
}
fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

{
 "message": "audio streaming started",
 "api_id":  "c7b69074-58be-11e1-86da-adf28403fe48",					
 "stream_id": "b7b69074-58be-11e1-86da-adf28403fe48" 
}

Retrieve all audio Streams

This method lets you retrieve all active and inactive audio streams for a given call UUID.

API Endpoint

GEThttps://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/

Arguments

No arguments need to be passed.

Example Request

1
2
3
import plivo
client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.calls.get_all_streams('ebe4ab56-9b72-4c3e-9870-5f4262847407')

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.get_all_streams("227ff3c3-1562-4316-819f-217f638890f6")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Retrieve all audio streams for a call

'use strict';

var plivo = require('plivo');

(function main() {
    var client = new plivo.Client(<auth_id>, <auth_token>);
    client.calls.getAllStream(call_uuid,
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
 * Retrieve all audio streams for a call
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    
    $response = $client->calls->getAllStreams(
        "be812e3f-89d5-4ded-a93b-9d38a956aa46"
    );

    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.plivo.examples.audioStream;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.base.ListResponse;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.CallCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreator;
import com.plivo.api.models.call.actions.CallStreamGetSpecificResponse;

/**
 * Retrieve all audio streams for a call
 */
class getAllAudioStreaming {

  public static void main(String [] args) throws PlivoRestException, PlivoValidationException, IOException {

    Plivo.init("<auth_id>","<auth_token>");

    try {

      ListResponse<CallStreamGetSpecificResponse> response1 = Call.streamGetter("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
        .list();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * Retrieve all audio streams for a call
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                
                var response = api.Call.GetAllStreams("eff5f2da-58a9-4447-b484-bee21870638c");
                Console.Write(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package Audio_Streaming

import (
"fmt"
"github.com/plivo/plivo-go/v7"
)

//Retrieve all audio streams for a call
//package main

func main() {
client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
if err != nil {
fmt.Print("Error", err.Error())
return
}
//Method for create Stream
response, err:= client.Calls.GetAllStreams( "61fa0825-3018-4508-9a3a-922247b1052d")

if err != nil {
fmt.Print("Error", err.Error())
return
}
fmt.Printf("Response: %#v\n", response)
}

Was this code helpful

Response

{
  "api_id": "87399872-13cb-11ee-9da1-0242ac110003",
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 1
  },
  "objects": [
    {
      "audio_track": "both",
      "bidirectional": false,
      "bill_duration": 21,
      "billed_amount": "0.00300",
      "call_uuid": "816e0b22-6913-4b43-88a9-6d3054b77df9",
      "created_at": "2023-06-26 02:44:50.617032+00:00",
      "end_time": "2023-06-26 08:14:50+05:30",
      "plivo_auth_id": "MAY2RJNZKZNJMWOXXXX",
      "resource_uri": "/v1/Account/MAY2RJNZKZNJMWOXXXX/Call/816e0b22-6913-4b43-88a9-6d3054b77df9/Stream/4543157e-60d3-4c3a-b9d8-189c47686bf0/",
      "rounded_bill_duration": 60,
      "service_url": "ws://13.127.140.35:19088/ws",
      "start_time": "2023-06-26 08:14:29+05:30",
      "stream_id": "4543157e-60d3-4c3a-b9d8-189c47686bf0"
    }
  ]
}

Retrieve an audio Stream

This method lets you retrieve the details of an audio stream.

API Endpoint

GEThttps://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/{Stream_uuid}/

Arguments

No arguments need to be passed.

Example Request

1
2
3
import plivo
client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.calls.get_details_of_specific_stream('ebe4ab56-9b72-4c3e-9870-5f4262847407','06d42b8e-db57-4ac7-a06d-e47cbccabadd')

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.get_stream("227ff3c3-1562-4316-819f-217f638890f6","{stream_uuid}")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Retrieves details of a specific audio stream on a call

'use strict';

var plivo = require('plivo');

(function main() {
    var client = new plivo.Client(<auth_id>, <auth_token>);
    client.calls.getStream(<call_uuid>,
        <stream_id>
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
/**
 * Retrieves details of a specific audio stream on a call
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    
    $response = $client->calls->getSpecificStream(
        "be812e3f-89d5-4ded-a93b-9d38a956aa46",
        "24e434ce-c37a-4417-82bd-f0e273e078bb"
    );
    print_r($response);  

}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.plivo.examples.audioStream;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.base.ListResponse;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.CallCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreator;
import com.plivo.api.models.call.actions.CallStreamGetSpecificResponse;

/**
 * Retrieves details of a specific audio stream on a call
 */
class getSpecificAudioStreaming {

  public static void main(String [] args) throws PlivoRestException, PlivoValidationException, IOException {

    Plivo.init("<auth_id>","<auth_token>");

    try {

      CallStreamGetSpecificResponse response = Call.streamGetSpecific("eba53b9e-8fbd-45c1-9444-696d2172fbc8", "stream-id")
        .get();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Retrieves details of a specific audio stream on a call
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.GetStream("eff5f2da-58a9-4447-b484-bee21870638c",
                    "aa18dfbd-d492-4301-9a2a-82340786d2ff");
                Console.Write(response);
                
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/{Stream_uuid}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package Audio_Streaming

import (
"fmt"
"github.com/plivo/plivo-go/v7"
)

// Retrieves details of a specific audio stream on a call
//package main

func main() {
client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
if err != nil {
fmt.Print("Error", err.Error())
return
}

err = client.Calls.GetSpecificStream("61fa0825-3018-4508-9a3a-922247b1052d", "f60342d1-eb0a-42b0-974b-2fd900b07ed1")

if err != nil {
fmt.Print("Error", err.Error())
return
}
}

Was this code helpful

Response

​​{
  "api_id": "757c17b8-13cb-11ee-9b7a-0242ac110007",
  "audio_track": "both",
  "bidirectional": false,
  "bill_duration": 21,
  "billed_amount": "0.00300",
  "call_uuid": "816e0b22-6913-4b43-88a9-6d3054b77df9",
  "created_at": "2023-06-26 02:44:50.617032+00:00",
  "end_time": "2023-06-26 08:14:50+05:30",
  "plivo_auth_id": "MAY2RJNZKZNJMWXXXX",
  "resource_uri": "/v1/Account/MAY2RJNZKZNJMWXXXX/Call/816e0b22-6913-4b43-88a9-6d3054b77df9/Stream/4543157e-60d3-4c3a-b9d8-189c47686bf0/",
  "rounded_bill_duration": 60,
  "service_url": "ws://13.127.140.35:19088/ws",
  "start_time": "2023-06-26 08:14:29+05:30",
  "stream_id": "4543157e-60d3-4c3a-b9d8-189c47686bf0"
}

Stop all audio Streams

This method stops all the audio streaming of the given call.

API Endpoint

DELETEhttps://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/

Arguments

No arguments need to be passed.

Example Request

1
2
3
import plivo
client = plivo.RestClient('<auth_id>','<auth_token>')
client.calls.delete_all_streams('ebe4ab56-9b72-4c3e-9870-5f4262847407')

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.stop_all_streams("c533f310-10af-428c-8f3d-b45a01606229")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Stop all audio streams on a call

'use strict';

var plivo = require('plivo');

(function main() {
    var client = new plivo.Client(<auth_id>, <auth_token>);
    client.calls.stopAllStream(<call_uuid>
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Stop all audio streams on a call
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    
    $client->calls->stopStream(
        "62993d16-7e42-4bae-9ac7-55015e35c788"
    );
    
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.plivo.examples.audioStream;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.base.ListResponse;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.CallCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreator;
import com.plivo.api.models.call.actions.CallStreamGetSpecificResponse;

/**
 * Stop all audio streams on a call
 */
class stopAllAudioStreaming {

  public static void main(String [] args) throws PlivoRestException, PlivoValidationException, IOException {

    Plivo.init("<auth_id>","<auth_token>");

    try {

      Call.streamStopper("eba53b9e-8fbd-45c1-9444-696d2172fbc8").stop();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Stop all audio streams on a call
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Call.StopAllStreams("b1c42cfa-2144-4749-b785-3230cf2cbfdd");
                Console.Write(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
 curl -i --user AUTH_ID:AUTH_TOKEN -X DELETE \
    https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package Audio_Streaming

import (
"fmt"
"github.com/plivo/plivo-go/v7"
)

// Stop all audio streams on a call
//package main

func main() {
client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
if err != nil {
fmt.Print("Error", err.Error())
return
}

err = client.Calls.StopAllStreams("4f48bad1-2dff-401c-9e30-56dbcbb7c7bd")

if err != nil {
fmt.Print("Error", err.Error())
return
}

}

Was this code helpful

Response

HTTP Status Code: 204

Error

HTTP status code: 400

{
"api_id": "79cf3765-0f65-11ee-809f-0242ac110003",
"error": "No active stream found"
}

Stop a specific audio Stream

This method stops streaming of a specific audio stream.

API Endpoint

DELETEhttps://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/{Stream_uuid}/

Arguments

No arguments need to be passed.

Example Request

1
2
3
import plivo
client = plivo.RestClient('<auth_id>','<auth_token>')
client.calls.delete_specific_stream('ebe4ab56-9b72-4c3e-9870-5f4262847407','f6efd24d-e592-4db5-baf9-6ad36ac54728')

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.calls.stop_stream("c533f310-10af-428c-8f3d-b45a01606229","bc3e82f1-a2d0-4c96-9620-adf97d2ba3ce")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Stop a specific audio stream on a call

'use strict';

var plivo = require('plivo');

(function main() {
    var client = new plivo.Client(<auth_id>, <auth_token>);
    client.calls.stopStream(<call_uuid>,
        <stream_id>
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
 * Stop a specific audio stream on a call
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
    
     $response = $client->calls->stopSpecificStream(
        "62993d16-7e42-4bae-9ac7-55015e35c788",
        "dc110403-bbc9-4d94-a564-d2939348f703"
    );
    
}
catch (PlivoRestException $ex) {
    print_r($ex);
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.plivo.examples.audioStream;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.base.ListResponse;
import com.plivo.api.models.call.Call;
import com.plivo.api.models.call.CallCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreateResponse;
import com.plivo.api.models.call.actions.CallStreamCreator;
import com.plivo.api.models.call.actions.CallStreamGetSpecificResponse;

/**
 * Stop a specific audio stream on a call
 */
class stopSpecificAudioStreaming {

  public static void main(String [] args) throws PlivoRestException, PlivoValidationException, IOException {

    Plivo.init("<auth_id>","<auth_token>");

    try {

      Call.streamStopSpecific("eba53b9e-8fbd-45c1-9444-696d2172fbc8", "stream-id")
        .stop();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Stop a specific audio stream on a call
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                 api.Call.StopStream("eff5f2da-58a9-4447-b484-bee21870638c","{stream_uuid}");
                
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN -X DELETE \
https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Stream/{Stream_uuid}/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package Audio_Streaming

import (
"fmt"
"github.com/plivo/plivo-go/v7"
)

// Stop a specific audio stream on a call
//package main

func main() {
client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
if err != nil {
fmt.Print("Error", err.Error())
return
}

err = client.Calls.StopSpecificStream("61fa0825-3018-4508-9a3a-922247b1052d", "f60342d1-eb0a-42b0-974b-2fd900b07ed1")

if err != nil {
fmt.Print("Error", err.Error())
return
}

}

Was this code helpful

Response

HTTP Status Code: 204

Error

HTTP status code: 400

{
"api_id": "79cf3765-0f65-11ee-809f-0242ac110003",
"error": "No active stream found"
}

Verified Caller ID

The Verify Caller ID feature allows you to authenticate numbers with Plivo before using them as a Calling Line Identification (CLI) for outbound calls made through the Plivo API or XML.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId

Response

{
  "alias": "US Mainland",
  "api_id": "870e2ded-58b0-41bc-8c1c-ba00c6a90741",
  "channel": "",
  "country": "US",
  "created_at": "2024-02-09T03:52:22.880097813Z",
  "phone_number": "+12025551XXX",
  "verification_uuid": "f87836bd-f3c0-41bb-9498-125e6faaa4d4"
}

The verified caller ID object

The verified caller ID object is used to authenticate numbers with Plivo before using them to make API and Dial XML calls. It enables you to verify and manage caller IDs with Plivo.

Attributes

verification_uuid string

The unique identifier generated when a VerifiedCallerId object is created

alias string

The alias name associated with the verified caller ID

phone_number string

The phone number (in E.164 format) for verification. Once verified, this phone number can be used as Calling Line Identification (CLI)

country string

The two-digit ISO country code of the phone number.

channel string

The approach for obtaining the four-digit One-Time Password (OTP) for phone number verification.

Possible options:

  • sms: An SMS containing the OTP will be dispatched to the phone number.
  • call: A phone call will be placed to the phone number, delivering the OTP message.
  • Default: sms
created_at string

The time (in UTC) when the verification request is first created for a verified number
Format: “YYYY-MM-DD HH:MM:SS”

modified_at string

The time (in UTC) when the phone number verification object was last modified.
Format: “YYYY-MM-DD HH:MM:SS”

otp string

The four-digit code sent to the phone number for verification.
Once created, an OTP is valid for 15 mins.

subaccount string

The sub-account Auth ID for which the number is being verified.
Only main-account credentials can be used to update this parameter.

If sub-account credentials are used, this defaults to the same sub-account.

Response

{
  "alias": "US Mainland",
  "api_id": "870e2ded-58b0-41bc-8c1c-ba00c6a90741",
  "channel": "",
  "country": "US",
  "created_at": "2024-02-09T03:52:22.880097813Z",
  "phone_number": "+12025551XXX",
  "verification_uuid": "f87836bd-f3c0-41bb-9498-125e6faaa4d4"
}

Initiate number verification

This method lets you initiate the number verification.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId

Attributes

phone_number (Mandatory)

The phone number for verification must be provided in E.164 format. This is mandatory for creating the VerifiedCallerID object.

alias (optional)

The unique name associated with the verified caller ID

channel (optional)

The method channel used to receive the OTP.

  • Possible values: sms, call
  • Default: sms
subaccount (optional)

A valid sub-account Auth ID.
Default: None

Example Request

1
2
3
4
5
6
7
8
9
10
import plivo

client = plivo.RestClient('<Auth>', '<Token>')

response = client.verify_callerids.initiate_verify(phone_number='<phone_number>',
                                                   alias='<alias>',
                                                     channel='call/sms',
                                                     subaccount='<subaccount>')

print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions


api = RestClient.new("<auth>", "<token>")
begin
    response = api.verify_caller_id.initiate(
        phone_number="91XXXXXXXXXX", channel="sms", alias_ = "test",subaccount="<subAccountAuth>" 
    )
    
    puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
  
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var plivo = require('plivo');

(function main() {
    'use strict';
    
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.verify.initiate('<phoneNumber>',{
    channel : '<call/sms>',
    alias : '<TestAlias>',
    subAccount  : '<SubAccount>'
    }).then(function(response) {
    console.log(response);
    }, function (err) {
        console.error(err);
    });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
/**
 * Example for initiat verify api request
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth>","<token>");

try {
    
    $response = $client->verifyCallerId->initiate("+91XXXXXXXXX", [
        "alias" => "test",
        "subaccount" => "<Subaccount>",
        "channel" => "Call"   
    ]);

        print_r($response);
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    }

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.verify.InitiateVerifyResponse;
import com.plivo.api.models.verify.Verify;

import java.io.IOException;

public class verificationCallerID {

  public static void main(String[] args) {
    Plivo.init("<auth>", "<token>");
     try {
      InitiateVerifyResponse response = Verify.initiateVerify().phoneNumber("91XXXXXXXXXX").alias("test").channel("call").create();
      System.out.println(response);
    } catch (PlivoRestException | IOException e) {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth-id>","<auth-token>");
            try
            {
                var response = api.VerifyCallerId.Initiate("<phone_number>", "<call/sms>", "<alias-test>","<subaccount>");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
                Console.WriteLine("Exception: " + e);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"phone_number": "+12025551XXX","alias":"US Mainland"}' \
    https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main
import (
	"fmt"
	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<Auth>", "<Token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.VerifyCallerId.InitiateVerify(plivo.InitiateVerify{PhoneNumber: "<phoneNumber>", Alias: "<TestAlias>", Channel : "<call/sms>", SubAccount: "<SubAccount>"})

	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)

Was this code helpful

Response

{
  "api_id": "654a7ca7-b9cc-4285-86f7-cf581f50409f",
  "message": "Verification code is sent to number +12025551XXX which is valid for 15 minutes",
  "verification_uuid": "f87836bd-f3c0-41bb-9498-125e6faaa4d4"
}

Verify Caller ID

This method allows you to verify the OTP for a number that has been initiated for verification.

Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/Verification/{verification_uuid}/

Attributes

otp (Mandatory)

The otp generated for the corresponding verification_uuid

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<Auth>', '<Token>')

response = client.verify_callerids.verify_caller_id(verification_uuid="68dea750-5a76-485d-8ac3-5cf5996ba2fb",otp="123456")

print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions


api = RestClient.new("<auth>", "<token>")
begin
  response = api.verify_caller_id.verify("<verification_uuid>", "<otp>")
    puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
  
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';
    
    var client = new plivo.Client("<auth_id>","<auth_token>");
	client.verify.verify("<verification_uuid>","<otp>").then(function(response) {
                console.log(response);
            }, function (err) {
                console.error(err);
            });
})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for verify API request
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth>","<token>");

    try {

    $response = $client->verifyCallerId->verify("<verification_uuid>","<otp>");
    
        print_r($response);
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    } 

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.verify.InitiateVerifyResponse;
import com.plivo.api.models.verify.Verify;

import java.io.IOException;

public class verificationCallerID {

try{ 
    VerifyCallerIdResponse response = Verify.verifyCallerId("2dfd42e2-431d-4bf6-bc70-d3971ffae240").otp("277407").create();
    System.out.println(response);
    
    }catch(PlivoRestException | IOException  e){
        e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth-id>","<auth-token>");
            try
            {
                var response = api.VerifyCallerId.Verify("<otp>", "<verification_uuid>");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
                Console.WriteLine("Exception: " + e);
            }
        }
    }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"otp": "7871"}' \
    https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/Verification/f87836bd-f3c0-41bb-9498-125e6faaa4d4/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main
import (
	"fmt"
	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<Auth>", "<Token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.VerifyCallerId.VerifyCallerID("<verification_uuid>","123456")

	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)

Was this code helpful

Response

{
  "alias": "US Mainland",
  "api_id": "870e2ded-58b0-41bc-8c1c-ba00c6a90741",
  "channel": "",
  "country": "US",
  "created_at": "2024-02-09T03:52:22.880097813Z",
  "phone_number": "+12025551XXX",
  "verification_uuid": "f87836bd-f3c0-41bb-9498-125e6faaa4d4"
}

Retrieve details of a verified caller ID

The method lets you retrieve details of a verified caller ID.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/{phone_number}

Attributes

No arguments need to be passed.

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<Auth>', '<Token>')

resonse = client.verify_callerids.get_verified_caller_id("+91XXXXXXXXXX")

print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions


api = RestClient.new("<auth>", "<token>")
begin
  response = api.verify_caller_id.get("+918149002252")
    puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
  
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
var plivo = require('plivo');

(function main() {
    'use strict';
    
    var client = new plivo.Client("<auth_id>","<auth_token>");
	client.verify.getVerifiedCallerId('<verified_phone_number>').then(function(response) {
            console.log(response)
        }, function (err) {
                console.error(err);
            });

})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
/**
 * Example for Retrieve details of a verified caller ID
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth>","<token>");

    try {
        $response = $client->verifyCallerId->getVerifiedCallerId("+91XXXXXXXXXX");
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    } 

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.models.verify.ListVerifiedCallerId;
import com.plivo.api.models.verify.Verify;

public class verificationCallerID {

  public static void main(String[] args) {
    Plivo.init("<auth>", "<token>");
      try {
	    GetVerifiedCallerId response = Verify.getVerifiedCallerID("+919268368720");
            System.out.println(response);
      }catch (Exception e){
        e.printStackTrace();
      }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth-id>","<auth-token>");
            try
            {
                var response = api.VerifyCallerId.Get("<phone_number>");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
                Console.WriteLine("Exception: " + e);
            }
        }
    }
}

Was this code helpful

1
2
 curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/{phone_number}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main
import (
	"fmt"
	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<Auth>", "<Token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.VerifyCallerId.GetVerifiedCallerID("<phone_number>")

	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)

Was this code helpful

Response

{
  "alias": "US Mainland",
  "api_id": "79ba7d96-94bb-4b91-a288-419213fa9239",
  "country": "US",
  "created_at": "2024-02-09T03:52:22.880098Z",
  "modified_at": "2024-02-09T03:52:22.880098Z",
  "phone_number": "+12025551XXX",
  "subaccount": "",
  "verification_uuid": "f87836bd-f3c0-41bb-9498-125e6faaa4d4"
}

Retrieve details of all verified caller IDs

The method lets you retrieve details of all verified caller IDs on your account.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/{phone_number}

Attributes

alias (optional)

The friendly name associated with the verified caller ID

subaccount (optional)

A valid sub-account Auth ID.
Default: None

country (optional)

The 2-digit ISO country code of the verified caller ID

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<Auth>', '<Token>')

response = client.verify_callerids.list_verified_caller_id();

print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions


api = RestClient.new("<auth>", "<token>")
begin
  response = api.verify_caller_id.list()
    puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
  
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
var plivo = require('plivo');

(function main() {
    'use strict';
    
    var client = new plivo.Client("<auth_id>","<auth_token>");
	client.verify.listVerifiedCallerId().then(function(response) {
            console.log(response)
          }, function (err) {
                console.error(err);
            });

})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
/**
 * Example for Retrieve details of all verified caller IDs
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth>","<token>");

    try {
        $response = $client->verifyCallerId->listVerifiedCallerIds(
        [
            'limit' => 1,
            'offset' => 0
        ]
        );
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    } 

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.models.verify.ListVerifiedCallerId;
import com.plivo.api.models.verify.Verify;

public class verificationCallerID {

  public static void main(String[] args) {
    Plivo.init("<auth>", "<token>");
      try {
        ListVerifiedCallerId response = Verify.listVerifiedCallerID().subaccount("<subaccount>").alias("").limit(1).offset(1);
        System.out.println(response);
      }catch (Exception e){
        e.printStackTrace();
      }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth-id>","<auth-token>");
            try
            {
                var response = api.VerifyCallerId.List(limit: 20 , country: "IN");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
                Console.WriteLine("Exception: " + e);
            }
        }
    }
}

Was this code helpful

1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main
import (
	"fmt"
	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<Auth>", "<Token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.VerifyCallerId.ListVerifiedCallerID(plivo.ListVerifiedCallerIdParams{Limit: 1 , Offset:  0,  SubAccount: "<subaccount>", Alias: "Test", Country: "IN"})

	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)

Was this code helpful

Response

{
  "api_id": "245e58e7-de0d-4d75-844a-5ce55750e0ff",
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 1
  },
  "objects": [
    {
      "alias": "US Mainland",
      "country": "US",
      "created_at": "2024-02-09T03:52:22.880098Z",
      "modified_at": "2024-02-09T03:52:22.880098Z",
      "phone_number": "+12025551XXX",
      "resource_uri": "/v1/Account/{auth_id}/VerifiedCallerId/12025551XXX",
      "subaccount": "",
      "verification_uuid": "f87836bd-f3c0-41bb-9498-125e6faaa4d4"
    }
  ]
}

Update a verified caller ID

This method lets you update a verified caller ID.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/{phone_number}

Attributes

alias (optional)

The friendly name associated with the phone number.

subaccount (optional)

A valid sub-account Auth ID.

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<Auth>', '<Token>')

response = client.verify_callerids.update_verified_caller_id(phone_number= '+91XXXXXXXXXX', alias='Test update', subaccount= None)

print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions


api = RestClient.new("<auth>", "<token>")
begin
  response = api.verify_caller_id.update("<phone_number>", "<subaccount>", "<updated_alias>")
    puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
  
end

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
var plivo = require('plivo');

(function main() {
    'use strict';
    
    var client = new plivo.Client("<auth_id>","<auth_token>");
        client.verify.updateVerifiedCallerId('+918681951370',{alias : "test"}).then(function(response) {
                console.log(response);
            }, function (err) {
                console.error(err);
            });

})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
 * Example for update a verified caller id
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth>","<token>");

    try {

           $response = $client->verifyCallerId->updateVerifiedCallerId(
            '<phone_number>', ['alias' => '<alias>','subaccount' => null]
            );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    }

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.verify.InitiateVerifyResponse;
import com.plivo.api.models.verify.Verify;

import java.io.IOException;

public class verificationCallerID {

  public static void main(String[] args)  {
   Plivo.init("<auth>", "<token>");

    try {
      UpdateVerifiedCallerIdResponse response = Verify.updateVerifiedCallerID("+919768368745").alias("Test abhishek").subaccount("").update();
      System.out.println(response);
    }catch(PlivoRestException | IOException | PlivoValidationException e){
        e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"alias":"US Mainland secondary"}' \
    https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/{phone_number}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main
import (
	"fmt"
	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<Auth>", "<Token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.VerifyCallerId.UpdateVerifiedCallerID("<phone_number>", plivo.UpdateVerifiedCallerIDParams{
		SubAccount: "<sub_account>", Alias: "<alias>"})

	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)

Was this code helpful

Response

{
  "alias": "US Mainland secondary",
  "api_id": "7f5328d3-7888-48ab-889b-9a60c0c3b9c9",
  "country": "US",
  "created_at": "2024-02-09T03:52:22.880098Z",
  "modified_at": "2024-02-09T04:07:09.954792017Z",
  "phone_number": "+12025551XXX",
  "subaccount": "",
  "verification_uuid": "f87836bd-f3c0-41bb-9498-125e6faaa4d4"
}

Delete a verified caller ID

The method lets you delete the verified caller ID.

API Endpoint

Delete https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/{phone_number}

Example Request

1
2
3
4
5
6
7
import plivo

client = plivo.RestClient('<Auth>', '<Token>')

response = client.verify_callerids.delete_verified_caller_id("+91XXXXXXXXXX")

print(response)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions


api = RestClient.new("<auth>", "<token>")
begin
  response = api.verify_caller_id.delete("<verified_number_to_be_deleted>");
    puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
  
end

  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
var plivo = require('plivo');

(function main() {
    'use strict';
    
    var client = new plivo.Client("<auth_id>","<auth_token>");
		client.verify.deleteVerifiedCallerId('<verified_phonenumber>').then(function(response) {
            console.log(response)
        }, function (err) {
                console.error(err);
            });

})();

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
/**
 * Example for Delete a verified caller ID
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth>","<token>");

    try {

        $response = $client->verifyCallerId->deleteVerifiedCallerId('+91XXXXXXXXXX');
        print_r($response);
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    } 

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.verify.Verify;

import java.io.IOException;

public class verificationCallerID {

  public static void main(String[] args) {
    Plivo.init("<auth>", "<token>");
    try {
      Verify.deleteVerifiedCallerID("919571740370").delete();

    } catch (PlivoRestException | PlivoValidationException | IOException e) {
      e.printStackTrace();
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth-id>","<auth-token>");
            try
            {
                var response = api.VerifyCallerId.Delete("<phone_number>");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
                Console.WriteLine("Exception: " + e);
            }
        }
    }
}

Was this code helpful

1
2
curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/{phone_number}

Was this code helpful

1
2
3
4
5
6
err = client.VerifyCallerId.DeleteVerifiedCallerID("phone_number")

	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}

Was this code helpful

Response

HTTP Status Code: 204

Endpoint

A Plivo endpoint, also known as a SIP endpoint, can be any IP phone, mobile phone, wireless device, or PC that uses the Session Initiation Protocol (SIP) to perform communications operations.

Endpoints are used to receive and make calls from SIP phones and Plivo client SDKs. They support use cases such as agents taking calls in call centers.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Endpoint/

The Endpoint object

Attributes

alias string

Alias for the endpoint.

application string

URI of the application attached to the end point.

endpoint_id string

Unique ID for the endpoint. All endpoint API operations are performed using this identifier.

password string

Password for the endpoint username. It should be at least five characters long.

resource_uri string

URI of the endpoint object.

sip_registered string

Set to true if the SIP endpoint is registered on a SIP client.

Defaults to false.

sip_uri string

SIP URI of the endpoint. External users will be able to call this endpoint on this SIP URI.

sub_account string

Subaccount to which the endpoint is linked. null if it’s not linked to any subaccount.

username string

Username for the endpoint. Only alphanumeric characters are accepted.

Response

{
  "alias": "callme",
  "application": "/v1/Account/MA2025RK4E639VJFZAGV/Application/33406267401237901/",
  "endpoint_id": "32866729519064",
  "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Endpoint/32866729519064/",
  "sip_contact": "sip:callme140703093224@122.172.71.207:57563;ob",
  "sip_expires": "2022-07-21 19:26:08", // Format: YYYY-MM-DD HH:mm:ss Timezone: UTC
  "sip_registered": "true",
  "sip_uri": "sip:callme140703093944@phone.plivo.com",
  "sip_user_agent": "Telephone 1.1.4",
  "sub_account": null,
  "username": "callme140703093944"
}

Create an endpoint

Creates a new endpoint.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Endpoint/

Arguments

username required string

Username for the endpoint. Only alphanumeric characters are accepted, and the username must start with an alphabetic character.

password required string

Password for the endpoint username. It should be at least five characters long.

alias required string

Alias for the endpoint.
Allowed Values:

  • Alphabets (upper case and lower case)
  • Numbers (0-9).
  • Only 2 special characters, i.e. "-" (hyphen) and "_" (underscore)
  • app_id string

    ID of the application attached to the endpoint.

    Returns

    If successful, returns “created” in the “message” field along with an updated username of the endpoint, which has a 12-digit number appended to the username provided in the request. It also returns endpoint_id, which is a unique ID for the endpoint that’s used with other endpoint APIs.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    response = client.endpoints.create(
        username='testusername',
        password='testpassword',
        alias='Test Account', )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    #
    # Example for Endpoint Create
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
      response = api.endpoints.create(
        'testusername',
        'testpassword',
        'Test Account',
        'app id'
      )
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    // Example for Endpoint create
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
       // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
        var client = new plivo.Client("<auth_id>","<auth_token>");
        client.endpoints.create(
            "testusername", // username
            "testpassword", // password
            "Test Account", // alias
        ).then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
    })();
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    <?php
    /**
     * Example for Endpoint create
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $response = $client->endpoints->create(
            'testusername',
            'testpassword',
            'Test Account'
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    package com.plivo.api.samples.endpoint;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.endpoint.Endpoint;
    import com.plivo.api.models.endpoint.EndpointCreateResponse;
    
    /**
    * Example for Endpoint create
    */
    class EndpointCreate {
        public static void main(String [] args) {
            Plivo.init("<auth_id>","<auth_token>");
            try {
                EndpointCreateResponse response = Endpoint.creator("testusername", "testpassword", "Test Account")
                    .create();
    
                System.out.println(response);
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    
    /**
     * Example for Endpoint Create
     */
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Endpoint.Create(
                        username:"testusername",
                        alias:"Test Account",
                        password:"testpassword"
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    
    curl -i --user AUTH_ID:AUTH_TOKEN \
        -H "Content-Type: application/json" \
        -d '{"username": "testuser", "password": "test123", "alias": "Test"}'  \
        https://api.plivo.com/v1/Account/{auth_id}/Endpoint/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    
    // Example for Endpoint create
    package main
    
    import (
    	"fmt"
    
    	"github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := client.Endpoints.Create(
    		plivo.EndpointCreateParams{
    			Username: "testusername",
    			Password: "testpassword",
    			Alias:    "Test Account",
    		},
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 201

    {
    "username": "zumba131031145958",
    "alias": "zumba",
    "message": "created",
    "endpoint_id": "37371860103666",
    "api_id": "1c13de4c-423d-11e3-9899-22000abfa5d5"
    }
    

    Retrieve an endpoint

    Retrieves the details of an existing endpoint.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Endpoint/{endpoint_id}/

    Arguments

    No arguments need to be passed.

    Returns

    Returns an Endpoint object if valid parameters were provided. Returns an error otherwise.

    Note: The password returned is an MD5 hash value of the actual password.

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    response = client.endpoints.get(
        endpoint_id='1465909595140', )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    #
    # Example for Endpoint Get
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
      response = api.endpoints.get(
        '39452475478853'
      )
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    // Example for Endpoint get
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
       // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
        var client = new plivo.Client("<auth_id>","<auth_token>");
        client.endpoints.get(
            "39452475478853", // endpoint id
        ).then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
    })();
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    <?php
    /**
     * Example for Endpoint get
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $response = $client->endpoints->get(
            '39452475478853'
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    package com.plivo.api.samples.endpoint;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.endpoint.Endpoint;
    import com.plivo.api.models.endpoint.Endpoint;
    
    /**
    * Example for Endpoint get
    */
    class EndpointGet {
        public static void main(String [] args) {
            Plivo.init("<auth_id>","<auth_token>");
            try {
                Endpoint response = Endpoint.getter("39452475478853")
                    .get();
    
                System.out.println(response);
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    /**
     * Example for Endpoint Get
     */
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Endpoint.Get(
                        endpointId:"18385812687105"
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user AUTH_ID:AUTH_TOKEN \
        https://api.plivo.com/v1/Account/{auth_id}/Endpoint/21784177241578/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    // Example for Endpoint get
    package main
    
    import (
    	"fmt"
    
    	"github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := client.Endpoints.Get(
    		"39452475478853",
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    Plivo returns this JSON response when the endpoint is not registered on a SIP client.

    {
    	"alias": "zumba",
    	"api_id": "39015de8-4fb3-11e4-a2d1-22000ac5040c",
    	"application": "/v1/Account/MA2025RK4E639VJFZAGV/Application/379619814477342321/",
    	"endpoint_id": "39452475478853",
    	"password": "8bc0002a467b8276aaaf47e92bc46b9f",
    	"resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Endpoint/39452475478853/",
    	"sip_registered": "false",
    	"sip_uri": "sip:zumba141009125224@phone.plivo.com",
    	"sub_account": null,
    	"username": "zumba141009125224"
    }
    

    When the endpoint is registered with a SIP client, Plivo returns this JSON response.

    {
    	"alias": "callme",
    	"application": "/v1/Account/MA2025RK4E639VJFZAGV/Application/33406267401237901/",
    	"endpoint_id": "32866729519064",
    	"resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Endpoint/32866729519064/",
    	"sip_contact": "sip:callme140703093224@122.172.71.207:57563;ob",
    	"sip_expires": "2022-07-21 19:26:08", // Format: YYYY-MM-DD HH:mm:ss Timezone: UTC
    	"sip_registered": "true",
    	"sip_uri": "sip:callme140703093944@phone.plivo.com",
    	"sip_user_agent": "Telephone 1.1.4",
    	"sub_account": null,
    	"username": "callme140703093944"
    }
    

    List all endpoints

    Retrieves the details of all endpoints.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Endpoint/

    Arguments

    No arguments need to be passed.

    Returns

    A dictionary with an objects property that contains an array of subaccount objects.

    Example Request

    1
    2
    3
    4
    5
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    response = client.endpoints.list()
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    #
    # Example for Endpoint List
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
      response = api.endpoints.list
      
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    // Example for Endpoint list
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
       // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
        var client = new plivo.Client("<auth_id>","<auth_token>");
        client.endpoints.list(
        ).then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
    })();
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    <?php
    /**
     * Example for Endpoint list
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $response = $client->endpoints->list(
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    package com.plivo.api.samples.endpoint;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.endpoint.Endpoint;
    import com.plivo.api.models.base.ListResponse;
    
    /**
    * Example for Endpoint list
    */
    class EndpointList {
        public static void main(String [] args) {
            Plivo.init("<auth_id>","<auth_token>");
            try {
                ListResponse<Endpoint> response = Endpoint.lister()
                    .list();
    
                System.out.println(response);
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    
    /**
     * Example for Endpoint List
     */
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Endpoint.List(
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user AUTH_ID:AUTH_TOKEN \
        https://api.plivo.com/v1/Account/{auth_id}/Endpoint/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    // Example for Endpoint list
    package main
    
    import (
    	"fmt"
    
    	"github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := client.Endpoints.List(
    		plivo.EndpointListParams{},
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
      "api_id": "30a0c8c2-110c-11e4-bd8a-12313f016a39",
      "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 11
      },
      "objects": [{
          "alias": "callme",
          "application": "/v1/Account/MA2025RK4E639VJFZAGV/Application/33406267401237901/",
          "endpoint_id": "32866729519064",
          "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Endpoint/32866729519064/",
          "sip_contact": "sip:callme140703093224@122.172.71.207:57563;ob",
          "sip_expires": "2022-07-21 19:26:08",
          "sip_registered": "true",
          "sip_uri": "sip:callme140703093944@phone.plivo.com",
          "sip_user_agent": "Telephone 1.1.4",
          "sub_account": null,
          "username": "callme140703093944"
        },
        {
          "alias": "polycom",
          "application": "/v1/Account/MA2025RK4E639VJFZAGV/Application/37961981447734951/",
          "endpoint_id": "17551316589618",
          "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Endpoint/17551316589618/",
          "sip_registered": "false",
          "sip_uri": "sip:polycom140506175228@phone.plivo.com",
          "sub_account": null,
          "username": "polycom140506175448"
        }
      ]
    }
    

    Update an endpoint

    Updates an endpoint’s password or alias, or the application attached to it.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/Endpoint/{endpoint_id}/

    Arguments

    password string

    Password for your endpoint username. It should be at least five characters long.

    alias string

    Alias for the endpoint.
    Allowed Values:

  • Alphabets (upper case and lower case)
  • Numbers (0-9).
  • Only 2 special characters, i.e. "-" (hyphen) and "_" (underscore)
  • app_id string

    ID of the application attached to the endpoint.

    Returns

    Returns a confirmation that the object is updated.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    response = client.endpoints.update(
        endpoint_id='14659095951490',
        alias='Double time.', )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    #
    # Example for Endpoint Update
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
      response = api.endpoints.update(
        '39452475478853',
        alias: 'Updated Endpoint Alias'
      )
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    // Example for Endpoint update
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
       // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
        var client = new plivo.Client("<auth_id>","<auth_token>");
        client.endpoints.update(
            "39452475478853", // endpoint id
            {
                alias: "Updated Endpoint Alias",
            },
        ).then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
    })();
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    <?php
    /**
     * Example for Endpoint update
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $response = $client->endpoints->update(
            '39452475478853',
            ['alias' => 'Updated Endpoint Alias']
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    
    package com.plivo.api.samples.endpoint;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.endpoint.Endpoint;
    import com.plivo.api.models.endpoint.EndpointUpdateResponse;
    
    /**
    * Example for Endpoint update
    */
    class EndpointUpdate {
        public static void main(String [] args) {
            Plivo.init("<auth_id>","<auth_token>");
            try {
                EndpointUpdateResponse response = Endpoint.updater("39452475478853")
                    .alias("Updated Endpoint Alias")
                    .update();
    
                System.out.println(response);
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    /**
     * Example for Endpoint Update
     */
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Endpoint.Update(
                        endpointId:"39452475478853",
                        alias:"Updated Endpoint Alias"
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    
    curl -i --user AUTH_ID:AUTH_TOKEN \
        -H "Content-Type: application/json" \
        -d '{"alias": "New_test"}' \
        https://api.plivo.com/v1/Account/{auth_id}/Endpoint/{endpoint_id}/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    
    // Example for Endpoint update
    package main
    
    import (
    	"fmt"
    
    	"github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := client.Endpoints.Update(
    		"39452475478853",
    		plivo.EndpointUpdateParams{
    			Alias: "Updated Endpoint Alias",
    		},
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 202

    {
      "message": "changed",
      "api_id": "d8f9ea6c-58cc-11e1-86da-adf28403fe48"
    }
    

    Delete an endpoint

    Permanently deletes an endpoint.

    API Endpoint

    DELETE https://api.plivo.com/v1/Account/{auth_id}/Endpoint/{endpoint_id}/

    Arguments

    No arguments need to be passed.

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    response = client.endpoints.delete(
        endpoint_id='14659095951490', )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    #
    # Example for Endpoint Delete
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
      response = api.endpoints.delete(
        '39452475478853'
      )
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    // Example for Endpoint delete
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
       // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
        var client = new plivo.Client("<auth_id>","<auth_token>");
        client.endpoints.delete(
            "39452475478853", // endpoint id
        ).then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
    })();
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    <?php
    /**
     * Example for Endpoint delete
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $response = $client->endpoints->delete(
            '39452475478853'
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package com.plivo.api.samples.endpoint;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.endpoint.Endpoint;
    
    /**
    * Example for Endpoint delete
    */
    class EndpointDelete {
        public static void main(String [] args) {
            Plivo.init("<auth_id>","<auth_token>");
            try {
                Endpoint.deleter("39452475478853")
                    .delete();
    
                System.out.println("Deleted successfully.");
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    /**
     * Example for Endpoint Delete
     */
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Endpoint.Delete(
                        endpointId:"18385812687105"
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -X DELETE -i --user AUTH_ID:AUTH_TOKEN \
        https://api.plivo.com/v1/Account/{auth_id}/Endpoint/{endpoint_id}/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    // Example for Endpoint delete
    package main
    
    import (
    	"fmt"
    
    	"github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	err = client.Endpoints.Delete(
    		"39452475478853",
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Println("Deleted successfully.")
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 204

    Recording

    This endpoint helps you manage the recordings available in your account. You can retrieve or delete recordings using this endpoint.

    API Endpoint

    BaseURI https://api.plivo.com/v1/Account/{auth_id}/Recording/

    The Recording object

    Attributes

    add_time string

    The datetime string on which the recording was created on the account.

    call_uuid string

    The identifier of the call that was recorded.

    conference_name string

    The name of the conference that was recorded. If it was not a conference, then the value will be null.

    recording_duration_ms string

    The duration of the recording in milliseconds.

    recording_format string

    The format of the recording file.

    Allowed values: wav, mp3

    recording_id string

    The ID of the recording.

    recording_type string

    The type of call on which the recording was made.

    Allowed values: conference (a conference call), normal (a regular call)

    recording_url string

    The URL where the recording can be accessed

    recording_storage_durationinteger

    The time in days for which the recording is stored.

    Increments by one after 24 hours from the recording add time.

    Minimum value: 1

    rounded_recording_durationinteger

    The rounded duration of recording in seconds.

    Plivo rounds the recording duration to the nearest 60-second interval. Recordings of less than 60 seconds duration are rounded up to 60 seconds.

    recording_storage_ratestring

    The unit cost of storing the recording per month.

    monthly_recording_storage_amountstring

    The monthly amount incurred in the latest billing cycyle to store a recording.

    Response

    {
      "add_time": "2020-08-05 16:15:15.852059+05:30",
      "api_id": "7abf0744-1ca0-11e4-a2d1-22000ac5040c",
      "call_uuid": "c2c128e2-1c8c-11e4-9bff-1db8a9db0432",
      "conference_name": "noname",
      "recording_duration_ms": "345100.00000", // duration in milliseconds
      "recording_end_ms": "1407235509007.00000", // milliseconds since epoch
      "recording_format": "mp3",
      "recording_id": "c2186400-1c8c-11e4-a664-0026b945b52x",
      "recording_start_ms": "1407235163907.00000", // milliseconds since epoch
      "recording_type": "conference",
      "recording_url": "http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-11e4-a664-0026b945b52x.mp3",
      "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Recording/c2186400-1c8c-11e4-a664-0026b945b52x/",
      "recording_storage_duration": "723",
      "rounded_recording_duration": "3456",
      "recording_storage_rate": "0.0004",
      "monthly_recording_storage_amount": "0.02304"
    }
    

    Retrieve a recording

    This API retrieves a specific recording based on the recording ID.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Recording/{recording_id}/

    Arguments

    No arguments need to be passed.

    Returns

    Returns a Recording object

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    response = client.recordings.get(
        recording_id='1ca34b00-3c5c-11e7-b213-06bcf6c57c65', )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    #
    # Example for Recording Get
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
      response = api.recordings.get(
        'c2186400-1c8c-1124-a664-0026b945b522'
      )
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    // Example for Recording get
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
       // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
        var client = new plivo.Client("<auth_id>","<auth_token>");
        client.recordings.get(
            "c2186400-1c8c-1124-a664-0026b945b522", // recording id
        ).then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
    })();
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    <?php
    /**
     * Example for Recording get
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $response = $client->recordings->get(
            'c2186400-1c8c-1124-a664-0026b945b522'
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    package com.plivo.api.samples.recording;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.recording.Recording;
    import com.plivo.api.models.recording.Recording;
    
    /**
    * Example for Recording get
    */
    class RecordingGet {
        public static void main(String [] args) {
            Plivo.init("<auth_id>","<auth_token>");
            try {
                Recording response = Recording.getter("c2186400-1c8c-1124-a664-0026b945b522")
                    .get();
    
                System.out.println(response);
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    /**
     * Example for Recording Get
     */
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Recording.Get(
                        recordingId:"3ebae784-54fd-11e7-975a-024cb8ab2db9"
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user AUTH_ID:AUTH_TOKEN \
        https://api.plivo.com/v1/Account/{auth_id}/Recording/{recording_id}/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    // Example for Recording get
    package main
    
    import (
    	"fmt"
    
    	"github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := client.Recordings.Get(
    		"c2186400-1c8c-1124-a664-0026b945b522",
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
      "add_time": "2020-08-05 16:15:15.852059+05:30",
      "api_id": "7abf0744-1ca0-11e4-a2d1-22000ac5040c",
      "call_uuid": "c2c128e2-1c8c-11e4-9bff-1db8a9db0432",
      "conference_name": "noname",
      "recording_duration_ms": "345100.00000", // duration in milliseconds
      "recording_end_ms": "1407235509007.00000", // milliseconds since epoch
      "recording_format": "mp3",
      "recording_id": "c2186400-1c8c-11e4-a664-0026b945b52x",
      "recording_start_ms": "1407235163907.00000", // milliseconds since epoch
      "recording_type": "conference",
      "recording_url": "http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-11e4-a664-0026b945b52x.mp3",
      "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Recording/c2186400-1c8c-11e4-a664-0026b945b52x/"
    }
    

    List all recordings

    This method lists the recordings that are available in your account.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Recording/

    Arguments

    from_numberstring

    Provide a source phone number (E.164 format) or SIP endpoint to retrieve recordings that match the number.

    to_numberstring

    Provide a destination phone number (E.164 format) or SIP endpoint to retrieve recordings that match the number.

    subaccount string

    Provide the auth_id of a subaccount if you want to filter only recordings for a given subaccount.

    call_uuid string

    Use the call_uuid of the call to filter only recordings associated with a specific call.

    add_time string

    Filter recordings based on the time they were added. The time format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]].

    • add_time__gt: gt stands for greater than. For example, to get all recordings that started after 2021-03-21 11:47, use add_time__gt=2021-03-21 11:47

    • add_time__gte: gte stands for greater than or equal. To get all recordings that started after or exactly at 2021-03-21 11:47[:30], use add_time__gte=2021-03-21 11:47[:30]

    • add_time__lt: lt stands for less than. To get all recordings that started before 2021-03-21 11:47, use add_time__lt=2021-03-21 11:47

    • add_time__lte: lte stands for less than or equal to. To get all recordings that started before or exactly at 2021-03-21 11:47[:30], use add_time__lte=2021-03-21 11:47[:30]

    Note: You can combine these filters to get recordings that were added during a particular time range.

    If you don’t use the add_time filter when you search, Plivo uses a search window of the last seven days from the current date. The add_time parameter permits Plivo users to obtain recordings within a 30-day search boundary limit, while still providing unrestricted access to older recordings. Alternatively, you can use add_time__[lt|lte] and add_time__[gt|gte] to search within a specific time range. If the provided time range exceeds the 30-day search boundary, the API will return a 400 response code, signaling an error.


    Timestamp values need to be specified as UTC.

    mpc_namestring

    Filtering based on Name of the MPC in case the recording file belongs to an MPC.

    mpc_uuidstring

    Provide a multiparty call UUID to retrieve recordings that match that UUID.

    conference_namestring

    Provide a conference name to retrieve recordings that match that name.

    conference_uuidstring

    Provide a conference UUID to retrieve recordings that match that UUID.

    Note: You can combine these filters to get recordings that started within a particular time range.
    limit string

    Denotes the number of results per page. The maximum number of results that can be fetched is 20.

    offset string

    Denotes the number of value items by which the results should be offset. For example, if the result contains 1,000 values,limit is set to 10, and offset is set to 705, then values 706 through 715 will be displayed in the results. This parameter is also used for pagination of the results.

    recording_storage_durationCannot be used with add_timeinteger

    Filter recordings based on the storage duration. The time format expected is integer (number of days)

    • recording_storage_duration: To get all recordings which are exactly equal to the provided recording_storage_duration.

    • recording_storage_duration__gt: gt stands for greater than. For example, to get all recordings that are greater than 80-day, use recording_storage_duration__gt=80]

    • recording_storage_duration__gte: : gte stands for greater than or equal. To get all recordings that is greater than or equal to 90 days, use recording_storage_duration__gte=90

    • recording_storage_duration__lt: lt stands for less than. To get all recordings that is less than or equal to 90 days, use recording_storage_duration__lt=90

    • recording_storage_duration__lte: lte stands for less than or equal to. To get all recordings that is less than or equal to 90 days, use recording_storage_duration__lte=90

    Default search window is 7 days.

    Maximum search window is 30 days.

    Returns

    Returns the details of the recordings based on the filters specified in the API.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    response = client.recordings.list(
        offset=0,
        limit=5, )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    #
    # Example for Recording List
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
      response = api.recordings.list(
        limit: 5,
        offset: 0
      )
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    // Example for Recording list
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
       // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
        var client = new plivo.Client("<auth_id>","<auth_token>");
        client.recordings.list(
            {
                offset: 0,
                limit: 5,
            },
        ).then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
    })();
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    <?php
    /**
     * Example for Recording list
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $response = $client->recordings->list(
            [
            	'limit' => 2,
            	'offset' => 2
            ]
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    
    package com.plivo.api.samples.recording;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.recording.Recording;
    import com.plivo.api.models.base.ListResponse;
    
    /**
    * Example for Recording list
    */
    class RecordingList {
        public static void main(String [] args) {
            Plivo.init("<auth_id>","<auth_token>");
            try {
                ListResponse<Recording> response = Recording.lister()
                    .offset(0)
                    .limit(5)
                    .list();
    
                System.out.println(response);
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    /**
     * Example for Recording List
     */
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Recording.List(
                        limit:5,
                        offset:0
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user AUTH_ID:AUTH_TOKEN \
        https://api.plivo.com/v1/Account/{auth_id}/Recording/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    
    // Example for Recording list
    package main
    
    import (
    	"fmt"
    
    	"github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := client.Recordings.List(
    		plivo.RecordingListParams{
    			Offset: 0,
    			Limit:  5,
    		},
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
      "api_id": "ff25223a-1c9f-11e4-80aa-12313f048015",
      "meta": {
        "limit": 3,
        "next": "/v1/Account/MA2025RK4E639VJFZAGV/Recording/?limit=3&offset=3",
        "offset": 0,
        "previous": null,
        "total_count": 948
      },
      "objects": [{
          "add_time": "2022-08-05 16:15:15.852059+05:30",
          "call_uuid": "c2c128e2-1c8c-11e4-9bff-1db8a9db0432",
          "conference_name": "noname",
          "recording_duration_ms": "345100.00000", // The duration of the recording in milliseconds
          "recording_end_ms": "1407235509007.00000", // The end time of the recording since epoch in milliseconds
          "recording_format": "mp3",
          "recording_id": "c2186400-1c8c-1124-a664-0026b945b522",
          "recording_start_ms": "1407235163907.00000", // The start time of the recording since epoch in milliseconds
          "recording_type": "conference",
          "recording_url": "http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-1124-a664-0026b945b522.mp3",
          "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Recording/c2186400-1c8c-1124-a664-0026b945b522/"
        },
        {
          "add_time": "2022-08-05 16:05:21.993853+05:30",
          "call_uuid": "fc773e88-1c8b-11e4-b25a-0fe7bcc54670",
          "conference_name": "noname",
          "recording_duration_ms": "90700.00000",
          "recording_end_ms": "1407234920253.00000",
          "recording_format": "mp3",
          "recording_id": "fc2716b0-1c8b-11e4-bwad-842b2b17453e",
          "recording_start_ms": "1407234829553.00000",
          "recording_type": "conference",
          "recording_url": "http://s3.amazonaws.com/recordings_2013/fc2716b0-1c8b-11e4-bwad-842b2b17453e.mp3",
          "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Recording/fc2716b0-1c8b-11e4-bwad-842b2b17453e/"
        }
      ]
    }
    

    Delete a specific recording

    This API lets you delete a recording from your account using the recording ID.

    You can retrieve the value of recording_id from List all recordings and Retrieve a recording API and pass them in the API endpoint.

    API Endpoint

    DELETE https://api.plivo.com/v1/Account/{auth_id}/Recording/{recording_id}/

    Arguments

    No arguments need to be passed.

    Returns

    Returns 404 Not Found if the recording is not found for the given recording_id. Else, returns 204 without content.

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    response = client.recordings.delete(
        recording_id='9684e812-4b88-11e7-b285-02fb5b2555e7', )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    #
    # Example for Recording Delete
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
      response = api.recordings.delete(
        'c2186400-1c8c-1124-a664-0026b945b522'
      )
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    // Example for Recording delete
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
       // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
        var client = new plivo.Client("<auth_id>","<auth_token>");
        client.recordings.delete(
            "c2186400-1c8c-1124-a664-0026b945b522", // recording id
        ).then(function (response) {
            console.log(response);
        }, function (err) {
            console.error(err);
        });
    })();
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    <?php
    /**
     * Example for Recording delete
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $response = $client->recordings->delete(
            'c2186400-1c8c-1124-a664-0026b945b522'
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package com.plivo.api.samples.recording;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.recording.Recording;
    
    /**
    * Example for Recording delete
    */
    class RecordingDelete {
        public static void main(String [] args) {
            Plivo.init("<auth_id>","<auth_token>");
            try {
                Recording.deleter("c2186400-1c8c-1124-a664-0026b945b522")
                    .delete();
    
                System.out.println("Deleted successfully.");
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    /**
     * Example for Recording Delete
     */
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Recording.Delete(
                        recordingId:"3ebae784-54fd-11e7-975a-024cb8ab2db9"
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
        https://api.plivo.com/v1/Account/{auth_id}/Recording/{recording_id}/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    // Example for Recording delete
    package main
    
    import (
    	"fmt"
    
    	"github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	err = client.Recordings.Delete(
    		"c2186400-1c8c-1124-a664-0026b945b522",
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Println("Deleted successfully.")
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 204