示例#1
0
        public static string GetVersion()
        {
            var intPtrVersion = PlcmHelper.getVersion();

            return(IntPtrHelper.IntPtrToUTF8string(intPtrVersion));
        }
示例#2
0
        /// <summary>
        /// 事件回调
        /// </summary>
        private static void AddEventCallbackF(IntPtr eventHandle, int call, IntPtr placeId, int eventType, IntPtr callerName,
                                              IntPtr calleeName, int userCode, IntPtr reason, int wndWidth, int wndHeight, bool plugDeviceStatus, IntPtr plugDeviceName, IntPtr deviceHandle, IntPtr ipAddress, int callMode,
                                              int streamId, int activeSpeakerStreamId, int remoteVideoChannelNum, IntPtr remoteChannelDisplayName, bool isActiveSpeaker, int isTalkingFlag, IntPtr regID, IntPtr sipCallId, IntPtr version, IntPtr serialNumber, IntPtr notBefore, IntPtr notAfter,
                                              IntPtr issuer, IntPtr subject, IntPtr signatureAlgorithm, IntPtr fingerPrintAlgorithm, IntPtr fingerPrint, IntPtr publickey, IntPtr basicContraints, IntPtr keyUsage, IntPtr rxtendedKeyUsage,
                                              IntPtr subjectAlternateNames, IntPtr pemCert, bool isCertHostNameOK, int certFailReason, int certConfirmId, IntPtr transcoderTaskId, IntPtr transcoderInputFileName, int iceStatus, IntPtr sutLiteMessage, bool isVideoOK, IntPtr mediaIPAddr, int discoveryStatus)
        {
            var strplaceId                  = IntPtrHelper.IntPtrTostring(placeId);
            var strcallerName               = IntPtrHelper.IntPtrTostring(callerName);
            var strcalleeName               = IntPtrHelper.IntPtrTostring(calleeName);
            var strreason                   = IntPtrHelper.IntPtrTostring(reason);
            var strplugDeviceName           = IntPtrHelper.IntPtrTostring(plugDeviceName);
            var strdeviceHandle             = IntPtrHelper.IntPtrTostring(deviceHandle);
            var stripAddress                = IntPtrHelper.IntPtrTostring(ipAddress);
            var strremoteChannelDisplayName = IntPtrHelper.IntPtrTostring(remoteChannelDisplayName);
            var strregID                   = IntPtrHelper.IntPtrTostring(regID);
            var strsipCallId               = IntPtrHelper.IntPtrTostring(sipCallId);
            var strVersion                 = IntPtrHelper.IntPtrTostring(version);
            var strSerialNumber            = IntPtrHelper.IntPtrTostring(serialNumber);
            var strNotBefore               = IntPtrHelper.IntPtrTostring(notBefore);
            var strNotAfter                = IntPtrHelper.IntPtrTostring(notAfter);
            var strIssuer                  = IntPtrHelper.IntPtrTostring(issuer);
            var strSubject                 = IntPtrHelper.IntPtrTostring(subject);
            var strSignatureAlgorithm      = IntPtrHelper.IntPtrTostring(signatureAlgorithm);
            var strFingerPrintAlgorithm    = IntPtrHelper.IntPtrTostring(fingerPrintAlgorithm);
            var strFingerPrint             = IntPtrHelper.IntPtrTostring(fingerPrint);
            var strPublickey               = IntPtrHelper.IntPtrTostring(publickey);
            var strBasicContraints         = IntPtrHelper.IntPtrTostring(basicContraints);
            var strKeyUsage                = IntPtrHelper.IntPtrTostring(keyUsage);
            var strExtendedKeyUsage        = IntPtrHelper.IntPtrTostring(rxtendedKeyUsage);
            var strSubjectAlternateNames   = IntPtrHelper.IntPtrTostring(subjectAlternateNames);
            var strPemCert                 = IntPtrHelper.IntPtrTostring(pemCert);
            var strtranscoderInputFileName = IntPtrHelper.IntPtrTostring(transcoderInputFileName);
            var strSUTLiteMessage          = IntPtrHelper.IntPtrTostring(sutLiteMessage);
            var strMediaIPAddr             = IntPtrHelper.IntPtrTostring(mediaIPAddr);
            var evt = new QLEvent(eventHandle, call, strplaceId, (EventType)eventType, strcallerName,
                                  strcalleeName, userCode, strreason,
                                  wndWidth, wndHeight, plugDeviceStatus, strplugDeviceName, strdeviceHandle, stripAddress, (CallMode)callMode,
                                  streamId, activeSpeakerStreamId, remoteVideoChannelNum, strremoteChannelDisplayName, isActiveSpeaker, isTalkingFlag, strregID, strsipCallId,
                                  strVersion,
                                  strSerialNumber,
                                  strNotBefore,
                                  strNotAfter,
                                  strIssuer,
                                  strSubject,
                                  strSignatureAlgorithm,
                                  strFingerPrintAlgorithm,
                                  strFingerPrint,
                                  strPublickey,
                                  strBasicContraints,
                                  strKeyUsage,
                                  strExtendedKeyUsage,
                                  strSubjectAlternateNames,
                                  strPemCert,
                                  isCertHostNameOK,
                                  certFailReason,
                                  certConfirmId,
                                  transcoderTaskId,
                                  strtranscoderInputFileName,
                                  (ICEStatus)iceStatus,
                                  strSUTLiteMessage,
                                  isVideoOK,
                                  strMediaIPAddr,
                                  (AutoDiscoveryStatus)discoveryStatus);

            AddEvent(evt);
        }
