/** * <h4>2. Send a SMS</h4> * <p>Method description</p> */ try { // Sender $sender = "THECALLR"; // Recipient phone number (E.164 format) $to = "__PHONENUMBER__"; // SMS text $text = "This is my first SMS with THECALLR API :)"; // Options $options = new stdClass(); $options->flash_message = FALSE; // "sms.send" method execution $result = $THECALLR->call('sms.send', $sender, $to, $text, $options); // The method returns the SMS ID echo 'SMS ID : ' . $result . '<br />'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>3. SMS sent list</h4> * <p>Method description</p> */ try { // WARNING // All the dates are GMT/UTC. Your country time offset is not handled date_default_timezone_set('UTC'); // SMS type $type = "OUT";
$app_params->medias->welcome = 84; // Played immediately to the caller $app_params->medias->ringtone = 3; // Played while the target is ringing $app_params->medias->whisper = 0; // Played to the target only (callee whispering) $app_params->medias->bridge = 0; // Played to both parties before bridging the call // Recipient array initialization (several recipients can be called simultaneously) $app_params->targets = array(); // Add a recipient // Recipient phone number must follow international format // Timeout parameter is the ringing timeout in seconds $app_params->targets[] = array('number' => '__PHONENUMBER__', 'timeout' => 20); // Application creation and ID recovery $app = $THECALLR->call('apps.create', $app_type, $app_name, $app_params); $app_id = $app->hash; // ID display echo 'CallTracking application ID : ' . $app_id . '<br />'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>3. Available Did recovery</h4> * <p>This step lists all available dids in order to assign the first one to the application.<br /> * You can also use an available did of your choice.</p> */ try { // The method argument allows you to retrieve only available DIDs $only_available = TRUE; // Method execution
/** * <h4>2. Outbound SMS Analytics (summary)</h4> * <p>Note : "credit" and "debit" fields are in EUR cents.</p> */ try { // WARNING // All the dates are GMT/UTC. Your country time offset is not handled date_default_timezone_set('UTC'); // Start date (included) $from = date('Y-m-d 00:00:00'); // Today at 00h00 // End date (included) $to = date('Y-m-d 23:59:59'); // Today at 23h59 // "analytics/sms.summary" method execution $sms = $THECALLR->call('analytics/sms.summary', $from, $to); // SMS Analytics display echo '<pre>'; print_r($sms); echo '</pre>'; // Outbound SMS statuses $sms_by_status = $THECALLR->call('analytics/sms.summary_out_by_status', $from, $to); // display SMS Analytics echo '<pre>'; print_r($sms_by_status); echo '</pre>'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>3. Outbound SMS Analytics over time (by hour, day, month)</h4>
// Media configuration for both interlocutors $app_params->medias = new stdClass(); $app_params->medias->A_welcome = 84; // Played to A immediately $app_params->medias->A_ringtone = 3; // Played to A while calling B $app_params->medias->B_whisper = 0; // Played to B only (A still hears the ringtone) $app_params->medias->AB_bridge = 0; // Played to both parties before bridging the call // Call attempts if A is not answering $app_params->A_attempts = 1; // Pause between attempts $app_params->A_retrypause = 30; // Application creation and ID recovery $app = $THECALLR->call('apps.create', $app_type, $app_name, $app_params); $app_id = $app->hash; // Application ID display echo 'ClickToCall application ID : ' . $app_id . '<br />'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>3. Start a call</h4> * <p>On your website, a user will have to fill in his phone number and optionaly the date and time he wants to be called back. * Those data will be then sent to THECALLR WebService using "<b>clicktocall/calls.start_2</b>" method.<br /> * You can cancel a call with "<a href="api/services/clicktocall/calls/#clicktocall/calls.cancel"><b>clicktocall/calls.cancel</b></a>" method.</p> */ try { // WARNING // Executing this method will make the call.
} elseif ($msg == "Tracking") { $text = "* Vérifier GPS et DATA à ON\r\n* Cliquer le lien " . $urlSMS . "/trace?c=" . $lastid . "\r\n* Accepter le partage\r\n" . $unite; } //envoi SMS et récupération du hash d'envoi // require('/js/thecallR/src/ThecallrClient.php'); $config = APP::getInstance()->config['thecallr']; $thecallrLogin = $config['login']; $thecallrPassword = $config['password']; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); $settings = $config['settings']; $res = $THECALLR->send($config['order']['set'], array($settings)); // Options $options = new stdClass(); $options->flash_message = FALSE; // "sms.send" method execution $result = $THECALLR->call($config['order']['send'], $sender, $tel, $text, $options); // The method returns the SMS ID $nModif = $DB->setSmsSend($lastid, $result); if ($nModif != 1) { throw new Exception("l'envoi du sms a échoué"); } // Renvoi au navigateur du succès de l'envoi du sms $html = '</br> <table id="sms-table"> <thead> <!-- En-tête du tableau --> <tr> <th>TEL</th> <th>STATUT</th> <th style="display:none;">HASH</th> </tr> </thead>
$THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <h4>2. Retrieve detailed inbound and outbound CDR</h4> */ try { // WARNING // All the dates are GMT/UTC. Your country time offset is not handled date_default_timezone_set('UTC'); // Call type (IN ou OUT) $type = 'IN'; // Start date (included) $from = date('Y-m-d 00:00:00'); // Today at 00h00 // End date (included) $to = date('Y-m-d 23:59:59'); // Today at 23h59 // Application ID or NULL if you want to retrieve all CDR $app = NULL; // DID ID (IN) or number (OUT) or NULL to retrieve all CDR $number = NULL; // "cdr.get" method execution $cdr = $THECALLR->call('cdr.get', $type, $from, $to, $app, $number); // CDR display echo '<pre>'; print_r($cdr); echo '</pre>'; } catch (Exception $error) { die($error->getMessage()); } ?> </pre>
$thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <h4>2. Upload a media in library</h4> * <p>Message creation follows several steps:<br /> * - 1/ Media creation.</li><br /> * - 2/ Content load or definition.<br /> * - 3/ Assign one or more keywords.<br /> * About audio media, please see <a href="api/services/media/#media.set_content"> documentation</a>.</p> */ try { // 1. Media definition $msg_name = 'My test media with audio file'; // Media creation and ID recovery $msg_id_01 = $THECALLR->call('media.create', $msg_name); // 2. Content definition $file_text_content = 'Waiting music 01'; // Audio file content recovery $file_content = file_get_contents('assets/Media_sample.wav'); // Base 64 content encoding $file_encoded = base64_encode($file_content); // Assign the content to the created media $content = $THECALLR->call('media.set_content', $msg_id_01, $file_text_content, $file_encoded); // 3. Keywords definition $keywords = new stdClass(); $keywords->CATEGORY = array('WELCOME', 'RINGTONE'); // Category tag $keywords->VERSION = array('1'); // Custom tag $keywords->SOURCE = array('SDKexample');
// Room limits $app_params->limits = new stdClass(); $app_params->max_duration = 3600; // In seconds (0 = unlimited) $app_params->max_connected = 0; // 0 = unlimited // Room audio recording $app_params->recording = 'OFF'; // AUTO - MANUAL // Is the room open or not? $app_params->open = TRUE; // Room access points $room_access = array(); // see next step // Room creation $room = $THECALLR->call('conference/10.create_room', $app_name, $app_params, $room_access); // Show room echo '<pre>'; print_r($room); echo '</pre>'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>3. Room access points</h4> * <p>Description</p> */ try { // Previously created room $room_hash = $room->hash; // First room access
* <h4>2. Requirements</h4> */ try { // This method will check your environment and throw an Exception if something is wrong $result = $THECALLR->check_configuration(); // Response echo 'Your server completed all requirements.<br />'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>3. Method execution without parameters</h4> */ try { // The "system.get_timestamp" method returns THECALLR server timestamp $result = $THECALLR->call('system.get_timestamp'); // Response display echo 'TheCallr server time : ' . date('Y-m-d H:i:s', $result) . '<br />'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>4. Method execution with one parameter</h4> */ try { // 1. "call" method: each parameter of the method to execute is provided as an argument $result = $THECALLR->call('apps.get_list', TRUE); // 2. "send" method: all parameters of the method to execute are provided as an array $result = $THECALLR->send('apps.get_list', array(TRUE)); // Response display echo '<pre>';
/** * <h4>2. Global Analytics (summary)</h4> * <p>Note : "credit" and "debit" fields are in EUR cents.</p> */ try { // WARNING // All the dates are GMT/UTC. Your country time offset is not handled date_default_timezone_set('UTC'); // Start date (included) $from = date('Y-m-d 00:00:00'); // Today at 00h00 // End date (included) $to = date('Y-m-d 23:59:59'); // Today at 23h59 // "analytics/calls.summary" method execution $calls = $THECALLR->call('analytics/calls.summary', $from, $to); // display Calls Analytics echo '<pre>'; print_r($calls); echo '</pre>'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>3. Calls Analytics over time (by hour, day or month depending on the range)</h4> * <p>Note : "credit" and "debit" fields are in EUR cents.</p> */ try { // WARNING // All the dates are GMT/UTC. Your country time offset is not handled date_default_timezone_set('UTC');
// Application type is THEDIALR20 $app_type = 'THEDIALR20'; // Application name $app_name = 'My first Dialer app'; // Your webservice access parameters $app_params = new stdClass(); $app_params->url = '__YOURSERVER__/SDK/realtimeExtendedServer.php'; // Your URL callback. Our system will POST call status to your URL, and your answers will control the call $app_params->data_format = 'JSON'; // Data format. The only format supported right now is "JSON" $app_params->login = '******'; // Login if your URL is password protected (HTTP Basic Authentication) $app_params->password = '******'; // Password If your URL is password protected (HTTP Basic Authentication) // Application creation and ID recovery $app = $THECALLR->call('apps.create', $app_type, $app_name, $app_params); $app_id = $app->hash; // Application ID display echo 'Voice Dialer application ID : ' . $app_id . '<br />'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>3. Make outbound call from THECALLR</h4> * <p>For outbound calls, ...</p> */ try { // WARNING // All the dates are GMT/UTC. Your country time offset is not handled date_default_timezone_set('UTC'); // Application ID. Application type must be THEDIALR20
// Application type is REALTIME10 $app_type = 'REALTIME10'; // Application name $app_name = 'My first realtime app'; // Your webservice access parameters $app_params = new stdClass(); $app_params->url = '__YOURSERVER__/SDK/realtimeExtendedServer.php'; // Your URL callback. Our system will POST call status to your URL, and your answers will control the call $app_params->data_format = 'JSON'; // Data format. The only format supported right now is "JSON" $app_params->login = '******'; // Login if your URL is password protected (HTTP Basic Authentication) $app_params->password = '******'; // Password If your URL is password protected (HTTP Basic Authentication) // Application creation and ID recovery $app = $THECALLR->call('apps.create', $app_type, $app_name, $app_params); $app_id = $app->hash; // Application ID display echo 'Realtime application ID : ' . $app_id . '<br />'; } catch (Exception $error) { die($error->getMessage()); } /** * <h4>3. Make outbound call from THECALLR</h4> * <p>For outbound calls, ...</p> */ try { // WARNING // All the dates are GMT/UTC. Your country time offset is not handled date_default_timezone_set('UTC'); // Application ID. Application type must be REALTIME10