function initcall() { if ($_REQUEST["CallStatus"] == "completed") { // receives request from Twilio server when a call ends // remove call from active calls // saves call info in DB as current call $callGuid = $_REQUEST["CallGuid"]; $db = new PDO("sqlite:twilio.db"); $query = "UPDATE Calls SET Status = 'ended' WHERE CallGuid = '{$callGuid}'"; $db->exec($query); } else { // dial all saved numbers for your account $numbers = getNumbersToCall(); // get numbers $r = new Response(); for ($i = 0; $i < count($numbers); $i++) { $r->addDial($numbers[$i]); } $r->Respond(); // saves call info in DB as current call $callGuid = $_REQUEST["CallGuid"]; $caller = $_REQUEST["Caller"]; $callLocation = $_REQUEST["CallerCity"] != "" ? $_REQUEST["CallerCity"] : ($_REQUEST["CallerState"] != "" ? $_REQUEST["CallerState"] : ($_REQUEST["CallerZip"] != "" ? $_REQUEST["CallerZip"] : ($_REQUEST["CallerCountry"] != "" ? $_REQUEST["CallerCountry"] : ""))); $db = new PDO("sqlite:twilio.db"); $query = "INSERT INTO Calls (CallGuid, Caller, Location, Status) VALUES ('{$callGuid}', '{$caller}', '{$callLocation}', 'active')"; $db->exec($query); } }
function connect($number, $ext) { header('X-WP-Click2Call: ' . WP_CLICK2CALL_VERSION); $twilio = new Response(); $greeting = get_option('wpc2c_custom_greeting'); if (!empty($greeting)) { $twilio->addSay($greeting); } $dial = $twilio->addDial(); $dial_options = array(); if (!empty($ext)) { $dial_options = array('sendDigits' => $ext); } $dial->addNumber($number, $dial_options); $twilio->Respond(); }
<?php header("Content-type: text/xml\n"); error_reporting(E_NONE); include "chirbit.php"; $user = AppletInstance::getUserGroupPickerValue('chirbit-controller'); $user_id = $user->values["id"]; $chirbit_username = PluginStore::get("chirbit_username_{$user_id}", ""); $chirbit_password = PluginStore::get("chirbit_password_{$user_id}", ""); $prompt = AppletInstance::getAudioSpeechPickerValue('prompt'); $after = AppletInstance::getAudioSpeechPickerValue('after'); $title = AppletInstance::getValue("title", ""); $response = new Response(); if (isset($_REQUEST['RecordingUrl'])) { chirbit_post($chirbit_username, $chirbit_password, $_REQUEST['RecordingUrl'], $title); $verb = AudioSpeechPickerWidget::getVerbForValue($after, null); $response->append($verb); $response->addHangup(); } else { $verb = AudioSpeechPickerWidget::getVerbForValue($prompt, null); $response->append($verb); $response->addRecord(); } $response->Respond();
<?php // Include the PHP Plivo Rest library require "./plivohelper.php"; $base_http = "http://" . dirname($_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"]); /* Render RESTXML */ $r = new Response(); $r->addRecord(array('timeout' => 5, 'finishOnKey' => "#", 'maxLength' => 30, 'playBeep' => 'true', 'filePath' => '/tmp')); $r->Respond();
function connect($number) { $twilio = new Response(); $twilio->addDial($number); $twilio->Respond(); }