Ejemplo n.º 1
0
        public DialogBuilder(Menus.Menu i_menu, Commands i_commands, DtmfKeyToSpokenEquivalentMappings i_DtmfToSpokenMapping, VxmlGenerationParameters i_VxmlGenerationParameters)
        {
            m_menu     = i_menu;
            m_commands = i_commands;
            m_commands.DtmfCanBeSpoken = m_menu.DtmfCanBeSpoken;                        // This setting is stored in the menu object but the logic becomes cleaner if the commands collection knows its value.

            if (m_menu.DtmfCanBeSpoken)
            {
                if (null == i_DtmfToSpokenMapping)
                {
                    Console.Error.WriteLine("{0} DialogBuilder: ERROR - DtmfCanBeSpoken is true but no DtmfToSpokenMapping is provided.", DateTime.Now.ToString());             //$$$ LP - use logger.
                    throw new ArgumentNullException("i_DtmfToSpokenMapping", "DtmfCanBeSpoken is true but no DtmfToSpokenMapping is provided.");
                }
                else if (0 == i_DtmfToSpokenMapping.Count)
                {
                    Console.Error.WriteLine("{0} DialogBuilder: ERROR - DtmfCanBeSpoken is true but DtmfToSpokenMapping is empty.", DateTime.Now.ToString());           //$$$ LP - use logger.
                    throw new ArgumentOutOfRangeException("i_DtmfToSpokenMapping", "DtmfCanBeSpoken is true but DtmfToSpokenMapping is empty.");
                }
            }

            m_DtmfToSpokenMapping = i_DtmfToSpokenMapping;

            if (m_menu.ConfirmationEnabled)
            {
                if (null == i_VxmlGenerationParameters)
                {
                    Console.Error.WriteLine("{0} DialogBuilder: ERROR - ConfirmationEnabled is true but no VxmlGenerationParameters is provided.", DateTime.Now.ToString());            //$$$ LP - use logger.
                    throw new ArgumentNullException("i_VxmlGenerationParameters", "ConfirmationEnabled is true but no VxmlGenerationParameters is provided.");
                }
            }

            m_VxmlGenerationParameters = i_VxmlGenerationParameters;
            FormName = i_menu.MenuName;
        }
Ejemplo n.º 2
0
        private int GetNumberOfDigitsInExtension()
        {
            VxmlGenerationDAL        vxmlGenerationDAL        = new VxmlGenerationDAL(m_Logger);
            VxmlGenerationParameters vxmlGenerationParameters = vxmlGenerationDAL.GetVxmlGenerationParameters();

            return(vxmlGenerationParameters.NumberOfDigitsForExtension);
        }
Ejemplo n.º 3
0
        // 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);
        }