From dc9a1b15bb69227e19afc070adf58156a362d2a2 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期一, 30 九月 2024 17:07:58 +0800 Subject: [PATCH] 安卓可视对讲响铃, --- HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs | 115 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 99 insertions(+), 16 deletions(-) diff --git a/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs b/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs index 900d456..b8c70e9 100644 --- a/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs +++ b/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs @@ -13,6 +13,7 @@ using Android.Widget; using Com.Hdl.Hdllinphonesdk; #else +using Other; using Foundation; using UIKit; using Shared.IOS.HDLLinphoneSDK; @@ -126,7 +127,17 @@ //鐧诲綍sip鏈嶅姟鍣� #if __IOS__ - Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm); + string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion; + System.Version currentVersion = new System.Version(systemVersion); + System.Version version17 = new System.Version(17, 0); + if (currentVersion.CompareTo(version17) > 0) + { + HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm, "udp"); + } + else + { + HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm, DB_ResidenceData.Instance.linphoneConnectType.ToString()); + } #else if (mInterphoneType == InterphoneType.FREEVIEW.ToString()) { @@ -135,7 +146,8 @@ mHDLSipInfo.sipPasswd, mHDLSipInfo.realm, //"sip:139.159.157.75:47000;transport=udp", - HDLLinphoneKit.InterPhoneTypeFreeview + HDLLinphoneKit.InterPhoneTypeFreeview, + DB_ResidenceData.Instance.linphoneConnectType.ToString() ); } else @@ -146,7 +158,8 @@ mHDLSipInfo.realm, //mHDLSipInfo.proxy+ ";transport=udp", //"sip:139.159.157.75:47000;transport=udp", - HDLLinphoneKit.InterPhoneTypeHdl + HDLLinphoneKit.InterPhoneTypeHdl, + DB_ResidenceData.Instance.linphoneConnectType.ToString() ); } #endif @@ -510,9 +523,16 @@ /// 鏀跺埌鎺ㄩ�侊紝鍚庡垽鏂懠鍙綇瀹呮槸鍚︿负褰撳墠浣忓畢锛屼笉鏄殑璇濋噸鏂拌幏鍙朣IP璐﹀彿骞剁櫥褰� /// </summary> /// <param name="mESVideoInfo"></param> - public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType) + public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType, bool isNotificationGoing = false) { - if(this.mHDLCallVideoInfo != null) +#if __ANDROID__ + //isNotificationGoing鍙傛暟鏄笓闂ㄧ粰瀹夊崜浣跨敤鐨勶紝鍥犱负瀹夊崜鍦ㄥ悗闈㈢殑鏃跺�欏凡缁忓惎鍔ㄤ簡鎺ュ惉鐨勭晫闈簡锛屼粠閫氱煡鏍忚繘鏉ョ殑鏃跺�欙紝callid宸茬粡琚娇鐢ㄤ簡锛屾墍浠ヨ閲嶇疆鎺夎繖涓睘鎬� + if (isNotificationGoing) + { + this.mHDLCallVideoInfo.CallId = ""; + } +#endif + if (this.mHDLCallVideoInfo != null) { if(this.mHDLCallVideoInfo.CallId == mESVideoInfo.callId) { @@ -575,6 +595,7 @@ intent.PutExtra("lpTitleName", mHDLCallVideoInfo.DeviceName); intent.PutExtra("lpSipAccount", mHDLCallVideoInfo.DeviceSipAccount); } + MainPage.Log("鍚姩鑷爺鍙瀵硅鐣岄潰"); Shared.Application.Activity.StartActivity(intent); #endif } @@ -607,7 +628,7 @@ bool IsIncomingReceivedCallState() { #if __IOS__ - return Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState; + return HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState; #else return HDLLinphoneKit.Instance.IsIncomingReceivedCallState; #endif @@ -620,6 +641,7 @@ #if __IOS__ + HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName); #else @@ -752,7 +774,14 @@ public void OnAnswerAction() { //showToast("鎺ュ惉"); - HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); + try + { + HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); + } + catch (Exception ex) + { + MainPage.Log("閾冨0鍏抽棴寮傚父:" + ex.StackTrace); + } hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL); } /// <summary> @@ -772,10 +801,23 @@ public void OnRejectCallAction() { //showToast("鎷掓帴"); - HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); - hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); + try + { + HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); + } + catch (Exception ex) + { + MainPage.Log("閾冨0鍏抽棴寮傚父:" + ex.StackTrace); + } + try + { + hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); + } + catch (Exception ex) + { + MainPage.Log("OnRejectCallAction寮傚父:" + ex.StackTrace); + } } - /// <summary> /// 鎴浘鎴愬姛浜嬩欢 /// </summary> @@ -808,15 +850,43 @@ /// </summary> public void OnCallAllRejection() { - HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); - hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); - hdlLinphone.HDLRejectCallIn(); + try + { + HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); + } + catch (Exception ex) + { + MainPage.Log("閾冨0鍏抽棴寮傚父:" + ex.StackTrace); + } + try + { + hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); + hdlLinphone.HDLRejectCallIn(); + } + catch (Exception ex) + { + MainPage.Log("鍏ㄩ儴鎸傛柇寮傚父:" + ex.StackTrace); + } } public void OnMissedCallsAction() { - HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); - hdlLinphone.HDLUpdateCallStatus(CallStatusType.MISSED, InterphoneType.HDL); + try + { + HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); + } + catch (Exception ex) + { + MainPage.Log("閾冨0鍏抽棴寮傚父:" + ex.StackTrace); + } + try + { + hdlLinphone.HDLUpdateCallStatus(CallStatusType.MISSED, InterphoneType.HDL); + } + catch (Exception ex) + { + MainPage.Log("OnMissedCallsAction寮傚父:" + ex.StackTrace); + } } } @@ -885,6 +955,7 @@ /// </summary> public override void OnRejectCallAction() { + MainPage.Log("iOS 鍏ㄩ儴鎷掓帴"); Other.SoundPlayer.Ins.StopSound(); hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); } @@ -893,7 +964,7 @@ /// 鎴浘鎴愬姛 /// </summary> /// <param name = "image" ></ param > - public void OnScreenshotSuccessfulAction(UIImage image) + public override void OnScreenshotSuccessfulAction(UIImage image) { //NSData imageData = UIImagePNGRepresentation(image); UIImage NSData imageData = image.AsPNG(); @@ -919,6 +990,18 @@ Utlis.WriteLine("OnIncomingCall :" + userName); } + public override void OnRejectAllCallAction() + { + MainPage.Log("iOS 鍏ㄩ儴鎷掓帴"); + Other.SoundPlayer.Ins.StopSound(); + hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); + hdlLinphone.HDLRejectCallIn(); + } + + //public override void OnScreenshotSuccessfulAction(UIImage image) + //{ + // throw new NotImplementedException(); + //} } #endregion -- Gitblit v1.8.0