Skip to content

Commit

Permalink
incoming calls gets forwarded to phono_sip_address, user can use voic…
Browse files Browse the repository at this point in the history
…e to control menu
  • Loading branch information
zlu committed Feb 20, 2011
1 parent 17733fc commit 88e2c3f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/controllers/incoming_calls_controller.rb
Expand Up @@ -64,6 +64,7 @@ def user_menu
:terminator => "*")
end
render :json => tropo.response
return
end

case value
Expand All @@ -74,6 +75,7 @@ def user_menu
:terminator => "ring(*)")
end
render :json => tropo.response
return
when "voicemail"
session_id = params[:session_id]
call_id = params[:call_id]
Expand All @@ -89,6 +91,7 @@ def user_menu
hangup
end
render :json => tropo.response
return
when "listenin"
caller_id = CGI::escape(params[:caller_id])
user_id = params[:user_id]
Expand All @@ -106,6 +109,7 @@ def user_menu
:terminator => "ring(*)")
end
render :json => tropo.response
return
end
render :status => 200, :nothing => true
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/incoming_call.rb
Expand Up @@ -53,7 +53,7 @@ def self.followme(params)
ask(:name => 'main-menu-incoming',
:attempts => 3,
:bargein => true,
:choices => {:value => "connect(1), voicemail(2), listenin(3)", :mode => "DTMF"},
:choices => {:value => "connect(1,connect), voicemail(2,voicemail), listenin(3,listen)"},
:say => {:value => "Incoming call from #{name_recording} , press 1 to accept, press 2 to send to voicemail, press 3 to listen in. "})
end
tropo.response
Expand Down
4 changes: 3 additions & 1 deletion app/models/user.rb
Expand Up @@ -33,7 +33,9 @@ def default_phone_number

# returns all the forward phone_numbers
def forwarding_numbers
phone_numbers.select{ |n| n.forward == true }.map(&:number)
numbers = phone_numbers.select{ |n| n.forward == true }.map(&:number)
numbers << profiles.first.phono_sip_address if profiles.first.phono_sip_address
numbers
end

def create_profile
Expand Down

0 comments on commit 88e2c3f

Please sign in to comment.