JLChen
2021-08-09 1f956c79026e8dc20bb16afbbf550385679e2e59
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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
 
 
    }
}