Skip to content

Instantly share code, notes, and snippets.

View dice's full-sized avatar
🤸‍♂️
Not CartWheeling

Daisuke Don Horie dice

🤸‍♂️
Not CartWheeling
View GitHub Profile
@dice
dice / handle_incoming_call.php
Created July 29, 2012 12:04
PHP code snippet for FullCourt Call Tracking Sample Code
<?php
require_once("./include/config.php");
header("Content-type: text/xml");
$db = new DB();
$db->save_call();
?>
<Response>
<Dial callbackUrl="http://dev.fullcourt.co/FullCourt-Call-Tracking/record_call.php" method="POST" callerId="815058383124">
<Number><?php echo(AGENT_NUMBER);?></Number>
</Dial>
@dice
dice / db.php
Created July 29, 2012 12:18
PHP code snippet for FullCourt Call Tracking Sample Code
function save_call() { //https://www.fullcourt.co/ja/docs/PhoneXML/request
$CallTo = $_REQUEST['To'];
$CallFrom=$_REQUEST['From'];
$DialCallDuration=$_REQUEST['variable_billsec'];
$Direction=$_REQUEST['Direction'];
$CallerName=$_REQUEST['CallerName'];
$CallSid = $_REQUEST['CallUUID'];
$CallStatus=$_REQUEST['CallStatus'];
$DialCallSid='';
$stmt = $this->db->prepare('INSERT INTO calls (DateCreated,CallSid,CallFrom,CallTo,CallStatus,Direction,CallerName,DialCallDuration,DialCallSid) VALUES (DATETIME('now','localtime'),?,?,?,?,?,?,?,?)');
@dice
dice / record_call.php
Created July 29, 2012 12:23
PHP code snippet for FullCourt Call Tracking Sample Code
<?php
require_once('./include/config.php');
header('Content-type: text/xml');
$db = new DB();
$db->saved_call();
?>
<Response/>
<form class="well" method="post" action="sendsms.php">
<div class="control-group">
<label class="control-label" for="inputIcon">Sender Id</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-envelope"></i></span><input class="span2" id="inputIcon" type="text" name="sender" placeholder="eg.FullCourt">
</div>
</div>
<label class="control-label" for="inputIcon">Mobile Phone Number</label>
<div class="controls">
<?php
require "../Services/fullcourt.php";
$from= $_REQUEST['sender'];
$to= $_REQUEST['number'];
$body = $_REQUEST['msg'];
$auth_id = "FCabcdefghijklmnopqrstuvwxyz123456";
$auth_token = "1234567890qwertyuiosdfghjklxcvbnmd";
$p = new RestAPI($auth_id, $auth_token);
// Send SMS
$params = array(
@dice
dice / functions.php
Created August 20, 2012 06:28
PHP code snippet for FullCourt SMS Authentication Sample Code
function user_generate_token($username, $phoneNum){
global $accountsid, $authtoken, $fromNumber;
// Create a new password
$password = substr(md5(time().rand(0, 10^10)), 0, 5);
// Store the username and password.
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
/* Set our AccountSid and AuthToken */
$accountsid= "FC20f8676ba75a63ba452784ca5858d217";
$authtoken= "ocYw1LU8A9w64uztN5dKPzwrNH9ynmuXtx";
@dice
dice / functions.php
Created August 20, 2012 06:37
PHP code snippet for FullCourt SMS Authentication Sample Code
function user_login($username, $submitted) {
// Retrieve the stored password
$stored = $_SESSION['password'];
// Compare the retrieved vs the stored password
if ($stored == $submitted) {
$message = "Hello and welcome back $username";
} else {
$message = "Sorry, that's an invalid username and password combination.";
}
// Clean up after ourselves
@dice
dice / process.php
Created August 20, 2012 06:40
PHP code snippet for FullCourt SMS Authentication Sample Code
<?php
include 'functions.php';
/*
* First we retrieve each of the relevant variables and remove any
* non-alphanumeric characters filter them to protect against things such
* as SQL Injection.
*/
$username = isset($_POST['username']) ? $_POST['username'] : '';
$username = preg_replace("/[^A-Za-z0-9]/", "", $username);
$password = isset($_POST['password']) ? $_POST['password'] : '';
@dice
dice / index.php
Created August 20, 2012 06:43
PHP code snippet for FullCourt SMS Authentication Sample Code
<?php
session_start();
?>
<html>
<head>
<title>Two Factor Authentication Demo</title>
<style>
.center {
margin-left: auto;
margin-right: auto;
@dice
dice / allapplications.json
Created September 28, 2012 07:06
List All FullCourt Applications Response
{
"Message": [
{
"VoiceURL": "http://test.com",
"APIVersion": "v0.1",
"DateCreated": "Mon, 11 Jun 2012 09:06:22 +0900",
"VoiceMethod": "",
"Sid": "PXdf37a0ebc71e93dcaee5547f5d5e65b9",
"FriendlyName": "TestTestTest",
"AccountSid": "FC2a73d65733d71b8249e39ab4d1254414",