39
40
class SdesNegotiator;
43
class AudioZrtpSession;
44
class AudioSrtpSession;
45
class AudioSymmetricRtpSession;
46
class AudioZrtpSession;
47
class AudioSrtpSession;
48
class AudioSymmetricRtpSession;
50
class AudioZrtpSession;
51
class AudioSrtpSession;
53
// Possible kind of rtp session
54
typedef enum RtpMethod {
61
class UnsupportedRtpSessionType : public std::logic_error {
63
UnsupportedRtpSessionType(const std::string& msg = "") : std::logic_error(msg) {}
66
class AudioRtpFactoryException : public std::logic_error {
68
AudioRtpFactoryException(const std::string& msg = "") : std::logic_error(msg) {}
71
class AudioRtpFactory {
55
class AudioZrtpSession;
56
class AudioSrtpSession;
57
class AudioSymmetricRtpSession;
59
// Possible kind of rtp session
60
typedef enum RtpMethod {
67
class UnsupportedRtpSessionType : public std::logic_error
70
UnsupportedRtpSessionType (const std::string& msg = "") : std::logic_error (msg) {}
73
class AudioRtpFactoryException : public std::logic_error
76
AudioRtpFactoryException (const std::string& msg = "") : std::logic_error (msg) {}
74
AudioRtpFactory(SIPCall * ca);
83
AudioRtpFactory (SIPCall * ca);
75
84
~AudioRtpFactory();
77
void initAudioRtpConfig(SIPCall *ca);
80
* Lazy instantiation method. Create a new RTP session of a given
81
* type according to the content of the configuration file.
82
* @param ca A pointer on a SIP call
83
* @return A new AudioRtpSession object
85
void initAudioRtpSession(SIPCall *ca);
88
* Start the audio rtp thread of the type specified in the configuration
89
* file. initAudioRtpSession must have been called prior to that.
92
void start(AudioCodec*);
95
* Stop the audio rtp thread of the type specified in the configuration
96
* file. initAudioRtpSession must have been called prior to that.
102
* Update current RTP destination address with one stored in call
105
void updateDestinationIpAddress (void);
109
* @return The internal audio rtp thread of the type specified in the configuration
110
* file. initAudioRtpSession must have been called prior to that.
112
inline void * getAudioRtpSession(void) { return _rtpSession; }
114
AudioSymmetricRtpSession * getAudioSymetricRtpSession();
118
* @return The internal audio rtp session type
123
inline RtpMethod getAudioRtpType(void) { return _rtpSessionType; }
126
* @param Set internal audio rtp session type (Symmetric, Zrtp, Sdes)
128
inline void setAudioRtpType(RtpMethod type) { _rtpSessionType = type; }
131
* Manually set the srtpEnable option (usefull for RTP fallback)
133
void setSrtpEnabled(bool enable){ _srtpEnabled = enable; }
136
* Manually set the keyExchangeProtocol parameter (usefull for RTP fallback)
138
void setKeyExchangeProtocol(int proto){ _keyExchangeProtocol = proto; }
141
* Manually set the setHelloHashEnabled parameter (usefull for RTP fallback)
143
void setHelloHashEnabled(bool enable){ _helloHashEnabled = enable; }
146
* Get the current AudioZrtpSession. Throws an AudioRtpFactoryException
147
* if the current rtp thread is null, or if it's not of the correct type.
148
* @return The current AudioZrtpSession thread.
150
sfl::AudioZrtpSession * getAudioZrtpSession();
153
* Set remote cryptographic info. Should be called after negotiation in SDP
154
* offer/answer session.
156
void setRemoteCryptoInfo(sfl::SdesNegotiator& nego);
159
* Send DTMF over RTP (RFC2833). The timestamp and sequence number must be
160
* incremented as if it was microphone audio. This function change the payload type of the rtp session,
161
* send the appropriate DTMF digit using this payload, discard coresponding data from mainbuffer and get
162
* back the codec payload for further audio processing.
164
void sendDtmfDigit(int digit);
168
RtpMethod _rtpSessionType;
169
ost::Mutex _audioRtpThreadMutex;
171
// Field used when initializinga udio rtp session
172
// May be set manually or from config using initAudioRtpConfig
175
// Field used when initializinga udio rtp session
176
// May be set manually or from config using initAudioRtpConfig
177
int _keyExchangeProtocol;
179
// Field used when initializinga udio rtp session
180
// May be set manually or from config using initAudioRtpConfig
181
bool _helloHashEnabled;
86
void initAudioRtpConfig (SIPCall *ca);
89
* Lazy instantiation method. Create a new RTP session of a given
90
* type according to the content of the configuration file.
91
* @param ca A pointer on a SIP call
92
* @return A new AudioRtpSession object
94
void initAudioRtpSession (SIPCall *ca);
97
* Start the audio rtp thread of the type specified in the configuration
98
* file. initAudioRtpSession must have been called prior to that.
101
void start (AudioCodec*);
104
* Stop the audio rtp thread of the type specified in the configuration
105
* file. initAudioRtpSession must have been called prior to that.
111
* Update current RTP destination address with one stored in call
114
void updateDestinationIpAddress (void);
118
* @return The internal audio rtp thread of the type specified in the configuration
119
* file. initAudioRtpSession must have been called prior to that.
121
inline void * getAudioRtpSession (void) {
125
AudioSymmetricRtpSession * getAudioSymetricRtpSession();
129
* @return The internal audio rtp session type
134
inline RtpMethod getAudioRtpType (void) {
135
return _rtpSessionType;
139
* @param Set internal audio rtp session type (Symmetric, Zrtp, Sdes)
141
inline void setAudioRtpType (RtpMethod type) {
142
_rtpSessionType = type;
146
* Manually set the srtpEnable option (usefull for RTP fallback)
148
void setSrtpEnabled (bool enable) {
149
_srtpEnabled = enable;
153
* Manually set the keyExchangeProtocol parameter (usefull for RTP fallback)
155
void setKeyExchangeProtocol (int proto) {
156
_keyExchangeProtocol = proto;
160
* Manually set the setHelloHashEnabled parameter (usefull for RTP fallback)
162
void setHelloHashEnabled (bool enable) {
163
_helloHashEnabled = enable;
167
* Get the current AudioZrtpSession. Throws an AudioRtpFactoryException
168
* if the current rtp thread is null, or if it's not of the correct type.
169
* @return The current AudioZrtpSession thread.
171
sfl::AudioZrtpSession * getAudioZrtpSession();
173
void initLocalCryptoInfo (SIPCall *ca);
176
* Set remote cryptographic info. Should be called after negotiation in SDP
177
* offer/answer session.
179
void setRemoteCryptoInfo (sfl::SdesNegotiator& nego);
182
* Send DTMF over RTP (RFC2833). The timestamp and sequence number must be
183
* incremented as if it was microphone audio. This function change the payload type of the rtp session,
184
* send the appropriate DTMF digit using this payload, discard coresponding data from mainbuffer and get
185
* back the codec payload for further audio processing.
187
void sendDtmfDigit (int digit);
191
RtpMethod _rtpSessionType;
192
ost::Mutex _audioRtpThreadMutex;
194
// Field used when initializinga udio rtp session
195
// May be set manually or from config using initAudioRtpConfig
198
// Field used when initializinga udio rtp session
199
// May be set manually or from config using initAudioRtpConfig
200
int _keyExchangeProtocol;
202
// Field used when initializinga udio rtp session
203
// May be set manually or from config using initAudioRtpConfig
204
bool _helloHashEnabled;
184
207
#endif // __AUDIO_RTP_FACTORY_H__