示例#3
0
        /// <summary>
        /// 统计信息回调
        /// </summary>
        private static void DisplayMediaStatisticsCallbackF(IntPtr channelNamePtr, IntPtr participantNamePtr, IntPtr remoteSystemIdPtr, IntPtr callRatePtr, IntPtr packetsLostPtr, IntPtr packetLossPtr,
                                                            IntPtr videoProtocolPtr, IntPtr videoRatePtr, IntPtr videoRateUsedPtr, IntPtr videoFrameRatePtr, IntPtr videoPacketsLostPtr, IntPtr videoJitterPtr,
                                                            IntPtr videoFormatPtr, IntPtr errorConcealmentPtr, IntPtr audioProtocolPtr, IntPtr audioRatePtr, IntPtr audioPacketsLostPtr, IntPtr audioJitterPtr,
                                                            IntPtr audioEncryptPtr, IntPtr videoEncryptPtr, IntPtr feccEncryptPtr, IntPtr audioReceivedPacketPtr, IntPtr roundTripTimePtr,
                                                            IntPtr fullIntraFrameRequestPtr, IntPtr intraFrameSentPtr, IntPtr packetsCountPtr, IntPtr overallCPULoadPtr, IntPtr channelNumPtr)
        {
            var channelName           = IntPtrHelper.IntPtrTostring(channelNamePtr);
            var participantName       = IntPtrHelper.IntPtrTostring(participantNamePtr);
            var remoteSystemId        = IntPtrHelper.IntPtrTostring(remoteSystemIdPtr);
            var callRate              = IntPtrHelper.IntPtrTostring(callRatePtr);
            var packetsLost           = IntPtrHelper.IntPtrTostring(packetsLostPtr);
            var packetLoss            = IntPtrHelper.IntPtrTostring(packetLossPtr);
            var videoProtocol         = IntPtrHelper.IntPtrTostring(videoProtocolPtr);
            var videoRate             = IntPtrHelper.IntPtrTostring(videoRatePtr);
            var videoRateUsed         = IntPtrHelper.IntPtrTostring(videoRateUsedPtr);
            var videoFrameRate        = IntPtrHelper.IntPtrTostring(videoFrameRatePtr);
            var videoPacketsLost      = IntPtrHelper.IntPtrTostring(videoPacketsLostPtr);
            var videoJitter           = IntPtrHelper.IntPtrTostring(videoJitterPtr);
            var videoFormat           = IntPtrHelper.IntPtrTostring(videoFormatPtr);
            var errorConcealment      = IntPtrHelper.IntPtrTostring(errorConcealmentPtr);
            var audioProtocol         = IntPtrHelper.IntPtrTostring(audioProtocolPtr);
            var audioRate             = IntPtrHelper.IntPtrTostring(audioRatePtr);
            var audioPacketsLost      = IntPtrHelper.IntPtrTostring(audioPacketsLostPtr);
            var audioJitter           = IntPtrHelper.IntPtrTostring(audioJitterPtr);
            var audioEncrypt          = IntPtrHelper.IntPtrTostring(audioEncryptPtr);
            var videoEncrypt          = IntPtrHelper.IntPtrTostring(videoEncryptPtr);
            var feccEncrypt           = IntPtrHelper.IntPtrTostring(feccEncryptPtr);
            var audioReceivedPacket   = IntPtrHelper.IntPtrTostring(audioReceivedPacketPtr);
            var roundTripTime         = IntPtrHelper.IntPtrTostring(roundTripTimePtr);
            var fullIntraFrameRequest = IntPtrHelper.IntPtrTostring(fullIntraFrameRequestPtr);
            var intraFrameSent        = IntPtrHelper.IntPtrTostring(intraFrameSentPtr);
            var packetsCount          = IntPtrHelper.IntPtrTostring(packetsCountPtr);
            var overallCPULoad        = IntPtrHelper.IntPtrTostring(overallCPULoadPtr);
            int channelNo             = 0;

            if (int.TryParse(IntPtrHelper.IntPtrTostring(channelNumPtr), out channelNo))
            {
                var statistics = new QLMediaStatistics()
                {
                    ChannelName           = channelName == "(null)"?string.Empty:channelName,
                    ParticipantName       = participantName == "(null)" ? string.Empty : participantName,
                    RemoteSystemId        = remoteSystemId == "(null)" ? string.Empty : remoteSystemId,
                    CallRate              = callRate == "(null)" ? string.Empty : callRate,
                    PacketsLost           = packetsLost == "(null)" ? string.Empty : packetsLost,
                    PacketLoss            = packetLoss == "(null)" ? string.Empty : packetLoss,
                    VideoProtocol         = videoProtocol == "(null)" ? string.Empty : videoProtocol,
                    VideoRate             = videoRate == "(null)" ? string.Empty : videoRate,
                    VideoRateUsed         = videoRateUsed == "(null)" ? string.Empty : videoRateUsed,
                    VideoFrameRate        = videoFrameRate == "(null)" ? string.Empty : videoFrameRate,
                    VideoPacketsLost      = videoPacketsLost == "(null)" ? string.Empty : videoPacketsLost,
                    VideoJitter           = videoJitter == "(null)" ? string.Empty : videoJitter,
                    VideoFormat           = videoFormat == "(null)" ? string.Empty : videoFormat,
                    ErrorConcealment      = errorConcealment == "(null)" ? string.Empty : errorConcealment,
                    AudioProtocol         = audioProtocol == "(null)" ? string.Empty : audioProtocol,
                    AudioRate             = audioRate == "(null)" ? string.Empty : audioRate,
                    AudioPacketsLost      = audioPacketsLost == "(null)" ? string.Empty : audioPacketsLost,
                    AudioJitter           = audioJitter == "(null)" ? string.Empty : audioJitter,
                    AudioEncrypt          = audioEncrypt == "(null)" ? string.Empty : audioEncrypt,
                    VideoEncrypt          = videoEncrypt == "(null)" ? string.Empty : videoEncrypt,
                    FeccEncrypt           = feccEncrypt == "(null)" ? string.Empty : feccEncrypt,
                    AudioReceivedPacket   = audioReceivedPacket == "(null)" ? string.Empty : audioReceivedPacket,
                    RoundTripTime         = roundTripTime == "(null)" ? string.Empty : roundTripTime,
                    FullIntraFrameRequest = fullIntraFrameRequest == "(null)" ? string.Empty : fullIntraFrameRequest,
                    IntraFrameSent        = intraFrameSent == "(null)" ? string.Empty : intraFrameSent,
                    PacketsCount          = packetsCount == "(null)" ? string.Empty : packetsCount,
                    OverallCPULoad        = overallCPULoad == "(null)" ? string.Empty : overallCPULoad,
                    ChannelNum            = channelNo
                };
                callView.Invoke(new Action(() =>
                {
                    QLManager.GetInstance().mediaStatistics.Add(statistics);
                }));
            }
        }
