Start recording a call

This endpoint allows you to 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 post which the recording will be stopped automatically. The default value is 60 seconds

file_format string

This allows you to specify the format in which you want the recording in. The formats supported are mp3 and wav. By default recordings are in mp3 format.

transcription_type string

There are two types of transcriptions: auto and hybrid

  • auto: This transcription is completely automated and the turnaround time is 5 minutes.
  • hybrid: This type of transcription is partially automated and manually reviewed. The turnaround time is 15 minutes.

Both types of transcriptions are charged and details are available in pricing page.

Note: Currently we support transcriptions only for voice mail use case (calls less than 60 second duration).

transcription_url string

The URL to which the transcription needs to be posted.

transcription_method string

The HTTP verb that is used to invoke the transcription_url. Defaults to POST.

callback_url string

The URL which needs to be invoked when the recording ends. The details that will be posted to the URL are provided in Callback URL section.

callback_method string

The HTTP verb that is used to invoke the callback_url. This defaults to POST. Supported values are GET and POST.

Callback URL

The following are the details that will be posted to when the Callback URL is invoked after the recording ends.

List of parameters sent to the Callback URL

api_id

The same api_id that is being 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 happened

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

Returns

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

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"
}

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient()
response = client.calls.record(
    call_uuid='3a2e4c90-dcee-4931-8a59-f123ab507e60', )
print(response)
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("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN")

begin
  response = api.calls.record(
    'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end
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';
    
    // 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();
    client.calls.record(
        "eba53b9e-8fbd-45c1-9444-696d2172fbc8", // call uuid
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();
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("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");

try {
    $response = $client->calls->startRecording(
        'eba53b9e-8fbd-45c1-9444-696d2172fbc8'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r(ex);
}
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();
        try {
            CallRecordCreateResponse response = Call.recorder("eba53b9e-8fbd-45c1-9444-696d2172fbc8")
                .record();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}
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("YOUR_AUTH_ID", "YOUR_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);
            }
        }
    }
}
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/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Example for Call Record create
package main

import "fmt"
import "github.com/plivo/plivo-go"
 
func main() {
	client, err := plivo.NewClient("", "", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	response, err := client.Calls.Record(
		"eba53b9e-8fbd-45c1-9444-696d2172fbc8",
		plivo.CallRecordParams{},
	)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}