diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 7f2bb48b..529223f2 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -158,6 +158,7 @@ docs/RbmMessageContentRichCard.md docs/RbmMessageContentText.md docs/RbmMessageMedia.md docs/RbmOpenUrlEnum.md +docs/RbmSession.md docs/RbmStandaloneCard.md docs/RbmSuggestionResponse.md docs/RbmWebViewEnum.md @@ -381,6 +382,7 @@ lib/bandwidth-sdk/models/rbm_message_content_rich_card.rb lib/bandwidth-sdk/models/rbm_message_content_text.rb lib/bandwidth-sdk/models/rbm_message_media.rb lib/bandwidth-sdk/models/rbm_open_url_enum.rb +lib/bandwidth-sdk/models/rbm_session.rb lib/bandwidth-sdk/models/rbm_standalone_card.rb lib/bandwidth-sdk/models/rbm_suggestion_response.rb lib/bandwidth-sdk/models/rbm_web_view_enum.rb diff --git a/README.md b/README.md index 60bf8060..f86216e1 100644 --- a/README.md +++ b/README.md @@ -322,6 +322,7 @@ Class | Method | HTTP request | Description - [Bandwidth::RbmMessageContentText](docs/RbmMessageContentText.md) - [Bandwidth::RbmMessageMedia](docs/RbmMessageMedia.md) - [Bandwidth::RbmOpenUrlEnum](docs/RbmOpenUrlEnum.md) + - [Bandwidth::RbmSession](docs/RbmSession.md) - [Bandwidth::RbmStandaloneCard](docs/RbmStandaloneCard.md) - [Bandwidth::RbmSuggestionResponse](docs/RbmSuggestionResponse.md) - [Bandwidth::RbmWebViewEnum](docs/RbmWebViewEnum.md) diff --git a/bandwidth.yml b/bandwidth.yml index 350b6217..0df9d764 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -2031,6 +2031,7 @@ components: messageLength: type: integer description: The length of the message content. + nullable: true example: 18 attachmentCount: type: integer @@ -2620,14 +2621,13 @@ components: type: string description: Displayed text for user to click maxLength: 25 - example: Hello world + example: Track my order rbmActionPostbackData: title: Post Back Data type: string - format: byte - description: Base64 payload the customer receives when the reply is clicked. + description: Payload the customer receives when the reply is clicked. maxLength: 2048 - example: SGVsbG8gd29ybGQ= + example: track-order-43654 rbmActionBase: type: object properties: @@ -2916,8 +2916,8 @@ components: properties: text: type: string - description: The text associated with the suggestion response. - example: Yes, I would like to proceed + description: The text of the suggestion the user tapped. + example: Track my order postbackData: $ref: '#/components/schemas/rbmActionPostbackData' pairedMessageId: @@ -2938,6 +2938,70 @@ components: format: double description: The longitude of the client's location. example: '-122.4194' + rbmSession: + type: object + description: >- + RCS interactive session information for the message. + + An interactive session is a 24-hour window covering all Rich and Rich + Media messages exchanged between an + + RCS agent and a specific end user mobile number. It is triggered when at + least 4 messages are exchanged within + + 24 hours, at least 2 of them mobile-originated and at least 1 + mobile-terminated. + + Only present on `message-delivered`, `message-received` and + `session-started` callbacks for RBM messages of + + US agents with the Conversational billing category. Omitted for all + other messages. + properties: + canInitiate: + type: boolean + description: >- + Whether the message can start an interactive session. + + `false` if the message is already part of an active session, or if + the agent is not eligible for + + interactive session billing. + example: false + id: + type: string + nullable: true + description: >- + The unique identifier of the interactive session the message is part + of. This is not a message ID. + + Omitted if the message is not part of a session. + example: 0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d + type: + type: string + nullable: true + description: |- + The type of the interactive session. + Only present on `session-started` callbacks. + example: INTERACTIVE_SESSION + startTime: + type: string + nullable: true + format: date-time + description: >- + The time the 24-hour session window opened. Only present on + `session-started` callbacks. + example: '2026-08-06T09:59:55Z' + endTime: + type: string + nullable: true + format: date-time + description: >- + The time the 24-hour session window closes. Only present on + `session-started` callbacks. + example: '2026-08-07T09:59:55Z' + required: + - canInitiate callback: description: >- Callbacks are divided into two types based on direction of the related @@ -2960,6 +3024,7 @@ components: message-delivered: '#/components/schemas/statusCallback' message-failed: '#/components/schemas/statusCallback' message-read: '#/components/schemas/statusCallback' + session-started: '#/components/schemas/statusCallback' message-received: '#/components/schemas/inboundCallback' requested-location-response: '#/components/schemas/inboundCallback' suggestion-response: '#/components/schemas/inboundCallback' @@ -3060,12 +3125,17 @@ components: - `message-read` indicates that the RBM message was read by the recipient. + + - `session-started` indicates that a previously exchanged RBM message is + now part of an RCS interactive session and is no longer billed + individually. enum: - message-sending - message-sent - message-delivered - message-failed - message-read + - session-started example: message-delivered inboundCallbackTypeEnum: type: string @@ -3143,6 +3213,8 @@ components: $ref: '#/components/schemas/priorityEnum' channel: $ref: '#/components/schemas/multiChannelMessageChannelEnum' + session: + $ref: '#/components/schemas/rbmSession' required: - id - owner @@ -4876,6 +4948,10 @@ components: $ref: '#/components/schemas/sipCallId' sipResponseCode: $ref: '#/components/schemas/sipResponseCode' + sipStatusLine: + $ref: '#/components/schemas/sipStatusLine' + sipHeaders: + $ref: '#/components/schemas/sipHeaders' dtmfCallback: type: object description: >- @@ -5395,6 +5471,12 @@ components: $ref: '#/components/schemas/errorMessage' errorId: $ref: '#/components/schemas/errorId' + sipResponseCode: + $ref: '#/components/schemas/sipResponseCode' + sipStatusLine: + $ref: '#/components/schemas/sipStatusLine' + sipHeaders: + $ref: '#/components/schemas/sipHeaders' eventType: type: string description: >- @@ -5710,23 +5792,44 @@ components: 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. + (optional) Map of SIP headers, with lowercase keys (SIP headers are + case-insensitive). On the Initiate callback, contains the + customer-supplied X-* headers from the original INVITE; present only for + inbound SIP URI calls with custom headers. On the Disconnect and + Transfer Disconnect callbacks, contains a single `reason` key holding + the raw, unmodified `Reason` header value from the final SIP response + that rejected an outbound call (or transferred leg); present only when + that response included a `Reason` header (for example, `v=analytics1` + call-analytics block information from a terminating carrier). If the + response carries more than one `Reason` header, all values are returned + in the order received, separated by `, `. Note - on the Initiate + callback, 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. The example shown is for the Initiate + callback; on the Disconnect and Transfer Disconnect callbacks the only + key is `reason`. 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. + (optional) The SIP status code of the final response that rejected an + outbound call's (or transferred leg's) INVITE (e.g. 486 for busy, 603 + for decline). Present only when the call was rejected with a SIP + response. example: 486 + sipStatusLine: + type: string + description: >- + (optional) The full SIP status line, exactly as received, of the final + response that rejected an outbound call's INVITE. The reason phrase can + help distinguish outcomes that share a status code, such as `603 Network + Blocked` and `603 Decline`. Present only when an outbound call was + rejected with a SIP response. + example: SIP/2.0 603 Network Blocked codeRequest: type: object properties: @@ -8878,6 +8981,31 @@ components: media: - >- https://messaging.bandwidth.com/api/v2/users/9900902/media/14762070468292kw2fuqty55yp2b2/0/bw.png + rbmMessageReceivedSessionCallbackExample: + summary: >- + An example of a rbm message-received callback body for a message that is + part of an RCS interactive session. + value: + time: '2026-08-06T10:00:05.502180Z' + type: message-received + to: BandwidthRBM + description: Incoming message received + message: + id: 1786010405502l2ntaoajuqjhqnxu + owner: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2026-08-06T10:00:05.302180Z' + segmentCount: 1 + direction: in + to: + - BandwidthRBM + from: '+12345678902' + channel: RBM + content: + text: Yes, please book it for tomorrow. + session: + canInitiate: false + id: 0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d messageSendingCallbackExample: summary: An example of a message-sending callback body. value: @@ -8977,6 +9105,79 @@ components: owner: '+12345678902' direction: out segmentCount: 1 + rbmMessageDeliveredSessionCallbackExample: + summary: >- + An example of a rbm message-delivered callback body for a message that + is part of an RCS interactive session. + value: + type: message-delivered + time: '2026-08-06T10:01:11.160744Z' + description: Message delivered to handset. + to: '+12345678902' + message: + id: 1786010470868ty55yp2b2kw2fuq + time: '2026-08-06T10:01:10.868292Z' + to: + - '+12345678902' + from: BandwidthRBM + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: BandwidthRBM + direction: out + segmentCount: 1 + channel: RBM + session: + canInitiate: false + id: 0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d + rbmMessageDeliveredCanInitiateSessionCallbackExample: + summary: >- + An example of a rbm message-delivered callback body for a message that + is not yet part of an RCS interactive session. + value: + type: message-delivered + time: '2026-08-06T09:59:56.160744Z' + description: Message delivered to handset. + to: '+12345678902' + message: + id: 1786010395000kw2fuqty55yp2b2 + time: '2026-08-06T09:59:55.000000Z' + to: + - '+12345678902' + from: BandwidthRBM + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: BandwidthRBM + direction: out + segmentCount: 1 + channel: RBM + session: + canInitiate: true + sessionStartedCallbackExample: + summary: An example of a session-started callback body. + value: + type: session-started + time: '2026-08-06T10:00:00.123000Z' + description: Message is now part of an RCS interactive session. + to: '+12345678902' + message: + id: 1786010395000kw2fuqty55yp2b2 + owner: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2026-08-06T10:00:00.120000Z' + segmentCount: 1 + direction: out + to: + - '+12345678902' + from: BandwidthRBM + text: '' + tag: '' + channel: RBM + session: + canInitiate: false + id: 0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d + type: INTERACTIVE_SESSION + startTime: '2026-08-06T09:59:55Z' + endTime: '2026-08-07T09:59:55Z' messageFailedCallbackExample: summary: An example of a message-failed callback body. value: @@ -9980,6 +10181,9 @@ components: $ref: '#/components/examples/smsMessageReceivedCallbackExample' mmsMessageReceivedCallback: $ref: '#/components/examples/mmsMessageReceivedCallbackExample' + rbmMessageReceivedSessionCallback: + $ref: >- + #/components/examples/rbmMessageReceivedSessionCallbackExample responses: '200': description: OK @@ -9995,8 +10199,9 @@ components: information regarding a message sent (MT) from your message-enabled Bandwidth telephone number. -

