From 3893e50c2b27cf8b3958ed1b36697ab66a7f70b5 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 16 Aug 2013 08:11:52 +0200 Subject: set fallback_sip_account as a valid sip_account --- app/controllers/config_snom_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb index 1cac4b2..5b31064 100644 --- a/app/controllers/config_snom_controller.rb +++ b/app/controllers/config_snom_controller.rb @@ -63,7 +63,10 @@ class ConfigSnomController < ApplicationController if !params[:phone].blank? @phone = Phone.where({ :id => params[:phone].to_i }).first if !params[:sip_account].blank? - @sip_account = @phone.sip_accounts.where({ :id => params[:sip_account].to_i }).first + @sip_account = @phone.sip_accounts.where({ :id => params[:sip_account].to_i }).first || + if !@sip_account && @phone.fallback_sip_account && @phone.fallback_sip_account.id == params[:sip_account].to_i + @sip_account = @phone.fallback_sip_account + end end end -- cgit v1.2.3