UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

38 lines (37 loc) 2.11 kB
/** * Tiny TwiML builders for Twilio webhook responses. * * The channel keeps TwiML generation local so callers do not need the * Twilio SDK just to acknowledge a webhook or gather speech. */ /** Options for rendering a voice `<Gather input="speech">` response. */ export interface TwilioGatherTwimlOptions { /** Absolute callback URL that receives the speech result. */ readonly actionUrl: string; /** Prompt spoken before Twilio starts speech recognition. */ readonly prompt: string; /** Twilio `<Say voice>` used for the prompt, e.g. `Polly.Joanna-Neural`. */ readonly voice?: string; /** BCP 47 language used for speech recognition and the nested `<Say>` prompt. */ readonly language?: string; /** Twilio `<Gather speechModel>` used for speech recognition. */ readonly speechModel?: string; /** Twilio `<Gather timeout>` in seconds. */ readonly timeoutSeconds?: number; /** Twilio `<Gather speechTimeout>`, such as `"auto"` or a second count string. */ readonly speechTimeout?: string; /** Twilio `<Gather hints>` for expected words or phrases. */ readonly hints?: string | readonly string[]; /** Twilio `<Gather profanityFilter>` toggle. */ readonly profanityFilter?: boolean; } /** Returns an empty TwiML response, useful for acknowledging inbound SMS without replying. */ export declare function emptyTwilioResponse(): Response; /** Returns a TwiML response that speaks `message` and then ends the call. */ export declare function sayTwilioResponse(message: string): Response; /** Returns a TwiML response that asks the caller to speak and posts the transcript to `actionUrl`. */ export declare function gatherSpeechTwilioResponse(options: TwilioGatherTwimlOptions): Response; /** Wraps a TwiML string in a Twilio-compatible XML response. */ export declare function twimlResponse(twiml: string): Response; /** Escapes the five XML predefined entities (`&`, `<`, `>`, `"`, `'`) for safe use in TwiML element content or attribute values. Note that `'` becomes `&apos;`. */ export declare function escapeXml(value: string): string;