?> <!-- transfer_action.php --> <?php $r = new Response(); $digit = $_REQUEST['Digits']; $call_uuid = $_REQUEST['CallUUID']; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; error_log($digit); error_log($call_uuid); $p = new RestAPI($auth_id, $auth_token); if ($digit == "1") { $params = array('call_uuid' => $call_uuid, 'aleg_url' => 'https://glacial-harbor-8656.herokuapp.com/testing.php/connect', 'aleg_method' => 'GET'); $resp = $p->transfer_call($params); print_r($resp); } else { print "WrongInput"; } /* Sample Output <Response> <GetDigits action="http://morning-ocean-4669.herokuapp.com/transfer_action/" method="GET" numDigits="1" redirect="false" retries="1" timeout="7"> <Speak>Press 1 to transfer this call</Speak> </GetDigits> <Wait length="10" /> </Response> Call UUID is : e66aa1a0-9587-11e4-9d37-c15e0b562efe Digit pressed is : 1
require_once '../plivo.php'; $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