Connections
Connect with LiveKit WebRTC or SIP
Use the official LiveKit client for WebRTC rooms and place outbound SIP calls.
Connect a browser with WebRTC
Request WebRTC on the server, then pass only the returned descriptor to the browser. The adapter uses the official LiveKit client and enables microphone publishing by default.
// Trusted server
const session = await ox.realtime.sessions.create({
model: "ox/voice-agent",
transport: "webrtc",
identity: signedInUser.id,
});
// Browser, called from a user gesture
import { connectLiveKitRealtime } from "@ox/sdk/browser";
const room = await connectLiveKitRealtime(session);
Import the same adapter from @ox/sdk/livekit when a dedicated subpath is preferable. Private-preview applications without package installation can import it from https://www.amerint.co/voice-sdk/ox-livekit.js. Pass publishMicrophone: false if the application will publish its own audio track. The participant token is scoped to one room and microphone publishing.
Place an outbound SIP call
Outbound telephony uses the same room and bridge. The server validates E.164 destinations and dispatches the model participant before dialing.
const call = await ox.realtime.calls.create({ to: "+14155550100" });