Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ bandwidth/models/additional_denial_reason.py
bandwidth/models/address.py
bandwidth/models/answer_callback.py
bandwidth/models/async_lookup_request.py
bandwidth/models/attestation_level_enum.py
bandwidth/models/blocked_webhook.py
bandwidth/models/bridge_complete_callback.py
bandwidth/models/bridge_target_complete_callback.py
Expand Down Expand Up @@ -229,6 +230,7 @@ docs/AdditionalDenialReason.md
docs/Address.md
docs/AnswerCallback.md
docs/AsyncLookupRequest.md
docs/AttestationLevelEnum.md
docs/BlockedWebhook.md
docs/BridgeCompleteCallback.md
docs/BridgeTargetCompleteCallback.md
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Class | Method | HTTP request | Description
- [Address](docs/Address.md)
- [AnswerCallback](docs/AnswerCallback.md)
- [AsyncLookupRequest](docs/AsyncLookupRequest.md)
- [AttestationLevelEnum](docs/AttestationLevelEnum.md)
- [BlockedWebhook](docs/BlockedWebhook.md)
- [BridgeCompleteCallback](docs/BridgeCompleteCallback.md)
- [BridgeTargetCompleteCallback](docs/BridgeTargetCompleteCallback.md)
Expand Down
70 changes: 70 additions & 0 deletions bandwidth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3241,6 +3241,16 @@ components:
- direction
- to
- from
attestationLevelEnum:
type: string
enum:
- A
- B
- C
description: >-
The STIR/SHAKEN attestation level Bandwidth signs the call with: `A`
(full), `B` (partial), or `C` (gateway).
example: B
callbackMethodEnum:
type: string
nullable: true
Expand Down Expand Up @@ -3419,6 +3429,52 @@ components:
entire value

cannot exceed 350 characters, including parameters and separators.
requestedAttestationLevel:
nullable: true
allOf:
- $ref: '#/components/schemas/attestationLevelEnum'
description: >-
The STIR/SHAKEN attestation level (`A`, `B`, or `C`) you request
Bandwidth sign this call with.

Applies to outbound calls to US destinations only, and only to
accounts that use the

<a href='/docs/voice/stir-shaken/hosted-signing-service'>Hosted
Signing Service</a>; it is ignored

for all other accounts. If omitted, the attestation policy
configured on your account is used.


Cannot be combined with `identity`. A request that includes both is
rejected with a `400`, as is

any value other than `A`, `B`, or `C`.
identity:
nullable: true
type: string
minLength: 1
maxLength: 2000
pattern: ^ *[A-Za-z0-9\-_.+/=;:<>"][A-Za-z0-9\-_.+/=;:<>" ]*$
description: >-
A complete SIP `Identity` header value that you signed yourself. It
must be a valid STIR/SHAKEN

PASSporT and may not exceed 2000 characters. Bandwidth sends it
unmodified on the outbound call and

does not sign the call. Bandwidth checks only the format and size of
the value, not the signature.

Applies to outbound calls to US destinations only.


Cannot be combined with `requestedAttestationLevel`. A request that
includes both, or a value that is too long

or not in the expected format, is rejected with a `400`.
example: eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cHM6Ly9jZXJ0LmV4YW1wbGUvY2VydC5wZW0ifQ.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxOTE5NTU1MTIzNCJdfSwiaWF0IjoxNzAwMDAwMDAwLCJvcmlnIjp7InRuIjoiMTU1NTU1NTEyMTIifSwib3JpZ2lkIjoiMTIzNCJ9.c2lnbmF0dXJl;info=<https://cert.example/cert.pem>;alg=ES256;ppt="shaken"
applicationId:
type: string
description: The id of the application associated with the `from` number.
Expand Down Expand Up @@ -3688,6 +3744,20 @@ components:
type: integer
example: 5
description: The priority of this call over other calls from your account.
requestedAttestationLevel:
nullable: true
allOf:
- $ref: '#/components/schemas/attestationLevelEnum'
description: >-
The `requestedAttestationLevel` provided in the Create Call request,
if any. This is the level you requested,

