- when allocating local ports for RTP relaying, do this
in a round-robin way over the available port range.
This commit is contained in:
parent
0984731872
commit
4acb6d6e34
@ -1,5 +1,7 @@
|
|||||||
0.5.11
|
0.5.11
|
||||||
======
|
======
|
||||||
|
20-Mar-2005: - when allocating local ports for RTP relaying, do this
|
||||||
|
in a round-robin way over the available port range.
|
||||||
1-Mar-2005: - working on running siproxd in front of a routing device
|
1-Mar-2005: - working on running siproxd in front of a routing device
|
||||||
and NOT on the firewall itself.
|
and NOT on the firewall itself.
|
||||||
19-Feb-2005: - more work on new libosip API
|
19-Feb-2005: - more work on new libosip API
|
||||||
|
|||||||
@ -389,7 +389,9 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, char *client_id,
|
|||||||
int media_stream_no, struct in_addr local_ipaddr,
|
int media_stream_no, struct in_addr local_ipaddr,
|
||||||
int *local_port, struct in_addr remote_ipaddr,
|
int *local_port, struct in_addr remote_ipaddr,
|
||||||
int remote_port) {
|
int remote_port) {
|
||||||
int i, j;
|
static int prev_used_port = 0;
|
||||||
|
int num_ports;
|
||||||
|
int i2, i, j;
|
||||||
int sock, port;
|
int sock, port;
|
||||||
int freeidx;
|
int freeidx;
|
||||||
int sts=STS_SUCCESS;
|
int sts=STS_SUCCESS;
|
||||||
@ -526,7 +528,20 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, char *client_id,
|
|||||||
/* find a local port number to use and bind to it */
|
/* find a local port number to use and bind to it */
|
||||||
sock=0;
|
sock=0;
|
||||||
port=0;
|
port=0;
|
||||||
for (i=configuration.rtp_port_low; i<=configuration.rtp_port_high; i+=2) {
|
// for (i=configuration.rtp_port_low; i<=configuration.rtp_port_high; i+=2) {
|
||||||
|
|
||||||
|
DEBUGC(DBCLASS_RTP,"*****a prev_used_port=%i",prev_used_port);
|
||||||
|
if ((prev_used_port < configuration.rtp_port_low) ||
|
||||||
|
(prev_used_port > configuration.rtp_port_high)) {
|
||||||
|
prev_used_port = configuration.rtp_port_high;
|
||||||
|
}
|
||||||
|
|
||||||
|
num_ports = configuration.rtp_port_high - configuration.rtp_port_low + 1;
|
||||||
|
for (i2 = (prev_used_port - configuration.rtp_port_low + 1);
|
||||||
|
i2 < (num_ports + prev_used_port - configuration.rtp_port_low + 1);
|
||||||
|
i2 += 2) {
|
||||||
|
i = (i2%num_ports) + configuration.rtp_port_low;
|
||||||
|
DEBUGC(DBCLASS_RTP,"***** i=%i, i2=%i",i,i2);
|
||||||
for (j=0; j<RTPPROXY_SIZE; j++) {
|
for (j=0; j<RTPPROXY_SIZE; j++) {
|
||||||
/* check if port already in use */
|
/* check if port already in use */
|
||||||
if ((memcmp(&rtp_proxytable[j].local_ipaddr,
|
if ((memcmp(&rtp_proxytable[j].local_ipaddr,
|
||||||
@ -542,6 +557,8 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, char *client_id,
|
|||||||
if (sock) break;
|
if (sock) break;
|
||||||
}
|
}
|
||||||
} /* for i */
|
} /* for i */
|
||||||
|
prev_used_port = port;
|
||||||
|
DEBUGC(DBCLASS_RTP,"*****z prev_used_port=%i",prev_used_port);
|
||||||
|
|
||||||
DEBUGC(DBCLASS_RTP,"rtp_relay_start_fwd: addr=%s, port=%i, sock=%i "
|
DEBUGC(DBCLASS_RTP,"rtp_relay_start_fwd: addr=%s, port=%i, sock=%i "
|
||||||
"freeidx=%i", utils_inet_ntoa(local_ipaddr), port, sock, freeidx);
|
"freeidx=%i", utils_inet_ntoa(local_ipaddr), port, sock, freeidx);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user