summaryrefslogtreecommitdiff
path: root/db/migrate/20130804201900_add_gateway_default_headers.rb
blob: fc35bc220782d2e30db571a82862d48a838d6b08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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_invite', :name => 'INVITE',  :value => 'sip:{destination_number}@{domain}', :class_type => 'String')
    GsParameter.create(:entity => 'sip_gateways', :section => 'headers_invite', :name => 'To',  :value => '<sip:{destination_number}@{domain}>', :class_type => 'String')
    GsParameter.create(:entity => 'sip_gateways', :section => 'headers_invite_clir_off', :name => 'From',  :value => '"{caller_id_name}" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
    GsParameter.create(:entity => 'sip_gateways', :section => 'headers_invite_clir_on', :name => 'From',  :value => '"Anonymous" <sip:anonymous@{domain_local}>', :class_type => 'String')
    GsParameter.create(:entity => 'sip_gateways', :section => 'headers_invite_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_invite_clir_on', :name => 'P-Asserted-Identity',  :value => '"Anonymous" <sip:{caller_id_number}@{domain_local}>', :class_type => 'String')
    GsParameter.create(:entity => 'sip_gateways', :section => 'headers_invite_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