summaryrefslogtreecommitdiff
path: root/app/models/gateway_setting.rb
blob: e96bb520e81744fb3bc1608c005e91c064017ee2 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class GatewaySetting < ActiveRecord::Base
  CLASS_TYPES = ['String', 'Integer', 'Boolean']
  GATEWAY_SETTINGS = {
    'sip' => { 
      'domain' => 'String', 
      'username' => 'String', 
      'password' => 'String',
      'register' => 'Boolean', 
      'auth_source' =>  'String', 
      'auth_pattern' =>  'String',
      'inbound_username' => 'String', 
      'inbound_password' => 'String',
      'number_source' =>  'String',
      'contact' =>  'String',
      'dial_string' =>  'String',
      'profile' =>  'String',
      'from' => 'String',
      'from_clir' => 'String',
      'asserted_identity' => 'String',
      'asserted_identity_clir' => 'String',
    },
   'xmpp' => { 
      'server' => 'String', 
      'login' => 'String', 
      'password' => 'String',
      'inbound_number' =>  'String',
      'auth_source' =>  'String', 
      'auth_pattern' =>  'String',
      'number_source' =>  'String',
      'destination_domain' =>  'String',
    }, 
  }
  
  attr_accessible :gateway_id, :name, :value, :class_type, :description

  belongs_to :gateway

  validates :name,
            :presence => true,
            :uniqueness => {:scope => :gateway_id}

  validates :class_type,
            :presence => true,
            :inclusion => { :in => CLASS_TYPES }

  def to_s
  	name
  end
end