public function send($to, $message) { require_once '_plivo.php'; $p = new RestAPI($this->getAccount(), $this->getPassword()); $params = array('src' => str_replace('+', '', $this->getFrom()), 'dst' => $to, 'text' => $message, 'type' => 'sms'); $response = $p->send_message($params); $tmp = array_values($response); if (array_shift($tmp) != "202") { throw new Exception('Plivo: Please ensure that From number is a valid and sms feature enabled Plivo DID number'); } }
public function assignToApplication($userName) { $restApi = new RestAPI(); $sendData = array("account_id" => self::ID, "api_key" => self::API_KEY, "user_name" => $userName, "application_name" => "staging-bottel"); $apiResult = $restApi->CallAPIGuzzle("GET", "https://api.voximplant.com/platform_api/BindUser/", $sendData); $result = json_decode($apiResult); if ($result->{"result"} == 1) { return true; } else { return false; } }
<?php require_once './plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); # Search for new number $params = array('country_iso' => 'US', 'type' => 'local', 'pattern' => '210', 'region' => 'Texas'); $response = $p->search_phone_numbers($params); print_r($response); /* Sample Output ( [status] => 200 [response] => Array ( [api_id] => 059936ae-b68a-11e4-af95-22000ac54c79 [meta] => Array ( [limit] => 20 [next] => /v1/Account/XXXXXXXXXXXX/PhoneNumber/?limit=20&country_iso=US&pattern=210®ion=Texas&offset=20&type=local [offset] => 0 [previous] => [total_count] => 98 ) [objects] => Array ( [0] => Array ( [country] => UNITED STATES
<?php require_once './plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); // Get account details $response = $p->get_account(); // print_r ($response['response']); /* Sample Output ( [account_type] => standard [address] => Example add [api_id] => 096ca42e-ac34-11e4-96e3-22000abcb9af [auth_id] => xxxxxxxxxxxxxxxx [auto_recharge] => False [billing_mode] => prepaid [cash_credits] => 79.40625 [city] => Test Place [name] => User [resource_uri] => /v1/Account/xxxxxxxxxxxxxxxx/ [state] => [timezone] => Asia/Kolkata ) */ // Modify account $params = array('name' => 'Testing', 'city' => 'Testing City', 'address' => 'Sample address', 'timezone' => 'Indian/Mauritius'); $response = $p->modify_account($params); // print_r ($response['response']); /*
$r->addWait($waitparam); Header('Content-type: text/xml'); echo $r->toXML(); ?> <!--recording_action.php--> <?php require_once "./plivo.php"; $digit = $_REQUEST['Digits']; $uuid = $_REQUEST['CallUUID']; print "Digit : {$digit}"; print "Call UUID : {$uuid}"; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); if ($digit == "1") { $params = array('call_uuid' => $uuid); $response = $p->record($params); print "URL : {$response['response']['url']}"; print "Recording ID : {$response['response']['recording_id']}"; print "API ID : {$response['response']['api_id']}"; print "Message : {$response['response']['message']}"; } else { print "invalid"; } /* Sample Output <Response> <GetDigits action="https://glacial-harbor-8656.herokuapp.com/testing.php/recording_action" method="GET" timeout="7" numDigits="1" retries="1" redirect="false"> <Speak>Press 1 to record this call</Speak>
<?php require_once '../plivo.php'; $auth_id = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"; $auth_token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $p = new RestAPI($auth_id, $auth_token); // Create Application $params = array('app_name' => 'Gandalf the Gray', 'answer_url' => 'http://example.com/answer_url', 'answer_method' => 'POST', 'hangup_url' => 'http://example.com/hangup_url', 'hangup_method' => 'POST', 'fallback_url' => 'http://example.com/fallback_url', 'fallback_method' => 'POST'); $response = $p->create_application($params); // Modify Application $response = $p->modify_application($params); // Delete Application $params = array('app_id' => 'XXXXXXXXXXXXXXXXXXX'); $response = $p->delete_application($params); // Create Subaccount application $params = array('subauth_id' => ' XXXXXXXXXXXX', 'app_name' => 'Gimli the dwarf', 'answer_url' => 'http://example.com/answer_url', 'answer_method' => 'POST', 'hangup_url' => 'http://example.com/hangup_url', 'hangup_method' => 'POST', 'fallback_url' => 'http://example.com/fallback_url', 'fallback_method' => 'POST'); $response = $p->create_subaccount_application($params); ?>
<?php require_once 'plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); // Fetch the details $response = $p->get_messages(); // Print the response print_r($response['response']); // Filter the response $params = array('limit' => '2', 'offset' => '0', 'message_direction ' => 'outbound', 'message_state' => 'sent', 'subaccount' => 'SubAccount_AUTH_ID'); // Fetch the details $response = $p->get_messages($params); // Print the response print_r($response['response']); ?> <!-- Sample Output without Filters ( [api_id] => f9adfd4a-a264-11e4-a2d1-22000ac5040c [meta] => Array ( [limit] => 2 [next] => /v1/Account/XXXXXXXXXXXXXXX/Message/?message_state=sent&limit=2&offset=2&message_direction+=outbound [offset] => 0 [previous] => [total_count] => 70 ) [objects] => Array ( [0] => Array ( [from_number] => 1111111111
<?php require_once 'plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); $params = array('record_id' => '6e699c0a-af55-11e4-91ce-377ffe01233f'); $response = $p->get_cdr($params); // Print the response print_r($response); /* Sample Output ( [status] => 200 [response] => Array ( [api_id] => 06b1b1cc-af5c-11e4-b153-22000abcaa64 [bill_duration] => 6 [billed_duration] => 60 [call_direction] => outbound [call_duration] => 6 [call_uuid] => 6e699c0a-af55-11e4-91ce-377ffe01233f [end_time] => 2015-02-08 09:43:52+04:00 [from_number] => +18583650866 [parent_call_uuid] => [resource_uri] => /v1/Account/XXXXXXXXXXXXXXX/Call/6e699c0a-af55-11e4-91ce-377ffe01233f/ [to_number] => 11111111111 [total_amount] => 0.03570 [total_rate] => 0.03570 ) ) */
/** * static public function for load user from session * @param string $prefix optional prefix for session publiciables * @return mixed DoceboUser instance of logged in user if found user in session * FALSE otherwise **/ public static function &createDoceboUserFromSession($prefix = 'base') { if (!isset($_SESSION['user_enter_time'])) { $_SESSION['user_enter_time'] = date('Y-m-d H:i:s'); } if (isset($_SESSION[$prefix . '_username'])) { $du = new DoceboUser($_SESSION[$prefix . '_username'], $prefix); if (isset($_SESSION['user_enter_mark'])) { if ($_SESSION['user_enter_mark'] < time() - REFRESH_LAST_ENTER) { $du->setLastEnter(date("Y-m-d H:i:s")); $_SESSION['user_enter_mark'] = time(); } } else { $du->setLastEnter(date("Y-m-d H:i:s")); $_SESSION['user_enter_mark'] = time(); } return $du; } else { // rest auth if (Get::sett('use_rest_api') != 'off') { require_once _base_ . '/api/lib/lib.rest.php'; if (Get::sett('rest_auth_method') == _REST_AUTH_TOKEN) { //require_once(_base_.'/lib/lib.utils.php'); $token = Get::req('auth', DOTY_ALPHANUM, ''); if ($token) { $id_user = RestAPI::getUserIdByToken($token); if ($id_user) { $user_manager = new DoceboACLManager(); $user_info = $user_manager->getUser($id_user, false); if ($user_info != false) { $username = $user_info[ACL_INFO_USERID]; $du = new DoceboUser($username, $prefix); $_SESSION['last_enter'] = $user_info[ACL_INFO_LASTENTER]; $du->setLastEnter(date("Y-m-d H:i:s")); $_SESSION['user_enter_mark'] = time(); $du->loadUserSectionST(); $du->SaveInSession(); return $du; } } } } } // kerberos and similar auth if (Get::sett('auth_kerberos') == 'on') { if (isset($_SERVER['REMOTE_USER'])) { // extract username $username = addslashes(substr($_SERVER['REMOTE_USER'], 0, strpos($_SERVER['REMOTE_USER'], '@'))); $user_manager = new DoceboACLManager(); $user_info = $user_manager->getUser(false, $username); if ($user_info != false) { $du = new DoceboUser($username, $prefix); $du->setLastEnter(date("Y-m-d H:i:s")); $_SESSION['user_enter_mark'] = time(); $du->loadUserSectionST(); $du->SaveInSession(); return $du; } } } $du = new DoceboUser('/Anonymous', $prefix); return $du; } }
?> <!--conf_callback.php--> <?php require_once "./plivo.php"; # Record API is called in the callback URL to record the conference $conf_name = $_REQUEST['ConferenceName']; $event = $_REQUEST['Event']; print "Conference Name : {$conf_name}"; print "Event : {$event}"; # The recording starts when the user enters the conference room if ($event == "ConferenceEnter") { $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); $params = array('conference_name' => $conf_name); $resp = $p->record_conference($params); print "URL : {$resp['response']['url']}"; print "Recording ID : {$resp['response']['recording_id']}"; print "API ID : {$resp['response']['api_id']}"; print "Message : {$resp['response']['message']}"; } else { print "invalid"; } /* Sample Output <Response> <Speak> You will now be placed into a demo conference. This is brought to you by Plivo. To know more visit us at plivo.com </Speak>
<?php require_once 'plivo-voicemail/plivo.php'; $auth_id = "MAYJDLMZEWODQWNTC5ZJ"; $auth_token = "NTY1N2VmN2E2ZTllYjhjYWRmYTNiOTk2MTJlNzA4"; $p = new RestAPI($auth_id, $auth_token); //Get Account $response = $p->get_account(); echo "<br>"; print_r($response); echo "</br>"; /* //Modify Account $params = array ( 'name' => 'Modified Name', 'city' => 'Modified City', 'address' => 'Changed Address', ); $response = $p->modify_account($params); //Create Subaccount $response = $p->create_subaccount(); //Get Subaccounts $response = $p->get_subaccounts(); //Delete Subaccount $params = array( 'subauth_id' => 'XXXXXXXXXXXXXXXXXXXX',
<?php require_once './plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); // Create an Endpoint $params = array('username' => 'Testing', 'password' => 'TestingCity', 'alias' => 'Sample address'); $response = $p->create_endpoint($params); // print_r ($response['response']); /* Sample Output ( [alias] => Sample address [api_id] => f800f950-ac43-11e4-ac1f-22000ac51de6 [endpoint_id] => 32969375408354 [message] => created [username] => Testing150204080105 ) */ // Get Details of all existing Endpoints $response = $p->get_endpoints(); // print_r ($response['response']); /* Sample Output ( [api_id] => 13632e02-ac44-11e4-b423-22000ac8a2f8 [meta] => Array ( [limit] => 20 [next] => [offset] => 0
$r->addWait($waitparam); Header('Content-type: text/xml'); echo $r->toXML(); ?> <!-- 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>
<?php require_once './plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); // Create an Application $params = array('answer_url' => 'http://example.com', 'app_name' => 'Testing'); $response = $p->create_application($params); // print_r ($response['response']); /* Sample Output ( [api_id] => ad7a2eb8-ac45-11e4-b932-22000ac50fac [app_id] => 23061826722302672 [message] => created ) */ // Get Details of all existing Applications $response = $p->get_applications(); // print_r ($response['response']); /* Sample Output ( [api_id] => cff47926-ac45-11e4-b153-22000abcaa64 [meta] => Array ( [limit] => 20 [next] => [offset] => 0 [previous] => [total_count] => 2
$waitparam = array('length' => '10'); $r->addWait($waitparam); Header('Content-type: text/xml'); echo $r->toXML(); ?> <!--speak_action.php--> <?php require_once "./plivo.php"; $r = new Response(); $digit = $_REQUEST['Digits']; $call_uuid = $_REQUEST['CallUUID']; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); if ($digit == "1") { $params = array('call_uuid' => $call_uuid, 'text' => 'Hello from Speak API', 'voice' => 'WOMAN', 'language' => 'en-GB'); $resp = $p->speak($params); print_r($resp); } else { print "WrongInput"; } /* Sample Output <Response> <GetDigits action="http://morning-ocean-4669.herokuapp.com/speak_action/" method="GET" numDigits="1" redirect="false" retries="1" timeout="7"> <Speak>Press 1 to listen to a message</Speak> </GetDigits> <Wait length="10" /> </Response>
<?php require_once "./plivo.php"; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); $response = $p->get_cdrs(); // print_r ($response); /* Sample Output ( [status] => 200 [response] => Array ( [api_id] => 22852b7c-ae03-11e4-a2d1-22000ac5040c [meta] => Array ( [limit] => 20 [next] => /v1/Account/XXXXXXXXXXXXXXX/Call/?limit=20&offset=20 [offset] => 0 [previous] => [total_count] => 124 ) [objects] => Array ( [0] => Array ( [bill_duration] => 8 [billed_duration] => 60 [call_direction] => outbound [call_duration] => 8 [call_uuid] => dd9b3414-adc8-11e4-aed8-377ffe01233f [end_time] => 2015-02-06 10:25:20+04:00 [from_number] => [parent_call_uuid] => d66cc0a4-adc8-11e4-ac44-377ffe01233f [resource_uri] => /v1/Account/XXXXXXXXXXXXXXX/Call/dd9b3414-adc8-11e4-aed8-377ffe01233f/
<?php require_once "./plivo.php"; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); $params = array('call_uuid' => 'fcef9018-aec6-11e4-8449-c73b3246dc2a'); // Get all Live Calls $response = $p->get_live_call($params); print_r($response); /* Sample Output ( [status] => 200 [response] => Array ( [calls] => Array ( [0] => a60f44dc-926f-11e4-82f5-b559cbfe39b9 [1] => af399206-926f-11e4-8b6f-fd067af138be ) [api_id] => 44abd2a4-aec7-11e4-ac1f-22000ac51de6 ) ) */ $uuids = $response['response']['calls']; // Looping through the call uuids foreach ($uuids as $value) { print_r("Calls : {$value} <br>"); } /* Sample Output Calls : a60f44dc-926f-11e4-82f5-b559cbfe39b9
<?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);
break; } header('Content-type:' . $content_type . '; charset=utf-8'); $rest_obj = false; $rest_module = $rest_params[_REST_APINAME_INDEX]; //the module specification $rest_function = $rest_params[_REST_APIMETHOD_INDEX]; //the name of module's method to call // extract additional parameters from GET string, void and outputtype parameter should be already avoided $i = _REST_APIMETHOD_INDEX + 1; $rest_subparams = array(); while ($i < count($rest_params)) { //$numparams) { $rest_subparams[] = $rest_params[$i]; $i++; } $res = API::Execute($auth_code, $rest_module, $rest_function, $rest_subparams); if (!$res['success']) { $err_msg = $res['message']; rest_cout(RestAPI::HandleError($err_msg, $GLOBALS['REST_API_ACCEPT'])); } else { rest_cout(RestAPI::HandleOutput($res, $GLOBALS['REST_API_ACCEPT'])); } // finalize Boot::finalize(); //clear debug messages and clean buffer for output $debug = ob_get_contents(); ob_clean(); echo $GLOBALS['output']; // flush buffer ob_end_flush();
<?php require_once '../plivo.php'; $auth_id = "XXXXXXXXXXXXXXXXXXXXXXXXX"; $auth_token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $p = new RestAPI($auth_id, $auth_token); // Get Live Conferences $p->get_live_conferences(); // Get Live conference $params = array('conference_name' => 'XXXXXXXXXXXXXXXXXXXX'); $p->get_live_conference($params); // Hangup Conference $params = array('conference_name' => 'XXXXXXXXXXXXXXXXXXXX'); $p->hangup_conference($params); // Hangup Member $params = array('conference_name' => 'XXXXXXXXXXXXXXXXXXXX', 'member_id' => 'MMMMMMMMMMMMM'); $p->hangup_member($params); // Record Conference $params = array('conference_name' => 'XXXXXXXXXXXXXXXXXXXX'); $p->record_conference($params); // Stop Recording Conference $params = array('conference_name' => 'XXXXXXXXXXXXXXXXXXXX'); $p->stop_record_conference($params); // Get Recordings $p->get_recordings();
<?php require_once './plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); # Link an application to a number $params = array('number' => '1111111111', 'app_id' => '16638156474000802'); #$response = $p->link_application_number($params); #print_r ($response); /* Sample Output ( [status] => 202 [response] => Array ( [api_id] => 3ca792ba-b68c-11e4-af95-22000ac54c79 [message] => changed ) ) */ # Unlink an application from an number $params = array('number' => '1111111111'); $response = $p->unlink_application_number($params); print_r($response); /* Sample Output ( [status] => 202 [response] => Array (
/** * send sms and return the status . * * @param $auth_id, $auth_token * @return response status */ private function sendMessage($auth_id, $auth_token) { // Set message parameters $params = array('src' => $this->src, 'dst' => $this->dest, 'text' => $this->txt, 'url' => $this->returnBackUrl, 'method' => 'POST'); $sendsms = new \RestAPI($this->auth_id, $this->auth_token); $response = $sendsms->send_message($params); if ($sendsms->send_message($params)) { return "Message sent successfully"; } else { return "Message sending failed"; } }
<?php require_once 'plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); $params = array('record_id' => '0936ec98-7c4c-11e4-9bd8-22000afa12b9'); // Fetch the details $response = $p->get_message($params); // Print the response print_r($response['response']); // Print the number of SMS units print "Units : {$response['response']['units']}"; // Print the status of the message print "Message State : {$response['response']['message_state']}"; ?> <!-- Sample Output ( [api_id] => 0a7cf0e6-a264-11e4-a2d1-22000ac5040c [from_number] => 1111111111 [message_direction] => outbound [message_state] => delivered [message_time] => 2014-12-05 10:57:54+04:00 [message_type] => sms [message_uuid] => 0936ec98-7c4c-11e4-9bd8-22000afa12b9 [resource_uri] => /v1/Account/XXXXXXXXXXXX/Message/0936ec98-7c4c-11e4-9bd8-22000afa12b9/ [to_number] => 2222222222 [total_amount] => 0.02600 [total_rate] => 0.00650
<form action="send_sms_from_browser.php" method="post"> From No:<input type="text" name="From"><br><br> To No:<input type="text" name="To"><br><br> Message:<br> <textarea name="Text" rows="3" cols="30" >Message Text</textarea><br><br> <input type="submit" value="Send SMS"> </form> <?php if (isset($_POST['From'])) { require_once 'plivo-voicemail/plivo.php'; $to = $_POST['To']; $from = $_POST['From']; $text = $_POST['Text']; echo "<br/>Sent Message info:<br/><br/>To: {$to}<br/>"; echo "From: {$from} <br/>"; echo "Message: {$text} <br/>"; $auth_id = "Your AUTHID"; $auth_token = "Your AUTHTOKEN"; $p = new RestAPI($auth_id, $auth_token); // Send a message $params = array('src' => "{$from}", 'dst' => "{$to}", 'text' => "{$text}", 'type' => 'sms'); $response = $p->send_message($params); echo $response[0]; if (array_shift(array_values($response)) == "202") { echo "<br/><br/>Message status: Sent"; } else { echo "<br/><br/>Error: Please ensure that From number is a valid and sms feature enabled Plivo DID number"; } }
<?php require_once '../plivo.php'; $auth_id = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"; $auth_token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $p = new RestAPI($auth_id, $auth_token); // Get Numbers $response = $p->get_numbers(); // Search Numbers $params = array('contains' => '67'); $response = $p->search_numbers($params); // Rent a number $params = array('number' => '12121212121'); $response = $p->rent_number($params); // Unrent a number $params = array('number' => '12121212121'); $response = $p->unrent_number($params); // Link application to number $params = array('number' => '12121212121', 'app_id' => 'XXXXXXXXXXX'); $response = $p->link_application_number($params); // Get Subaccount numbers $params = array('subauth_id' => 'AAAAAAAAAAAAAAAA'); $response = $p->get_subaccount_numbers($params);
<?php require_once "plivo.php"; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); # API ID is returned for every API request. # Request UUID is request id of the call. This ID is returned as soon as the call is fired irrespective of whether the call is answered or not $params = array('to' => '2222222222', 'from' => '1111111111', 'answer_url' => "https://glacial-harbor-8656.herokuapp.com/testing.php/speak", 'answer_method' => "GET"); # Make an outbound call $response = $p->make_call($params); puts("API ID : #{$response['api_id']}"); puts("Request UUID : #{$response['request_uuid']}"); /* Sample Output API ID : 32cba792-ae01-11e4-b153-22000abcaa64 Request UUID : 5b2db3d3-f478-4b63-992c-e47c527572e8 */ # Call UUID is th id of a live call. This ID is returned only after the call is answered. $params1 = array('status' => 'live'); # Get the details of all live calls $response = $p->get_live_calls($params1); $uuids = $response['response']['calls']; // Looping through the call uuids foreach ($uuids as $value) { print_r("Call UUID : {$value} <br>"); } /* Sample Output Call UUID : a60f44dc-926f-11e4-82f5-b559cbfe39b9 Call UUID : af399206-926f-11e4-8b6f-fd067af138be
<?php require_once "./plivo.php"; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); $plivo_number = "1111111111"; $params = array('to' => '1111111111<2222222222', 'from' => $plivo_number, 'answer_url' => "https://glacial-harbor-8656.herokuapp.com/testing.php/response/conference", 'answer_method' => "GET"); $response = $p->make_call($params); print_r($response); /* Sample Output ( [status] => 201 [response] => Array ( [api_id] => 8b32b934-af6e-11e4-b153-22000abcaa64 [message] => calls fired [request_uuid] => Array ( [0] => d1187266-b5e8-4a1d-bd8d-b0a4395f08f6 [1] => 0c88ed10-fde4-4e6e-8c7c-08ebeee5e856 ) ) ) */
<?php require_once './plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); # Get all numbers $params = array('limit' => '10', 'offset' => '0'); #$response = $p->get_numbers($params); #print_r ($response); /* Sample Output ( [status] => 200 [response] => Array ( [api_id] => b5b9e238-b688-11e4-ac1f-22000ac51de6 [meta] => Array ( [limit] => 10 [next] => [offset] => 0 [previous] => [total_count] => 2 ) [objects] => Array ( [0] => Array ( [active] => 1
* * XenAPI is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * XenAPI is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // To change the API key, replace the REPLACE_THIS_WITH_AN_API_KEY with your desired API key. $restAPI = new RestAPI('REPLACE_THIS_WITH_AN_API_KEY'); # DO NOT CHANGE ANYTHING BELOW THIS LINE UNLESS # YOU REALLY KNOW WHAT ARE YOU DOING // Process the request if ($restAPI->getAPIKey() !== NULL && $restAPI->isDefaultAPIKey()) { // API is set but not changed from the default API key. $restAPI->throwError(17); } else { if ($restAPI->getAPIKey() !== NULL && !$restAPI->hasRequest('hash') && !$restAPI->isPublicAction()) { // Hash argument is required and was not found, throw error. $restAPI->throwError(3, 'hash'); } else { if (!$restAPI->getHash() && !$restAPI->isPublicAction()) { // Hash argument is empty or not set, throw error. $restAPI->throwError(1, 'hash'); } else {
<?php require_once './plivo.php'; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); $params = array('country_iso' => 'GB'); $response = $p->pricing($params); print_r($response); /* Sample Output ( [status] => 200 [response] => Array ( [api_id] => 36d239fa-ac4e-11e4-96e3-22000abcb9af [country] => United Kingdom [country_code] => 44 [country_iso] => GB [message] => Array ( [inbound] => Array ( [rate] => 0.00000 ) [outbound] => Array ( [rate] => 0.03680 ) [outbound_networks_list] => Array ( [0] => Array ( [group_name] => United Kingdom - All [rate] => 0.03680 ) ) ) [phone_numbers] => Array ( [local] => Array (