示例#4
0
        /// <summary>
        /// 设置属性
        /// </summary>
        /// <param name="key">属性名</param>
        /// <param name="value">属性值</param>
        /// <param name="isPersistence">是否持久化保存</param>
        public void SetProperty(PropertyKey key, string value, bool isPersistence)
        {
            log.Info(string.Format(string.Format("SetProperty:{0}={1}", key, value)));
            properties[key] = value;
            if (key <= PropertyKey.PLCM_MFW_KVLIST_KEY_MAXSYS)
            {
                var errno = PlcmProxy.SetProperty(key, value);
                if (errno != ErrorNumber.OK)
                {
                    var errMsg = string.Format("{0}设定失败,err={1}", key, errno);
                    log.Error(errMsg);
                    throw new Exception(errMsg);
                }
                if (isPersistence)
                {
                    errno = PlcmProxy.UpdateConfig();
                    if (errno != ErrorNumber.OK)
                    {
                        var errMsg = string.Format("{0}更新配置失败,err={1}", key, errno);
                        log.Error(errMsg);
                        throw new Exception(errMsg);
                    }
                }
            }
            else
            {
                switch (key)
                {
                case PropertyKey.LocalAddr: break;

                case PropertyKey.CalleeAddr: break;

                case PropertyKey.AUDIO_INPUT_DEVICE:
                {
                    string audioOutput = null;
                    if (properties.ContainsKey(PropertyKey.AUDIO_OUTPUT_DEVICE))
                    {
                        audioOutput = properties[PropertyKey.AUDIO_OUTPUT_DEVICE];
                    }
                    PlcmProxy.SetAudioDevice(value, audioOutput);
                }
                break;

                case PropertyKey.AUDIO_OUTPUT_DEVICE:
                {
                    string audioInput = null;
                    if (properties.ContainsKey(PropertyKey.AUDIO_INPUT_DEVICE))
                    {
                        audioInput = properties[PropertyKey.AUDIO_INPUT_DEVICE];
                    }
                    PlcmProxy.SetAudioDevice(audioInput, value);
                    PlcmProxy.SetAudioDeviceForRingtone(value);
                }
                break;

                case PropertyKey.AUDIO_OUTPUT_DEVICE_FOR_RINGTONE:
                {
                }
                break;

                case PropertyKey.VIDEO_INPUT_DEVICE:
                {
                    PlcmProxy.SetVideoDevice(value);
                }
                break;

                case PropertyKey.MONITOR_DEVICE: break;

                /*Sound Effects*/
                case PropertyKey.SOUND_INCOMING: break;

                case PropertyKey.SOUND_CLOSED: break;

                case PropertyKey.SOUND_RINGING: break;

                case PropertyKey.SOUND_HOLD: break;

                //ICE token
                case PropertyKey.ICE_AUTH_TOKEN: break;

                case PropertyKey.StaticImage: {
                    #region StaticImage
                    if (!string.IsNullOrWhiteSpace(value))
                    {
                        var filePath = Path.Combine(Application.StartupPath, value);
                        if (File.Exists(filePath))
                        {
                            var img = new Bitmap(filePath);
                            if (null != img)
                            {
                                int w      = img.Width;
                                int h      = img.Height;
                                var buffer = new byte[w * h * 4];
                                var idx    = 0;
                                for (var row = 0; row < h; row++)
                                {
                                    for (var col = 0; col < w; col++)
                                    {
                                        var color = img.GetPixel(col, row);
                                        //转换为RGBA模式
                                        buffer[idx] = color.R;
                                        idx++;
                                        buffer[idx] = color.G;
                                        idx++;
                                        buffer[idx] = color.B;
                                        idx++;
                                        buffer[idx] = color.A;
                                        idx++;
                                    }
                                }
                                int length = buffer.Length;

                                var intPtrBuffer = IntPtrHelper.IntPtrFromBytes(buffer);
                                var errno        = PlcmProxy.SetStaticImage(intPtrBuffer, length, w, h);
                                if (ErrorNumber.OK != errno)
                                {
                                    var errMsg = "setStaticImage failed,errno=" + errno;
                                    log.Error(errMsg);
                                    //throw new Exception(errMsg);
                                }
                            }
                        }
                    }
                    #endregion
                } break;

                case PropertyKey.LayoutType: break;

                case PropertyKey.CryptoSuiteType: break;

                case PropertyKey.SRTPKey: break;

                case PropertyKey.AuthToken: break;
                }
            }
        }