{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/functions/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["partial"]},"type":"markdown"},"seo":{"title":"Developer Documentation","siteUrl":"https://developers.sinch.com","llmstxt":{"title":"Sinch Developer Documentation","description":"LLMs.txt containing a map of all the documentation files for Sinch.","sections":[{"title":"SMS API","description":"The SMS API allows you to send and receive SMS messages with a few easy steps. You can also send bulk SMS messages to multiple customers using the Sinch SMS service.","includeFiles":["docs/sms/**/*.md","docs/sms/**/*.yaml"],"excludeFiles":["docs/sms/index.md"]},{"title":"Numbers API","description":"The Numbers API enables you to search for, view, and activate numbers. It's considered a precursor to other APIs in the Sinch product family. The numbers API can be used in tandem with any of our APIs that perform messaging or calling.","includeFiles":["docs/numbers/**/*.md","docs/numbers/**/*.yaml"],"excludeFiles":["docs/numbers/index.md"]},{"title":"Conversation API","description":"Send and receive messages globally on many popular channels with ease and confidence when using Sinch's Conversation API. Conversation API is the preferred API for sending mobile messages on SMS and other social channels with Sinch. It is a simple API with unified error messages, consistent request payloads, and common webhook payloads that are channel-agnostic.","includeFiles":["docs/conversation/**/*.md","docs/conversation/**/*.yaml"],"excludeFiles":["docs/conversation/index.md"]},{"title":"Voice API","description":"The Voice API works as a big telephony switch. The Voice API handles incoming phone calls (also known as incoming call “legs”), sets up outgoing phone calls (or outgoing call “legs”), and bridges the two. The incoming call leg may come in over a data connection (from a smartphone or web application using the Sinch SDKs) or through a local phone number (from the PSTN network). Similarly, the outgoing call leg can be over data (to another smartphone or web application using the Sinch SDKs) or the PSTN network.","includeFiles":["docs/voice/**/*.md","docs/voice/**/*.yaml"],"excludeFiles":["docs/voice/index.md"]},{"title":"Verification API","description":"The Verification API is a platform for phone number verification. It consists of the API and different software development kits (the Sinch SDKs) that you integrate with your smartphone or web application and cloud based back-end services. Together they enable SMS, Flashcall, Phone Call and Data verification in your application.","includeFiles":["docs/verification/**/*.md","docs/verification/**/*.yaml"],"excludeFiles":["docs/verification/index.md"]},{"title":"Provisioning API","description":"Provisioning API allows you to programmatically set up your senders, accounts and templates on your favorite messaging platforms on the Conversation API. For now, you can create your first WhatsApp channel through Meta's Embedded sign up, you can configure your first SMS App and configure your webhooks. As development continues, we will be adding the most commonly used channels.","includeFiles":["docs/provisioning-api/**/*.md","docs/provisioning-api/**/*.json"],"excludeFiles":["docs/provisioning-api/index.md"]},{"title":"Elastic SIP Trunking API","description":"With Elastic SIP Trunking you can create and manage your SIP trunks and phone numbers programmatically.","includeFiles":["docs/est/**/*.md","docs/est/**/*.yaml"],"excludeFiles":["docs/est/index.md"]},{"title":"Fax API","description":"Send and receive HIPAA compliant faxes on our modern fax platform using our developer-friendly API.","includeFiles":["docs/fax/**/*.md","docs/fax/**/*.yaml"],"excludeFiles":["docs/fax/index.md"]},{"title":"In-app Voice and Video SDK","description":"The In-app Voice and Video SDK enables you to add voice and video calling capabilities directly into your mobile or web application using the Sinch SDKs.","includeFiles":["docs/in-app-calling/**/*.md"],"excludeFiles":["docs/in-app-calling/index.md"]}],"hide":false,"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"build-a-voice-ivr","__idx":0},"children":["Build a Voice IVR"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-a-call-flows","__idx":1},"children":["How a call flows"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Caller dials your Sinch number."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Sinch sends an ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ICE"]}," callback to your function."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Your function responds with SVAML that runs a menu."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Caller presses a key. Sinch sends a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["PIE"]}," callback with the selection."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Your function responds with SVAML that connects, plays a message, or runs another menu."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["When the call ends, Sinch sends a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["DICE"]}," callback for logging."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/voice/api-reference/voice-callbacks/"},"children":["Voice Callbacks"]}," and ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/voice/api-reference/svaml/"},"children":["SVAML"]}," on developers.sinch.com for the full Voice API specification."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"create-from-template","__idx":2},"children":["Create from template"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sinch functions init simple-voice-ivr --name my-ivr\ncd my-ivr\nsinch functions dev\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For C#: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sinch functions init simple-voice-ivr --name my-ivr --runtime csharp"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"complete-example","__idx":3},"children":["Complete example"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"import type { VoiceFunction, FunctionContext } from '@sinch/functions-runtime';\nimport type { Voice } from '@sinch/voice';\nimport {\n  createIceBuilder,\n  createPieBuilder,\n  MenuBuilder,\n  MenuTemplates,\n  createUniversalConfig,\n} from '@sinch/functions-runtime';\n\nexport default {\n  async ice(context: FunctionContext, event: Voice.IceRequest) {\n    const config = createUniversalConfig(context);\n    const companyName = config.getVariable('COMPANY_NAME', 'Acme Corp');\n\n    const menu = new MenuBuilder()\n      .prompt(\n        `Thank you for calling ${companyName}. Press 1 for sales, 2 for support, or 0 for an operator.`\n      )\n      .repeatPrompt('Press 1 for sales, 2 for support, or 0 for an operator.')\n      .option('1', 'return(sales)')\n      .option('2', 'return(support)')\n      .option('0', 'return(operator)')\n      .timeout(8000)\n      .repeats(2)\n      .maxDigits(1)\n      .build();\n\n    return createIceBuilder().say(`Welcome to ${companyName}.`).runMenu(menu).build();\n  },\n\n  async pie(context: FunctionContext, event: Voice.PieRequest) {\n    const selection = event.menuResult?.value;\n\n    switch (selection) {\n      case 'sales':\n        return createPieBuilder()\n          .say('Connecting you to sales now.')\n          .connectPstn('+15551110001', { cli: '+15550000000' })\n          .build();\n\n      case 'support':\n        return createPieBuilder()\n          .say('Connecting you to support.')\n          .connectPstn('+15551110002')\n          .build();\n\n      case 'operator':\n        return createPieBuilder()\n          .say('Please hold for an operator.')\n          .connectPstn('+15551110000')\n          .build();\n\n      default:\n        const retryMenu = new MenuBuilder()\n          .prompt('Sorry, we did not receive your selection. Press 1 for sales, or 2 for support.')\n          .option('1', 'return(sales)')\n          .option('2', 'return(support)')\n          .repeats(1)\n          .build();\n\n        return createPieBuilder().say('Invalid selection.').runMenu(retryMenu).build();\n    }\n  },\n\n  async dice(context: FunctionContext, event: Voice.DiceRequest) {\n    console.log('Call ended', { reason: event.reason, duration: event.duration });\n  },\n} satisfies VoiceFunction;\n","lang":"typescript"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"C#","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Microsoft.AspNetCore.Mvc;\nusing SinchFunctions.Models;\nusing SinchFunctions.Utils;\n\nnamespace SinchFunctions\n{\n    public class FunctionController : SinchVoiceController\n    {\n        public FunctionController(\n            FunctionContext context,\n            IConfiguration configuration,\n            ILogger<FunctionController> logger)\n            : base(context, configuration, logger) { }\n\n        public override async Task<IActionResult> Ice([FromBody] IceCallbackModel callbackData)\n        {\n            var companyName = Configuration[\"COMPANY_NAME\"] ?? \"Acme Corp\";\n\n            var menu = MenuFactory.CreateMenu()\n                .Prompt($\"Thank you for calling {companyName}. Press 1 for sales, 2 for support, or 0 for an operator.\")\n                .RepeatPrompt(\"Press 1 for sales, 2 for support, or 0 for an operator.\")\n                .Option(\"1\", \"return(sales)\")\n                .Option(\"2\", \"return(support)\")\n                .Option(\"0\", \"return(operator)\")\n                .Timeout(8000)\n                .Repeats(2)\n                .MaxDigits(1)\n                .Build();\n\n            var result = new IceSvamletBuilder()\n                .Instructions.Say($\"Welcome to {companyName}.\")\n                .Action.RunMenu(menu)\n                .Build();\n\n            return Ok(result);\n        }\n\n        public override async Task<IActionResult> Pie([FromBody] PieCallbackModel callbackData)\n        {\n            var selection = callbackData.MenuResult?.Value;\n\n            return selection switch\n            {\n                \"sales\" => Ok(new PieSvamletBuilder()\n                    .Instructions.Say(\"Connecting you to sales now.\")\n                    .Action.ConnectPstn(\"+15551110001\", cli: \"+15550000000\")\n                    .Build()),\n\n                \"support\" => Ok(new PieSvamletBuilder()\n                    .Instructions.Say(\"Connecting you to support.\")\n                    .Action.ConnectPstn(\"+15551110002\")\n                    .Build()),\n\n                \"operator\" => Ok(new PieSvamletBuilder()\n                    .Instructions.Say(\"Please hold for an operator.\")\n                    .Action.ConnectPstn(\"+15551110000\")\n                    .Build()),\n\n                _ => Ok(new PieSvamletBuilder()\n                    .Instructions.Say(\"Invalid selection.\")\n                    .Action.Hangup()\n                    .Build()),\n            };\n        }\n\n        public override async Task<IActionResult> Dice([FromBody] DiceCallbackModel callbackData)\n        {\n            Logger.LogInformation(\"Call ended: Reason={Reason}, Duration={Duration}s\",\n                callbackData.Reason, callbackData.Duration);\n            return Ok();\n        }\n    }\n}\n","lang":"csharp"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"menubuilder-reference","__idx":4},"children":["MenuBuilder reference"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Method"},"children":["Method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".prompt(text)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Main prompt, spoken when the menu starts"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".repeatPrompt(text)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Spoken when the caller does not respond"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".option(dtmf, action)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Add a key mapping"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".timeout(ms)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Wait time before repeating (default 8000)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".repeats(n)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Times to repeat before giving up (default 2)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".maxDigits(n)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Digits to collect before triggering PIE (default 1)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".barge(bool)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Allow keypresses to interrupt the prompt (default true)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".build()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Returns the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuStructure"]}," to pass to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["runMenu()"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Valid action formats: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["'return'"]}," (raw digit), ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["'return(value)'"]}," (custom value), ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["'menu(subMenuId)'"]}," (navigate to submenu)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"multi-level-menus","__idx":5},"children":["Multi-level menus"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".addSubmenu(id)"]}," to chain submenus into a single ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["runMenu"]}," action."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"import { createIceBuilder, MenuBuilder } from '@sinch/functions-runtime';\n\nconst menu = new MenuBuilder()\n  .prompt('Press 1 for English, 2 for Spanish.')\n  .option('1', 'menu(english)')\n  .option('2', 'menu(spanish)')\n  .addSubmenu('english')\n  .prompt('Press 1 for sales, 2 for support.')\n  .option('1', 'return(en-sales)')\n  .option('2', 'return(en-support)')\n  .addSubmenu('spanish')\n  .prompt('Presione 1 para ventas, 2 para soporte.')\n  .option('1', 'return(es-sales)')\n  .option('2', 'return(es-support)')\n  .build();\n\nreturn createIceBuilder().runMenu(menu).build();\n","lang":"typescript"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"C#","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"// C# requires building each menu separately\nvar mainMenu = MenuFactory.CreateMenu()\n    .Prompt(\"Press 1 for English, 2 for Spanish.\")\n    .Option(\"1\", \"menu(english)\")\n    .Option(\"2\", \"menu(spanish)\")\n    .Build();\n\nvar englishMenu = MenuFactory.CreateMenu()\n    .Prompt(\"Press 1 for sales, 2 for support.\")\n    .Option(\"1\", \"return(en-sales)\")\n    .Option(\"2\", \"return(en-support)\")\n    .Build();\nenglishMenu.Id = \"english\";\n\nvar spanishMenu = MenuFactory.CreateMenu()\n    .Prompt(\"Presione 1 para ventas, 2 para soporte.\")\n    .Option(\"1\", \"return(es-sales)\")\n    .Option(\"2\", \"return(es-support)\")\n    .Build();\nspanishMenu.Id = \"spanish\";\n\nvar result = new IceSvamletBuilder()\n    .Action.RunMenu(mainMenu)\n    .Build();\n\nreturn Ok(result);\n","lang":"csharp"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"pre-built-menutemplates","__idx":6},"children":["Pre-built MenuTemplates"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"import { MenuTemplates, createIceBuilder } from '@sinch/functions-runtime';\n\nconst menu = MenuTemplates.business('Acme Corp');\nconst yesNo = MenuTemplates.yesNo('Do you want to continue?');\nconst lang = MenuTemplates.language([\n  { dtmf: '1', name: 'English', value: 'en-US' },\n  { dtmf: '2', name: 'Spanish', value: 'es-ES' },\n]);\nconst afterHours = MenuTemplates.afterHours('Acme Corp', '9 AM to 5 PM, Monday through Friday');\n\nreturn createIceBuilder().runMenu(menu).build();\n","lang":"typescript"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"C#","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using SinchFunctions.Utils;\n\nvar menu = MenuTemplates.Business(\"Acme Corp\");\nvar yesNo = MenuTemplates.YesNo(\"Do you want to continue?\");\nvar lang = MenuTemplates.Language(new List<LanguageOption>\n{\n    new() { Dtmf = \"1\", Name = \"English\", Value = \"en-US\" },\n    new() { Dtmf = \"2\", Name = \"Spanish\", Value = \"es-ES\" },\n});\nvar afterHours = MenuTemplates.AfterHours(\"Acme Corp\", \"9 AM to 5 PM, Monday through Friday\");\n\nvar result = new IceSvamletBuilder()\n    .Action.RunMenu(menu)\n    .Build();\nreturn Ok(result);\n","lang":"csharp"},"children":[]}]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Template"},"children":["Template"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Node.js"},"children":["Node.js"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"C#"},"children":["C#"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Returns"},"children":["Returns"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Business menu"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.business(name)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.Business(name)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sales"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["support"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["operator"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes/No"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.yesNo(question)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.YesNo(question)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["yes"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["no"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Language"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.language(options)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.Language(options)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["locale value"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["After hours"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.afterHours(name, hours)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.AfterHours(name, hours)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voicemail"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["website"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["emergency"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Recording consent"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.recordingConsent()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MenuTemplates.RecordingConsent()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["consent"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["no_consent"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"svaml-builder-quick-reference","__idx":7},"children":["SVAML builder quick reference"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ice-builder","__idx":8},"children":["ICE builder"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Method"},"children":["Method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Effect"},"children":["Effect"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".say(text, locale?)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Play TTS before action"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".play(url)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Play audio file"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".answer()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Answer the call explicitly"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".setCookie(key, value)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Store state across callbacks"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".startRecording(options?)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Begin recording"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".runMenu(menu)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Run IVR menu (triggers PIE)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".connectPstn(number, options?)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Forward to phone number"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".connectSip(sipUri, options?)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Forward to SIP endpoint"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".connectConf(conferenceId)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Join a conference"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".park(holdPrompt?)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Hold the caller"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".hangup()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["End the call"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"pie-builder","__idx":9},"children":["PIE builder"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Same instructions as ICE, plus ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".connectPstn()"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".runMenu()"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".hangup()"]},". Does not support ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".park()"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For sinch.json configuration and environment variables, see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"#"},"children":["Templates"]}," and ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"#"},"children":["Configuration & Secrets"]},"."]}]},"headings":[{"value":"Build a Voice IVR","id":"build-a-voice-ivr","depth":1},{"value":"How a call flows","id":"how-a-call-flows","depth":2},{"value":"Create from template","id":"create-from-template","depth":2},{"value":"Complete example","id":"complete-example","depth":2},{"value":"MenuBuilder reference","id":"menubuilder-reference","depth":2},{"value":"Multi-level menus","id":"multi-level-menus","depth":2},{"value":"Pre-built MenuTemplates","id":"pre-built-menutemplates","depth":2},{"value":"SVAML builder quick reference","id":"svaml-builder-quick-reference","depth":2},{"value":"ICE builder","id":"ice-builder","depth":3},{"value":"PIE builder","id":"pie-builder","depth":3}],"frontmatter":{"seo":{"title":""}},"lastModified":"2026-04-15T14:23:23.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/functions/guides/build-an-ivr","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}