which can differ from the level the call is ultimately signed with.
identity:
nullable: true
type: string
description: The `identity` value provided in the Create Call request, if any.
example: eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cHM6Ly9jZXJ0LmV4YW1wbGUvY2VydC5wZW0ifQ.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxOTE5NTU1MTIzNCJdfSwiaWF0IjoxNzAwMDAwMDAwLCJvcmlnIjp7InRuIjoiMTU1NTU1NTEyMTIifSwib3JpZ2lkIjoiMTIzNCJ9.c2lnbmF0dXJl;info=<https://cert.example/cert.pem>;alg=ES256;ppt="shaken"
callState:
type: object
properties:
Expand Down
2 changes: 2 additions & 0 deletions bandwidth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"Address",
"AnswerCallback",
"AsyncLookupRequest",
"AttestationLevelEnum",
"BlockedWebhook",
"BridgeCompleteCallback",
"BridgeTargetCompleteCallback",
Expand Down Expand Up @@ -275,6 +276,7 @@
from bandwidth.models.address import Address as Address
from bandwidth.models.answer_callback import AnswerCallback as AnswerCallback
from bandwidth.models.async_lookup_request import AsyncLookupRequest as AsyncLookupRequest
from bandwidth.models.attestation_level_enum import AttestationLevelEnum as AttestationLevelEnum
from bandwidth.models.blocked_webhook import BlockedWebhook as BlockedWebhook
from bandwidth.models.bridge_complete_callback import BridgeCompleteCallback as BridgeCompleteCallback
from bandwidth.models.bridge_target_complete_callback import BridgeTargetCompleteCallback as BridgeTargetCompleteCallback
Expand Down
1 change: 1 addition & 0 deletions bandwidth/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from bandwidth.models.address import Address
from bandwidth.models.answer_callback import AnswerCallback
from bandwidth.models.async_lookup_request import AsyncLookupRequest
from bandwidth.models.attestation_level_enum import AttestationLevelEnum
from bandwidth.models.blocked_webhook import BlockedWebhook
from bandwidth.models.bridge_complete_callback import BridgeCompleteCallback
from bandwidth.models.bridge_target_complete_callback import BridgeTargetCompleteCallback
Expand Down
39 changes: 39 additions & 0 deletions bandwidth/models/attestation_level_enum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding: utf-8

"""
Bandwidth

Bandwidth's Communication APIs

The version of the OpenAPI document: 1.0.0
Contact: letstalk@bandwidth.com
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501


from __future__ import annotations
import json
from enum import Enum
from typing_extensions import Self


class AttestationLevelEnum(str, Enum):
"""
The STIR/SHAKEN attestation level Bandwidth signs the call with: `A` (full), `B` (partial), or `C` (gateway).
"""

"""
allowed enum values
"""
A = 'A'
B = 'B'
C = 'C'

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of AttestationLevelEnum from a JSON string"""
return cls(json.loads(json_str))


