summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2014-01-21 08:32:50 +0000
committerPeter Kozak <spag@golwen.net>2014-01-21 08:32:50 +0000
commitd5677cdb0021e37c6e15d24b7cc2e6af0a567ae7 (patch)
treeb281a8126c605033ad9471e98683cd136cbaa53e /app
parentfd38cbfb317bffe38563a7faedb1dca8a564494b (diff)
Snom 320 - MAC range added
Diffstat (limited to 'app')
-rw-r--r--app/controllers/config_snom_controller.rb103
1 files changed, 37 insertions, 66 deletions
diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb
index 5b31064..c162416 100644
--- a/app/controllers/config_snom_controller.rb
+++ b/app/controllers/config_snom_controller.rb
@@ -55,6 +55,40 @@ class ConfigSnomController < ApplicationController
},
}
+ MAC_ADDRESS_TO_MODEL = {
+ '00041325' => 'Snom 300',
+ '00041328' => 'Snom 300',
+ '0004132D' => 'Snom 300',
+ '0004132F' => 'Snom 300',
+ '00041334' => 'Snom 300',
+ '00041350' => 'Snom 300',
+ '0004133B' => 'Snom 300',
+ '00041337' => 'Snom 300',
+ '00041324' => 'Snom 320',
+ '00041327' => 'Snom 320',
+ '0004132C' => 'Snom 320',
+ '00041331' => 'Snom 320',
+ '00041335' => 'Snom 320',
+ '00041338' => 'Snom 320',
+ '00041351' => 'Snom 320',
+ '0004133F' => 'Snom 320',
+ '00041323' => 'Snom 360',
+ '00041329' => 'Snom 360',
+ '0004132B' => 'Snom 360',
+ '00041339' => 'Snom 360',
+ '00041390' => 'Snom 360',
+ '00041326' => 'Snom 370',
+ '0004132E' => 'Snom 370',
+ '0004133A' => 'Snom 370',
+ '00041352' => 'Snom 370',
+ '00041340' => 'Snom 820',
+ '00041345' => 'Snom 821',
+ '00041348' => 'Snom 821',
+ '00041341' => 'Snom 870',
+ '00041332' => 'Snom meetingPoint',
+ '00041343' => 'Snom vision',
+ }
+
skip_authorization_check
before_filter { |controller|
@@ -85,40 +119,9 @@ class ConfigSnomController < ApplicationController
return
end
- mac_address_to_model = {
- '00041325' => 'Snom 300',
- '00041328' => 'Snom 300',
- '0004132D' => 'Snom 300',
- '0004132F' => 'Snom 300',
- '00041334' => 'Snom 300',
- '00041350' => 'Snom 300',
- '0004133B' => 'Snom 300',
- '00041337' => 'Snom 300',
- '00041324' => 'Snom 320',
- '00041327' => 'Snom 320',
- '0004132C' => 'Snom 320',
- '00041331' => 'Snom 320',
- '00041335' => 'Snom 320',
- '00041338' => 'Snom 320',
- '00041351' => 'Snom 320',
- '00041323' => 'Snom 360',
- '00041329' => 'Snom 360',
- '0004132B' => 'Snom 360',
- '00041339' => 'Snom 360',
- '00041390' => 'Snom 360',
- '00041326' => 'Snom 370',
- '0004132E' => 'Snom 370',
- '0004133A' => 'Snom 370',
- '00041352' => 'Snom 370',
- '00041340' => 'Snom 820',
- '00041345' => 'Snom 821',
- '00041348' => 'Snom 821',
- '00041341' => 'Snom 870',
- '00041332' => 'Snom meetingPoint',
- '00041343' => 'Snom vision',
- }
+
- phone_model_str = mac_address_to_model[@mac_address[0, 8]]
+ phone_model_str = MAC_ADDRESS_TO_MODEL[@mac_address[0, 8]]
if phone_model_str == 'Snom vision'
snom_vision
elsif !phone_model_str.blank?
@@ -157,39 +160,7 @@ class ConfigSnomController < ApplicationController
@phone.hot_deskable = true
@phone.tenant = tenant
- mac_address_to_model = {
- '00041325' => 'Snom 300',
- '00041328' => 'Snom 300',
- '0004132D' => 'Snom 300',
- '0004132F' => 'Snom 300',
- '00041334' => 'Snom 300',
- '00041350' => 'Snom 300',
- '0004133B' => 'Snom 300',
- '00041337' => 'Snom 300',
- '00041324' => 'Snom 320',
- '00041327' => 'Snom 320',
- '0004132C' => 'Snom 320',
- '00041331' => 'Snom 320',
- '00041335' => 'Snom 320',
- '00041338' => 'Snom 320',
- '00041351' => 'Snom 320',
- '00041323' => 'Snom 360',
- '00041329' => 'Snom 360',
- '0004132B' => 'Snom 360',
- '00041339' => 'Snom 360',
- '00041390' => 'Snom 360',
- '00041326' => 'Snom 370',
- '0004132E' => 'Snom 370',
- '0004133A' => 'Snom 370',
- '00041352' => 'Snom 370',
- '00041340' => 'Snom 820',
- '00041345' => 'Snom 821',
- '00041348' => 'Snom 821',
- '00041341' => 'Snom 870',
- '00041332' => 'Snom meetingPoint',
- }
-
- @phone.phone_model = PhoneModel.where(:name => mac_address_to_model[@mac_address[0, 8]]).first
+ @phone.phone_model = PhoneModel.where(:name => MAC_ADDRESS_TO_MODEL[@mac_address[0, 8]]).first
if ! @phone.save
render(
:status => 500,