// The reason the menu and its associated commands are passed in (rather then retrieve the commands from the database inside the method) // is that this method is used to create a VXML file when a menu is saved on the Menu Editor page (at which point the commands already // exists in memory so no point wasting time retrieving them again). public static bool ProcessMenu(Menus.Menu i_menu, Commands i_commands, string i_sVxmlDirectory) { DtmfKeyToSpokenEquivalentMappings dtmfToSpokenMapping = null; VxmlGenerationParameters vxmlGenerationParameters = null; if (ConfigParams.IsVoiceRecognitionEnabled()) { if (i_menu.DtmfCanBeSpoken) { DialogDesignerDAL dal = new DialogDesignerDAL(); DialogDesignerDAL.ErrorCode ecDal = dal.GetDtmfToSpokenMapping(i_menu.LanguageCode, out dtmfToSpokenMapping); } } else { // If the system is not capable of voice recognition then it doesn't matter what the "DTMF keys can be spoken" setting in the menu is. i_menu.DtmfCanBeSpoken = false; } if (i_menu.ConfirmationEnabled) { vxmlGenerationParameters = GetVxmlGenerationParameters(); } DialogBuilder dialogBuilder = new DialogBuilder(i_menu, i_commands, dtmfToSpokenMapping, vxmlGenerationParameters); bool bMenuGenerated = dialogBuilder.GenerateVxml(GetFileNameForMenu(i_menu, i_sVxmlDirectory)); return(bMenuGenerated); }
/// <summary> /// Generate dialogs for all enabled menus in specified folder. /// If the specified directory is a relative path then it will be rooted in the local folder. /// </summary> /// <param name="i_sVxmlDirectory"></param> public static bool ProcessEnabledMenus(string i_sVxmlDirectory) { bool bMenuGenerated = true; DialogDesignerDAL dal = new DialogDesignerDAL(); Menus menus = dal.GetEnabledMenus(); foreach (Menus.Menu menu in menus) { Commands commands = dal.GetCommandsForMenu(menu); bMenuGenerated &= ProcessMenu(menu, commands, i_sVxmlDirectory); } return(bMenuGenerated); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Prints to stdout the language codes of the currently installed languages, each to a separate line. /// </summary> /// <returns></returns> //////////////////////////////////////////////////////////////////////////////////////////////////////////////// private static bool GetLanguageCodes() { bool bRet = true; Languages languages; DialogDesignerDAL ddDal = new DialogDesignerDAL(); DialogDesignerDAL.ErrorCode errorCode = ddDal.GetInstalledLanguages(out languages); if (errorCode == DialogDesignerDAL.ErrorCode.Success) { foreach (Languages.Language language in languages) { Console.WriteLine(language.Code); } } else { bRet = false; } return(bRet); }