public override void OnAnswerCallResult(string callId, DialContent dialContent, bool flag, int errorCode) { if (ReceiveAnswerCallResult != null) { ReceiveAnswerCallResult(callId, dialContent, flag, errorCode); } }
public void ReceiveDialResult(string callId, DialContent dialContent, bool flag, int errorCode) { try { // Se reporta el resultado de la operación Dictionary <string, object> salida = new Dictionary <string, object>(); salida.Add("callId", callId); salida.Add("dialContent", dialContent); salida.Add("flag", flag); salida.Add("errorCode", errorCode); operaciones.Enqueue(salida); waitDialResult.Set(); // Se muestra el resultado de la operación logger.Trace("Dial result [{0}]", errorCode); // Se valida el resultado de la operación if (errorCode != 0) { return; } } catch (Exception ex) { // Se detecto un error en el procedimiento logger.Error("Error en el procedimiento de marcar el teléfono. {0} {1}", callId, ex.Message, ex); } }
//批量移除成员 private void BtnRemoveMembers_Click(object sender, EventArgs e) { try { if (this.Device == null) { return; } var selectedItems = this.lvwMembers.Items; if (selectedItems == null || selectedItems.Count == 0) { return; } for (int i = 0; i < selectedItems.Count; i++) { DialContent dialContent = (DialContent)selectedItems[i].Tag; if (this.AgentInfo != null && dialContent != null && this.AgentInfo.PhoneNumber != dialContent.PhoneNumber) { this.Device.RemoveMeetingMember(this.MeetingId, dialContent); } } } catch { MsgBox.Error("occur exception"); } }
private void btnRemoveMember_Click(object sender, EventArgs e) { try { if (this.Device == null) { return; } var selectedItems = this.lvwMembers.SelectedItems; if (selectedItems == null || selectedItems.Count == 0) { return; } DialContent dialContent = (DialContent)selectedItems[0].Tag; if (this.AgentInfo != null && dialContent != null && this.AgentInfo.PhoneNumber == dialContent.PhoneNumber) { MsgBox.Error("Cannot remove self."); return; } this.Device.RemoveMeetingMember(this.MeetingId, dialContent); } catch { MsgBox.Error("occur exception"); } }
/// <summary> /// /// </summary> /// <param name="dialContent"></param> public void AddDialContent(DialContent dialContent) { if (dialContent == null) { return; } var obj = this.FindDialContent(dialContent.PhoneNumber); if (obj == null) { this.DialContentList.Add(dialContent); } var item = this.lvwMembers.Items[dialContent.PhoneNumber]; if (item != null) { item.SubItems[1].Text = dialContent.Status.ToString(); } else { item = this.lvwMembers.Items.Add(dialContent.PhoneNumber, dialContent.PhoneNumber, null); item.SubItems.Add(dialContent.Status.ToString()); item.Tag = dialContent; } }
public override void OnPhoneHungup(string callId, DialContent dialContent) { if (ReceivePhoneHungupHandler != null) { ReceivePhoneHungupHandler(callId, dialContent); } }
/// <summary> /// /// </summary> /// <param name="dialContent"></param> /// <returns></returns> public static bool NewMasterPhoneNumber(DialContent dialContent, AgentInfo agentInfo) { if (dialContent == null || agentInfo == null || string.IsNullOrEmpty(dialContent.PhoneNumber)) { return false; } if (dialContent.PhoneNumber.Equals(agentInfo.PhoneNumber)) { return true; } return false; ; }
/// <summary> /// /// </summary> /// <param name="dialContent"></param> /// <returns></returns> public static string ToString(DialContent dialContent) { if (dialContent == null) { return null; } return "{CallId = " + dialContent.CallId + ", CallType = " + dialContent.CallType + ", DeviceId = " + dialContent.DeviceId + ", PhoneType = " + dialContent.PhoneType + ", PhoneNumber = " + dialContent.PhoneNumber + ", Status = " + dialContent.Status + "}"; }
/// <summary> /// /// </summary> /// <param name="dialContent"></param> public void RemoveDialContent(DialContent dialContent) { if (dialContent == null) { return; } var obj = this.FindDialContent(dialContent.PhoneNumber); if (obj != null) { this.DialContentList.Remove(obj); this.lvwMembers.Items.RemoveByKey(obj.PhoneNumber); } }
//改变会议成员属性 private void btnChangeMemberMode_Click(object sender, EventArgs e) { DialContent dialContent = null; var selectedItems = this.lvwMembers.SelectedItems; if (selectedItems != null && selectedItems.Count > 0) { dialContent = selectedItems[0].Tag == null ? null : (DialContent)selectedItems[0].Tag; } var dialog = new frmChangeMemberMode(this.MeetingId, dialContent); dialog.Text = btnChangeMemberMode.Text; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK && null != dialog.DialContent) { this.Device.ChangeMeetingMemberMode(dialog.MeetingID, dialog.DialContent, dialog.OpType); } }
//确定 private void btnOK_Click(object sender, EventArgs e) { DialContent dialContent = null; var index = combType.SelectedIndex; if (index >= 0) { OpType = index + 1; var phone = txtPhone.Text.Trim(); if (!string.IsNullOrEmpty(phone)) { dialContent = new DialContent(); dialContent.PhoneNumber = phone; } MeetingID = txtMeetingID.Text.Trim(); } DialContent = dialContent; this.DialogResult = System.Windows.Forms.DialogResult.OK; }
public void ReceivePhoneAlertOtherHungup(string callId, DialContent dialContent) { try { // Se marca la operación logger.Trace("Se detecto el cambio de status en una llamada: {0}/{1}/{2}", dialContent.CallId, dialContent.DeviceId, dialContent.PhoneNumber); if (OnPhoneAlertOtherHungup != null) { OnPhoneAlertOtherHungup(callId, dialContent); } // Se intenta regresar el status del agente a Idle cambiarStatus("DISPONIBLE"); } catch (Exception ex) { // Se detecto un error en el procedimiento logger.Error("Error en el método de notificación de llamadas {0}", ex.Message, ex); } }
public void OnPhoneHungup(string callId, DialContent dialContent) { try { logger.Trace("Main phone hungup dial:{0}", dialContent.PhoneNumber); // Se valida que sea una operación segura para el dialogo if (this.InvokeRequired) { OnPhoneHungupHandler hand = new OnPhoneHungupHandler(OnPhoneHungup); this.Invoke(hand, new object[] { callId, dialContent }); return; } // Se continua con el procesamiento normal de la función AgregarMensajeBitacora(string.Format("Se colgo la bocina: {0}", dialContent.PhoneNumber)); } catch (Exception ex) { // Se detecto un error en el procedimiento logger.Error("Error en el procesamiento de colgado de la bocina. {0}", ex.Message, ex); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { accessCode = this.txtAccessCode.Text.Trim(); string number = this.textPhoneNumber.Text.Trim(); if (string.IsNullOrEmpty(number)) { this.textPhoneNumber.Focus(); MsgBox.Info("Please input phone number."); return; } DialContent dialContent = new DialContent(); DeviceType phoneType = DeviceType.Phone; DeviceCallType callType = DeviceCallType.ConventionCall; if (this.ShowCallType) { var intCallType = this.cboCallType.SelectedIndex; if (intCallType == 0) { phoneType = DeviceType.Phone; } else if (intCallType == 1 || intCallType == 2) { if (intCallType == 1) { callType = DeviceCallType.GroupCall; } else { callType = DeviceCallType.SecretCall; } var wirelessType = this.cboWirelessType.SelectedIndex; if (wirelessType == 0) { phoneType = DeviceType.SW; } else if (wirelessType == 1) { phoneType = DeviceType.WLDigitalDevice; } else if (wirelessType == 2) { phoneType = DeviceType.WLSimulateDevice; } else if (wirelessType == 3) { phoneType = DeviceType.LTE; } else { MsgBox.Info("Please select wireless type."); this.cboWirelessType.Focus(); return; } } else { MsgBox.Info("Please select call type."); this.cboCallType.Focus(); return; } } var mediaAblty = MediaAbility.Default; if (cmbMediaAbility.Enabled) { if (cmbMediaAbility.SelectedIndex == 0) { mediaAblty = MediaAbility.Audio; } else if (cmbMediaAbility.SelectedIndex == 1) { mediaAblty = MediaAbility.Video; } } dialContent.PhoneNumber = number; dialContent.PhoneType = phoneType; dialContent.CallType = callType; dialContent.MediaAbility = mediaAblty; dialContent.AccessCode = accessCode; if (IsDisconnectCall) { dialContent.CallId = number; } this.DialContent = dialContent; this.DialogResult = DialogResult.OK; } catch { MsgBox.Error("occur exception"); } }
private void button1_Click(object sender, EventArgs e) { try { string number = this.textPhoneNumber.Text.Trim(); if (string.IsNullOrEmpty(number)) { this.textPhoneNumber.Focus(); MsgBox.Info("Please input phone number."); return; } foreach (DialContent dial in dialContents) { if (dial.PhoneNumber == number) { return; } } DialContent dialContent = new DialContent(); DeviceType phoneType = DeviceType.Phone; DeviceCallType callType = DeviceCallType.ConventionCall; var intCallType = this.cboCallType.SelectedIndex; if (intCallType == 0) { phoneType = DeviceType.Phone; } else if (intCallType == 1 || intCallType == 2) { if (intCallType == 1) { callType = DeviceCallType.GroupCall; } else { callType = DeviceCallType.SecretCall; } var wirelessType = this.cboWirelessType.SelectedIndex; if (wirelessType == 0) { phoneType = DeviceType.SW; } else if (wirelessType == 1) { phoneType = DeviceType.WLDigitalDevice; } else if (wirelessType == 2) { phoneType = DeviceType.WLSimulateDevice; } else if (wirelessType == 3) { phoneType = DeviceType.LTE; } else { MsgBox.Info("Please select wireless type."); this.cboWirelessType.Focus(); return; } } else { MsgBox.Info("Please select call type."); this.cboCallType.Focus(); return; } var mediaAblty = MediaAbility.Default; if (cmbMediaAbility.Enabled) { if (cmbMediaAbility.SelectedIndex == 0) { mediaAblty = MediaAbility.Video; } else if (cmbMediaAbility.SelectedIndex == 1) { mediaAblty = MediaAbility.Video; } } dialContent.PhoneNumber = number; dialContent.PhoneType = phoneType; dialContent.CallType = callType; dialContent.MediaAbility = mediaAblty; dialContents.Add(dialContent); listBoxCall.Items.Add(dialContent.PhoneNumber); } catch { MsgBox.Error("occur exception"); } }
public int marcarTelefono(string telefono) { bool bloqueado = false; try { errMsg = ""; logger.Info("Se intentara marcar el teléfono: {0}", telefono); // Se valida que no se cuente con otra operación pendiente logger.Trace("Se intenta obtener el control de la interface."); if (!controlOperaciones.WaitOne(timeOut)) { errMsg = "No se logro acceder a la interface de telefonía. BLOQUEADA"; logger.Error(errMsg); return(-1); } bloqueado = true; logger.Trace("Se bloqueo el control de la interface."); if (this.device == null) { errMsg = "No se obtuvo el acceso a la interface."; logger.Error(errMsg); return(-1); } // Se genera la invocación en un hilo distinto new Thread(() => { try { logger.Trace("Solicitud de marcar el teléfono: {0}", telefono); DialContent dial = new DialContent(); dial.PhoneNumber = telefono; dial.PhoneType = DeviceType.Phone; dial.CallType = DeviceCallType.ConventionCall; this.device.Dial(dial); } catch (Exception ex) { // Se detecto un error en el procedimiento logger.Error("Error en el intento de marcar el teléfono. {0}", ex.Message, ex); } } ).Start(); // Se intenta esperar por los eventos logger.Trace("Inicio de la espera de respuesta del evento de marcar teléfono."); if (!waitDialResult.WaitOne(timeOut)) { errMsg = "No se logro obtener una respuesta en tiempo del procedimiento de " + "marcar el teléfono."; logger.Error(errMsg); return(-1); } logger.Trace("Concluye la espera del evento de marcar el teléfono."); // Se obtiene la respuesta del método Dictionary <string, object> respuesta = operaciones.Dequeue(); controlOperaciones.Release(); bloqueado = false; int errCode = Convert.ToInt32(respuesta["errorCode"]); logger.Trace("Respuesta: {0}", errCode); if (errCode == 0) { logger.Trace("Se logro marcar el teléfono."); return(0); } // Se detecto un error en el procedimiento errMsg = "Error al intentar marcar el teléfono."; logger.Error(errMsg); return(-1); } catch (Exception ex) { // Se detecto un error en el procedimiento errMsg = string.Format("Error el intento de marcar el teléfono. {0}", ex.Message); logger.Error("Error en el intento de marcar el teléfono. {0}", ex.Message, ex); return(-1); } finally { // Se valida que no este bloqueado el recurso if (bloqueado) { controlOperaciones.Release(); } } }
public frmChangeMemberMode(string meetingId, DialContent dialContent) { InitializeComponent(); this._meetingId = meetingId; this._dialContent = dialContent; }