From f46be160caed45c67e8980173d29ed48d525a4d3 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 28 三月 2023 14:49:52 +0800
Subject: [PATCH] 2023年03月28日14:49:50

---
 HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs |  200 +++++++++++++++++++++++++++----------------------
 1 files changed, 110 insertions(+), 90 deletions(-)

diff --git a/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs b/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
index 9fa20e5..8466190 100644
--- a/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
+++ b/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
@@ -15,7 +15,7 @@
 #else
 using Foundation;
 using UIKit;
-using Shared.IOS.HDLLinphoneSDK;
+//using Shared.IOS.HDLLinphoneSDK;
 #endif
 
 namespace Shared
@@ -92,13 +92,13 @@
 
 #if __IOS__
 
-            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().InitalLinPhone();
-            //璁剧疆鏀跺埌鏉ョ數鍚庛�佹槸鍚﹂渶鑷姩璺宠浆鍛煎彨椤甸潰鏂规
-            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsAutoJumpCallView = IsAutoJumpCallView;
-            //璁剧疆Listener鐩戝惉
-            mOnHDLLinphoneCallDelegate = new OnHDLLinphoneCallDelegate(this);
-            Console.WriteLine(UserInfo.Current.ID);
-            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().HdlLinphoneCallDelegate = mOnHDLLinphoneCallDelegate;
+            //Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().InitalLinPhone();
+            ////璁剧疆鏀跺埌鏉ョ數鍚庛�佹槸鍚﹂渶鑷姩璺宠浆鍛煎彨椤甸潰鏂规
+            //Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsAutoJumpCallView = IsAutoJumpCallView;
+            ////璁剧疆Listener鐩戝惉
+            //mOnHDLLinphoneCallDelegate = new OnHDLLinphoneCallDelegate(this);
+            //Console.WriteLine(UserInfo.Current.ID);
+            //Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().HdlLinphoneCallDelegate = mOnHDLLinphoneCallDelegate;
 #else
             HDLLinphoneKit.Instance.InitLinphone(Application.Activity);
             //璁剧疆鏀跺埌鏉ョ數鍚庛�佹槸鍚﹂渶鑷姩璺宠浆鍛煎彨椤甸潰鏂规
@@ -117,22 +117,27 @@
 
             this.currentHDLSipInfo = mHDLSipInfo;
 
-            if (mHDLSipInfo == null) return;
+            if (mHDLSipInfo == null) {
+                //new alert
+                return;
+            }
+
+
 
 #if __IOS__
+            //Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login("1003", "123456", "192.168.31.194:5060");
             //Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login("6666", "85521566", "116.62.26.215:5060");
-            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm);
+            //Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm);
 #else
             if (mInterphoneType == InterphoneType.FREEVIEW.ToString())
             {
-                //HDLLinphoneKit.Instance.SetAccountAndLogin(
-                //    mHDLSipInfo.sipAccount,
-                //    mHDLSipInfo.sipPasswd,
-                //    mHDLSipInfo.realm,
-                //    HDLLinphoneKit.InterPhoneTypeFreeview
-                //    );
-
-                HDLLinphoneKit.Instance.SetAccountAndLogin("A583853817423247", "763548", "139.159.157.75:46000", HDLLinphoneKit.InterPhoneTypeFreeview);
+                HDLLinphoneKit.Instance.SetAccountAndLogin(
+                    mHDLSipInfo.sipAccount,
+                    mHDLSipInfo.sipPasswd,
+                    "139.159.157.75:47000",//mHDLSipInfo.realm,
+                    "sip:139.159.157.75:47000;transport=udp",
+                    HDLLinphoneKit.InterPhoneTypeFreeview
+                    );
             }
             else
             {
@@ -140,10 +145,10 @@
                    mHDLSipInfo.sipAccount,
                    mHDLSipInfo.sipPasswd,
                    mHDLSipInfo.realm,
+                   "sip:139.159.157.75:47000;transport=udp",
                    HDLLinphoneKit.InterPhoneTypeHdl
                    );
             }
-            // "A583853817423247","763548","139.159.157.75:46000",
 #endif
         }
 
@@ -158,7 +163,7 @@
             this.mHDLCallVideoInfo = null;
 #if __IOS__
 
-            HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser();
+            //HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser();
 #else
             HDLLinphoneKit.Instance.Logout();
 #endif
@@ -171,7 +176,7 @@
         {
 #if __IOS__
 
-            HDLLinPhoneSDK.Instance().ClearAllConfigs();
+            //HDLLinPhoneSDK.Instance().ClearAllConfigs();
 #else
             HDLLinphoneKit.Instance.ClearProxyConfig();
 #endif
@@ -235,6 +240,10 @@
                         SetAccountAndLogin(mHDLSipInfo, mHDLCallVideoInfo.InterphoneType);
                         Utlis.WriteLine("CALL 鑾峰彇SIP璐﹀彿鎴愬姛锛�" + mHDLSipInfo.sipAccount);
                     });
+                }
+                else
+                {
+                    new Alert("", $"鑾峰彇Sip璐﹀彿淇℃伅澶辫触.", "纭畾").Show();
                 }
             }
             catch { }
