summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-24 16:43:42 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-24 16:43:42 +0200
commita24aee0fdfcbbc2200ad05ee5b789aec5988f1ad (patch)
treeb2b8f1201c4d483174a6e22e98492be4ff2d0048 /app/controllers
parente0c3ca61eeed9b9ac6d5786809e023f5dc27c069 (diff)
First step to provide an attended transfer.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/v1/calls_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/api/v1/calls_controller.rb b/app/controllers/api/v1/calls_controller.rb
index e6fbed4..329bd94 100644
--- a/app/controllers/api/v1/calls_controller.rb
+++ b/app/controllers/api/v1/calls_controller.rb
@@ -14,6 +14,23 @@ module Api
if params[:transfer_blind]
@call.transfer_blind(params[:transfer_blind])
+ else
+ if params[:transfer_attended] && @call.b_sip_account.phones.first.phone_model.manufacturer.name == 'SNOM Technology AG'
+ phone = @call.b_sip_account.phones.first
+ ip_address = phone.ip_address
+ http_user = phone.http_user
+ http_password = phone.http_password
+
+ # Hold
+ open("http://#{ip_address}/command.htm?key=F_HOLD", :http_basic_authentication=>[http_user, http_password])
+
+ # Call the other party
+ (0..(params[:transfer_attended].length - 1)).each do |i|
+ digit = params[:transfer_attended][i]
+ open("http://#{ip_address}/command.htm?key=#{digit}", :http_basic_authentication=>[http_user, http_password])
+ end
+ open("http://#{ip_address}/command.htm?key=ENTER", :http_basic_authentication=>[http_user, http_password])
+ end
end
respond_with @call