Permalink
Browse files

WIP: spiked on dial on heroku, checking in to continua to work on Kal…

…v's machine'
  • Loading branch information...
1 parent d552447 commit ad8fde12138c840d9be25c9419696943fe881b90 @zlu zlu committed Jul 15, 2011
Showing with 74 additions and 248 deletions.
  1. +2 −2 Gemfile
  2. +17 −1 Gemfile.lock
  3. +24 −0 app/controllers/dials_controller.rb
  4. +13 −0 app/models/dial.rb
  5. +11 −0 app/views/dials/new.html.erb
  6. +3 −1 config/routes.rb
  7. +4 −3 lib/answer.rb
  8. +0 −241 public/index.html
View
@@ -16,13 +16,13 @@ gem 'jquery-rails'
gem 'thin'
-gem 'connfu', :path => './vendor/gems/connfu'
+gem 'connfu', :path => '/Users/zlu/projects/thelab/play'
gem 'minitest', '2.3.1'
gem 'nokogiri', '1.5.0'
gem 'niceogiri', '0.0.4'
gem 'blather', '0.5.3'
-
+gem 'resque', '1.17.1'
# Use unicorn as the web server
# gem 'unicorn'
View
@@ -1,8 +1,9 @@
PATH
- remote: ./vendor/gems/connfu
+ remote: /Users/zlu/projects/thelab/play
specs:
connfu (0.0.3)
blather (= 0.5.3)
+ resque (= 1.17.1)
GEM
remote: http://rubygems.org/
@@ -60,6 +61,7 @@ GEM
jquery-rails (1.0.12)
railties (~> 3.0)
thor (~> 0.14)
+ json (1.5.3)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -97,12 +99,23 @@ GEM
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.8)
+ redis (2.2.1)
+ redis-namespace (1.0.3)
+ redis (< 3.0.0)
+ resque (1.17.1)
+ json (>= 1.4.6, < 1.6)
+ redis-namespace (~> 1.0.2)
+ sinatra (>= 0.9.2)
+ vegas (~> 0.1.2)
sass (3.1.4)
sass-rails (3.1.0.rc.4)
actionpack (~> 3.1.0.rc1)
railties (~> 3.1.0.rc1)
sass (>= 3.1.4)
sprockets (>= 2.0.0.beta.9)
+ sinatra (1.2.6)
+ rack (~> 1.1)
+ tilt (>= 1.2.2, < 2.0)
sprockets (2.0.0.beta.10)
hike (~> 1.0)
rack (~> 1.0)
@@ -120,6 +133,8 @@ GEM
uglifier (1.0.0)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
+ vegas (0.1.8)
+ rack (>= 1.0.0)
PLATFORMS
ruby
@@ -133,6 +148,7 @@ DEPENDENCIES
niceogiri (= 0.0.4)
nokogiri (= 1.5.0)
rails (= 3.1.0.rc4)
+ resque (= 1.17.1)
sass-rails (~> 3.1.0.rc)
therubyracer-heroku (~> 0.8.1.pre3)
thin
@@ -0,0 +1,24 @@
+class DialsController < ApplicationController
+ def new
+
+ end
+
+ def create
+ Connfu::App.dial(:to => params[:to], :from => params[:from]) do |c|
+ c.on_ringing do
+ update_status "The phone is ringing!"
+ end
+ c.on_answer do
+ update_status "The phone was answered!"
+
+ say "Though I am but a robot, my love for you is real."
+ hangup
+ end
+ c.on_hangup do
+ update_status "The phone was hung up"
+ end
+ end
+ flash[:notice] = "Dialed #{params[:to]} successfully"
+ redirect_to new_dial_path
+ end
+end
View
@@ -0,0 +1,13 @@
+#class Dial
+# include Connfu::Dsl
+#
+# def on_answer
+# start_recording
+# sleep 5
+# file_name = stop_recording
+# end
+#
+# def on_hangup
+# say 'good bye'
+# end
+#end
@@ -0,0 +1,11 @@
+<h2>Dial Somebody</h2>
+
+<p><%= flash[:notice] %></p>
+
+<%= form_tag dials_path do %>
+
+ <p>TO: <%= text_field_tag :to, "sip:zlu@213.192.59.75" %></p>
+ <P>FROM: <%= text_field_tag :from, "sip:usera@46.137.85.52" %></P>
+ <P><%= submit_tag "Dial" %></P>
+
+<% end %>
View
@@ -48,11 +48,13 @@
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
- # root :to => 'welcome#index'
+ root :to => 'dials#new'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
+
+ resources :dials, :only => [:new, :create]
end
View
@@ -1,17 +1,18 @@
require 'connfu'
Connfu.setup "usera@46.137.85.52", "1"
+Connfu.redis_uri = "redis://localhost:6379"
#Connfu.setup "usera@127.0.0.1", "1"
class AnswerExample
include Connfu::Dsl
- on :offer do |offer|
+ on :answer do |call|
answer
- say('hello, this is openvoice powered by connfu')
+ say('hello, this is open voice powered by connfu')
say('http://www.phono.com/audio/troporocks.mp3')
hangup
end
end
-Connfu.start AnswerExample
+Connfu.start *args
Oops, something went wrong.

0 comments on commit ad8fde1

Please sign in to comment.