-
Notifications
You must be signed in to change notification settings - Fork 22
/
MakeCall.h
100 lines (82 loc) · 3 KB
/
MakeCall.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
//////////////////////////////////////////////////////////////////
//
// MakeCall.h
//
// Copyright (c) 2007-2017, Jan Willamowius
//
// This work is published under the GNU Public License version 2 (GPLv2)
// see file COPYING for details.
// We also explicitly grant the right to link this code
// with the OpenH323/H323Plus and OpenSSL library.
//
//////////////////////////////////////////////////////////////////
#ifndef _MakeCall_H
#define _MakeCall_H
#include <ptlib.h>
#include <h323.h>
#include "singleton.h"
#include "config.h"
#include <map>
class MakeCallEndPoint : public Singleton<MakeCallEndPoint>, public H323EndPoint
{
public:
MakeCallEndPoint();
virtual ~MakeCallEndPoint();
// overrides from H323EndPoint
virtual H323Connection * CreateConnection(unsigned callReference);
virtual PBoolean OnIncomingCall(H323Connection &, const H323SignalPDU &, H323SignalPDU &);
virtual PBoolean OnConnectionForwarded(H323Connection &, const PString &, const H323SignalPDU &);
virtual void OnConnectionEstablished(H323Connection & connection, const PString & token);
#ifdef H323_AUDIO_CODECS
virtual PBoolean OpenAudioChannel(H323Connection &, PBoolean, unsigned, H323AudioCodec &);
#endif
virtual void OnRegistrationConfirm(const H323TransportAddress & rasAddress);
virtual void OnRegistrationReject();
virtual void ThirdPartyMakeCall(const PString & user1, const PString & user2, const PString & transferMethod);
virtual PBoolean IsRegisteredWithGk() const;
// get destination from list
PString GetDestination(const PString & token);
BYTE GetRateMultiplier() const { return m_rateMultiplier; }
protected:
void AddDestination(const PString & token, const PString & alias, const PString & transferMethod);
// get and remove destination from list
PString GetRemoveDestination(const PString & token);
PString GetRemoveTransferMethod(const PString & token);
// call destinations
PMutex destinationMutex;
std::map<PString, PString> destinations;
// per call transfer methods
PMutex methodMutex;
std::map<PString, PString> methods;
PCaselessString globalTransferMethod;
PBoolean isRegistered;
PString m_gkAddress;
long m_bandwidth;
BYTE m_rateMultiplier;
};
class MakeCallConnection : public H323Connection
{
public:
MakeCallConnection(MakeCallEndPoint & ep, unsigned _callReference, unsigned _options);
virtual ~MakeCallConnection() { }
PBoolean OnSendSignalSetup(H323SignalPDU & setupPDU);
#ifdef H323_AUDIO_CODECS
PBoolean OpenAudioChannel(PBoolean isEncoding, unsigned bufferSize, H323AudioCodec & codec);
#endif
protected:
MakeCallEndPoint & m_ep;
};
class SilentChannel : public PIndirectChannel
{
PCLASSINFO(SilentChannel, PIndirectChannel);
public:
SilentChannel() { }
virtual ~SilentChannel() { }
virtual PBoolean Read(void * buf, PINDEX len);
virtual PBoolean Write(const void *, PINDEX);
virtual PBoolean Close();
protected:
PAdaptiveDelay readDelay;
PAdaptiveDelay writeDelay;
};
#endif // _MakeCall_H