29 changes: 27 additions & 2 deletions bandwidth/models/create_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing_extensions import Annotated
from bandwidth.models.attestation_level_enum import AttestationLevelEnum
from bandwidth.models.callback_method_enum import CallbackMethodEnum
from bandwidth.models.machine_detection_configuration import MachineDetectionConfiguration
from typing import Optional, Set
Expand All @@ -35,6 +36,8 @@ class CreateCall(BaseModel):
privacy: Optional[StrictBool] = Field(default=None, description="Hide the calling number. The `displayName` field can be used to customize the displayed name.")
display_name: Optional[Annotated[str, Field(strict=True, max_length=256)]] = Field(default=None, description="The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`.", alias="displayName")
uui: Optional[StrictStr] = Field(default=None, description="A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP URI. Each value must end with an 'encoding' parameter as described in <a href='https://tools.ietf.org/html/rfc7433'>RFC 7433</a>. Only 'jwt', 'base64' and 'hex' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators.")
requested_attestation_level: Optional[AttestationLevelEnum] = Field(default=None, description="The STIR/SHAKEN attestation level (`A`, `B`, or `C`) you request Bandwidth sign this call with. Applies to outbound calls to US destinations only, and only to accounts that use the <a href='/docs/voice/stir-shaken/hosted-signing-service'>Hosted Signing Service</a>; it is ignored for all other accounts. If omitted, the attestation policy configured on your account is used. Cannot be combined with `identity`. A request that includes both is rejected with a `400`, as is any value other than `A`, `B`, or `C`.", alias="requestedAttestationLevel")
identity: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=2000)]] = Field(default=None, description="A complete SIP `Identity` header value that you signed yourself. It must be a valid STIR/SHAKEN PASSporT and may not exceed 2000 characters. Bandwidth sends it unmodified on the outbound call and does not sign the call. Bandwidth checks only the format and size of the value, not the signature. Applies to outbound calls to US destinations only. Cannot be combined with `requestedAttestationLevel`. A request that includes both, or a value that is too long or not in the expected format, is rejected with a `400`.")
application_id: StrictStr = Field(description="The id of the application associated with the `from` number.", alias="applicationId")
answer_url: Annotated[str, Field(strict=True, max_length=2048)] = Field(description="The full URL to send the <a href='/docs/voice/webhooks/answer'>Answer</a> event to when the called party answers. This endpoint should return the first <a href='/docs/voice/bxml'>BXML document</a> to be executed in the call. Must use `https` if specifying `username` and `password`.", alias="answerUrl")
answer_method: Optional[CallbackMethodEnum] = Field(default=CallbackMethodEnum.POST, alias="answerMethod")
Expand All @@ -52,7 +55,17 @@ class CreateCall(BaseModel):
priority: Optional[Annotated[int, Field(le=5, strict=True, ge=1)]] = Field(default=5, description="The priority of this call over other calls from your account. For example, if during a call your application needs to place a new call and bridge it with the current call, you might want to create the call with priority 1 so that it will be the next call picked off your queue, ahead of other less time sensitive calls. A lower value means higher priority, so a priority 1 call takes precedence over a priority 2 call.")
tag: Optional[Annotated[str, Field(strict=True, max_length=4096)]] = Field(default=None, description="A custom string that will be sent with all webhooks for this call unless overwritten by a future <a href='/docs/voice/bxml/tag'>`<Tag>`</a> verb or `tag` attribute on another verb, or cleared. May be cleared by setting `tag=\"\"` Max length 4096 characters.")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["to", "from", "privacy", "displayName", "uui", "applicationId", "answerUrl", "answerMethod", "username", "password", "answerFallbackUrl", "answerFallbackMethod", "fallbackUsername", "fallbackPassword", "disconnectUrl", "disconnectMethod", "callTimeout", "callbackTimeout", "machineDetection", "priority", "tag"]
__properties: ClassVar[List[str]] = ["to", "from", "privacy", "displayName", "uui", "requestedAttestationLevel", "identity", "applicationId", "answerUrl", "answerMethod", "username", "password", "answerFallbackUrl", "answerFallbackMethod", "fallbackUsername", "fallbackPassword", "disconnectUrl", "disconnectMethod", "callTimeout", "callbackTimeout", "machineDetection", "priority", "tag"]

@field_validator('identity')
def identity_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not re.match(r"^ *[A-Za-z0-9\-_.+\/=;:<>\"][A-Za-z0-9\-_.+\/=;:<>\" ]*$", value):
raise ValueError(r"must validate the regular expression /^ *[A-Za-z0-9\-_.+\/=;:<>\"][A-Za-z0-9\-_.+\/=;:<>\" ]*$/")
return value

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -118,6 +131,16 @@ def to_dict(self) -> Dict[str, Any]:
if self.uui is None and "uui" in self.model_fields_set:
_dict['uui'] = None

# set to None if requested_attestation_level (nullable) is None
# and model_fields_set contains the field
if self.requested_attestation_level is None and "requested_attestation_level" in self.model_fields_set:
_dict['requestedAttestationLevel'] = None

