using System;
|
#if __Android__
|
using Android.Graphics;
|
using Android.Widget;
|
using Com.Hdl.Hdllinphonesdk;
|
#endif
|
|
namespace Shared
|
{
|
public class HDLLinphone
|
{
|
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;
|
}
|
}
|
|
|
public void InitLinphone()
|
{
|
#if __IOS__
|
|
#else
|
|
Com.Hdl.Hdllinphonesdk.Core.EasyLinphone.InitLinphone(Application.Activity);
|
setOnHDLLinphoneCallListener();
|
Com.Hdl.Hdllinphonesdk.Core.EasyLinphone.SetAccountAndLogin("3333", "85521566", "116.62.26.215:5060");
|
|
#endif
|
|
|
}
|
|
#if __Android__
|
|
|
|
class HDLLinphoneCallListener : Java.Lang.Object, Com.Hdl.Hdllinphonesdk.Callback.IOnHDLLinphoneCallListener
|
{
|
//showToast
|
void showToast(string text)
|
{
|
|
Toast.MakeText(Application.Activity, text, ToastLength.Short).Show();
|
}
|
|
public void OnAnswerAction()
|
{
|
showToast("接听");
|
}
|
|
public void OnHangUpAction(int callDuration)
|
{
|
|
showToast("挂断 通话时长:" + callDuration);
|
}
|
|
public void OnRejectCallAction()
|
{
|
showToast("拒接");
|
}
|
|
public void OnScreenshotSuccessfulAction(Bitmap p0)
|
{
|
showToast("截图");
|
}
|
|
public void OnUnlockAction()
|
{
|
HDLLinphoneKit.Instance.OnOpenSuccess();
|
}
|
|
}
|
|
void setOnHDLLinphoneCallListener()
|
{
|
HDLLinphoneKit.Instance.OnHDLLinphoneCallListener = new HDLLinphoneCallListener();
|
|
}
|
#endif
|
|
|
}
|
}
|