Esempio n. 1
0
        public void Hold(int callHandle)
        {
            var call = callManager.GetCall(callHandle);

            if (null != call)
            {
                if (!LAL.Hold(call))
                {
                    MessageBox.Show(this, "接听保持失败!", "消息框", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
        private void btnVideoCall_Click(object sender, EventArgs e)
        {
            var callAddr = txtCallee.Text.Trim();

            if (string.IsNullOrEmpty(callAddr))
            {
                MessageBox.Show("被呼叫方必须");
                return;
            }

            LAL.Hold(true);
            log.Info("[MainWindow]Dial a call " + CallModeEnum.PLCM_MFW_AUDIOVIDEO_CALL);
            var errno = LAL.Dial(callAddr, CallModeEnum.PLCM_MFW_AUDIOVIDEO_CALL);
            var msg   = string.Empty;

            switch (errno)
            {
            case ErrorNumberEnum.PLCM_SAMPLE_OK:
                break;

            case ErrorNumberEnum.PLCM_MFW_ERR_CALL_INVALID_FORMAT:
                msg = "Place call failed. Your input is in wrong format or contains illegal characters.";
                break;

            case ErrorNumberEnum.PLCM_MFW_ERR_CALL_IN_REGISTERING:
                msg = "Place call failed. Registering to server, please try again after your registration is completed";
                break;

            case ErrorNumberEnum.PLCM_MFW_ERR_CALL_EXCEED_MAXIMUM_CALLS:
                msg = "Place call failed. Total Call Number Exceeds Maximum Allowable Value.";
                break;

            case ErrorNumberEnum.PLCM_MFW_ERR_ENCRYPTION_CONFIG:
                msg = "Place call failed. Encryption settings do not match.";
                break;

            case ErrorNumberEnum.PLCM_MFW_ERR_CALL_NO_CONNECT:
                msg = "Place call failed. No local network connection.";
                break;

            case ErrorNumberEnum.PLCM_MFW_ERR_CALL_HOST_UNKNOWN:
                msg = "Place call failed. Your input can not be parsed into a valid address.";
                break;

            case ErrorNumberEnum.PLCM_MFW_ERR_CALL_EXIST:
                msg = "Place call failed. The call of the far site already exist.";
                break;

            case ErrorNumberEnum.PLCM_MFW_ERR_GENERIC:
                msg = "Place call failed. PLCM_MFW_ERR_GENERIC";
                break;

            default:
                msg = "Place call failed." + errno.ToString();
                break;
            }
            if (!string.IsNullOrEmpty(msg))
            {
                if (MessageBox.Show(this, msg, "消息通知", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
                {
                }
            }
        }