Skip to content

Instantly share code, notes, and snippets.

View mheadd's full-sized avatar

Mark Headd mheadd

View GitHub Profile
@mheadd
mheadd / record-conference.js
Created March 16, 2011 17:04
A Tropo scripting app for recording a conference call.
// Start recording the conference call.
startCallRecording('http://url-for-your-server/record.php', { format: 'audio/mp3' });
// Welcome the caller to the conference.
say('Welcome to the conferene line. Press the star key to exit.');
// Start the conference.
conference('1234567', {
terminator : "*",
mute : false,
{
"in_reply_to_screen_name": null,
"in_reply_to_user_id": null,
"text": "I'm at Telephony Is Sexy. http:\/\/4sq.com\/eLfv6I",
"in_reply_to_status_id_str": null,
"contributors": null,
"retweeted": false,
"in_reply_to_user_id_str": null,
"retweet_count": 0,
"source": "\u003Ca href=\"http:\/\/foursquare.com\" rel=\"nofollow\"\u003Efoursquare\u003C\/a\u003E",
@mheadd
mheadd / registrar.js
Created April 6, 2011 18:26
A simple SIP registrar that uses Node.js and Redis
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
}
sip.start({},function(request) {
@mheadd
mheadd / program.cs
Created April 14, 2011 14:09
A simple console application to invoke the Tropo Session API and send an outbound SMS message
using System;
using System.Collections.Generic;
using System.Web;
using System.Xml;
using TropoCSharp.Structs;
using TropoCSharp.Tropo;
namespace OutboundTest
{
class Program
@mheadd
mheadd / phlapi.php
Created April 26, 2011 19:41
Simple PHP class that can be used to fetch locations from PHLAPI.
<?php
/**
*
* A simple class to retrieve point data from PHLAPI.
*
*/
class PhlApi {
// Private class members.
@mheadd
mheadd / phlapi.js
Created April 26, 2011 20:44
Simple Node.js script showing how to retrieve location JSON from PHLAPI
// Include required modules.
var sys = require('sys');
var http = require('http');
var EventEmitter = require('events').EventEmitter;
// PHLAPI class.
PhlApi = function(host, port, data_set, version) {
this.host = host;
this.port = port;
this.data_set = data_set
@mheadd
mheadd / phinditforme.php
Created April 30, 2011 18:38
A Tropo script to find locations in Philadelphia.
<?php
/**
* PhindItForMe - an IM, SMS, Twitter and Phone application that finds locations in Philadelphia.
*
* @copyright 2011 Mark J. Headd (http://www.voiceingov.org)
* @author Mark Headd
*/
// Constants used to geocode an address.
@mheadd
mheadd / alphabet.js
Created May 2, 2011 23:31
A collection of code samples used in a talk at JSConf 2011
// A simple JavaScript app that runs on Tropo.
var letters = 'abcdefghijklmnopqrstuvwxyz';
var letterArray = letters.split('');
var start = new Date();
say('Hello, and welcome to Tropo.');
for(var i = 0; i < letterArray.length; i++) {
say(letterArray[i] + '.');
@mheadd
mheadd / sms-result-couchdb.js
Created May 12, 2011 17:51
Node.js scripts for processing SMS delivery reports from SMSified.
var sys = require('sys');
var http = require('http');
var cradle = require('cradle');
var port = 8000;
var db = new (cradle.Connection)('http://127.0.0.1', 5984).database('smsrecords');
var server = http.createServer(function(req, res) {
@mheadd
mheadd / inbound-sms.php
Created May 16, 2011 14:12
A simple PHP script that processes and saves inbound SMS messages from SMSified.
<?php
/*
* Convenience class that parses inbound SMSified JSON into a simple object.
*/
class InboundMessage {
// Class properties.
public $timeStamp;
public $destinationAddress;