/// <summary> /// 创建外拨活动 /// </summary> /// <param name="_confService"></param> /// <param name="campaignname"></param> /// <param name="tenantid"></param> /// <param name="switchname"></param> public static void CreateCampaign(IConfService _confService, string campaignname, int tenantid, string switchname) { CfgTenantQuery qTenant = new CfgTenantQuery(); qTenant.Dbid = tenantid; CfgTenant tenant = _confService.RetrieveObject <CfgTenant>(qTenant); CfgSwitchQuery qSwitch = new CfgSwitchQuery(); qSwitch.Name = switchname; qSwitch.TenantDbid = tenant.DBID; CfgSwitch @switch = _confService .RetrieveObject <CfgSwitch>(qSwitch); CfgCampaign campaign = new CfgCampaign(_confService); try { campaign.Name = campaignname; campaign.Tenant = tenant; campaign.Save(); } catch (Exception ex) { log.Error("can not create campaignname " + campaignname + ":" + ex.Message); } }
public OutputValues Initialize(string place, string userName, ConfService configObject, string tServerApplicationName, string agentLoginId, string agentPassword, CfgSwitch switchType) { Settings.GetInstance().AgentLoginID = agentLoginId; Settings.GetInstance().Switch = switchType; Settings.GetInstance().SwitchTypeName = switchType.Type == CfgSwitchType.CFGLucentDefinityG3 ? "avaya" : ((switchType.Type == CfgSwitchType.CFGNortelDMS100 || switchType.Type == CfgSwitchType.CFGNortelMeridianCallCenter) ? "nortel" : "avaya"); var output = OutputValues.GetInstance(); var connect = new VoiceConnectionManager(); var read = new ReadConfigObjects(); //Print DLL Info try { Assembly assemblyVersion = Assembly.LoadFrom(Environment.CurrentDirectory + @"\Pointel.Softphone.Voice.dll"); if (assemblyVersion != null) { logger.Debug("*********************************************"); logger.Debug(assemblyVersion.GetName().Name + " : " + assemblyVersion.GetName().Version); logger.Debug("*********************************************"); } } catch (Exception versionException) { logger.Error("Error occurred while getting the version of the SoftPhone library " + versionException.ToString()); } try { //ConnectionSettings.comObject = configObject; //Get Place details Settings.GetInstance().PlaceName = place; Settings.GetInstance().UserName = userName; output = read.ReadPlaceObject(); //Read Person Details //output = read.ReadPersonObject(userName); read.ReadApplicationObject(tServerApplicationName, agentLoginId); } catch (Exception inputException) { logger.Error("Error occurred while login into SoftPhone " + inputException); } //Input Validation CheckException.CheckLoginValues(place, userName); if (output.MessageCode == "200") { //Register with TServer output = connect.ConnectTServer(Settings.GetInstance().PrimaryApplication, Settings.GetInstance().SecondaryApplication); if (output.MessageCode != "200") { logger.Debug("Protocol is not opened, try to connect with server config keys"); if (Settings.GetInstance().VoiceProtocol != null && Settings.GetInstance().VoiceProtocol.State != ChannelState.Opened) { if (!string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName)) { logger.Debug("Primary TServer name : " + Settings.GetInstance().PrimaryTServerName); Settings.GetInstance().PrimaryApplication = read.ReadApplicationLevelServerDetails(Settings.GetInstance().PrimaryTServerName); } if (!string.IsNullOrEmpty(Settings.GetInstance().SecondaryTServerName)) { logger.Debug("Secondary TServer name : " + Settings.GetInstance().SecondaryTServerName); Settings.GetInstance().SecondaryApplication = read.ReadApplicationLevelServerDetails(Settings.GetInstance().SecondaryTServerName); if (Settings.GetInstance().PrimaryApplication == null && Settings.GetInstance().SecondaryApplication != null) { logger.Debug("Primary server is not configured, Secondary server is assigned to Primary server"); Settings.GetInstance().PrimaryApplication = Settings.GetInstance().SecondaryApplication; } } else { logger.Debug("secondary application name is not configured"); if (Settings.GetInstance().SecondaryApplication == null) { logger.Debug("Secondary server is not configured, primary server is assigned to secondary server"); Settings.GetInstance().SecondaryApplication = Settings.GetInstance().PrimaryApplication; } } //connect with server names from options tab output = connect.ConnectTServer(Settings.GetInstance().PrimaryApplication, Settings.GetInstance().SecondaryApplication); } else { return(output); } } } return(output); }