@@ -30,6 +30,7 @@ namespace OSS {
30
30
namespace SIP {
31
31
namespace SBC {
32
32
33
+ #define RTP_PROXY_THREAD_COUNT 30
33
34
34
35
static int get_node (const std::string& sessionId, bool & spillOver)
35
36
{
@@ -77,43 +78,55 @@ SBCMediaProxy::SBCMediaProxy(SBCManager* pManager) :
77
78
_node2 (2 ),
78
79
_node3 (3 ),
79
80
_node4 (4 ),
80
- _pManager (pManager)
81
+ _pManager (pManager),
82
+ _remoteRtpEnabled (false )
81
83
{
82
84
}
83
85
84
86
SBCMediaProxy::~SBCMediaProxy ()
85
87
{
86
88
}
87
89
88
- bool SBCMediaProxy::initialize ()
90
+ bool SBCMediaProxy::initialize (bool remoteRtpEnabled )
89
91
{
90
- if (!_node0.initialize ())
91
- return false ;
92
- if (!_node1.initialize ())
93
- return false ;
94
- if (!_node2.initialize ())
95
- return false ;
96
- if (!_node3.initialize ())
97
- return false ;
98
- if (!_node4.initialize ())
99
- return false ;
100
-
92
+ _remoteRtpEnabled = remoteRtpEnabled;
93
+
94
+ if (_remoteRtpEnabled)
95
+ {
96
+ if (!_node0.initialize ())
97
+ return false ;
98
+ if (!_node1.initialize ())
99
+ return false ;
100
+ if (!_node2.initialize ())
101
+ return false ;
102
+ if (!_node3.initialize ())
103
+ return false ;
104
+ if (!_node4.initialize ())
105
+ return false ;
106
+ }
107
+ else
108
+ {
109
+ _rtp.run (RTP_PROXY_THREAD_COUNT);
110
+ }
101
111
return true ;
102
112
}
103
113
104
114
SBCMediaProxyClient* SBCMediaProxy::getNode (const std::string& sessionId, bool & spillOver)
105
115
{
106
- int node = get_node (sessionId, spillOver);
107
- if (node == 0 )
108
- return &_node0;
109
- else if (node == 1 )
110
- return &_node1;
111
- else if (node == 2 )
112
- return &_node2;
113
- else if (node == 3 )
114
- return &_node3;
115
- else if (node == 4 )
116
- return &_node4;
116
+ if (_remoteRtpEnabled)
117
+ {
118
+ int node = get_node (sessionId, spillOver);
119
+ if (node == 0 )
120
+ return &_node0;
121
+ else if (node == 1 )
122
+ return &_node1;
123
+ else if (node == 2 )
124
+ return &_node2;
125
+ else if (node == 3 )
126
+ return &_node3;
127
+ else if (node == 4 )
128
+ return &_node4;
129
+ }
117
130
return 0 ;
118
131
}
119
132
@@ -136,6 +149,18 @@ bool SBCMediaProxy::handleSDP(
136
149
{
137
150
return pNode->handleSDP (logId, sessionId, sentBy, packetSourceIP, packetLocalInterface, route, routeLocalInterface, requestType, sdp, rtpAttribute);
138
151
}
152
+ else
153
+ {
154
+ try
155
+ {
156
+ _rtp.handleSDP (logId, sessionId, sentBy, packetSourceIP, packetLocalInterface, route, routeLocalInterface, requestType, sdp, rtpAttribute);
157
+ return true ;
158
+ }
159
+ catch (...)
160
+ {
161
+ return false ;
162
+ }
163
+ }
139
164
return false ;
140
165
}
141
166
@@ -147,6 +172,11 @@ bool SBCMediaProxy::getSDP(const std::string& sessionId, std::string& lastOffer,
147
172
{
148
173
return pNode->getSDP ( sessionId, lastOffer, lastAnswer);
149
174
}
175
+ else
176
+ {
177
+ _rtp.getSDP (sessionId, lastOffer, lastAnswer);
178
+ return true ;
179
+ }
150
180
return false ;
151
181
}
152
182
@@ -159,6 +189,11 @@ bool SBCMediaProxy::removeSession(const std::string& sessionId)
159
189
{
160
190
return pNode->removeSession (sessionId);
161
191
}
192
+ else
193
+ {
194
+ _rtp.removeSession (sessionId);
195
+ return true ;
196
+ }
162
197
return false ;
163
198
}
164
199
@@ -179,11 +214,18 @@ unsigned int SBCMediaProxy::getMaxSession() const
179
214
180
215
unsigned int SBCMediaProxy::getSessionCount () const
181
216
{
182
- return _node0.getSessionCount () +
183
- _node1.getSessionCount () +
184
- _node2.getSessionCount () +
185
- _node3.getSessionCount () +
186
- _node4.getSessionCount ();
217
+ if (_remoteRtpEnabled)
218
+ {
219
+ return _node0.getSessionCount () +
220
+ _node1.getSessionCount () +
221
+ _node2.getSessionCount () +
222
+ _node3.getSessionCount () +
223
+ _node4.getSessionCount ();
224
+ }
225
+ else
226
+ {
227
+ return _rtp.getSessionCount ();
228
+ }
187
229
}
188
230
189
231
} } } // OSS::SIP::SBC
0 commit comments