diff --git a/.changeset/curly-impalas-fix.md b/.changeset/curly-impalas-fix.md new file mode 100644 index 000000000..3c3b6e86c --- /dev/null +++ b/.changeset/curly-impalas-fix.md @@ -0,0 +1,6 @@ +--- +'@signalwire/realtime-api': patch +'@signalwire/core': patch +--- + +Fix Collect and Prompt APIs' speech diff --git a/packages/core/src/types/voiceCall.ts b/packages/core/src/types/voiceCall.ts index ac5e78963..1cfc3524c 100644 --- a/packages/core/src/types/voiceCall.ts +++ b/packages/core/src/types/voiceCall.ts @@ -550,6 +550,7 @@ export interface VoiceCallPromptContract { /** Alias for type in case of errors */ readonly reason?: string readonly digits?: string + readonly speech?: string readonly terminator?: string readonly text?: string readonly confidence?: number @@ -589,6 +590,7 @@ export interface VoiceCallCollectContract { /** Alias for type in case of errors */ readonly reason?: string readonly digits?: string + readonly speech?: string readonly terminator?: string readonly text?: string readonly confidence?: number diff --git a/packages/realtime-api/src/voice/CallCollect.ts b/packages/realtime-api/src/voice/CallCollect.ts index cb2af6e23..75630306a 100644 --- a/packages/realtime-api/src/voice/CallCollect.ts +++ b/packages/realtime-api/src/voice/CallCollect.ts @@ -88,6 +88,13 @@ export class CallCollectAPI return undefined } + get speech() { + if (this.result?.type === 'speech') { + return this.result.params.text + } + return undefined + } + get terminator() { if (this.result?.type === 'digit') { return this.result.params.terminator diff --git a/packages/realtime-api/src/voice/CallPrompt.ts b/packages/realtime-api/src/voice/CallPrompt.ts index a4d241a2b..d20510071 100644 --- a/packages/realtime-api/src/voice/CallPrompt.ts +++ b/packages/realtime-api/src/voice/CallPrompt.ts @@ -88,6 +88,13 @@ export class CallPromptAPI return undefined } + get speech() { + if (this.result?.type === 'speech') { + return this.result.params.text + } + return undefined + } + get terminator() { if (this.result?.type === 'digit') { return this.result.params.terminator