telequick.client.TeleQuickClient.
Constructor
| Argument | Notes |
|---|---|
endpoint | quic://host:port. ALPN h3 is added automatically. |
service_account_path | Path to your service-account JSON. |
lib_path | Override path to telequick_core_ffi.so. Defaults to the env var TELEQUICK_LIB_PATH then a packaged binary. |
- Loads the FFI symbols.
- Reads the JWT signing key (lazy — actual signing is done in
connect_async). - Generates a UUID into
client.client_idforEventStreamRequestrouting.
Connection
connect_async() (async context manager)
EventStreamRequest, and yields.
On exit, closes the session. You must be inside this block to call any
RPC method.
Callbacks
connect_async(). They receive the raw
serde-envelope payload (no length/method prefix). Decode with
deserialize_audio_frame / deserialize_call_event.
RPC methods
All RPC methods are coroutines. Calling them withoutawait is a no-op.
await client.dial(...)
Originate. client_id defaults to the SDK-generated UUID, which
is also what connect_async subscribed events under — leave it alone unless
you know why you’re routing events somewhere else.
await client.originate_bulk(...)
abort_bulk(campaign_id) to
cancel.
await client.terminate(call_sid)
Hang up a single call.
await client.barge(call_sid)
Trigger or arm AI barge-in for call_sid. While the AI agent is
speaking on the call, the gateway listens to the human leg and gates
the AI’s audio the moment the human starts talking. This is not the
supervisor-injection feature found in legacy PBXs. See
Method IDs → Barge.
await client.stream_events(client_id)
Manually re-subscribe events under a different client_id. connect_async
already does this for you with client.client_id — only call this if you
need to fan-out events to a different SDK process.
await client.push_audio(call_sid, pcm_data)
Serialize one AudioFrame (codec PCMU, sequence_number=0, eos=False)
and write it on the lazy-opened audio uni-stream. Pass raw payload bytes.
Inbound-routing RPCs
InboundRule.
Bulk + bucket admin
Mid-call control (ExecuteDialplan verbs)
The 6 call-control verbs are exposed as convenience wrappers; each
maps to execute_dialplan(call_sid, action, app_args) with the
matching DialplanAction enum value.
execute_dialplan directly when you need an enum value the
sugar doesn’t cover:
Helpers
parse_call_event returns a frozen CallEvent dataclass with
call_sid, event_type, status, start_timestamp_ms, q850_cause,
recording_url, duration_seconds, answer_timestamp_ms,
end_timestamp_ms, packets_sent, packets_received, packets_lost,
bytes_sent, jitter_ms, estimated_mos, trunk_id, tenant_id,
codec, timestamp_ms, client_id. See
CallEvent fields.
serialize_audio_frame returns a fully-framed RPC packet (length prefix +
method id + envelope) — useful if you want to write to a custom QUIC stream
yourself.
Enums
MethodID
DialplanAction
Errors
| Error | Cause |
|---|---|
FileNotFoundError(... FFI Core) | Native lib not on disk. Set TELEQUICK_LIB_PATH. |
RuntimeError("Must connect first") | Calling push_audio outside connect_async() block. |
RuntimeError("Must execute dial() within 'async with client.connect_async()' context.") | Calling any RPC outside the connect block. |
QUIC ConnectionRefusedError | Endpoint unreachable, wrong port, or ALPN mismatch. |