<?php require_once "./plivo.php"; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); # To record a call $params = array('call_uuid' => "xxxxxxxxxxx", 'time_limit' => '40', 'callback_url' => "https://glacial-harbor-8656.herokuapp.com/testing.php/record_action/", 'callback_method' => "GET", 'transcriptionType' => 'auto', 'transcriptionUrl' => "https://glacial-harbor-8656.herokuapp.com/testing.php/transcription/", 'transcriptionMethod' => 'GET'); $resp = $p->record($params); print_r($resp); # To stop recording a call $params = array('call_uuid' => "xxxxxxxxxxx"); $resp = $p->stop_record($params); print_r($resp); # To record a conference call $params = array('conference_name' => "demo", 'callback_url' => "https://glacial-harbor-8656.herokuapp.com/testing.php/record_action/", 'callback_method' => "GET"); $resp = $p->record_conference($params); print_r($resp); # To stop recording a conference call $params = array('conference_name' => "demo"); $resp = $p->stop_record_conference($params); print_r($resp);
$auth_id = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"; $auth_token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $p = new RestAPI($auth_id, $auth_token); // Make Call $params = array('to' => '1212121212121', 'from' => '43434343434343', 'ring_url' => 'http://example.com/ring_url', 'answer_url' => 'http://example.com/answer_url', 'hangup_url' => 'http://example.com/hangup_url'); $response = $p->make_call($params); // Hangup Call $params = array('call_uuid' => 'XXXXXXXXXXXXXXXXXXXXXXXXX'); $response = $p->hangup_call($params); // Hangup All Calls $response = $p->hangup_all_calls(); // Transfer Calls $params = array('call_uuid' => 'XXXXXXXXXXXXXXXXXXXXXXXXX', 'url' => 'http://example.com/transfer_call', 'method' => 'POST'); $response = $p->transfer_call($params); // Record Call $params = array('call_uuid' => 'XXXXXXXXXXXXXXXXXXXXXXXXX', 'time_limit' => '60', 'file_format' => 'mp3', 'url' => 'http://example.com/record_url_fetch', 'method' => 'POST'); $response = $p->record($params); // Stop Record $params = array('call_uuid' => 'XXXXXXXXXXXXXXXXXXXXXXXXX', 'url' => 'http://example.com/record_url_fetch'); $response = $p->stop_record($params); // Play Sound $params = array('call_uuid' => 'XXXXXXXXXXXXXXXXXXXXXXXXX', 'url' => 'http://example.com/play_to_call'); $response = $p->play($params); // Stop Play $params = array('call_uuid' => 'XXXXXXXXXXXXXXXXXXXXXXXXX'); $response = $p->stop_play($params); // Get CDRs $response = $p->get_cdrs(); // Get CDR $params = array('record_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXX'); $response = $p->get_cdr($params);