summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20130307104654_create_switchboards.rb13
-rw-r--r--db/migrate/20130307122344_create_switchboard_entries.rb15
-rw-r--r--db/migrate/20130309055700_change_perimeter_gs_parameters.rb18
-rw-r--r--db/migrate/20130314031100_add_event_socket_gs_parameters.rb11
-rw-r--r--db/migrate/20130314104000_change_calls_active.rb84
-rw-r--r--db/migrate/20130314134600_change_conference_parameters.rb37
-rw-r--r--db/migrate/20130315074600_change_calls_active2.rb86
7 files changed, 264 insertions, 0 deletions
diff --git a/db/migrate/20130307104654_create_switchboards.rb b/db/migrate/20130307104654_create_switchboards.rb
new file mode 100644
index 0000000..222b168
--- /dev/null
+++ b/db/migrate/20130307104654_create_switchboards.rb
@@ -0,0 +1,13 @@
+class CreateSwitchboards < ActiveRecord::Migration
+ def self.up
+ create_table :switchboards do |t|
+ t.string :name
+ t.integer :user_id
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :switchboards
+ end
+end
diff --git a/db/migrate/20130307122344_create_switchboard_entries.rb b/db/migrate/20130307122344_create_switchboard_entries.rb
new file mode 100644
index 0000000..1c7521e
--- /dev/null
+++ b/db/migrate/20130307122344_create_switchboard_entries.rb
@@ -0,0 +1,15 @@
+class CreateSwitchboardEntries < ActiveRecord::Migration
+ def self.up
+ create_table :switchboard_entries do |t|
+ t.integer :switchboard_id
+ t.integer :sip_account_id
+ t.string :name
+ t.integer :position
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :switchboard_entries
+ end
+end
diff --git a/db/migrate/20130309055700_change_perimeter_gs_parameters.rb b/db/migrate/20130309055700_change_perimeter_gs_parameters.rb
new file mode 100644
index 0000000..7973ee0
--- /dev/null
+++ b/db/migrate/20130309055700_change_perimeter_gs_parameters.rb
@@ -0,0 +1,18 @@
+class ChangePerimeterGsParameters < ActiveRecord::Migration
+ def up
+ GsParameter.find_or_create_by_entity_and_section_and_name('perimeter', 'bad_headers_register', 'from_user').update_attributes(:value => '^%d+$', :class_type => 'String')
+ GsParameter.where(:entity => 'perimeter', :section => 'bad_headers_register', :name => 'to_user').first.update_attributes(:value => '^%d+$', :class_type => 'String')
+
+ GsParameter.where(:entity => 'perimeter', :section => 'checks_call', :name => 'check_bad_headers').first.update_attributes(:value => '20', :class_type => 'Integer')
+ GsParameter.where(:entity => 'perimeter', :section => 'checks_call', :name => 'check_frequency').first.update_attributes(:value => '100', :class_type => 'Integer')
+
+ GsParameter.where(:entity => 'perimeter', :section => 'checks_register', :name => 'check_bad_headers').first.update_attributes(:value => '20', :class_type => 'Integer')
+ GsParameter.where(:entity => 'perimeter', :section => 'checks_register', :name => 'check_frequency').first.update_attributes(:value => '100', :class_type => 'Integer')
+ GsParameter.where(:entity => 'perimeter', :section => 'checks_register', :name => 'check_username_scan').first.update_attributes(:value => '20', :class_type => 'Integer')
+
+ GsParameter.where(:entity => 'perimeter', :section => 'general', :name => 'ban_threshold').first.update_attributes(:value => '1000', :class_type => 'Integer')
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20130314031100_add_event_socket_gs_parameters.rb b/db/migrate/20130314031100_add_event_socket_gs_parameters.rb
new file mode 100644
index 0000000..6c26888
--- /dev/null
+++ b/db/migrate/20130314031100_add_event_socket_gs_parameters.rb
@@ -0,0 +1,11 @@
+class AddEventSocketGsParameters < ActiveRecord::Migration
+ def up
+ GsParameter.create(:entity => 'event_socket', :section => 'settings', :name => 'listen-ip', :value => '127.0.0.1', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'event_socket', :section => 'settings', :name => 'listen-port', :value => '8021', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'event_socket', :section => 'settings', :name => 'password', :value => 'ClueCon', :class_type => 'String', :description => '')
+ end
+
+ def down
+ GsParameter.where(:entity => 'event_socket', :section => 'settings').destroy_all
+ end
+end
diff --git a/db/migrate/20130314104000_change_calls_active.rb b/db/migrate/20130314104000_change_calls_active.rb
new file mode 100644
index 0000000..4054157
--- /dev/null
+++ b/db/migrate/20130314104000_change_calls_active.rb
@@ -0,0 +1,84 @@
+class ChangeCallsActive < ActiveRecord::Migration
+ def self.up
+ execute "DROP VIEW IF EXISTS calls_active"
+ if ActiveRecord::Base.connection_config[:adapter] != 'sqlite3'
+ execute <<-SQL
+ CREATE VIEW calls_active AS SELECT
+ a.uuid AS uuid,
+ a.direction AS direction,
+ a.created_epoch AS start_stamp,
+ a.cid_name AS caller_id_name,
+ a.cid_num AS caller_id_number,
+ a.dest AS destination,
+ d.id AS sip_account_id,
+ d.caller_name AS sip_caller_name,
+ a.callee_name AS callee_name,
+ a.callee_num AS callee_number,
+ a.callstate AS callstate,
+ a.read_codec AS read_codec,
+ a.read_rate AS read_rate,
+ a.read_bit_rate AS read_bit_rate,
+ a.write_codec AS write_codec,
+ a.write_rate AS write_rate,
+ a.write_bit_rate AS write_bit_rate,
+ a.secure AS secure,
+ b.uuid AS b_uuid,
+ b.cid_name AS b_caller_id_name,
+ b.cid_num AS b_caller_id_number,
+ b.callstate AS b_callstate,
+ e.id AS b_sip_account_id,
+ e.caller_name AS b_sip_caller_name,
+ b.callee_name AS b_callee_name,
+ b.callee_num AS b_callee_number,
+ b.secure AS b_secure
+ FROM channels a
+ LEFT JOIN calls c ON a.uuid = c.caller_uuid AND a.hostname = c.hostname
+ LEFT JOIN channels b ON b.uuid = c.callee_uuid AND b.hostname = c.hostname
+ LEFT JOIN sip_accounts d ON a.presence_id LIKE CONCAT(d.auth_name, "@%")
+ LEFT JOIN sip_accounts e ON b.presence_id LIKE CONCAT(e.auth_name, "@%")
+ WHERE a.uuid = c.caller_uuid OR a.uuid NOT IN (select callee_uuid from calls)
+ SQL
+ else
+ execute <<-SQL
+ CREATE VIEW calls_active AS SELECT
+ a.uuid AS uuid,
+ a.direction AS direction,
+ a.created_epoch AS start_stamp,
+ a.cid_name AS caller_id_name,
+ a.cid_num AS caller_id_number,
+ a.dest AS destination,
+ d.id AS sip_account_id,
+ d.caller_name AS sip_caller_name,
+ a.callee_name AS callee_name,
+ a.callee_num AS callee_number,
+ a.callstate AS callstate,
+ a.read_codec AS read_codec,
+ a.read_rate AS read_rate,
+ a.read_bit_rate AS read_bit_rate,
+ a.write_codec AS write_codec,
+ a.write_rate AS write_rate,
+ a.write_bit_rate AS write_bit_rate,
+ a.secure AS secure,
+ b.uuid AS b_uuid,
+ b.cid_name AS b_caller_id_name,
+ b.cid_num AS b_caller_id_number,
+ b.callstate AS b_callstate,
+ e.id AS b_sip_account_id,
+ e.caller_name AS b_sip_caller_name,
+ b.callee_name AS b_callee_name,
+ b.callee_num AS b_callee_number,
+ b.secure AS b_secure
+ FROM channels a
+ LEFT JOIN calls c ON a.uuid = c.caller_uuid AND a.hostname = c.hostname
+ LEFT JOIN channels b ON b.uuid = c.callee_uuid AND b.hostname = c.hostname
+ LEFT JOIN sip_accounts d ON a.presence_id LIKE (d.auth_name || "@%")
+ LEFT JOIN sip_accounts e ON b.presence_id LIKE (e.auth_name || "@%")
+ WHERE a.uuid = c.caller_uuid OR a.uuid NOT IN (select callee_uuid from calls)
+ SQL
+ end
+ end
+
+ def self.down
+
+ end
+end \ No newline at end of file
diff --git a/db/migrate/20130314134600_change_conference_parameters.rb b/db/migrate/20130314134600_change_conference_parameters.rb
new file mode 100644
index 0000000..85116e4
--- /dev/null
+++ b/db/migrate/20130314134600_change_conference_parameters.rb
@@ -0,0 +1,37 @@
+class ChangeConferenceParameters < ActiveRecord::Migration
+ def up
+ GsParameter.where(:entity => 'conferences', :section => 'parameters').destroy_all
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'caller-controls', :value => 'speaker', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'moderator-controls', :value => 'moderator', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'muted-sound', :value => 'conference/conf-muted.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'unmuted-sound', :value => 'conference/conf-unmuted.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'moh-sound', :value => '', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'comfort-noise', :value => 'true', :class_type => 'Boolean')
+ end
+
+ def down
+ GsParameter.where(:entity => 'conferences', :section => 'parameters').destroy_all
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'caller-controls', :value => 'speaker', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'moderator-controls', :value => 'moderator', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'max-members', :value => 100, :class_type => 'Integer')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'rate', :value => 16000, :class_type => 'Integer')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'interval', :value => 20, :class_type => 'Integer')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'energy-level', :value => 300, :class_type => 'Integer')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'sound-prefix', :value => '/opt/freeswitch/sounds/de/tts/google', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'muted-sound', :value => 'conference/conf-muted.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'unmuted-sound', :value => 'conference/conf-unmuted.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'alone-sound', :value => 'conference/conf-alone.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'moh-sound', :value => 'local_stream://moh', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'enter-sound', :value => 'tone_stream://%(200,0,500,600,700)', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'exit-sound', :value => 'tone_stream://%(500,0,300,200,100,50,25)', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'kicked-sound', :value => 'conference/conf-kicked.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'locked-sound', :value => 'conference/conf-locked.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'is-locked-sound', :value => 'conference/conf-is-locked.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'is-unlocked-sound', :value => 'conference/conf-is-unlocked.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'pin-sound', :value => 'conference/conf-pin.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'bad-pin-sound', :value => 'conference/conf-bad-pin.wav', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'caller-id-name', :value => 'Conference', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'caller-id-number', :value => '', :class_type => 'String')
+ GsParameter.create(:entity => 'conferences', :section => 'parameters', :name => 'comfort-noise', :value => 'true', :class_type => 'Boolean')
+ end
+end
diff --git a/db/migrate/20130315074600_change_calls_active2.rb b/db/migrate/20130315074600_change_calls_active2.rb
new file mode 100644
index 0000000..378ffde
--- /dev/null
+++ b/db/migrate/20130315074600_change_calls_active2.rb
@@ -0,0 +1,86 @@
+class ChangeCallsActive2 < ActiveRecord::Migration
+ def self.up
+ execute "DROP VIEW IF EXISTS calls_active"
+ if ActiveRecord::Base.connection_config[:adapter] != 'sqlite3'
+ execute <<-SQL
+ CREATE VIEW calls_active AS SELECT
+ a.uuid AS uuid,
+ a.direction AS direction,
+ a.created_epoch AS start_stamp,
+ a.cid_name AS caller_id_name,
+ a.cid_num AS caller_id_number,
+ a.dest AS destination,
+ c.id AS sip_account_id,
+ c.caller_name AS sip_caller_name,
+ a.callee_name AS callee_name,
+ a.callee_num AS callee_number,
+ a.callstate AS callstate,
+ a.read_codec AS read_codec,
+ a.read_rate AS read_rate,
+ a.read_bit_rate AS read_bit_rate,
+ a.write_codec AS write_codec,
+ a.write_rate AS write_rate,
+ a.write_bit_rate AS write_bit_rate,
+ a.secure AS secure,
+ b.uuid AS b_uuid,
+ b.cid_name AS b_caller_id_name,
+ b.cid_num AS b_caller_id_number,
+ b.callstate AS b_callstate,
+ d.id AS b_sip_account_id,
+ d.caller_name AS b_sip_caller_name,
+ b.callee_name AS b_callee_name,
+ b.callee_num AS b_callee_number,
+ b.secure AS b_secure
+ FROM channels a
+ LEFT JOIN channels b ON (a.uuid = b.call_uuid AND a.uuid != b.uuid)
+ LEFT JOIN sip_accounts c ON a.presence_id LIKE CONCAT(c.auth_name, "@%")
+ LEFT JOIN sip_accounts d ON b.presence_id LIKE CONCAT(d.auth_name, "@%")
+ WHERE (a.uuid = b.call_uuid AND a.uuid != b.uuid)
+ OR a.call_uuid IS NULL
+ OR a.call_uuid = a.uuid
+ SQL
+ else
+ execute <<-SQL
+ CREATE VIEW calls_active AS SELECT
+ a.uuid AS uuid,
+ a.direction AS direction,
+ a.created_epoch AS start_stamp,
+ a.cid_name AS caller_id_name,
+ a.cid_num AS caller_id_number,
+ a.dest AS destination,
+ c.id AS sip_account_id,
+ c.caller_name AS sip_caller_name,
+ a.callee_name AS callee_name,
+ a.callee_num AS callee_number,
+ a.callstate AS callstate,
+ a.read_codec AS read_codec,
+ a.read_rate AS read_rate,
+ a.read_bit_rate AS read_bit_rate,
+ a.write_codec AS write_codec,
+ a.write_rate AS write_rate,
+ a.write_bit_rate AS write_bit_rate,
+ a.secure AS secure,
+ b.uuid AS b_uuid,
+ b.cid_name AS b_caller_id_name,
+ b.cid_num AS b_caller_id_number,
+ b.callstate AS b_callstate,
+ d.id AS b_sip_account_id,
+ d.caller_name AS b_sip_caller_name,
+ b.callee_name AS b_callee_name,
+ b.callee_num AS b_callee_number,
+ b.secure AS b_secure
+ FROM channels a
+ LEFT JOIN channels b ON (a.uuid = b.call_uuid AND a.uuid != b.uuid)
+ LEFT JOIN sip_accounts c ON a.presence_id LIKE (c.auth_name || "@%")
+ LEFT JOIN sip_accounts d ON b.presence_id LIKE (d.auth_name || "@%")
+ WHERE (a.uuid = b.call_uuid AND a.uuid != b.uuid)
+ OR a.call_uuid IS NULL
+ OR a.call_uuid = a.uuid
+ SQL
+ end
+ end
+
+ def self.down
+
+ end
+end \ No newline at end of file