| | |
| | | /// </summary> |
| | | public bool IsEnable = false; |
| | | /// <summary> |
| | | /// 当前视频通话是否为自研 |
| | | /// </summary> |
| | | public bool IsSelfResearch = false; |
| | | /// <summary> |
| | | /// 是否自动跳转呼叫页面, |
| | | /// false:收到推送并且已经收到sip呼叫才跳转呼叫页面 |
| | | /// true:原生收到呼叫马上跳转呼叫页面,不等待推送过来 |
| | | /// </summary> |
| | | bool IsAutoJumpCallView = false; |
| | | bool IsAutoJumpCallView = true; |
| | | /// <summary> |
| | | /// 是否初始化了SDK |
| | | /// </summary> |
| | |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsAutoJumpCallView = IsAutoJumpCallView; |
| | | //设置Listener监听 |
| | | mOnHDLLinphoneCallDelegate = new OnHDLLinphoneCallDelegate(this); |
| | | Console.WriteLine(UserInfo.Current.ID); |
| | | Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().HdlLinphoneCallDelegate = mOnHDLLinphoneCallDelegate; |
| | | #else |
| | | HDLLinphoneKit.Instance.InitLinphone(Application.Activity); |
| | | //设置收到来电后、是否需自动跳转呼叫页面方案 |
| | | HDLLinphoneKit.Instance.AutoJumpCallView = IsAutoJumpCallView; |
| | | //HDLLinphoneKit.Instance.HangUp();//挂断 |
| | | //设置Listener监听 |
| | | setOnHDLLinphoneCallListener(); |
| | | #endif |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 设置sip登录账号 |
| | | /// </summary> |
| | | /// <param name="mHDLSipInfo"></param> |
| | | public void SetAccountAndLogin(HDLSipInfo mHDLSipInfo) |
| | | public void SetAccountAndLogin(HDLSipInfo mHDLSipInfo, string mInterphoneType) |
| | | { |
| | | |
| | | this.currentHDLSipInfo = mHDLSipInfo; |
| | |
| | | //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); |
| | | #else |
| | | HDLLinphoneKit.Instance.SetAccountAndLogin(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm); |
| | | if (mInterphoneType == InterphoneType.FREEVIEW.ToString()) |
| | | { |
| | | HDLLinphoneKit.Instance.SetAccountAndLogin( |
| | | mHDLSipInfo.sipAccount, |
| | | mHDLSipInfo.sipPasswd, |
| | | "139.159.157.75:46000", |
| | | HDLLinphoneKit.InterPhoneTypeFreeview |
| | | ); |
| | | } |
| | | else |
| | | { |
| | | HDLLinphoneKit.Instance.SetAccountAndLogin( |
| | | mHDLSipInfo.sipAccount, |
| | | mHDLSipInfo.sipPasswd, |
| | | mHDLSipInfo.realm, |
| | | HDLLinphoneKit.InterPhoneTypeHdl |
| | | ); |
| | | } |
| | | #endif |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 请求服务器获取当前住宅Sip账号信息并初始化LinphoneSDK和登录 |
| | | /// </summary> |
| | | /// <param name="homeId"></param> |
| | | public void GetHDLSipInfoAndInitSDK(string homeId, bool clearCallInfo = true) |
| | | public void GetHDLSipInfoAndInitSDK(HDLCallVideoInfo mHDLCallVideoInfo, bool clearCallInfo = true) |
| | | { |
| | | try |
| | | { |
| | |
| | | InitCallInfo(null); |
| | | } |
| | | |
| | | HDLSipInfo mHDLSipInfo = GetHDLSipInfo(homeId); |
| | | HDLSipInfo mHDLSipInfo = GetHDLSipInfo(mHDLCallVideoInfo.HomeId); |
| | | if (mHDLSipInfo != null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | InitLinphone(); |
| | | mHDLSipInfo.homeId = homeId; |
| | | SetAccountAndLogin(mHDLSipInfo); |
| | | mHDLSipInfo.homeId = mHDLCallVideoInfo.HomeId; |
| | | SetAccountAndLogin(mHDLSipInfo, mHDLCallVideoInfo.InterphoneType); |
| | | Utlis.WriteLine("CALL 获取SIP账号成功:" + mHDLSipInfo.sipAccount); |
| | | }); |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region ■ -- 跳转监控页面_______________________________ |
| | | /// <summary> |
| | | /// 跳转监控页面 |
| | | /// </summary> |
| | | /// <param name="mESVideoInfo"></param> |
| | | /// <param name="enableMic">是否打开麦克风</param> |
| | | public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo,bool enableMic,bool isCallIn = false) |
| | | public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo,string mInterphoneType) |
| | | { |
| | | InitLinphone(); |
| | | //sip账号为空 |
| | |
| | | mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId; |
| | | mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId; |
| | | mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName; |
| | | mHDLCallVideoInfo.InterphoneType = InterphoneType.HDL.ToString(); |
| | | mHDLCallVideoInfo.InterphoneType = mInterphoneType; |
| | | mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount;//监视主动呼叫门口机时用到 |
| | | InitCallInfo(mHDLCallVideoInfo); |
| | | |
| | | if (isCallIn) |
| | | { |
| | | #if __IOS__ |
| | | #else |
| | | HDLLinphoneKit.Instance.HangUp(); |
| | | #endif |
| | | } |
| | | else |
| | | { |
| | | openMonitorPage(enableMic); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 打开监视界面 |
| | | /// </summary> |
| | | void openMonitorPage(bool enableMic) |
| | | { |
| | | |
| | | #if __IOS__ |
| | | |
| | |
| | | //2.跳转打开监控页面 |
| | | var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneMonitorActivity)); ; |
| | | intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);//传入设备名称为显示标题 |
| | | intent.PutExtra(HDLLinphoneKit.Enablemic, enableMic);//是否打开麦克风 |
| | | Shared.Application.Activity.StartActivity(intent); |
| | | |
| | | |
| | | |
| | | #endif |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region ■ -- 跳转呼叫页面_______________________________ |
| | | #region ■ -- 跳转呼叫页面_______________________________ |
| | | /// <summary> |
| | | /// 收到推送,后判断呼叫住宅是否为当前住宅,不是的话重新获取SIP账号并登录 |
| | | /// </summary> |
| | | /// <param name="mESVideoInfo"></param> |
| | | /// <param name="isHdlLinphone">是否是自研可视对讲</param> |
| | | public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,bool isHdlLinphone) |
| | | public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType) |
| | | { |
| | | InitLinphone(); |
| | | |
| | |
| | | mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId; |
| | | mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId; |
| | | mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName; |
| | | mHDLCallVideoInfo.InterphoneType = InterphoneType.HDL.ToString(); |
| | | mHDLCallVideoInfo.InterphoneType = mInterphoneType; |
| | | mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount; |
| | | mHDLCallVideoInfo.spk = mESVideoInfo.spk; |
| | | InitCallInfo(mHDLCallVideoInfo); |
| | | |
| | | |
| | | |
| | | if (isHdlLinphone) |
| | | //当前呼叫来电的住宅和之前注册登录的住宅一致的情况下 |
| | | if (currentHDLSipInfo != null && currentHDLSipInfo.homeId == mESVideoInfo.HomeId) |
| | | { |
| | | //当前呼叫来电的住宅和之前注册登录的住宅一致的情况下 |
| | | if (currentHDLSipInfo != null && currentHDLSipInfo.homeId == mESVideoInfo.HomeId) |
| | | { |
| | | Utlis.WriteLine("CALL 收到推送 推送住宅和之前注册登录的住宅一致"); |
| | | CheckCallStateAndGotoPage(true); |
| | | } |
| | | Utlis.WriteLine("CALL 收到推送 推送住宅和之前注册登录的住宅一致"); |
| | | CheckCallStateAndGotoPage(); |
| | | } |
| | | else { |
| | | //当前呼叫来电的住宅和之前注册登录的住宅一致的情况下 |
| | | if (currentHDLSipInfo != null && currentHDLSipInfo.homeId == mESVideoInfo.HomeId) |
| | | else |
| | | { |
| | | //注意:之前没登录SIP账号或者住宅不一致的情况下需要重新获取SIP账号 |
| | | //获取呼叫住宅的SIP账号并登录 |
| | | Utlis.WriteLine("CALL 收到推送 其他住宅,重新获取呼叫住宅的SIP账号并登录"); |
| | | new Thread(() => |
| | | { |
| | | Utlis.WriteLine("CALL 收到推送 推送住宅和之前注册登录的住宅一致"); |
| | | CheckCallStateAndGotoPage(); |
| | | } |
| | | else |
| | | { |
| | | //注意:之前没登录SIP账号或者住宅不一致的情况下需要重新获取SIP账号 |
| | | //获取呼叫住宅的SIP账号并登录 |
| | | Utlis.WriteLine("CALL 收到推送 其他住宅,重新获取呼叫住宅的SIP账号并登录"); |
| | | new Thread(() => |
| | | { |
| | | GetHDLSipInfoAndInitSDK(mESVideoInfo.HomeId, false); |
| | | }) |
| | | { IsBackground = false }.Start(); |
| | | GetHDLSipInfoAndInitSDK(mHDLCallVideoInfo, false); |
| | | }) |
| | | { IsBackground = false }.Start(); |
| | | |
| | | // |
| | | CheckCallStateAndGotoPage(); |
| | | } |
| | | // |
| | | CheckCallStateAndGotoPage(); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | /// 检测来电状态,判断是否马上打开呼叫页面,如果还没来电则开启线程检测等待 |
| | | /// </summary> |
| | | /// <param name="mESVideoInfo"></param> |
| | | public void CheckCallStateAndGotoPage(bool isHdlLinphone = false) |
| | | public void CheckCallStateAndGotoPage() |
| | | { |
| | | //如果开启了自动跳转方案,则无需继续下面处理、无需手动跳转 |
| | | if (IsAutoJumpCallView) return; |
| | | //先结束掉之前的线程 |
| | | EndCheckIncomingCallThread(); |
| | | //检测是否来电了如果是直接调整呼叫页面如果不是则开启线程等待判断 |
| | | if (IsIncomingReceivedCallState()|| isHdlLinphone) { |
| | | Utlis.WriteLine("CALL 已经来电了。。。打开呼叫页面"); |
| | | GoToHDLLinphoneIntercomActivity(); |
| | | } |
| | | else |
| | | if (mHDLCallVideoInfo.spk == "door.gate") |
| | | { |
| | | //如果还没来电 开启线程检测 |
| | | StartCheckIncomingCallThread(); |
| | | #if __IOS__ |
| | | //自研可视对讲 |
| | | HDLLinPhoneSDK.Instance().GotoHDLSRLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName,mHDLCallVideoInfo.DeviceSipAccount); |
| | | #else |
| | | var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneReverseCallActivity)); |
| | | if (mHDLCallVideoInfo != null) |
| | | { |
| | | //intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName); |
| | | intent.PutExtra("lpTitleName", mHDLCallVideoInfo.DeviceName); |
| | | intent.PutExtra("lpSipAccount", mHDLCallVideoInfo.DeviceSipAccount); |
| | | } |
| | | Shared.Application.Activity.StartActivity(intent); |
| | | #endif |
| | | } |
| | | else { |
| | | //狄耐克可视对讲 |
| | | //如果开启了自动跳转方案,则无需继续下面处理、无需手动跳转 |
| | | if (IsAutoJumpCallView) return; |
| | | //先结束掉之前的线程 |
| | | EndCheckIncomingCallThread(); |
| | | //检测是否来电了如果是直接调整呼叫页面如果不是则开启线程等待判断 |
| | | if (IsIncomingReceivedCallState()) |
| | | { |
| | | Utlis.WriteLine("CALL 已经来电了。。。打开呼叫页面"); |
| | | GoToHDLLinphoneIntercomActivity(); |
| | | } |
| | | else |
| | | { |
| | | //如果还没来电 开启线程检测 |
| | | StartCheckIncomingCallThread(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | /// 类型 |
| | | /// </summary> |
| | | public string InterphoneType; |
| | | /// <summary> |
| | | /// spk |
| | | /// </summary> |
| | | public string spk=""; |
| | | |
| | | } |
| | | |