Class: Vapi::ByoSipTrunkCredential

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, org_id:, created_at:, updated_at:, gateways:, provider: OMIT, name: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, sbc_configuration: OMIT, additional_properties: nil) ⇒ Vapi::ByoSipTrunkCredential

Parameters:

  • provider (String) (defaults to: OMIT)

    This can be used to bring your own SIP trunks or to connect to a Carrier.

  • id (String)

    This is the unique identifier for the credential.

  • org_id (String)

    This is the unique identifier for the org that this credential belongs to.

  • created_at (DateTime)

    This is the ISO 8601 date-time string of when the credential was created.

  • updated_at (DateTime)

    This is the ISO 8601 date-time string of when the assistant was last updated.

  • gateways (Array<Vapi::SipTrunkGateway>)

    This is the list of SIP trunk’s gateways.

  • name (String) (defaults to: OMIT)

    This is the name of the SIP trunk. This is just for your reference.

  • outbound_authentication_plan (Vapi::SipTrunkOutboundAuthenticationPlan) (defaults to: OMIT)

    This can be used to configure the outbound authentication if required by the SIP trunk.

  • outbound_leading_plus_enabled (Boolean) (defaults to: OMIT)

    This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. Usage:

    • Vonage/Twilio requires leading plus for all outbound calls. Set this to true.

    @default false

  • sbc_configuration (Vapi::SbcConfiguration) (defaults to: OMIT)

    This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk’s ‘gateways`, rather than the managed SBC provided by Vapi.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 66

def initialize(id:, org_id:, created_at:, updated_at:, gateways:, provider: OMIT, name: OMIT,
               outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, sbc_configuration: OMIT, additional_properties: nil)
  @provider = provider if provider != OMIT
  @id = id
  @org_id = org_id
  @created_at = created_at
  @updated_at = updated_at
  @gateways = gateways
  @name = name if name != OMIT
  @outbound_authentication_plan = outbound_authentication_plan if outbound_authentication_plan != OMIT
  @outbound_leading_plus_enabled = outbound_leading_plus_enabled if outbound_leading_plus_enabled != OMIT
  @sbc_configuration = sbc_configuration if sbc_configuration != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "provider": provider,
    "id": id,
    "orgId": org_id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "gateways": gateways,
    "name": name,
    "outboundAuthenticationPlan": outbound_authentication_plan,
    "outboundLeadingPlusEnabled": outbound_leading_plus_enabled,
    "sbcConfiguration": sbc_configuration
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



40
41
42
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 40

def additional_properties
  @additional_properties
end

#created_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the credential was created.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the credential was created.



19
20
21
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 19

def created_at
  @created_at
end

#gatewaysArray<Vapi::SipTrunkGateway> (readonly)

Returns This is the list of SIP trunk’s gateways.

Returns:



23
24
25
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 23

def gateways
  @gateways
end

#idString (readonly)

Returns This is the unique identifier for the credential.

Returns:

  • (String)

    This is the unique identifier for the credential.



15
16
17
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 15

def id
  @id
end

#nameString (readonly)

Returns This is the name of the SIP trunk. This is just for your reference.

Returns:

  • (String)

    This is the name of the SIP trunk. This is just for your reference.



25
26
27
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 25

def name
  @name
end

#org_idString (readonly)

Returns This is the unique identifier for the org that this credential belongs to.

Returns:

  • (String)

    This is the unique identifier for the org that this credential belongs to.



17
18
19
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 17

def org_id
  @org_id
end

#outbound_authentication_planVapi::SipTrunkOutboundAuthenticationPlan (readonly)

Returns This can be used to configure the outbound authentication if required by the SIP trunk.

Returns:



28
29
30
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 28

def outbound_authentication_plan
  @outbound_authentication_plan
end

#outbound_leading_plus_enabledBoolean (readonly)

Returns This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. Usage:

  • Vonage/Twilio requires leading plus for all outbound calls. Set this to true.

@default false.

Returns:

  • (Boolean)

    This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. Usage:

    • Vonage/Twilio requires leading plus for all outbound calls. Set this to true.

    @default false



34
35
36
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 34

def outbound_leading_plus_enabled
  @outbound_leading_plus_enabled
end

#providerString (readonly)

Returns This can be used to bring your own SIP trunks or to connect to a Carrier.

Returns:

  • (String)

    This can be used to bring your own SIP trunks or to connect to a Carrier.



13
14
15
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 13

def provider
  @provider
end

#sbc_configurationVapi::SbcConfiguration (readonly)

Returns This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk’s ‘gateways`, rather than the managed SBC provided by Vapi.

Returns:

  • (Vapi::SbcConfiguration)

    This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk’s ‘gateways`, rather than the managed SBC provided by Vapi.



38
39
40
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 38

def sbc_configuration
  @sbc_configuration
end

#updated_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the assistant was last updated.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the assistant was last updated.



21
22
23
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 21

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::ByoSipTrunkCredential

Deserialize a JSON object to an instance of ByoSipTrunkCredential

Parameters:

  • json_object (String)

Returns:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 99

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  provider = parsed_json["provider"]
  id = parsed_json["id"]
  org_id = parsed_json["orgId"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  gateways = parsed_json["gateways"]&.map do |item|
    item = item.to_json
    Vapi::SipTrunkGateway.from_json(json_object: item)
  end
  name = parsed_json["name"]
  if parsed_json["outboundAuthenticationPlan"].nil?
    outbound_authentication_plan = nil
  else
    outbound_authentication_plan = parsed_json["outboundAuthenticationPlan"].to_json
    outbound_authentication_plan = Vapi::SipTrunkOutboundAuthenticationPlan.from_json(json_object: outbound_authentication_plan)
  end
  outbound_leading_plus_enabled = parsed_json["outboundLeadingPlusEnabled"]
  if parsed_json["sbcConfiguration"].nil?
    sbc_configuration = nil
  else
    sbc_configuration = parsed_json["sbcConfiguration"].to_json
    sbc_configuration = Vapi::SbcConfiguration.from_json(json_object: sbc_configuration)
  end
  new(
    provider: provider,
    id: id,
    org_id: org_id,
    created_at: created_at,
    updated_at: updated_at,
    gateways: gateways,
    name: name,
    outbound_authentication_plan: outbound_authentication_plan,
    outbound_leading_plus_enabled: outbound_leading_plus_enabled,
    sbc_configuration: sbc_configuration,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 153

def self.validate_raw(obj:)
  obj.provider&.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.")
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.gateways.is_a?(Array) != false || raise("Passed value for field obj.gateways is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.outbound_authentication_plan.nil? || Vapi::SipTrunkOutboundAuthenticationPlan.validate_raw(obj: obj.outbound_authentication_plan)
  obj.outbound_leading_plus_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.outbound_leading_plus_enabled is not the expected type, validation failed.")
  obj.sbc_configuration.nil? || Vapi::SbcConfiguration.validate_raw(obj: obj.sbc_configuration)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ByoSipTrunkCredential to a JSON object

Returns:

  • (String)


143
144
145
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 143

def to_json(*_args)
  @_field_set&.to_json
end