The payload type will be one of message-sending, message-sent, message-delivered, message-failed or message-read. -

Note that message-read callbacks are pertinent only for RBM messages sent from the /messages/multiChannel endpoint. +

The payload type will be one of message-sending, message-sent, message-delivered, message-failed, message-read or session-started. +

Note that message-read and session-started callbacks are pertinent only for RBM messages sent from the /messages/multiChannel endpoint. +

Note that session-started callbacks are pertinent only for RBM messages of agents with the Conversational billing category.

Please visit Webhooks

content: @@ -10015,8 +10220,16 @@ components: groupMmsMessageDeliveredCallback: $ref: >- #/components/examples/groupMmsMessageDeliveredCallbackExample + rbmMessageDeliveredSessionCallback: + $ref: >- + #/components/examples/rbmMessageDeliveredSessionCallbackExample + rbmMessageDeliveredCanInitiateSessionCallback: + $ref: >- + #/components/examples/rbmMessageDeliveredCanInitiateSessionCallbackExample messageFailedCallback: $ref: '#/components/examples/messageFailedCallbackExample' + sessionStartedCallback: + $ref: '#/components/examples/sessionStartedCallbackExample' responses: '200': description: OK diff --git a/docs/Callback.md b/docs/Callback.md index 80aaca3e..e5756655 100644 --- a/docs/Callback.md +++ b/docs/Callback.md @@ -51,6 +51,7 @@ Bandwidth::Callback.openapi_discriminator_mapping # :'message-sending' => :'StatusCallback', # :'message-sent' => :'StatusCallback', # :'requested-location-response' => :'InboundCallback', +# :'session-started' => :'StatusCallback', # :'suggestion-response' => :'InboundCallback' # } ``` diff --git a/docs/DisconnectCallback.md b/docs/DisconnectCallback.md index 89cb2eca..0f5e79c4 100644 --- a/docs/DisconnectCallback.md +++ b/docs/DisconnectCallback.md @@ -22,7 +22,9 @@ | **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] | +| **sip_response_code** | **Integer** | (optional) The SIP status code of the final response that rejected an outbound call's (or transferred leg's) INVITE (e.g. 486 for busy, 603 for decline). Present only when the call was rejected with a SIP response. | [optional] | +| **sip_status_line** | **String** | (optional) The full SIP status line, exactly as received, of the final response that rejected an outbound call's INVITE. The reason phrase can help distinguish outcomes that share a status code, such as `603 Network Blocked` and `603 Decline`. Present only when an outbound call was rejected with a SIP response. | [optional] | +| **sip_headers** | **Hash<String, String>** | (optional) Map of SIP headers, with lowercase keys (SIP headers are case-insensitive). On the Initiate callback, contains the customer-supplied X-* headers from the original INVITE; present only for inbound SIP URI calls with custom headers. On the Disconnect and Transfer Disconnect callbacks, contains a single `reason` key holding the raw, unmodified `Reason` header value from the final SIP response that rejected an outbound call (or transferred leg); present only when that response included a `Reason` header (for example, `v=analytics1` call-analytics block information from a terminating carrier). If the response carries more than one `Reason` header, all values are returned in the order received, separated by `, `. Note - on the Initiate callback, 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. The example shown is for the Initiate callback; on the Disconnect and Transfer Disconnect callbacks the only key is `reason`. | [optional] | ## Example @@ -48,7 +50,9 @@ instance = Bandwidth::DisconnectCallback.new( error_id: 4642074b-7b58-478b-96e4-3a60955c6765, tag: exampleTag, sip_call_id: c95ac8d6e1a31c52eb38f419893c151633ec68f8d@sbc.bandwidth.com, - sip_response_code: 486 + sip_response_code: 486, + sip_status_line: SIP/2.0 603 Network Blocked, + sip_headers: {"x-custom-header":"customer-value","x-session-id":"sess-12345"} ) ``` diff --git a/docs/InboundCallbackMessage.md b/docs/InboundCallbackMessage.md index 2ef8d8d9..cd7e67a7 100644 --- a/docs/InboundCallbackMessage.md +++ b/docs/InboundCallbackMessage.md @@ -17,6 +17,7 @@ | **media** | **Array<String>** | Optional media, not applicable for sms | [optional] | | **priority** | [**PriorityEnum**](PriorityEnum.md) | | [optional] | | **channel** | [**MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] | +| **session** | [**RbmSession**](RbmSession.md) | | [optional] | | **content** | [**MultiChannelMessageContent**](MultiChannelMessageContent.md) | | [optional] | | **suggestion_response** | [**RbmSuggestionResponse**](RbmSuggestionResponse.md) | | [optional] | | **location_response** | [**RbmLocationResponse**](RbmLocationResponse.md) | | [optional] | @@ -40,6 +41,7 @@ instance = Bandwidth::InboundCallbackMessage.new( media: [https://dev.bandwidth.com/images/bandwidth-logo.png, https://dev.bandwidth.com/images/github_logo.png], priority: null, channel: null, + session: null, content: null, suggestion_response: null, location_response: null diff --git a/docs/InitiateCallback.md b/docs/InitiateCallback.md index dd6e13fb..e04bcd51 100644 --- a/docs/InitiateCallback.md +++ b/docs/InitiateCallback.md @@ -18,7 +18,7 @@ | **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] | +| **sip_headers** | **Hash<String, String>** | (optional) Map of SIP headers, with lowercase keys (SIP headers are case-insensitive). On the Initiate callback, contains the customer-supplied X-* headers from the original INVITE; present only for inbound SIP URI calls with custom headers. On the Disconnect and Transfer Disconnect callbacks, contains a single `reason` key holding the raw, unmodified `Reason` header value from the final SIP response that rejected an outbound call (or transferred leg); present only when that response included a `Reason` header (for example, `v=analytics1` call-analytics block information from a terminating carrier). If the response carries more than one `Reason` header, all values are returned in the order received, separated by `, `. Note - on the Initiate callback, 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. The example shown is for the Initiate callback; on the Disconnect and Transfer Disconnect callbacks the only key is `reason`. | [optional] | ## Example diff --git a/docs/MultiChannelAction.md b/docs/MultiChannelAction.md index 2dd71011..a0509c0e 100644 --- a/docs/MultiChannelAction.md +++ b/docs/MultiChannelAction.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Payload the customer receives when the reply is clicked. | | | **phone_number** | **String** | The phone number to dial. Must be E164 format. | | | **latitude** | **Float** | The latitude of the location. Must be in range [-90.000000, 90.000000]. | | | **longitude** | **Float** | The longitude of the location. Must be in range [-180.000000, 180.000000]. | | @@ -26,8 +26,8 @@ require 'bandwidth-sdk' instance = Bandwidth::MultiChannelAction.new( type: null, - text: Hello world, - postback_data: U0dWc2JHOGdkMjl5YkdRPQ==, + text: Track my order, + postback_data: track-order-43654, phone_number: +15552223333, latitude: 37.7749, longitude: -122.4194, diff --git a/docs/MultiChannelActionCalendarEvent.md b/docs/MultiChannelActionCalendarEvent.md index d493b054..509d4197 100644 --- a/docs/MultiChannelActionCalendarEvent.md +++ b/docs/MultiChannelActionCalendarEvent.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Payload the customer receives when the reply is clicked. | | | **title** | **String** | The title of the event. | | | **start_time** | **Time** | The start time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. | | | **end_time** | **Time** | The end time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. | | @@ -19,8 +19,8 @@ require 'bandwidth-sdk' instance = Bandwidth::MultiChannelActionCalendarEvent.new( type: null, - text: Hello world, - postback_data: U0dWc2JHOGdkMjl5YkdRPQ==, + text: Track my order, + postback_data: track-order-43654, title: Meeting with John, start_time: 2022-09-14T18:20:16Z, end_time: 2022-09-14T18:20:16Z, diff --git a/docs/RbmActionBase.md b/docs/RbmActionBase.md index cdf5e020..107a150e 100644 --- a/docs/RbmActionBase.md +++ b/docs/RbmActionBase.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Payload the customer receives when the reply is clicked. | | ## Example @@ -15,8 +15,8 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionBase.new( type: null, - text: Hello world, - postback_data: [B@11fa11b2 + text: Track my order, + postback_data: track-order-43654 ) ``` diff --git a/docs/RbmActionDial.md b/docs/RbmActionDial.md index f14ab5bf..20a58bc4 100644 --- a/docs/RbmActionDial.md +++ b/docs/RbmActionDial.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Payload the customer receives when the reply is clicked. | | | **phone_number** | **String** | The phone number to dial. Must be E164 format. | | ## Example @@ -16,8 +16,8 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionDial.new( type: null, - text: Hello world, - postback_data: U0dWc2JHOGdkMjl5YkdRPQ==, + text: Track my order, + postback_data: track-order-43654, phone_number: +15552223333 ) ``` diff --git a/docs/RbmActionOpenUrl.md b/docs/RbmActionOpenUrl.md index e03b865e..ffa45a62 100644 --- a/docs/RbmActionOpenUrl.md +++ b/docs/RbmActionOpenUrl.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Payload the customer receives when the reply is clicked. | | | **url** | **String** | The URL to open in browser. Must use http:// or https:// scheme. | | | **application** | [**RbmOpenUrlEnum**](RbmOpenUrlEnum.md) | | [optional] | | **webview_view_mode** | [**RbmWebViewEnum**](RbmWebViewEnum.md) | | [optional] | @@ -18,8 +18,8 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionOpenUrl.new( type: null, - text: Hello world, - postback_data: U0dWc2JHOGdkMjl5YkdRPQ==, + text: Track my order, + postback_data: track-order-43654, url: https://dev.bandwidth.com, application: null, webview_view_mode: null diff --git a/docs/RbmActionViewLocation.md b/docs/RbmActionViewLocation.md index 8457bbdc..327759f9 100644 --- a/docs/RbmActionViewLocation.md +++ b/docs/RbmActionViewLocation.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Payload the customer receives when the reply is clicked. | | | **latitude** | **Float** | The latitude of the location. Must be in range [-90.000000, 90.000000]. | | | **longitude** | **Float** | The longitude of the location. Must be in range [-180.000000, 180.000000]. | | | **label** | **String** | The label of the location. | [optional] | @@ -18,8 +18,8 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionViewLocation.new( type: null, - text: Hello world, - postback_data: U0dWc2JHOGdkMjl5YkdRPQ==, + text: Track my order, + postback_data: track-order-43654, latitude: 37.7749, longitude: -122.4194, label: San Francisco diff --git a/docs/RbmSession.md b/docs/RbmSession.md new file mode 100644 index 00000000..595efbc2 --- /dev/null +++ b/docs/RbmSession.md @@ -0,0 +1,26 @@ +# Bandwidth::RbmSession + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **can_initiate** | **Boolean** | Whether the message can start an interactive session. `false` if the message is already part of an active session, or if the agent is not eligible for interactive session billing. | | +| **id** | **String** | The unique identifier of the interactive session the message is part of. This is not a message ID. Omitted if the message is not part of a session. | [optional] | +| **type** | **String** | The type of the interactive session. Only present on `session-started` callbacks. | [optional] | +| **start_time** | **Time** | The time the 24-hour session window opened. Only present on `session-started` callbacks. | [optional] | +| **end_time** | **Time** | The time the 24-hour session window closes. Only present on `session-started` callbacks. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::RbmSession.new( + can_initiate: false, + id: 0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d, + type: INTERACTIVE_SESSION, + start_time: 2026-08-06T09:59:55Z, + end_time: 2026-08-07T09:59:55Z +) +``` + diff --git a/docs/RbmSuggestionResponse.md b/docs/RbmSuggestionResponse.md index 26993828..443e2905 100644 --- a/docs/RbmSuggestionResponse.md +++ b/docs/RbmSuggestionResponse.md @@ -4,8 +4,8 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **text** | **String** | The text associated with the suggestion response. | [optional] | -| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | [optional] | +| **text** | **String** | The text of the suggestion the user tapped. | [optional] | +| **postback_data** | **String** | Payload the customer receives when the reply is clicked. | [optional] | | **paired_message_id** | **String** | Corresponding parent message ID (MT). | [optional] | ## Example @@ -14,8 +14,8 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmSuggestionResponse.new( - text: Yes, I would like to proceed, - postback_data: [B@11fa11b2, + text: Track my order, + postback_data: track-order-43654, paired_message_id: 1752697342534u24xerqdukke523x ) ``` diff --git a/docs/StatusCallbackMessage.md b/docs/StatusCallbackMessage.md index 8774826a..460ca2f5 100644 --- a/docs/StatusCallbackMessage.md +++ b/docs/StatusCallbackMessage.md @@ -17,6 +17,7 @@ | **media** | **Array<String>** | Optional media, not applicable for sms | [optional] | | **priority** | [**PriorityEnum**](PriorityEnum.md) | | [optional] | | **channel** | [**MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] | +| **session** | [**RbmSession**](RbmSession.md) | | [optional] | ## Example @@ -36,7 +37,8 @@ instance = Bandwidth::StatusCallbackMessage.new( tag: custom string, media: ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], priority: null, - channel: null + channel: null, + session: null ) ``` diff --git a/docs/TransferDisconnectCallback.md b/docs/TransferDisconnectCallback.md index dd08d105..88dab16f 100644 --- a/docs/TransferDisconnectCallback.md +++ b/docs/TransferDisconnectCallback.md @@ -24,6 +24,9 @@ | **cause** | **String** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional] | | **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] | +| **sip_response_code** | **Integer** | (optional) The SIP status code of the final response that rejected an outbound call's (or transferred leg's) INVITE (e.g. 486 for busy, 603 for decline). Present only when the call was rejected with a SIP response. | [optional] | +| **sip_status_line** | **String** | (optional) The full SIP status line, exactly as received, of the final response that rejected an outbound call's INVITE. The reason phrase can help distinguish outcomes that share a status code, such as `603 Network Blocked` and `603 Decline`. Present only when an outbound call was rejected with a SIP response. | [optional] | +| **sip_headers** | **Hash<String, String>** | (optional) Map of SIP headers, with lowercase keys (SIP headers are case-insensitive). On the Initiate callback, contains the customer-supplied X-* headers from the original INVITE; present only for inbound SIP URI calls with custom headers. On the Disconnect and Transfer Disconnect callbacks, contains a single `reason` key holding the raw, unmodified `Reason` header value from the final SIP response that rejected an outbound call (or transferred leg); present only when that response included a `Reason` header (for example, `v=analytics1` call-analytics block information from a terminating carrier). If the response carries more than one `Reason` header, all values are returned in the order received, separated by `, `. Note - on the Initiate callback, 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. The example shown is for the Initiate callback; on the Disconnect and Transfer Disconnect callbacks the only key is `reason`. | [optional] | ## Example @@ -50,7 +53,10 @@ instance = Bandwidth::TransferDisconnectCallback.new( transfer_to: +15555555555, 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 + error_id: 4642074b-7b58-478b-96e4-3a60955c6765, + sip_response_code: 486, + sip_status_line: SIP/2.0 603 Network Blocked, + sip_headers: {"x-custom-header":"customer-value","x-session-id":"sess-12345"} ) ``` diff --git a/lib/bandwidth-sdk.rb b/lib/bandwidth-sdk.rb index 9e1b1646..26dd16dc 100644 --- a/lib/bandwidth-sdk.rb +++ b/lib/bandwidth-sdk.rb @@ -164,6 +164,7 @@ require 'bandwidth-sdk/models/rbm_message_content_text' require 'bandwidth-sdk/models/rbm_message_media' require 'bandwidth-sdk/models/rbm_open_url_enum' +require 'bandwidth-sdk/models/rbm_session' require 'bandwidth-sdk/models/rbm_standalone_card' require 'bandwidth-sdk/models/rbm_suggestion_response' require 'bandwidth-sdk/models/rbm_web_view_enum' diff --git a/lib/bandwidth-sdk/models/callback.rb b/lib/bandwidth-sdk/models/callback.rb index cfb1be70..0bed9415 100644 --- a/lib/bandwidth-sdk/models/callback.rb +++ b/lib/bandwidth-sdk/models/callback.rb @@ -40,6 +40,7 @@ def openapi_discriminator_mapping :'message-sending' => :'StatusCallback', :'message-sent' => :'StatusCallback', :'requested-location-response' => :'InboundCallback', + :'session-started' => :'StatusCallback', :'suggestion-response' => :'InboundCallback' } end diff --git a/lib/bandwidth-sdk/models/disconnect_callback.rb b/lib/bandwidth-sdk/models/disconnect_callback.rb index c66d2991..8c76d305 100644 --- a/lib/bandwidth-sdk/models/disconnect_callback.rb +++ b/lib/bandwidth-sdk/models/disconnect_callback.rb @@ -69,9 +69,15 @@ class DisconnectCallback < ApiModelBase # (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. + # (optional) The SIP status code of the final response that rejected an outbound call's (or transferred leg's) INVITE (e.g. 486 for busy, 603 for decline). Present only when the call was rejected with a SIP response. attr_accessor :sip_response_code + # (optional) The full SIP status line, exactly as received, of the final response that rejected an outbound call's INVITE. The reason phrase can help distinguish outcomes that share a status code, such as `603 Network Blocked` and `603 Decline`. Present only when an outbound call was rejected with a SIP response. + attr_accessor :sip_status_line + + # (optional) Map of SIP headers, with lowercase keys (SIP headers are case-insensitive). On the Initiate callback, contains the customer-supplied X-* headers from the original INVITE; present only for inbound SIP URI calls with custom headers. On the Disconnect and Transfer Disconnect callbacks, contains a single `reason` key holding the raw, unmodified `Reason` header value from the final SIP response that rejected an outbound call (or transferred leg); present only when that response included a `Reason` header (for example, `v=analytics1` call-analytics block information from a terminating carrier). If the response carries more than one `Reason` header, all values are returned in the order received, separated by `, `. Note - on the Initiate callback, 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. The example shown is for the Initiate callback; on the Disconnect and Transfer Disconnect callbacks the only key is `reason`. + attr_accessor :sip_headers + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -115,7 +121,9 @@ def self.attribute_map :'error_id' => :'errorId', :'tag' => :'tag', :'sip_call_id' => :'sipCallId', - :'sip_response_code' => :'sipResponseCode' + :'sip_response_code' => :'sipResponseCode', + :'sip_status_line' => :'sipStatusLine', + :'sip_headers' => :'sipHeaders' } end @@ -150,7 +158,9 @@ def self.openapi_types :'error_id' => :'String', :'tag' => :'String', :'sip_call_id' => :'String', - :'sip_response_code' => :'Integer' + :'sip_response_code' => :'Integer', + :'sip_status_line' => :'String', + :'sip_headers' => :'Hash' } end @@ -256,6 +266,16 @@ def initialize(attributes = {}) if attributes.key?(:'sip_response_code') self.sip_response_code = attributes[:'sip_response_code'] end + + if attributes.key?(:'sip_status_line') + self.sip_status_line = attributes[:'sip_status_line'] + 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? @@ -296,7 +316,9 @@ def ==(o) error_id == o.error_id && tag == o.tag && sip_call_id == o.sip_call_id && - sip_response_code == o.sip_response_code + sip_response_code == o.sip_response_code && + sip_status_line == o.sip_status_line && + sip_headers == o.sip_headers end # @see the `==` method @@ -308,7 +330,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, sip_call_id, sip_response_code].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, sip_status_line, sip_headers].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/inbound_callback_message.rb b/lib/bandwidth-sdk/models/inbound_callback_message.rb index 9dae4746..f9db26b3 100644 --- a/lib/bandwidth-sdk/models/inbound_callback_message.rb +++ b/lib/bandwidth-sdk/models/inbound_callback_message.rb @@ -49,6 +49,8 @@ class InboundCallbackMessage < ApiModelBase attr_accessor :channel + attr_accessor :session + attr_accessor :content attr_accessor :suggestion_response @@ -93,6 +95,7 @@ def self.attribute_map :'media' => :'media', :'priority' => :'priority', :'channel' => :'channel', + :'session' => :'session', :'content' => :'content', :'suggestion_response' => :'suggestionResponse', :'location_response' => :'locationResponse' @@ -125,6 +128,7 @@ def self.openapi_types :'media' => :'Array', :'priority' => :'PriorityEnum', :'channel' => :'MultiChannelMessageChannelEnum', + :'session' => :'RbmSession', :'content' => :'MultiChannelMessageContent', :'suggestion_response' => :'RbmSuggestionResponse', :'location_response' => :'RbmLocationResponse' @@ -232,6 +236,10 @@ def initialize(attributes = {}) self.channel = attributes[:'channel'] end + if attributes.key?(:'session') + self.session = attributes[:'session'] + end + if attributes.key?(:'content') self.content = attributes[:'content'] end @@ -398,6 +406,7 @@ def ==(o) media == o.media && priority == o.priority && channel == o.channel && + session == o.session && content == o.content && suggestion_response == o.suggestion_response && location_response == o.location_response @@ -412,7 +421,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority, channel, content, suggestion_response, location_response].hash + [id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority, channel, session, content, suggestion_response, location_response].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 93b137f1..1ae91829 100644 --- a/lib/bandwidth-sdk/models/initiate_callback.rb +++ b/lib/bandwidth-sdk/models/initiate_callback.rb @@ -55,7 +55,7 @@ class InitiateCallback < ApiModelBase # (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. + # (optional) Map of SIP headers, with lowercase keys (SIP headers are case-insensitive). On the Initiate callback, contains the customer-supplied X-* headers from the original INVITE; present only for inbound SIP URI calls with custom headers. On the Disconnect and Transfer Disconnect callbacks, contains a single `reason` key holding the raw, unmodified `Reason` header value from the final SIP response that rejected an outbound call (or transferred leg); present only when that response included a `Reason` header (for example, `v=analytics1` call-analytics block information from a terminating carrier). If the response carries more than one `Reason` header, all values are returned in the order received, separated by `, `. Note - on the Initiate callback, 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. The example shown is for the Initiate callback; on the Disconnect and Transfer Disconnect callbacks the only key is `reason`. attr_accessor :sip_headers class EnumAttributeValidator diff --git a/lib/bandwidth-sdk/models/list_message_item.rb b/lib/bandwidth-sdk/models/list_message_item.rb index f97997d3..925c34ce 100644 --- a/lib/bandwidth-sdk/models/list_message_item.rb +++ b/lib/bandwidth-sdk/models/list_message_item.rb @@ -176,6 +176,7 @@ def self.openapi_nullable Set.new([ :'carrier_name', :'message_size', + :'message_length', :'attachment_count', :'recipient_count', :'campaign_class', diff --git a/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb b/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb index c9c17efd..377a00d9 100644 --- a/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb +++ b/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb @@ -20,7 +20,7 @@ class MultiChannelActionCalendarEvent < ApiModelBase # Displayed text for user to click attr_accessor :text - # Base64 payload the customer receives when the reply is clicked. + # Payload the customer receives when the reply is clicked. attr_accessor :postback_data # The title of the event. diff --git a/lib/bandwidth-sdk/models/rbm_action_base.rb b/lib/bandwidth-sdk/models/rbm_action_base.rb index b3f9f1cb..572ce45b 100644 --- a/lib/bandwidth-sdk/models/rbm_action_base.rb +++ b/lib/bandwidth-sdk/models/rbm_action_base.rb @@ -20,7 +20,7 @@ class RbmActionBase < ApiModelBase # Displayed text for user to click attr_accessor :text - # Base64 payload the customer receives when the reply is clicked. + # Payload the customer receives when the reply is clicked. attr_accessor :postback_data class EnumAttributeValidator diff --git a/lib/bandwidth-sdk/models/rbm_action_dial.rb b/lib/bandwidth-sdk/models/rbm_action_dial.rb index c4f2d17e..a5444c0b 100644 --- a/lib/bandwidth-sdk/models/rbm_action_dial.rb +++ b/lib/bandwidth-sdk/models/rbm_action_dial.rb @@ -20,7 +20,7 @@ class RbmActionDial < ApiModelBase # Displayed text for user to click attr_accessor :text - # Base64 payload the customer receives when the reply is clicked. + # Payload the customer receives when the reply is clicked. attr_accessor :postback_data # The phone number to dial. Must be E164 format. diff --git a/lib/bandwidth-sdk/models/rbm_action_open_url.rb b/lib/bandwidth-sdk/models/rbm_action_open_url.rb index 1a399248..4d1b2a83 100644 --- a/lib/bandwidth-sdk/models/rbm_action_open_url.rb +++ b/lib/bandwidth-sdk/models/rbm_action_open_url.rb @@ -20,7 +20,7 @@ class RbmActionOpenUrl < ApiModelBase # Displayed text for user to click attr_accessor :text - # Base64 payload the customer receives when the reply is clicked. + # Payload the customer receives when the reply is clicked. attr_accessor :postback_data # The URL to open in browser. Must use http:// or https:// scheme. diff --git a/lib/bandwidth-sdk/models/rbm_action_view_location.rb b/lib/bandwidth-sdk/models/rbm_action_view_location.rb index e89e9296..ef3a10fa 100644 --- a/lib/bandwidth-sdk/models/rbm_action_view_location.rb +++ b/lib/bandwidth-sdk/models/rbm_action_view_location.rb @@ -20,7 +20,7 @@ class RbmActionViewLocation < ApiModelBase # Displayed text for user to click attr_accessor :text - # Base64 payload the customer receives when the reply is clicked. + # Payload the customer receives when the reply is clicked. attr_accessor :postback_data # The latitude of the location. Must be in range [-90.000000, 90.000000]. diff --git a/lib/bandwidth-sdk/models/rbm_session.rb b/lib/bandwidth-sdk/models/rbm_session.rb new file mode 100644 index 00000000..5052f8ee --- /dev/null +++ b/lib/bandwidth-sdk/models/rbm_session.rb @@ -0,0 +1,208 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.24.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + # RCS interactive session information for the message. An interactive session is a 24-hour window covering all Rich and Rich Media messages exchanged between an RCS agent and a specific end user mobile number. It is triggered when at least 4 messages are exchanged within 24 hours, at least 2 of them mobile-originated and at least 1 mobile-terminated. Only present on `message-delivered`, `message-received` and `session-started` callbacks for RBM messages of US agents with the Conversational billing category. Omitted for all other messages. + class RbmSession < ApiModelBase + # Whether the message can start an interactive session. `false` if the message is already part of an active session, or if the agent is not eligible for interactive session billing. + attr_accessor :can_initiate + + # The unique identifier of the interactive session the message is part of. This is not a message ID. Omitted if the message is not part of a session. + attr_accessor :id + + # The type of the interactive session. Only present on `session-started` callbacks. + attr_accessor :type + + # The time the 24-hour session window opened. Only present on `session-started` callbacks. + attr_accessor :start_time + + # The time the 24-hour session window closes. Only present on `session-started` callbacks. + attr_accessor :end_time + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'can_initiate' => :'canInitiate', + :'id' => :'id', + :'type' => :'type', + :'start_time' => :'startTime', + :'end_time' => :'endTime' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'can_initiate' => :'Boolean', + :'id' => :'String', + :'type' => :'String', + :'start_time' => :'Time', + :'end_time' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'id', + :'type', + :'start_time', + :'end_time' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmSession` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmSession`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'can_initiate') + self.can_initiate = attributes[:'can_initiate'] + else + self.can_initiate = nil + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @can_initiate.nil? + invalid_properties.push('invalid value for "can_initiate", can_initiate cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @can_initiate.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] can_initiate Value to be assigned + def can_initiate=(can_initiate) + if can_initiate.nil? + fail ArgumentError, 'can_initiate cannot be nil' + end + + @can_initiate = can_initiate + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + can_initiate == o.can_initiate && + id == o.id && + type == o.type && + start_time == o.start_time && + end_time == o.end_time + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [can_initiate, id, type, start_time, end_time].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end +end diff --git a/lib/bandwidth-sdk/models/rbm_suggestion_response.rb b/lib/bandwidth-sdk/models/rbm_suggestion_response.rb index 6a7613c8..3f29e634 100644 --- a/lib/bandwidth-sdk/models/rbm_suggestion_response.rb +++ b/lib/bandwidth-sdk/models/rbm_suggestion_response.rb @@ -15,10 +15,10 @@ module Bandwidth class RbmSuggestionResponse < ApiModelBase - # The text associated with the suggestion response. + # The text of the suggestion the user tapped. attr_accessor :text - # Base64 payload the customer receives when the reply is clicked. + # Payload the customer receives when the reply is clicked. attr_accessor :postback_data # Corresponding parent message ID (MT). diff --git a/lib/bandwidth-sdk/models/status_callback_message.rb b/lib/bandwidth-sdk/models/status_callback_message.rb index ddb75228..2ebb3d91 100644 --- a/lib/bandwidth-sdk/models/status_callback_message.rb +++ b/lib/bandwidth-sdk/models/status_callback_message.rb @@ -50,6 +50,8 @@ class StatusCallbackMessage < ApiModelBase attr_accessor :channel + attr_accessor :session + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -87,7 +89,8 @@ def self.attribute_map :'tag' => :'tag', :'media' => :'media', :'priority' => :'priority', - :'channel' => :'channel' + :'channel' => :'channel', + :'session' => :'session' } end @@ -116,7 +119,8 @@ def self.openapi_types :'tag' => :'String', :'media' => :'Array', :'priority' => :'PriorityEnum', - :'channel' => :'MultiChannelMessageChannelEnum' + :'channel' => :'MultiChannelMessageChannelEnum', + :'session' => :'RbmSession' } end @@ -213,6 +217,10 @@ def initialize(attributes = {}) if attributes.key?(:'channel') self.channel = attributes[:'channel'] end + + if attributes.key?(:'session') + self.session = attributes[:'session'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -367,7 +375,8 @@ def ==(o) tag == o.tag && media == o.media && priority == o.priority && - channel == o.channel + channel == o.channel && + session == o.session end # @see the `==` method @@ -379,7 +388,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority, channel].hash + [id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority, channel, session].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/status_callback_type_enum.rb b/lib/bandwidth-sdk/models/status_callback_type_enum.rb index 39aab93a..98aa51b2 100644 --- a/lib/bandwidth-sdk/models/status_callback_type_enum.rb +++ b/lib/bandwidth-sdk/models/status_callback_type_enum.rb @@ -20,9 +20,10 @@ class StatusCallbackTypeEnum MESSAGE_DELIVERED = 'message-delivered'.freeze MESSAGE_FAILED = 'message-failed'.freeze MESSAGE_READ = 'message-read'.freeze + SESSION_STARTED = 'session-started'.freeze def self.all_vars - @all_vars ||= [MESSAGE_SENDING, MESSAGE_SENT, MESSAGE_DELIVERED, MESSAGE_FAILED, MESSAGE_READ].freeze + @all_vars ||= [MESSAGE_SENDING, MESSAGE_SENT, MESSAGE_DELIVERED, MESSAGE_FAILED, MESSAGE_READ, SESSION_STARTED].freeze end # Builds the enum from string diff --git a/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb b/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb index 12b24304..7af2cf7d 100644 --- a/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +++ b/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb @@ -75,6 +75,15 @@ class TransferDisconnectCallback < ApiModelBase # Bandwidth's internal id that references the error event. attr_accessor :error_id + # (optional) The SIP status code of the final response that rejected an outbound call's (or transferred leg's) INVITE (e.g. 486 for busy, 603 for decline). Present only when the call was rejected with a SIP response. + attr_accessor :sip_response_code + + # (optional) The full SIP status line, exactly as received, of the final response that rejected an outbound call's INVITE. The reason phrase can help distinguish outcomes that share a status code, such as `603 Network Blocked` and `603 Decline`. Present only when an outbound call was rejected with a SIP response. + attr_accessor :sip_status_line + + # (optional) Map of SIP headers, with lowercase keys (SIP headers are case-insensitive). On the Initiate callback, contains the customer-supplied X-* headers from the original INVITE; present only for inbound SIP URI calls with custom headers. On the Disconnect and Transfer Disconnect callbacks, contains a single `reason` key holding the raw, unmodified `Reason` header value from the final SIP response that rejected an outbound call (or transferred leg); present only when that response included a `Reason` header (for example, `v=analytics1` call-analytics block information from a terminating carrier). If the response carries more than one `Reason` header, all values are returned in the order received, separated by `, `. Note - on the Initiate callback, 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. The example shown is for the Initiate callback; on the Disconnect and Transfer Disconnect callbacks the only key is `reason`. + attr_accessor :sip_headers + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -119,7 +128,10 @@ def self.attribute_map :'transfer_to' => :'transferTo', :'cause' => :'cause', :'error_message' => :'errorMessage', - :'error_id' => :'errorId' + :'error_id' => :'errorId', + :'sip_response_code' => :'sipResponseCode', + :'sip_status_line' => :'sipStatusLine', + :'sip_headers' => :'sipHeaders' } end @@ -155,7 +167,10 @@ def self.openapi_types :'transfer_to' => :'String', :'cause' => :'String', :'error_message' => :'String', - :'error_id' => :'String' + :'error_id' => :'String', + :'sip_response_code' => :'Integer', + :'sip_status_line' => :'String', + :'sip_headers' => :'Hash' } end @@ -166,7 +181,7 @@ def self.openapi_nullable :'answer_time', :'tag', :'error_message', - :'error_id' + :'error_id', ]) end @@ -265,6 +280,20 @@ def initialize(attributes = {}) if attributes.key?(:'error_id') self.error_id = attributes[:'error_id'] end + + if attributes.key?(:'sip_response_code') + self.sip_response_code = attributes[:'sip_response_code'] + end + + if attributes.key?(:'sip_status_line') + self.sip_status_line = attributes[:'sip_status_line'] + 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? @@ -306,7 +335,10 @@ def ==(o) transfer_to == o.transfer_to && cause == o.cause && error_message == o.error_message && - error_id == o.error_id + error_id == o.error_id && + sip_response_code == o.sip_response_code && + sip_status_line == o.sip_status_line && + sip_headers == o.sip_headers end # @see the `==` method @@ -318,7 +350,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, parent_call_id, enqueued_time, start_time, answer_time, end_time, tag, transfer_caller_id, transfer_to, cause, error_message, error_id].hash + [event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, parent_call_id, enqueued_time, start_time, answer_time, end_time, tag, transfer_caller_id, transfer_to, cause, error_message, error_id, sip_response_code, sip_status_line, sip_headers].hash end # Builds the object from hash diff --git a/spec/unit/client/api_client_spec.rb b/spec/unit/client/api_client_spec.rb index 8856f068..8a672d15 100644 --- a/spec/unit/client/api_client_spec.rb +++ b/spec/unit/client/api_client_spec.rb @@ -12,199 +12,6 @@ let(:form_encoded_headers) { { 'Content-Type' => 'application/x-www-form-urlencoded' } } let(:error_data) { '{"error": true}' } - describe '#call_api' do - it 'calls api and returns a tempfile with name from content-disposition header' do - stub_request(:get, 'https://messaging.bandwidth.com/api/v2/path'). - to_return(status: 200, headers: media_headers, body: media_data) - - opts = { - operation: :"MediaApi.get_media", - header_params: {}, - query_params: {}, - form_params: {}, - body: nil, - auth_names: ['Basic'], - return_type: 'File' - } - data, status_code, headers = api_client.call_api(:GET, 'path', opts) - - expect(status_code).to eq(200) - expect(headers).to eq(media_headers) - expect(data).to be_a(Tempfile) - end - - it 'calls api and returns a tempfile' do - stub_request(:get, 'https://messaging.bandwidth.com/api/v2/path'). - to_return(status: 200, headers: named_media_headers, body: media_data) - - opts = { - operation: :"MediaApi.get_media", - header_params: {}, - query_params: {}, - form_params: {}, - body: nil, - auth_names: ['Basic'], - return_type: 'File' - } - data, status_code, headers = api_client.call_api(:GET, 'path', opts) - - expect(status_code).to eq(200) - expect(headers).to eq(named_media_headers) - expect(data).to be_a(Tempfile) - end - - it 'calls api and returns binary data' do - stub_request(:get, 'https://messaging.bandwidth.com/api/v2/path'). - to_return(status: 200, headers: media_headers, body: media_data) - - api_client.config.return_binary_data = true - api_client.config.debugging = true - - opts = { - operation: :"MediaApi.get_media", - header_params: {}, - query_params: {}, - form_params: {}, - body: nil, - auth_names: ['Basic'], - return_type: 'File' - } - data, status_code, headers = api_client.call_api(:GET, 'path', opts) - - expect(status_code).to eq(200) - expect(headers).to eq(media_headers) - expect(data).to eq(media_data) - end - - it 'calls api and returns a hash' do - stub_request(:get, 'https://messaging.bandwidth.com/api/v2/path'). - to_return(status: 200, headers: json_headers, body: '{"id": 1}') - - opts = { - operation: :"MessagesApi.list_messages", - header_params: {}, - query_params: {}, - form_params: {}, - body: nil, - auth_names: ['Basic'], - return_type: 'Hash' - } - data, status_code, headers = api_client.call_api(:GET, 'path', opts) - - expect(status_code).to eq(200) - expect(headers).to eq(json_headers) - expect(data).to eq({ id: 1 }) - end - - it 'posts data and returns nothing' do - stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path'). - to_return(status: 204) - - api_client.config.debugging = true - - opts = { - operation: :"MediaApi.upload_media", - header_params: {}, - query_params: {}, - form_params: {}, - body: { id: 1 }, - auth_names: ['Basic'], - return_type: nil - } - data, status_code = api_client.call_api(:POST, 'path', opts) - - expect(status_code).to eq(204) - expect(data).to be nil - end - - it 'posts multipart/form-data and returns nothing' do - stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path'). - to_return(status: 204) - - opts = { - operation: :"MediaApi.upload_media", - header_params: multipart_headers, - query_params: {}, - form_params: { file: Tempfile.new('filename'), array: [1, 2, 3], string: '123' }, - body: nil, - auth_names: ['Basic'], - return_type: nil - } - data, status_code = api_client.call_api(:POST, 'path', opts) - - expect(status_code).to eq(204) - expect(data).to be nil - end - - it 'calls api and handles HTTP error' do - stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path'). - to_return(status: 400, headers: json_headers, body: error_data) - - opts = { - operation: :"MediaApi.upload_media", - header_params: {}, - query_params: {}, - form_params: {}, - body: { id: 1 }, - auth_names: ['Basic'], - return_type: nil - } - - expect { - api_client.call_api(:POST, 'path', opts) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.code).to eq(400) - expect(e.response_headers).to eq(json_headers) - expect(e.response_body).to eq('{"error": true}') - } - end - - it 'calls api and handles timeout error' do - stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path'). - to_raise(Faraday::TimeoutError) - - opts = { - operation: :"MediaApi.upload_media", - header_params: {}, - query_params: {}, - form_params: {}, - body: { id: 1 }, - auth_names: ['Basic'], - return_type: nil - } - - expect { - api_client.call_api(:POST, 'path', opts) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.message).to eq('Connection timed out') - } - end - - it 'calls api and handles connection error' do - stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path'). - to_raise(Faraday::ConnectionFailed) - - opts = { - operation: :"MediaApi.upload_media", - header_params: {}, - query_params: {}, - form_params: {}, - body: { id: 1 }, - auth_names: ['Basic'], - return_type: nil - } - - expect { - api_client.call_api(:POST, 'path', opts) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.message).to eq('Connection failed') - } - end - end if false # not needed since the api unit tests cover this - describe '#build_request_body' do it 'builds application/x-www-form-urlencoded' do expect(api_client_default.build_request_body(form_encoded_headers, { id: 1 }, nil)).to eq('id=1') diff --git a/spec/unit/models/callback_spec.rb b/spec/unit/models/callback_spec.rb index d6a011bc..06dd9e71 100644 --- a/spec/unit/models/callback_spec.rb +++ b/spec/unit/models/callback_spec.rb @@ -25,6 +25,7 @@ :'message-sending' => :'StatusCallback', :'message-sent' => :'StatusCallback', :'requested-location-response' => :'InboundCallback', + :'session-started' => :'StatusCallback', :'suggestion-response' => :'InboundCallback' }) end diff --git a/spec/unit/models/disconnect_callback_spec.rb b/spec/unit/models/disconnect_callback_spec.rb index a39dd66a..827ba188 100644 --- a/spec/unit/models/disconnect_callback_spec.rb +++ b/spec/unit/models/disconnect_callback_spec.rb @@ -21,6 +21,8 @@ tag: 'custom tag', sip_call_id: 'sip-call-id-12345', sip_response_code: '486', + sip_status_line: 'SIP/2.0 486 Busy Here', + sip_headers: { 'reason' => 'v=analytics1' } }) } describe '#initialize' do @@ -77,6 +79,8 @@ tag: 'custom tag', sipCallId: 'sip-call-id-12345', sipResponseCode: 486, + sipStatusLine: 'SIP/2.0 486 Busy Here', + sipHeaders: { 'reason' => 'v=analytics1' } }) expect(disconnect_callback_from_hash).to be_instance_of(Bandwidth::DisconnectCallback) expect(disconnect_callback_from_hash.event_type).to eq('disconnect') @@ -98,12 +102,14 @@ 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) + expect(disconnect_callback_from_hash.sip_status_line).to eq('SIP/2.0 486 Busy Here') + expect(disconnect_callback_from_hash.sip_headers).to eq({ 'reason' => 'v=analytics1' }) 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', :sipCallId => 'sip-call-id-12345', :sipResponseCode => '486' }.to_s) + 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', :sipStatusLine => 'SIP/2.0 486 Busy Here', :sipHeaders => { 'reason' => 'v=analytics1' } }.to_s) end end @@ -135,7 +141,9 @@ errorId: '4642074b-7b58-478b-96e4-3a60955c6765', tag: 'custom tag', sipCallId: 'sip-call-id-12345', - sipResponseCode: '486' + sipResponseCode: '486', + sipStatusLine: 'SIP/2.0 486 Busy Here', + sipHeaders: { 'reason' => 'v=analytics1' } }) end end diff --git a/spec/unit/models/inbound_callback_message_spec.rb b/spec/unit/models/inbound_callback_message_spec.rb index 669b1eed..0bba5877 100644 --- a/spec/unit/models/inbound_callback_message_spec.rb +++ b/spec/unit/models/inbound_callback_message_spec.rb @@ -23,7 +23,11 @@ tag: 'custom tag', media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'], priority: Bandwidth::PriorityEnum::DEFAULT, - channel: Bandwidth::MultiChannelMessageChannelEnum::SMS + channel: Bandwidth::MultiChannelMessageChannelEnum::RBM, + session: Bandwidth::RbmSession.new({ + can_initiate: false, + id: '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d' + }) }) } describe '#initialize' do @@ -67,7 +71,11 @@ tag: 'custom tag', media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'], priority: Bandwidth::PriorityEnum::DEFAULT, - channel: Bandwidth::MultiChannelMessageChannelEnum::SMS + channel: Bandwidth::MultiChannelMessageChannelEnum::RBM, + session: { + canInitiate: false, + id: '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d' + } }) expect(inbound_callback_message_from_hash).to be_instance_of(Bandwidth::InboundCallbackMessage) expect(inbound_callback_message_from_hash.id).to eq('1589228074636lm4k2je7j7jklbn2') @@ -82,13 +90,16 @@ expect(inbound_callback_message_from_hash.tag).to eq('custom tag') expect(inbound_callback_message_from_hash.media).to eq(['https://dev.bandwidth.com/images/bandwidth-logo.png']) expect(inbound_callback_message_from_hash.priority).to eq(Bandwidth::PriorityEnum::DEFAULT) - expect(inbound_callback_message_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::SMS) + expect(inbound_callback_message_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::RBM) + expect(inbound_callback_message_from_hash.session).to be_instance_of(Bandwidth::RbmSession) + expect(inbound_callback_message_from_hash.session.can_initiate).to be false + expect(inbound_callback_message_from_hash.session.id).to eq('0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d') end end describe '#to_s' do it 'returns a string representation of the object' do - expect(inbound_callback_message_values.to_s).to eq({ :id => '1589228074636lm4k2je7j7jklbn2', :owner => '+19195554321', :applicationId => '93de2206-9669-4e07-948d-329f4b722ee2', :time => '2022-06-16T13:15:07.160Z', :segmentCount => 2, :direction => 'in', :to => ['+19195551234'], :from => '+19195554321', :text => 'Hello world', :tag => 'custom tag', :media => ['https://dev.bandwidth.com/images/bandwidth-logo.png'], :priority => 'default', :channel => 'SMS' }.to_s) + expect(inbound_callback_message_values.to_s).to eq({ :id => '1589228074636lm4k2je7j7jklbn2', :owner => '+19195554321', :applicationId => '93de2206-9669-4e07-948d-329f4b722ee2', :time => '2022-06-16T13:15:07.160Z', :segmentCount => 2, :direction => 'in', :to => ['+19195551234'], :from => '+19195554321', :text => 'Hello world', :tag => 'custom tag', :media => ['https://dev.bandwidth.com/images/bandwidth-logo.png'], :priority => 'default', :channel => 'RBM', :session => { :canInitiate => false, :id => '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d' } }.to_s) end end @@ -124,7 +135,11 @@ tag: 'custom tag', media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'], priority: Bandwidth::PriorityEnum::DEFAULT, - channel: Bandwidth::MultiChannelMessageChannelEnum::SMS + channel: Bandwidth::MultiChannelMessageChannelEnum::RBM, + session: { + canInitiate: false, + id: '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d' + } }) end end diff --git a/spec/unit/models/list_message_item_spec.rb b/spec/unit/models/list_message_item_spec.rb index abc030e5..b11dfa0c 100644 --- a/spec/unit/models/list_message_item_spec.rb +++ b/spec/unit/models/list_message_item_spec.rb @@ -52,6 +52,7 @@ expect(Bandwidth::ListMessageItem.openapi_nullable).to eq(Set.new([ :'carrier_name', :'message_size', + :'message_length', :'attachment_count', :'recipient_count', :'campaign_class', diff --git a/spec/unit/models/rbm_session_spec.rb b/spec/unit/models/rbm_session_spec.rb new file mode 100644 index 00000000..f261db4e --- /dev/null +++ b/spec/unit/models/rbm_session_spec.rb @@ -0,0 +1,95 @@ +# Unit tests for Bandwidth::RbmSession +describe Bandwidth::RbmSession do + let(:rbm_session_default) { Bandwidth::RbmSession.new({ + can_initiate: true + }) } + let(:rbm_session_values) { Bandwidth::RbmSession.new({ + can_initiate: false, + id: '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d', + type: 'INTERACTIVE_SESSION', + start_time: '2026-08-06T09:59:55Z', + end_time: '2026-08-07T09:59:55Z' + }) } + + describe '#initialize' do + it 'causes an ArgumentError by passing an Array to the initialize method' do + expect { + Bandwidth::RbmSession.new([]) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do + expect { + Bandwidth::RbmSession.new({ invalid: true }) + }.to raise_error(ArgumentError) + end + end + + describe '#acceptable_attributes' do + it 'expects acceptable JSON attributes to be those in the attribute map' do + expect(Bandwidth::RbmSession.acceptable_attributes).to eq(Bandwidth::RbmSession.attribute_map.values) + end + end + + describe '#openapi_nullable' do + it 'expects nullable attributes to be the set of nullable fields' do + expect(Bandwidth::RbmSession.openapi_nullable).to eq(Set.new([ + :'id', + :'type', + :'start_time', + :'end_time' + ])) + end + end + + describe '#build_from_hash' do + it 'validates instance of RbmSession created by the build_from_hash method' do + rbm_session_from_hash = Bandwidth::RbmSession.build_from_hash({ + canInitiate: false, + id: '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d', + type: 'INTERACTIVE_SESSION', + startTime: '2026-08-06T09:59:55Z', + endTime: '2026-08-07T09:59:55Z' + }) + expect(rbm_session_from_hash).to be_instance_of(Bandwidth::RbmSession) + expect(rbm_session_from_hash.can_initiate).to be false + expect(rbm_session_from_hash.id).to eq('0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d') + expect(rbm_session_from_hash.type).to eq('INTERACTIVE_SESSION') + expect(rbm_session_from_hash.start_time).to eq(Time.parse('2026-08-06T09:59:55Z')) + expect(rbm_session_from_hash.end_time).to eq(Time.parse('2026-08-07T09:59:55Z')) + end + end + + describe '#to_s' do + it 'returns a string representation of the object' do + expect(rbm_session_values.to_s).to eq({ :canInitiate => false, :id => '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d', :type => 'INTERACTIVE_SESSION', :startTime => '2026-08-06T09:59:55Z', :endTime => '2026-08-07T09:59:55Z' }.to_s) + end + end + + describe '#eq? #==' do + it 'returns true/false when comparing objects' do + expect(rbm_session_default.eql?(Bandwidth::RbmSession.new({ can_initiate: true }))).to be true + expect(rbm_session_default.eql?(rbm_session_values)).to be false + end + end + + describe '#to_body #to_hash' do + it 'returns a hash representation of the object' do + expect(rbm_session_values.to_body).to eq({ + canInitiate: false, + id: '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d', + type: 'INTERACTIVE_SESSION', + startTime: '2026-08-06T09:59:55Z', + endTime: '2026-08-07T09:59:55Z' + }) + end + end + + describe 'custom attribute writers' do + it '#can_initiate=' do + expect { + rbm_session_values.can_initiate = nil + }.to raise_error(ArgumentError, 'can_initiate cannot be nil') + end + end +end diff --git a/spec/unit/models/status_callback_message_spec.rb b/spec/unit/models/status_callback_message_spec.rb index f0388f6f..74436eeb 100644 --- a/spec/unit/models/status_callback_message_spec.rb +++ b/spec/unit/models/status_callback_message_spec.rb @@ -23,7 +23,11 @@ tag: 'custom tag', media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'], priority: Bandwidth::PriorityEnum::DEFAULT, - channel: Bandwidth::MultiChannelMessageChannelEnum::SMS + channel: Bandwidth::MultiChannelMessageChannelEnum::RBM, + session: Bandwidth::RbmSession.new({ + can_initiate: false, + id: '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d' + }) }) } describe '#initialize' do @@ -67,7 +71,11 @@ tag: 'custom tag', media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'], priority: Bandwidth::PriorityEnum::DEFAULT, - channel: Bandwidth::MultiChannelMessageChannelEnum::SMS + channel: Bandwidth::MultiChannelMessageChannelEnum::RBM, + session: { + canInitiate: false, + id: '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d' + } }) expect(status_callback_message_from_hash).to be_instance_of(Bandwidth::StatusCallbackMessage) expect(status_callback_message_from_hash.id).to eq('1589228074636lm4k2je7j7jklbn2') @@ -82,13 +90,16 @@ expect(status_callback_message_from_hash.tag).to eq('custom tag') expect(status_callback_message_from_hash.media).to eq(['https://dev.bandwidth.com/images/bandwidth-logo.png']) expect(status_callback_message_from_hash.priority).to eq(Bandwidth::PriorityEnum::DEFAULT) - expect(status_callback_message_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::SMS) + expect(status_callback_message_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::RBM) + expect(status_callback_message_from_hash.session).to be_instance_of(Bandwidth::RbmSession) + expect(status_callback_message_from_hash.session.can_initiate).to be false + expect(status_callback_message_from_hash.session.id).to eq('0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d') end end describe '#to_s' do it 'returns a string representation of the object' do - expect(status_callback_message_values.to_s).to eq({ :id => '1589228074636lm4k2je7j7jklbn2', :owner => '+19195554321', :applicationId => '93de2206-9669-4e07-948d-329f4b722ee2', :time => '2022-06-16T13:15:07.160Z', :segmentCount => 2, :direction => 'out', :to => ['+19195551234'], :from => '+19195554321', :text => 'Hello world', :tag => 'custom tag', :media => ['https://dev.bandwidth.com/images/bandwidth-logo.png'], :priority => 'default', :channel => 'SMS' }.to_s) + expect(status_callback_message_values.to_s).to eq({ :id => '1589228074636lm4k2je7j7jklbn2', :owner => '+19195554321', :applicationId => '93de2206-9669-4e07-948d-329f4b722ee2', :time => '2022-06-16T13:15:07.160Z', :segmentCount => 2, :direction => 'out', :to => ['+19195551234'], :from => '+19195554321', :text => 'Hello world', :tag => 'custom tag', :media => ['https://dev.bandwidth.com/images/bandwidth-logo.png'], :priority => 'default', :channel => 'RBM', :session => { :canInitiate => false, :id => '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d' } }.to_s) end end @@ -124,7 +135,11 @@ tag: 'custom tag', media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'], priority: Bandwidth::PriorityEnum::DEFAULT, - channel: Bandwidth::MultiChannelMessageChannelEnum::SMS + channel: Bandwidth::MultiChannelMessageChannelEnum::RBM, + session: { + canInitiate: false, + id: '0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d' + } }) end end diff --git a/spec/unit/models/status_callback_type_enum_spec.rb b/spec/unit/models/status_callback_type_enum_spec.rb index fb599e39..765fc222 100644 --- a/spec/unit/models/status_callback_type_enum_spec.rb +++ b/spec/unit/models/status_callback_type_enum_spec.rb @@ -20,6 +20,10 @@ it 'defines MESSAGE_READ' do expect(Bandwidth::StatusCallbackTypeEnum::MESSAGE_READ).to eq('message-read') end + + it 'defines SESSION_STARTED' do + expect(Bandwidth::StatusCallbackTypeEnum::SESSION_STARTED).to eq('session-started') + end end describe '.all_vars' do @@ -29,7 +33,8 @@ 'message-sent', 'message-delivered', 'message-failed', - 'message-read' + 'message-read', + 'session-started' ]) end end @@ -41,6 +46,7 @@ expect(Bandwidth::StatusCallbackTypeEnum.build_from_hash('message-delivered')).to eq('message-delivered') expect(Bandwidth::StatusCallbackTypeEnum.build_from_hash('message-failed')).to eq('message-failed') expect(Bandwidth::StatusCallbackTypeEnum.build_from_hash('message-read')).to eq('message-read') + expect(Bandwidth::StatusCallbackTypeEnum.build_from_hash('session-started')).to eq('session-started') end it 'raises an error for an invalid enum value' do diff --git a/spec/unit/models/transfer_disconnect_callback_spec.rb b/spec/unit/models/transfer_disconnect_callback_spec.rb index 6643e9e3..49529184 100644 --- a/spec/unit/models/transfer_disconnect_callback_spec.rb +++ b/spec/unit/models/transfer_disconnect_callback_spec.rb @@ -21,7 +21,10 @@ transfer_to: '+19195551234', cause: 'hangup', error_message: 'call rejected', - error_id: '4642074b-7b58-478b-96e4-3a60955c6765' + error_id: '4642074b-7b58-478b-96e4-3a60955c6765', + sip_response_code: 486, + sip_status_line: 'SIP/2.0 486 Busy Here', + sip_headers: { 'reason' => 'v=analytics1' } }) } describe '#initialize' do @@ -78,7 +81,10 @@ transferTo: '+19195551234', cause: 'hangup', errorMessage: 'call rejected', - errorId: '4642074b-7b58-478b-96e4-3a60955c6765' + errorId: '4642074b-7b58-478b-96e4-3a60955c6765', + sipResponseCode: 486, + sipStatusLine: 'SIP/2.0 486 Busy Here', + sipHeaders: { 'reason' => 'v=analytics1' } }) expect(transfer_disconnect_callback_from_hash).to be_instance_of(Bandwidth::TransferDisconnectCallback) expect(transfer_disconnect_callback_from_hash.event_type).to eq('transferDisconnect') @@ -101,12 +107,15 @@ expect(transfer_disconnect_callback_from_hash.cause).to eq('hangup') expect(transfer_disconnect_callback_from_hash.error_message).to eq('call rejected') expect(transfer_disconnect_callback_from_hash.error_id).to eq('4642074b-7b58-478b-96e4-3a60955c6765') + expect(transfer_disconnect_callback_from_hash.sip_response_code).to eq(486) + expect(transfer_disconnect_callback_from_hash.sip_status_line).to eq('SIP/2.0 486 Busy Here') + expect(transfer_disconnect_callback_from_hash.sip_headers).to eq({ 'reason' => 'v=analytics1' }) end end describe '#to_s' do it 'returns a string representation of the object' do - expect(transfer_disconnect_callback_values.to_s).to eq({ :eventType => 'transferDisconnect', :eventTime => '2022-06-16T13:15:07.160Z', :accountId => '9900000', :applicationId => '04e88489-df02-4e34-a0ee-27a91849555f', :from => '+19195554321', :to => '+19195551234', :direction => 'outbound', :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', :parentCallId => 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99', :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', :tag => 'custom tag', :transferCallerId => '+19195554321', :transferTo => '+19195551234', :cause => 'hangup', :errorMessage => 'call rejected', :errorId => '4642074b-7b58-478b-96e4-3a60955c6765' }.to_s) + expect(transfer_disconnect_callback_values.to_s).to eq({ :eventType => 'transferDisconnect', :eventTime => '2022-06-16T13:15:07.160Z', :accountId => '9900000', :applicationId => '04e88489-df02-4e34-a0ee-27a91849555f', :from => '+19195554321', :to => '+19195551234', :direction => 'outbound', :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', :parentCallId => 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99', :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', :tag => 'custom tag', :transferCallerId => '+19195554321', :transferTo => '+19195551234', :cause => 'hangup', :errorMessage => 'call rejected', :errorId => '4642074b-7b58-478b-96e4-3a60955c6765', :sipResponseCode => 486, :sipStatusLine => 'SIP/2.0 486 Busy Here', :sipHeaders => { 'reason' => 'v=analytics1' } }.to_s) end end @@ -139,7 +148,10 @@ transferTo: '+19195551234', cause: 'hangup', errorMessage: 'call rejected', - errorId: '4642074b-7b58-478b-96e4-3a60955c6765' + errorId: '4642074b-7b58-478b-96e4-3a60955c6765', + sipResponseCode: 486, + sipStatusLine: 'SIP/2.0 486 Busy Here', + sipHeaders: { 'reason' => 'v=analytics1' } }) end end