private static void GenerateVxml() { bool bFailure = false; // Generate VXML files regardless of whether the Dirty Bit is set in the database. VoiceScriptGen voiceXmlTemplateProcessor = new VoiceScriptGen(); List <VoiceScriptGen.Result> results = voiceXmlTemplateProcessor.GenerateVxmlsFromTemplates(); foreach (VoiceScriptGen.Result result in results) { if (result.Success) { Console.WriteLine(String.Format("SUCCESS: {0}", result.Message)); } else { bFailure = true; Console.Error.WriteLine(String.Format("FAILURE: {0}", result.Message)); } } // If all the files were generated successfully then clear the Dirty Bit in the database. if (!bFailure) { ConfigParams.SetVoicexmlDirty(false); } // If the files didn't exist prior to executing this command then they will have incorrect owner and permission. // This needs to be rectified so that generating the files from the web site can succeed. Console.WriteLine(); Console.WriteLine("IMPORTANT: Ensure that the VXML files generated have appropriate owner and permissions set."); Console.WriteLine(); }
private static int ImportDirectory(string i_sFileType, string i_sFileName, bool i_bMerge) { int iExitCode = EXIT_CODE_SUCCESS; IImportParser importParser = null; switch (i_sFileType.ToLower()) { case "csv": importParser = new CsvImportParser(); break; case "allworx": importParser = new AllworxImportParser(); break; case "shoretel": importParser = new ShoreTelImportParser(); break; default: iExitCode = EXIT_CODE_ILLEGAL_ARGUMENT; Console.Error.WriteLine("ERROR: Invalid type specified {0} - valid types are: csv, allworx, shoretel", i_sFileType); break; } if (null != importParser) { byte[] importBytes = GetBytesFromImportFile(i_sFileName); if ((null != importBytes) && (importBytes.Length > 0)) { bool bContinueImport = true; if (!i_bMerge) { bContinueImport = DeleteAllUsersExceptAdmin(); } if (bContinueImport) { SBConfigStor.Directory sbcDir = new SBConfigStor.Directory(); SBConfigStor.Directory.eImportStatus importStatus = sbcDir.Persist(importBytes, importParser, GetNumberOfUsersThatCanBeAdded()); if (SBConfigStor.Directory.eImportStatus.eFailure == importStatus) { iExitCode = EXIT_CODE_IMPORT_ERROR; Console.Error.WriteLine("ERROR: There was an error importing the file ('{0}', '{1}').", i_sFileType, i_sFileName); } else { if (SBConfigStor.Directory.eImportStatus.eIncomplete == importStatus) { iExitCode = EXIT_CODE_IMPORT_INCOMPLETE; Console.Error.WriteLine("WARNING: Import incomplete since licensed number of Directory Entries exceeded."); } ConfigParams.SetVoicexmlDirty(true); } } else { iExitCode = EXIT_CODE_IMPORT_ERROR; } } else { iExitCode = EXIT_CODE_IMPORT_ERROR; Console.Error.WriteLine("ERROR: Import file was empty or doesn't exist {0}.", i_sFileName); } } return(iExitCode); }