Skip to content

Commit

Permalink
make the sinatra app independent from the domain
Browse files Browse the repository at this point in the history
  • Loading branch information
bru committed Nov 1, 2013
1 parent e917cf5 commit 4da30a0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/twiml_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class TwimlApp < Sinatra::Base
username == ENV['CALLME_USER'] && password == ENV['CALLME_PASS']
end


get '/' do
logger.info "New call"
if Agent.on_call.empty?
Expand All @@ -21,8 +20,8 @@ class TwimlApp < Sinatra::Base
logger.info "Calling #{params[:agents]} agents"
redirect "/callme/voicemail" unless ["active", "sleepers"].include?(params[:agents])
agents = agents_to_dial(params[:agents])
number_strings = numbers_to_dial(agents)do |number|
"<Number url=\"http://#{ENV['CALLME_USER']}:#{ENV['CALLME_PASS']}@callmecplus.herokuapp.com/callme/screen\">#{number}</Number>"
number_strings = numbers_to_dial(agents).map do |number|
"<Number url=\"http://#{ENV['CALLME_USER']}:#{ENV['CALLME_PASS']}@#{request.host}/callme/screen\">#{number}</Number>"
end

response =<<EOF
Expand All @@ -39,7 +38,7 @@ class TwimlApp < Sinatra::Base
logger.info "Screening call"
reponse =<<EOF
<Response>
<Gather action="http://#{ENV['CALLME_USER']}:#{ENV['CALLME_PASS']}@callmecplus.herokuapp.com/callme/complete_call">
<Gather action="http://#{ENV['CALLME_USER']}:#{ENV['CALLME_PASS']}@#{request.host}/callme/complete_call">
<Say voice='woman'>Press any key to accept this call</Say>
</Gather>
<Hangup/>
Expand Down

0 comments on commit 4da30a0

Please sign in to comment.