Skip to content

Instantly share code, notes, and snippets.

@aaronsherwood
Created March 6, 2013 04:22
Show Gist options
  • Save aaronsherwood/5096681 to your computer and use it in GitHub Desktop.
Save aaronsherwood/5096681 to your computer and use it in GitHub Desktop.
openFrameworks dialin test
exten => ans,1,Background(vm-enter-num-to-call)
exten => ans,n,WaitExten(10)
exten => ans,n,Goto(ags419_OFtest,ans,1)
exten => 1,1,System(/home/ags419/asterisk_agi/postRequest.rb 1)
exten => 1,n,Goto(ags419_OFtest,ans,1)
exten => 2,1,System(/home/ags419/asterisk_agi/postRequest.rb 2)
exten => 2,n,Goto(ags419_OFtest,ans,1)
exten => 3,1,System(/home/ags419/asterisk_agi/postRequest.rb 3)
exten => 3,n,Goto(ags419_OFtest,ans,1)
exten => 4,1,System(/home/ags419/asterisk_agi/postRequest.rb 4)
exten => 4,n,Goto(ags419_OFtest,ans,1)
exten => 5,1,System(/home/ags419/asterisk_agi/postRequest.rb 5)
exten => 5,n,Goto(ags419_OFtest,ans,1)
exten => 6,1,System(/home/ags419/asterisk_agi/postRequest.rb 6)
exten => 6,n,Goto(ags419_OFtest,ans,1)
exten => 7,1,System(/home/ags419/asterisk_agi/postRequest.rb 7)
exten => 7,n,Goto(ags419_OFtest,ans,1)
exten => 8,1,System(/home/ags419/asterisk_agi/postRequest.rb 8)
exten => 8,n,Goto(ags419_OFtest,ans,1)
exten => 9,1,System(/home/ags419/asterisk_agi/postRequest.rb 9)
exten => 9,n,Goto(ags419_OFtest,ans,1)
exten => 0,1,System(/home/ags419/asterisk_agi/postRequest.rb 0)
exten => 0,n,Goto(ags419_OFtest,ans,1)
exten => i,1,Goto(ags419_OFtest,ans,1)
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
ofBackground(54, 54, 54, 255);
ofHttpResponse resp = ofLoadURL("http://itp.nyu.edu/~ags419/sinatra/redial/getout");
inData = ofSplitString(resp.data, " ");
pastID=inData[1];
ofTrueTypeFont::setGlobalDpi(72);
font.loadFont("frabk.ttf", 660, true);
it="*";
}
//--------------------------------------------------------------
void testApp::update(){
ofHttpResponse resp = ofLoadURL("http://itp.nyu.edu/~ags419/sinatra/redial/getout");
inData = ofSplitString(resp.data, " ");
if (inData[1]!=pastID) {
pastID=inData[1];
it=inData[0];
}
}
//--------------------------------------------------------------
void testApp::draw(){
ofSetColor(255);
font.drawString(it, 330, 580);
}
#pragma once
#include "ofMain.h"
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
string pastID;
vector<string> inData;
ofTrueTypeFont font;
string it;
};
#!/usr/bin/ruby
require 'net/http'
require 'uri'
num = ARGV[0]
postData = Net::HTTP.post_form(URI.parse('http://itp.nyu.edu/~ags419/sinatra/redial/putin'), {'number'=>num})
puts postData.body
require 'sinatra'
require 'dm-core'
DataMapper::setup(:default, {:adapter => 'yaml', :path => 'db'})
class Phonecall
include DataMapper::Resource
property :id, Serial
property :number, Integer
end
DataMapper.finalize
get '/getout' do
@number = Phonecall.last.number
@id= Phonecall.last.id
"#{@number} #{@id}"
end
post '/putin' do
call = Phonecall.new
call.number = params[:number]
call.save
"did it"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment