From 452e8cef1c740d18ee398be6971d9952e41dbd4a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 12 四月 2023 16:11:50 +0800
Subject: [PATCH] 1
---
HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs | 203 ++++++++++++++++++++++++++------------------------
1 files changed, 106 insertions(+), 97 deletions(-)
diff --git a/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs b/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
index 8466190..13c9e3c 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鐩戝惉(Shared.IOS.HDLLinphoneSDK)
+ mOnHDLLinphoneCallDelegate = new OnHDLLinphoneCallDelegate(this);
+ Console.WriteLine(UserInfo.Current.ID);
+ Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().HdlLinphoneCallDelegate = mOnHDLLinphoneCallDelegate;
#else
HDLLinphoneKit.Instance.InitLinphone(Application.Activity);
//璁剧疆鏀跺埌鏉ョ數鍚庛�佹槸鍚﹂渶鑷姩璺宠浆鍛煎彨椤甸潰鏂规
@@ -125,9 +125,8 @@
#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())
{
@@ -163,9 +162,16 @@
this.mHDLCallVideoInfo = null;
#if __IOS__
- //HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser();
+ Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser();
#else
- HDLLinphoneKit.Instance.Logout();
+ if (HDLLinphoneKit.Instance != null)
+ {
+ HDLLinphoneKit.Instance.Logout();
+ }
+ else
+ {
+
+ }
#endif
}
@@ -176,7 +182,7 @@
{
#if __IOS__
- //HDLLinPhoneSDK.Instance().ClearAllConfigs();
+ Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().ClearAllConfigs();
#else
HDLLinphoneKit.Instance.ClearProxyConfig();
#endif
@@ -243,7 +249,10 @@
}
else
{
- new Alert("", $"鑾峰彇Sip璐﹀彿淇℃伅澶辫触.", "纭畾").Show();
+ //Application.RunOnMainThread(() =>
+ //{
+ // new Alert("", $"鑾峰彇Sip璐﹀彿淇℃伅澶辫触.", "纭畾").Show();
+ //});
}
}
catch { }
@@ -427,7 +436,7 @@
#if __IOS__
- //HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName);
+ Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName);
#else
//1.鍏堝懠鍙澶�
@@ -495,7 +504,7 @@
{
#if __IOS__
//鑷爺鍙瀵硅
- //HDLLinPhoneSDK.Instance().GotoHDLSRLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName,mHDLCallVideoInfo.DeviceSipAccount);
+ Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().GotoHDLSRLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName, mHDLCallVideoInfo.DeviceSipAccount);
#else
var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneReverseCallActivity));
if (mHDLCallVideoInfo != null)
@@ -513,7 +522,7 @@
if (IsAutoJumpCallView) return;
//鍏堢粨鏉熸帀涔嬪墠鐨勭嚎绋�
EndCheckIncomingCallThread();
- //妫�娴嬫槸鍚︽潵鐢典簡濡傛灉鏄洿鎺ヨ皟鏁村懠鍙〉闈㈠鏋滀笉鏄垯寮�鍚嚎绋嬬瓑寰呭垽鏂�
+ //妫�娴嬫槸鍚︽潵鐢典簡濡傛灉鏄洿鎺ヨ皟鏁村懠鍙〉闈㈠鏋滀笉鏄垯寮�鍚嚎绋嬬瓑寰呭垽鏂�(Shared.IOS.HDLLinphoneSDK)
if (IsIncomingReceivedCallState())
{
Utlis.WriteLine("CALL 宸茬粡鏉ョ數浜嗐�傘�傘�傛墦寮�鍛煎彨椤甸潰");
@@ -530,13 +539,13 @@
}
/// <summary>
- /// 鏄惁鏉ョ數鐘舵��
+ /// 鏄惁鏉ョ數鐘舵��(Shared.IOS.HDLLinphoneSDK)
/// </summary>
/// <returns></returns>
- bool IsIncomingReceivedCallState() {
+ bool IsIncomingReceivedCallState()
+ {
#if __IOS__
- //return HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState;
- return true;
+ return Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState;
#else
return HDLLinphoneKit.Instance.IsIncomingReceivedCallState;
#endif
@@ -549,7 +558,7 @@
#if __IOS__
- //HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName);
+ Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName);
#else
var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneIntercomActivity));
@@ -598,7 +607,7 @@
threadTime--;
Utlis.WriteLine("CALL 妫�娴嬩腑...." + threadTime);
Thread.Sleep(1000);
- //鏉ョ數浜嗭紝璺宠浆鍛煎彨椤甸潰
+ //鏉ョ數浜嗭紝璺宠浆鍛煎彨椤甸潰(Shared.IOS.HDLLinphoneSDK)
if (IsIncomingReceivedCallState())
{
Utlis.WriteLine("CALL 鏉ョ數浜嗐�傘�傘�傛墦寮�鍛煎彨椤甸潰");
@@ -650,10 +659,10 @@
return checkIncomingCallThread == null || checkIncomingCallThread.ThreadState != ThreadState.Running;
}
-#endregion
+ #endregion
-#region 鈻� -- Android鐩稿叧鎿嶄綔_______________________________
+ #region 鈻� -- Android鐩稿叧鎿嶄綔_______________________________
#if __Android__
@@ -748,93 +757,93 @@
}
#endif
-#endregion
+ #endregion
-#region 鈻� -- iOS鐩稿叧鎿嶄綔_______________________________
+ #region 鈻� -- iOS鐩稿叧鎿嶄綔_______________________________
#if __IOS__
-#region OnHDLLinphoneCallDelegate
- ///// <summary>
- /////
- ///// </summary>
- //OnHDLLinphoneCallDelegate mOnHDLLinphoneCallDelegate;
-
- ///// <summary>
- /////
- ///// </summary>
- //public class OnHDLLinphoneCallDelegate : HDLLinphoneCallDelegate
- //{
- // [Weak] HDLLinphone hdlLinphone;
+ #region OnHDLLinphoneCallDelegate
+ /// <summary>
+ ///
+ /// </summary>
+ OnHDLLinphoneCallDelegate mOnHDLLinphoneCallDelegate;
- // public OnHDLLinphoneCallDelegate(HDLLinphone mHDLLinphone)
- // {
- // this.hdlLinphone = mHDLLinphone;
- // }
+ /// <summary>
+ ///
+ /// </summary>
+ public class OnHDLLinphoneCallDelegate : HDLLinphoneCallDelegate
+ {
+ [Weak] HDLLinphone hdlLinphone;
- // /// <summary>
- // /// 鎺ュ惉
- // /// </summary>
- // public override void OnAnswerAction()
- // {
- // hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL);
- // }
+ public OnHDLLinphoneCallDelegate(HDLLinphone mHDLLinphone)
+ {
+ this.hdlLinphone = mHDLLinphone;
+ }
- // /// <summary>
- // /// 鎸傛柇
- // /// </summary>
- // /// <param name="callDuration"></param>
- // public override void OnHangUpAction(int callDuration)
- // {
- // hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration);
- // }
+ /// <summary>
+ /// 鎺ュ惉
+ /// </summary>
+ public override void OnAnswerAction()
+ {
+ hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL);
+ }
- // /// <summary>
- // /// 鎷掓帴
- // /// </summary>
- // public override void OnRejectCallAction()
- // {
- // hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, 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="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 OnRejectCallAction()
+ {
+ hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL);
+ }
- // /// <summary>
- // /// 寮�閿佹垚鍔�
- // /// </summary>
- // public override void OnUnlockAction()
- // {
- // hdlLinphone.HDLUnlockAction();
- // }
+ /// <summary>
+ /// 鎴浘鎴愬姛
+ /// </summary>
+ /// <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>
- // /// 鏉ョ數涓�...
- // /// </summary>
- // public override void OnIncomingCall(string userName)
- // {
- // Utlis.WriteLine("OnIncomingCall :" + userName);
- // }
-
+ /// <summary>
+ /// 寮�閿佹垚鍔�
+ /// </summary>
+ public override void OnUnlockAction()
+ {
+ hdlLinphone.HDLUnlockAction();
+ }
+
+ /// <summary>
+ /// 鏉ョ數涓�...
+ /// </summary>
+ public override void OnIncomingCall(string userName)
+ {
+ Utlis.WriteLine("OnIncomingCall :" + userName);
+ }
- //}
-#endregion
+ }
+
+ #endregion
#endif
-#endregion
+ #endregion
}
--
Gitblit v1.8.0