Skip to content

Instantly share code, notes, and snippets.

View mheadd's full-sized avatar

Mark Headd mheadd

View GitHub Profile
{
"result": {
"actions": {
"attempts": 1,
"concept": "1",
"confidence": 100,
"disposition": "SUCCESS",
"interpretation": "1",
"name": "zip",
"utterance": "1",
{
"tropo": [
{
"say": {
"value": "Your zip code is 19807."
}
},
{
"hangup": {
# Rewrite rules
# On any incoming POST requests, we want to rewrite from http://hostname/resource
# to http://hostname/node/resource
RewriteEngine On
# We only want HTTP POSTs
RewriteCond %{REQUEST_METHOD} "POST"
# If we've already added "/node/" skip the rewrite rule
RewriteCond %{REQUEST_URI} !./node
# Once rewritten, pass thru to the next handler
RewriteRule (.*) /node$1 [PT]
@mheadd
mheadd / dartfirststate_de_us.sql
Created October 7, 2010 17:13
A SQL script for importing GFTS data from the State of Delaware into a MySQL database.
-- -------------------------------------------------------------------------------------------------------
-- A SQL script for importing GFTS data from the State of Delaware into a MySQL database.
--
-- Copyright 2010 Mark J. Headd
-- http://www.voiceingov.org
--
-- This file is free software; you can redistribute it and/or modify it under the terms of the
-- GNU Library General Public License as published by the Free Software Foundation; either version 2 of the
-- License, or (at your option) any later version.
-- This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
@mheadd
mheadd / dartfirststate_de_us_procs.sql
Created October 18, 2010 14:35
Stored Procedures for querying GFTS data from the State of Delaware in a MySQL database.
-- ----------------------------------------------------------------------------------------------------
-- Stored Procedures for querying GFTS data from the State of Delaware in a MySQL database.
--
-- Copyright 2010 Mark J. Headd
-- http://www.voiceingov.org
--
-- This file is free software; you can redistribute it and/or modify it under the terms of the
-- GNU Library General Public License as published by the Free Software Foundation; either version 2 of the
-- License, or (at your option) any later version.
-- This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
@mheadd
mheadd / fastagi.js
Created October 21, 2010 15:18
Node.js script to execute FastAGI application
// Include required modules.
var net = require('net');
var sys = require('sys');
// Create a TCP server and listen on FastAGI port.
var server = net.createServer();
server.listen(4573, '127.0.0.7');
// Add a listener for new connections.
server.addListener('connection', fastAGI);
<?php
require_once 'path/to/tropo.class.php';
// Create a new instance of the Tropo object.
$tropo = new Tropo();
// Create a say object and give it the URL of an audio file.
$say = new Say("http://mp3server.com/someringtone.mp3");
@mheadd
mheadd / extensions.conf
Created October 28, 2010 20:30
Asterisk configuration files for enabling XMPP-based screen pops on incoming calls.
[default]
exten => _XXXX,1,Answer()
exten => _XXXX,n,JabberSend(asterisk,user@xxx.xxx.xxx.xxx,Incoming call from ${CALLERID(num)})
exten => _XXXX,n,JabberSend(asterisk,user@xxx.xxx.xxx.xxx,To accept, enter 1. To reject, enter 2.)
exten => _XXXX,n,Set(OPTION = ${JABBER_RECEIVE(asterisk,user@xxx.xxx.xxx.xxx,10)})
exten => _XXXX,n,Gotoif($[${OPTION}=1]?connect:goodbye)
exten => _XXXX,n(connect),Wait(1)
exten => _XXXX,n,JabberSend(asterisk,user@xxx.xxx.xxx.xxx,Connecting call...);
exten => _XXXX,n,Wait(1)
exten => _XXXX,n,Dial(SIP/${EXTEN})
@mheadd
mheadd / transit-location-finder.php
Created November 2, 2010 15:24
A Tropo SMS/IM app that provides transit route and stop locations.
<?php
/*
* Copyright 2010 Mark J. Headd
*
* This application is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@mheadd
mheadd / ccxml-screen-pop.xml
Created November 3, 2010 20:35
CCXML script to answer a Phono call, send an IM screen pop and connect to a predefined number.
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
<var name="inboundID"/>
<var name="outboundID"/>
<var name="initState" expr="'state1'" />
<!-- Tropo API information -->
<var name="tropoAPIToken" expr="'your-tropo-session-token'"/>
<var name="tropoAPIEndPoint" expr="'http://api-internal.tropo.com/1.0/sessions?action=create&amp;token=' + tropoAPIToken"/>