diff options
author | Peter Kozak <spag@golwen.net> | 2013-08-13 16:00:42 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-08-13 16:00:42 +0200 |
commit | fed2bd7a18eee95b2a7ce1fc555e251a610baa96 (patch) | |
tree | 12daa8ee4fda0ecf403320c382d96153a73b14f8 | |
parent | 1ba70082555314c3793ec05fdb0b1a0780ed7b5e (diff) |
save phone ip
-rw-r--r-- | app/controllers/config_yealink_controller.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/config_yealink_controller.rb b/app/controllers/config_yealink_controller.rb index ed81905..1288fb7 100644 --- a/app/controllers/config_yealink_controller.rb +++ b/app/controllers/config_yealink_controller.rb @@ -67,6 +67,15 @@ class ConfigYealinkController < ApplicationController handset } + @provisioning_url = "#{request.protocol}#{request.host_with_port}" + + if ! request.env['HTTP_USER_AGENT'].index('Yealink') + Rails.logger.info "---> User-Agent indicates not a Yealink phone (#{request.env['HTTP_USER_AGENT'].inspect})" + else + Rails.logger.info "---> Phone #{@mac_address.inspect}, IP address #{request_remote_ip.inspect}" + @phone.update_attributes({ :ip_address => request_remote_ip }) + end + end |