sinch.domains.voice.helpers.v2.svaml.custom_events module

class sinch.domains.voice.helpers.v2.svaml.custom_events.CustomEvents[source]

Bases: object

Helpers to build the custom event SVAML commands.

static trigger(
name: str,
url: str,
*,
fallback_url: str | Unset = <sinch.core.sentinel.Unset object>,
) → CustomEventCommandDict[source]

Triggers a mid-call event to the application backend, allowing it to return a new set of SVAML commands that control the remainder of the call flow.

This is a blocking command — execution pauses until a response is received from the event destination. The next command in the sequence runs only after the backend responds. Event requests use a 5-second timeout. If fallback_url is provided, a failed request is re-sent to it.

Parameters:
  • name (str) – Name for this custom event, between 1 and 64 characters, matching ^\S+$. When triggered, the event request’s event property contains this name prepended with call.customEvent..

  • url (str) – URL of the event destination to send the mid-call event to.

  • fallback_url (UnsetOr[str]) – Fallback URL used when the primary URL fails. A failed request is re-sent to this URL immediately. After repeated consecutive failures of the primary URL, requests are sent only here until the primary URL recovers.

Returns:

The customEvent command.

Return type:

CustomEventCommandDict