# set to None if identity (nullable) is None
# and model_fields_set contains the field
if self.identity is None and "identity" in self.model_fields_set:
_dict['identity'] = None

# set to None if answer_method (nullable) is None
# and model_fields_set contains the field
if self.answer_method is None and "answer_method" in self.model_fields_set:
Expand Down Expand Up @@ -200,6 +223,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"privacy": obj.get("privacy"),
"displayName": obj.get("displayName"),
"uui": obj.get("uui"),
"requestedAttestationLevel": obj.get("requestedAttestationLevel"),
"identity": obj.get("identity"),
"applicationId": obj.get("applicationId"),
"answerUrl": obj.get("answerUrl"),
"answerMethod": obj.get("answerMethod") if obj.get("answerMethod") is not None else CallbackMethodEnum.POST,
Expand Down
19 changes: 17 additions & 2 deletions bandwidth/models/create_call_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing_extensions import Annotated
from bandwidth.models.attestation_level_enum import AttestationLevelEnum
from bandwidth.models.callback_method_enum import CallbackMethodEnum
from typing import Optional, Set
from typing_extensions import Self
Expand Down Expand Up @@ -51,8 +52,10 @@ class CreateCallResponse(BaseModel):
fallback_username: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(default=None, description="Basic auth username.", alias="fallbackUsername")
fallback_password: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(default=None, description="Basic auth password.", alias="fallbackPassword")
priority: Optional[StrictInt] = Field(default=None, description="The priority of this call over other calls from your account.")
requested_attestation_level: Optional[AttestationLevelEnum] = Field(default=None, description="The `requestedAttestationLevel` provided in the Create Call request, if any. This is the level you requested, which can differ from the level the call is ultimately signed with.", alias="requestedAttestationLevel")
identity: Optional[StrictStr] = Field(default=None, description="The `identity` value provided in the Create Call request, if any.")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["applicationId", "accountId", "callId", "to", "from", "enqueuedTime", "callUrl", "callTimeout", "callbackTimeout", "tag", "answerMethod", "answerUrl", "answerFallbackMethod", "answerFallbackUrl", "disconnectMethod", "disconnectUrl", "username", "password", "fallbackUsername", "fallbackPassword", "priority"]
__properties: ClassVar[List[str]] = ["applicationId", "accountId", "callId", "to", "from", "enqueuedTime", "callUrl", "callTimeout", "callbackTimeout", "tag", "answerMethod", "answerUrl", "answerFallbackMethod", "answerFallbackUrl", "disconnectMethod", "disconnectUrl", "username", "password", "fallbackUsername", "fallbackPassword", "priority", "requestedAttestationLevel", "identity"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -160,6 +163,16 @@ def to_dict(self) -> Dict[str, Any]:
if self.priority is None and "priority" in self.model_fields_set:
_dict['priority'] = None

# set to None if requested_attestation_level (nullable) is None
# and model_fields_set contains the field
if self.requested_attestation_level is None and "requested_attestation_level" in self.model_fields_set:
_dict['requestedAttestationLevel'] = None

# set to None if identity (nullable) is None
# and model_fields_set contains the field
if self.identity is None and "identity" in self.model_fields_set:
_dict['identity'] = None

return _dict

@classmethod
Expand Down Expand Up @@ -192,7 +205,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"password": obj.get("password"),
"fallbackUsername": obj.get("fallbackUsername"),
"fallbackPassword": obj.get("fallbackPassword"),
"priority": obj.get("priority")
"priority": obj.get("priority"),
"requestedAttestationLevel": obj.get("requestedAttestationLevel"),
"identity": obj.get("identity")
})
# store additional fields in additional_properties
for _key in obj.keys():
Expand Down
15 changes: 15 additions & 0 deletions docs/AttestationLevelEnum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# AttestationLevelEnum

The STIR/SHAKEN attestation level Bandwidth signs the call with: `A` (full), `B` (partial), or `C` (gateway).

## Enum

* `A` (value: `'A'`)

* `B` (value: `'B'`)

* `C` (value: `'C'`)

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


Loading