Skip to content

Commit ba8d157

Browse files
band-swi-release-engineering[bot]DX-Bandwidthckoegel
authored
SWI-11839 Update SDK Based on Recent Spec Changes (#305)
* Generate SDK with OpenAPI Generator Version * unit tests --------- Co-authored-by: DX-Bandwidth <dx@bandwidth.com> Co-authored-by: ckoegel <ckoegel1006@gmail.com>
1 parent af0ac20 commit ba8d157

10 files changed

Lines changed: 79 additions & 10 deletions

bandwidth.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4568,6 +4568,8 @@ components:
45684568
$ref: '#/components/schemas/tag1'
45694569
machineDetectionResult:
45704570
$ref: '#/components/schemas/machineDetectionResult'
4571+
sipCallId:
4572+
$ref: '#/components/schemas/sipCallId'
45714573
bridgeCompleteCallback:
45724574
type: object
45734575
description: >-
@@ -4832,6 +4834,10 @@ components:
48324834
$ref: '#/components/schemas/errorId'
48334835
tag:
48344836
$ref: '#/components/schemas/tag1'
4837+
sipCallId:
4838+
$ref: '#/components/schemas/sipCallId'
4839+
sipResponseCode:
4840+
$ref: '#/components/schemas/sipResponseCode'
48354841
dtmfCallback:
48364842
type: object
48374843
description: >-
@@ -4948,6 +4954,10 @@ components:
49484954
$ref: '#/components/schemas/stirShaken'
49494955
uui:
49504956
$ref: '#/components/schemas/uui'
4957+
sipCallId:
4958+
$ref: '#/components/schemas/sipCallId'
4959+
sipHeaders:
4960+
$ref: '#/components/schemas/sipHeaders'
49514961
machineDetectionCompleteCallback:
49524962
type: object
49534963
description: >-
@@ -5595,6 +5605,36 @@ components:
55955605
value, including the encoding specifier, may not exceed 256 characters.
55965606
example: bXktdXVp
55975607
maxLength: 256
5608+
sipCallId:
5609+
type: string
5610+
description: >-
5611+
(optional) The SIP Call-ID of the call's current SIP dialog with
5612+
Bandwidth's SBC. Used to correlate dialogs and trace calls. Present on
5613+
any call, inbound or outbound, once that dialog has been established;
5614+
may be absent very early in a call before the dialog exists.
5615+
example: c95ac8d6e1a31c52eb38f419893c151633ec68f8d@sbc.bandwidth.com
5616+
sipHeaders:
5617+
type: object
5618+
additionalProperties:
5619+
type: string
5620+
description: >-
5621+
(optional) Map of customer-supplied X-* headers from the original
5622+
INVITE. Keys are lowercase (SIP headers are case-insensitive). Present
5623+
only for inbound SIP URI calls with custom headers. Note - keys preserve
5624+
the original SIP header name in lowercase rather than Bandwidth's usual
5625+
camelCase JSON convention, since these are passthrough values from the
5626+
caller's SIP INVITE, not Bandwidth-defined fields. If the same header
5627+
name is sent more than once in the INVITE, only the last value is kept.
5628+
example:
5629+
x-custom-header: customer-value
5630+
x-session-id: sess-12345
5631+
sipResponseCode:
5632+
type: integer
5633+
description: >-
5634+
(optional) The SIP status code returned by Bandwidth's SBC when it
5635+
rejected an outbound call's INVITE (e.g. 486 for busy, 603 for decline).
5636+
Present only when an outbound call was rejected by the SBC.
5637+
example: 486
55985638
codeRequest:
55995639
type: object
56005640
properties:

bandwidth/models/answer_callback.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ class AnswerCallback(BaseModel):
4444
answer_time: Optional[datetime] = Field(default=None, description="Time the call was answered, in ISO 8601 format.", alias="answerTime")
4545
tag: Optional[StrictStr] = Field(default=None, description="(optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.")
4646
machine_detection_result: Optional[MachineDetectionResult] = Field(default=None, alias="machineDetectionResult")
47+
sip_call_id: Optional[StrictStr] = Field(default=None, 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.", alias="sipCallId")
4748
additional_properties: Dict[str, Any] = {}
48-
__properties: ClassVar[List[str]] = ["eventType", "eventTime", "accountId", "applicationId", "from", "to", "direction", "callId", "callUrl", "enqueuedTime", "startTime", "answerTime", "tag", "machineDetectionResult"]
49+
__properties: ClassVar[List[str]] = ["eventType", "eventTime", "accountId", "applicationId", "from", "to", "direction", "callId", "callUrl", "enqueuedTime", "startTime", "answerTime", "tag", "machineDetectionResult", "sipCallId"]
4950

5051
model_config = ConfigDict(
5152
populate_by_name=True,
@@ -141,7 +142,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
141142
"startTime": obj.get("startTime"),
142143
"answerTime": obj.get("answerTime"),
143144
"tag": obj.get("tag"),
144-
"machineDetectionResult": MachineDetectionResult.from_dict(obj["machineDetectionResult"]) if obj.get("machineDetectionResult") is not None else None
145+
"machineDetectionResult": MachineDetectionResult.from_dict(obj["machineDetectionResult"]) if obj.get("machineDetectionResult") is not None else None,
146+
"sipCallId": obj.get("sipCallId")
145147
})
146148
# store additional fields in additional_properties
147149
for _key in obj.keys():

bandwidth/models/disconnect_callback.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020

2121
from datetime import datetime
22-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
2323
from typing import Any, ClassVar, Dict, List, Optional
2424
from bandwidth.models.call_direction_enum import CallDirectionEnum
2525
from typing import Optional, Set
@@ -46,8 +46,10 @@ class DisconnectCallback(BaseModel):
4646
error_message: Optional[StrictStr] = Field(default=None, description="Text explaining the reason that caused the call to fail in case of errors.", alias="errorMessage")
4747
error_id: Optional[StrictStr] = Field(default=None, description="Bandwidth's internal id that references the error event.", alias="errorId")
4848
tag: Optional[StrictStr] = Field(default=None, description="(optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.")
49+
sip_call_id: Optional[StrictStr] = Field(default=None, 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.", alias="sipCallId")
50+
sip_response_code: Optional[StrictInt] = Field(default=None, 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.", alias="sipResponseCode")
4951
additional_properties: Dict[str, Any] = {}
50-
__properties: ClassVar[List[str]] = ["eventType", "eventTime", "accountId", "applicationId", "from", "to", "callId", "direction", "callUrl", "enqueuedTime", "startTime", "answerTime", "endTime", "cause", "errorMessage", "errorId", "tag"]
52+
__properties: ClassVar[List[str]] = ["eventType", "eventTime", "accountId", "applicationId", "from", "to", "callId", "direction", "callUrl", "enqueuedTime", "startTime", "answerTime", "endTime", "cause", "errorMessage", "errorId", "tag", "sipCallId", "sipResponseCode"]
5153

5254
model_config = ConfigDict(
5355
populate_by_name=True,
@@ -148,7 +150,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
148150
"cause": obj.get("cause"),
149151
"errorMessage": obj.get("errorMessage"),
150152
"errorId": obj.get("errorId"),
151-
"tag": obj.get("tag")
153+
"tag": obj.get("tag"),
154+
"sipCallId": obj.get("sipCallId"),
155+
"sipResponseCode": obj.get("sipResponseCode")
152156
})
153157
# store additional fields in additional_properties
154158
for _key in obj.keys():

bandwidth/models/initiate_callback.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ class InitiateCallback(BaseModel):
4545
diversion: Optional[Diversion] = None
4646
stir_shaken: Optional[StirShaken] = Field(default=None, alias="stirShaken")
4747
uui: Optional[Annotated[str, Field(strict=True, max_length=256)]] = Field(default=None, description="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.")
48+
sip_call_id: Optional[StrictStr] = Field(default=None, 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.", alias="sipCallId")
49+
sip_headers: Optional[Dict[str, StrictStr]] = Field(default=None, 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.", alias="sipHeaders")
4850
additional_properties: Dict[str, Any] = {}
49-
__properties: ClassVar[List[str]] = ["eventType", "eventTime", "accountId", "applicationId", "from", "to", "direction", "callId", "callUrl", "startTime", "diversion", "stirShaken", "uui"]
51+
__properties: ClassVar[List[str]] = ["eventType", "eventTime", "accountId", "applicationId", "from", "to", "direction", "callId", "callUrl", "startTime", "diversion", "stirShaken", "uui", "sipCallId", "sipHeaders"]
5052

5153
model_config = ConfigDict(
5254
populate_by_name=True,
@@ -124,7 +126,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
124126
"startTime": obj.get("startTime"),
125127
"diversion": Diversion.from_dict(obj["diversion"]) if obj.get("diversion") is not None else None,
126128
"stirShaken": StirShaken.from_dict(obj["stirShaken"]) if obj.get("stirShaken") is not None else None,
127-
"uui": obj.get("uui")
129+
"uui": obj.get("uui"),
130+
"sipCallId": obj.get("sipCallId"),
131+
"sipHeaders": obj.get("sipHeaders")
128132
})
129133
# store additional fields in additional_properties
130134
for _key in obj.keys():

docs/AnswerCallback.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Name | Type | Description | Notes
2020
**answer_time** | **datetime** | Time the call was answered, in ISO 8601 format. | [optional]
2121
**tag** | **str** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
2222
**machine_detection_result** | [**MachineDetectionResult**](MachineDetectionResult.md) | | [optional]
23+
**sip_call_id** | **str** | (optional) The SIP Call-ID of the call&#39;s current SIP dialog with Bandwidth&#39;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]
2324

2425
## Example
2526

docs/DisconnectCallback.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Name | Type | Description | Notes
2323
**error_message** | **str** | Text explaining the reason that caused the call to fail in case of errors. | [optional]
2424
**error_id** | **str** | Bandwidth&#39;s internal id that references the error event. | [optional]
2525
**tag** | **str** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
26+
**sip_call_id** | **str** | (optional) The SIP Call-ID of the call&#39;s current SIP dialog with Bandwidth&#39;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]
27+
**sip_response_code** | **int** | (optional) The SIP status code returned by Bandwidth&#39;s SBC when it rejected an outbound call&#39;s INVITE (e.g. 486 for busy, 603 for decline). Present only when an outbound call was rejected by the SBC. | [optional]
2628

2729
## Example
2830

docs/InitiateCallback.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Name | Type | Description | Notes
1919
**diversion** | [**Diversion**](Diversion.md) | | [optional]
2020
**stir_shaken** | [**StirShaken**](StirShaken.md) | | [optional]
2121
**uui** | **str** | The value of the &#x60;User-To-User&#x60; header to send within the initial &#x60;INVITE&#x60;. Must include the encoding parameter as specified in RFC 7433. Only &#x60;base64&#x60;, &#x60;jwt&#x60; and &#x60;hex&#x60; encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters. | [optional]
22+
**sip_call_id** | **str** | (optional) The SIP Call-ID of the call&#39;s current SIP dialog with Bandwidth&#39;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]
23+
**sip_headers** | **Dict[str, str]** | (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&#39;s usual camelCase JSON convention, since these are passthrough values from the caller&#39;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]
2224

2325
## Example
2426

test/unit/models/test_answer_callback.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def make_instance(self, include_optional) -> AnswerCallback:
5050
tag = 'exampleTag',
5151
machine_detection_result = MachineDetectionResult(
5252
value = 'answering-machine',
53-
duration = 'PT4.9891287S', )
53+
duration = 'PT4.9891287S', ),
54+
sip_call_id = 'sipCallIdExample'
5455
)
5556
else:
5657
return AnswerCallback(
@@ -77,6 +78,7 @@ def testAnswerCallback(self):
7778
assert isinstance(instance.machine_detection_result, MachineDetectionResult)
7879
assert instance.machine_detection_result.value == 'answering-machine'
7980
assert instance.machine_detection_result.duration == 'PT4.9891287S'
81+
assert instance.sip_call_id == 'sipCallIdExample'
8082

8183

8284
if __name__ == '__main__':

test/unit/models/test_disconnect_callback.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def make_instance(self, include_optional) -> DisconnectCallback:
5050
cause = 'busy',
5151
error_message = 'Call c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f is already bridged with another call',
5252
error_id = '4642074b-7b58-478b-96e4-3a60955c6765',
53-
tag = 'exampleTag'
53+
tag = 'exampleTag',
54+
sip_call_id = 'sipCallIdExample',
55+
sip_response_code = 200
5456
)
5557
else:
5658
return DisconnectCallback(
@@ -78,6 +80,8 @@ def testDisconnectCallback(self):
7880
assert instance.error_message == 'Call c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f is already bridged with another call'
7981
assert instance.error_id == '4642074b-7b58-478b-96e4-3a60955c6765'
8082
assert instance.tag == 'exampleTag'
83+
assert instance.sip_call_id == 'sipCallIdExample'
84+
assert instance.sip_response_code == 200
8185

8286
if __name__ == '__main__':
8387
unittest.main()

test/unit/models/test_initiate_callback.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ def make_instance(self, include_optional) -> InitiateCallback:
5858
verstat = 'Tn-Verification-Passed',
5959
attestation_indicator = 'A',
6060
originating_id = '99759086-1335-11ed-9bcf-5f7d464e91af', ),
61-
uui='bXktdXVp'
61+
uui='bXktdXVp',
62+
sip_call_id = 'sipCallIdExample',
63+
sip_headers = {
64+
'X-Example-Header': 'ExampleValue'
65+
}
6266
)
6367
else:
6468
return InitiateCallback(
@@ -92,6 +96,10 @@ def testInitiateCallback(self):
9296
assert instance.stir_shaken.attestation_indicator == 'A'
9397
assert instance.stir_shaken.originating_id == '99759086-1335-11ed-9bcf-5f7d464e91af'
9498
assert instance.uui == 'bXktdXVp'
99+
assert instance.sip_call_id == 'sipCallIdExample'
100+
assert instance.sip_headers == {
101+
'X-Example-Header': 'ExampleValue'
102+
}
95103

96104
if __name__ == '__main__':
97105
unittest.main()

0 commit comments

Comments
 (0)