Skip to navigation

Start an agent session on your own call leg

Admits a call that runs the agent’s live published version and returns a signed media WebSocket for a call leg that your switch, carrier, dialer or application already owns. Rasen places, answers and routes no telephone call and needs no phone number. Stream the leg’s audio to websocket_url before expires_at; the agent’s audio comes back on the same socket. Optional expected_version_id only refuses an unexpected live version. Requires current admission capacity: at_capacity and quota_exceeded say to retry with the same key after Retry-After. Same key and body replay the same call, websocket_url and expires_at. The call’s metadata is returned on call reads.

Authentication

AuthorizationBearer

Create and manage workspace-owned keys through the existing app session routes, outside this public API. Creator and manager identities are audit actors only. Key validity follows workspace policy, expiry and explicit revocation, independently of creator membership. Do not include a workspace-selection header.

Headers

Idempotency-KeystringRequired1-255 characters

Stable key per logical intent, 1–255 printable characters. Persist it before sending. Retry the same key/body after an uncertain result for 24 hours. A changed body conflicts. Beyond retention, reconcile the resource before retrying; this is not permanent deduplication. Current authorization is rechecked on replay. Evaluation order: authenticate and check current authorization; look up intent; replay its stored receipt before checking the current revision; only a new intent evaluates If-Match and executes. Fingerprint includes method, path, body and original If-Match. A changed request returns idempotency_key_reused. The server stores only a keyed (HMAC) fingerprint, and no error or response ever returns a fingerprint or hash of a request. In-flight intent returns 409 idempotency_in_progress with Retry-After; retry the same intent after reconciliation. Receipts describe that attempt, not current resource state. A replay returns the original status code and body, with the response header Idempotent-Replayed: true.

Request

This endpoint expects an object.
agent_idstringRequired<=128 characters
Opaque agent identifier. Do not parse its contents.
directionenumOptional

A label for call reads and filters. It does not place or answer a call. Omitted, it is the live version’s call_direction setting, or outbound when that is not set.

Allowed values:
expected_version_idstringOptional<=128 characters

Optional precondition: refuse if this is not the live version at admission. Does not select an old version.

mediaobjectOptional
Audio framing for both directions of the media WebSocket. Omitted fields take their defaults. mulaw with 16000 Hz is refused.
dynamic_variablesmap from strings to stringsOptional

Flat object of string values. At most 64 keys; each key matches ^[a-z][a-z0-9_]63$. Each value is at most 4096 characters and contains no control characters except tab and newline. The whole object is at most 16 KiB as JSON. Nested objects and non-string values are refused, never converted. Overrides literal defaults; undeclared names are allowed. Credentials are forbidden.

metadatamap from strings to stringsOptional

Bounded customer correlation map: at most 16 keys; each key matches ^[a-z][a-z0-9_]63$ (the same form the metadata_key filter accepts); each value at most 512 characters; at most 4 KiB in total. No credential storage. Metadata is not a uniqueness or permanent deduplication guarantee.

Response headers

X-Request-IdstringOptional
Safe server request correlation ID.
RateLimit-LimitintegerOptional
Requests allowed in the current window for the tightest applicable limit.
RateLimit-RemainingintegerOptional
Requests left in the current window.
RateLimit-ResetintegerOptional
Seconds until the current window resets.
Idempotent-ReplayedstringOptional

true when this response replays a stored Idempotency-Key result. The status and body equal the original.

LocationstringOptional<=2048 characters

Path-absolute URL of the resource to poll, including the API base path. Agent-scoped knowledge creates point to the canonical knowledge source URL.

Response

Start an agent session on your own call leg.
call_idstring<=128 characters
Opaque call identifier. Do not parse its contents.
agent_idstring<=128 characters
Opaque agent identifier. Do not parse its contents.
published_version_idstring<=128 characters
Opaque pub identifier. Do not parse its contents.
statestring
The call state at admission. The call becomes active when the first audio frame arrives on the socket.
directionenum
Allowed values:
mediaobject
Audio framing for both directions of the media WebSocket. Omitted fields take their defaults. mulaw with 16000 Hz is refused.
websocket_urlstring<=2048 characters

The signed media WebSocket URL of this call. It is a credential: connect to it exactly as returned, before expires_at, and do not log it. One socket per call.

expires_atdatetime

The socket must connect and send audio before this time (120 seconds after admission). After it, the reserved capacity is released and the call ends with end_reason never_connected. A replay never extends it.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
413
Content Too Large Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error