public static EventosHuawei getMainEvtHuawei(InterfaceHuawei frmmain) { try { if (evtHuawei == null) { evtHuawei = new EventosHuawei(); frmmain = main; } return(evtHuawei); } catch (Exception ex) { // Se detecto un error en el procedimiento logger.Error("Error en la carga de la interface. {0}", ex.Message); return(null); } }
public int inicializarDatosConexion(string mainIPCC, string backIPCC, int timeOut, string mainIPCCWS, string backIPCCWS, string accessCode1, string accessCode2, string outboundPrefix, string extensionPrefix, int extensionLength, string transferAccessCode, MainForm frm) { try { errMsg = ""; logger.Info("Carga de los valores de conexión."); settings = new Dictionary <string, string>(); settings.Add("HuaweiCTIServerIP", mainIPCC); settings.Add("HuaweiBackupCTIServerIP", backIPCC); settings.Add("HuaweiTimeout", timeOut.ToString()); settings.Add("HuaweiWebServiceUrl", mainIPCCWS); settings.Add("HuaweiBackupWebServiceUrl", backIPCCWS); settings.Add("HuaweiAccessCode1", accessCode1); settings.Add("HuaweiAccessCode2", accessCode2); settings.Add("HuaweiOutboundPrefix", outboundPrefix); settings.Add("HuaweiExtensionPrefix", extensionPrefix); settings.Add("HuaweiExtensionLength", extensionLength.ToString()); settings.Add("HuaweiTransferAccessCode", transferAccessCode); this.timeOut = timeOut; // Inicialización de los valores de status statusAsociacion = false; statusOperacion = OpStatus.Closed; // Se intenta generar la interface de conexión bool nuevo = false; if (this.device == null) { this.device = IDeviceProvider.GetIDevice(EventosHuawei.getMainEvtHuawei(this)) as IDevice; nuevo = true; } if (nuevo) { // Se asocian los eventos con el control EventosHuawei.ReceiveInitializeResult += ReceiveInitializeResult; EventosHuawei.ReceiveUnInitializeResult += ReceiveUnInitializeResult; EventosHuawei.ReceiveSetBusyResult += ReceiveAgentStatusChangeResult; EventosHuawei.ReceiveSetIdleResult += ReceiveAgentStatusChangeResult; EventosHuawei.ReceiveAnswerCallResult += ReceiveAnswerCallResult; EventosHuawei.ReceiveHangUpResult += ReceiveHangUpResult; EventosHuawei.ReceiveAgentStatusChangeResult += ReceiveAgentStatusChange; EventosHuawei.ReceivePhoneAlertingHandle += ReceivePhoneAlerting; EventosHuawei.ReceivePhoneAlertOtherHungupHandler += ReceivePhoneAlertOtherHungup; EventosHuawei.ReceiveInitializeResult += frm.OnInitializeResultCallback; EventosHuawei.ReceiveUnInitializeResult += frm.OnUnInitializeResultCallback; EventosHuawei.ReceiveAgentStatusChangeResult += frm.OnAgentStatusChange; EventosHuawei.ReceivePhoneAlertingHandle += frm.OnPhoneAlerting; EventosHuawei.ReceivePhoneHungupHandler += frm.OnPhoneHungup; } return(0); } catch (Exception ex) { // Se detecto un error en el procedimiento errMsg = string.Format("Error en la carga de los valores de conexión. {0}", ex.Message); logger.Error("Error en la carga de los valores de conexión. {0}", ex.Message, ex); return(-1); } }