| | |
| | | #else |
| | | using Foundation; |
| | | using UIKit; |
| | | //using Shared.IOS.HDLLinphoneSDK; |
| | | using Shared.IOS.HDLLinphoneSDK; |
| | | #endif |
| | | |
| | | namespace Shared |
| | |
| | | |
| | | #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); |
| | | //设置收到来电后、是否需自动跳转呼叫页面方案 |
| | |
| | | |
| | | |
| | | #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()) |
| | | { |
| | |
| | | this.mHDLCallVideoInfo = null; |
| | | #if __IOS__ |
| | | |
| | | //HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser(); |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser(); |
| | | #else |
| | | HDLLinphoneKit.Instance.Logout(); |
| | | #endif |
| | |
| | | { |
| | | #if __IOS__ |
| | | |
| | | //HDLLinPhoneSDK.Instance().ClearAllConfigs(); |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().ClearAllConfigs(); |
| | | #else |
| | | HDLLinphoneKit.Instance.ClearProxyConfig(); |
| | | #endif |
| | |
| | | |
| | | #if __IOS__ |
| | | |
| | | //HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName); |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName); |
| | | |
| | | #else |
| | | //1.先呼叫设备 |
| | |
| | | { |
| | | #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) |
| | |
| | | if (IsAutoJumpCallView) return; |
| | | //先结束掉之前的线程 |
| | | EndCheckIncomingCallThread(); |
| | | //检测是否来电了如果是直接调整呼叫页面如果不是则开启线程等待判断 |
| | | //检测是否来电了如果是直接调整呼叫页面如果不是则开启线程等待判断(Shared.IOS.HDLLinphoneSDK) |
| | | if (IsIncomingReceivedCallState()) |
| | | { |
| | | Utlis.WriteLine("CALL 已经来电了。。。打开呼叫页面"); |
| | |
| | | } |
| | | |
| | | /// <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 |
| | |
| | | |
| | | #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)); |
| | |
| | | threadTime--; |
| | | Utlis.WriteLine("CALL 检测中...." + threadTime); |
| | | Thread.Sleep(1000); |
| | | //来电了,跳转呼叫页面 |
| | | //来电了,跳转呼叫页面(Shared.IOS.HDLLinphoneSDK) |
| | | if (IsIncomingReceivedCallState()) |
| | | { |
| | | Utlis.WriteLine("CALL 来电了。。。打开呼叫页面"); |
| | |
| | | return checkIncomingCallThread == null || checkIncomingCallThread.ThreadState != ThreadState.Running; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | #region ■ -- Android相关操作_______________________________ |
| | | #region ■ -- Android相关操作_______________________________ |
| | | |
| | | #if __Android__ |
| | | |
| | |
| | | } |
| | | |
| | | #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 |
| | | |
| | | } |
| | | |