Class: Vapi::CreateByoSipTrunkCredentialDto

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gateways:, provider: OMIT, name: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, sbc_configuration: OMIT, additional_properties: nil) ⇒ Vapi::CreateByoSipTrunkCredentialDto

Parameters:

  • provider (String) (defaults to: OMIT)

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

  • 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



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 53

def initialize(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
  @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,
    "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



31
32
33
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 31

def additional_properties
  @additional_properties
end

#gatewaysArray<Vapi::SipTrunkGateway> (readonly)

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

Returns:



14
15
16
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 14

def gateways
  @gateways
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.



16
17
18
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 16

def name
  @name
end

#outbound_authentication_planVapi::SipTrunkOutboundAuthenticationPlan (readonly)

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

Returns:



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

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



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

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.



12
13
14
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 12

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.



29
30
31
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 29

def sbc_configuration
  @sbc_configuration
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CreateByoSipTrunkCredentialDto

Deserialize a JSON object to an instance of CreateByoSipTrunkCredentialDto

Parameters:

  • json_object (String)

Returns:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 78

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  provider = parsed_json["provider"]
  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,
    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)


124
125
126
127
128
129
130
131
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 124

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.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 CreateByoSipTrunkCredentialDto to a JSON object

Returns:

  • (String)


114
115
116
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 114

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