java.lang.Object
com.sinch.sdk.domains.voice.models.v2.helpers.Menu

public final class Menu extends Object
Helpers to build the interactive menu SVAML commands
Since:
2.4
  • Method Details

    • create

      public static MenuCreator create(String startMenu)
      Run an interactive menu that collects user input (e.g. DTMF digits)

      The sequence waits for the menu to end before running the next command.

      Parameters:
      startMenu - Name of the item played first, 1 to 16 characters. It must be one of the items of the menu
      Returns:
      The creator of the menu command
      Since:
      2.4
    • gotoMenu

      public static GotoMenuCommand gotoMenu(String name)
      Jump to another item of the enclosing menu

      Only valid within a menu: in the match or onFailure commands of an item, including their nested event handlers. The target must be an item of that menu.

      The target is checked when one of these is built: a menu (MenuCreator), a sequence (CommandsSequenceCreator), a static call behavior or a response to an incoming call. Building another creator alone, e.g. DialCreator, does not check it.

      Named after the API command: goto is a reserved word in Java.

      Parameters:
      name - Name of the menu item, 1 to 16 characters, sent as menuName
      Returns:
      The gotoMenu command
      Since:
      2.4
    • prompt

      public static MenuPrompt prompt(Consumer<PromptCreator> prompt)
      Create a menu prompt, e.g. to share it between several items or as repeat prompt
      Parameters:
      prompt - Lambda filling the prompt
      Returns:
      The menu prompt
      Throws:
      IllegalStateException - if the lambda adds no message
      Since:
      2.4
    • item

      public static MenuItem item(Consumer<MenuItemCreator> item)
      Create a menu item, e.g. to share it between several menus

      Add it to a menu with MenuCreator.item(String, MenuItem). Its gotoMenu targets are checked when that menu is built.

      Parameters:
      item - Lambda filling the item
      Returns:
      The menu item
      Since:
      2.4