summaryrefslogtreecommitdiff
path: root/app/controllers/config_snom_controller.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-12 13:53:28 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-12 13:53:28 +0100
commitc9066760fd1f5f2f892ce2be5cf2a83bb5210246 (patch)
tree82ecdd528e803ccd1b469dc13482e06cf8ea0b8e /app/controllers/config_snom_controller.rb
parent0b97717b2171820dea41de8df705f8f0e4b71464 (diff)
parentfb66a5e5a4c5d5f9eac4a5e8de6a286482cb55d5 (diff)
Release a new beta.5.1-beta4
Diffstat (limited to 'app/controllers/config_snom_controller.rb')
-rw-r--r--app/controllers/config_snom_controller.rb48
1 files changed, 37 insertions, 11 deletions
diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb
index e797a43..58cced2 100644
--- a/app/controllers/config_snom_controller.rb
+++ b/app/controllers/config_snom_controller.rb
@@ -247,6 +247,7 @@ class ConfigSnomController < ApplicationController
elsif @phone.fallback_sip_account
phone_sip_accounts.push( @phone.fallback_sip_account )
end
+ 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 = {
@@ -259,7 +260,8 @@ class ConfigSnomController < ApplicationController
:name => sip_account.auth_name,
:realname => 'Call',
:idle_text => sip_account.caller_name,
- :mailbox => "<sip:#{sip_account.auth_name}@#{sip_account.host}>"
+ :mailbox => "<sip:#{sip_account.auth_name}@#{sip_account.host}>",
+ :expiry => expiry_seconds,
}
@sip_accounts.push(snom_sip_account)
sip_account_index = @sip_accounts.length
@@ -280,23 +282,47 @@ class ConfigSnomController < ApplicationController
@softkeys.push({:context => sip_account_index, :label => softkey.label, :data => "speed f-li-#{softkey.number}"})
when 'conference'
@softkeys.push({:context => sip_account_index, :label => softkey.label, :data => "blf <sip:#{softkey.number}@#{sip_account.host}>|f-ta-"})
- when 'call_forwarding'
+ when 'call_parking'
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
:subscription => {
- :to => "f-cftg-#{softkey.call_forward_id}@#{sip_account.host}",
+ :to => "park+#{@softkeys.softkeyable_id}@#{sip_account.host}",
:for => "#{sip_account.auth_name}@#{sip_account.host}"
},
:actions => [{
- :type => :url,
- :target => "#{request.protocol}#{request.host_with_port}/config_snom/#{@phone.id}/#{snom_sip_account[:id]}/call_forwarding.xml?id=#{softkey.call_forward_id}&function=toggle",
+ :type => :dial,
+ :target => "f-tpark-#{@softkeys.softkeyable_id}",
+ :when => 'on press',
+ :states => 'connected,holding',
+ },{
+ :type => :dial,
+ :target => "f-park-#{@softkeys.softkeyable_id}",
:when => 'on press',
}],
})
+ when 'call_forwarding'
+ if softkey.softkeyable.class == CallForward then
+ @softkeys.push({
+ :context => sip_account_index,
+ :function => softkey.softkey_function.name,
+ :label => softkey.label,
+ :softkey => softkey,
+ :general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
+ :subscription => {
+ :to => "f-cftg-#{softkey.softkeyable_id}@#{sip_account.host}",
+ :for => "#{sip_account.auth_name}@#{sip_account.host}"
+ },
+ :actions => [{
+ :type => :url,
+ :target => "#{request.protocol}#{request.host_with_port}/config_snom/#{@phone.id}/#{snom_sip_account[:id]}/call_forwarding.xml?id=#{softkey.softkeyable_id}&function=toggle",
+ :when => 'on press',
+ }],
+ })
+ end
when 'call_forwarding_always'
phone_number = PhoneNumber.where(:number => softkey.number, :phone_numberable_type => 'SipAccount').first
if phone_number
@@ -308,7 +334,7 @@ class ConfigSnomController < ApplicationController
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
@@ -333,7 +359,7 @@ class ConfigSnomController < ApplicationController
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
@@ -373,7 +399,7 @@ class ConfigSnomController < ApplicationController
if hunt_group_member
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
@@ -403,7 +429,7 @@ class ConfigSnomController < ApplicationController
if acd_agent
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
@@ -922,7 +948,7 @@ AAAA'
if @call_forwarding_id
call_forwarding = @sip_account.call_forwards.where(:id => @call_forwarding_id).first
- if !call_forwarding and @sip_account.softkeys.where(:call_forward_id => @call_forwarding_id).count > 0
+ if !call_forwarding and @sip_account.softkeys.where(:softkeyable_id => @call_forwarding_id, :softkeyable_type => 'CallForward').count > 0
call_forwarding = CallForward.where(:id => @call_forwarding_id).first
end