private void ContentSelectPanel_Load(object sender, EventArgs e) { cbxFormat.SelectedIndex = 0; cbxMonitor.DataSource = QLDeviceManager.GetInstance().GetDevicesByType(DeviceType.MONITOR); cbxMonitor.SelectedIndex = 0; }
private void CallPanel_Load(object sender, EventArgs e) { //当视频输出设备存在时,可以进行视频通话 if (null == QLDeviceManager.GetInstance().CurrentVideoInputDevice) { btnVideoCall.Enabled = false; } else { btnVideoCall.Enabled = true; } }
private void grdCalls_CellClick(object sender, DataGridViewCellEventArgs e) { var dgv = (DataGridView)sender; if (e.ColumnIndex < 0) { return; } if (e.RowIndex < 0) { return; } var calls = dgv.DataSource as IEnumerable <QLSDK.Core.QLCall>; if (null != calls) { var call = calls.Skip(e.RowIndex).FirstOrDefault(); if (null != call) { var columnName = dgv.Columns[e.ColumnIndex].Name; switch (columnName) { #region Answer case "btnAnswer": { switch (call.CallState) { case QLSDK.Core.CallState.SIP_UNKNOWN: case QLSDK.Core.CallState.SIP_CALL_CLOSED: case QLSDK.Core.CallState.SIP_OUTGOING_FAILURE: break; case QLSDK.Core.CallState.SIP_INCOMING_INVITE: { if (null == QLDeviceManager.GetInstance().CurrentVideoInputDevice) { call.AnswerCall(QLSDK.Core.CallMode.AUDIO); } else { call.AnswerCall(call.CallMode); } } break; case QLSDK.Core.CallState.SIP_INCOMING_CONNECTED: case QLSDK.Core.CallState.SIP_CALL_HOLD: case QLSDK.Core.CallState.SIP_CALL_HELD: case QLSDK.Core.CallState.SIP_CALL_DOUBLE_HOLD: case QLSDK.Core.CallState.SIP_OUTGOING_TRYING: case QLSDK.Core.CallState.SIP_OUTGOING_RINGING: case QLSDK.Core.CallState.SIP_OUTGOING_CONNECTED: break; } } break; #endregion #region Hold case "btnHold": { switch (call.CallState) { case QLSDK.Core.CallState.SIP_UNKNOWN: case QLSDK.Core.CallState.SIP_CALL_CLOSED: case QLSDK.Core.CallState.SIP_OUTGOING_FAILURE: break; case QLSDK.Core.CallState.SIP_INCOMING_INVITE: break; case QLSDK.Core.CallState.SIP_INCOMING_CONNECTED: case QLSDK.Core.CallState.SIP_OUTGOING_CONNECTED: { call.HoldCall(); } break; case QLSDK.Core.CallState.SIP_CALL_HOLD: case QLSDK.Core.CallState.SIP_CALL_HELD: case QLSDK.Core.CallState.SIP_CALL_DOUBLE_HOLD: case QLSDK.Core.CallState.SIP_OUTGOING_TRYING: case QLSDK.Core.CallState.SIP_OUTGOING_RINGING: break; } } break; #endregion #region Resume case "btnResume": { switch (call.CallState) { case QLSDK.Core.CallState.SIP_UNKNOWN: case QLSDK.Core.CallState.SIP_CALL_CLOSED: case QLSDK.Core.CallState.SIP_OUTGOING_FAILURE: break; case QLSDK.Core.CallState.SIP_INCOMING_INVITE: case QLSDK.Core.CallState.SIP_INCOMING_CONNECTED: case QLSDK.Core.CallState.SIP_OUTGOING_CONNECTED: case QLSDK.Core.CallState.SIP_CALL_HELD: case QLSDK.Core.CallState.SIP_OUTGOING_TRYING: case QLSDK.Core.CallState.SIP_OUTGOING_RINGING: break; case QLSDK.Core.CallState.SIP_CALL_HOLD: case QLSDK.Core.CallState.SIP_CALL_DOUBLE_HOLD: { call.ResumeCall(); } break; } } break; #endregion #region Hangup case "btnHangup": { switch (call.CallState) { case QLSDK.Core.CallState.SIP_UNKNOWN: case QLSDK.Core.CallState.SIP_CALL_CLOSED: case QLSDK.Core.CallState.SIP_OUTGOING_FAILURE: break; case QLSDK.Core.CallState.SIP_INCOMING_INVITE: case QLSDK.Core.CallState.SIP_INCOMING_CONNECTED: case QLSDK.Core.CallState.SIP_OUTGOING_CONNECTED: case QLSDK.Core.CallState.SIP_CALL_HELD: case QLSDK.Core.CallState.SIP_OUTGOING_TRYING: case QLSDK.Core.CallState.SIP_OUTGOING_RINGING: case QLSDK.Core.CallState.SIP_CALL_HOLD: case QLSDK.Core.CallState.SIP_CALL_DOUBLE_HOLD: { call.HangUpCall(); } break; } } break; #endregion #region AudioCall case "btnAudioCall": { switch (call.CallState) { case QLSDK.Core.CallState.SIP_UNKNOWN: case QLSDK.Core.CallState.SIP_CALL_CLOSED: case QLSDK.Core.CallState.SIP_OUTGOING_FAILURE: { QLCallManager.GetInstance().DialCall(call.CallName, QLSDK.Core.CallMode.AUDIO); } break; case QLSDK.Core.CallState.SIP_INCOMING_INVITE: case QLSDK.Core.CallState.SIP_INCOMING_CONNECTED: case QLSDK.Core.CallState.SIP_OUTGOING_CONNECTED: case QLSDK.Core.CallState.SIP_CALL_HELD: case QLSDK.Core.CallState.SIP_OUTGOING_TRYING: case QLSDK.Core.CallState.SIP_OUTGOING_RINGING: case QLSDK.Core.CallState.SIP_CALL_HOLD: case QLSDK.Core.CallState.SIP_CALL_DOUBLE_HOLD: break; } } break; #endregion #region Video Call case "btnVideoCall": { switch (call.CallState) { case QLSDK.Core.CallState.SIP_UNKNOWN: case QLSDK.Core.CallState.SIP_CALL_CLOSED: case QLSDK.Core.CallState.SIP_OUTGOING_FAILURE: { QLCallManager.GetInstance().DialCall(call.CallName, QLSDK.Core.CallMode.VIDEO); } break; case QLSDK.Core.CallState.SIP_INCOMING_INVITE: case QLSDK.Core.CallState.SIP_INCOMING_CONNECTED: case QLSDK.Core.CallState.SIP_OUTGOING_CONNECTED: case QLSDK.Core.CallState.SIP_CALL_HELD: case QLSDK.Core.CallState.SIP_OUTGOING_TRYING: case QLSDK.Core.CallState.SIP_OUTGOING_RINGING: case QLSDK.Core.CallState.SIP_CALL_HOLD: case QLSDK.Core.CallState.SIP_CALL_DOUBLE_HOLD: break; } } break; #endregion } } } }
private void grdCalls_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { var dgv = (DataGridView)sender; if (e.ColumnIndex < 0) { return; } if (e.RowIndex < 0) { return; } var isHandled = true; var calls = dgv.DataSource as IEnumerable <QLSDK.Core.QLCall>; if (null != calls) { var call = calls.Skip(e.RowIndex).FirstOrDefault(); if (null != call) { var columnName = dgv.Columns[e.ColumnIndex].Name; switch (columnName) { case "btnAnswer": case "btnHold": case "btnResume": case "btnHangup": case "btnAudioCall": case "btnVideoCall": break; default: isHandled = false; break; } switch (call.CallState) { case QLSDK.Core.CallState.SIP_UNKNOWN: case QLSDK.Core.CallState.SIP_CALL_CLOSED: case QLSDK.Core.CallState.SIP_OUTGOING_FAILURE: { switch (columnName) { case "btnAudioCall": isHandled = false; break; case "btnVideoCall": { if (null != QLDeviceManager.GetInstance().CurrentVideoInputDevice) { isHandled = false; } } break; } } break; case QLSDK.Core.CallState.SIP_INCOMING_INVITE: if ("btnAnswer" == columnName) { isHandled = false; } break; case QLSDK.Core.CallState.SIP_INCOMING_CONNECTED: /* from CC */ switch (columnName) { case "btnHold": isHandled = false; break; case "btnHangup": isHandled = false; break; } break; case QLSDK.Core.CallState.SIP_CALL_HOLD: /* local hold */ switch (columnName) { case "btnResume": isHandled = false; break; case "btnHangup": isHandled = false; break; } break; case QLSDK.Core.CallState.SIP_CALL_HELD: /* far site hold */ switch (columnName) { case "btnHold": isHandled = false; break; case "btnHangup": isHandled = false; break; } break; case QLSDK.Core.CallState.SIP_CALL_DOUBLE_HOLD: /* both far-site and local hold */ switch (columnName) { case "btnResume": isHandled = false; break; case "btnHangup": isHandled = false; break; } break; case QLSDK.Core.CallState.SIP_OUTGOING_TRYING: /* UAC get 100, from CC */ switch (columnName) { case "btnHangup": isHandled = false; break; } break; case QLSDK.Core.CallState.SIP_OUTGOING_RINGING: /* UAC get 180 from CC */ switch (columnName) { case "btnHangup": isHandled = false; break; } break; //SIP_OUTGOING_ANSWERED, /* UAC get 200 from CC */ case QLSDK.Core.CallState.SIP_OUTGOING_CONNECTED: /* from CC */ switch (columnName) { case "btnHold": isHandled = false; break; case "btnHangup": isHandled = false; break; } break; } } } if (isHandled) { using (Brush gridBrush = new SolidBrush(dgv.GridColor), backColorBrush = new SolidBrush(e.CellStyle.BackColor)) { e.Graphics.FillRectangle(backColorBrush, e.CellBounds); } } e.Handled = isHandled; }