summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-02-26 10:00:36 -0500
committerPeter Kozak <spag@golwen.net>2013-02-26 10:00:36 -0500
commit0399b856c75b842f43bc5380f9c19a64c6418f11 (patch)
tree0604719a148b7ba545f97a677633ac7ec4646eb1 /app
parenteb0b73618dac66d5f9e1c4127af156886d362315 (diff)
call action added
Diffstat (limited to 'app')
-rw-r--r--app/controllers/sip_accounts_controller.rb29
1 files changed, 28 insertions, 1 deletions
diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb
index 2886c8b..022858c 100644
--- a/app/controllers/sip_accounts_controller.rb
+++ b/app/controllers/sip_accounts_controller.rb
@@ -1,6 +1,7 @@
class SipAccountsController < ApplicationController
load_resource :user
load_resource :tenant
+ #load_resource :sip_account
load_and_authorize_resource :sip_account, :through => [:user, :tenant ]
before_filter :set_and_authorize_parent
@@ -76,7 +77,33 @@ class SipAccountsController < ApplicationController
end
def call
- redirect_to(:back)
+ if !params[:url].blank?
+ protocol, separator, phone_number = params[:url].partition(':')
+ if ! phone_number.blank?
+ @sip_account.call(phone_number)
+ render(
+ :status => 200,
+ :layout => false,
+ :content_type => 'text/plain',
+ :text => "<!-- CALL -->",
+ )
+ return;
+ end
+ render(
+ :status => 404,
+ :layout => false,
+ :content_type => 'text/plain',
+ :text => "<!-- Number not found -->",
+ )
+ return;
+ end
+
+ render(
+ :status => 404,
+ :layout => false,
+ :content_type => 'text/plain',
+ :text => "<!-- Call URL not found -->",
+ )
end
private