-
Notifications
You must be signed in to change notification settings - Fork 4
/
myphoneendpoint.h
111 lines (86 loc) · 3.17 KB
/
myphoneendpoint.h
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
102
103
104
105
106
107
108
109
110
111
#ifndef MYPHONEENDPOINT_H
#define MYPHONEENDPOINT_H
#include <QObject>
#include "global.h"
#include <ptlib/sound.h>
#include <ptlib/video.h>
#include <h323.h>
class QtPhoneDlg;
class CVideoDlg;
// Structure for stored connection statistics
typedef struct
{
int iSecs; // talk duration
int ibSent; // bytes sent
int ibRcvd; // bytes received
int iDelay; // round trip delay
} MyStat;
class CMyPhoneEndPoint : public QObject, public H323EndPoint
{
Q_OBJECT
public:
CMyPhoneEndPoint();
~CMyPhoneEndPoint();
QtPhoneDlg *m_dialog;
CVideoDlg *m_vdlg;
PConfig config;
mutable MyStat m_stat;
PBoolean OnIncomingCall(H323Connection &, const H323SignalPDU &, H323SignalPDU &);
virtual H323Connection::AnswerCallResponse OnAnswerCall(H323Connection &, const PString & caller,const H323SignalPDU &,H323SignalPDU &);
virtual void OnConnectionEstablished(H323Connection & connection, const PString & token);
virtual void OnConnectionCleared(H323Connection & connection, const PString & clearedCallToken);
PBoolean OpenAudioChannel(H323Connection &, PBoolean, unsigned, H323AudioCodec &);
PBoolean OpenVideoChannel(H323Connection &, PBoolean, H323VideoCodec &);
PBoolean OnStartLogicalChannel(H323Connection &, H323Channel &);
void OnClosedLogicalChannel(H323Connection &, const H323Channel &);
void OnRTPStatistics(const H323Connection &, const RTP_Session &) const;
void TranslateTCPAddress(PIPSocket::Address &localAddr, const PIPSocket::Address &remoteAddr);
virtual H323Connection * CreateConnection(unsigned refID);
void OnLogicalChannel(const H323Channel & channel, char *txStrID, char *rxStrID);
bool FindGatekeeper();
bool Initialise(QtPhoneDlg *dlg);
void LoadCapabilities();
bool autoStartTransmitVideo;
bool autoStartReceiveVideo;
bool localVideo;
bool localFlip;
PIPSocket::Address m_router;
static PString VideoInputDriver;
bool m_fSilenceOn;
bool m_fAutoAnswer;
bool m_fNoFastStart;
bool m_fDoH245Tunnelling;
bool m_fDtmfAsString;
inline void DisableH245Tunnelling(bool bDisable) { m_fDoH245Tunnelling = !bDisable; }
inline bool DisableH245Tunnelling() { return !m_fDoH245Tunnelling; }
friend class QtPhoneDlg;
friend class CMyPhoneConnection;
void OutputMsg(const QString &);
void OutputUsrMsg(const QString &);
signals:
void signal_RecvStats(const QString &);
void signal_OutputMsg(const QString &);
void signal_OutputUsrMsg(const QString &);
void signal_OnConnectionEstablished(const QString &);
void signal_OnConnectionCleared(const QString &);
void signal_OnAnswerCall(const QString &);
void signal_ShowVideoPanels(bool);
void signal_CreateConnection();
};
class CMyPhoneConnection : public H323Connection
{
PCLASSINFO(CMyPhoneConnection, H323Connection);
public:
CMyPhoneConnection(
QtPhoneDlg* wnd,
CMyPhoneEndPoint & ep,
unsigned callReference,
unsigned options);
// overrides from H323Connection
PBoolean OnAlerting(const H323SignalPDU &, const PString &);
void OnUserInputString(const PString &);
protected:
CMyPhoneEndPoint &endpoint;
QtPhoneDlg *m_dialog;
};
#endif // MYPHONEENDPOINT_H