- RTCP support
- dejitter feature by Hans Carlos Hofmann (<labtop-carlos@hchs.de>)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
0.5.13
|
||||
======
|
||||
18-Jun-2006: - included RTCP support and a de-jitter feature
|
||||
(submitted by by Hans Carlos Hofmann)
|
||||
11-Jun-2006: - RTP timeout handling: allow unidirectional data w/o
|
||||
terminating connection after timeout.
|
||||
20-May-2006: - Fixed compiling issue when building on MacOS (Georg Schwarz)
|
||||
|
||||
@@ -142,6 +142,13 @@ rtp_timeout = 300
|
||||
#
|
||||
rtp_dscp = 46
|
||||
|
||||
######################################################################
|
||||
# Dejitter value
|
||||
# in useconds
|
||||
#
|
||||
rtp_input_dejitter = 300000
|
||||
rtp_output_dejitter = 300000
|
||||
|
||||
######################################################################
|
||||
# Default Expiration timeout for Registrations
|
||||
# If a REGISTER request does not contain an Expires header
|
||||
|
||||
+26
-1
@@ -21,6 +21,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -791,6 +792,7 @@ int proxy_rewrite_invitation_body(sip_ticket_t *ticket, int direction){
|
||||
sdp_media_t *sdp_med;
|
||||
int rtp_direction=0;
|
||||
int have_c_media=0;
|
||||
int isrtp = 0 ;
|
||||
|
||||
if (configuration.rtp_proxy_enable == 0) return STS_SUCCESS;
|
||||
|
||||
@@ -1000,6 +1002,28 @@ if (configuration.debuglevel)
|
||||
msg_port=atoi(sdp_message_m_port_get(sdp, media_stream_no));
|
||||
|
||||
if (msg_port > 0) {
|
||||
|
||||
/* is this an RTP stream ? */
|
||||
{
|
||||
char *protocol = sdp_message_m_proto_get (sdp, media_stream_no);
|
||||
if (protocol == NULL) {
|
||||
DEBUGC(DBCLASS_PROXY, "no protocol definition found!");
|
||||
} else {
|
||||
char *check;
|
||||
char *cmp;
|
||||
isrtp = 1;
|
||||
check = protocol ;
|
||||
cmp = "RTP/" ;
|
||||
while (*cmp && (isrtp = isrtp && *check) &&
|
||||
(isrtp = isrtp && (*cmp++ == toupper(*check++))) ) {} ;
|
||||
if (isrtp) {
|
||||
DEBUGC(DBCLASS_PROXY, "found RTP protocol [%s]!", protocol);
|
||||
} else {
|
||||
DEBUGC(DBCLASS_PROXY, "found non RTP protocol [%s]!", protocol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
osip_uri_t *cont_url = NULL;
|
||||
char *client_id=NULL;
|
||||
/* try to get some additional UA specific unique ID.
|
||||
@@ -1051,7 +1075,8 @@ if (configuration.debuglevel)
|
||||
rtp_direction,
|
||||
media_stream_no,
|
||||
map_addr, &map_port,
|
||||
addr_media, msg_port);
|
||||
addr_media, msg_port,
|
||||
isrtp);
|
||||
|
||||
if (sts == STS_SUCCESS) {
|
||||
/* and rewrite the port */
|
||||
|
||||
@@ -157,6 +157,8 @@ static int parse_config (FILE *configfile) {
|
||||
{ "rtp_timeout", TYP_INT4, &configuration.rtp_timeout },
|
||||
{ "rtp_proxy_enable", TYP_INT4, &configuration.rtp_proxy_enable },
|
||||
{ "rtp_dscp", TYP_INT4, &configuration.rtp_dscp },
|
||||
{ "rtp_input_dejitter", TYP_INT4, &configuration.rtp_input_dejitter },
|
||||
{ "rtp_output_dejitter", TYP_INT4, &configuration.rtp_output_dejitter },
|
||||
{ "user", TYP_STRING, &configuration.user },
|
||||
{ "chrootjail", TYP_STRING, &configuration.chrootjail },
|
||||
{ "hosts_allow_reg", TYP_STRING, &configuration.hosts_allow_reg },
|
||||
@@ -312,6 +314,8 @@ int make_default_config(void){
|
||||
memset (&configuration, 0, sizeof(configuration));
|
||||
configuration.sip_listen_port=SIP_PORT;
|
||||
configuration.default_expires=DEFAULT_EXPIRES;
|
||||
configuration.rtp_input_dejitter=DEFAULT_DEJITTER;
|
||||
configuration.rtp_output_dejitter=DEFAULT_DEJITTER;
|
||||
|
||||
return STS_SUCCESS;
|
||||
}
|
||||
|
||||
+26
-7
@@ -2,17 +2,17 @@
|
||||
Copyright (C) 2003-2005 Thomas Ries <tries@gmx.net>
|
||||
|
||||
This file is part of Siproxd.
|
||||
|
||||
|
||||
Siproxd is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
Siproxd is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Siproxd; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -47,6 +47,16 @@ int rtpproxy_init( void ) {
|
||||
sts = STS_SUCCESS;
|
||||
} else if (configuration.rtp_proxy_enable == 1) { // Relay
|
||||
sts = rtp_relay_init ();
|
||||
if ((configuration.rtp_output_dejitter < 0) ||
|
||||
(configuration.rtp_output_dejitter > DEJITTERLIMIT)) {
|
||||
ERROR("CONFIG: rtp_output_dejitter has invalid value %i [0 .. %i]",
|
||||
configuration.rtp_output_dejitter, DEJITTERLIMIT) ;
|
||||
}
|
||||
if ((configuration.rtp_input_dejitter < 0) ||
|
||||
(configuration.rtp_input_dejitter > DEJITTERLIMIT)) {
|
||||
ERROR("CONFIG: rtp_input_dejitter has invalid value %i [0 .. %i]",
|
||||
configuration.rtp_input_dejitter, DEJITTERLIMIT) ;
|
||||
}
|
||||
} else {
|
||||
ERROR("CONFIG: rtp_proxy_enable has invalid value: %d",
|
||||
configuration.rtp_proxy_enable);
|
||||
@@ -64,17 +74,26 @@ int rtpproxy_init( void ) {
|
||||
*/
|
||||
int rtp_start_fwd (osip_call_id_t *callid, char *client_id,
|
||||
int direction, int media_stream_no,
|
||||
struct in_addr local_ipaddr, int *local_port,
|
||||
struct in_addr remote_ipaddr, int remote_port) {
|
||||
int sts=STS_FAILURE;
|
||||
struct in_addr local_ipaddr, int *local_port,
|
||||
struct in_addr remote_ipaddr, int remote_port,
|
||||
int isrtp) {
|
||||
int sts=STS_FAILURE;
|
||||
int dejitter=0;
|
||||
|
||||
if (configuration.rtp_proxy_enable == 0) {
|
||||
sts = STS_SUCCESS;
|
||||
} else if (configuration.rtp_proxy_enable == 1) { // Relay
|
||||
if (isrtp) {
|
||||
if (direction == DIR_OUTGOING) {
|
||||
dejitter = configuration.rtp_output_dejitter;
|
||||
} else {
|
||||
dejitter = configuration.rtp_input_dejitter;
|
||||
}
|
||||
}
|
||||
sts = rtp_relay_start_fwd (callid, client_id,
|
||||
direction, media_stream_no,
|
||||
local_ipaddr, local_port,
|
||||
remote_ipaddr, remote_port);
|
||||
remote_ipaddr, remote_port, dejitter);
|
||||
} else {
|
||||
ERROR("CONFIG: rtp_proxy_enable has invalid value: %d",
|
||||
configuration.rtp_proxy_enable);
|
||||
|
||||
+22
-2
@@ -23,14 +23,33 @@
|
||||
#define CALLIDNUM_SIZE 256
|
||||
#define CALLIDHOST_SIZE 128
|
||||
#define CLIENT_ID_SIZE 128
|
||||
|
||||
typedef struct {
|
||||
struct timeval starttime ;
|
||||
int calccount ;
|
||||
int dejitter ;
|
||||
struct timeval dejitter_tv ;
|
||||
double dejitter_d ;
|
||||
int time_code_a ;
|
||||
double recived_a ; /* time in µsec sience epoch */
|
||||
int time_code_b ;
|
||||
double recived_b ; /* time in µsec sience epoch */
|
||||
int time_code_c ;
|
||||
double recived_c ; /* time in µsec sience epoch */
|
||||
|
||||
} timecontrol_t ;
|
||||
|
||||
typedef struct {
|
||||
int rtp_rx_sock; /* rx socket (0 -> free slot)*/
|
||||
int rtp_tx_sock; /* tx socket */
|
||||
int rtp_con_rx_sock; /* rx socket rtcp */
|
||||
int rtp_con_tx_sock; /* tx socket rtcp */
|
||||
char callid_number[CALLIDNUM_SIZE]; /* call ID */
|
||||
char callid_host[CALLIDHOST_SIZE]; /* --"-- */
|
||||
char client_id[CLIENT_ID_SIZE];
|
||||
int direction; /* Direction of RTP stream */
|
||||
int media_stream_no;
|
||||
timecontrol_t tc;
|
||||
struct in_addr local_ipaddr; /* local IP */
|
||||
int local_port; /* local allocated port */
|
||||
struct in_addr remote_ipaddr; /* remote IP */
|
||||
@@ -45,7 +64,8 @@ typedef struct {
|
||||
int rtp_relay_init(void);
|
||||
int rtp_relay_start_fwd (osip_call_id_t *callid, char *client_id,
|
||||
int rtp_direction, int media_stream_no,
|
||||
struct in_addr local_ipaddr, int *local_port,
|
||||
struct in_addr remote_ipaddr, int remote_port);
|
||||
struct in_addr local_ipaddr, int *local_port,
|
||||
struct in_addr remote_ipaddr, int remote_port,
|
||||
int dejitter);
|
||||
int rtp_relay_stop_fwd (osip_call_id_t *callid, int rtp_direction,
|
||||
int media_stream_no, int nolock);
|
||||
|
||||
+716
-171
File diff suppressed because it is too large
Load Diff
+9
-3
@@ -69,6 +69,8 @@ struct siproxd_config {
|
||||
int rtp_timeout;
|
||||
int rtp_dscp;
|
||||
int rtp_proxy_enable;
|
||||
int rtp_input_dejitter;
|
||||
int rtp_output_dejitter;
|
||||
char *user;
|
||||
char *chrootjail;
|
||||
char *hosts_allow_reg;
|
||||
@@ -184,7 +186,8 @@ int rtpproxy_init( void ); /*X*/
|
||||
int rtp_start_fwd (osip_call_id_t *callid, char *client_id, /*X*/
|
||||
int direction, int media_stream_no,
|
||||
struct in_addr outbound_ipaddr, int *outboundport,
|
||||
struct in_addr lcl_client_ipaddr, int lcl_clientport);
|
||||
struct in_addr lcl_client_ipaddr, int lcl_clientport,
|
||||
int isrtp);
|
||||
int rtp_stop_fwd (osip_call_id_t *callid, int direction); /*X*/
|
||||
void rtpproxy_kill( void ); /*X*/
|
||||
|
||||
@@ -222,11 +225,14 @@ int sip_message_set_body(osip_message_t * sip, const char *buf, size_t len);
|
||||
#define DEFAULT_MAXFWD 70 /* default Max-Forward count */
|
||||
#define DEFAULT_EXPIRES 3600 /* default Expires timeout */
|
||||
|
||||
#define URLMAP_SIZE 64 /* number of URL mapping table entries */
|
||||
#define URLMAP_SIZE 128 /* number of URL mapping table entries */
|
||||
/* this limits the number of clients! */
|
||||
|
||||
#define RTPPROXY_SIZE 128 /* number of rtp proxy entries */
|
||||
#define RTPPROXY_SIZE 256 /* number of rtp proxy entries */
|
||||
/* this limits the number of calls! */
|
||||
#define SOURCECACHE_SIZE 256 /* number of return addresses */
|
||||
#define DEJITTERLIMIT 1500000 /* max value for dejitter configuration */
|
||||
#define DEFAULT_DEJITTER 300000 /* default value for dejitter configuration */
|
||||
|
||||
#define BUFFER_SIZE 8196 /* input buffer for read from socket */
|
||||
#define RTP_BUFFER_SIZE 512 /* max size of an RTP frame */
|
||||
|
||||
Reference in New Issue
Block a user