using System;
|
using System.Collections.Generic;
|
using System.Threading;
|
|
using HDL_ON;
|
using HDL_ON.DAL.Server;
|
using HDL_ON.Entity;
|
|
#if __Android__
|
using Android.App;
|
using Android.Content;
|
using Android.Graphics;
|
using Android.Widget;
|
using Com.Hdl.Hdllinphonesdk;
|
#else
|
using Foundation;
|
using UIKit;
|
using Shared.IOS.HDLLinphoneSDK;
|
#endif
|
|
namespace Shared
|
{
|
/// <summary>
|
/// 目前是每个住宅对应一个SIP账号,切换住宅需要重新获取SIP账号
|
/// </summary>
|
public class HDLLinphone
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public HDLLinphone()
|
{
|
|
}
|
/// <summary>
|
///
|
/// </summary>
|
private static HDLLinphone m_Current = null;
|
/// <summary>
|
///
|
/// </summary>
|
public static HDLLinphone Current
|
{
|
get
|
{
|
if (m_Current == null)
|
{
|
m_Current = new HDLLinphone();
|
}
|
return m_Current;
|
}
|
}
|
|
|
/// <summary>
|
/// 当前住宅是否支持可视对讲
|
/// </summary>
|
public bool IsEnable = false;
|
/// <summary>
|
/// 是否自动跳转呼叫页面,
|
/// false:收到推送并且已经收到sip呼叫才跳转呼叫页面
|
/// true:原生收到呼叫马上跳转呼叫页面,不等待推送过来
|
/// </summary>
|
bool IsAutoJumpCallView = false;
|
/// <summary>
|
/// 是否初始化了SDK
|
/// </summary>
|
bool IsInitSdk;
|
/// <summary>
|
/// 当前登录的Sip账号
|
/// </summary>
|
HDLSipInfo currentHDLSipInfo;
|
/// <summary>
|
/// 可视对讲设备参数
|
/// </summary>
|
HDLCallVideoInfo mHDLCallVideoInfo;
|
|
#region ■ -- 初始化SDK_______________________________
|
/// <summary>
|
/// 初始化SDK
|
/// </summary>
|
void InitLinphone()
|
{
|
//防止重复初始化
|
if (IsInitSdk) return;
|
|
IsInitSdk = true;
|
|
#if __IOS__
|
|
Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().InitalLinPhone();
|
//设置收到来电后、是否需自动跳转呼叫页面方案
|
Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsAutoJumpCallView = IsAutoJumpCallView;
|
//设置Listener监听
|
mOnHDLLinphoneCallDelegate = new OnHDLLinphoneCallDelegate(this);
|
Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().HdlLinphoneCallDelegate = mOnHDLLinphoneCallDelegate;
|
#else
|
HDLLinphoneKit.Instance.InitLinphone(Application.Activity);
|
//设置收到来电后、是否需自动跳转呼叫页面方案
|
HDLLinphoneKit.Instance.AutoJumpCallView = IsAutoJumpCallView;
|
//设置Listener监听
|
setOnHDLLinphoneCallListener();
|
#endif
|
}
|
|
|
/// <summary>
|
/// 设置sip登录账号
|
/// </summary>
|
/// <param name="mHDLSipInfo"></param>
|
public void SetAccountAndLogin(HDLSipInfo mHDLSipInfo)
|
{
|
|
this.currentHDLSipInfo = mHDLSipInfo;
|
|
if (mHDLSipInfo == null) return;
|
|
#if __IOS__
|
//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);
|
#endif
|
|
}
|
|
/// <summary>
|
/// 注销所有账号
|
/// </summary>
|
public void LogoutAllAccount() {
|
//没初始化过则返回
|
if (!IsInitSdk) return;
|
|
this.currentHDLSipInfo = null;
|
this.mHDLCallVideoInfo = null;
|
#if __IOS__
|
|
HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser();
|
#else
|
HDLLinphoneKit.Instance.Logout();
|
#endif
|
}
|
|
/// <summary>
|
/// 清除配置表
|
/// </summary>
|
public void ClearProxyConfig()
|
{
|
#if __IOS__
|
|
HDLLinPhoneSDK.Instance().ClearAllConfigs();
|
#else
|
HDLLinphoneKit.Instance.ClearProxyConfig();
|
#endif
|
}
|
|
#endregion
|
|
#region ■ -- 获取sip账号_______________________________
|
/// <summary>
|
/// 获取当前住宅的SIP账号
|
/// </summary>
|
public HDLSipInfo GetHDLSipInfo(string homeId)
|
{
|
Dictionary<string, object> d = new Dictionary<string, object>();
|
d.Add("homeId", homeId);
|
|
var requestJson = HttpUtil.GetSignRequestJson(d);
|
var resultObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_GetSipAccount, requestJson);
|
|
if (resultObj.Code == StateCode.SUCCESS)
|
{
|
if (string.IsNullOrEmpty(resultObj.Data.ToString()))
|
{
|
//控的话代表当前住宅不支持
|
return null;
|
}
|
else
|
{
|
var info = Newtonsoft.Json.JsonConvert.DeserializeObject<HDLSipInfo>(resultObj.Data.ToString());
|
return info;
|
}
|
}
|
else
|
{
|
return null;
|
}
|
|
}
|
|
/// <summary>
|
/// 请求服务器获取当前住宅Sip账号信息并初始化LinphoneSDK和登录
|
/// </summary>
|
/// <param name="homeId"></param>
|
public void GetHDLSipInfoAndInitSDK(string homeId, bool clearCallInfo = true)
|
{
|
try
|
{
|
|
|
//先清空呼叫和监视设备信息
|
if (clearCallInfo)
|
{
|
InitCallInfo(null);
|
}
|
|
HDLSipInfo mHDLSipInfo = GetHDLSipInfo(homeId);
|
if (mHDLSipInfo != null)
|
{
|
Application.RunOnMainThread(() =>
|
{
|
InitLinphone();
|
mHDLSipInfo.homeId = homeId;
|
SetAccountAndLogin(mHDLSipInfo);
|
Utlis.WriteLine("CALL 获取SIP账号成功:" + mHDLSipInfo.sipAccount);
|
});
|
}
|
}
|
catch { }
|
|
}
|
#endregion
|
|
|
#region ■ -- 动作回调和原生交互,提交记录到云端_______________________________
|
|
/// <summary>
|
/// 初始化呼叫参数
|
/// </summary>
|
/// <param name="mHDLCallVideoInfo"></param>
|
/// <param name="mInterphoneType"></param>
|
void InitCallInfo(HDLCallVideoInfo mHDLCallVideoInfo)
|
{
|
this.mHDLCallVideoInfo = mHDLCallVideoInfo;
|
}
|
|
/// <summary>
|
/// 判断callId是否为空
|
/// </summary>
|
/// <returns></returns>
|
bool CheckmHDLCallVideoInfoIsNullOrEmpty()
|
{
|
return (mHDLCallVideoInfo == null || string.IsNullOrEmpty(mHDLCallVideoInfo.CallId));
|
}
|
|
/// <summary>
|
/// 截图成功 暂时废弃
|
/// </summary>
|
public void ScreenshotSuccessfulAction(byte[] dataBytes)
|
{
|
//Utlis.WriteLine("ScreenshotSuccessfulAction");
|
|
if (CheckmHDLCallVideoInfoIsNullOrEmpty()) return;
|
|
new Thread(() =>
|
{
|
//var imageName = Guid.NewGuid().ToString();
|
Dictionary<string, object> dic = new Dictionary<string, object>();
|
dic.Add("callId", mHDLCallVideoInfo.CallId);
|
dic.Add("images", dataBytes);
|
#if __IOS__
|
dic.Add("imagesName", "_IOS.jpg");
|
#else
|
dic.Add("imagesName", "_Android.jpg");
|
#endif
|
|
var requestJson = HttpUtil.GetSignRequestJson(dic);
|
var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Screenshot, requestJson);
|
if (revertObj.Code == StateCode.SUCCESS)
|
{
|
//Utlis.WriteLine("POST 截图上传成功");
|
}
|
else
|
{
|
Utlis.WriteLine("POST 截图上传失败 code: " + revertObj.Code);
|
}
|
|
})
|
{ IsBackground = false }.Start();
|
|
}
|
|
//DateTime UnlockDateTime = DateTime.MinValue;
|
#endregion
|
|
#region ■ -- 新接听和开锁接口_______________________________
|
/// <summary>
|
/// 开锁
|
/// </summary>
|
public void HDLUnlockAction()
|
{
|
//Utlis.WriteLine("UnlockAction");
|
|
if (mHDLCallVideoInfo == null) return;
|
|
new Thread(() =>
|
{
|
Dictionary<string, object> dic = new Dictionary<string, object>();
|
dic.Add("deviceId", mHDLCallVideoInfo.DeviceId);//设备id
|
dic.Add("callId", mHDLCallVideoInfo.CallId);//当前呼叫id
|
dic.Add("interphoneType", mHDLCallVideoInfo.InterphoneType);//可视对讲厂家类型
|
dic.Add("homeId", mHDLCallVideoInfo.HomeId);//住宅ID
|
var requestJson = HttpUtil.GetSignRequestJson(dic);
|
var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_OpenDoorbell, requestJson);
|
|
Application.RunOnMainThread(() =>
|
{
|
|
#if __IOS__
|
if (revertObj.Code == StateCode.SUCCESS)
|
{
|
//和原生监控界面交互、发送开锁成功通知
|
NSNotificationCenter.DefaultCenter.PostNotificationName("lcCallDelegateOpenDoorSuccess", null);
|
}
|
else
|
{
|
Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code);
|
}
|
#else
|
if (revertObj.Code == StateCode.SUCCESS)
|
{
|
HDLLinphoneKit.Instance.OnOpenSuccess();
|
}
|
else
|
{
|
Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code);
|
HDLLinphoneKit.Instance.OnOpenError(revertObj.message);
|
}
|
#endif
|
|
});
|
|
|
})
|
{ IsBackground = false }.Start();
|
}
|
|
/// <summary>
|
/// 更改通话状态
|
/// </summary>
|
public void HDLUpdateCallStatus(CallStatusType callStatusType, InterphoneType interphoneType, int callDuration = 0)
|
{
|
|
if (CheckmHDLCallVideoInfoIsNullOrEmpty()) return;
|
|
new Thread(() =>
|
{
|
Dictionary<string, object> dic = new Dictionary<string, object>();
|
dic.Add("callId", mHDLCallVideoInfo.CallId);//呼叫id
|
dic.Add("callStatus", callStatusType.ToString());//可用值:MISSED,RECEIVED,REJECT
|
dic.Add("interphoneTypeEnum", interphoneType.ToString());
|
if (callStatusType == CallStatusType.RECEIVED && callDuration > 0)
|
{
|
dic.Add("callDuration", callDuration);//通话时长(秒)
|
}
|
|
var requestJson = HttpUtil.GetSignRequestJson(dic);
|
var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_UpdateCallStatus, requestJson);
|
if (revertObj.Code == StateCode.SUCCESS)
|
{
|
|
}
|
else
|
{
|
Utlis.WriteLine("POST 更新状态失败 code: " + revertObj.Code);
|
}
|
|
})
|
{ IsBackground = false }.Start();
|
|
}
|
#endregion
|
|
|
#region ■ -- 跳转监控页面_______________________________
|
/// <summary>
|
/// 跳转监控页面
|
/// </summary>
|
/// <param name="mESVideoInfo"></param>
|
public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo)
|
{
|
InitLinphone();
|
//sip账号为空
|
if (string.IsNullOrEmpty(mESVideoInfo.deviceSipAccount))
|
{
|
|
HDLCommon.Current.ShowAlert(Language.StringByID(StringId.shebeibucunzai));
|
return;
|
}
|
HDLCallVideoInfo mHDLCallVideoInfo = new HDLCallVideoInfo();
|
mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId;
|
mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId;
|
mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName;
|
mHDLCallVideoInfo.InterphoneType = InterphoneType.HDL.ToString();
|
mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount;//监视主动呼叫门口机时用到
|
InitCallInfo(mHDLCallVideoInfo);
|
|
#if __IOS__
|
|
HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName);
|
|
#else
|
//1.先呼叫设备
|
Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.CallTo(mHDLCallVideoInfo.DeviceSipAccount, true);
|
//2.跳转打开监控页面
|
var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneMonitorActivity)); ;
|
intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);//传入设备名称为显示标题
|
Shared.Application.Activity.StartActivity(intent);
|
#endif
|
|
}
|
#endregion
|
|
|
#region ■ -- 跳转呼叫页面_______________________________
|
/// <summary>
|
/// 收到推送,后判断呼叫住宅是否为当前住宅,不是的话重新获取SIP账号并登录
|
/// </summary>
|
/// <param name="mESVideoInfo"></param>
|
public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo)
|
{
|
InitLinphone();
|
|
HDLCallVideoInfo mHDLCallVideoInfo = new HDLCallVideoInfo();
|
mHDLCallVideoInfo.CallId = mESVideoInfo.callId;
|
mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId;
|
mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId;
|
mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName;
|
mHDLCallVideoInfo.InterphoneType = InterphoneType.HDL.ToString();
|
mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount;
|
InitCallInfo(mHDLCallVideoInfo);
|
|
//当前呼叫来电的住宅和之前注册登录的住宅一致的情况下
|
if (currentHDLSipInfo != null && currentHDLSipInfo.homeId == mESVideoInfo.HomeId)
|
{
|
Utlis.WriteLine("CALL 收到推送 推送住宅和之前注册登录的住宅一致");
|
CheckCallStateAndGotoPage();
|
}
|
else
|
{
|
//注意:之前没登录SIP账号或者住宅不一致的情况下需要重新获取SIP账号
|
//获取呼叫住宅的SIP账号并登录
|
Utlis.WriteLine("CALL 收到推送 其他住宅,重新获取呼叫住宅的SIP账号并登录");
|
new Thread(() =>
|
{
|
GetHDLSipInfoAndInitSDK(mESVideoInfo.HomeId, false);
|
})
|
{ IsBackground = false }.Start();
|
|
//
|
CheckCallStateAndGotoPage();
|
|
}
|
|
}
|
|
/// <summary>
|
/// 检测来电状态,判断是否马上打开呼叫页面,如果还没来电则开启线程检测等待
|
/// </summary>
|
/// <param name="mESVideoInfo"></param>
|
public void CheckCallStateAndGotoPage()
|
{
|
//如果开启了自动跳转方案,则无需继续下面处理、无需手动跳转
|
if (IsAutoJumpCallView) return;
|
//先结束掉之前的线程
|
EndCheckIncomingCallThread();
|
//检测是否来电了如果是直接调整呼叫页面如果不是则开启线程等待判断
|
if (IsIncomingReceivedCallState()) {
|
Utlis.WriteLine("CALL 已经来电了。。。打开呼叫页面");
|
GoToHDLLinphoneIntercomActivity();
|
}
|
else
|
{
|
//如果还没来电 开启线程检测
|
StartCheckIncomingCallThread();
|
}
|
|
}
|
|
/// <summary>
|
/// 是否来电状态
|
/// </summary>
|
/// <returns></returns>
|
bool IsIncomingReceivedCallState() {
|
#if __IOS__
|
return HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState;
|
#else
|
return HDLLinphoneKit.Instance.IsIncomingReceivedCallState;
|
#endif
|
}
|
|
/// <summary>
|
/// 跳转打开原生的呼叫页面
|
/// </summary>
|
void GoToHDLLinphoneIntercomActivity() {
|
|
#if __IOS__
|
|
HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName);
|
|
#else
|
var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneIntercomActivity));
|
if (mHDLCallVideoInfo != null)
|
{
|
intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);
|
}
|
Shared.Application.Activity.StartActivity(intent);
|
#endif
|
|
}
|
|
|
/// <summary>
|
/// 检测来电线程
|
/// </summary>
|
Thread checkIncomingCallThread = null;
|
/// <summary>
|
/// 检测线程持续时间
|
/// </summary>
|
const int MAX_THREAD_TIME = 30;
|
/// <summary>
|
/// 线程结束
|
/// </summary>
|
int threadTime = MAX_THREAD_TIME;
|
/// <summary>
|
/// 开启检测来电线程
|
/// </summary>
|
void StartCheckIncomingCallThread()
|
{
|
try
|
{
|
Utlis.WriteLine("CALL 还没来电,开启线程");
|
threadTime = MAX_THREAD_TIME;
|
//结束之前的线程
|
EndCheckIncomingCallThread();
|
//新建线程
|
checkIncomingCallThread = new Thread(() =>
|
{
|
try
|
{
|
//15S后自动结束线程
|
while (threadTime > 0)
|
{
|
threadTime--;
|
Utlis.WriteLine("CALL 检测中...." + threadTime);
|
Thread.Sleep(1000);
|
//来电了,跳转呼叫页面
|
if (IsIncomingReceivedCallState())
|
{
|
Utlis.WriteLine("CALL 来电了。。。打开呼叫页面");
|
threadTime = 0;//跳出循环,关闭线程
|
Application.RunOnMainThread(() =>
|
{
|
GoToHDLLinphoneIntercomActivity();
|
});
|
|
}
|
}
|
|
|
}
|
catch { }
|
});
|
//开启线程
|
checkIncomingCallThread.Start();
|
}
|
catch { }
|
}
|
|
/// <summary>
|
/// 结束线程
|
/// </summary>
|
void EndCheckIncomingCallThread()
|
{
|
if (checkIncomingCallThread != null)
|
{
|
try
|
{
|
checkIncomingCallThread.Interrupt();
|
}
|
catch {
|
|
}
|
|
checkIncomingCallThread = null;
|
Utlis.WriteLine("CALL 先结束线程");
|
}
|
}
|
|
/// <summary>
|
/// 判断线程是否启动了
|
/// </summary>
|
/// <returns></returns>
|
public bool CheckIncomingCallThreadIsNull()
|
{
|
return checkIncomingCallThread == null || checkIncomingCallThread.ThreadState != ThreadState.Running;
|
}
|
|
#endregion
|
|
|
#region ■ -- Android相关操作_______________________________
|
|
#if __Android__
|
|
/// <summary>
|
/// 接听、挂断、开锁等动作监听处理
|
/// </summary>
|
private class HDLLinphoneCallListener : Java.Lang.Object, Com.Hdl.Hdllinphonesdk.Callback.IOnHDLLinphoneCallListener
|
{
|
[Weak] HDLLinphone hdlLinphone;
|
|
public HDLLinphoneCallListener(HDLLinphone mHDLLinphone)
|
{
|
hdlLinphone = mHDLLinphone;
|
}
|
|
|
//showToast
|
void showToast(string text)
|
{
|
Toast.MakeText(Application.Activity, text, ToastLength.Short).Show();
|
}
|
/// <summary>
|
/// 接听事件
|
/// </summary>
|
public void OnAnswerAction()
|
{
|
//showToast("接听");
|
hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL);
|
}
|
/// <summary>
|
/// 挂断事件
|
/// </summary>
|
/// <param name="callDuration"></param>
|
public void OnHangUpAction(int callDuration)
|
{
|
|
//showToast("挂断 通话时长:" + callDuration);
|
hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration);
|
}
|
|
/// <summary>
|
/// 拒接事件
|
/// </summary>
|
public void OnRejectCallAction()
|
{
|
//showToast("拒接");
|
hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL);
|
}
|
|
/// <summary>
|
/// 截图成功事件
|
/// </summary>
|
/// <param name="p0"></param>
|
public void OnScreenshotSuccessfulAction(Bitmap imgBitmap)
|
{
|
//showToast("截图成功");
|
}
|
|
/// <summary>
|
/// 开锁事件
|
/// </summary>
|
public void OnUnlockAction()
|
{
|
hdlLinphone.HDLUnlockAction();
|
}
|
|
/// <summary>
|
/// 来电事件
|
/// </summary>
|
/// <param name="userName"></param>
|
public void OnIncomingCall(string userName)
|
{
|
Utlis.WriteLine("OnIncomingCall :" + userName);
|
}
|
}
|
|
/// <summary>
|
/// 设置原生的Listener监听
|
/// </summary>
|
void setOnHDLLinphoneCallListener()
|
{
|
HDLLinphoneKit.Instance.OnHDLLinphoneCallListener = new HDLLinphoneCallListener(this);
|
}
|
|
/// <summary>
|
/// 清楚通知栏所有通知
|
/// </summary>
|
void CancelAllNotification()
|
{
|
NotificationManager nMgr = (NotificationManager)Application.Activity.GetSystemService(Context.NotificationService);
|
nMgr.CancelAll();
|
}
|
|
#endif
|
#endregion
|
|
#region ■ -- iOS相关操作_______________________________
|
|
#if __IOS__
|
|
#region OnHDLLinphoneCallDelegate
|
/// <summary>
|
///
|
/// </summary>
|
OnHDLLinphoneCallDelegate mOnHDLLinphoneCallDelegate;
|
|
/// <summary>
|
///
|
/// </summary>
|
public class OnHDLLinphoneCallDelegate : HDLLinphoneCallDelegate
|
{
|
[Weak] HDLLinphone hdlLinphone;
|
|
public OnHDLLinphoneCallDelegate(HDLLinphone mHDLLinphone)
|
{
|
this.hdlLinphone = mHDLLinphone;
|
}
|
|
/// <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>
|
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);
|
//}
|
|
/// <summary>
|
/// 开锁成功
|
/// </summary>
|
public override void OnUnlockAction()
|
{
|
hdlLinphone.HDLUnlockAction();
|
}
|
|
/// <summary>
|
/// 来电中...
|
/// </summary>
|
public override void OnIncomingCall(string userName)
|
{
|
Utlis.WriteLine("OnIncomingCall :" + userName);
|
}
|
|
|
|
}
|
|
#endregion
|
#endif
|
|
#endregion
|
|
}
|
|
/// <summary>
|
/// SIP可视对讲参数
|
/// </summary>
|
public class HDLCallVideoInfo
|
{
|
/// <summary>
|
/// 设备序列号,通讯必要字段
|
/// </summary>
|
public string DeviceId = string.Empty;
|
/// <summary>
|
/// 设备名称
|
/// </summary>
|
public string DeviceName = string.Empty;
|
/// <summary>
|
/// 设备Sip账号
|
/// </summary>
|
public string DeviceSipAccount = string.Empty;
|
/// <summary>
|
/// 呼叫记录Id
|
/// </summary>
|
public string CallId = string.Empty;
|
/// <summary>
|
/// 住宅Id
|
/// </summary>
|
public string HomeId = string.Empty;
|
/// <summary>
|
/// 类型
|
/// </summary>
|
public string InterphoneType;
|
|
}
|
|
/// <summary>
|
/// SIP账号相关信息
|
/// </summary>
|
public class HDLSipInfo
|
{
|
/// <summary>
|
/// Sip服务器
|
/// </summary>
|
public string proxy { get; set; }
|
/// <summary>
|
/// 设备域
|
/// </summary>
|
public string realm { get; set; }
|
/// <summary>
|
/// sip账号
|
/// </summary>
|
public string sipAccount { get; set; }
|
/// <summary>
|
/// sipPasswd sip密码
|
/// </summary>
|
public string sipPasswd { get; set; }
|
/// <summary>
|
/// 住宅ID
|
/// </summary>
|
public string homeId;
|
}
|
|
|
}
|