<pre> <?php /** * <h3>B. Send SMS</h3> * <p>Documentation of methods and parameters not used in this example are available <a href="api/services/sms">here</a>.</p> */ /** * <h4>1. Client initialization and configuration</h4> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <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 />';
<pre> <?php /** * <h3>C. Create a Call Tracking Voice App</h3> * * */ /** * <h4>1. Client initialization and configuration</h4> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <h4>2. Application creation</h4> * <p>Step description</p> */ try { // A CallTracking application has the CALLTRACKING10 type $app_type = 'CALLTRACKING10'; // Application name $app_name = 'My first CallTraking app'; // Application parameters $app_params = new stdClass(); // Media configuration $app_params->medias = new stdClass(); $app_params->medias->welcome = 84; // Played immediately to the caller $app_params->medias->ringtone = 3; // Played while the target is ringing
<pre> <?php /** * <h3>I. SMS Analytics</h3> */ /** * <h4>1. Client initialization and configuration</h4> * <p>Your credentials are the ones you use with https://thecallr.com/s/</p> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <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>';
<pre> <?php /** * <h3>D. Make a ClickToCall application</h3> * <p>ClickToCall is also known as "Web Callback"</p> */ /** * <h4>1. Client initialization and configuration</h4> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <h4>2. Application creation</h4> */ try { // A ClickToCall application has the CLICKTOCALL10 type $app_type = 'CLICKTOCALL10'; // Application name $app_name = 'My first ClickToCall app'; // Application parameters $app_params = new stdClass(); // 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)
$DB = new Database(); $lastid = $DB->addSmsLock($unite, $msg, $lang, $tel, $val); $urlSMS = APP::getInstance()->config['url']; //génération texte suivant msg langue et code $sender = "GENDLOC"; if ($msg == "Geoloc") { $text = "* Vérifier GPS et DATA à ON\r\n* Cliquer le lien " . $urlSMS . "/pos?c=" . $lastid . "\r\n* Accepter le partage\r\n* Patienter\r\n" . $unite; } 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">
<pre> <?php /** * <h3>G. Retrieve your CDR</h3> */ /** * <h4>1. Client initialization and configuration</h4> * <p>Your credentials are the ones you use with https://thecallr.com/s/</p> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $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
<pre> <?php /** * <h3>K. Manage audio media</h3> */ /** * <h4>1. Client initialization and configuration</h4> */ require '../src/ThecallrClient.php'; $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);
<pre> <?php /** * <h3>F. Manager Conference rooms</h3> */ /** * <h4>1. Client initialization and configuration</h4> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <h4>2. Create conference app</h4> * <p>Description</p> */ try { // Room name $app_name = 'My first conference room'; // Room parameters $app_params = new stdClass(); // Room media $app_params->medias = new stdClass(); $app_params->medias->welcome = 109753; $app_params->medias->pin_ask = 109756; $app_params->medias->pin_invalid = 109757; // Room limits $app_params->limits = new stdClass(); $app_params->max_duration = 3600; // In seconds (0 = unlimited) $app_params->max_connected = 0;
<pre> <?php /** * <h3>A. Quick Start</h3> */ /** * <h4>1. Include the Library and edit your credentials</h4> * <p>Your credentials are the ones you use with https://thecallr.com/s/</p> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <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
<pre> <?php /** * <h3>H. Calls Analytics</h3> */ /** * <h4>1. Client initialization and configuration</h4> * <p>Your credentials are the ones you use with https://thecallr.com/s/</p> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <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>';
<pre> <?php /** * <h3>E. Make a real time application</h3> * <p> Like VoiceXML, Real-Time allows you to monitor your inbound and outbound calls thanks to a WebService you provide.<br /> * Some server examples are available in this SDK (see "<b>realtimeBasicServer.php</b>" and "<b>realtimeExtendedServer.php</b>")</p> */ /** * <h4>1. Client initialization and configuration</h4> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <h4>2. Application creation</h4> * <p>Real time application management is available through "<b>thedialr</b>" service.<br /> * The only application type valid for this service is "THEDIALR20".</p> */ try { // 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 = '******';
<pre> <?php /** * <h3>E. Make a REAL-TIME application</h3> * <p> Like VoiceXML, Real-Time allows you to monitor your inbound and outbound calls thanks to a WebService you provide.<br /> * Some server examples are available in this SDK (see "<b>realtimeBasicServer.php</b>" and "<b>realtimeExtendedServer.php</b>")</p> */ /** * <h4>1. Client initialization and configuration</h4> */ require '../src/ThecallrClient.php'; $thecallrLogin = '******'; $thecallrPassword = '******'; $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword); /** * <h4>2. Application creation</h4> * <p>Real time application management is available through "<b>dialr</b>" service.<br /> * The only application type valid for this service is "REALTIME10".</p> */ try { // 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 = '******';