@sayna-ai/node-sdk 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +69 -2
- package/dist/index.js.map +3 -3
- package/dist/sayna-client.d.ts +140 -1
- package/dist/sayna-client.d.ts.map +1 -1
- package/dist/types.d.ts +156 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -279,7 +279,7 @@ class SaynaClient {
|
|
|
279
279
|
if (this.apiKey && !hasAuthHeader) {
|
|
280
280
|
headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
281
281
|
}
|
|
282
|
-
if (options.
|
|
282
|
+
if (options.body && !headers["Content-Type"]) {
|
|
283
283
|
headers["Content-Type"] = "application/json";
|
|
284
284
|
}
|
|
285
285
|
try {
|
|
@@ -486,6 +486,73 @@ class SaynaClient {
|
|
|
486
486
|
})
|
|
487
487
|
});
|
|
488
488
|
}
|
|
489
|
+
async getLiveKitRooms() {
|
|
490
|
+
return this.fetchFromSayna("livekit/rooms");
|
|
491
|
+
}
|
|
492
|
+
async getLiveKitRoom(roomName) {
|
|
493
|
+
if (!roomName || roomName.trim().length === 0) {
|
|
494
|
+
throw new SaynaValidationError("room_name cannot be empty");
|
|
495
|
+
}
|
|
496
|
+
const encoded = encodeURIComponent(roomName.trim());
|
|
497
|
+
return this.fetchFromSayna(`livekit/rooms/${encoded}`);
|
|
498
|
+
}
|
|
499
|
+
async removeLiveKitParticipant(roomName, participantIdentity) {
|
|
500
|
+
if (!roomName || roomName.trim().length === 0) {
|
|
501
|
+
throw new SaynaValidationError("room_name cannot be empty");
|
|
502
|
+
}
|
|
503
|
+
if (!participantIdentity || participantIdentity.trim().length === 0) {
|
|
504
|
+
throw new SaynaValidationError("participant_identity cannot be empty");
|
|
505
|
+
}
|
|
506
|
+
return this.fetchFromSayna("livekit/participant", {
|
|
507
|
+
method: "DELETE",
|
|
508
|
+
body: JSON.stringify({
|
|
509
|
+
room_name: roomName.trim(),
|
|
510
|
+
participant_identity: participantIdentity.trim()
|
|
511
|
+
})
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
async muteLiveKitParticipantTrack(roomName, participantIdentity, trackSid, muted) {
|
|
515
|
+
if (!roomName || roomName.trim().length === 0) {
|
|
516
|
+
throw new SaynaValidationError("room_name cannot be empty");
|
|
517
|
+
}
|
|
518
|
+
if (!participantIdentity || participantIdentity.trim().length === 0) {
|
|
519
|
+
throw new SaynaValidationError("participant_identity cannot be empty");
|
|
520
|
+
}
|
|
521
|
+
if (!trackSid || trackSid.trim().length === 0) {
|
|
522
|
+
throw new SaynaValidationError("track_sid cannot be empty");
|
|
523
|
+
}
|
|
524
|
+
if (typeof muted !== "boolean") {
|
|
525
|
+
throw new SaynaValidationError("muted must be a boolean");
|
|
526
|
+
}
|
|
527
|
+
return this.fetchFromSayna("livekit/participant/mute", {
|
|
528
|
+
method: "POST",
|
|
529
|
+
body: JSON.stringify({
|
|
530
|
+
room_name: roomName.trim(),
|
|
531
|
+
participant_identity: participantIdentity.trim(),
|
|
532
|
+
track_sid: trackSid.trim(),
|
|
533
|
+
muted
|
|
534
|
+
})
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
async sipTransferRest(roomName, participantIdentity, transferTo) {
|
|
538
|
+
if (!roomName || roomName.trim().length === 0) {
|
|
539
|
+
throw new SaynaValidationError("room_name cannot be empty");
|
|
540
|
+
}
|
|
541
|
+
if (!participantIdentity || participantIdentity.trim().length === 0) {
|
|
542
|
+
throw new SaynaValidationError("participant_identity cannot be empty");
|
|
543
|
+
}
|
|
544
|
+
if (!transferTo || transferTo.trim().length === 0) {
|
|
545
|
+
throw new SaynaValidationError("transfer_to cannot be empty");
|
|
546
|
+
}
|
|
547
|
+
return this.fetchFromSayna("sip/transfer", {
|
|
548
|
+
method: "POST",
|
|
549
|
+
body: JSON.stringify({
|
|
550
|
+
room_name: roomName.trim(),
|
|
551
|
+
participant_identity: participantIdentity.trim(),
|
|
552
|
+
transfer_to: transferTo.trim()
|
|
553
|
+
})
|
|
554
|
+
});
|
|
555
|
+
}
|
|
489
556
|
async getRecording(streamId) {
|
|
490
557
|
if (!streamId || streamId.trim().length === 0) {
|
|
491
558
|
throw new SaynaValidationError("streamId cannot be empty");
|
|
@@ -696,4 +763,4 @@ export {
|
|
|
696
763
|
SaynaClient
|
|
697
764
|
};
|
|
698
765
|
|
|
699
|
-
//# debugId=
|
|
766
|
+
//# debugId=03E3B3D15CF30BEF64756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
"sources": ["../src/errors.ts", "../src/sayna-client.ts", "../src/webhook-receiver.ts", "../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * Base error class for all Sayna SDK errors.\n */\nexport class SaynaError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"SaynaError\";\n Object.setPrototypeOf(this, SaynaError.prototype);\n }\n}\n\n/**\n * Error thrown when attempting to use the client before it's connected.\n */\nexport class SaynaNotConnectedError extends SaynaError {\n constructor(message: string = \"Not connected to Sayna WebSocket\") {\n super(message);\n this.name = \"SaynaNotConnectedError\";\n Object.setPrototypeOf(this, SaynaNotConnectedError.prototype);\n }\n}\n\n/**\n * Error thrown when attempting operations before the client is ready.\n */\nexport class SaynaNotReadyError extends SaynaError {\n constructor(\n message: string = \"Sayna voice providers are not ready. Wait for the connection to be established.\"\n ) {\n super(message);\n this.name = \"SaynaNotReadyError\";\n Object.setPrototypeOf(this, SaynaNotReadyError.prototype);\n }\n}\n\n/**\n * Error thrown when WebSocket connection fails.\n */\nexport class SaynaConnectionError extends SaynaError {\n public override readonly cause?: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = \"SaynaConnectionError\";\n this.cause = cause;\n Object.setPrototypeOf(this, SaynaConnectionError.prototype);\n }\n}\n\n/**\n * Error thrown when invalid parameters are provided.\n */\nexport class SaynaValidationError extends SaynaError {\n constructor(message: string) {\n super(message);\n this.name = \"SaynaValidationError\";\n Object.setPrototypeOf(this, SaynaValidationError.prototype);\n }\n}\n\n/**\n * Error thrown when the server returns an error.\n */\nexport class SaynaServerError extends SaynaError {\n constructor(message: string) {\n super(message);\n this.name = \"SaynaServerError\";\n Object.setPrototypeOf(this, SaynaServerError.prototype);\n }\n}\n",
|
|
6
|
-
"import type {\n STTConfig,\n TTSConfig,\n LiveKitConfig,\n ConfigMessage,\n SpeakMessage,\n ClearMessage,\n SendMessageMessage,\n STTResultMessage,\n ErrorMessage,\n SipTransferErrorMessage,\n SipTransferMessage,\n OutgoingMessage,\n SaynaMessage,\n Participant,\n VoicesResponse,\n HealthResponse,\n LiveKitTokenResponse,\n SipHook,\n SipHooksResponse,\n} from \"./types\";\nimport {\n SaynaNotConnectedError,\n SaynaNotReadyError,\n SaynaConnectionError,\n SaynaValidationError,\n SaynaServerError,\n} from \"./errors\";\n\n// Node.js 18+ has native fetch support\ndeclare const fetch: typeof globalThis.fetch;\n\n/**\n * Event handler for speech-to-text results.\n */\nexport type STTResultHandler = (\n result: STTResultMessage\n) => void | Promise<void>;\n\n/**\n * Event handler for text-to-speech audio data.\n */\nexport type TTSAudioHandler = (audio: ArrayBuffer) => void | Promise<void>;\n\n/**\n * Event handler for error messages.\n */\nexport type ErrorHandler = (error: ErrorMessage) => void | Promise<void>;\n\n/**\n * Event handler for participant messages.\n */\nexport type MessageHandler = (message: SaynaMessage) => void | Promise<void>;\n\n/**\n * Event handler for participant disconnections.\n */\nexport type ParticipantDisconnectedHandler = (\n participant: Participant\n) => void | Promise<void>;\n\n/**\n * Event handler for TTS playback completion.\n */\nexport type TTSPlaybackCompleteHandler = (\n timestamp: number\n) => void | Promise<void>;\n\n/**\n * Event handler for SIP transfer specific errors.\n */\nexport type SipTransferErrorHandler = (\n error: SipTransferErrorMessage\n) => void | Promise<void>;\n\n/**\n * Client for connecting to Sayna WebSocket server for real-time voice interactions.\n *\n * @example\n * ```typescript\n * const client = await saynaConnect(\n * \"https://api.sayna.ai\",\n * sttConfig,\n * ttsConfig\n * );\n *\n * client.registerOnSttResult((result) => {\n * console.log(\"Transcription:\", result.transcript);\n * });\n *\n * await client.speak(\"Hello, world!\");\n * ```\n */\nexport class SaynaClient {\n private url: string;\n private sttConfig?: STTConfig;\n private ttsConfig?: TTSConfig;\n private livekitConfig?: LiveKitConfig;\n private withoutAudio: boolean;\n private apiKey?: string;\n private websocket?: WebSocket;\n private isConnected: boolean = false;\n private isReady: boolean = false;\n private _livekitRoomName?: string;\n private _livekitUrl?: string;\n private _saynaParticipantIdentity?: string;\n private _saynaParticipantName?: string;\n private _streamId?: string;\n private inputStreamId?: string;\n private sttCallback?: STTResultHandler;\n private ttsCallback?: TTSAudioHandler;\n private errorCallback?: ErrorHandler;\n private messageCallback?: MessageHandler;\n private participantDisconnectedCallback?: ParticipantDisconnectedHandler;\n private ttsPlaybackCompleteCallback?: TTSPlaybackCompleteHandler;\n private sipTransferErrorCallback?: SipTransferErrorHandler;\n private readyPromiseResolve?: () => void;\n private readyPromiseReject?: (error: Error) => void;\n\n /**\n * Creates a new SaynaClient instance.\n *\n * @param url - The Sayna server URL (e.g., \"https://api.sayna.ai\")\n * @param sttConfig - Speech-to-text configuration (required when withoutAudio=false)\n * @param ttsConfig - Text-to-speech configuration (required when withoutAudio=false)\n * @param livekitConfig - Optional LiveKit room configuration\n * @param withoutAudio - If true, disables audio streaming (default: false)\n * @param apiKey - Optional API key used to authorize HTTP and WebSocket calls (defaults to SAYNA_API_KEY env)\n * @param streamId - Optional session identifier for recording paths; server generates a UUID when omitted\n *\n * @throws {SaynaValidationError} If URL is invalid or if audio configs are missing when audio is enabled\n */\n constructor(\n url: string,\n sttConfig?: STTConfig,\n ttsConfig?: TTSConfig,\n livekitConfig?: LiveKitConfig,\n withoutAudio: boolean = false,\n apiKey?: string,\n streamId?: string\n ) {\n // Validate URL\n if (!url || typeof url !== \"string\") {\n throw new SaynaValidationError(\"URL must be a non-empty string\");\n }\n if (\n !url.startsWith(\"http://\") &&\n !url.startsWith(\"https://\") &&\n !url.startsWith(\"ws://\") &&\n !url.startsWith(\"wss://\")\n ) {\n throw new SaynaValidationError(\n \"URL must start with http://, https://, ws://, or wss://\"\n );\n }\n\n // Validate audio config requirements\n if (!withoutAudio) {\n if (!sttConfig || !ttsConfig) {\n throw new SaynaValidationError(\n \"sttConfig and ttsConfig are required when withoutAudio=false (audio streaming enabled). \" +\n \"Either provide both configs or set withoutAudio=true for non-audio use cases.\"\n );\n }\n }\n\n this.url = url;\n this.sttConfig = sttConfig;\n this.ttsConfig = ttsConfig;\n this.livekitConfig = livekitConfig;\n this.withoutAudio = withoutAudio;\n this.apiKey = apiKey ?? process.env.SAYNA_API_KEY;\n this.inputStreamId = streamId;\n }\n\n /**\n * Establishes connection to the Sayna WebSocket server.\n *\n * @throws {SaynaConnectionError} If connection fails\n * @returns Promise that resolves when the connection is ready\n */\n async connect(): Promise<void> {\n if (this.isConnected) {\n return;\n }\n\n // Convert HTTP(S) URL to WebSocket URL\n const wsUrl =\n this.url.replace(/^https:\\/\\//, \"wss://\").replace(/^http:\\/\\//, \"ws://\") +\n (this.url.endsWith(\"/\") ? \"ws\" : \"/ws\");\n\n return new Promise((resolve, reject) => {\n this.readyPromiseResolve = resolve;\n this.readyPromiseReject = reject;\n\n try {\n const headers = this.apiKey\n ? { Authorization: `Bearer ${this.apiKey}` }\n : undefined;\n\n const WebSocketConstructor = WebSocket as unknown as {\n new (\n url: string,\n protocols?: string | string[],\n options?: { headers?: Record<string, string> }\n ): WebSocket;\n };\n\n this.websocket = headers\n ? new WebSocketConstructor(wsUrl, undefined, { headers })\n : new WebSocket(wsUrl);\n\n this.websocket.onopen = () => {\n this.isConnected = true;\n\n // Send initial configuration\n const configMessage: ConfigMessage = {\n type: \"config\",\n stream_id: this.inputStreamId,\n stt_config: this.sttConfig,\n tts_config: this.ttsConfig,\n livekit: this.livekitConfig,\n audio: !this.withoutAudio,\n };\n\n try {\n if (this.websocket) {\n this.websocket.send(JSON.stringify(configMessage));\n }\n } catch (error) {\n this.cleanup();\n const err = new SaynaConnectionError(\n \"Failed to send configuration\",\n error\n );\n if (this.readyPromiseReject) {\n this.readyPromiseReject(err);\n }\n }\n };\n\n this.websocket.onmessage = async (event) => {\n try {\n if (\n event.data instanceof Blob ||\n event.data instanceof ArrayBuffer\n ) {\n // Binary TTS audio data\n const buffer =\n event.data instanceof Blob\n ? await event.data.arrayBuffer()\n : event.data;\n if (this.ttsCallback) {\n await this.ttsCallback(buffer);\n }\n } else {\n // JSON control messages\n if (typeof event.data !== \"string\") {\n throw new Error(\"Expected string data for JSON messages\");\n }\n const data = JSON.parse(event.data) as OutgoingMessage;\n await this.handleJsonMessage(data);\n }\n } catch (error) {\n // Log parse errors but don't break the connection\n if (this.errorCallback) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n await this.errorCallback({\n type: \"error\",\n message: `Failed to process message: ${errorMessage}`,\n });\n }\n }\n };\n\n this.websocket.onerror = () => {\n const error = new SaynaConnectionError(\"WebSocket connection error\");\n if (this.readyPromiseReject && !this.isReady) {\n this.readyPromiseReject(error);\n }\n };\n\n this.websocket.onclose = (event) => {\n const wasReady = this.isReady;\n this.cleanup();\n\n // If connection closed before ready, reject the promise\n if (!wasReady && this.readyPromiseReject) {\n this.readyPromiseReject(\n new SaynaConnectionError(\n `WebSocket closed before ready (code: ${event.code}, reason: ${event.reason || \"none\"})`\n )\n );\n }\n };\n } catch (error) {\n reject(new SaynaConnectionError(\"Failed to create WebSocket\", error));\n }\n });\n }\n\n /**\n * Handles incoming JSON messages from the WebSocket.\n * @internal\n */\n private async handleJsonMessage(data: OutgoingMessage): Promise<void> {\n const messageType = data.type;\n\n try {\n switch (messageType) {\n case \"ready\": {\n const readyMsg = data;\n this.isReady = true;\n this._livekitRoomName = readyMsg.livekit_room_name;\n this._livekitUrl = readyMsg.livekit_url;\n this._saynaParticipantIdentity = readyMsg.sayna_participant_identity;\n this._saynaParticipantName = readyMsg.sayna_participant_name;\n this._streamId = readyMsg.stream_id;\n if (this.readyPromiseResolve) {\n this.readyPromiseResolve();\n }\n break;\n }\n\n case \"stt_result\": {\n const sttResult = data;\n if (this.sttCallback) {\n await this.sttCallback(sttResult);\n }\n break;\n }\n\n case \"error\": {\n const errorMsg = data;\n if (this.errorCallback) {\n await this.errorCallback(errorMsg);\n }\n if (this.readyPromiseReject && !this.isReady) {\n this.readyPromiseReject(new SaynaServerError(errorMsg.message));\n }\n break;\n }\n\n case \"sip_transfer_error\": {\n const sipTransferError = data;\n if (this.sipTransferErrorCallback) {\n await this.sipTransferErrorCallback(sipTransferError);\n } else if (this.errorCallback) {\n await this.errorCallback({\n type: \"error\",\n message: sipTransferError.message,\n });\n }\n break;\n }\n\n case \"message\": {\n const messageData = data;\n if (this.messageCallback) {\n await this.messageCallback(messageData.message);\n }\n break;\n }\n\n case \"participant_disconnected\": {\n const participantMsg = data;\n if (this.participantDisconnectedCallback) {\n await this.participantDisconnectedCallback(\n participantMsg.participant\n );\n }\n break;\n }\n\n case \"tts_playback_complete\": {\n const ttsPlaybackCompleteMsg = data;\n if (this.ttsPlaybackCompleteCallback) {\n await this.ttsPlaybackCompleteCallback(\n ttsPlaybackCompleteMsg.timestamp\n );\n }\n break;\n }\n\n default: {\n const unknownMessage = data as { type: string };\n const errorMessage = `Unknown message type received: ${unknownMessage.type}`;\n if (this.errorCallback) {\n await this.errorCallback({ type: \"error\", message: errorMessage });\n } else {\n console.warn(errorMessage);\n }\n }\n }\n } catch (error) {\n // Notify error callback if handler fails\n if (this.errorCallback) {\n await this.errorCallback({\n type: \"error\",\n message: `Handler error: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n }\n }\n\n /**\n * Cleans up internal state.\n * @internal\n */\n private cleanup(): void {\n this.isConnected = false;\n this.isReady = false;\n this._livekitRoomName = undefined;\n this._livekitUrl = undefined;\n this._saynaParticipantIdentity = undefined;\n this._saynaParticipantName = undefined;\n this._streamId = undefined;\n }\n\n /**\n * Converts WebSocket URL to HTTP URL for REST API calls.\n * @internal\n */\n private getHttpUrl(): string {\n return this.url\n .replace(/^ws:\\/\\//, \"http://\")\n .replace(/^wss:\\/\\//, \"https://\");\n }\n\n /**\n * Generic fetch helper for making REST API calls to Sayna server.\n * Handles URL construction, headers, error responses, and type conversion.\n * @internal\n *\n * @param endpoint - API endpoint path (e.g., \"/voices\", \"/speak\")\n * @param options - Fetch options including method, body, headers, etc.\n * @param responseType - Expected response type: \"json\" or \"arrayBuffer\"\n * @returns Promise resolving to the parsed response\n * @throws {SaynaConnectionError} If the network request fails\n * @throws {SaynaServerError} If the server returns an error response\n */\n private async fetchFromSayna<T>(\n endpoint: string,\n options: RequestInit = {},\n responseType: \"json\" | \"arrayBuffer\" = \"json\"\n ): Promise<T> {\n const httpUrl = this.getHttpUrl();\n const url = `${httpUrl}${httpUrl.endsWith(\"/\") ? \"\" : \"/\"}${endpoint.startsWith(\"/\") ? endpoint.slice(1) : endpoint}`;\n\n // Merge default headers with user-provided headers\n const headers: Record<string, string> = {\n ...(options.headers as Record<string, string>),\n };\n\n // Add Authorization header when an API key is provided, unless user supplied one\n const hasAuthHeader = Object.keys(headers).some(\n (key) => key.toLowerCase() === \"authorization\"\n );\n if (this.apiKey && !hasAuthHeader) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n\n // Add Content-Type for JSON requests if not already set\n if (options.method === \"POST\" && options.body && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n try {\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n if (!response.ok) {\n // Try to parse error message from JSON response\n let errorMessage: string;\n try {\n const errorData: unknown = await response.json();\n errorMessage =\n errorData &&\n typeof errorData === \"object\" &&\n \"error\" in errorData &&\n typeof errorData.error === \"string\"\n ? errorData.error\n : `Request failed: ${response.status} ${response.statusText}`;\n } catch {\n errorMessage = `Request failed: ${response.status} ${response.statusText}`;\n }\n throw new SaynaServerError(errorMessage);\n }\n\n // Parse response based on expected type\n if (responseType === \"arrayBuffer\") {\n return (await response.arrayBuffer()) as T;\n } else {\n return (await response.json()) as T;\n }\n } catch (error) {\n // Re-throw SaynaServerError as-is\n if (error instanceof SaynaServerError) {\n throw error;\n }\n // Wrap other errors in SaynaConnectionError\n throw new SaynaConnectionError(`Failed to fetch from ${endpoint}`, error);\n }\n }\n\n /**\n * Disconnects from the Sayna WebSocket server and cleans up resources.\n */\n disconnect(): void {\n if (this.websocket) {\n // Remove event handlers to prevent memory leaks\n this.websocket.onopen = null;\n this.websocket.onmessage = null;\n this.websocket.onerror = null;\n this.websocket.onclose = null;\n\n if (this.websocket.readyState === WebSocket.OPEN) {\n this.websocket.close(1000, \"Client disconnect\");\n }\n\n this.websocket = undefined;\n }\n\n this.cleanup();\n }\n\n /**\n * Sends audio data to the server for speech recognition.\n *\n * @param audioData - Raw audio data as ArrayBuffer\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n onAudioInput(audioData: ArrayBuffer): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (!(audioData instanceof ArrayBuffer)) {\n throw new SaynaValidationError(\"audioData must be an ArrayBuffer\");\n }\n\n if (audioData.byteLength === 0) {\n throw new SaynaValidationError(\"audioData cannot be empty\");\n }\n\n try {\n this.websocket.send(audioData);\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send audio data\", error);\n }\n }\n\n /**\n * Registers a callback for speech-to-text results.\n *\n * @param callback - Function to call when STT results are received\n */\n registerOnSttResult(callback: STTResultHandler): void {\n this.sttCallback = callback;\n }\n\n /**\n * Registers a callback for text-to-speech audio data.\n *\n * @param callback - Function to call when TTS audio is received\n */\n registerOnTtsAudio(callback: TTSAudioHandler): void {\n this.ttsCallback = callback;\n }\n\n /**\n * Registers a callback for error messages.\n *\n * @param callback - Function to call when errors occur\n */\n registerOnError(callback: ErrorHandler): void {\n this.errorCallback = callback;\n }\n\n /**\n * Registers a callback for participant messages.\n *\n * @param callback - Function to call when messages are received\n */\n registerOnMessage(callback: MessageHandler): void {\n this.messageCallback = callback;\n }\n\n /**\n * Registers a callback for participant disconnection events.\n *\n * @param callback - Function to call when a participant disconnects\n */\n registerOnParticipantDisconnected(\n callback: ParticipantDisconnectedHandler\n ): void {\n this.participantDisconnectedCallback = callback;\n }\n\n /**\n * Registers a callback for TTS playback completion.\n *\n * @param callback - Function to call when TTS playback is complete\n */\n registerOnTtsPlaybackComplete(callback: TTSPlaybackCompleteHandler): void {\n this.ttsPlaybackCompleteCallback = callback;\n }\n\n /**\n * Registers a callback for SIP transfer specific errors.\n *\n * @param callback - Function to call when a SIP transfer error message is received\n */\n registerOnSipTransferError(callback: SipTransferErrorHandler): void {\n this.sipTransferErrorCallback = callback;\n }\n\n /**\n * Sends text to be synthesized as speech.\n *\n * @param text - Text to synthesize\n * @param flush - Whether to flush the TTS queue before speaking (default: true)\n * @param allowInterruption - Whether this speech can be interrupted (default: true)\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If text is not a string\n */\n speak(\n text: string,\n flush: boolean = true,\n allowInterruption: boolean = true\n ): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof text !== \"string\") {\n throw new SaynaValidationError(\"text must be a string\");\n }\n\n try {\n const speakMessage: SpeakMessage = {\n type: \"speak\",\n text,\n flush,\n allow_interruption: allowInterruption,\n };\n this.websocket.send(JSON.stringify(speakMessage));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send speak command\", error);\n }\n }\n\n /**\n * Clears the text-to-speech queue.\n *\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n clear(): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n try {\n const clearMessage: ClearMessage = {\n type: \"clear\",\n };\n this.websocket.send(JSON.stringify(clearMessage));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send clear command\", error);\n }\n }\n\n /**\n * Flushes the TTS queue by sending an empty speak command.\n *\n * @param allowInterruption - Whether the flush can be interrupted (default: true)\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n ttsFlush(allowInterruption: boolean = true): void {\n this.speak(\"\", true, allowInterruption);\n }\n\n /**\n * Sends a message to the Sayna session.\n *\n * @param message - Message content\n * @param role - Message role (e.g., \"user\", \"assistant\")\n * @param topic - Optional topic identifier\n * @param debug - Optional debug metadata\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If parameters are invalid\n */\n sendMessage(\n message: string,\n role: string,\n topic?: string,\n debug?: Record<string, unknown>\n ): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof message !== \"string\") {\n throw new SaynaValidationError(\"message must be a string\");\n }\n\n if (typeof role !== \"string\") {\n throw new SaynaValidationError(\"role must be a string\");\n }\n\n try {\n const sendMsg: SendMessageMessage = {\n type: \"send_message\",\n message,\n role,\n topic,\n debug,\n };\n this.websocket.send(JSON.stringify(sendMsg));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send message\", error);\n }\n }\n\n /**\n * Initiates a SIP transfer for the active LiveKit session.\n *\n * @param transferTo - Destination phone number or extension to transfer to\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If transferTo is not a non-empty string\n */\n sipTransfer(transferTo: string): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof transferTo !== \"string\" || transferTo.trim().length === 0) {\n throw new SaynaValidationError(\"transfer_to must be a non-empty string\");\n }\n\n try {\n const sipTransferMessage: SipTransferMessage = {\n type: \"sip_transfer\",\n transfer_to: transferTo.trim(),\n };\n this.websocket.send(JSON.stringify(sipTransferMessage));\n } catch (error) {\n throw new SaynaConnectionError(\n \"Failed to send SIP transfer command\",\n error\n );\n }\n }\n\n /**\n * Performs a health check on the Sayna server.\n *\n * @returns Promise that resolves with the health status\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const health = await client.health();\n * console.log(health.status); // \"OK\"\n * ```\n */\n async health(): Promise<HealthResponse> {\n return this.fetchFromSayna<HealthResponse>(\"\");\n }\n\n /**\n * Retrieves the catalogue of text-to-speech voices grouped by provider.\n *\n * @returns Promise that resolves with voices organized by provider\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const voices = await client.getVoices();\n * for (const [provider, voiceList] of Object.entries(voices)) {\n * console.log(`${provider}:`, voiceList.map(v => v.name));\n * }\n * ```\n */\n async getVoices(): Promise<VoicesResponse> {\n return this.fetchFromSayna<VoicesResponse>(\"voices\");\n }\n\n /**\n * Synthesizes text into audio using the REST API endpoint.\n * This is a standalone synthesis method that doesn't require an active WebSocket connection.\n *\n * @param text - Text to synthesize\n * @param ttsConfig - Text-to-speech configuration\n * @returns Promise that resolves with the audio data as ArrayBuffer\n * @throws {SaynaValidationError} If text is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const audioBuffer = await client.speakRest(\"Hello, world!\", {\n * provider: \"elevenlabs\",\n * voice_id: \"21m00Tcm4TlvDq8ikWAM\",\n * model: \"eleven_turbo_v2\",\n * speaking_rate: 1.0,\n * audio_format: \"mp3\",\n * sample_rate: 24000,\n * connection_timeout: 30,\n * request_timeout: 60,\n * pronunciations: []\n * });\n * ```\n */\n async speakRest(text: string, ttsConfig: TTSConfig): Promise<ArrayBuffer> {\n if (!text || text.trim().length === 0) {\n throw new SaynaValidationError(\"Text cannot be empty\");\n }\n\n return this.fetchFromSayna<ArrayBuffer>(\n \"speak\",\n {\n method: \"POST\",\n body: JSON.stringify({\n text,\n tts_config: ttsConfig,\n }),\n },\n \"arrayBuffer\"\n );\n }\n\n /**\n * Issues a LiveKit access token for a participant.\n *\n * @param roomName - LiveKit room to join or create\n * @param participantName - Display name assigned to the participant\n * @param participantIdentity - Unique identifier for the participant\n * @returns Promise that resolves with the LiveKit token and connection details\n * @throws {SaynaValidationError} If any parameter is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const tokenInfo = await client.getLiveKitToken(\n * \"my-room\",\n * \"John Doe\",\n * \"user-123\"\n * );\n * console.log(\"Token:\", tokenInfo.token);\n * console.log(\"LiveKit URL:\", tokenInfo.livekit_url);\n * ```\n */\n async getLiveKitToken(\n roomName: string,\n participantName: string,\n participantIdentity: string\n ): Promise<LiveKitTokenResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantName || participantName.trim().length === 0) {\n throw new SaynaValidationError(\"participant_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n return this.fetchFromSayna<LiveKitTokenResponse>(\"livekit/token\", {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName,\n participant_name: participantName,\n participant_identity: participantIdentity,\n }),\n });\n }\n\n /**\n * Downloads the recorded audio file for a completed session.\n *\n * @param streamId - The session identifier (obtained from the `streamId` getter after connection)\n * @returns Promise that resolves with the audio data as ArrayBuffer (OGG format)\n * @throws {SaynaValidationError} If streamId is empty\n * @throws {SaynaConnectionError} If the network request fails\n * @throws {SaynaServerError} If the recording is not found or server returns an error\n *\n * @example\n * ```typescript\n * // After a session completes, download the recording\n * const audioBuffer = await client.getRecording(client.streamId!);\n *\n * // Save to file (Node.js)\n * import { writeFile } from \"fs/promises\";\n * await writeFile(\"recording.ogg\", Buffer.from(audioBuffer));\n * ```\n */\n async getRecording(streamId: string): Promise<ArrayBuffer> {\n if (!streamId || streamId.trim().length === 0) {\n throw new SaynaValidationError(\"streamId cannot be empty\");\n }\n\n return this.fetchFromSayna<ArrayBuffer>(\n `recording/${encodeURIComponent(streamId)}`,\n { method: \"GET\" },\n \"arrayBuffer\"\n );\n }\n\n /**\n * Retrieves all configured SIP webhook hooks from the runtime cache.\n *\n * @returns Promise that resolves with the list of configured SIP hooks\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 500 if reading cache fails)\n *\n * @example\n * ```typescript\n * const response = await client.getSipHooks();\n * for (const hook of response.hooks) {\n * console.log(`Host: ${hook.host}, URL: ${hook.url}`);\n * }\n * ```\n */\n async getSipHooks(): Promise<SipHooksResponse> {\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\");\n }\n\n /**\n * Sets or updates SIP webhook hooks in the runtime cache.\n *\n * Hooks with matching hosts will be replaced; new hosts will be added.\n * The response contains the merged list of all hooks (existing + new).\n *\n * @param hooks - Array of SIP hook configurations to add or replace\n * @returns Promise that resolves with the merged list of all configured hooks\n * @throws {SaynaValidationError} If hooks array is empty or contains invalid entries\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 400 for duplicate hosts, 500 for cache errors)\n *\n * @example\n * ```typescript\n * const response = await client.setSipHooks([\n * { host: \"example.com\", url: \"https://webhook.example.com/events\" },\n * { host: \"another.com\", url: \"https://webhook.another.com/events\" }\n * ]);\n * console.log(\"Total hooks configured:\", response.hooks.length);\n * ```\n */\n async setSipHooks(hooks: SipHook[]): Promise<SipHooksResponse> {\n if (!Array.isArray(hooks)) {\n throw new SaynaValidationError(\"hooks must be an array\");\n }\n\n if (hooks.length === 0) {\n throw new SaynaValidationError(\"hooks array cannot be empty\");\n }\n\n for (const [i, hook] of hooks.entries()) {\n if (\n !hook.host ||\n typeof hook.host !== \"string\" ||\n hook.host.trim().length === 0\n ) {\n throw new SaynaValidationError(\n `hooks[${i}].host must be a non-empty string`\n );\n }\n if (\n !hook.url ||\n typeof hook.url !== \"string\" ||\n hook.url.trim().length === 0\n ) {\n throw new SaynaValidationError(\n `hooks[${i}].url must be a non-empty string`\n );\n }\n }\n\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\", {\n method: \"POST\",\n body: JSON.stringify({ hooks }),\n });\n }\n\n /**\n * Deletes SIP webhook hooks by host name from the runtime cache.\n *\n * If a deleted host exists in the original server configuration,\n * it will revert to its config value after deletion.\n *\n * @param hosts - Array of host names to remove (case-insensitive)\n * @returns Promise that resolves with the updated list of hooks after deletion\n * @throws {SaynaValidationError} If hosts array is empty or contains invalid entries\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 400 for empty hosts, 500 for cache errors)\n *\n * @example\n * ```typescript\n * const response = await client.deleteSipHooks([\"example.com\", \"another.com\"]);\n * console.log(\"Remaining hooks:\", response.hooks.length);\n * ```\n */\n async deleteSipHooks(hosts: string[]): Promise<SipHooksResponse> {\n if (!Array.isArray(hosts)) {\n throw new SaynaValidationError(\"hosts must be an array\");\n }\n\n if (hosts.length === 0) {\n throw new SaynaValidationError(\"hosts array cannot be empty\");\n }\n\n for (const [i, host] of hosts.entries()) {\n if (!host || typeof host !== \"string\" || host.trim().length === 0) {\n throw new SaynaValidationError(\n `hosts[${i}] must be a non-empty string`\n );\n }\n }\n\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\", {\n method: \"DELETE\",\n body: JSON.stringify({ hosts }),\n });\n }\n\n /**\n * Whether the client is ready to send/receive data.\n */\n get ready(): boolean {\n return this.isReady;\n }\n\n /**\n * Whether the client is connected to the WebSocket.\n */\n get connected(): boolean {\n return this.isConnected;\n }\n\n /**\n * LiveKit room name acknowledged by the server, if available.\n */\n get livekitRoomName(): string | undefined {\n return this._livekitRoomName;\n }\n\n /**\n * LiveKit WebSocket URL configured on the server, if available.\n */\n get livekitUrl(): string | undefined {\n return this._livekitUrl;\n }\n\n /**\n * Identity assigned to the agent participant when LiveKit is enabled, if available.\n */\n get saynaParticipantIdentity(): string | undefined {\n return this._saynaParticipantIdentity;\n }\n\n /**\n * Display name assigned to the agent participant when LiveKit is enabled, if available.\n */\n get saynaParticipantName(): string | undefined {\n return this._saynaParticipantName;\n }\n\n /**\n * Session identifier returned by the server.\n * This can be used to download recordings or correlate session data.\n * The value is available after the connection is ready.\n */\n get streamId(): string | undefined {\n return this._streamId;\n }\n}\n",
|
|
6
|
+
"import type {\n STTConfig,\n TTSConfig,\n LiveKitConfig,\n ConfigMessage,\n SpeakMessage,\n ClearMessage,\n SendMessageMessage,\n STTResultMessage,\n ErrorMessage,\n SipTransferErrorMessage,\n SipTransferMessage,\n OutgoingMessage,\n SaynaMessage,\n Participant,\n VoicesResponse,\n HealthResponse,\n LiveKitTokenResponse,\n LiveKitRoomsResponse,\n LiveKitRoomDetails,\n SipHook,\n SipHooksResponse,\n RemoveLiveKitParticipantResponse,\n MuteLiveKitParticipantResponse,\n SipTransferResponse,\n} from \"./types\";\nimport {\n SaynaNotConnectedError,\n SaynaNotReadyError,\n SaynaConnectionError,\n SaynaValidationError,\n SaynaServerError,\n} from \"./errors\";\n\n// Node.js 18+ has native fetch support\ndeclare const fetch: typeof globalThis.fetch;\n\n/**\n * Event handler for speech-to-text results.\n */\nexport type STTResultHandler = (\n result: STTResultMessage\n) => void | Promise<void>;\n\n/**\n * Event handler for text-to-speech audio data.\n */\nexport type TTSAudioHandler = (audio: ArrayBuffer) => void | Promise<void>;\n\n/**\n * Event handler for error messages.\n */\nexport type ErrorHandler = (error: ErrorMessage) => void | Promise<void>;\n\n/**\n * Event handler for participant messages.\n */\nexport type MessageHandler = (message: SaynaMessage) => void | Promise<void>;\n\n/**\n * Event handler for participant disconnections.\n */\nexport type ParticipantDisconnectedHandler = (\n participant: Participant\n) => void | Promise<void>;\n\n/**\n * Event handler for TTS playback completion.\n */\nexport type TTSPlaybackCompleteHandler = (\n timestamp: number\n) => void | Promise<void>;\n\n/**\n * Event handler for SIP transfer specific errors.\n */\nexport type SipTransferErrorHandler = (\n error: SipTransferErrorMessage\n) => void | Promise<void>;\n\n/**\n * Client for connecting to Sayna WebSocket server for real-time voice interactions.\n *\n * @example\n * ```typescript\n * const client = await saynaConnect(\n * \"https://api.sayna.ai\",\n * sttConfig,\n * ttsConfig\n * );\n *\n * client.registerOnSttResult((result) => {\n * console.log(\"Transcription:\", result.transcript);\n * });\n *\n * await client.speak(\"Hello, world!\");\n * ```\n */\nexport class SaynaClient {\n private url: string;\n private sttConfig?: STTConfig;\n private ttsConfig?: TTSConfig;\n private livekitConfig?: LiveKitConfig;\n private withoutAudio: boolean;\n private apiKey?: string;\n private websocket?: WebSocket;\n private isConnected: boolean = false;\n private isReady: boolean = false;\n private _livekitRoomName?: string;\n private _livekitUrl?: string;\n private _saynaParticipantIdentity?: string;\n private _saynaParticipantName?: string;\n private _streamId?: string;\n private inputStreamId?: string;\n private sttCallback?: STTResultHandler;\n private ttsCallback?: TTSAudioHandler;\n private errorCallback?: ErrorHandler;\n private messageCallback?: MessageHandler;\n private participantDisconnectedCallback?: ParticipantDisconnectedHandler;\n private ttsPlaybackCompleteCallback?: TTSPlaybackCompleteHandler;\n private sipTransferErrorCallback?: SipTransferErrorHandler;\n private readyPromiseResolve?: () => void;\n private readyPromiseReject?: (error: Error) => void;\n\n /**\n * Creates a new SaynaClient instance.\n *\n * @param url - The Sayna server URL (e.g., \"https://api.sayna.ai\")\n * @param sttConfig - Speech-to-text configuration (required when withoutAudio=false)\n * @param ttsConfig - Text-to-speech configuration (required when withoutAudio=false)\n * @param livekitConfig - Optional LiveKit room configuration\n * @param withoutAudio - If true, disables audio streaming (default: false)\n * @param apiKey - Optional API key used to authorize HTTP and WebSocket calls (defaults to SAYNA_API_KEY env)\n * @param streamId - Optional session identifier for recording paths; server generates a UUID when omitted\n *\n * @throws {SaynaValidationError} If URL is invalid or if audio configs are missing when audio is enabled\n */\n constructor(\n url: string,\n sttConfig?: STTConfig,\n ttsConfig?: TTSConfig,\n livekitConfig?: LiveKitConfig,\n withoutAudio: boolean = false,\n apiKey?: string,\n streamId?: string\n ) {\n // Validate URL\n if (!url || typeof url !== \"string\") {\n throw new SaynaValidationError(\"URL must be a non-empty string\");\n }\n if (\n !url.startsWith(\"http://\") &&\n !url.startsWith(\"https://\") &&\n !url.startsWith(\"ws://\") &&\n !url.startsWith(\"wss://\")\n ) {\n throw new SaynaValidationError(\n \"URL must start with http://, https://, ws://, or wss://\"\n );\n }\n\n // Validate audio config requirements\n if (!withoutAudio) {\n if (!sttConfig || !ttsConfig) {\n throw new SaynaValidationError(\n \"sttConfig and ttsConfig are required when withoutAudio=false (audio streaming enabled). \" +\n \"Either provide both configs or set withoutAudio=true for non-audio use cases.\"\n );\n }\n }\n\n this.url = url;\n this.sttConfig = sttConfig;\n this.ttsConfig = ttsConfig;\n this.livekitConfig = livekitConfig;\n this.withoutAudio = withoutAudio;\n this.apiKey = apiKey ?? process.env.SAYNA_API_KEY;\n this.inputStreamId = streamId;\n }\n\n /**\n * Establishes connection to the Sayna WebSocket server.\n *\n * @throws {SaynaConnectionError} If connection fails\n * @returns Promise that resolves when the connection is ready\n */\n async connect(): Promise<void> {\n if (this.isConnected) {\n return;\n }\n\n // Convert HTTP(S) URL to WebSocket URL\n const wsUrl =\n this.url.replace(/^https:\\/\\//, \"wss://\").replace(/^http:\\/\\//, \"ws://\") +\n (this.url.endsWith(\"/\") ? \"ws\" : \"/ws\");\n\n return new Promise((resolve, reject) => {\n this.readyPromiseResolve = resolve;\n this.readyPromiseReject = reject;\n\n try {\n const headers = this.apiKey\n ? { Authorization: `Bearer ${this.apiKey}` }\n : undefined;\n\n const WebSocketConstructor = WebSocket as unknown as {\n new (\n url: string,\n protocols?: string | string[],\n options?: { headers?: Record<string, string> }\n ): WebSocket;\n };\n\n this.websocket = headers\n ? new WebSocketConstructor(wsUrl, undefined, { headers })\n : new WebSocket(wsUrl);\n\n this.websocket.onopen = () => {\n this.isConnected = true;\n\n // Send initial configuration\n const configMessage: ConfigMessage = {\n type: \"config\",\n stream_id: this.inputStreamId,\n stt_config: this.sttConfig,\n tts_config: this.ttsConfig,\n livekit: this.livekitConfig,\n audio: !this.withoutAudio,\n };\n\n try {\n if (this.websocket) {\n this.websocket.send(JSON.stringify(configMessage));\n }\n } catch (error) {\n this.cleanup();\n const err = new SaynaConnectionError(\n \"Failed to send configuration\",\n error\n );\n if (this.readyPromiseReject) {\n this.readyPromiseReject(err);\n }\n }\n };\n\n this.websocket.onmessage = async (event) => {\n try {\n if (\n event.data instanceof Blob ||\n event.data instanceof ArrayBuffer\n ) {\n // Binary TTS audio data\n const buffer =\n event.data instanceof Blob\n ? await event.data.arrayBuffer()\n : event.data;\n if (this.ttsCallback) {\n await this.ttsCallback(buffer);\n }\n } else {\n // JSON control messages\n if (typeof event.data !== \"string\") {\n throw new Error(\"Expected string data for JSON messages\");\n }\n const data = JSON.parse(event.data) as OutgoingMessage;\n await this.handleJsonMessage(data);\n }\n } catch (error) {\n // Log parse errors but don't break the connection\n if (this.errorCallback) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n await this.errorCallback({\n type: \"error\",\n message: `Failed to process message: ${errorMessage}`,\n });\n }\n }\n };\n\n this.websocket.onerror = () => {\n const error = new SaynaConnectionError(\"WebSocket connection error\");\n if (this.readyPromiseReject && !this.isReady) {\n this.readyPromiseReject(error);\n }\n };\n\n this.websocket.onclose = (event) => {\n const wasReady = this.isReady;\n this.cleanup();\n\n // If connection closed before ready, reject the promise\n if (!wasReady && this.readyPromiseReject) {\n this.readyPromiseReject(\n new SaynaConnectionError(\n `WebSocket closed before ready (code: ${event.code}, reason: ${event.reason || \"none\"})`\n )\n );\n }\n };\n } catch (error) {\n reject(new SaynaConnectionError(\"Failed to create WebSocket\", error));\n }\n });\n }\n\n /**\n * Handles incoming JSON messages from the WebSocket.\n * @internal\n */\n private async handleJsonMessage(data: OutgoingMessage): Promise<void> {\n const messageType = data.type;\n\n try {\n switch (messageType) {\n case \"ready\": {\n const readyMsg = data;\n this.isReady = true;\n this._livekitRoomName = readyMsg.livekit_room_name;\n this._livekitUrl = readyMsg.livekit_url;\n this._saynaParticipantIdentity = readyMsg.sayna_participant_identity;\n this._saynaParticipantName = readyMsg.sayna_participant_name;\n this._streamId = readyMsg.stream_id;\n if (this.readyPromiseResolve) {\n this.readyPromiseResolve();\n }\n break;\n }\n\n case \"stt_result\": {\n const sttResult = data;\n if (this.sttCallback) {\n await this.sttCallback(sttResult);\n }\n break;\n }\n\n case \"error\": {\n const errorMsg = data;\n if (this.errorCallback) {\n await this.errorCallback(errorMsg);\n }\n if (this.readyPromiseReject && !this.isReady) {\n this.readyPromiseReject(new SaynaServerError(errorMsg.message));\n }\n break;\n }\n\n case \"sip_transfer_error\": {\n const sipTransferError = data;\n if (this.sipTransferErrorCallback) {\n await this.sipTransferErrorCallback(sipTransferError);\n } else if (this.errorCallback) {\n await this.errorCallback({\n type: \"error\",\n message: sipTransferError.message,\n });\n }\n break;\n }\n\n case \"message\": {\n const messageData = data;\n if (this.messageCallback) {\n await this.messageCallback(messageData.message);\n }\n break;\n }\n\n case \"participant_disconnected\": {\n const participantMsg = data;\n if (this.participantDisconnectedCallback) {\n await this.participantDisconnectedCallback(\n participantMsg.participant\n );\n }\n break;\n }\n\n case \"tts_playback_complete\": {\n const ttsPlaybackCompleteMsg = data;\n if (this.ttsPlaybackCompleteCallback) {\n await this.ttsPlaybackCompleteCallback(\n ttsPlaybackCompleteMsg.timestamp\n );\n }\n break;\n }\n\n default: {\n const unknownMessage = data as { type: string };\n const errorMessage = `Unknown message type received: ${unknownMessage.type}`;\n if (this.errorCallback) {\n await this.errorCallback({ type: \"error\", message: errorMessage });\n } else {\n console.warn(errorMessage);\n }\n }\n }\n } catch (error) {\n // Notify error callback if handler fails\n if (this.errorCallback) {\n await this.errorCallback({\n type: \"error\",\n message: `Handler error: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n }\n }\n\n /**\n * Cleans up internal state.\n * @internal\n */\n private cleanup(): void {\n this.isConnected = false;\n this.isReady = false;\n this._livekitRoomName = undefined;\n this._livekitUrl = undefined;\n this._saynaParticipantIdentity = undefined;\n this._saynaParticipantName = undefined;\n this._streamId = undefined;\n }\n\n /**\n * Converts WebSocket URL to HTTP URL for REST API calls.\n * @internal\n */\n private getHttpUrl(): string {\n return this.url\n .replace(/^ws:\\/\\//, \"http://\")\n .replace(/^wss:\\/\\//, \"https://\");\n }\n\n /**\n * Generic fetch helper for making REST API calls to Sayna server.\n * Handles URL construction, headers, error responses, and type conversion.\n * @internal\n *\n * @param endpoint - API endpoint path (e.g., \"/voices\", \"/speak\")\n * @param options - Fetch options including method, body, headers, etc.\n * @param responseType - Expected response type: \"json\" or \"arrayBuffer\"\n * @returns Promise resolving to the parsed response\n * @throws {SaynaConnectionError} If the network request fails\n * @throws {SaynaServerError} If the server returns an error response\n */\n private async fetchFromSayna<T>(\n endpoint: string,\n options: RequestInit = {},\n responseType: \"json\" | \"arrayBuffer\" = \"json\"\n ): Promise<T> {\n const httpUrl = this.getHttpUrl();\n const url = `${httpUrl}${httpUrl.endsWith(\"/\") ? \"\" : \"/\"}${endpoint.startsWith(\"/\") ? endpoint.slice(1) : endpoint}`;\n\n // Merge default headers with user-provided headers\n const headers: Record<string, string> = {\n ...(options.headers as Record<string, string>),\n };\n\n // Add Authorization header when an API key is provided, unless user supplied one\n const hasAuthHeader = Object.keys(headers).some(\n (key) => key.toLowerCase() === \"authorization\"\n );\n if (this.apiKey && !hasAuthHeader) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n\n // Add Content-Type for JSON requests with body if not already set\n if (options.body && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n try {\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n if (!response.ok) {\n // Try to parse error message from JSON response\n let errorMessage: string;\n try {\n const errorData: unknown = await response.json();\n errorMessage =\n errorData &&\n typeof errorData === \"object\" &&\n \"error\" in errorData &&\n typeof errorData.error === \"string\"\n ? errorData.error\n : `Request failed: ${response.status} ${response.statusText}`;\n } catch {\n errorMessage = `Request failed: ${response.status} ${response.statusText}`;\n }\n throw new SaynaServerError(errorMessage);\n }\n\n // Parse response based on expected type\n if (responseType === \"arrayBuffer\") {\n return (await response.arrayBuffer()) as T;\n } else {\n return (await response.json()) as T;\n }\n } catch (error) {\n // Re-throw SaynaServerError as-is\n if (error instanceof SaynaServerError) {\n throw error;\n }\n // Wrap other errors in SaynaConnectionError\n throw new SaynaConnectionError(`Failed to fetch from ${endpoint}`, error);\n }\n }\n\n /**\n * Disconnects from the Sayna WebSocket server and cleans up resources.\n */\n disconnect(): void {\n if (this.websocket) {\n // Remove event handlers to prevent memory leaks\n this.websocket.onopen = null;\n this.websocket.onmessage = null;\n this.websocket.onerror = null;\n this.websocket.onclose = null;\n\n if (this.websocket.readyState === WebSocket.OPEN) {\n this.websocket.close(1000, \"Client disconnect\");\n }\n\n this.websocket = undefined;\n }\n\n this.cleanup();\n }\n\n /**\n * Sends audio data to the server for speech recognition.\n *\n * @param audioData - Raw audio data as ArrayBuffer\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n onAudioInput(audioData: ArrayBuffer): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (!(audioData instanceof ArrayBuffer)) {\n throw new SaynaValidationError(\"audioData must be an ArrayBuffer\");\n }\n\n if (audioData.byteLength === 0) {\n throw new SaynaValidationError(\"audioData cannot be empty\");\n }\n\n try {\n this.websocket.send(audioData);\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send audio data\", error);\n }\n }\n\n /**\n * Registers a callback for speech-to-text results.\n *\n * @param callback - Function to call when STT results are received\n */\n registerOnSttResult(callback: STTResultHandler): void {\n this.sttCallback = callback;\n }\n\n /**\n * Registers a callback for text-to-speech audio data.\n *\n * @param callback - Function to call when TTS audio is received\n */\n registerOnTtsAudio(callback: TTSAudioHandler): void {\n this.ttsCallback = callback;\n }\n\n /**\n * Registers a callback for error messages.\n *\n * @param callback - Function to call when errors occur\n */\n registerOnError(callback: ErrorHandler): void {\n this.errorCallback = callback;\n }\n\n /**\n * Registers a callback for participant messages.\n *\n * @param callback - Function to call when messages are received\n */\n registerOnMessage(callback: MessageHandler): void {\n this.messageCallback = callback;\n }\n\n /**\n * Registers a callback for participant disconnection events.\n *\n * @param callback - Function to call when a participant disconnects\n */\n registerOnParticipantDisconnected(\n callback: ParticipantDisconnectedHandler\n ): void {\n this.participantDisconnectedCallback = callback;\n }\n\n /**\n * Registers a callback for TTS playback completion.\n *\n * @param callback - Function to call when TTS playback is complete\n */\n registerOnTtsPlaybackComplete(callback: TTSPlaybackCompleteHandler): void {\n this.ttsPlaybackCompleteCallback = callback;\n }\n\n /**\n * Registers a callback for SIP transfer specific errors.\n *\n * @param callback - Function to call when a SIP transfer error message is received\n */\n registerOnSipTransferError(callback: SipTransferErrorHandler): void {\n this.sipTransferErrorCallback = callback;\n }\n\n /**\n * Sends text to be synthesized as speech.\n *\n * @param text - Text to synthesize\n * @param flush - Whether to flush the TTS queue before speaking (default: true)\n * @param allowInterruption - Whether this speech can be interrupted (default: true)\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If text is not a string\n */\n speak(\n text: string,\n flush: boolean = true,\n allowInterruption: boolean = true\n ): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof text !== \"string\") {\n throw new SaynaValidationError(\"text must be a string\");\n }\n\n try {\n const speakMessage: SpeakMessage = {\n type: \"speak\",\n text,\n flush,\n allow_interruption: allowInterruption,\n };\n this.websocket.send(JSON.stringify(speakMessage));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send speak command\", error);\n }\n }\n\n /**\n * Clears the text-to-speech queue.\n *\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n clear(): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n try {\n const clearMessage: ClearMessage = {\n type: \"clear\",\n };\n this.websocket.send(JSON.stringify(clearMessage));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send clear command\", error);\n }\n }\n\n /**\n * Flushes the TTS queue by sending an empty speak command.\n *\n * @param allowInterruption - Whether the flush can be interrupted (default: true)\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n ttsFlush(allowInterruption: boolean = true): void {\n this.speak(\"\", true, allowInterruption);\n }\n\n /**\n * Sends a message to the Sayna session.\n *\n * @param message - Message content\n * @param role - Message role (e.g., \"user\", \"assistant\")\n * @param topic - Optional topic identifier\n * @param debug - Optional debug metadata\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If parameters are invalid\n */\n sendMessage(\n message: string,\n role: string,\n topic?: string,\n debug?: Record<string, unknown>\n ): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof message !== \"string\") {\n throw new SaynaValidationError(\"message must be a string\");\n }\n\n if (typeof role !== \"string\") {\n throw new SaynaValidationError(\"role must be a string\");\n }\n\n try {\n const sendMsg: SendMessageMessage = {\n type: \"send_message\",\n message,\n role,\n topic,\n debug,\n };\n this.websocket.send(JSON.stringify(sendMsg));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send message\", error);\n }\n }\n\n /**\n * Initiates a SIP transfer for the active LiveKit session.\n *\n * @param transferTo - Destination phone number or extension to transfer to\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If transferTo is not a non-empty string\n */\n sipTransfer(transferTo: string): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof transferTo !== \"string\" || transferTo.trim().length === 0) {\n throw new SaynaValidationError(\"transfer_to must be a non-empty string\");\n }\n\n try {\n const sipTransferMessage: SipTransferMessage = {\n type: \"sip_transfer\",\n transfer_to: transferTo.trim(),\n };\n this.websocket.send(JSON.stringify(sipTransferMessage));\n } catch (error) {\n throw new SaynaConnectionError(\n \"Failed to send SIP transfer command\",\n error\n );\n }\n }\n\n /**\n * Performs a health check on the Sayna server.\n *\n * @returns Promise that resolves with the health status\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const health = await client.health();\n * console.log(health.status); // \"OK\"\n * ```\n */\n async health(): Promise<HealthResponse> {\n return this.fetchFromSayna<HealthResponse>(\"\");\n }\n\n /**\n * Retrieves the catalogue of text-to-speech voices grouped by provider.\n *\n * @returns Promise that resolves with voices organized by provider\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const voices = await client.getVoices();\n * for (const [provider, voiceList] of Object.entries(voices)) {\n * console.log(`${provider}:`, voiceList.map(v => v.name));\n * }\n * ```\n */\n async getVoices(): Promise<VoicesResponse> {\n return this.fetchFromSayna<VoicesResponse>(\"voices\");\n }\n\n /**\n * Synthesizes text into audio using the REST API endpoint.\n * This is a standalone synthesis method that doesn't require an active WebSocket connection.\n *\n * @param text - Text to synthesize\n * @param ttsConfig - Text-to-speech configuration\n * @returns Promise that resolves with the audio data as ArrayBuffer\n * @throws {SaynaValidationError} If text is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const audioBuffer = await client.speakRest(\"Hello, world!\", {\n * provider: \"elevenlabs\",\n * voice_id: \"21m00Tcm4TlvDq8ikWAM\",\n * model: \"eleven_turbo_v2\",\n * speaking_rate: 1.0,\n * audio_format: \"mp3\",\n * sample_rate: 24000,\n * connection_timeout: 30,\n * request_timeout: 60,\n * pronunciations: []\n * });\n * ```\n */\n async speakRest(text: string, ttsConfig: TTSConfig): Promise<ArrayBuffer> {\n if (!text || text.trim().length === 0) {\n throw new SaynaValidationError(\"Text cannot be empty\");\n }\n\n return this.fetchFromSayna<ArrayBuffer>(\n \"speak\",\n {\n method: \"POST\",\n body: JSON.stringify({\n text,\n tts_config: ttsConfig,\n }),\n },\n \"arrayBuffer\"\n );\n }\n\n /**\n * Issues a LiveKit access token for a participant.\n *\n * @param roomName - LiveKit room to join or create\n * @param participantName - Display name assigned to the participant\n * @param participantIdentity - Unique identifier for the participant\n * @returns Promise that resolves with the LiveKit token and connection details\n * @throws {SaynaValidationError} If any parameter is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const tokenInfo = await client.getLiveKitToken(\n * \"my-room\",\n * \"John Doe\",\n * \"user-123\"\n * );\n * console.log(\"Token:\", tokenInfo.token);\n * console.log(\"LiveKit URL:\", tokenInfo.livekit_url);\n * ```\n */\n async getLiveKitToken(\n roomName: string,\n participantName: string,\n participantIdentity: string\n ): Promise<LiveKitTokenResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantName || participantName.trim().length === 0) {\n throw new SaynaValidationError(\"participant_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n return this.fetchFromSayna<LiveKitTokenResponse>(\"livekit/token\", {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName,\n participant_name: participantName,\n participant_identity: participantIdentity,\n }),\n });\n }\n\n /**\n * Lists all LiveKit rooms belonging to the authenticated tenant.\n *\n * Room names are automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. Only rooms matching your tenant prefix are returned.\n *\n * @returns Promise that resolves with the list of rooms\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., LiveKit not configured)\n *\n * @example\n * ```typescript\n * const response = await client.getLiveKitRooms();\n * for (const room of response.rooms) {\n * console.log(`Room: ${room.name}, Participants: ${room.num_participants}`);\n * }\n * ```\n */\n async getLiveKitRooms(): Promise<LiveKitRoomsResponse> {\n return this.fetchFromSayna<LiveKitRoomsResponse>(\"livekit/rooms\");\n }\n\n /**\n * Retrieves detailed information about a specific LiveKit room including participants.\n *\n * The room name is automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. You should provide the room name without the tenant prefix.\n *\n * @param roomName - Name of the room to retrieve (without tenant prefix)\n * @returns Promise that resolves with detailed room information including participants\n * @throws {SaynaValidationError} If roomName is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., room not found, LiveKit not configured)\n *\n * @example\n * ```typescript\n * const room = await client.getLiveKitRoom(\"my-room\");\n * console.log(`Room: ${room.name}, SID: ${room.sid}`);\n * console.log(`Participants: ${room.num_participants}/${room.max_participants}`);\n * for (const participant of room.participants) {\n * console.log(` - ${participant.name} (${participant.identity}): ${participant.state}`);\n * }\n * ```\n */\n async getLiveKitRoom(roomName: string): Promise<LiveKitRoomDetails> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n const encoded = encodeURIComponent(roomName.trim());\n return this.fetchFromSayna<LiveKitRoomDetails>(`livekit/rooms/${encoded}`);\n }\n\n /**\n * Removes a participant from a LiveKit room, forcibly disconnecting them.\n *\n * The room name is automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. You should provide the room name without the tenant prefix.\n *\n * **Important:** This does not invalidate the participant's token. To prevent\n * rejoining, use short-lived tokens and avoid issuing new tokens to removed participants.\n *\n * @param roomName - Name of the room where the participant is connected (without tenant prefix)\n * @param participantIdentity - The identity of the participant to remove\n * @returns Promise that resolves with the removal confirmation\n * @throws {SaynaValidationError} If roomName or participantIdentity is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., participant not found, LiveKit not configured)\n *\n * @example\n * ```typescript\n * const result = await client.removeLiveKitParticipant(\"my-room\", \"user-alice-456\");\n * console.log(`Status: ${result.status}`);\n * console.log(`Removed from room: ${result.room_name}`);\n * console.log(`Participant: ${result.participant_identity}`);\n * ```\n */\n async removeLiveKitParticipant(\n roomName: string,\n participantIdentity: string\n ): Promise<RemoveLiveKitParticipantResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n return this.fetchFromSayna<RemoveLiveKitParticipantResponse>(\n \"livekit/participant\",\n {\n method: \"DELETE\",\n body: JSON.stringify({\n room_name: roomName.trim(),\n participant_identity: participantIdentity.trim(),\n }),\n }\n );\n }\n\n /**\n * Mutes or unmutes a participant's published track in a LiveKit room.\n *\n * The room name is automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. You should provide the room name without the tenant prefix.\n *\n * @param roomName - Name of the room where the participant is connected (without tenant prefix)\n * @param participantIdentity - The identity of the participant whose track to mute\n * @param trackSid - The session ID of the track to mute/unmute\n * @param muted - True to mute, false to unmute\n * @returns Promise that resolves with the mute operation result\n * @throws {SaynaValidationError} If roomName, participantIdentity, or trackSid is empty, or if muted is not a boolean\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., track or participant not found, LiveKit not configured)\n *\n * @example\n * ```typescript\n * // Mute a participant's track\n * const result = await client.muteLiveKitParticipantTrack(\n * \"my-room\",\n * \"user-alice-456\",\n * \"TR_abc123\",\n * true\n * );\n * console.log(`Track ${result.track_sid} muted: ${result.muted}`);\n *\n * // Unmute the track\n * const unmuteResult = await client.muteLiveKitParticipantTrack(\n * \"my-room\",\n * \"user-alice-456\",\n * \"TR_abc123\",\n * false\n * );\n * ```\n */\n async muteLiveKitParticipantTrack(\n roomName: string,\n participantIdentity: string,\n trackSid: string,\n muted: boolean\n ): Promise<MuteLiveKitParticipantResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n if (!trackSid || trackSid.trim().length === 0) {\n throw new SaynaValidationError(\"track_sid cannot be empty\");\n }\n\n if (typeof muted !== \"boolean\") {\n throw new SaynaValidationError(\"muted must be a boolean\");\n }\n\n return this.fetchFromSayna<MuteLiveKitParticipantResponse>(\n \"livekit/participant/mute\",\n {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName.trim(),\n participant_identity: participantIdentity.trim(),\n track_sid: trackSid.trim(),\n muted,\n }),\n }\n );\n }\n\n /**\n * Initiates a SIP call transfer via the REST API endpoint.\n *\n * This is distinct from the WebSocket `sipTransfer()` method. Use this REST endpoint\n * when you need to transfer a SIP call from outside the active WebSocket session,\n * or when you want to specify a particular room and participant explicitly.\n *\n * The room name is automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. You should provide the room name without the tenant prefix.\n *\n * **Important Notes:**\n * - Only SIP participants can be transferred\n * - A successful response indicates the transfer has been **initiated**, not necessarily completed\n * - The actual transfer may take several seconds\n *\n * @param roomName - Name of the room where the SIP participant is connected (without tenant prefix)\n * @param participantIdentity - The identity of the SIP participant to transfer\n * @param transferTo - The phone number to transfer to (international, national, or extension format)\n * @returns Promise that resolves with the transfer status\n * @throws {SaynaValidationError} If roomName, participantIdentity, or transferTo is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., invalid phone, participant not found)\n *\n * @example\n * ```typescript\n * // Transfer a SIP participant to another phone number\n * const result = await client.sipTransferRest(\n * \"call-room-123\",\n * \"sip_participant_456\",\n * \"+15551234567\"\n * );\n * console.log(`Transfer status: ${result.status}`);\n * console.log(`Transferred to: ${result.transfer_to}`);\n * ```\n */\n async sipTransferRest(\n roomName: string,\n participantIdentity: string,\n transferTo: string\n ): Promise<SipTransferResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n if (!transferTo || transferTo.trim().length === 0) {\n throw new SaynaValidationError(\"transfer_to cannot be empty\");\n }\n\n return this.fetchFromSayna<SipTransferResponse>(\"sip/transfer\", {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName.trim(),\n participant_identity: participantIdentity.trim(),\n transfer_to: transferTo.trim(),\n }),\n });\n }\n\n /**\n * Downloads the recorded audio file for a completed session.\n *\n * @param streamId - The session identifier (obtained from the `streamId` getter after connection)\n * @returns Promise that resolves with the audio data as ArrayBuffer (OGG format)\n * @throws {SaynaValidationError} If streamId is empty\n * @throws {SaynaConnectionError} If the network request fails\n * @throws {SaynaServerError} If the recording is not found or server returns an error\n *\n * @example\n * ```typescript\n * // After a session completes, download the recording\n * const audioBuffer = await client.getRecording(client.streamId!);\n *\n * // Save to file (Node.js)\n * import { writeFile } from \"fs/promises\";\n * await writeFile(\"recording.ogg\", Buffer.from(audioBuffer));\n * ```\n */\n async getRecording(streamId: string): Promise<ArrayBuffer> {\n if (!streamId || streamId.trim().length === 0) {\n throw new SaynaValidationError(\"streamId cannot be empty\");\n }\n\n return this.fetchFromSayna<ArrayBuffer>(\n `recording/${encodeURIComponent(streamId)}`,\n { method: \"GET\" },\n \"arrayBuffer\"\n );\n }\n\n /**\n * Retrieves all configured SIP webhook hooks from the runtime cache.\n *\n * @returns Promise that resolves with the list of configured SIP hooks\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 500 if reading cache fails)\n *\n * @example\n * ```typescript\n * const response = await client.getSipHooks();\n * for (const hook of response.hooks) {\n * console.log(`Host: ${hook.host}, URL: ${hook.url}`);\n * }\n * ```\n */\n async getSipHooks(): Promise<SipHooksResponse> {\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\");\n }\n\n /**\n * Sets or updates SIP webhook hooks in the runtime cache.\n *\n * Hooks with matching hosts will be replaced; new hosts will be added.\n * The response contains the merged list of all hooks (existing + new).\n *\n * @param hooks - Array of SIP hook configurations to add or replace\n * @returns Promise that resolves with the merged list of all configured hooks\n * @throws {SaynaValidationError} If hooks array is empty or contains invalid entries\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 400 for duplicate hosts, 500 for cache errors)\n *\n * @example\n * ```typescript\n * const response = await client.setSipHooks([\n * { host: \"example.com\", url: \"https://webhook.example.com/events\" },\n * { host: \"another.com\", url: \"https://webhook.another.com/events\" }\n * ]);\n * console.log(\"Total hooks configured:\", response.hooks.length);\n * ```\n */\n async setSipHooks(hooks: SipHook[]): Promise<SipHooksResponse> {\n if (!Array.isArray(hooks)) {\n throw new SaynaValidationError(\"hooks must be an array\");\n }\n\n if (hooks.length === 0) {\n throw new SaynaValidationError(\"hooks array cannot be empty\");\n }\n\n for (const [i, hook] of hooks.entries()) {\n if (\n !hook.host ||\n typeof hook.host !== \"string\" ||\n hook.host.trim().length === 0\n ) {\n throw new SaynaValidationError(\n `hooks[${i}].host must be a non-empty string`\n );\n }\n if (\n !hook.url ||\n typeof hook.url !== \"string\" ||\n hook.url.trim().length === 0\n ) {\n throw new SaynaValidationError(\n `hooks[${i}].url must be a non-empty string`\n );\n }\n }\n\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\", {\n method: \"POST\",\n body: JSON.stringify({ hooks }),\n });\n }\n\n /**\n * Deletes SIP webhook hooks by host name from the runtime cache.\n *\n * If a deleted host exists in the original server configuration,\n * it will revert to its config value after deletion.\n *\n * @param hosts - Array of host names to remove (case-insensitive)\n * @returns Promise that resolves with the updated list of hooks after deletion\n * @throws {SaynaValidationError} If hosts array is empty or contains invalid entries\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 400 for empty hosts, 500 for cache errors)\n *\n * @example\n * ```typescript\n * const response = await client.deleteSipHooks([\"example.com\", \"another.com\"]);\n * console.log(\"Remaining hooks:\", response.hooks.length);\n * ```\n */\n async deleteSipHooks(hosts: string[]): Promise<SipHooksResponse> {\n if (!Array.isArray(hosts)) {\n throw new SaynaValidationError(\"hosts must be an array\");\n }\n\n if (hosts.length === 0) {\n throw new SaynaValidationError(\"hosts array cannot be empty\");\n }\n\n for (const [i, host] of hosts.entries()) {\n if (!host || typeof host !== \"string\" || host.trim().length === 0) {\n throw new SaynaValidationError(\n `hosts[${i}] must be a non-empty string`\n );\n }\n }\n\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\", {\n method: \"DELETE\",\n body: JSON.stringify({ hosts }),\n });\n }\n\n /**\n * Whether the client is ready to send/receive data.\n */\n get ready(): boolean {\n return this.isReady;\n }\n\n /**\n * Whether the client is connected to the WebSocket.\n */\n get connected(): boolean {\n return this.isConnected;\n }\n\n /**\n * LiveKit room name acknowledged by the server, if available.\n */\n get livekitRoomName(): string | undefined {\n return this._livekitRoomName;\n }\n\n /**\n * LiveKit WebSocket URL configured on the server, if available.\n */\n get livekitUrl(): string | undefined {\n return this._livekitUrl;\n }\n\n /**\n * Identity assigned to the agent participant when LiveKit is enabled, if available.\n */\n get saynaParticipantIdentity(): string | undefined {\n return this._saynaParticipantIdentity;\n }\n\n /**\n * Display name assigned to the agent participant when LiveKit is enabled, if available.\n */\n get saynaParticipantName(): string | undefined {\n return this._saynaParticipantName;\n }\n\n /**\n * Session identifier returned by the server.\n * This can be used to download recordings or correlate session data.\n * The value is available after the connection is ready.\n */\n get streamId(): string | undefined {\n return this._streamId;\n }\n}\n",
|
|
7
7
|
"import { createHmac, timingSafeEqual } from \"crypto\";\nimport { SaynaValidationError } from \"./errors\";\nimport type { WebhookSIPOutput } from \"./types\";\n\n/**\n * Minimum required secret length in characters for security.\n * @internal\n */\nconst MIN_SECRET_LENGTH = 16;\n\n/**\n * Maximum allowed time difference in seconds for replay protection.\n * Webhooks with timestamps outside this window will be rejected.\n * @internal\n */\nconst TIMESTAMP_TOLERANCE_SECONDS = 300; // 5 minutes\n\n/**\n * Receives and verifies cryptographically signed webhooks from Sayna SIP service.\n *\n * This class handles the secure verification of webhook signatures using HMAC-SHA256,\n * validates timestamp freshness to prevent replay attacks, and parses the webhook\n * payload into a strongly-typed WebhookSIPOutput object.\n *\n * ## Security Features\n *\n * - **HMAC-SHA256 Signature Verification**: Ensures webhook authenticity\n * - **Constant-Time Comparison**: Prevents timing attack vulnerabilities\n * - **Replay Protection**: 5-minute timestamp window prevents replay attacks\n * - **Strict Validation**: Comprehensive checks on all required fields\n *\n * ## Usage\n *\n * ### Basic Example\n *\n * ```typescript\n * import { WebhookReceiver } from \"@sayna-ai/node-sdk\";\n *\n * // Initialize with secret (or uses SAYNA_WEBHOOK_SECRET env variable)\n * const receiver = new WebhookReceiver(\"your-secret-key-min-16-chars\");\n *\n * // In your Express route handler\n * app.post('/webhook', express.json({ verify: (req, res, buf) => {\n * req.rawBody = buf.toString('utf8');\n * }}), (req, res) => {\n * try {\n * const webhook = receiver.receive(req.headers, req.rawBody);\n *\n * console.log('Valid webhook received:');\n * console.log(' From:', webhook.from_phone_number);\n * console.log(' To:', webhook.to_phone_number);\n * console.log(' Room:', webhook.room.name);\n * console.log(' SIP Host:', webhook.sip_host);\n * console.log(' Participant:', webhook.participant.identity);\n *\n * res.status(200).json({ received: true });\n * } catch (error) {\n * console.error('Webhook verification failed:', error.message);\n * res.status(401).json({ error: 'Invalid signature' });\n * }\n * });\n * ```\n *\n * ### With Environment Variable\n *\n * ```typescript\n * // Set environment variable\n * process.env.SAYNA_WEBHOOK_SECRET = \"your-secret-key\";\n *\n * // Receiver automatically uses env variable\n * const receiver = new WebhookReceiver();\n * ```\n *\n * ### Fastify Example\n *\n * ```typescript\n * import Fastify from 'fastify';\n * import { WebhookReceiver } from \"@sayna-ai/node-sdk\";\n *\n * const fastify = Fastify();\n * const receiver = new WebhookReceiver();\n *\n * fastify.post('/webhook', {\n * config: {\n * rawBody: true\n * }\n * }, async (request, reply) => {\n * try {\n * const webhook = receiver.receive(\n * request.headers,\n * request.rawBody\n * );\n *\n * // Process webhook...\n *\n * return { received: true };\n * } catch (error) {\n * reply.code(401);\n * return { error: error.message };\n * }\n * });\n * ```\n *\n * ## Important Notes\n *\n * - **Raw Body Required**: You MUST pass the raw request body string, not the parsed JSON object.\n * The signature is computed over the exact bytes received, so any formatting changes will\n * cause verification to fail.\n *\n * - **Case-Insensitive Headers**: Header names are case-insensitive in HTTP. This class handles\n * both `X-Sayna-Signature` and `x-sayna-signature` correctly.\n *\n * - **Secret Security**: Never commit secrets to version control. Use environment variables\n * or a secret management system.\n *\n * @see WebhookSIPOutput\n */\nexport class WebhookReceiver {\n private readonly secret: string;\n\n /**\n * Creates a new webhook receiver with the specified signing secret.\n *\n * @param secret - HMAC signing secret (min 16 chars, 32+ recommended).\n * If not provided, uses SAYNA_WEBHOOK_SECRET environment variable.\n *\n * @throws {SaynaValidationError} If secret is missing or too short\n *\n * @example\n * ```typescript\n * // Explicit secret\n * const receiver = new WebhookReceiver(\"my-secret-key-at-least-16-chars\");\n *\n * // From environment variable\n * const receiver = new WebhookReceiver();\n * ```\n */\n constructor(secret?: string) {\n const effectiveSecret = secret ?? process.env.SAYNA_WEBHOOK_SECRET;\n\n if (!effectiveSecret) {\n throw new SaynaValidationError(\n \"Webhook secret is required. Provide it as a constructor parameter or set SAYNA_WEBHOOK_SECRET environment variable.\"\n );\n }\n\n const trimmedSecret = effectiveSecret.trim();\n\n if (trimmedSecret.length < MIN_SECRET_LENGTH) {\n throw new SaynaValidationError(\n `Webhook secret must be at least ${MIN_SECRET_LENGTH} characters long. ` +\n `Received ${trimmedSecret.length} characters. ` +\n `Generate a secure secret with: openssl rand -hex 32`\n );\n }\n\n this.secret = trimmedSecret;\n }\n\n /**\n * Verifies and parses an incoming SIP webhook from Sayna.\n *\n * This method performs the following security checks:\n * 1. Validates presence of required headers\n * 2. Verifies timestamp is within acceptable window (prevents replay attacks)\n * 3. Computes HMAC-SHA256 signature over canonical string\n * 4. Performs constant-time comparison to prevent timing attacks\n * 5. Parses and validates the webhook payload structure\n *\n * @param headers - HTTP request headers (case-insensitive)\n * @param body - Raw request body as string (not parsed JSON)\n *\n * @returns Parsed and validated webhook payload\n *\n * @throws {SaynaValidationError} If signature verification fails or payload is invalid\n *\n * @example\n * ```typescript\n * const receiver = new WebhookReceiver(\"your-secret\");\n *\n * // Express example\n * app.post('/webhook', express.json({ verify: (req, res, buf) => {\n * req.rawBody = buf.toString();\n * }}), (req, res) => {\n * const webhook = receiver.receive(req.headers, req.rawBody);\n * // webhook is now a validated WebhookSIPOutput object\n * });\n * ```\n */\n receive(\n headers: Record<string, string | string[] | undefined>,\n body: string\n ): WebhookSIPOutput {\n // Normalize headers to lowercase for case-insensitive lookup\n const normalizedHeaders = this.normalizeHeaders(headers);\n\n // Extract required headers\n const signature = this.getRequiredHeader(\n normalizedHeaders,\n \"x-sayna-signature\"\n );\n const timestamp = this.getRequiredHeader(\n normalizedHeaders,\n \"x-sayna-timestamp\"\n );\n const eventId = this.getRequiredHeader(\n normalizedHeaders,\n \"x-sayna-event-id\"\n );\n\n // Parse and validate signature format\n if (!signature.startsWith(\"v1=\")) {\n throw new SaynaValidationError(\n \"Invalid signature format. Expected 'v1=<hex>' but got: \" +\n signature.substring(0, 10) +\n \"...\"\n );\n }\n const signatureHex = signature.substring(3);\n\n // Validate signature is valid hex (64 chars for SHA256)\n if (!/^[0-9a-f]{64}$/i.test(signatureHex)) {\n throw new SaynaValidationError(\n \"Invalid signature: must be 64 hex characters (HMAC-SHA256)\"\n );\n }\n\n // Validate and check timestamp\n this.validateTimestamp(timestamp);\n\n // Build canonical string for signature verification\n const canonical = `v1:${timestamp}:${eventId}:${body}`;\n\n // Compute expected signature\n const hmac = createHmac(\"sha256\", this.secret);\n hmac.update(canonical, \"utf8\");\n const expectedSignature = hmac.digest(\"hex\");\n\n // Constant-time comparison to prevent timing attacks\n if (!this.constantTimeEqual(signatureHex, expectedSignature)) {\n throw new SaynaValidationError(\n \"Signature verification failed. The webhook may have been tampered with or the secret is incorrect.\"\n );\n }\n\n // Parse and validate the webhook payload\n return this.parseAndValidatePayload(body);\n }\n\n /**\n * Normalizes HTTP headers to lowercase for case-insensitive access.\n * Handles both single string values and arrays of strings.\n *\n * @internal\n */\n private normalizeHeaders(\n headers: Record<string, string | string[] | undefined>\n ): Record<string, string> {\n const normalized: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(headers)) {\n if (value !== undefined) {\n // Handle array values (take first element)\n const stringValue = Array.isArray(value) ? value[0] : value;\n if (stringValue) {\n normalized[key.toLowerCase()] = stringValue;\n }\n }\n }\n\n return normalized;\n }\n\n /**\n * Retrieves a required header value or throws a validation error.\n *\n * @internal\n */\n private getRequiredHeader(\n headers: Record<string, string>,\n name: string\n ): string {\n const value = headers[name.toLowerCase()];\n\n if (!value) {\n throw new SaynaValidationError(`Missing required header: ${name}`);\n }\n\n return value;\n }\n\n /**\n * Validates the timestamp is within the acceptable window.\n *\n * @internal\n */\n private validateTimestamp(timestampStr: string): void {\n // Parse timestamp\n const timestamp = Number(timestampStr);\n\n if (isNaN(timestamp)) {\n throw new SaynaValidationError(\n `Invalid timestamp format: expected Unix seconds but got '${timestampStr}'`\n );\n }\n\n // Check if timestamp is within acceptable range\n const now = Math.floor(Date.now() / 1000);\n const diff = Math.abs(now - timestamp);\n\n if (diff > TIMESTAMP_TOLERANCE_SECONDS) {\n throw new SaynaValidationError(\n `Timestamp outside replay protection window. ` +\n `Difference: ${diff} seconds (max allowed: ${TIMESTAMP_TOLERANCE_SECONDS}). ` +\n `This webhook may be a replay attack or there may be significant clock skew.`\n );\n }\n }\n\n /**\n * Performs constant-time string comparison to prevent timing attacks.\n *\n * @internal\n */\n private constantTimeEqual(a: string, b: string): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n const bufA = Buffer.from(a, \"utf8\");\n const bufB = Buffer.from(b, \"utf8\");\n\n return timingSafeEqual(bufA, bufB);\n }\n\n /**\n * Parses and validates the webhook payload structure.\n *\n * @internal\n */\n private parseAndValidatePayload(body: string): WebhookSIPOutput {\n let payload: unknown;\n\n // Parse JSON\n try {\n payload = JSON.parse(body);\n } catch (error) {\n throw new SaynaValidationError(\n `Invalid JSON payload: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n\n // Validate payload is an object\n if (!payload || typeof payload !== \"object\" || Array.isArray(payload)) {\n throw new SaynaValidationError(\"Webhook payload must be a JSON object\");\n }\n\n const data = payload as Record<string, unknown>;\n\n // Validate required fields\n this.validateParticipant(data.participant);\n this.validateRoom(data.room);\n this.validateStringField(data, \"from_phone_number\", \"from_phone_number\");\n this.validateStringField(data, \"to_phone_number\", \"to_phone_number\");\n this.validateStringField(data, \"room_prefix\", \"room_prefix\");\n this.validateStringField(data, \"sip_host\", \"sip_host\");\n\n // TypeScript type assertion is safe here because we've validated all fields\n // We use double assertion through unknown to satisfy strict type checking\n return data as unknown as WebhookSIPOutput;\n }\n\n /**\n * Validates the participant object structure.\n *\n * @internal\n */\n private validateParticipant(participant: unknown): void {\n if (\n !participant ||\n typeof participant !== \"object\" ||\n Array.isArray(participant)\n ) {\n throw new SaynaValidationError(\n \"Webhook payload missing required field 'participant' (must be an object)\"\n );\n }\n\n const p = participant as Record<string, unknown>;\n\n this.validateStringField(p, \"identity\", \"participant.identity\");\n this.validateStringField(p, \"sid\", \"participant.sid\");\n\n // name is optional, but if present must be a string\n if (p.name !== undefined && typeof p.name !== \"string\") {\n throw new SaynaValidationError(\n \"Field 'participant.name' must be a string if present\"\n );\n }\n }\n\n /**\n * Validates the room object structure.\n *\n * @internal\n */\n private validateRoom(room: unknown): void {\n if (!room || typeof room !== \"object\" || Array.isArray(room)) {\n throw new SaynaValidationError(\n \"Webhook payload missing required field 'room' (must be an object)\"\n );\n }\n\n const r = room as Record<string, unknown>;\n\n this.validateStringField(r, \"name\", \"room.name\");\n this.validateStringField(r, \"sid\", \"room.sid\");\n }\n\n /**\n * Validates a required string field.\n *\n * @internal\n */\n private validateStringField(\n obj: Record<string, unknown>,\n field: string,\n displayName: string\n ): void {\n const value = obj[field];\n\n if (typeof value !== \"string\" || value.length === 0) {\n throw new SaynaValidationError(\n `Webhook payload missing required field '${displayName}' (must be a non-empty string)`\n );\n }\n }\n}\n",
|
|
8
8
|
"import { SaynaClient } from \"./sayna-client\";\nimport type { STTConfig, TTSConfig, LiveKitConfig } from \"./types\";\n\nexport * from \"./sayna-client\";\nexport * from \"./types\";\nexport * from \"./errors\";\nexport * from \"./webhook-receiver\";\n\n/**\n * Creates and connects a new SaynaClient instance.\n *\n * This is the recommended way to create a Sayna client. It handles both\n * instantiation and connection, returning a ready-to-use client.\n *\n * @param url - The Sayna server URL (e.g., \"https://api.sayna.ai\")\n * @param sttConfig - Speech-to-text configuration (required when withoutAudio=false)\n * @param ttsConfig - Text-to-speech configuration (required when withoutAudio=false)\n * @param livekitConfig - Optional LiveKit room configuration\n * @param withoutAudio - If true, disables audio streaming (default: false)\n * @param apiKey - Optional API key used to authorize HTTP and WebSocket calls (defaults to SAYNA_API_KEY env)\n *\n * @returns Promise that resolves to a connected SaynaClient\n *\n * @throws {SaynaValidationError} If parameters are invalid\n * @throws {SaynaConnectionError} If connection fails\n * @throws {SaynaServerError} If server returns an error during setup\n *\n * @example\n * ```typescript\n * import { saynaConnect } from \"@sayna/node-sdk\";\n *\n * const client = await saynaConnect(\n * \"https://api.sayna.ai\",\n * {\n * provider: \"deepgram\",\n * language: \"en-US\",\n * sample_rate: 16000,\n * channels: 1,\n * punctuation: true,\n * encoding: \"linear16\",\n * model: \"nova-2\"\n * },\n * {\n * provider: \"elevenlabs\",\n * voice_id: \"21m00Tcm4TlvDq8ikWAM\",\n * speaking_rate: 1.0,\n * audio_format: \"pcm\",\n * sample_rate: 16000,\n * connection_timeout: 5000,\n * request_timeout: 10000,\n * model: \"eleven_turbo_v2\",\n * pronunciations: []\n * }\n * );\n *\n * // Register event handlers\n * client.registerOnSttResult((result) => {\n * console.log(\"Transcription:\", result.transcript);\n * });\n *\n * // Send text to be spoken\n * await client.speak(\"Hello, world!\");\n *\n * // Clean up\n * await client.disconnect();\n * ```\n */\nexport async function saynaConnect(\n url: string,\n sttConfig?: STTConfig,\n ttsConfig?: TTSConfig,\n livekitConfig?: LiveKitConfig,\n withoutAudio: boolean = false,\n apiKey?: string\n): Promise<SaynaClient> {\n const client = new SaynaClient(\n url,\n sttConfig,\n ttsConfig,\n livekitConfig,\n withoutAudio,\n apiKey\n );\n await client.connect();\n return client;\n}\n"
|
|
9
9
|
],
|
|
10
|
-
"mappings": ";AAGO,MAAM,mBAAmB,MAAM;AAAA,EACpC,WAAW,CAAC,SAAiB;AAAA,IAC3B,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,OAAO,eAAe,MAAM,WAAW,SAAS;AAAA;AAEpD;AAAA;AAKO,MAAM,+BAA+B,WAAW;AAAA,EACrD,WAAW,CAAC,UAAkB,oCAAoC;AAAA,IAChE,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,OAAO,eAAe,MAAM,uBAAuB,SAAS;AAAA;AAEhE;AAAA;AAKO,MAAM,2BAA2B,WAAW;AAAA,EACjD,WAAW,CACT,UAAkB,mFAClB;AAAA,IACA,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,OAAO,eAAe,MAAM,mBAAmB,S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BAAgB,YACvB,MAAM,QAAQ,WAAW,GACzB;AAAA,MACA,MAAM,IAAI,qBACR,0EACF;AAAA,IACF;AAAA,IAEA,MAAM,IAAI;AAAA,IAEV,KAAK,oBAAoB,GAAG,YAAY,sBAAsB;AAAA,IAC9D,KAAK,oBAAoB,GAAG,OAAO,iBAAiB;AAAA,IAGpD,IAAI,EAAE,SAAS,aAAa,OAAO,EAAE,SAAS,UAAU;AAAA,MACtD,MAAM,IAAI,qBACR,sDACF;AAAA,IACF;AAAA;AAAA,EAQM,YAAY,CAAC,MAAqB;AAAA,IACxC,IAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,GAAG;AAAA,MAC5D,MAAM,IAAI,qBACR,mEACF;AAAA,IACF;AAAA,IAEA,MAAM,IAAI;AAAA,IAEV,KAAK,oBAAoB,GAAG,QAAQ,WAAW;AAAA,IAC/C,KAAK,oBAAoB,GAAG,OAAO,UAAU;AAAA;AAAA,EAQvC,mBAAmB,CACzB,KACA,OACA,aACM;AAAA,IACN,MAAM,QAAQ,IAAI;AAAA,IAElB,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAAG;AAAA,MACnD,MAAM,IAAI,qBACR,2CAA2C,2CAC7C;AAAA,IACF;AAAA;AAEJ;;;AClXA,eAAsB,YAAY,CAChC,KACA,WACA,WACA,eACA,eAAwB,OACxB,QACsB;AAAA,EACtB,MAAM,SAAS,IAAI,YACjB,KACA,WACA,WACA,eACA,cACA,MACF;AAAA,EACA,MAAM,OAAO,QAAQ;AAAA,EACrB,OAAO;AAAA;",
|
|
11
|
+
"debugId": "03E3B3D15CF30BEF64756E2164756E21",
|
|
12
12
|
"names": []
|
|
13
13
|
}
|
package/dist/sayna-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { STTConfig, TTSConfig, LiveKitConfig, STTResultMessage, ErrorMessage, SipTransferErrorMessage, SaynaMessage, Participant, VoicesResponse, HealthResponse, LiveKitTokenResponse, SipHook, SipHooksResponse } from "./types";
|
|
1
|
+
import type { STTConfig, TTSConfig, LiveKitConfig, STTResultMessage, ErrorMessage, SipTransferErrorMessage, SaynaMessage, Participant, VoicesResponse, HealthResponse, LiveKitTokenResponse, LiveKitRoomsResponse, LiveKitRoomDetails, SipHook, SipHooksResponse, RemoveLiveKitParticipantResponse, MuteLiveKitParticipantResponse, SipTransferResponse } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Event handler for speech-to-text results.
|
|
4
4
|
*/
|
|
@@ -300,6 +300,145 @@ export declare class SaynaClient {
|
|
|
300
300
|
* ```
|
|
301
301
|
*/
|
|
302
302
|
getLiveKitToken(roomName: string, participantName: string, participantIdentity: string): Promise<LiveKitTokenResponse>;
|
|
303
|
+
/**
|
|
304
|
+
* Lists all LiveKit rooms belonging to the authenticated tenant.
|
|
305
|
+
*
|
|
306
|
+
* Room names are automatically prefixed with the tenant ID (from the JWT token)
|
|
307
|
+
* for isolation. Only rooms matching your tenant prefix are returned.
|
|
308
|
+
*
|
|
309
|
+
* @returns Promise that resolves with the list of rooms
|
|
310
|
+
* @throws {SaynaConnectionError} If the request fails
|
|
311
|
+
* @throws {SaynaServerError} If server returns an error (e.g., LiveKit not configured)
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```typescript
|
|
315
|
+
* const response = await client.getLiveKitRooms();
|
|
316
|
+
* for (const room of response.rooms) {
|
|
317
|
+
* console.log(`Room: ${room.name}, Participants: ${room.num_participants}`);
|
|
318
|
+
* }
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
getLiveKitRooms(): Promise<LiveKitRoomsResponse>;
|
|
322
|
+
/**
|
|
323
|
+
* Retrieves detailed information about a specific LiveKit room including participants.
|
|
324
|
+
*
|
|
325
|
+
* The room name is automatically prefixed with the tenant ID (from the JWT token)
|
|
326
|
+
* for isolation. You should provide the room name without the tenant prefix.
|
|
327
|
+
*
|
|
328
|
+
* @param roomName - Name of the room to retrieve (without tenant prefix)
|
|
329
|
+
* @returns Promise that resolves with detailed room information including participants
|
|
330
|
+
* @throws {SaynaValidationError} If roomName is empty
|
|
331
|
+
* @throws {SaynaConnectionError} If the request fails
|
|
332
|
+
* @throws {SaynaServerError} If server returns an error (e.g., room not found, LiveKit not configured)
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```typescript
|
|
336
|
+
* const room = await client.getLiveKitRoom("my-room");
|
|
337
|
+
* console.log(`Room: ${room.name}, SID: ${room.sid}`);
|
|
338
|
+
* console.log(`Participants: ${room.num_participants}/${room.max_participants}`);
|
|
339
|
+
* for (const participant of room.participants) {
|
|
340
|
+
* console.log(` - ${participant.name} (${participant.identity}): ${participant.state}`);
|
|
341
|
+
* }
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
getLiveKitRoom(roomName: string): Promise<LiveKitRoomDetails>;
|
|
345
|
+
/**
|
|
346
|
+
* Removes a participant from a LiveKit room, forcibly disconnecting them.
|
|
347
|
+
*
|
|
348
|
+
* The room name is automatically prefixed with the tenant ID (from the JWT token)
|
|
349
|
+
* for isolation. You should provide the room name without the tenant prefix.
|
|
350
|
+
*
|
|
351
|
+
* **Important:** This does not invalidate the participant's token. To prevent
|
|
352
|
+
* rejoining, use short-lived tokens and avoid issuing new tokens to removed participants.
|
|
353
|
+
*
|
|
354
|
+
* @param roomName - Name of the room where the participant is connected (without tenant prefix)
|
|
355
|
+
* @param participantIdentity - The identity of the participant to remove
|
|
356
|
+
* @returns Promise that resolves with the removal confirmation
|
|
357
|
+
* @throws {SaynaValidationError} If roomName or participantIdentity is empty
|
|
358
|
+
* @throws {SaynaConnectionError} If the request fails
|
|
359
|
+
* @throws {SaynaServerError} If server returns an error (e.g., participant not found, LiveKit not configured)
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* ```typescript
|
|
363
|
+
* const result = await client.removeLiveKitParticipant("my-room", "user-alice-456");
|
|
364
|
+
* console.log(`Status: ${result.status}`);
|
|
365
|
+
* console.log(`Removed from room: ${result.room_name}`);
|
|
366
|
+
* console.log(`Participant: ${result.participant_identity}`);
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
removeLiveKitParticipant(roomName: string, participantIdentity: string): Promise<RemoveLiveKitParticipantResponse>;
|
|
370
|
+
/**
|
|
371
|
+
* Mutes or unmutes a participant's published track in a LiveKit room.
|
|
372
|
+
*
|
|
373
|
+
* The room name is automatically prefixed with the tenant ID (from the JWT token)
|
|
374
|
+
* for isolation. You should provide the room name without the tenant prefix.
|
|
375
|
+
*
|
|
376
|
+
* @param roomName - Name of the room where the participant is connected (without tenant prefix)
|
|
377
|
+
* @param participantIdentity - The identity of the participant whose track to mute
|
|
378
|
+
* @param trackSid - The session ID of the track to mute/unmute
|
|
379
|
+
* @param muted - True to mute, false to unmute
|
|
380
|
+
* @returns Promise that resolves with the mute operation result
|
|
381
|
+
* @throws {SaynaValidationError} If roomName, participantIdentity, or trackSid is empty, or if muted is not a boolean
|
|
382
|
+
* @throws {SaynaConnectionError} If the request fails
|
|
383
|
+
* @throws {SaynaServerError} If server returns an error (e.g., track or participant not found, LiveKit not configured)
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```typescript
|
|
387
|
+
* // Mute a participant's track
|
|
388
|
+
* const result = await client.muteLiveKitParticipantTrack(
|
|
389
|
+
* "my-room",
|
|
390
|
+
* "user-alice-456",
|
|
391
|
+
* "TR_abc123",
|
|
392
|
+
* true
|
|
393
|
+
* );
|
|
394
|
+
* console.log(`Track ${result.track_sid} muted: ${result.muted}`);
|
|
395
|
+
*
|
|
396
|
+
* // Unmute the track
|
|
397
|
+
* const unmuteResult = await client.muteLiveKitParticipantTrack(
|
|
398
|
+
* "my-room",
|
|
399
|
+
* "user-alice-456",
|
|
400
|
+
* "TR_abc123",
|
|
401
|
+
* false
|
|
402
|
+
* );
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
muteLiveKitParticipantTrack(roomName: string, participantIdentity: string, trackSid: string, muted: boolean): Promise<MuteLiveKitParticipantResponse>;
|
|
406
|
+
/**
|
|
407
|
+
* Initiates a SIP call transfer via the REST API endpoint.
|
|
408
|
+
*
|
|
409
|
+
* This is distinct from the WebSocket `sipTransfer()` method. Use this REST endpoint
|
|
410
|
+
* when you need to transfer a SIP call from outside the active WebSocket session,
|
|
411
|
+
* or when you want to specify a particular room and participant explicitly.
|
|
412
|
+
*
|
|
413
|
+
* The room name is automatically prefixed with the tenant ID (from the JWT token)
|
|
414
|
+
* for isolation. You should provide the room name without the tenant prefix.
|
|
415
|
+
*
|
|
416
|
+
* **Important Notes:**
|
|
417
|
+
* - Only SIP participants can be transferred
|
|
418
|
+
* - A successful response indicates the transfer has been **initiated**, not necessarily completed
|
|
419
|
+
* - The actual transfer may take several seconds
|
|
420
|
+
*
|
|
421
|
+
* @param roomName - Name of the room where the SIP participant is connected (without tenant prefix)
|
|
422
|
+
* @param participantIdentity - The identity of the SIP participant to transfer
|
|
423
|
+
* @param transferTo - The phone number to transfer to (international, national, or extension format)
|
|
424
|
+
* @returns Promise that resolves with the transfer status
|
|
425
|
+
* @throws {SaynaValidationError} If roomName, participantIdentity, or transferTo is empty
|
|
426
|
+
* @throws {SaynaConnectionError} If the request fails
|
|
427
|
+
* @throws {SaynaServerError} If server returns an error (e.g., invalid phone, participant not found)
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```typescript
|
|
431
|
+
* // Transfer a SIP participant to another phone number
|
|
432
|
+
* const result = await client.sipTransferRest(
|
|
433
|
+
* "call-room-123",
|
|
434
|
+
* "sip_participant_456",
|
|
435
|
+
* "+15551234567"
|
|
436
|
+
* );
|
|
437
|
+
* console.log(`Transfer status: ${result.status}`);
|
|
438
|
+
* console.log(`Transferred to: ${result.transfer_to}`);
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
sipTransferRest(roomName: string, participantIdentity: string, transferTo: string): Promise<SipTransferResponse>;
|
|
303
442
|
/**
|
|
304
443
|
* Downloads the recorded audio file for a completed session.
|
|
305
444
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sayna-client.d.ts","sourceRoot":"","sources":["../src/sayna-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,aAAa,EAKb,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EAGvB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,OAAO,EACP,gBAAgB,
|
|
1
|
+
{"version":3,"file":"sayna-client.d.ts","sourceRoot":"","sources":["../src/sayna-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,aAAa,EAKb,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EAGvB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,OAAO,EACP,gBAAgB,EAChB,gCAAgC,EAChC,8BAA8B,EAC9B,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAYjB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,MAAM,EAAE,gBAAgB,KACrB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,CAC3C,WAAW,EAAE,WAAW,KACrB,I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;;;;;;;;;;;;;;OAkCG;IACG,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,mBAAmB,EAAE,MAAM,EAC3B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,mBAAmB,CAAC;IAuB/B;;;;;;;;;;;;;;;;;;OAkBG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAY1D;;;;;;;;;;;;;;OAcG;IACG,WAAW,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAI9C;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAoC9D;;;;;;;;;;;;;;;;;OAiBG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAuBhE;;OAEG;IACH,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,GAAG,SAAS,CAExC;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED;;OAEG;IACH,IAAI,wBAAwB,IAAI,MAAM,GAAG,SAAS,CAEjD;IAED;;OAEG;IACH,IAAI,oBAAoB,IAAI,MAAM,GAAG,SAAS,CAE7C;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAAI,MAAM,GAAG,SAAS,CAEjC;CACF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -365,4 +365,160 @@ export interface DeleteSipHooksRequest {
|
|
|
365
365
|
/** List of host names to remove (case-insensitive) */
|
|
366
366
|
hosts: string[];
|
|
367
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Summary information for a LiveKit room.
|
|
370
|
+
* Returned by the GET /livekit/rooms endpoint.
|
|
371
|
+
*/
|
|
372
|
+
export interface LiveKitRoomSummary {
|
|
373
|
+
/** The full room name (includes tenant prefix) */
|
|
374
|
+
name: string;
|
|
375
|
+
/** Number of current participants in the room */
|
|
376
|
+
num_participants: number;
|
|
377
|
+
/** Room creation time (Unix timestamp in seconds) */
|
|
378
|
+
creation_time: number;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Response from the GET /livekit/rooms endpoint.
|
|
382
|
+
* Returns all rooms belonging to the authenticated tenant.
|
|
383
|
+
*/
|
|
384
|
+
export interface LiveKitRoomsResponse {
|
|
385
|
+
/** List of rooms belonging to the authenticated client */
|
|
386
|
+
rooms: LiveKitRoomSummary[];
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Participant connection state in a LiveKit room.
|
|
390
|
+
*/
|
|
391
|
+
export type LiveKitParticipantState = "JOINING" | "JOINED" | "ACTIVE" | "DISCONNECTED" | "UNKNOWN";
|
|
392
|
+
/**
|
|
393
|
+
* Type/kind of participant in a LiveKit room.
|
|
394
|
+
*/
|
|
395
|
+
export type LiveKitParticipantKind = "STANDARD" | "AGENT" | "SIP" | "EGRESS" | "INGRESS" | "UNKNOWN";
|
|
396
|
+
/**
|
|
397
|
+
* Detailed information about a participant in a LiveKit room.
|
|
398
|
+
* Returned as part of the GET /livekit/rooms/{room_name} response.
|
|
399
|
+
*/
|
|
400
|
+
export interface LiveKitParticipantInfo {
|
|
401
|
+
/** Unique session ID for this participant (generated by LiveKit) */
|
|
402
|
+
sid: string;
|
|
403
|
+
/** Unique identifier provided when connecting */
|
|
404
|
+
identity: string;
|
|
405
|
+
/** Display name of the participant */
|
|
406
|
+
name: string;
|
|
407
|
+
/** Current connection state of the participant */
|
|
408
|
+
state: LiveKitParticipantState;
|
|
409
|
+
/** Type/kind of the participant (e.g., STANDARD, AGENT, SIP) */
|
|
410
|
+
kind: LiveKitParticipantKind;
|
|
411
|
+
/** Timestamp when participant joined (Unix timestamp in seconds) */
|
|
412
|
+
joined_at: number;
|
|
413
|
+
/** User-specified metadata for the participant */
|
|
414
|
+
metadata: string;
|
|
415
|
+
/** User-specified attributes for the participant */
|
|
416
|
+
attributes: Record<string, string>;
|
|
417
|
+
/** Whether the participant is currently publishing audio/video */
|
|
418
|
+
is_publisher: boolean;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Detailed information about a LiveKit room including participants.
|
|
422
|
+
* Returned by the GET /livekit/rooms/{room_name} endpoint.
|
|
423
|
+
*/
|
|
424
|
+
export interface LiveKitRoomDetails {
|
|
425
|
+
/** Unique session ID for the room (generated by LiveKit) */
|
|
426
|
+
sid: string;
|
|
427
|
+
/** The full room name (includes tenant prefix) */
|
|
428
|
+
name: string;
|
|
429
|
+
/** Number of current participants in the room */
|
|
430
|
+
num_participants: number;
|
|
431
|
+
/** Maximum allowed participants (0 = no limit) */
|
|
432
|
+
max_participants: number;
|
|
433
|
+
/** Room creation time (Unix timestamp in seconds) */
|
|
434
|
+
creation_time: number;
|
|
435
|
+
/** User-specified metadata for the room */
|
|
436
|
+
metadata: string;
|
|
437
|
+
/** Whether a recording is currently active */
|
|
438
|
+
active_recording: boolean;
|
|
439
|
+
/** List of participants currently in the room */
|
|
440
|
+
participants: LiveKitParticipantInfo[];
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Request body for the DELETE /livekit/participant endpoint.
|
|
444
|
+
* Used to remove a participant from a LiveKit room.
|
|
445
|
+
*/
|
|
446
|
+
export interface RemoveLiveKitParticipantRequest {
|
|
447
|
+
/** The LiveKit room name where the participant is connected (without tenant prefix) */
|
|
448
|
+
room_name: string;
|
|
449
|
+
/** The identity of the participant to remove */
|
|
450
|
+
participant_identity: string;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Response from the DELETE /livekit/participant endpoint.
|
|
454
|
+
* Confirms the participant removal operation.
|
|
455
|
+
*/
|
|
456
|
+
export interface RemoveLiveKitParticipantResponse {
|
|
457
|
+
/** Status of the removal operation (e.g., "removed") */
|
|
458
|
+
status: string;
|
|
459
|
+
/** The normalized room name (with tenant prefix) */
|
|
460
|
+
room_name: string;
|
|
461
|
+
/** The identity of the removed participant */
|
|
462
|
+
participant_identity: string;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Request body for the POST /livekit/participant/mute endpoint.
|
|
466
|
+
* Used to mute or unmute a participant's track in a LiveKit room.
|
|
467
|
+
*/
|
|
468
|
+
export interface MuteLiveKitParticipantRequest {
|
|
469
|
+
/** The LiveKit room name where the participant is connected (without tenant prefix) */
|
|
470
|
+
room_name: string;
|
|
471
|
+
/** The identity of the participant whose track to mute */
|
|
472
|
+
participant_identity: string;
|
|
473
|
+
/** The session ID of the track to mute/unmute */
|
|
474
|
+
track_sid: string;
|
|
475
|
+
/** True to mute, false to unmute */
|
|
476
|
+
muted: boolean;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Response from the POST /livekit/participant/mute endpoint.
|
|
480
|
+
* Confirms the mute/unmute operation.
|
|
481
|
+
*/
|
|
482
|
+
export interface MuteLiveKitParticipantResponse {
|
|
483
|
+
/** The normalized room name (with tenant prefix) */
|
|
484
|
+
room_name: string;
|
|
485
|
+
/** The identity of the participant */
|
|
486
|
+
participant_identity: string;
|
|
487
|
+
/** The session ID of the track */
|
|
488
|
+
track_sid: string;
|
|
489
|
+
/** Current muted state after the operation */
|
|
490
|
+
muted: boolean;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Status of a SIP transfer operation.
|
|
494
|
+
* - "initiated": Transfer has been started but not yet confirmed complete
|
|
495
|
+
* - "completed": Transfer has been successfully completed
|
|
496
|
+
*/
|
|
497
|
+
export type SipTransferStatus = "initiated" | "completed";
|
|
498
|
+
/**
|
|
499
|
+
* Request body for the POST /sip/transfer endpoint.
|
|
500
|
+
* Used to initiate a SIP call transfer for a participant in a LiveKit room.
|
|
501
|
+
*/
|
|
502
|
+
export interface SipTransferRequest {
|
|
503
|
+
/** The LiveKit room name where the SIP participant is connected (without tenant prefix) */
|
|
504
|
+
room_name: string;
|
|
505
|
+
/** The identity of the SIP participant to transfer */
|
|
506
|
+
participant_identity: string;
|
|
507
|
+
/** The phone number to transfer the call to (international, national, or extension format) */
|
|
508
|
+
transfer_to: string;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Response from the POST /sip/transfer endpoint.
|
|
512
|
+
* Confirms the SIP transfer operation status.
|
|
513
|
+
*/
|
|
514
|
+
export interface SipTransferResponse {
|
|
515
|
+
/** Status of the transfer request ("initiated" or "completed") */
|
|
516
|
+
status: SipTransferStatus;
|
|
517
|
+
/** The normalized room name (with tenant prefix) */
|
|
518
|
+
room_name: string;
|
|
519
|
+
/** The identity of the participant being transferred */
|
|
520
|
+
participant_identity: string;
|
|
521
|
+
/** The normalized phone number with tel: prefix */
|
|
522
|
+
transfer_to: string;
|
|
523
|
+
}
|
|
368
524
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,WAAW,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACtD,aAAa,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAA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