@@ -418,7 +427,7 @@
 
 #if __IOS__
 
-            HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName);
+            //HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName);
 
 #else
             //1.鍏堝懠鍙澶�
@@ -486,7 +495,16 @@
             {
 #if __IOS__
                 //鑷爺鍙瀵硅
-                HDLLinPhoneSDK.Instance().GotoHDLSRLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName,mHDLCallVideoInfo.DeviceSipAccount);
+                //HDLLinPhoneSDK.Instance().GotoHDLSRLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName,mHDLCallVideoInfo.DeviceSipAccount);
+#else
+                var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneReverseCallActivity));  
+                if (mHDLCallVideoInfo != null)
+                {
+                    //intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);
+                    intent.PutExtra("lpTitleName", mHDLCallVideoInfo.DeviceName);
+                    intent.PutExtra("lpSipAccount", mHDLCallVideoInfo.DeviceSipAccount);
+                }
+                Shared.Application.Activity.StartActivity(intent);
 #endif
             }
             else {
@@ -517,7 +535,8 @@
         /// <returns></returns>
         bool IsIncomingReceivedCallState() {
 #if __IOS__
-             return HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState;
+            //return HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState;
+            return true;
 #else
             return HDLLinphoneKit.Instance.IsIncomingReceivedCallState;
 #endif
@@ -530,13 +549,14 @@
 
 #if __IOS__
 
-            HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName);
+            //HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName);
 
 #else
             var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneIntercomActivity));
             if (mHDLCallVideoInfo != null)
             {
-                intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);
+                //intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);
+                intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.CallId);
             }
             Shared.Application.Activity.StartActivity(intent);
 #endif
@@ -735,81 +755,81 @@
 #if __IOS__
 
 #region OnHDLLinphoneCallDelegate
-        /// <summary>
-        /// 
-        /// </summary>
-        OnHDLLinphoneCallDelegate mOnHDLLinphoneCallDelegate;
+        ///// <summary>
+        ///// 
+        ///// </summary>
+        //OnHDLLinphoneCallDelegate mOnHDLLinphoneCallDelegate;
      
-        /// <summary>
-        /// 
-        /// </summary>
-        public class OnHDLLinphoneCallDelegate : HDLLinphoneCallDelegate
-        { 
-            [Weak] HDLLinphone hdlLinphone;
+        ///// <summary>
+        ///// 
+        ///// </summary>
+        //public class OnHDLLinphoneCallDelegate : HDLLinphoneCallDelegate
+        //{ 
+        //    [Weak] HDLLinphone hdlLinphone;
 
-            public OnHDLLinphoneCallDelegate(HDLLinphone mHDLLinphone)
-            {
-                this.hdlLinphone = mHDLLinphone;
-            }
+        //    public OnHDLLinphoneCallDelegate(HDLLinphone mHDLLinphone)
+        //    {
+        //        this.hdlLinphone = mHDLLinphone;
+        //    }
 
-            /// <summary>
-            /// 鎺ュ惉
-            /// </summary>
-            public override void OnAnswerAction()
-            {
-                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL);
-            }
+        //    /// <summary>
+        //    /// 鎺ュ惉
+        //    /// </summary>
+        //    public override void OnAnswerAction()
+        //    {
+        //        hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL);
+        //    }
 
-            /// <summary>
-            /// 鎸傛柇
-            /// </summary>
-            /// <param name="callDuration"></param>
-            public override void OnHangUpAction(int callDuration)
-            {
-                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration);
-            }
+        //    /// <summary>
+        //    /// 鎸傛柇
+        //    /// </summary>
+        //    /// <param name="callDuration"></param>
+        //    public override void OnHangUpAction(int callDuration)
+        //    {
+        //        hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration);
+        //    }
 
-            /// <summary>
-            /// 鎷掓帴
-            /// </summary>
-            public override void OnRejectCallAction()
-            {
-                hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL);
-            }
+        //    /// <summary>
+        //    /// 鎷掓帴
+        //    /// </summary>
+        //    public override void OnRejectCallAction()
+        //    {
+        //        hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL);
+        //    }
 
-            /// <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);
-            //}
+        //    /// <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);
+        //    //}
 
-            /// <summary>
-            /// 寮�閿佹垚鍔�
-            /// </summary>
-            public override void OnUnlockAction()
-            {
-                hdlLinphone.HDLUnlockAction();
-            }
+        //    /// <summary>
+        //    /// 寮�閿佹垚鍔�
+        //    /// </summary>
+        //    public override void OnUnlockAction()
+        //    {
+        //        hdlLinphone.HDLUnlockAction();
+        //    }
 
-            /// <summary>
-            /// 鏉ョ數涓�...
-            /// </summary>
-            public override void OnIncomingCall(string userName)
-            {
-                Utlis.WriteLine("OnIncomingCall :" + userName);
-            }
+        //    /// <summary>
+        //    /// 鏉ョ數涓�...
+        //    /// </summary>
+        //    public override void OnIncomingCall(string userName)
+        //    {
+        //        Utlis.WriteLine("OnIncomingCall :" + userName);
+        //    }
             
 
 
-        }
+        //}
 
 #endregion
 #endif

--
Gitblit v1.8.0