private void Hangup(int callHandle) { var call = callManager.GetCall(callHandle); if (null != call) { if (!LAL.Hangup(call)) { MessageBox.Show(this, "挂断失败!", "消息框", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void onCallWindowClosedHandle(object sender, EventArgs args) { var callWindow = sender as CallWindow; if (null != callWindow) { var wnds = callWindows.Where(c => c.Value == callWindow).ToList(); foreach (var wnd in wnds) { var call = callManager.GetCall(wnd.Key); if (null != call) { LAL.Hangup(call); callManager.RemoveCall(call); } callWindows.Remove(wnd.Key); } } }
private void CallWindow_FormClosing(object sender, FormClosingEventArgs e) { bool canDirectClose = false; switch (_call.CallState) { case CallStateEnum.SIP_UNKNOWN: case CallStateEnum.SIP_CALL_CLOSED: case CallStateEnum.NULL_CALL: canDirectClose = true; break; case CallStateEnum.SIP_INCOMING_INVITE: case CallStateEnum.SIP_INCOMING_CONNECTED: case CallStateEnum.SIP_CALL_HOLD: case CallStateEnum.SIP_CALL_HELD: case CallStateEnum.SIP_CALL_DOUBLE_HOLD: case CallStateEnum.SIP_OUTGOING_TRYING: case CallStateEnum.SIP_OUTGOING_RINGING: case CallStateEnum.SIP_OUTGOING_CONNECTED: canDirectClose = false; break; } if (!canDirectClose) { Action okAction = () => { LAL.Hangup(_call); e.Cancel = false; }; Action cancelAction = () => { e.Cancel = true; }; UXMessageMask.ShowMessage(this, true, "当前通话连通中.\r\n确认要关闭退出吗?", MessageBoxButtonsType.OKCancel, MessageBoxIcon.Question , okAction, cancelAction); } }
public void handleEvent(Call call) { switch (call.CallEventState) { case CallEventStateEnum.UNKNOWN: { } break; case CallEventStateEnum.INCOMING_INVITE: /* UAS received an incoming call. */ { deviceManager.StopSound(); deviceManager.PlaySound(DeviceManager.IncomingSound, true, 2000); var msg = string.Format("【{0}】呼入中,是否接听?", this._call.RemoteDisplayName); Action answerAction = () => { LAL.Hold(true); LAL.Hangup(true); deviceManager.StopSound(); LAL.Answer(this._call, CallModeEnum.PLCM_MFW_AUDIOVIDEO_CALL, true); }; Action hangupAction = () => { LAL.Hangup(this._call); }; UXMessageMask.ShowMessage(this, false, msg, MessageBoxButtonsType.AnswerHangup, MessageBoxIcon.Question , answerAction, hangupAction); } break; case CallEventStateEnum.INCOMING_CLOSED: /* UAS received the call terminated. */ { deviceManager.StopSound(); deviceManager.PlaySound(DeviceManager.ClosedSound, false, 0); Action okAction = () => { this.Close(); }; UXMessageMask.ShowMessage(this, false, "呼叫已经关闭!", MessageBoxButtonsType.OK, MessageBoxIcon.Information , okAction); } break; case CallEventStateEnum.INCOMING_CONNECTED: /* UAS received the call connected. */ { deviceManager.StopSound(); ViewRender(); UXMessageMask.HideMessage(this); } break; case CallEventStateEnum.INCOMING_HOLD: break; /* The call is holding by local site. */ case CallEventStateEnum.INCOMING_HELD: break; /* The call is holding by far site. */ case CallEventStateEnum.INCOMING_DOUBLE_HOLD: break; /* The call is holding by both far site and local site. */ case CallEventStateEnum.INCOMING_CALL_FARSITE_MIC_MUTE: /* Far site has muted micphone. */ { } break; case CallEventStateEnum.INCOMING_CALL_FARSITE_MIC_UNMUTE: /* Far site has unmuted micphone. */ { } break; case CallEventStateEnum.INCOMING_CONTENT: { } break; case CallEventStateEnum.CONTENT_SENDING: { log.Info("CONTENT_SENDING"); } break; case CallEventStateEnum.CONTENT_CLOSED: { var contentChannel = _call.Channels.FirstOrDefault(c => c.ChannelType == ChannelType.Content); if (null != contentChannel) { this._call.RemoveChannel(contentChannel.ChannelID); } // LAL.detachStreamFromWindow(MediaType.PLCM_MF_STREAM_CONTENT, 0, LAL.getActiveCall().getCallHandle()); /*detach content window*/ } break; case CallEventStateEnum.CONTENT_UNSUPPORTED: break; case CallEventStateEnum.CONTENT_IDLE: break; case CallEventStateEnum.OUTGOING_RINGING: /* UAC received far site is ringing.*/ { deviceManager.StopSound(); deviceManager.PlaySound(DeviceManager.RingingSound, true, 2000); Action hangupAction = () => { this.Close(); }; UXMessageMask.ShowMessage(this, false, "当前正呼叫中...", MessageBoxButtonsType.Hangup, MessageBoxIcon.Information , hangupAction); } break; case CallEventStateEnum.OUTGOING_FAILURE: /* from CC */ { deviceManager.StopSound(); Action okAction = () => { this.Close(); }; UXMessageMask.ShowMessage(this, false, "呼叫失敗!", MessageBoxButtonsType.OK, MessageBoxIcon.Error , okAction); } break; case CallEventStateEnum.OUTGOING_CONNECTED: /* from CC */ { deviceManager.StopSound(); ViewRender(); UXMessageMask.HideMessage(this); } break; case CallEventStateEnum.LOCAL_RESOLUTION_CHANGED: break; case CallEventStateEnum.REMOTE_RESOLUTION_CHANGED: break; case CallEventStateEnum.SIP_REGISTER_SUCCESS: break; /* Register to sip server succeed. */ case CallEventStateEnum.SIP_REGISTER_FAILURE: break; /* Register to sip server failed. */ case CallEventStateEnum.SIP_UNREGISTERED: break; /* Unregister to sip server. */ case CallEventStateEnum.NETWORK_CHANGED: break; /* Network changed or lost.*/ case CallEventStateEnum.CALL_AUDIO_ONLY_TRUE: break; /* The call is audio only.*/ case CallEventStateEnum.CALL_AUDIO_ONLY_FALSE: break; /* The call is not audio only.*/ case CallEventStateEnum.MFW_INTERNAL_TIME_OUT: break; //SVC case CallEventStateEnum.REFRESH_ACTIVE_SPEAKER: { // ViewRender(); //重新布局 } break; case CallEventStateEnum.REFRESH_LAYOUT: { this._call.ClearRemoteChannels(); } break; case CallEventStateEnum.CHANNEL_STATUS_UPDATE: break; case CallEventStateEnum.DISPLAYNAME_UPDATE: break; case CallEventStateEnum.CALL_MODE_UPGRADE_REQ: break; case CallEventStateEnum.DEVICE_VIDEOINPUT: break; case CallEventStateEnum.CERTIFICATE_VERIFY: break; case CallEventStateEnum.TRANSCODER_FINISH: break; case CallEventStateEnum.ICE_STATUS_CHANGED: break; case CallEventStateEnum.AUTODISCOVERY_SUCCESS: break; case CallEventStateEnum.AUTODISCOVERY_FAILURE: break; case CallEventStateEnum.AUTODISCOVERY_ERROR: break; case CallEventStateEnum.SIP_CALL_TRYING: { deviceManager.StopSound(); deviceManager.PlaySound(DeviceManager.RingingSound, true, 2000); Action hangupAction = () => { LAL.Hangup(this._call); }; UXMessageMask.ShowMessage(this, false, "呼叫中...", MessageBoxButtonsType.Hangup, MessageBoxIcon.Information , hangupAction); } break; } }