From 401923c7380e3d6c30b4fc8ee174d3fe4bd7e0de Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 18 May 2018 08:48:39 +0200 Subject: [PATCH] Fixed issue #2029 - Make sipgate.io integration working by just enable it. --- ...01_issue2029_sipgate_integration_enable.rb | 24 +++++++++++++++++++ db/seeds/settings.rb | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20180518000001_issue2029_sipgate_integration_enable.rb diff --git a/db/migrate/20180518000001_issue2029_sipgate_integration_enable.rb b/db/migrate/20180518000001_issue2029_sipgate_integration_enable.rb new file mode 100644 index 000000000..c67a5a530 --- /dev/null +++ b/db/migrate/20180518000001_issue2029_sipgate_integration_enable.rb @@ -0,0 +1,24 @@ +class Issue2029SipgateIntegrationEnable < ActiveRecord::Migration[5.1] + def change + + # return if it's a new setup + return if !Setting.find_by(name: 'system_init_done') + + return if Setting.get(name: 'sipgate_config').present? + + Setting.create_or_update( + title: 'sipgate.io config', + name: 'sipgate_config', + area: 'Integration::Sipgate', + description: 'Defines the sipgate.io config.', + options: {}, + state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, + preferences: { + prio: 2, + permission: ['admin.integration'], + }, + frontend: false, + ) + + end +end diff --git a/db/seeds/settings.rb b/db/seeds/settings.rb index 7d024b69b..3b3d339e4 100644 --- a/db/seeds/settings.rb +++ b/db/seeds/settings.rb @@ -3715,7 +3715,7 @@ Setting.create_if_not_exists( area: 'Integration::Sipgate', description: 'Defines the sipgate.io config.', options: {}, - state: {}, + state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, preferences: { prio: 2, permission: ['admin.integration'],