TelephonyCallLifecycleEvent Class

A bounded durable observation in the lifecycle of one telephony call.

Constructor

TelephonyCallLifecycleEvent(*args: Any, **kwargs: Any)

Variables

Name Description
sequence
int

The service-assigned order of the event within the call record. Required.

name

The stable provider-neutral event name. Required. Known values are: "telephony.webhook.received", "telephony.webhook.validation", "telephony.binding.resolve", "telephony.provider.answer", "telephony.media.connect", "telephony.agent_session.connect", "telephony.media.first_caller_audio", "telephony.media.first_agent_audio", "telephony.call.transfer", "telephony.call.hangup", and "telephony.call.disconnect".

source

The component that supplied the observation. Required. Known values are: "gateway", "teams_phone_extension", "twilio", and "voice_agent".

outcome

The outcome of the observed lifecycle operation. Required. Known values are: "observed", "started", "succeeded", "failed", "rejected", and "cancelled".

observed_at

The Unix timestamp (in seconds) for when the service observed the event. Required.

occurred_at

The Unix timestamp (in seconds) for when the event occurred according to the provider.

timestamp_source

The source of the event timestamp. Required. Known values are: "provider", "gateway", and "derived".

reason

A stable service-generated reason associated with this lifecycle event, not necessarily the final outcome of the call. Additional string codes may be returned. Known values are: "invalid_webhook_payload", "webhook_validation_failed", "binding_not_found", "binding_suspended", "admission_rejected", "admission_check_failed", "route_agent_mismatch", "invalid_binding_configuration", "credential_resolution_failed", "provider_resource_mismatch", "endpoint_resolution_failed", "ingress_setup_failed", "live_call_conflict", "live_call_persistence_failed", "answer_failed", "provider_disconnected", "provider_busy", "provider_no_answer", "provider_cancelled", "provider_failed", "provider_stream_error", "provider_stream_stopped", "agent_session_connect_failed", "media_stream_ended", "bridge_cancelled", "bridge_failed", "managed_hangup", "managed_transfer", "manage_hangup_failed", and "manage_transfer_failed".

provider_event_id
str

The provider event identifier used for idempotency, when supplied.

provider_sequence
int

The provider event sequence, when supplied.

provider_status_code
int

The provider status code associated with the event.

provider_sub_code
int

The provider subcode associated with the event.

Methods

as_dict

Return a dict that can be turned into json using json.dump.

clear

Remove all items from the dictionary.

copy
get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: The value for key if key is in the dictionary, else default. :rtype: any

items
keys
pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if the dictionary is empty.

setdefault

Return the value for key if key is in the dictionary; otherwise set the key to default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: The value for key if key is in the dictionary, else default. :rtype: any

update

Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs.

values

as_dict

Return a dict that can be turned into json using json.dump.

as_dict(*, exclude_readonly: bool = False) -> dict[str, Any]

Keyword-Only Parameters

Name Description
exclude_readonly

Whether to remove the readonly properties.

Default value: False

Returns

Type Description

A dict JSON compatible object

clear

Remove all items from the dictionary.

clear() -> None

copy

copy() -> Model

get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: The value for key if key is in the dictionary, else default. :rtype: any

get(key: str, default: Any = None) -> Any

Parameters

Name Description
key
Required
default
Default value: None

items

items() -> ItemsView[str, Any]

Returns

Type Description

a set-like object providing a view on the mapping's items

keys

keys() -> KeysView[str]

Returns

Type Description

a set-like object providing a view on the mapping's keys

pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

pop(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if the dictionary is empty.

popitem() -> tuple[str, Any]

setdefault

Return the value for key if key is in the dictionary; otherwise set the key to default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: The value for key if key is in the dictionary, else default. :rtype: any

setdefault(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

update

Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs.

update(*args: Any, **kwargs: Any) -> None

values

values() -> ValuesView[Any]

Returns

Type Description

an object providing a view on the mapping's values

Attributes

name

The stable provider-neutral event name. Required. Known values are: "telephony.webhook.received", "telephony.webhook.validation", "telephony.binding.resolve", "telephony.provider.answer", "telephony.media.connect", "telephony.agent_session.connect", "telephony.media.first_caller_audio", "telephony.media.first_agent_audio", "telephony.call.transfer", "telephony.call.hangup", and "telephony.call.disconnect".

name: str | _models.TelephonyCallLifecycleEventName

observed_at

The Unix timestamp (in seconds) for when the service observed the event. Required.

observed_at: datetime

occurred_at

The Unix timestamp (in seconds) for when the event occurred according to the provider.

occurred_at: datetime | None

outcome

"observed", "started", "succeeded", "failed", "rejected", and "cancelled".

outcome: str | _models.TelephonyCallLifecycleEventOutcome

provider_event_id

The provider event identifier used for idempotency, when supplied.

provider_event_id: str | None

provider_sequence

The provider event sequence, when supplied.

provider_sequence: int | None

provider_status_code

The provider status code associated with the event.

provider_status_code: int | None

provider_sub_code

The provider subcode associated with the event.

provider_sub_code: int | None

reason

A stable service-generated reason associated with this lifecycle event, not necessarily the final outcome of the call. Additional string codes may be returned. Known values are: "invalid_webhook_payload", "webhook_validation_failed", "binding_not_found", "binding_suspended", "admission_rejected", "admission_check_failed", "route_agent_mismatch", "invalid_binding_configuration", "credential_resolution_failed", "provider_resource_mismatch", "endpoint_resolution_failed", "ingress_setup_failed", "live_call_conflict", "live_call_persistence_failed", "answer_failed", "provider_disconnected", "provider_busy", "provider_no_answer", "provider_cancelled", "provider_failed", "provider_stream_error", "provider_stream_stopped", "agent_session_connect_failed", "media_stream_ended", "bridge_cancelled", "bridge_failed", "managed_hangup", "managed_transfer", "manage_hangup_failed", and "manage_transfer_failed".

reason: str | _models.TelephonyCallLifecycleEventReason | None

sequence

The service-assigned order of the event within the call record. Required.

sequence: int

source

"gateway", "teams_phone_extension", "twilio", and "voice_agent".

source: str | _models.TelephonyCallLifecycleEventSource

timestamp_source

"provider", "gateway", and "derived".

timestamp_source: str | _models.TelephonyCallTimestampSource