From 56486b506d1863b863d0a3554a616bbace2ff871 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 21 Jul 2026 14:44:48 +0000 Subject: [PATCH 1/2] Generate SDK with OpenAPI Generator Version --- bandwidth.yml | 40 +++++++++++++++++++ docs/AnswerCallback.md | 4 +- docs/DisconnectCallback.md | 6 ++- docs/InitiateCallback.md | 6 ++- docs/RbmActionBase.md | 2 +- docs/RbmSuggestionResponse.md | 2 +- lib/bandwidth-sdk/models/answer_callback.rb | 20 +++++++--- .../models/disconnect_callback.rb | 30 +++++++++++--- lib/bandwidth-sdk/models/initiate_callback.rb | 30 ++++++++++++-- 9 files changed, 121 insertions(+), 19 deletions(-) diff --git a/bandwidth.yml b/bandwidth.yml index 52ceffd4..305a40b7 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -4568,6 +4568,8 @@ components: $ref: '#/components/schemas/tag1' machineDetectionResult: $ref: '#/components/schemas/machineDetectionResult' + sipCallId: + $ref: '#/components/schemas/sipCallId' bridgeCompleteCallback: type: object description: >- @@ -4832,6 +4834,10 @@ components: $ref: '#/components/schemas/errorId' tag: $ref: '#/components/schemas/tag1' + sipCallId: + $ref: '#/components/schemas/sipCallId' + sipResponseCode: + $ref: '#/components/schemas/sipResponseCode' dtmfCallback: type: object description: >- @@ -4948,6 +4954,10 @@ components: $ref: '#/components/schemas/stirShaken' uui: $ref: '#/components/schemas/uui' + sipCallId: + $ref: '#/components/schemas/sipCallId' + sipHeaders: + $ref: '#/components/schemas/sipHeaders' machineDetectionCompleteCallback: type: object description: >- @@ -5595,6 +5605,36 @@ components: value, including the encoding specifier, may not exceed 256 characters. example: bXktdXVp maxLength: 256 + sipCallId: + type: string + description: >- + (optional) The SIP Call-ID of the call's current SIP dialog with + Bandwidth's SBC. Used to correlate dialogs and trace calls. Present on + any call, inbound or outbound, once that dialog has been established; + may be absent very early in a call before the dialog exists. + example: c95ac8d6e1a31c52eb38f419893c151633ec68f8d@sbc.bandwidth.com + sipHeaders: + type: object + additionalProperties: + type: string + description: >- + (optional) Map of customer-supplied X-* headers from the original + INVITE. Keys are lowercase (SIP headers are case-insensitive). Present + only for inbound SIP URI calls with custom headers. Note - keys preserve + the original SIP header name in lowercase rather than Bandwidth's usual + camelCase JSON convention, since these are passthrough values from the + caller's SIP INVITE, not Bandwidth-defined fields. If the same header + name is sent more than once in the INVITE, only the last value is kept. + example: + x-custom-header: customer-value + x-session-id: sess-12345 + sipResponseCode: + type: integer + description: >- + (optional) The SIP status code returned by Bandwidth's SBC when it + rejected an outbound call's INVITE (e.g. 486 for busy, 603 for decline). + Present only when an outbound call was rejected by the SBC. + example: 486 codeRequest: type: object properties: diff --git a/docs/AnswerCallback.md b/docs/AnswerCallback.md index 99e24095..ce060824 100644 --- a/docs/AnswerCallback.md +++ b/docs/AnswerCallback.md @@ -18,6 +18,7 @@ | **answer_time** | **Time** | Time the call was answered, in ISO 8601 format. | [optional] | | **tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | | **machine_detection_result** | [**MachineDetectionResult**](MachineDetectionResult.md) | | [optional] | +| **sip_call_id** | **String** | (optional) The SIP Call-ID of the call's current SIP dialog with Bandwidth's SBC. Used to correlate dialogs and trace calls. Present on any call, inbound or outbound, once that dialog has been established; may be absent very early in a call before the dialog exists. | [optional] | ## Example @@ -38,7 +39,8 @@ instance = Bandwidth::AnswerCallback.new( start_time: 2022-06-17T22:19:40.375Z, answer_time: 2022-06-17T22:20Z, tag: exampleTag, - machine_detection_result: null + machine_detection_result: null, + sip_call_id: c95ac8d6e1a31c52eb38f419893c151633ec68f8d@sbc.bandwidth.com ) ``` diff --git a/docs/DisconnectCallback.md b/docs/DisconnectCallback.md index b01cc6c7..8bb4d469 100644 --- a/docs/DisconnectCallback.md +++ b/docs/DisconnectCallback.md @@ -21,6 +21,8 @@ | **error_message** | **String** | Text explaining the reason that caused the call to fail in case of errors. | [optional] | | **error_id** | **String** | Bandwidth's internal id that references the error event. | [optional] | | **tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +| **sip_call_id** | **String** | (optional) The SIP Call-ID of the call's current SIP dialog with Bandwidth's SBC. Used to correlate dialogs and trace calls. Present on any call, inbound or outbound, once that dialog has been established; may be absent very early in a call before the dialog exists. | [optional] | +| **sip_response_code** | **Integer** | (optional) The SIP status code returned by Bandwidth's SBC when it rejected an outbound call's INVITE (e.g. 486 for busy, 603 for decline). Present only when an outbound call was rejected by the SBC. | [optional] | ## Example @@ -44,7 +46,9 @@ instance = Bandwidth::DisconnectCallback.new( cause: busy, error_message: Call c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f is already bridged with another call, error_id: 4642074b-7b58-478b-96e4-3a60955c6765, - tag: exampleTag + tag: exampleTag, + sip_call_id: c95ac8d6e1a31c52eb38f419893c151633ec68f8d@sbc.bandwidth.com, + sip_response_code: 486 ) ``` diff --git a/docs/InitiateCallback.md b/docs/InitiateCallback.md index 94cf0d89..54e04872 100644 --- a/docs/InitiateCallback.md +++ b/docs/InitiateCallback.md @@ -17,6 +17,8 @@ | **diversion** | [**Diversion**](Diversion.md) | | [optional] | | **stir_shaken** | [**StirShaken**](StirShaken.md) | | [optional] | | **uui** | **String** | The value of the `User-To-User` header to send within the initial `INVITE`. Must include the encoding parameter as specified in RFC 7433. Only `base64`, `jwt` and `hex` encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters. | [optional] | +| **sip_call_id** | **String** | (optional) The SIP Call-ID of the call's current SIP dialog with Bandwidth's SBC. Used to correlate dialogs and trace calls. Present on any call, inbound or outbound, once that dialog has been established; may be absent very early in a call before the dialog exists. | [optional] | +| **sip_headers** | **Hash<String, String>** | (optional) Map of customer-supplied X-* headers from the original INVITE. Keys are lowercase (SIP headers are case-insensitive). Present only for inbound SIP URI calls with custom headers. Note - keys preserve the original SIP header name in lowercase rather than Bandwidth's usual camelCase JSON convention, since these are passthrough values from the caller's SIP INVITE, not Bandwidth-defined fields. If the same header name is sent more than once in the INVITE, only the last value is kept. | [optional] | ## Example @@ -36,7 +38,9 @@ instance = Bandwidth::InitiateCallback.new( start_time: 2022-06-17T22:19:40.375Z, diversion: null, stir_shaken: null, - uui: bXktdXVp + uui: bXktdXVp, + sip_call_id: c95ac8d6e1a31c52eb38f419893c151633ec68f8d@sbc.bandwidth.com, + sip_headers: {"x-custom-header":"customer-value","x-session-id":"sess-12345"} ) ``` diff --git a/docs/RbmActionBase.md b/docs/RbmActionBase.md index 12bee534..a2a7d78c 100644 --- a/docs/RbmActionBase.md +++ b/docs/RbmActionBase.md @@ -16,7 +16,7 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionBase.new( type: null, text: Hello world, - postback_data: [B@5b3c11ce + postback_data: [B@3dabdd11 ) ``` diff --git a/docs/RbmSuggestionResponse.md b/docs/RbmSuggestionResponse.md index 2686306c..6494287e 100644 --- a/docs/RbmSuggestionResponse.md +++ b/docs/RbmSuggestionResponse.md @@ -15,7 +15,7 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmSuggestionResponse.new( text: Yes, I would like to proceed, - postback_data: [B@5b3c11ce, + postback_data: [B@3dabdd11, paired_message_id: 1752697342534u24xerqdukke523x ) ``` diff --git a/lib/bandwidth-sdk/models/answer_callback.rb b/lib/bandwidth-sdk/models/answer_callback.rb index 29f9d8d1..181f6cb2 100644 --- a/lib/bandwidth-sdk/models/answer_callback.rb +++ b/lib/bandwidth-sdk/models/answer_callback.rb @@ -56,6 +56,9 @@ class AnswerCallback < ApiModelBase attr_accessor :machine_detection_result + # (optional) The SIP Call-ID of the call's current SIP dialog with Bandwidth's SBC. Used to correlate dialogs and trace calls. Present on any call, inbound or outbound, once that dialog has been established; may be absent very early in a call before the dialog exists. + attr_accessor :sip_call_id + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -94,7 +97,8 @@ def self.attribute_map :'start_time' => :'startTime', :'answer_time' => :'answerTime', :'tag' => :'tag', - :'machine_detection_result' => :'machineDetectionResult' + :'machine_detection_result' => :'machineDetectionResult', + :'sip_call_id' => :'sipCallId' } end @@ -124,7 +128,8 @@ def self.openapi_types :'start_time' => :'Time', :'answer_time' => :'Time', :'tag' => :'String', - :'machine_detection_result' => :'MachineDetectionResult' + :'machine_detection_result' => :'MachineDetectionResult', + :'sip_call_id' => :'String' } end @@ -134,7 +139,7 @@ def self.openapi_nullable :'enqueued_time', :'answer_time', :'tag', - :'machine_detection_result' + :'machine_detection_result', ]) end @@ -209,6 +214,10 @@ def initialize(attributes = {}) if attributes.key?(:'machine_detection_result') self.machine_detection_result = attributes[:'machine_detection_result'] end + + if attributes.key?(:'sip_call_id') + self.sip_call_id = attributes[:'sip_call_id'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -244,7 +253,8 @@ def ==(o) start_time == o.start_time && answer_time == o.answer_time && tag == o.tag && - machine_detection_result == o.machine_detection_result + machine_detection_result == o.machine_detection_result && + sip_call_id == o.sip_call_id end # @see the `==` method @@ -256,7 +266,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, enqueued_time, start_time, answer_time, tag, machine_detection_result].hash + [event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, enqueued_time, start_time, answer_time, tag, machine_detection_result, sip_call_id].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/disconnect_callback.rb b/lib/bandwidth-sdk/models/disconnect_callback.rb index fdad845b..13394047 100644 --- a/lib/bandwidth-sdk/models/disconnect_callback.rb +++ b/lib/bandwidth-sdk/models/disconnect_callback.rb @@ -66,6 +66,12 @@ class DisconnectCallback < ApiModelBase # (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. attr_accessor :tag + # (optional) The SIP Call-ID of the call's current SIP dialog with Bandwidth's SBC. Used to correlate dialogs and trace calls. Present on any call, inbound or outbound, once that dialog has been established; may be absent very early in a call before the dialog exists. + attr_accessor :sip_call_id + + # (optional) The SIP status code returned by Bandwidth's SBC when it rejected an outbound call's INVITE (e.g. 486 for busy, 603 for decline). Present only when an outbound call was rejected by the SBC. + attr_accessor :sip_response_code + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -107,7 +113,9 @@ def self.attribute_map :'cause' => :'cause', :'error_message' => :'errorMessage', :'error_id' => :'errorId', - :'tag' => :'tag' + :'tag' => :'tag', + :'sip_call_id' => :'sipCallId', + :'sip_response_code' => :'sipResponseCode' } end @@ -140,7 +148,9 @@ def self.openapi_types :'cause' => :'String', :'error_message' => :'String', :'error_id' => :'String', - :'tag' => :'String' + :'tag' => :'String', + :'sip_call_id' => :'String', + :'sip_response_code' => :'Integer' } end @@ -151,7 +161,7 @@ def self.openapi_nullable :'answer_time', :'error_message', :'error_id', - :'tag' + :'tag', ]) end @@ -238,6 +248,14 @@ def initialize(attributes = {}) if attributes.key?(:'tag') self.tag = attributes[:'tag'] end + + if attributes.key?(:'sip_call_id') + self.sip_call_id = attributes[:'sip_call_id'] + end + + if attributes.key?(:'sip_response_code') + self.sip_response_code = attributes[:'sip_response_code'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -276,7 +294,9 @@ def ==(o) cause == o.cause && error_message == o.error_message && error_id == o.error_id && - tag == o.tag + tag == o.tag && + sip_call_id == o.sip_call_id && + sip_response_code == o.sip_response_code end # @see the `==` method @@ -288,7 +308,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [event_type, event_time, account_id, application_id, from, to, call_id, direction, call_url, enqueued_time, start_time, answer_time, end_time, cause, error_message, error_id, tag].hash + [event_type, event_time, account_id, application_id, from, to, call_id, direction, call_url, enqueued_time, start_time, answer_time, end_time, cause, error_message, error_id, tag, sip_call_id, sip_response_code].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/initiate_callback.rb b/lib/bandwidth-sdk/models/initiate_callback.rb index 45292da7..7c5aef42 100644 --- a/lib/bandwidth-sdk/models/initiate_callback.rb +++ b/lib/bandwidth-sdk/models/initiate_callback.rb @@ -52,6 +52,12 @@ class InitiateCallback < ApiModelBase # The value of the `User-To-User` header to send within the initial `INVITE`. Must include the encoding parameter as specified in RFC 7433. Only `base64`, `jwt` and `hex` encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters. attr_accessor :uui + # (optional) The SIP Call-ID of the call's current SIP dialog with Bandwidth's SBC. Used to correlate dialogs and trace calls. Present on any call, inbound or outbound, once that dialog has been established; may be absent very early in a call before the dialog exists. + attr_accessor :sip_call_id + + # (optional) Map of customer-supplied X-* headers from the original INVITE. Keys are lowercase (SIP headers are case-insensitive). Present only for inbound SIP URI calls with custom headers. Note - keys preserve the original SIP header name in lowercase rather than Bandwidth's usual camelCase JSON convention, since these are passthrough values from the caller's SIP INVITE, not Bandwidth-defined fields. If the same header name is sent more than once in the INVITE, only the last value is kept. + attr_accessor :sip_headers + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -89,7 +95,9 @@ def self.attribute_map :'start_time' => :'startTime', :'diversion' => :'diversion', :'stir_shaken' => :'stirShaken', - :'uui' => :'uui' + :'uui' => :'uui', + :'sip_call_id' => :'sipCallId', + :'sip_headers' => :'sipHeaders' } end @@ -118,7 +126,9 @@ def self.openapi_types :'start_time' => :'Time', :'diversion' => :'Diversion', :'stir_shaken' => :'StirShaken', - :'uui' => :'String' + :'uui' => :'String', + :'sip_call_id' => :'String', + :'sip_headers' => :'Hash' } end @@ -195,6 +205,16 @@ def initialize(attributes = {}) if attributes.key?(:'uui') self.uui = attributes[:'uui'] end + + if attributes.key?(:'sip_call_id') + self.sip_call_id = attributes[:'sip_call_id'] + end + + if attributes.key?(:'sip_headers') + if (value = attributes[:'sip_headers']).is_a?(Hash) + self.sip_headers = value + end + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -248,7 +268,9 @@ def ==(o) start_time == o.start_time && diversion == o.diversion && stir_shaken == o.stir_shaken && - uui == o.uui + uui == o.uui && + sip_call_id == o.sip_call_id && + sip_headers == o.sip_headers end # @see the `==` method @@ -260,7 +282,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, start_time, diversion, stir_shaken, uui].hash + [event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, start_time, diversion, stir_shaken, uui, sip_call_id, sip_headers].hash end # Builds the object from hash From cc85f161d23f34bae2f75e3f9cb7d28d271dc9d3 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Wed, 22 Jul 2026 14:54:38 -0400 Subject: [PATCH 2/2] unit tests --- spec/unit/models/answer_callback_spec.rb | 12 ++++++++---- spec/unit/models/disconnect_callback_spec.rb | 16 ++++++++++++---- spec/unit/models/initiate_callback_spec.rb | 17 +++++++++++++---- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/spec/unit/models/answer_callback_spec.rb b/spec/unit/models/answer_callback_spec.rb index c775a207..eb81ec1b 100644 --- a/spec/unit/models/answer_callback_spec.rb +++ b/spec/unit/models/answer_callback_spec.rb @@ -15,7 +15,8 @@ start_time: '2022-06-16T13:15:07.160Z', answer_time: '2022-06-16T13:15:18.126Z', tag: 'custom tag', - machine_detection_result: { value: 'human', duration: 'PT5S' } + machine_detection_result: { value: 'human', duration: 'PT5S' }, + sip_call_id: 'sip-call-id-12345', }) } describe '#initialize' do @@ -65,7 +66,8 @@ startTime: '2022-06-16T13:15:07.160Z', answerTime: '2022-06-16T13:15:18.126Z', tag: 'custom tag', - machineDetectionResult: { value: 'human', duration: 'PT5S' } + machineDetectionResult: { value: 'human', duration: 'PT5S' }, + sipCallId: 'sip-call-id-12345' }) expect(answer_callback_from_hash).to be_instance_of(Bandwidth::AnswerCallback) expect(answer_callback_from_hash.event_type).to eq('answer') @@ -84,12 +86,13 @@ expect(answer_callback_from_hash.machine_detection_result).to be_instance_of(Bandwidth::MachineDetectionResult) expect(answer_callback_from_hash.machine_detection_result.value).to eq('human') expect(answer_callback_from_hash.machine_detection_result.duration).to eq('PT5S') + expect(answer_callback_from_hash.sip_call_id).to eq('sip-call-id-12345') end end describe '#to_s' do it 'returns a string representation of the object' do - expect(answer_callback_values.to_s).to eq('{:eventType=>"answer", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag", :machineDetectionResult=>{:value=>"human", :duration=>"PT5S"}}') + expect(answer_callback_values.to_s).to eq('{:eventType=>"answer", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag", :machineDetectionResult=>{:value=>"human", :duration=>"PT5S"}, :sipCallId=>"sip-call-id-12345"}') end end @@ -116,7 +119,8 @@ startTime: '2022-06-16T13:15:07.160Z', answerTime: '2022-06-16T13:15:18.126Z', tag: 'custom tag', - machineDetectionResult: { value: 'human', duration: 'PT5S' } + machineDetectionResult: { value: 'human', duration: 'PT5S' }, + sipCallId: 'sip-call-id-12345' }) end end diff --git a/spec/unit/models/disconnect_callback_spec.rb b/spec/unit/models/disconnect_callback_spec.rb index 20457aae..bca37ccf 100644 --- a/spec/unit/models/disconnect_callback_spec.rb +++ b/spec/unit/models/disconnect_callback_spec.rb @@ -18,7 +18,9 @@ cause: 'hangup', error_message: 'call rejected', error_id: '4642074b-7b58-478b-96e4-3a60955c6765', - tag: 'custom tag' + tag: 'custom tag', + sip_call_id: 'sip-call-id-12345', + sip_response_code: '486', }) } describe '#initialize' do @@ -72,7 +74,9 @@ cause: 'hangup', errorMessage: 'call rejected', errorId: '4642074b-7b58-478b-96e4-3a60955c6765', - tag: 'custom tag' + tag: 'custom tag', + sipCallId: 'sip-call-id-12345', + sipResponseCode: 486, }) expect(disconnect_callback_from_hash).to be_instance_of(Bandwidth::DisconnectCallback) expect(disconnect_callback_from_hash.event_type).to eq('disconnect') @@ -92,12 +96,14 @@ expect(disconnect_callback_from_hash.error_message).to eq('call rejected') expect(disconnect_callback_from_hash.error_id).to eq('4642074b-7b58-478b-96e4-3a60955c6765') expect(disconnect_callback_from_hash.tag).to eq('custom tag') + expect(disconnect_callback_from_hash.sip_call_id).to eq('sip-call-id-12345') + expect(disconnect_callback_from_hash.sip_response_code).to eq(486) end end describe '#to_s' do it 'returns a string representation of the object' do - expect(disconnect_callback_values.to_s).to eq('{:eventType=>"disconnect", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :direction=>"inbound", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :endTime=>"2022-06-16T13:16:18.126Z", :cause=>"hangup", :errorMessage=>"call rejected", :errorId=>"4642074b-7b58-478b-96e4-3a60955c6765", :tag=>"custom tag"}') + expect(disconnect_callback_values.to_s).to eq('{:eventType=>"disconnect", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :direction=>"inbound", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :endTime=>"2022-06-16T13:16:18.126Z", :cause=>"hangup", :errorMessage=>"call rejected", :errorId=>"4642074b-7b58-478b-96e4-3a60955c6765", :tag=>"custom tag", :sipCallId=>"sip-call-id-12345", :sipResponseCode=>"486"}') end end @@ -127,7 +133,9 @@ cause: 'hangup', errorMessage: 'call rejected', errorId: '4642074b-7b58-478b-96e4-3a60955c6765', - tag: 'custom tag' + tag: 'custom tag', + sipCallId: 'sip-call-id-12345', + sipResponseCode: '486' }) end end diff --git a/spec/unit/models/initiate_callback_spec.rb b/spec/unit/models/initiate_callback_spec.rb index 5f5dd51d..f65d0cbf 100644 --- a/spec/unit/models/initiate_callback_spec.rb +++ b/spec/unit/models/initiate_callback_spec.rb @@ -14,7 +14,9 @@ start_time: '2022-06-16T13:15:07.160Z', diversion: { reason: 'unconditional', privacy: 'off' }, stir_shaken: { verstat: 'TN-Validation-Passed', attestationIndicator: 'A', originatingId: '527c7d1f-22a4-4ec1-ad19-1a4ec9466cdb' }, - uui: 'aGVsbG8sIHdvcmxkIQ==;encoding=base64' + uui: 'aGVsbG8sIHdvcmxkIQ==;encoding=base64', + sip_call_id: 'sip-call-id-12345', + sip_headers: { 'X-Custom-Header' => 'custom-value' } }) } describe '#initialize' do @@ -58,7 +60,9 @@ startTime: '2022-06-16T13:15:07.160Z', diversion: { reason: 'unconditional', privacy: 'off' }, stirShaken: { verstat: 'TN-Validation-Passed', attestationIndicator: 'A', originatingId: '527c7d1f-22a4-4ec1-ad19-1a4ec9466cdb' }, - uui: 'aGVsbG8sIHdvcmxkIQ==;encoding=base64' + uui: 'aGVsbG8sIHdvcmxkIQ==;encoding=base64', + sipCallId: 'sip-call-id-12345', + sipHeaders: { 'X-Custom-Header' => 'custom-value' } }) expect(initiate_callback_from_hash).to be_instance_of(Bandwidth::InitiateCallback) expect(initiate_callback_from_hash.event_type).to eq('initiate') @@ -76,12 +80,15 @@ expect(initiate_callback_from_hash.stir_shaken).to be_instance_of(Bandwidth::StirShaken) expect(initiate_callback_from_hash.stir_shaken.verstat).to eq('TN-Validation-Passed') expect(initiate_callback_from_hash.uui).to eq('aGVsbG8sIHdvcmxkIQ==;encoding=base64') + expect(initiate_callback_from_hash.sip_call_id).to eq('sip-call-id-12345') + expect(initiate_callback_from_hash.sip_headers).to be_instance_of(Hash) + expect(initiate_callback_from_hash.sip_headers['X-Custom-Header']).to eq('custom-value') end end describe '#to_s' do it 'returns a string representation of the object' do - expect(initiate_callback_values.to_s).to eq('{:eventType=>"initiate", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :startTime=>"2022-06-16T13:15:07.160Z", :diversion=>{:reason=>"unconditional", :privacy=>"off"}, :stirShaken=>{:verstat=>"TN-Validation-Passed", :attestationIndicator=>"A", :originatingId=>"527c7d1f-22a4-4ec1-ad19-1a4ec9466cdb"}, :uui=>"aGVsbG8sIHdvcmxkIQ==;encoding=base64"}') + expect(initiate_callback_values.to_s).to eq('{:eventType=>"initiate", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :startTime=>"2022-06-16T13:15:07.160Z", :diversion=>{:reason=>"unconditional", :privacy=>"off"}, :stirShaken=>{:verstat=>"TN-Validation-Passed", :attestationIndicator=>"A", :originatingId=>"527c7d1f-22a4-4ec1-ad19-1a4ec9466cdb"}, :uui=>"aGVsbG8sIHdvcmxkIQ==;encoding=base64", :sipCallId=>"sip-call-id-12345", :sipHeaders=>{"X-Custom-Header"=>"custom-value"}}') end end @@ -107,7 +114,9 @@ startTime: '2022-06-16T13:15:07.160Z', diversion: { reason: 'unconditional', privacy: 'off' }, stirShaken: { verstat: 'TN-Validation-Passed', attestationIndicator: 'A', originatingId: '527c7d1f-22a4-4ec1-ad19-1a4ec9466cdb' }, - uui: 'aGVsbG8sIHdvcmxkIQ==;encoding=base64' + uui: 'aGVsbG8sIHdvcmxkIQ==;encoding=base64', + sipCallId: 'sip-call-id-12345', + sipHeaders: { 'X-Custom-Header' => 'custom-value' } }) end end