new TeleQuickClient(...)

new TeleQuickClient(
  endpoint: string,
  credentialsPathOrToken?: string,
  isBrowserToken: boolean = false,
  serverCertificateHash?: string,
)
ArgumentDescription
endpointquic://host:port (Node) or https://host:port (browser). The SDK rewrites quic://https:// for WT.
credentialsPathOrTokenIn Node, the path to your service-account JSON. In the browser, the JWT itself.
isBrowserTokentrue ⇒ second arg is a token. false ⇒ second arg is a file path.
serverCertificateHashBase64-encoded SHA-256 fingerprint for self-signed dev certs.
If credentialsPathOrToken is omitted, the SDK reads from TELEQUICK_CREDENTIALS.

await client.connect()

Initializes the WASM module, signs the JWT (Node-only; browsers pass tokens through), opens the WebTransport session, and subscribes to events under a fresh per-instance UUID. connect() is called automatically by every RPC method, so you don’t have to call it explicitly — but doing so reduces first-RPC latency.

RPC methods

await client.dial(options)

interface DialOptions {{
  to: string;
  trunkId: string;
  callFrom?: string;
  aiWebsocketUrl?: string;
  aiQuicUrl?: string;
  callSid?: string;
  autoBargeIn?: boolean;
  bargeInPatienceMs?: number;
  clientId?: string;
  onDisconnect?: (e: CallEvent) => void;
}}
onDisconnect requires a callSid — the SDK uses it to route the matching hangup event back to your callback.

await client.originateBulk(options)

interface BulkDialOptions {{
  csvUrl: string;
  trunkId: string;
  cps: number;
  campaignId: string;
  defaultApp?: number;
  defaultAppArgs?: string;
  aiWebsocketUrl?: string;
  aiQuicUrl?: string;
  autoBargeIn?: boolean;
  bargeInPatienceMs?: number;
}}
cps sets both calls_per_second and max_concurrent_calls to the same value for simplicity. For different values, build the request through wasmModule.BulkRequest directly.

await client.terminate(callSid)

Hang up a single call.

await client.barge(callSid)

Trigger or arm AI barge-in for callSid. While the AI agent is speaking, the gateway gates the AI’s outbound audio the moment the human starts talking on the inbound leg. Not the supervisor-injection feature found in legacy PBXs. See Method IDs → Barge.

await client.streamEvents(clientId)

Re-subscribe events under a different clientId. connect() already does this for you with the auto-generated UUID; only use this for explicit fanout.

Inbound-routing RPCs

await client.setInboundRouting({
    trunkId: "default",
    rule: 3,                          // InboundRule.HANDLE_AI
    aiWebsocketUrl: "wss://my-app.example.com/agent",
});
await client.getIncomingCalls("default");
await client.answerIncomingCall({
    callSid: incomingSid,
    aiWebsocketUrl: "wss://my-app.example.com/agent",
});
await client.abortBulk(campaignId);

Mid-call control (ExecuteDialplan verbs)

import { DialplanAction } from "@telequick/sdk";

await client.transfer(callSid, "+15551234567");
await client.mute(callSid);
await client.mute(callSid, { onWire: true });    // also send recvonly re-INVITE
await client.unmute(callSid);
await client.hold(callSid);
await client.unhold(callSid);
await client.sendDtmf(callSid, "5", { mode: "rfc2833", durationMs: 200 });

// Direct ExecuteDialplan when you need a verb the sugar doesn't cover:
await client.executeDialplan(callSid, DialplanAction.PLAYBACK, "/audio/hold.wav");
Full enum: DialplanAction values.

await client.pushAudio(callSid, payload, codec, seq, eos)

await client.pushAudio(
  callSid: string,
  payload: Uint8Array,
  codec: "PCMU" | "PCMA" | "PCM16",
  sequenceNumber: number,
  endOfStream: boolean,
);
The SDK lazily opens one uni-stream per client and writes every frame on it. endOfStream = true is final — you can’t push more frames after.

Callbacks

client.onAudioFrame = (payload: Uint8Array) => void;
client.onCallEvent  = (payload: Uint8Array) => void;
Both callbacks receive the raw serde envelope (no [length][method_id] prefix). Use the WASM helpers (exposed on client.wasmModule) to decode.

Direct WASM access

If you need a method that isn’t wrapped, the WASM module is exposed on client.wasmModule after connect(). It’s typed as TeleQuickWasmModule and lets you build any envelope:
const req = new client.wasmModule.OriginateRequest();
req.trunk_id = "default";
req.to = "+15551234567";
const buf = client.wasmModule.rpc_originate_request(req);  // ArrayBuffer
req.delete();
req.delete() is mandatory — Emscripten doesn’t reclaim WASM heap automatically. Forgetting it leaks memory at the rate of one struct per call.

CallEvent shape

interface CallEvent {{
  call_sid: string;
  event_type: number;          // see EventType enum on rpc/types
  status: string;
  start_timestamp_ms: bigint;
  q850_cause: number;
  duration_seconds: number;
  answer_timestamp_ms: bigint;
  end_timestamp_ms: bigint;
  trunk_id: string;
  tenant_id: string;
}}

Method IDs

import {{ MethodID }} from "@telequick/sdk";

MethodID.AUDIO_FRAME       // 2991054320
MethodID.STREAM_EVENTS     // 959835745
MethodID.ORIGINATE         // 1430677891
See Method IDs for the complete table.