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:, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, name: OMIT, additional_properties: nil) ⇒ Vapi::CreateByoSipTrunkCredentialDto

Parameters:

  • gateways (Array<Vapi::SipTrunkGateway>)

    This is the list of SIP trunk’s gateways.

  • 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

  • tech_prefix (String) (defaults to: OMIT)

    This can be used to configure the tech prefix on outbound calls. This is an advanced property.

  • sip_diversion_header (String) (defaults to: OMIT)

    This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property.

  • 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.

  • name (String) (defaults to: OMIT)

    This is the name of credential. This is just for your reference.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 60

def initialize(gateways:, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT,
               tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, name: OMIT, additional_properties: nil)
  @gateways = gateways
  @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
  @tech_prefix = tech_prefix if tech_prefix != OMIT
  @sip_diversion_header = sip_diversion_header if sip_diversion_header != OMIT
  @sbc_configuration = sbc_configuration if sbc_configuration != OMIT
  @name = name if name != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "gateways": gateways,
    "outboundAuthenticationPlan": outbound_authentication_plan,
    "outboundLeadingPlusEnabled": outbound_leading_plus_enabled,
    "techPrefix": tech_prefix,
    "sipDiversionHeader": sip_diversion_header,
    "sbcConfiguration": sbc_configuration,
    "name": name
  }.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



35
36
37
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 35

def additional_properties
  @additional_properties
end

#gatewaysArray<Vapi::SipTrunkGateway> (readonly)

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

Returns:



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

def gateways
  @gateways
end

#nameString (readonly)

Returns This is the name of credential. This is just for your reference.

Returns:

  • (String)

    This is the name of credential. This is just for your reference.



33
34
35
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 33

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:



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

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



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

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



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

def sbc_configuration
  @sbc_configuration
end

#sip_diversion_headerString (readonly)

Returns This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property.

Returns:

  • (String)

    This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property.



27
28
29
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 27

def sip_diversion_header
  @sip_diversion_header
end

#tech_prefixString (readonly)

Returns This can be used to configure the tech prefix on outbound calls. This is an advanced property.

Returns:

  • (String)

    This can be used to configure the tech prefix on outbound calls. This is an advanced property.



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

def tech_prefix
  @tech_prefix
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CreateByoSipTrunkCredentialDto

Deserialize a JSON object to an instance of CreateByoSipTrunkCredentialDto

Parameters:

  • json_object (String)

Returns:



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 87

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  gateways = parsed_json["gateways"]&.map do |item|
    item = item.to_json
    Vapi::SipTrunkGateway.from_json(json_object: item)
  end
  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"]
  tech_prefix = parsed_json["techPrefix"]
  sip_diversion_header = parsed_json["sipDiversionHeader"]
  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
  name = parsed_json["name"]
  new(
    gateways: gateways,
    outbound_authentication_plan: outbound_authentication_plan,
    outbound_leading_plus_enabled: outbound_leading_plus_enabled,
    tech_prefix: tech_prefix,
    sip_diversion_header: sip_diversion_header,
    sbc_configuration: sbc_configuration,
    name: name,
    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)


135
136
137
138
139
140
141
142
143
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 135

def self.validate_raw(obj:)
  obj.gateways.is_a?(Array) != false || raise("Passed value for field obj.gateways 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.tech_prefix&.is_a?(String) != false || raise("Passed value for field obj.tech_prefix is not the expected type, validation failed.")
  obj.sip_diversion_header&.is_a?(String) != false || raise("Passed value for field obj.sip_diversion_header is not the expected type, validation failed.")
  obj.sbc_configuration.nil? || Vapi::SbcConfiguration.validate_raw(obj: obj.sbc_configuration)
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CreateByoSipTrunkCredentialDto to a JSON object

Returns:

  • (String)


125
126
127
# File 'lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb', line 125

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