Skip to content

Instantly share code, notes, and snippets.

@avimar
avimar / playerror.lua
Created January 23, 2013 07:14
Avi's Freeswitch play error lua script
calling_card = session:getVariable("calling_card_ivr")
cause = session:getVariable("originate_disposition")
cause2=session:getVariable("bridge_hangup_cause")
if cause == nil then cause="none" end
session:execute("log", "DEBUG Hangup cause: "..cause);
if cause2 == nil then cause2="none" end
session:execute("log", "DEBUG bridge hangup cause: "..cause2);
@avimar
avimar / build.sls
Created August 8, 2012 19:04
FreeSWITCH Salt install file
freeswitch-build:
pkg:
- installed
- names:
- build-essential
- curl
- wget
- autoconf
- automake
- libtool
@avimar
avimar / gist:3172823
Created July 24, 2012 21:34
nginx reverse proxy node.js
upstream node_js {
server 127.0.0.1:8000;
}
server {
...
...
location ~^/nodejs/ {
@avimar
avimar / test-affected-rows.js
Created July 21, 2012 21:31
node-mysql unit test for affected rows
var common = require('../common');
var connection = common.createConnection();
var assert = require('assert');
common.useTestDb(connection);
var table = 'insert_test';
connection.query([
'CREATE TEMPORARY TABLE `' + table + '` (',
'`title` varchar(255),',
@avimar
avimar / gist:3146678
Created July 19, 2012 20:42
auto-opper written in node
console.log("Bot Started...");
process.on('uncaughtException', function (err) { console.log('OMG something went really wrong: ' + err); });
var irc = require('irc');
//https://github.com/martynsmith/node-irc
//npm install irc
var MYBOT = {};
MYBOT.channelname = "#node.js";
MYBOT.nick = "ryan_opper";
@avimar
avimar / gist:3092732
Created July 11, 2012 19:37
install node.js from source with salt
nodejs-deps:
pkg.installed:
- names:
- g++
- curl
- libssl-dev
- apache2-utils
require:
- pkg: git
@avimar
avimar / ActiveCalls.php
Created July 13, 2010 18:34
SipSorcery REST PHP Code
<?php
$user="USER";
$pass="PASS";
include("SipSorcery.inc.php");
ini_set('session.use_only_cookies',1);
ini_set('session.gc_maxlifetime',31557600);
session_set_cookie_params(24*24*60);
session_start();