Plivo is an open source communication platform as a service. It also provides an APIs to make and receive calls , SMS.

Plivo APIs are platform independent and can easily use in PHP environment. Developers can easily integrate with our website to perform all the telephonic operations like calls, SMS, conference call, DTMF etc. after creating a SIP (session initiation protocol).

We can perform all the above operations by including the plivo js file.

Plivo js is included in this format:

<script type="text/javaScript" src="https://s3.amazonaws.com/plivosdk/web/plivo.min.js"></script>

Plivo js file does not support to record a call while call is in progress or not. To record a call we use Ajax with plivo rest API. We do not use plivo rest API directly

How to use Plivo Rest API :

For Windows: Install composer ( https://getcomposer.org/ ) with guzzle http and plivo php library.

Using Command line istallation :

–install-dir (Install composer in a specific directory). Example :

php composer-setup.php –install-dir=bin

–filename (Install composer using filename option). Example :

php composer-setup.php –filename=composer

–version (Install composer using version). Example :

php composer-setup.php –version=1.0.0-alpha8

After that include vendor autoload.php with the directory path in which vendor folder exists.

require __DIR__. '/vendor/autoload.php';

use Plivo\RestAPI;

$AuthId = "AuthId";
$AuthToken = "AuthToken";

This $AuthId and $AuthToken you can get from plivo dashboard after login.

$p = new RestAPI($AuthId, $AuthToken);
$all_live_call = $p->get_live_calls();

Get live calls function give the call details of all ongoing call.

$params = array(
'call_uuid' => 'a8caa572453-1ab2-11e7-8bd2-dbf71cdc290355',
'time_limit' => 3600
);

$p->record($params) will start record the call based on the parameters that you have passed in params array.

e.g : $response = $p->record($params);

Recording url is also present in the above response. With the help of this url you can also download the recording.