wjc
2023-07-26 9508510f0b27da3278fa1161eb2ba3dd1e3e2030
HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
@@ -134,7 +134,7 @@
                    mHDLSipInfo.sipAccount,
                    mHDLSipInfo.sipPasswd,
                    "139.159.157.75:47000",//mHDLSipInfo.realm,
                    "sip:139.159.157.75:47000;transport=udp",
                    //"sip:139.159.157.75:47000;transport=udp",
                    HDLLinphoneKit.InterPhoneTypeFreeview
                    );
            }
@@ -144,7 +144,8 @@
                   mHDLSipInfo.sipAccount,
                   mHDLSipInfo.sipPasswd,
                   mHDLSipInfo.realm,
                   "sip:139.159.157.75:47000;transport=udp",
                   //mHDLSipInfo.proxy+ ";transport=udp",
                   //"sip:139.159.157.75:47000;transport=udp",
                   HDLLinphoneKit.InterPhoneTypeHdl
                   );
            }
@@ -164,7 +165,14 @@
            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser();
#else
            HDLLinphoneKit.Instance.Logout();
            if (HDLLinphoneKit.Instance != null)
            {
                HDLLinphoneKit.Instance.Logout();
            }
            else
            {
            }
#endif
        }
@@ -226,7 +234,7 @@
                //先清空呼叫和监视设备信息
                if (clearCallInfo)
                {
                    InitCallInfo(null);
                    //InitCallInfo(null);//造成接收呼叫时开锁开锁异常
                }
                HDLSipInfo mHDLSipInfo = GetHDLSipInfo(mHDLCallVideoInfo.HomeId);
@@ -234,15 +242,31 @@
                {
                    Application.RunOnMainThread(() =>
                    {
                        InitLinphone();
                        try
                        {
                            InitLinphone();
                        }
                        catch (Exception ex)
                        {
                            MainPage.Log($"InitLinphone exception : {ex.Message}");
                        }
                        mHDLSipInfo.homeId = mHDLCallVideoInfo.HomeId;
                        SetAccountAndLogin(mHDLSipInfo, mHDLCallVideoInfo.InterphoneType);
                        try {
                            SetAccountAndLogin(mHDLSipInfo, mHDLCallVideoInfo.InterphoneType);
                        }
                        catch (Exception ex)
                        {
                            MainPage.Log($"SetAccountAndLogin exception : {ex.Message}");
                        }
                        Utlis.WriteLine("CALL 获取SIP账号成功:" + mHDLSipInfo.sipAccount);
                    });
                }
                else
                {
                    new Alert("", $"获取Sip账号信息失败.", "确定").Show();
                    //Application.RunOnMainThread(() =>
                    //{
                    //    new Alert("", $"获取Sip账号信息失败.", "确定").Show();
                    //});
                }
            }
            catch { }
@@ -314,7 +338,7 @@
        #region ■  --  新接听和开锁接口_______________________________
        /// <summary>
        /// 开锁
        /// 可视对讲开锁
        /// </summary>
        public void HDLUnlockAction()
        {
@@ -334,6 +358,10 @@
                Application.RunOnMainThread(() =>
                {
                    if(revertObj == null)
                    {
                        return;
                    }
#if __IOS__
                    if (revertObj.Code == StateCode.SUCCESS)
@@ -799,16 +827,16 @@
            /// <summary>
            /// 截图成功
            /// </summary>
            /// <param name="image"></param>
            //public override void OnScreenshotSuccessfulAction(UIImage image)
            //{
            ////NSData imageData = UIImagePNGRepresentation(image); UIImage
            //NSData imageData = image.AsPNG();
            //byte[] dataBytes = new byte[imageData.Length];
            //System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, dataBytes, 0, Convert.ToInt32(imageData.Length));
            ////image.g
            ////hdlLinphone.ScreenshotSuccessfulAction(dataBytes);
            //}
            /// <param name = "image" ></ param >
            public  void OnScreenshotSuccessfulAction(UIImage image)
            {
                //NSData imageData = UIImagePNGRepresentation(image); UIImage
                NSData imageData = image.AsPNG();
                byte[] dataBytes = new byte[imageData.Length];
                System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, dataBytes, 0, Convert.ToInt32(imageData.Length));
                //image.g
                //hdlLinphone.ScreenshotSuccessfulAction(dataBytes);
            }
            /// <summary>
            /// 开锁成功
@@ -825,8 +853,6 @@
            {
                Utlis.WriteLine("OnIncomingCall :" + userName);
            }
        }