1. Browser agent dashboard
Stream live audio from every active AI call; click a call to arm AI barge-in so the human is heard the moment they start talking.import {{ useEffect, useRef, useState }} from "react";
import {{ TeleQuickClient }} from "@telequick/sdk";
export function AgentDashboard({{ token }}: {{ token: string }}) {{
const clientRef = useRef<TeleQuickClient | null>(null);
const [calls, setCalls] = useState<string[]>([]);
useEffect(() => {{
const client = new TeleQuickClient(
"https://engine.telequick.dev:9090",
token,
true,
);
clientRef.current = client;
client.onCallEvent = (raw) => {{
// Parse the envelope through the WASM helpers if you need fields.
// For this demo we just track unique call_sids by string-scanning.
const decoded = new TextDecoder("utf-8", {{ fatal: false }}).decode(raw);
const m = decoded.match(/call-[a-z0-9-]+/);
if (m) setCalls((prev) => Array.from(new Set([...prev, m[0]])));
}};
client.connect();
return () => {{ /* WT closes on page unload */ }};
}}, [token]);
return (
<ul>
{{calls.map((sid) => (
<li key={{sid}}>
{{sid}}{" "}
<button onClick={{() => clientRef.current?.barge(sid)}}>
Arm AI barge-in
</button>
</li>
))}}
</ul>
);
}}
2. Node-side dialer hooked into a job queue
import {{ Worker }} from "bullmq";
import {{ TeleQuickClient }} from "@telequick/sdk";
const client = new TeleQuickClient(
"quic://engine.telequick.dev:9090",
process.env.TELEQUICK_CREDENTIALS!,
);
await client.connect();
new Worker("dial-jobs", async (job) => {{
const {{ to, trunkId, callSid }} = job.data;
await client.dial({{
to,
trunkId,
callSid,
onDisconnect: (ev) => {{
job.updateProgress({{
status: ev.status,
durationSeconds: ev.duration_seconds,
}});
}},
}});
}});
3. AI bridge — OpenAI Realtime in Node
Mirrors the Python example, but co-locates the AI worker with the dialer:import WebSocket from "ws";
import {{ TeleQuickClient }} from "@telequick/sdk";
const client = new TeleQuickClient("quic://engine.telequick.dev:9090", credsPath);
await client.connect();
const realtime = new WebSocket(
"wss://api.openai.com/v1/realtime?model=gpt-realtime",
{{ headers: {{ Authorization: `Bearer ${{process.env.OPENAI_API_KEY}}` }} }},
);
const callSid = "call-" + crypto.randomUUID();
let seq = 0;
client.onAudioFrame = (raw) => {{
// Forward inbound audio to OpenAI as base64 PCMU.
realtime.send(JSON.stringify({{
type: "input_audio_buffer.append",
audio: Buffer.from(raw).toString("base64"),
}}));
}};
realtime.on("message", async (msg) => {{
const ev = JSON.parse(msg.toString());
if (ev.type === "response.audio.delta") {{
await client.pushAudio(
callSid,
Buffer.from(ev.delta, "base64"),
"PCMU",
seq++,
false,
);
}}
}});
await client.dial({{
to: "sip:+15551234567@example.sip.livekit.cloud",
trunkId: "default",
callSid,
aiWebsocketUrl: "wss://placeholder", // not used; we proxy ourselves
}});
4. Live transcription stream
Pipe every inboundAudioFrame to a Deepgram stream and display the text:
import {{ Deepgram }} from "@deepgram/sdk";
import {{ TeleQuickClient }} from "@telequick/sdk";
const dg = new Deepgram(process.env.DEEPGRAM_API_KEY!);
const dgStream = dg.transcription.live({{
encoding: "mulaw",
sampleRate: 8000,
}});
const client = new TeleQuickClient("https://engine.telequick.dev:9090", token, true);
client.onAudioFrame = (raw) => dgStream.send(raw);
dgStream.addListener("transcriptReceived", (data) => {{
const txt = JSON.parse(data).channel?.alternatives?.[0]?.transcript;
if (txt) console.log("►", txt);
}});
await client.connect();
// Subscribe to events for the active call; transcription receives the
// inbound audio frames that `onAudioFrame` is already piping through.
await client.streamEvents("transcription-listener");
5. Bulk dialer with progress UI
import {{ TeleQuickClient }} from "@telequick/sdk";
const client = new TeleQuickClient("quic://engine.telequick.dev:9090", credsPath);
await client.connect();
let total = 0, done = 0;
client.onCallEvent = (raw) => {{
// Crude — real apps should parse the CallEvent properly.
const text = new TextDecoder().decode(raw);
if (text.includes("CHANNEL_CREATE")) total++;
if (text.includes("CHANNEL_HANGUP_COMPLETE")) done++;
process.stdout.write(`\r${{done}}/${{total}}`);
}};
await client.originateBulk({{
csvUrl: "https://files.example.com/numbers.csv",
trunkId: "default",
cps: 10,
campaignId: "demo-campaign",
}});