summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20130225091200_add_destinationable_to_call_forward.rb14
-rw-r--r--db/migrate/20130612120200_add_gateway_defaults.rb8
-rw-r--r--db/migrate/20130627103456_add_blind_transfer_to_switchboard.rb17
-rw-r--r--db/migrate/20130627162201_add_search_activated_to_switchboard.rb5
-rw-r--r--db/migrate/20130701084803_add_reverse_lookup_to_switchboard.rb5
-rw-r--r--db/migrate/20130718083656_create_extension_modules.rb19
-rw-r--r--db/migrate/20130730080331_add_forwarding_path_to_cdrs.rb5
-rw-r--r--db/migrate/20130731055839_add_clir_to_call_histories.rb5
-rw-r--r--db/migrate/20130802105300_create_gateway_headers.rb18
-rw-r--r--db/migrate/20130804201900_add_gateway_default_headers.rb28
-rw-r--r--db/migrate/20130805064700_change_rfc2833_profile_parameter.rb15
11 files changed, 134 insertions, 5 deletions
diff --git a/db/migrate/20130225091200_add_destinationable_to_call_forward.rb b/db/migrate/20130225091200_add_destinationable_to_call_forward.rb
index 89e4b3b..56f7df4 100644
--- a/db/migrate/20130225091200_add_destinationable_to_call_forward.rb
+++ b/db/migrate/20130225091200_add_destinationable_to_call_forward.rb
@@ -4,7 +4,19 @@ class AddDestinationableToCallForward < ActiveRecord::Migration
add_column :call_forwards, :destinationable_id, :integer
CallForward.all.each do |call_forward|
- call_forward.update_attributes(:destinationable_type => call_forward.call_forwardable_type, :destinationable_id => call_forward.call_forwardable_id, :call_forwardable_type => 'PhoneNumber', :call_forwardable_id => call_forward.phone_number_id )
+ phone_number = PhoneNumber.where(:id => call_forward.phone_number_id).first
+ if phone_number and phone_number.phone_numberable.class == SipAccount
+ account = phone_number.phone_numberable
+ result = call_forward.update_attributes(:destinationable_type => call_forward.call_forwardable_type, :destinationable_id => call_forward.call_forwardable_id, :call_forwardable_type => account.class.to_s, :call_forwardable_id => account.id)
+ else
+ call_forward.update_attributes(:destinationable_type => call_forward.call_forwardable_type, :destinationable_id => call_forward.call_forwardable_id, :call_forwardable_type => 'PhoneNumber', :call_forwardable_id => call_forward.phone_number_id)
+ end
+ end
+
+ cf_groups = CallForward.order('active DESC').all.group_by{|cf| [cf.call_forwardable_type, cf.call_forwardable_id, cf.call_forward_case_id, cf.destinationable_type, cf.destinationable_id, cf.destination, cf.source]}
+ cf_groups.values.each do |duplicates|
+ first_item = duplicates.shift
+ duplicates.each{|duplicate| duplicate.destroy}
end
remove_column :call_forwards, :phone_number_id
diff --git a/db/migrate/20130612120200_add_gateway_defaults.rb b/db/migrate/20130612120200_add_gateway_defaults.rb
index eddba9d..c6d1c9f 100644
--- a/db/migrate/20130612120200_add_gateway_defaults.rb
+++ b/db/migrate/20130612120200_add_gateway_defaults.rb
@@ -3,10 +3,10 @@ class AddGatewayDefaults < ActiveRecord::Migration
GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'domain', :value => '192.168.1.1', :class_type => 'String')
GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'auth_source', :value => 'sip_received_ip', :class_type => 'String')
GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'auth_pattern', :value => '^192.168.1.1$', :class_type => 'String')
- GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'from', :value => '"{caller_id_name}" <sip:{caller_id_number}@{domain}>', :class_type => 'String')
- GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'from_clir', :value => '"Anonymous" <sip:anonymous@{domain}>', :class_type => 'String')
- GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'asserted_identity', :value => '"{caller_id_name}" <sip:{caller_id_number}@{domain}>', :class_type => 'String')
- GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'asserted_identity_clir', :value => '"Anonymous" <sip:{caller_id_number}@{domain}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'from', :value => '"{caller_id_name}" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'from_clir', :value => '"Anonymous" <sip:anonymous@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'asserted_identity', :value => '"{caller_id_name}" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'asserted_identity_clir', :value => '"Anonymous" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
end
def down
diff --git a/db/migrate/20130627103456_add_blind_transfer_to_switchboard.rb b/db/migrate/20130627103456_add_blind_transfer_to_switchboard.rb
new file mode 100644
index 0000000..a947a51
--- /dev/null
+++ b/db/migrate/20130627103456_add_blind_transfer_to_switchboard.rb
@@ -0,0 +1,17 @@
+class AddBlindTransferToSwitchboard < ActiveRecord::Migration
+ def up
+ add_column :switchboards, :blind_transfer_activated, :boolean
+ add_column :switchboards, :attended_transfer_activated, :boolean
+
+ Switchboard.all.each do |switchboard|
+ switchboard.blind_transfer_activated = true
+ switchboard.attended_transfer_activated = true
+ switchboard.save
+ end
+ end
+
+ def down
+ remove_column :switchboards, :blind_transfer_activated
+ remove_column :switchboards, :attended_transfer_activated
+ end
+end
diff --git a/db/migrate/20130627162201_add_search_activated_to_switchboard.rb b/db/migrate/20130627162201_add_search_activated_to_switchboard.rb
new file mode 100644
index 0000000..48916ac
--- /dev/null
+++ b/db/migrate/20130627162201_add_search_activated_to_switchboard.rb
@@ -0,0 +1,5 @@
+class AddSearchActivatedToSwitchboard < ActiveRecord::Migration
+ def change
+ add_column :switchboards, :search_activated, :boolean
+ end
+end
diff --git a/db/migrate/20130701084803_add_reverse_lookup_to_switchboard.rb b/db/migrate/20130701084803_add_reverse_lookup_to_switchboard.rb
new file mode 100644
index 0000000..e16e8e2
--- /dev/null
+++ b/db/migrate/20130701084803_add_reverse_lookup_to_switchboard.rb
@@ -0,0 +1,5 @@
+class AddReverseLookupToSwitchboard < ActiveRecord::Migration
+ def change
+ add_column :switchboards, :reverse_lookup_activated, :boolean
+ end
+end
diff --git a/db/migrate/20130718083656_create_extension_modules.rb b/db/migrate/20130718083656_create_extension_modules.rb
new file mode 100644
index 0000000..3372b5f
--- /dev/null
+++ b/db/migrate/20130718083656_create_extension_modules.rb
@@ -0,0 +1,19 @@
+class CreateExtensionModules < ActiveRecord::Migration
+ def self.up
+ create_table :extension_modules do |t|
+ t.string :model
+ t.string :mac_address
+ t.string :ip_address
+ t.string :provisioning_key
+ t.boolean :provisioning_key_active
+ t.integer :phone_id
+ t.integer :position
+ t.boolean :active
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :extension_modules
+ end
+end
diff --git a/db/migrate/20130730080331_add_forwarding_path_to_cdrs.rb b/db/migrate/20130730080331_add_forwarding_path_to_cdrs.rb
new file mode 100644
index 0000000..7954868
--- /dev/null
+++ b/db/migrate/20130730080331_add_forwarding_path_to_cdrs.rb
@@ -0,0 +1,5 @@
+class AddForwardingPathToCdrs < ActiveRecord::Migration
+ def change
+ add_column :cdrs, :forwarding_path, :string
+ end
+end
diff --git a/db/migrate/20130731055839_add_clir_to_call_histories.rb b/db/migrate/20130731055839_add_clir_to_call_histories.rb
new file mode 100644
index 0000000..27c7839
--- /dev/null
+++ b/db/migrate/20130731055839_add_clir_to_call_histories.rb
@@ -0,0 +1,5 @@
+class AddClirToCallHistories < ActiveRecord::Migration
+ def change
+ add_column :call_histories, :clir, :boolean
+ end
+end
diff --git a/db/migrate/20130802105300_create_gateway_headers.rb b/db/migrate/20130802105300_create_gateway_headers.rb
new file mode 100644
index 0000000..52c74dc
--- /dev/null
+++ b/db/migrate/20130802105300_create_gateway_headers.rb
@@ -0,0 +1,18 @@
+class CreateGatewayHeaders < ActiveRecord::Migration
+ def self.up
+ create_table :gateway_headers do |t|
+ t.integer :gateway_id
+ t.string :header_type
+ t.string :constraint_source
+ t.string :constraint_value
+ t.string :name
+ t.string :value
+ t.string :description
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :gateway_headers
+ end
+end
diff --git a/db/migrate/20130804201900_add_gateway_default_headers.rb b/db/migrate/20130804201900_add_gateway_default_headers.rb
new file mode 100644
index 0000000..4b50242
--- /dev/null
+++ b/db/migrate/20130804201900_add_gateway_default_headers.rb
@@ -0,0 +1,28 @@
+class AddGatewayDefaultHeaders < ActiveRecord::Migration
+ def up
+ GsParameter.where(:entity => 'sip_gateways', :section => 'settings', :name => 'from').destroy_all
+ GsParameter.where(:entity => 'sip_gateways', :section => 'settings', :name => 'from_clir').destroy_all
+ GsParameter.where(:entity => 'sip_gateways', :section => 'settings', :name => 'asserted_identity').destroy_all
+ GsParameter.where(:entity => 'sip_gateways', :section => 'settings', :name => 'asserted_identity_clir').destroy_all
+
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'dtmf_type', :value => 'rfc2833', :class_type => 'String')
+
+ GsParameter.create(:entity => 'sip_gateways', :section => 'headers_default', :name => 'INVITE', :value => 'sip:{destination_number}@{domain}', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'headers_default', :name => 'To', :value => '<sip:{destination_number}@{domain}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'headers_default_clir_off', :name => 'From', :value => '"{caller_id_name}" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'headers_default_clir_on', :name => 'From', :value => '"Anonymous" <sip:anonymous@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'headers_default_clir_off', :name => 'P-Asserted-Identity', :value => '"{caller_id_name}" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'headers_default_clir_on', :name => 'P-Asserted-Identity', :value => '"Anonymous" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'headers_default_clir_on', :name => 'Privacy', :value => 'id', :class_type => 'String')
+ end
+
+ def down
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'domain', :value => '192.168.1.1', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'auth_source', :value => 'sip_received_ip', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'auth_pattern', :value => '^192.168.1.1$', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'from', :value => '"{caller_id_name}" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'from_clir', :value => '"Anonymous" <sip:anonymous@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'asserted_identity', :value => '"{caller_id_name}" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
+ GsParameter.create(:entity => 'sip_gateways', :section => 'settings', :name => 'asserted_identity_clir', :value => '"Anonymous" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
+ end
+end
diff --git a/db/migrate/20130805064700_change_rfc2833_profile_parameter.rb b/db/migrate/20130805064700_change_rfc2833_profile_parameter.rb
new file mode 100644
index 0000000..78b2350
--- /dev/null
+++ b/db/migrate/20130805064700_change_rfc2833_profile_parameter.rb
@@ -0,0 +1,15 @@
+class ChangeRfc2833ProfileParameter < ActiveRecord::Migration
+ def up
+ pass_rfc2833 = GsParameter.where(:entity => 'sofia', :section => 'profile', :name => 'pass-rfc2833').first
+ if pass_rfc2833
+ pass_rfc2833.update_attributes(:value => 'false')
+ end
+ end
+
+ def down
+ pass_rfc2833 = GsParameter.where(:entity => 'sofia', :section => 'profile', :name => 'pass-rfc2833').first
+ if pass_rfc2833
+ pass_rfc2833.update_attributes(:value => 'true')
+ end
+ end
+end