| | |
| | | using Android.Widget; |
| | | using Com.Hdl.Hdllinphonesdk; |
| | | #else |
| | | using Other; |
| | | using Foundation; |
| | | using UIKit; |
| | | using Shared.IOS.HDLLinphoneSDK; |
| | |
| | | |
| | | |
| | | |
| | | //登录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()) |
| | | { |
| | | HDLLinphoneKit.Instance.SetAccountAndLogin( |
| | | mHDLSipInfo.sipAccount, |
| | | mHDLSipInfo.sipPasswd, |
| | | "139.159.157.75:47000",//mHDLSipInfo.realm, |
| | | mHDLSipInfo.realm, |
| | | //"sip:139.159.157.75:47000;transport=udp", |
| | | HDLLinphoneKit.InterPhoneTypeFreeview |
| | | HDLLinphoneKit.InterPhoneTypeFreeview, |
| | | DB_ResidenceData.Instance.linphoneConnectType.ToString() |
| | | ); |
| | | } |
| | | else |
| | |
| | | mHDLSipInfo.realm, |
| | | //mHDLSipInfo.proxy+ ";transport=udp", |
| | | //"sip:139.159.157.75:47000;transport=udp", |
| | | HDLLinphoneKit.InterPhoneTypeHdl |
| | | HDLLinphoneKit.InterPhoneTypeHdl, |
| | | DB_ResidenceData.Instance.linphoneConnectType.ToString() |
| | | ); |
| | | } |
| | | #endif |
| | |
| | | //先清空呼叫和监视设备信息 |
| | | if (clearCallInfo) |
| | | { |
| | | InitCallInfo(null); |
| | | //InitCallInfo(null);//造成接收呼叫时开锁开锁异常 |
| | | } |
| | | |
| | | HDLSipInfo mHDLSipInfo = GetHDLSipInfo(mHDLCallVideoInfo.HomeId); |
| | |
| | | { IsBackground = false }.Start(); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 拒接(挂段所有呼叫) |
| | | /// </summary> |
| | | public void HDLRejectCallIn() { |
| | | |
| | | if (CheckmHDLCallVideoInfoIsNullOrEmpty()) return; |
| | | |
| | | new Thread(() => |
| | | { |
| | | Dictionary<string, object> dic = new Dictionary<string, object>(); |
| | | dic.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | dic.Add("deviceId", mHDLCallVideoInfo.DeviceId); |
| | | dic.Add("interphoneType", "HDL"); |
| | | dic.Add("callId", mHDLCallVideoInfo.CallId);//呼叫id |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(dic); |
| | | var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_RejectCallIn, requestJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("POST 更新状态失败 code: " + revertObj.Code); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = false }.Start(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region ■ -- 跳转监控页面_______________________________ |
| | | /// <summary> |
| | | /// 跳转监控页面 |
| | |
| | | |
| | | #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.先呼叫设备 |
| | |
| | | /// <param name="mESVideoInfo"></param> |
| | | public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType) |
| | | { |
| | | if(this.mHDLCallVideoInfo != null) |
| | | { |
| | | if(this.mHDLCallVideoInfo.CallId == mESVideoInfo.callId) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | InitLinphone(); |
| | | |
| | | HDLCallVideoInfo mHDLCallVideoInfo = new HDLCallVideoInfo(); |
| | |
| | | { |
| | | #if __IOS__ |
| | | //自研可视对讲 |
| | | Shared.IOS.HDLLinphoneSDK.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) |
| | |
| | | bool IsIncomingReceivedCallState() |
| | | { |
| | | #if __IOS__ |
| | | return Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState; |
| | | return HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState; |
| | | #else |
| | | return HDLLinphoneKit.Instance.IsIncomingReceivedCallState; |
| | | #endif |
| | |
| | | |
| | | #if __IOS__ |
| | | |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName); |
| | | |
| | | HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName); |
| | | |
| | | #else |
| | | var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneIntercomActivity)); |
| | |
| | | public void OnAnswerAction() |
| | | { |
| | | //showToast("接听"); |
| | | HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); |
| | | hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL); |
| | | } |
| | | /// <summary> |
| | |
| | | public void OnRejectCallAction() |
| | | { |
| | | //showToast("拒接"); |
| | | HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); |
| | | hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); |
| | | } |
| | | |
| | |
| | | public void OnIncomingCall(string userName) |
| | | { |
| | | Utlis.WriteLine("OnIncomingCall :" + userName); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 拒接事件 |
| | | /// 全部挂断 |
| | | /// </summary> |
| | | public void OnCallAllRejection() |
| | | { |
| | | HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); |
| | | hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); |
| | | hdlLinphone.HDLRejectCallIn(); |
| | | } |
| | | |
| | | public void OnMissedCallsAction() |
| | | { |
| | | HDLLinphoneKit.Instance.SetMediaPlayerLooping(false); |
| | | hdlLinphone.HDLUpdateCallStatus(CallStatusType.MISSED, InterphoneType.HDL); |
| | | } |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | public override void OnAnswerAction() |
| | | { |
| | | Other.SoundPlayer.Ins.StopSound(); |
| | | hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL); |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | public override void OnRejectCallAction() |
| | | { |
| | | MainPage.Log("iOS 全部拒接"); |
| | | Other.SoundPlayer.Ins.StopSound(); |
| | | hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); |
| | | } |
| | | |
| | |
| | | /// 截图成功 |
| | | /// </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(); |
| | |
| | | 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 |