summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 15:33:06 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 15:33:06 +0100
commit39aa7132ceed3d4beab3a9b828e571bbfc67c07e (patch)
tree6c88289c9f99be0af8635636fcdf64102090e5ec /app/controllers
parent5ad8203ce4f1bfea997960d0b52c626dea24b944 (diff)
parent6f69c1a85055ec7c2515719d79d2a7a4e60cec50 (diff)
Merge branch 'develop'5.1-beta1
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/rows_controller.rb2
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/controllers/call_forwards_controller.rb4
-rw-r--r--app/controllers/call_histories_controller.rb4
-rw-r--r--app/controllers/call_routes_controller.rb75
-rw-r--r--app/controllers/conferences_controller.rb2
-rw-r--r--app/controllers/config_siemens_controller.rb26
-rw-r--r--app/controllers/config_siemens_sort_controller.rb371
-rw-r--r--app/controllers/config_snom_controller.rb65
-rw-r--r--app/controllers/fax_accounts_controller.rb4
-rw-r--r--app/controllers/gateway_parameters_controller.rb44
-rw-r--r--app/controllers/gateway_settings_controller.rb44
-rw-r--r--app/controllers/gateways_controller.rb57
-rw-r--r--app/controllers/gemeinschaft_setups_controller.rb39
-rw-r--r--app/controllers/gs_nodes_controller.rb2
-rw-r--r--app/controllers/gs_parameters_controller.rb44
-rw-r--r--app/controllers/gui_functions_controller.rb12
-rw-r--r--app/controllers/page_controller.rb7
-rw-r--r--app/controllers/phone_book_entries_controller.rb2
-rw-r--r--app/controllers/phone_books_controller.rb4
-rw-r--r--app/controllers/phone_numbers_controller.rb17
-rw-r--r--app/controllers/phones_controller.rb9
-rw-r--r--app/controllers/route_elements_controller.rb67
-rw-r--r--app/controllers/sessions_controller.rb2
-rw-r--r--app/controllers/sip_accounts_controller.rb22
-rw-r--r--app/controllers/tenants_controller.rb19
-rw-r--r--app/controllers/trigger_controller.rb11
-rw-r--r--app/controllers/user_groups_controller.rb2
-rw-r--r--app/controllers/users_controller.rb4
-rw-r--r--app/controllers/voicemail_messages_controller.rb6
30 files changed, 499 insertions, 472 deletions
diff --git a/app/controllers/api/rows_controller.rb b/app/controllers/api/rows_controller.rb
index 6e815eb..543aebe 100644
--- a/app/controllers/api/rows_controller.rb
+++ b/app/controllers/api/rows_controller.rb
@@ -84,7 +84,7 @@ class Api::RowsController < ApplicationController
private
def check_remote_ip_address_whitelist
- if !(REMOTE_IP_ADDRESS_WHITELIST.empty? or REMOTE_IP_ADDRESS_WHITELIST.include?(ENV['REMOTE_ADDR']))
+ if !(GsParameter.get('REMOTE_IP_ADDRESS_WHITELIST').empty? or GsParameter.get('REMOTE_IP_ADDRESS_WHITELIST').include?(ENV['REMOTE_ADDR']))
redirect_to root_url
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index c675f5c..e4165f3 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -54,8 +54,8 @@ class ApplicationController < ActionController::Base
# Generate a new random PIN
#
def random_pin
- if MINIMUM_PIN_LENGTH > 0
- (1..MINIMUM_PIN_LENGTH).map{|i| (0 .. 9).to_a.sample}.join
+ if GsParameter.get('MINIMUM_PIN_LENGTH') > 0
+ (1..GsParameter.get('MINIMUM_PIN_LENGTH')).map{|i| (0 .. 9).to_a.sample}.join
end
end
diff --git a/app/controllers/call_forwards_controller.rb b/app/controllers/call_forwards_controller.rb
index 5321b35..001ed60 100644
--- a/app/controllers/call_forwards_controller.rb
+++ b/app/controllers/call_forwards_controller.rb
@@ -21,10 +21,10 @@ class CallForwardsController < ApplicationController
def new
@call_forward = @phone_number.call_forwards.build
- @call_forward.depth = DEFAULT_CALL_FORWARD_DEPTH
+ @call_forward.depth = GsParameter.get('DEFAULT_CALL_FORWARD_DEPTH')
@call_forward.active = true
@call_forwarding_destinations = call_forwarding_destination_types()
- @call_forward.destination = CALLFORWARD_DESTINATION_DEFAULT.to_s if defined?(CALLFORWARD_DESTINATION_DEFAULT)
+ @call_forward.destination = GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT').to_s if defined?(GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT'))
@available_call_forward_cases = []
CallForwardCase.all.each do |available_call_forward_case|
diff --git a/app/controllers/call_histories_controller.rb b/app/controllers/call_histories_controller.rb
index f956f88..5335ed3 100644
--- a/app/controllers/call_histories_controller.rb
+++ b/app/controllers/call_histories_controller.rb
@@ -22,7 +22,7 @@ class CallHistoriesController < ApplicationController
@call_histories = calls.paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
@calls_count = calls.count
@@ -34,6 +34,8 @@ class CallHistoriesController < ApplicationController
if ! @type.blank?
@call_histories = @call_histories.where(:entry_type => @type)
end
+
+ @call_histories = @call_histories.order(:created_at).reverse_order.limit(1000)
end
diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb
new file mode 100644
index 0000000..0259a10
--- /dev/null
+++ b/app/controllers/call_routes_controller.rb
@@ -0,0 +1,75 @@
+class CallRoutesController < ApplicationController
+ authorize_resource :call_route
+
+ def index
+ @call_routes = CallRoute.order([:routing_table, :position])
+ @routing_tables = @call_routes.pluck(:routing_table).uniq.sort
+ spread_breadcrumbs
+ end
+
+ def show
+ @call_route = CallRoute.find(params[:id])
+ spread_breadcrumbs
+ end
+
+ def new
+ @call_route = CallRoute.new
+ spread_breadcrumbs
+ end
+
+ def create
+ @call_route = CallRoute.new(call_route_parameter_params)
+ spread_breadcrumbs
+ if @call_route.save
+ redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @call_route = CallRoute.find(params[:id])
+ spread_breadcrumbs
+ end
+
+ def update
+ @call_route = CallRoute.find(params[:id])
+ spread_breadcrumbs
+ if @call_route.update_attributes(call_route_parameter_params)
+ redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @call_route = CallRoute.find(params[:id])
+ @call_route.destroy
+ redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed')
+ end
+
+ def move_higher
+ @call_route = CallRoute.find(params[:id])
+ @call_route.move_higher
+ redirect_to :back
+ end
+
+ def move_lower
+ @call_route = CallRoute.find(params[:id])
+ @call_route.move_lower
+ redirect_to :back
+ end
+
+ private
+ def call_route_parameter_params
+ params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id)
+ end
+
+ def spread_breadcrumbs
+ add_breadcrumb t("call_routes.index.page_title"), call_routes_path
+ if @call_route && !@call_route.new_record?
+ add_breadcrumb @call_route, @call_route
+ end
+ end
+
+end
diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb
index 302a23b..6091b46 100644
--- a/app/controllers/conferences_controller.rb
+++ b/app/controllers/conferences_controller.rb
@@ -19,7 +19,7 @@ class ConferencesController < ApplicationController
@conference.start = nil
@conference.end = nil
@conference.open_for_anybody = true
- @conference.max_members = DEFAULT_MAX_CONFERENCE_MEMBERS
+ @conference.max_members = GsParameter.get('DEFAULT_MAX_CONFERENCE_MEMBERS')
@conference.pin = random_pin
@conference.open_for_anybody = true
diff --git a/app/controllers/config_siemens_controller.rb b/app/controllers/config_siemens_controller.rb
index c09dfcf..b7fa107 100644
--- a/app/controllers/config_siemens_controller.rb
+++ b/app/controllers/config_siemens_controller.rb
@@ -64,8 +64,8 @@ class ConfigSiemensController < ApplicationController
if mac_address
@phone = Phone.find_by_mac_address(mac_address.gsub(':','').upcase)
- if ! @phone && PROVISIONING_AUTO_ADD_PHONE
- tenant = Tenant.where(:id => PROVISIONING_AUTO_TENANT_ID).first
+ if ! @phone && GsParameter.get('PROVISIONING_AUTO_ADD_PHONE')
+ tenant = Tenant.where(:id => GsParameter.get('PROVISIONING_AUTO_TENANT_ID')).first
if ! tenant
render(
:status => 404,
@@ -91,12 +91,12 @@ class ConfigSiemensController < ApplicationController
return
end
- if ! PROVISIONING_AUTO_ADD_SIP_ACCOUNT
+ if ! GsParameter.get('PROVISIONING_AUTO_ADD_SIP_ACCOUNT')
return
end
caller_name_index = 0
- sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}%").sort { |item1, item2|
+ sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}%").sort { |item1, item2|
item1.caller_name.gsub(/[^0-9]/, '').to_i <=> item2.caller_name.gsub(/[^0-9]/, '').to_i
}.last
@@ -106,18 +106,18 @@ class ConfigSiemensController < ApplicationController
caller_name_index = caller_name_index + 1
@sip_account = tenant.sip_accounts.build
- @sip_account.caller_name = "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}#{caller_name_index}"
- @sip_account.call_waiting = CALL_WAITING
- @sip_account.clir = DEFAULT_CLIR_SETTING
- @sip_account.clip = DEFAULT_CLIP_SETTING
+ @sip_account.caller_name = "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}#{caller_name_index}"
+ @sip_account.call_waiting = GsParameter.get('CALL_WAITING')
+ @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING')
+ @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING')
@sip_account.voicemail_pin = random_pin
- @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT
+ @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT')
@sip_account.hotdeskable = false
loop do
- @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME)
+ @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME'))
break unless SipAccount.exists?(:auth_name => @sip_account.auth_name)
end
- @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD)
+ @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD'))
if ! @sip_account.save
render(
@@ -439,7 +439,7 @@ class ConfigSiemensController < ApplicationController
@new_settings << ['XML-app-debug-prog-name', 2, '']
@new_settings << ['XML-app-num-tabs', 2, '3']
@new_settings << ['XML-app-restart', 2, 'true']
- @new_settings << ['XML-app-tab1-display-name', 2, "Gemeinschaft #{GEMEINSCHAFT_VERSION}"]
+ @new_settings << ['XML-app-tab1-display-name', 2, "Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}"]
@new_settings << ['XML-app-tab1-name', 2, 'menu']
@new_settings << ['XML-app-tab2-display-name', 2, 'Status']
@new_settings << ['XML-app-tab2-name', 2, 'menu_status']
@@ -816,7 +816,7 @@ class ConfigSiemensController < ApplicationController
auto_reload_time = 60
- SIEMENS_HISTORY_RELOAD_TIMES.each_pair do |time_range, reload_value|
+ GsParameter.get('SIEMENS_HISTORY_RELOAD_TIMES').each_pair do |time_range, reload_value|
if time_range === Time.now.localtime.hour
auto_reload_time = reload_value
end
diff --git a/app/controllers/config_siemens_sort_controller.rb b/app/controllers/config_siemens_sort_controller.rb
deleted file mode 100644
index c0739e5..0000000
--- a/app/controllers/config_siemens_sort_controller.rb
+++ /dev/null
@@ -1,371 +0,0 @@
-require 'nokogiri'
-#doc.search('Message/ItemList').each do |a| puts a.children end
-class ConfigSiemensController < ApplicationController
-#TODO Authentication
- # No access for admins though as this contains personal data.
-
- # We can't use load_and_authorize_resource() here because
- # ConfigSiemensController isn't a resource.
- # We can try client certificates
-
- skip_authorization_check
-
-
- def index
- os40_keys=7
- os60_keys=8
- os80_keys=9
- doc = Nokogiri::XML(request.body.read)
- #logger.debug("#{params[:WorkpointMessage].to_xml}")
- #logger.debug("#{params[:WorkpointMessage][:Message][:ItemList].to_xml}")
- @phone_items=Hash.new
- contact_reason = params[:WorkpointMessage][:Message][:ReasonForContact]
- reply_status = doc.search('Message/ReasonForContact').first[:status]
- reply_action = doc.search('Message/ReasonForContact').first[:action]
-
- doc.search('Message/ItemList/Item').each do |post_item|
- @phone_items[post_item[:name]]=post_item.children.to_s
- end
-
- mac_address = @phone_items['mac-addr']
- phone_type = @phone_items['device-type']
- if phone_type == "OpenStage 40"
- max_keys = (os40_keys) * 2
- elsif phone_type == "OpenStage 60"
- max_keys = (os60_keys) * 2
- elsif phone_type == "OpenStage 80"
- max_keys = (os80_keys) * 2
- else
- max_keys = 0
- end
-
- blf_keys_max = max_keys / 2
- shift_key_position = blf_keys_max - 1
-
- #logger.debug(request.body.read)
- @phone = Phone.find_by_mac_address(mac_address.gsub(':','').upcase)
- if ! @phone.nil?
- @phone.update_attributes(:ip_address => request.remote_ip)
- sip_account = SipAccount.where(:sip_accountable_type == @phone.phoneable_type,
- :sip_accountable_id == @phone.phoneable_id).first
- end
-
- if ! @phone.nil? && ! sip_account.nil?
- #logger.debug(@phone_items)
- @my_nonce = params[:WorkpointMessage][:Message][:nonce]
- @new_settings = Array.new
-
- @new_settings << ['dhcp', nil, 'true']
- @new_settings << ['hostname', nil, mac_address.gsub(':', '') ]
- @new_settings << ['e164-hostname', nil, 'false']
- @new_settings << ['mobility-enabled', nil, 'false']
- @new_settings << ['mobility-password-on-logoff', nil, 'false']
- @new_settings << ['e164', nil, sip_account.try(:phone_numbers).first.number]
- @new_settings << ['sip-user-id', nil, sip_account.auth_name]
- @new_settings << ['reg-id', nil, sip_account.auth_name]
- @new_settings << ['reg-number', nil, sip_account.auth_name]
- @new_settings << ['fully-qualified-phone-no', nil, sip_account.auth_name]
- @new_settings << ['sip-pwd', nil, sip_account.password]
- @new_settings << ['sip-name', nil, sip_account.caller_name]
- @new_settings << ['register-by-name', nil, 'false']
- #OPTIMIZE Display ID ?
- @new_settings << ['display-id', nil, sip_account.try(:phone_numbers).first.number]
- @new_settings << ['display-id-unicode', nil, sip_account.caller_name]
- @new_settings << ['use-display-id', nil, 'true']
- @new_settings << ['reg-addr', nil, sip_account.sip_domain.host]
- @new_settings << ['reg-port', nil, '5060']
- @new_settings << ['registrar-addr', nil, sip_account.sip_domain.host]
- @new_settings << ['registrar-port', nil, '5060']
- @new_settings << ['outbound-proxy', nil, sip_account.sip_domain.host]
- @new_settings << ['outbound-proxy-user', nil, sip_account.sip_domain.host]
- @new_settings << ['sgnl-gateway-addr', nil, sip_account.sip_domain.host]
- @new_settings << ['sgnl-gateway-addr-user', nil, sip_account.sip_domain.host]
- @new_settings << ['sgnl-gateway-port', nil, '5060' ]
- @new_settings << ['sgnl-gateway-port-user', nil, '5060']
- @new_settings << ['sgnl-route', nil, '0' ]
- @new_settings << ['mwi-e164', nil, '' ]
- @new_settings << ['rtp-base-port', nil, '5004']
- @new_settings << ['default-domain', nil, '' ]
- @new_settings << ['sip-transport', nil, '0' ]
- @new_settings << ['sip-transport-user', nil, '0' ]
- @new_settings << ['server-type', nil, '0' ]
- @new_settings << ['session-timer', nil, 'true']
- @new_settings << ['session-duration', nil, '3600' ]
- @new_settings << ['reg-ttl', nil, '3600' ]
- @new_settings << ['realm', nil, sip_account.sip_domain.realm]
- @new_settings << ['emergency-e164', nil, '0110' ]
- @new_settings << ['voice-mail-e164', nil, 'voicemail']
- @new_settings << ['auto-answer', nil, 'false']
- @new_settings << ['beep-on-auto-answer', nil, 'true']
- @new_settings << ['auto-reconnect', nil, 'false' ]
- @new_settings << ['beep-on-auto-reconnect', nil, 'true']
- @new_settings << ['permit-decline-call', nil, 'true']
- @new_settings << ['transfer-on-ring', nil, 'false' ]
- @new_settings << ['join-allowed-in-conference', nil, 'true']
- @new_settings << ['pickup-group-uri', nil, '*8*']
- @new_settings << ['pickup-group-uri', nil, '' ]
- @new_settings << ['hot-line-warm-line-digits', nil, '' ]
- @new_settings << ['initial-digit-timer', nil, '30' ]
- @new_settings << ['conference-factory-uri', nil, '']
- @new_settings << ['callback-busy-allow', nil, 'false']
- @new_settings << ['callback-busy-code', nil, '' ]
- @new_settings << ['callback-ring-allow', nil, 'false']
- @new_settings << ['callback-ring-code', nil, '']
- @new_settings << ['callback-cancel-code', nil, '']
- @new_settings << ['park-server', nil, '']
- #OPTIMIZE Callwaiting
- @new_settings << ['call-waiting-enabled', nil, 'true']
- @new_settings << ['qos-layer2', nil, 'true']
- @new_settings << ['l2qos-voice', nil, '5' ]
- @new_settings << ['l2qos-signalling', nil, '3' ]
- @new_settings << ['l2qos-default', nil, '0']
- @new_settings << ['qos-layer3', nil, 'true']
- @new_settings << ['l3qos-voice', nil, '46']
- @new_settings << ['l3qos-signalling', nil, '26']
- @new_settings << ['vlan-method', nil, '1']
- #OPTIMIZE Timezone
- @new_settings << ['sntp-tz-offset', nil, '']
- @new_settings << ['daylight-save', nil, '']
- @new_settings << ['daylight-save-minutes', nil, '']
- #OPTIMIZE Use SNMP?
- @new_settings << ['snmp-trap-addr', nil, '']
- @new_settings << ['snmp-trap-port', nil, '']
- @new_settings << ['snmp-trap-pwd', nil, 'snmp' ]
- @new_settings << ['snmp-traps-active', nil, 'false' ]
- @new_settings << ['diagnostic-trap-addr', nil, '']
- @new_settings << ['diagnostic-trap-port', nil, '']
- @new_settings << ['diagnostic-trap-pwd', nil, 'snmp' ]
- @new_settings << ['diagnostic-traps-active', nil, 'false' ]
- @new_settings << ['diagnostic-snmp-active', nil, 'false']
- @new_settings << ['qdc-collection-unit-addr', nil, '']
- @new_settings << ['qdc-collection-unit-port', nil, '12010']
-
- @new_settings << ['qdc-trap-pwd', nil, 'QOSDC']
- @new_settings << ['qdc-snmp-active', nil, 'false']
- @new_settings << ['qdc-qcu-active', nil, 'false']
- @new_settings << ['snmp-queries-allowed', nil, 'false']
- @new_settings << ['snmp-pwd', nil, '']
- @new_settings << ['disable-microphone', nil, 'false']
- @new_settings << ['loudspeech-enabled', nil, 'true']
- @new_settings << ['audio-silence-suppression', nil, 'false']
-
- @new_settings << ['port1', nil, '0' ] # 0=Automatic (speed)
- @new_settings << ['port2', nil, '0' ]
- @new_settings << ['port2-mode', nil, '1' ]
- @new_settings << ['port2-auto-mdix-enabled', nil, 'true' ]
- @new_settings << ['originating-line-preference', nil, '0']
- @new_settings << ['terminating-line-preference', nil, '0']
- @new_settings << ['line-key-operating-mode', nil, '0']
- @new_settings << ['line-rollover-type', nil, '2']
- @new_settings << ['line-rollover-volume', nil, '5' ]# 1-5
- @new_settings << ['line-registration-leds', nil, 'true']
- @new_settings << ['keyset-use-focus', nil, 'true' ]
- @new_settings << ['keyset-remote-forward-ind', nil, 'true']
- @new_settings << ['keyset-reservation-timer', nil, '60' ] # 0-300
- @new_settings << ['dial-plan-enabled', nil, '' ]
- @new_settings << ['Canonical-dialing-international-prefix', nil, '']
- @new_settings << ['Canonical-dialing-local-country-code', nil, '']
- @new_settings << ['Canonical-dialing-national-prefix', nil, '']
- @new_settings << ['Canonical-dialing-local-area-code', nil, '']
- @new_settings << ['Canonical-dialing-local-node', nil, '']
- @new_settings << ['Canonical-dialing-external-access', nil, '0']
- @new_settings << ['Canonical-dialing-operator-code', nil, '']
- @new_settings << ['Canonical-dialing-emergency-number', nil, '']
- @new_settings << ['Canonical-dialing-dial-needs-access-code', nil, '0']
- @new_settings << ['Canonical-dialing-dial-needs-intGWcode', nil, '0']
- @new_settings << ['Canonical-dialing-min-local-number-length', nil, '10']
- @new_settings << ['Canonical-dialing-extension-initial-digits', nil, '']
- @new_settings << ['Canonical-dialing-dial-internal-form', nil, '0' ]
- @new_settings << ['Canonical-dialing-dial-external-form', nil, '0' ]
- @new_settings << ['Canonical-lookup-local-code', nil, '' ]
- @new_settings << ['Canonical-lookup-international-code', nil, '']
- @new_settings << ['hot-keypad-dialing', nil, '']
- @new_settings << ['ldap-transport', nil, '0']
- @new_settings << ['ldap-server-address', nil, '' ]
- @new_settings << ['ldap-server-port', nil, '389' ]
- @new_settings << ['ldap-authentication', nil, '1']
- @new_settings << ['ldap-user', nil, '' ]
- @new_settings << ['ldap-pwd', nil, '' ]
- @new_settings << ['ldap-max-responses', nil, '25']
- @new_settings << ['backup-addr', nil, '']
- @new_settings << ['backup-registration', nil, 'false']
- @new_settings << ['qdc-qcu-active', nil, 'false' ]
- @new_settings << ['min-admin-passw-length', nil, '6' ]
- @new_settings << ['default-locked-config-menus', nil, 'true' ]
- @new_settings << ['locked-config-menus', nil, 'true' ]
- @new_settings << ['default-locked-local-function-menus', nil, 'true' ]
- @new_settings << ['locked-local-function-menus', nil, 'true' ]
- @new_settings << ['dls-mode-secure', nil, '0' ]
- @new_settings << ['dls-chunk-size', nil, '9492']
- @new_settings << ['default-passw-policy', nil, 'false']
- @new_settings << ['deflect-destination', nil, '']
- @new_settings << ['display-skin', nil, '']
- @new_settings << ['enable-bluetooth-interface', nil, 'true']
- @new_settings << ['usb-access-enabled', nil, 'false' ]
- @new_settings << ['usb-backup-enabled', nil, 'false' ]
- @new_settings << ['line-button-mode', nil, '0' ]
- @new_settings << ['lock-forwarding', nil, '' ]
- @new_settings << ['loudspeaker-function-mode', nil, '0' ]
- @new_settings << ['max-pin-retries', nil, '' ]
- @new_settings << ['inactivity-timeout', nil, '30' ]
- @new_settings << ['not-used-timeout', nil, '2' ]
- @new_settings << ['passw-char-set', nil, '0' ]
- @new_settings << ['refuse-call', nil, 'true' ]
- @new_settings << ['restart-password', nil, '']
- #OPTIMIZE clock format
- @new_settings << ['time-format', nil, '0' ]# 1=12 h
- @new_settings << ['uaCSTA-enabled', nil, 'false' ]
- @new_settings << ['enable-test-interface', nil, 'false']
- @new_settings << ['enable-WBM', nil, 'true']
- @new_settings << ['pixelsaver-timeout', nil, '2' ]# 2 hours?
- @new_settings << ['voice-message-dial-tone', nil, '' ]
- @new_settings << ['call-pickup-allowed', nil, 'true' ]
- @new_settings << ['group-pickup-tone-allowed', nil, 'true']
- @new_settings << ['group-pickup-as-ringer', nil, 'false']
- @new_settings << ['group-pickup-alert-type', nil, '0' ]
- @new_settings << ['default-profile', nil, '' ]
- @new_settings << ['count-medium-priority', nil, '5']
- @new_settings << ['timer-medium-priority', nil, '60'] # 1 - 999
- @new_settings << ['timer-high-priority', nil, '5'] # 0 - 999
- @new_settings << ['dss-sip-detect-timer', nil, '10']
- @new_settings << ['dss-sip-deflect', nil, 'false' ]
- @new_settings << ['dss-sip-refuse', nil, 'false' ]
- @new_settings << ['feature-availability', nil, 'false']
- @new_settings << ['feature-availability', nil, 'true' ]
- @new_settings << ['feature-availability', nil, 'true' ]
- @new_settings << ['local-control-feature-availability', nil, 'false' ]
- @new_settings << ['trace-level', nil, '0' ] # Off
- @new_settings << ['default-locked-function-keys', nil, 'true' ]# "unknown item"
- #OPTIMIZE Put pickup prefix into database/global constant?
- @new_settings << ['blf-code', nil, 'f_ia_'] # pickup prefix for softkey function 59 (BLF)
- @new_settings << ['stimulus-feature-code', nil, true]
- @new_settings << ['stimulus-led-control-uri', nil, true]
-
-
- @new_settings << ['min-user-passw-length', nil, '6' ]# 6 - 24
- #OPTIMIZE language
- @new_settings << ['country-iso', nil, 'DE' ]
- @new_settings << ['language-iso', nil, 'de']
- @new_settings << ['date-format', nil, '0' ] # DD.MM.YYYY
- #OPTIMIZE ringtones
- @new_settings << ['ringer-melody', nil, '1']
-
- @new_settings << ['ringer-melody', nil, '2']
- @new_settings << ['ringer-tone-sequence', nil, '2']
-
- soft_keys = Array.new
- # Getting BLF keys only for the first level
- blf_keys = sip_account.softkeys.find(
- :all,
- :conditions => {:function => ['blf', 'conference']},
- :limit => blf_keys_max)
- #Getting other keys
- non_blf_keys = sip_account.softkeys.find(
- :all,
- :conditions => {:function => ['speed_dial']})
-
- # Fill softkey array with BLF keys up to shift key
- blf_keys.each do |k|
- soft_keys << k
- end
- # Fill sofkey with other keys up to end
- non_blf_keys.each do |k|
- if soft_keys.length < max_keys
- soft_keys << k
- end
- end
- # Delete unset softkeys
- while soft_keys.length < max_keys
- soft_keys << Softkey.new
- end
-
- key_pos=1
-
- #soft_keys.each do |sk|
-
- while key_pos < shift_key_position
-
- (1..shift_key_position-1).each do |key_idx|
- sk = soft_keys.shift
- logger.debug(sk.function, key_idx)
- if sk.function == "blf"
- @new_settings << ['function-key-def', key_idx, '59']
- @new_settings << ['select-dial', key_idx, sk.number ]
- elsif sk.function == "log_out"
- @new_settings << ['function-key-def', key_idx, '1']
- @new_settings << ['select-dial', key_idx, 'f_lo' ]
- elsif sk.function == "log_in"
- @new_settings << ['function-key-def', key_idx, '1']
- @new_settings << ['select-dial', key_idx, "f_li_#{sk.number}" ]
- elsif sk.function == "dtmf"
- @new_settings << ['function-key-def', key_idx, '54']
- @new_settings << ['stimulus-DTMF-sequence', key_idx, sk.number ]
- elsif sk.function.nil?
- @new_settings << ['function-key-def', key_idx, '0']
- else
- @new_settings << ['function-key-def', key_idx, '1']
- @new_settings << ['select-dial', key_idx, sk.number ]
- end
- @new_settings << ['key-label', key_idx, sk.label ]
- @new_settings << ['key-label-unicode', key_idx, sk.label ]
- key_pos = key_pos+1
-
- end
- end
- if key_pos == shift_key_position
- @new_settings << ['function-key-def', shift_key_position, '18']
- @new_settings << ['key-label', shift_key_position, 'Shift']
- @new_settings << ['key-label-unicode', shift_key_position, 'Shift']
- key_pos = key_pos+1
- end
-
- (1001..1000+shift_key_position-1).each do |key_idx|
- sk = soft_keys.shift
- if sk.function == "log_out"
- @new_settings << ['function-key-def', key_idx, '1']
- @new_settings << ['select-dial', key_idx, 'f_lo' ]
- elsif sk.function == "log_in"
- @new_settings << ['function-key-def', key_idx, '1']
- @new_settings << ['select-dial', key_idx, "f_li_#{sk.number}" ]
- elsif sk.function == "dtmf"
- @new_settings << ['function-key-def', key_idx, '54']
- @new_settings << ['stimulus-DTMF-sequence', key_idx, sk.number ]
- elsif sk.function.nil?
- @new_settings << ['function-key-def', key_idx, '0']
- else
- @new_settings << ['function-key-def', key_idx, '1']
- @new_settings << ['select-dial', key_idx, sk.number ]
- end
- @new_settings << ['key-label', key_idx, sk.label ]
- @new_settings << ['key-label-unicode', key_idx, sk.label ]
- key_pos = key_pos+1
-
- end
-
- #end
- logger.debug(@new_settings)
- end
-
- if @phone.nil? || sip_account.nil?
- respond_to { |format|
- format.xml { render :action => "clean-up" }
- }
-
- elsif (reply_status == 'accepted' && contact_reason == 'reply-to' && reply_action == 'ReadAllItems')
- respond_to { |format|
- format.xml { render :action => "write" }
- }
-
- elsif ["reply-to"].include? contact_reason
- respond_to { |format|
- format.xml { render :action => "clean-up" }
- }
-
- else
- respond_to { |format|
- format.xml { render :action => "index" }
- }
- end
-
- end
-end
diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb
index 7542415..149e601 100644
--- a/app/controllers/config_snom_controller.rb
+++ b/app/controllers/config_snom_controller.rb
@@ -5,13 +5,13 @@ class ConfigSnomController < ApplicationController
KEY_REGEXP = {
'0' => "[ -.,_0]+",
'1' => "[ -.,_1]+",
- '2' => "[abc2]",
- '3' => "[def3]",
- '4' => "[ghi4]",
+ '2' => "[abc2\xC3\xA4]",
+ '3' => "[def3\xC3\xA9]",
+ '4' => "[ghi4\xC3\xAF]",
'5' => "[jkl5]",
- '6' => "[mno6]",
- '7' => "[pqrs7]",
- '8' => "[tuv8]",
+ '6' => "[mno6\xC3\xB6]",
+ '7' => "[pqrs7\xC3\x9F]",
+ '8' => "[tuv8\xC3\xBC]",
'9' => "[wxyz9]",
}
@@ -34,8 +34,8 @@ class ConfigSnomController < ApplicationController
@phone = Phone.where({ :mac_address => @mac_address }).first
end
- if ! @phone && PROVISIONING_AUTO_ADD_PHONE
- tenant = Tenant.where(:id => PROVISIONING_AUTO_TENANT_ID).first
+ if ! @phone && GsParameter.get('PROVISIONING_AUTO_ADD_PHONE')
+ tenant = Tenant.where(:id => GsParameter.get('PROVISIONING_AUTO_TENANT_ID')).first
if ! tenant
render(
:status => 404,
@@ -80,7 +80,7 @@ class ConfigSnomController < ApplicationController
'00041345' => 'Snom 821',
'00041348' => 'Snom 821',
'00041341' => 'Snom 870',
- '00041332' => 'snom MeetingPoint',
+ '00041332' => 'Snom meetingPoint',
}
@phone.phone_model = PhoneModel.where(:name => mac_address_to_model[@mac_address[0, 8]]).first
@@ -94,12 +94,12 @@ class ConfigSnomController < ApplicationController
return
end
- if ! PROVISIONING_AUTO_ADD_SIP_ACCOUNT
+ if ! GsParameter.get('PROVISIONING_AUTO_ADD_SIP_ACCOUNT')
return
end
caller_name_index = 0
- sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}%").sort { |item1, item2|
+ sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}%").sort { |item1, item2|
item1.caller_name.gsub(/[^0-9]/, '').to_i <=> item2.caller_name.gsub(/[^0-9]/, '').to_i
}.last
@@ -109,18 +109,18 @@ class ConfigSnomController < ApplicationController
caller_name_index = caller_name_index + 1
@sip_account = tenant.sip_accounts.build
- @sip_account.caller_name = "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}#{caller_name_index}"
- @sip_account.call_waiting = CALL_WAITING
- @sip_account.clir = DEFAULT_CLIR_SETTING
- @sip_account.clip = DEFAULT_CLIP_SETTING
+ @sip_account.caller_name = "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}#{caller_name_index}"
+ @sip_account.call_waiting = GsParameter.get('CALL_WAITING')
+ @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING')
+ @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING')
@sip_account.voicemail_pin = random_pin
- @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT
+ @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT')
@sip_account.hotdeskable = false
loop do
- @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME)
+ @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME'))
break unless SipAccount.exists?(:auth_name => @sip_account.auth_name)
end
- @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD)
+ @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD'))
if ! @sip_account.save
render(
@@ -182,9 +182,9 @@ class ConfigSnomController < ApplicationController
send_sensitve = @provisioning_authenticated || !@phone.provisioning_key_active
@phone_settings = Hash.new()
- if defined?(PROVISIONING_KEY_LENGTH) && PROVISIONING_KEY_LENGTH > 0
+ if !GsParameter.get('PROVISIONING_KEY_LENGTH').nil? && GsParameter.get('PROVISIONING_KEY_LENGTH') > 0
if @phone.provisioning_key.blank?
- @phone.update_attributes({ :provisioning_key => SecureRandom.hex(PROVISIONING_KEY_LENGTH), :provisioning_key_active => false })
+ @phone.update_attributes({ :provisioning_key => SecureRandom.hex(GsParameter.get('PROVISIONING_KEY_LENGTH')), :provisioning_key_active => false })
elsif @provisioning_authenticated
@phone.update_attributes({ :provisioning_key_active => true })
end
@@ -199,19 +199,19 @@ class ConfigSnomController < ApplicationController
end
end
- if defined?(PROVISIONING_SET_HTTP_USER) && @phone.http_user.blank?
- if PROVISIONING_SET_HTTP_USER.class == Fixnum
- @phone.update_attributes({ :http_user => SecureRandom.hex(PROVISIONING_SET_HTTP_USER) })
- elsif PROVISIONING_SET_HTTP_USER.class == String
- @phone.update_attributes({ :http_user => PROVISIONING_SET_HTTP_USER })
+ if !GsParameter.get('PROVISIONING_SET_HTTP_USER').nil? && @phone.http_user.blank?
+ if GsParameter.get('PROVISIONING_SET_HTTP_USER').class == Fixnum
+ @phone.update_attributes({ :http_user => SecureRandom.hex(GsParameter.get('PROVISIONING_SET_HTTP_USER')) })
+ elsif GsParameter.get('PROVISIONING_SET_HTTP_USER').class == String
+ @phone.update_attributes({ :http_user => GsParameter.get('PROVISIONING_SET_HTTP_USER') })
end
end
- if defined?(PROVISIONING_SET_HTTP_PASSWORD) && @phone.http_password.blank?
- if PROVISIONING_SET_HTTP_PASSWORD.class == Fixnum
- @phone.update_attributes({ :http_password => SecureRandom.hex(PROVISIONING_SET_HTTP_PASSWORD) })
- elsif PROVISIONING_SET_HTTP_PASSWORD.class == String
- @phone.update_attributes({ :http_password => PROVISIONING_SET_HTTP_PASSWORD })
+ if !GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD').nil? && @phone.http_password.blank?
+ if GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD').class == Fixnum
+ @phone.update_attributes({ :http_password => SecureRandom.hex(GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD')) })
+ elsif GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD').class == String
+ @phone.update_attributes({ :http_password => GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD') })
end
end
@@ -503,6 +503,11 @@ class ConfigSnomController < ApplicationController
:idle_down => "keyevent F_NEXT_ID",
:idle_left => "url #{xml_applications_url}/call_history.xml?type=received",
:idle_right => "url #{xml_applications_url}/call_history.xml?type=missed",
+ :touch_idle_adr_book => "url #{xml_applications_url}/phone_book.xml",
+ :touch_idle_list_missed => "url #{xml_applications_url}/call_history.xml?type=missed",
+ :touch_idle_list_taken => "url #{xml_applications_url}/call_history.xml?type=received",
+ :touch_idle_redial => "url #{xml_applications_url}/call_history.xml?type=dialed",
+ :touch_idle_dialog => "url #{xml_applications_url}/call_history.xml",
}
# Remap conference key to first conference if found
diff --git a/app/controllers/fax_accounts_controller.rb b/app/controllers/fax_accounts_controller.rb
index ce03bc5..031080e 100644
--- a/app/controllers/fax_accounts_controller.rb
+++ b/app/controllers/fax_accounts_controller.rb
@@ -15,8 +15,8 @@ class FaxAccountsController < ApplicationController
def new
@fax_account = @parent.fax_accounts.build
@fax_account.name = generate_a_new_name(@parent, @fax_account)
- @fax_account.days_till_auto_delete = DAYS_TILL_AUTO_DELETE
- @fax_account.retries = DEFAULT_NUMBER_OF_RETRIES
+ @fax_account.days_till_auto_delete = GsParameter.get('DAYS_TILL_AUTO_DELETE')
+ @fax_account.retries = GsParameter.get('DEFAULT_NUMBER_OF_RETRIES')
@fax_account.station_id = @parent.to_s
@fax_account.phone_numbers.build
if @parent.class == User && !@parent.email.blank?
diff --git a/app/controllers/gateway_parameters_controller.rb b/app/controllers/gateway_parameters_controller.rb
new file mode 100644
index 0000000..d5ade9e
--- /dev/null
+++ b/app/controllers/gateway_parameters_controller.rb
@@ -0,0 +1,44 @@
+class GatewayParametersController < ApplicationController
+ load_and_authorize_resource :gateway
+ load_and_authorize_resource :gateway_parameter, :through => [:gateway]
+
+ def index
+ @gateway_parameters = @gateway.gateway_parameters
+ end
+
+ def show
+ @gateway_parameter = @gateway.gateway_parameters.find(params[:id])
+ end
+
+ def new
+ @gateway_parameter = @gateway.gateway_parameters.build
+ end
+
+ def create
+ @gateway_parameter = @gateway.gateway_parameters.build(params[:gateway_parameter])
+ if @gateway_parameter.save
+ redirect_to @gateway, :notice => t('gateway_parameters.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @gateway_parameter = @gateway.gateway_parameters.find(params[:id])
+ end
+
+ def update
+ @gateway_parameter = @gateway.gateway_parameters.find(params[:id])
+ if @gateway_parameter.update_attributes(params[:gateway_parameter])
+ redirect_to @gateway, :notice => t('gateway_parameters.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @gateway_parameter = @gateway.gateway_parameters.find(params[:id])
+ @gateway_parameter.destroy
+ redirect_to gateway_path(@gateway), :notice => t('gateway_parameters.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/controllers/gateway_settings_controller.rb b/app/controllers/gateway_settings_controller.rb
new file mode 100644
index 0000000..0304411
--- /dev/null
+++ b/app/controllers/gateway_settings_controller.rb
@@ -0,0 +1,44 @@
+class GatewaySettingsController < ApplicationController
+ load_and_authorize_resource :gateway
+ load_and_authorize_resource :gateway_setting, :through => [:gateway]
+
+ def index
+ @gateway_settings = @gateway.gateway_settings
+ end
+
+ def show
+ end
+
+ def new
+ # @gateway_setting = @gateway.gateway_settings.build
+ end
+
+ def create
+ @gateway_setting = @gateway.gateway_settings.build(params[:gateway_setting])
+ @gateway_setting.class_type = GatewaySetting::GATEWAY_SETTINGS[@gateway.technology][@gateway_setting.name]
+ if @gateway_setting.save
+ redirect_to @gateway, :notice => t('gateway_settings.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @gateway_setting = @gateway.gateway_settings.find(params[:id])
+ end
+
+ def update
+ @gateway_setting = @gateway.gateway_settings.find(params[:id])
+ if @gateway_setting.update_attributes(params[:gateway_setting])
+ redirect_to @gateway, :notice => t('gateway_settings.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @gateway_setting = @gateway.gateway_settings.find(params[:id])
+ @gateway_setting.destroy
+ redirect_to gateway_path(@gateway), :notice => t('gateway_settings.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/controllers/gateways_controller.rb b/app/controllers/gateways_controller.rb
new file mode 100644
index 0000000..5741195
--- /dev/null
+++ b/app/controllers/gateways_controller.rb
@@ -0,0 +1,57 @@
+class GatewaysController < ApplicationController
+ authorize_resource :gateway
+
+ def index
+ @gateways = Gateway.all
+ spread_breadcrumbs
+ end
+
+ def show
+ @gateway = Gateway.find(params[:id])
+ spread_breadcrumbs
+ end
+
+ def new
+ @gateway = Gateway.new
+ spread_breadcrumbs
+ end
+
+ def create
+ @gateway = Gateway.new(params[:gateway])
+ spread_breadcrumbs
+ if @gateway.save
+ redirect_to @gateway, :notice => t('gateways.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @gateway = Gateway.find(params[:id])
+ spread_breadcrumbs
+ end
+
+ def update
+ @gateway = Gateway.find(params[:id])
+ spread_breadcrumbs
+ if @gateway.update_attributes(params[:gateway])
+ redirect_to @gateway, :notice => t('gateways.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @gateway = Gateway.find(params[:id])
+ @gateway.destroy
+ redirect_to gateways_url, :notice => t('gateways.controller.successfuly_destroyed')
+ end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("gateways.index.page_title"), gateways_path
+ if @gateway && !@gateway.new_record?
+ add_breadcrumb @gateway, @gateway
+ end
+ end
+end
diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb
index e871862..347e043 100644
--- a/app/controllers/gemeinschaft_setups_controller.rb
+++ b/app/controllers/gemeinschaft_setups_controller.rb
@@ -1,8 +1,12 @@
class GemeinschaftSetupsController < ApplicationController
+ # We use the heater rake task to generate this file.
+ # So it loads super fast even on slow machines.
+ #
+ caches_page :new, :gzip => :best_compression
+
load_and_authorize_resource :gemeinschaft_setup
skip_before_filter :go_to_setup_if_new_installation
- # before_filter :redirect_if_not_a_fresh_installation
def new
@user = @gemeinschaft_setup.build_user(
@@ -21,7 +25,7 @@ class GemeinschaftSetupsController < ApplicationController
def create
if @gemeinschaft_setup.save
super_tenant = Tenant.create(
- :name => SUPER_TENANT_NAME,
+ :name => GsParameter.get('SUPER_TENANT_NAME'),
:country_id => @gemeinschaft_setup.country.id,
:language_id => @gemeinschaft_setup.language_id,
:description => t('gemeinschaft_setups.initial_setup.super_tenant_description'),
@@ -41,6 +45,25 @@ class GemeinschaftSetupsController < ApplicationController
super_tenant_super_admin_group = super_tenant.user_groups.create(:name => t('gemeinschaft_setups.initial_setup.super_admin_group_name'))
super_tenant_super_admin_group.user_group_memberships.create(:user_id => user.id)
+ # Set CallRoute defaults
+ CallRoute.factory_defaults_prerouting(@gemeinschaft_setup.country.country_code,
+ @gemeinschaft_setup.country.trunk_prefix,
+ @gemeinschaft_setup.country.international_call_prefix,
+ '',
+ @gemeinschaft_setup.default_area_code
+ )
+
+ # Set a couple of URLs in the GsParameter table
+ GsParameter.where(:name => 'phone_book_entry_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/phone_book_entry/image")
+ GsParameter.where(:name => 'ringtone_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}")
+ GsParameter.where(:name => 'user_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/user/image")
+
+ # Restart FreeSWITCH
+ if Rails.env.production?
+ require 'freeswitch_event'
+ FreeswitchAPI.execute('fsctl', 'shutdown restart')
+ end
+
# Auto-Login:
session[:user_id] = user.id
@@ -51,16 +74,4 @@ class GemeinschaftSetupsController < ApplicationController
end
end
- private
-
- def redirect_if_not_a_fresh_installation
- if GemeinschaftSetup.all.count > 0
- if current_user
- redirect_to root_url , :alert => t('gemeinschaft_setups.initial_setup.access_denied_only_available_on_a_new_system')
- else
- redirect_to log_in_path , :alert => t('gemeinschaft_setups.initial_setup.access_denied_only_available_on_a_new_system')
- end
- end
- end
-
end
diff --git a/app/controllers/gs_nodes_controller.rb b/app/controllers/gs_nodes_controller.rb
index 3667775..17c9e8b 100644
--- a/app/controllers/gs_nodes_controller.rb
+++ b/app/controllers/gs_nodes_controller.rb
@@ -70,7 +70,7 @@ class GsNodesController < ApplicationController
@request_class = '';
end
- @node = GsNode.where(:ip_address => HOMEBASE_IP_ADDRESS).first
+ @node = GsNode.where(:ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS')).first
if @request_class.blank? || @request_class == "tenants"
@tenants = Tenant.where('updated_at > ?', @newer_as)
diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb
new file mode 100644
index 0000000..bd8b44b
--- /dev/null
+++ b/app/controllers/gs_parameters_controller.rb
@@ -0,0 +1,44 @@
+class GsParametersController < ApplicationController
+ load_and_authorize_resource :gs_parameter
+
+ before_filter :spread_breadcrumbs
+
+ def index
+ @gs_parameters_unordered = GsParameter.scoped
+ @gs_parameters = GsParameter.order([:section, :name])
+ @sections = @gs_parameters.pluck(:section).uniq.sort
+ end
+
+ def show
+ @gs_parameter = GsParameter.find(params[:id])
+ end
+
+ def new
+ @gs_parameter = GsParameter.new
+ end
+
+ def edit
+ @gs_parameter = GsParameter.find(params[:id])
+ end
+
+ def update
+ @gs_parameter = GsParameter.find(params[:id])
+ if @gs_parameter.update_attributes(gs_parameter_params)
+ redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ private
+ def gs_parameter_params
+ params.require(:gs_parameter).permit(:value, :class_type, :description)
+ end
+
+ def spread_breadcrumbs
+ add_breadcrumb t("gs_parameters.index.page_title"), gs_parameters_path
+ if @gs_parameter && !@gs_parameter.new_record?
+ add_breadcrumb @gs_parameter, gs_parameter_path(@gs_parameter)
+ end
+ end
+end
diff --git a/app/controllers/gui_functions_controller.rb b/app/controllers/gui_functions_controller.rb
index 2ab2c5e..0cb7898 100644
--- a/app/controllers/gui_functions_controller.rb
+++ b/app/controllers/gui_functions_controller.rb
@@ -1,4 +1,6 @@
class GuiFunctionsController < ApplicationController
+ load_resource :gui_function
+
before_filter :load_user_groups
before_filter :spread_breadcrumbs
@@ -60,14 +62,10 @@ class GuiFunctionsController < ApplicationController
end
def spread_breadcrumbs
- if @tenant
- add_breadcrumb t("user_groups.index.page_title"), tenant_user_groups_path(@tenant)
- if @user_group && !@user_group.new_record?
- add_breadcrumb @user_group, tenant_user_group_path(@tenant, @user_group)
- end
- end
-
add_breadcrumb t("gui_functions.index.page_title"), gui_functions_path
+ if @gui_function && !@gui_function.new_record?
+ add_breadcrumb @gui_function, gui_function_path(@gui_function)
+ end
end
end
diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb
index 4ea4d25..dc5f57b 100644
--- a/app/controllers/page_controller.rb
+++ b/app/controllers/page_controller.rb
@@ -5,7 +5,12 @@ class PageController < ApplicationController
before_filter :if_fresh_system_then_go_to_wizard
skip_before_filter :home_breadcrumb, :only => [:index]
- def index;end
+ def index
+ if current_user
+ redirect_to [current_user.current_tenant, current_user]
+ end
+ end
+
def conference;end
def beginners_intro;end
diff --git a/app/controllers/phone_book_entries_controller.rb b/app/controllers/phone_book_entries_controller.rb
index 823d50e..9cc9f18 100644
--- a/app/controllers/phone_book_entries_controller.rb
+++ b/app/controllers/phone_book_entries_controller.rb
@@ -71,7 +71,7 @@ class PhoneBookEntriesController < ApplicationController
order([ :last_name, :first_name, :organization ]).
paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
end
diff --git a/app/controllers/phone_books_controller.rb b/app/controllers/phone_books_controller.rb
index 54e7889..5f2d61f 100644
--- a/app/controllers/phone_books_controller.rb
+++ b/app/controllers/phone_books_controller.rb
@@ -22,7 +22,7 @@ class PhoneBooksController < ApplicationController
order([ :last_name, :first_name ]).
paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
else
# search by name
@@ -39,7 +39,7 @@ class PhoneBooksController < ApplicationController
order([ :last_name, :first_name ]).
paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
end
end
diff --git a/app/controllers/phone_numbers_controller.rb b/app/controllers/phone_numbers_controller.rb
index 065934c..c562954 100644
--- a/app/controllers/phone_numbers_controller.rb
+++ b/app/controllers/phone_numbers_controller.rb
@@ -77,6 +77,23 @@ class PhoneNumbersController < ApplicationController
redirect_to :back
end
+ def call
+ sip_account = nil
+ current_user.sip_accounts.each do |user_sip_account|
+ if user_sip_account.registration
+ sip_account = user_sip_account
+ break
+ end
+ end
+
+ if can?(:call, @phone_number) && sip_account
+ if ! @phone_number.number.blank?
+ sip_account.call(@phone_number.number)
+ end
+ end
+ redirect_to(:back)
+ end
+
private
def set_and_authorize_parent
@parent = @phone_book_entry || @sip_account || @conference || @fax_account ||
diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb
index 2698465..3672390 100644
--- a/app/controllers/phones_controller.rb
+++ b/app/controllers/phones_controller.rb
@@ -46,6 +46,7 @@ class PhonesController < ApplicationController
m = method( :"#{@phoneable.class.name.underscore}_phone_path" )
redirect_to m.( @phoneable, @phone ), :notice => t('phones.controller.successfuly_updated')
else
+ set_fallback_sip_accounts
render :edit
end
end
@@ -78,11 +79,11 @@ class PhonesController < ApplicationController
end
def set_fallback_sip_accounts
- used_sip_account_ids = Phone.where(:fallback_sip_account_id => SipAccount.pluck(:id)).pluck(:fallback_sip_account_id)
- @fallback_sip_accounts = SipAccount.where(:sip_accountable_type => 'Tenant').where(:hotdeskable => true) - SipAccount.where(:id => used_sip_account_ids)
- if @phone && !@phone.fallback_sip_account_id.blank? && SipAccount.exists?(@phone.fallback_sip_account_id)
- @fallback_sip_accounts << SipAccount.where(:id => @phone.fallback_sip_account_id).first
+ used_sip_account_ids = Phone.pluck(:fallback_sip_account_id) + PhoneSipAccount.pluck(:sip_account_id)
+ if @phone
+ used_sip_account_ids = used_sip_account_ids - [ @phone.fallback_sip_account_id ]
end
+ @fallback_sip_accounts = SipAccount.where(:sip_accountable_type => 'Tenant') - SipAccount.where(:id => used_sip_account_ids)
end
end
diff --git a/app/controllers/route_elements_controller.rb b/app/controllers/route_elements_controller.rb
new file mode 100644
index 0000000..c4e4c1a
--- /dev/null
+++ b/app/controllers/route_elements_controller.rb
@@ -0,0 +1,67 @@
+class RouteElementsController < ApplicationController
+ load_and_authorize_resource :call_route
+ load_and_authorize_resource :route_element, :through => [:call_route]
+
+ before_filter :spread_breadcrumbs
+
+ def index
+ @route_elements = @call_route.route_elements
+ end
+
+ def show
+ @route_element = @call_route.route_elements.find(params[:id])
+ end
+
+ def new
+ @route_element = @call_route.route_elements.build
+ end
+
+ def create
+ @route_element = @call_route.route_elements.build(params[:route_element])
+ if @route_element.save
+ redirect_to [@call_route, @route_element], :notice => t('route_elements.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @route_element = @call_route.route_elements.find(params[:id])
+ end
+
+ def update
+ @route_element = @call_route.route_elements.find(params[:id])
+ if @route_element.update_attributes(params[:route_element])
+ redirect_to [@call_route, @route_element], :notice => t('route_elements.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @route_element = @call_route.route_elements.find(params[:id])
+ @route_element.destroy
+ redirect_to call_route_route_elements_path(@call_route), :notice => t('route_elements.controller.successfuly_destroyed')
+ end
+
+ def move_higher
+ @route_element.move_higher
+ redirect_to :back
+ end
+
+ def move_lower
+ @route_element.move_lower
+ redirect_to :back
+ end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("call_routes.index.page_title"), call_routes_path
+ add_breadcrumb @call_route, call_route_path(@call_route)
+ add_breadcrumb t("route_elements.index.page_title"), call_route_route_elements_path(@call_route)
+ if @route_element && !@route_element.new_record?
+ add_breadcrumb @route_element, call_route_route_element_path(@call_route, @route_element)
+ end
+ end
+
+end
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index f92ae1c..81b04e0 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -36,7 +36,7 @@ class SessionsController < ApplicationController
private
def redirect_to_https
- if GUI_REDIRECT_HTTPS and ! request.ssl?
+ if GsParameter.get('GUI_REDIRECT_HTTPS') and ! request.ssl?
redirect_to :protocol => "https://"
end
end
diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb
index 1f3166e..a83208b 100644
--- a/app/controllers/sip_accounts_controller.rb
+++ b/app/controllers/sip_accounts_controller.rb
@@ -15,21 +15,23 @@ class SipAccountsController < ApplicationController
def new
@sip_account = @parent.sip_accounts.build
@sip_account.caller_name = @parent
- @sip_account.call_waiting = CALL_WAITING
- @sip_account.clir = DEFAULT_CLIR_SETTING
- @sip_account.clip = DEFAULT_CLIP_SETTING
+ @sip_account.call_waiting = GsParameter.get('CALL_WAITING')
+ @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING')
+ @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING')
@sip_account.voicemail_pin = random_pin
- @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT
- @sip_account.hotdeskable = true
+ @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT')
+ if @parent.class == User
+ @sip_account.hotdeskable = true
+ end
# Make sure that we don't use an already taken auth_name
#
loop do
- @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME)
+ @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME'))
break unless SipAccount.exists?(:auth_name => @sip_account.auth_name)
end
- @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD)
+ @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD'))
end
def create
@@ -37,13 +39,13 @@ class SipAccountsController < ApplicationController
if @sip_account.auth_name.blank?
loop do
- @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME)
+ @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME'))
break unless SipAccount.exists?(:auth_name => @sip_account.auth_name)
end
end
if @sip_account.password.blank?
- @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD)
+ @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD'))
end
if @sip_account.save
@@ -69,7 +71,7 @@ class SipAccountsController < ApplicationController
def destroy
@sip_account.destroy
m = method( :"#{@parent.class.name.underscore}_sip_accounts_url" )
- redirect_to m.( @parent ), :notice => t('sip_accounts.controller.successfuly_destroyed')
+ redirect_to :back, :notice => t('sip_accounts.controller.successfuly_destroyed')
end
private
diff --git a/app/controllers/tenants_controller.rb b/app/controllers/tenants_controller.rb
index 7bb8ecd..cb67e5f 100644
--- a/app/controllers/tenants_controller.rb
+++ b/app/controllers/tenants_controller.rb
@@ -1,13 +1,17 @@
class TenantsController < ApplicationController
- load_and_authorize_resource :tenant
+ authorize_resource :tenant
def index
+ @tenants = Tenant.scoped
end
def show
+ @tenant = Tenant.find(params[:id])
+ @gateways = Gateway.order(:updated_at)
end
def new
+ @tenant = Tenant.new
@tenant.name = generate_a_new_name(@tenant)
@tenant.sip_domain = SipDomain.last
@tenant.country = GemeinschaftSetup.first.country
@@ -18,6 +22,8 @@ class TenantsController < ApplicationController
end
def create
+ @tenant = Tenant.new(tenant_params)
+
if @tenant.save
# Become a member of this tenant.
#
@@ -86,10 +92,12 @@ class TenantsController < ApplicationController
end
def edit
+ @tenant = Tenant.find(params[:id])
end
def update
- if @tenant.update_attributes(params[:tenant])
+ @tenant = Tenant.find(params[:id])
+ if @tenant.update_attributes(tenant_params)
redirect_to @tenant, :notice => t('tenants.controller.successfuly_updated')
else
render :edit
@@ -97,8 +105,15 @@ class TenantsController < ApplicationController
end
def destroy
+ @tenant = Tenant.find(params[:id])
@tenant.destroy
redirect_to tenants_url, :notice => t('tenants.controller.successfuly_destroyed')
end
+
+ private
+ def tenant_params
+ params.require(:tenant).permit(:name, :description, :sip_domain_id, :country_id, :language_id, :from_field_pin_change_email, :from_field_voicemail_email
+)
+ end
end
diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb
new file mode 100644
index 0000000..e9821f6
--- /dev/null
+++ b/app/controllers/trigger_controller.rb
@@ -0,0 +1,11 @@
+class TriggerController < ApplicationController
+ def voicemail
+ # Something is triggered when ever a local script fetches this action.
+ #
+ end
+
+ def fax
+ # Something is triggered when ever a local script fetches this action.
+ #
+ end
+end
diff --git a/app/controllers/user_groups_controller.rb b/app/controllers/user_groups_controller.rb
index ff3292c..9e08ff1 100644
--- a/app/controllers/user_groups_controller.rb
+++ b/app/controllers/user_groups_controller.rb
@@ -38,7 +38,7 @@ class UserGroupsController < ApplicationController
def destroy
@user_group.destroy
- redirect_to method( :"#{@parent.class.name.underscore}_user_groups_path" ).(@parent), :notice => t('user_groups.controller.successfuly_destroyed')
+ redirect_to :back, :notice => t('user_groups.controller.successfuly_destroyed')
end
private
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 454c26b..584d08c 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -10,7 +10,7 @@ class UsersController < ApplicationController
end
def show
- @phone_books = PhoneBook.accessible_by( Ability.new( @user ) ).all
+ @phone_books = PhoneBook.accessible_by( Ability.new( @user ), :read )
end
def new
@@ -52,7 +52,7 @@ class UsersController < ApplicationController
def destroy
@user.destroy
- redirect_to @parent, :notice => t('users.controller.successfuly_destroyed')
+ redirect_to :back, :notice => t('users.controller.successfuly_destroyed')
end
def destroy_avatar
diff --git a/app/controllers/voicemail_messages_controller.rb b/app/controllers/voicemail_messages_controller.rb
index 58f5265..dfe0ae4 100644
--- a/app/controllers/voicemail_messages_controller.rb
+++ b/app/controllers/voicemail_messages_controller.rb
@@ -24,17 +24,17 @@ class VoicemailMessagesController < ApplicationController
if @type == 'read'
@voicemail_messages = @sip_account.voicemail_messages.where('read_epoch > 0').order('created_epoch DESC').paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
elsif @type == 'unread'
@voicemail_messages = @sip_account.voicemail_messages.where(:read_epoch => 0).order('created_epoch DESC').paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
else
@voicemail_messages = @sip_account.voicemail_messages.order('created_epoch DESC').paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
end
end