| | |
| | | #else |
| | | using Foundation; |
| | | using UIKit; |
| | | //using Shared.IOS.HDLLinphoneSDK; |
| | | using Shared.IOS.HDLLinphoneSDK; |
| | | #endif |
| | | |
| | | namespace Shared |
| | |
| | | |
| | | |
| | | |
| | | //登录sip服务器 |
| | | #if __IOS__ |
| | | |
| | | 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, |
| | | "139.159.157.75:47000",//mHDLSipInfo.realm, |
| | | "sip:139.159.157.75:47000;transport=udp", |
| | | mHDLSipInfo.realm, |
| | | //"sip:139.159.157.75:47000;transport=udp", |
| | | HDLLinphoneKit.InterPhoneTypeFreeview |
| | | ); |
| | | } |
| | |
| | | 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 |
| | | ); |
| | | } |
| | |
| | | |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser(); |
| | | #else |
| | | HDLLinphoneKit.Instance.Logout(); |
| | | if (HDLLinphoneKit.Instance != null) |
| | | { |
| | | HDLLinphoneKit.Instance.Logout(); |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | #endif |
| | | } |
| | | |
| | |
| | | //先清空呼叫和监视设备信息 |
| | | if (clearCallInfo) |
| | | { |
| | | InitCallInfo(null); |
| | | //InitCallInfo(null);//造成接收呼叫时开锁开锁异常 |
| | | } |
| | | |
| | | HDLSipInfo mHDLSipInfo = GetHDLSipInfo(mHDLCallVideoInfo.HomeId); |
| | |
| | | { |
| | | 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 { } |
| | |
| | | |
| | | #region ■ -- 新接听和开锁接口_______________________________ |
| | | /// <summary> |
| | | /// 开锁 |
| | | /// 可视对讲开锁 |
| | | /// </summary> |
| | | public void HDLUnlockAction() |
| | | { |
| | |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if(revertObj == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | #if __IOS__ |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | |
| | | |
| | | #if __IOS__ |
| | | |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName); |
| | | if (mHDLCallVideoInfo.spk == "door.gate") |
| | | { |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().CallHDLSRWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName); |
| | | }else{ |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName); |
| | | } |
| | | |
| | | |
| | | #else |
| | | //1.先呼叫设备 |
| | |
| | | { |
| | | [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); |
| | | //} |
| | | /// <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 OnUnlockAction() |
| | | // { |
| | | // hdlLinphone.HDLUnlockAction(); |
| | | // } |
| | | /// <summary> |
| | | /// 开锁成功 |
| | | /// </summary> |
| | | public override void OnUnlockAction() |
| | | { |
| | | hdlLinphone.HDLUnlockAction(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 来电中... |
| | |
| | | Utlis.WriteLine("OnIncomingCall :" + userName); |
| | | } |
| | | |
| | | |
| | | |
| | | //} |
| | | } |
| | | |
| | | #endregion |
| | | #endif |