diff options
author | Peter Kozak <spag@golwen.net> | 2013-05-07 12:58:01 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-05-07 12:58:01 +0200 |
commit | c5bfe11c01f2b3575ec96b6bd6f567976d93ff63 (patch) | |
tree | 885ac2fc3b795833df499917e69db3cb2ac3dacf /app | |
parent | 289d88ee79ea5dc4228cf93a64faddf5c0815c54 (diff) |
support for additional provisioning parameters
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/config_snom_controller.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb index b692693..805f682 100644 --- a/app/controllers/config_snom_controller.rb +++ b/app/controllers/config_snom_controller.rb @@ -242,6 +242,7 @@ class ConfigSnomController < ApplicationController phone_sip_accounts = Array.new() if send_sensitve + phone_parameters = GsParameter.get_list('phones', 'snom') if @phone.sip_accounts && @phone.sip_accounts.count > 0 phone_sip_accounts = @phone.sip_accounts elsif @phone.fallback_sip_account @@ -250,6 +251,7 @@ class ConfigSnomController < ApplicationController expiry_seconds = GsParameter.get('SIP_EXPIRY_SECONDS') phone_sip_accounts.each do |sip_account| if (sip_account.sip_accountable_type == @phone.phoneable_type) and (sip_account.sip_accountable_id == @phone.phoneable_id) + snom_sip_account = { :id => sip_account.id, :active => 'on', @@ -259,7 +261,7 @@ class ConfigSnomController < ApplicationController :outbound => sip_account.host, :name => sip_account.auth_name, :realname => 'Call', - :idle_text => sip_account.caller_name, + :user_idle_text => sip_account.caller_name, :expiry => expiry_seconds, } @@ -267,6 +269,16 @@ class ConfigSnomController < ApplicationController snom_sip_account[:mailbox] = "<sip:#{sip_account.voicemail_account.name}@#{sip_account.host}>" end + phone_parameters.each do |name, value| + snom_sip_account[name.to_sym] = value.gsub!(/\{([a-z0-9_\.]+)\}/) { |v| + source = sip_account + $1.split('.').each do |method| + source = source.send(method) if source.respond_to?(method) + end + source.to_s + } + end + @sip_accounts.push(snom_sip_account) sip_account_index = @sip_accounts.length sip_account.softkeys.order(:position).each do |softkey| |