diff --git a/ChangeLog b/ChangeLog index 8ad7cb5..8f8b554 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 0.6.0 ===== 24-May-2007: - new feature: can masquerade User-agent header + - new feature: can add ;rport to my own Via Headers 13-May-2007: - deal with locally running UAs on same host (inboud IF side) 07-May-2007: - Client-ID in RTP proxy is derived from Client IP address. This should fix an issue with unexpectedly timing-out RTP diff --git a/doc/siproxd.conf.example b/doc/siproxd.conf.example index 777af75..8f1ca30 100644 --- a/doc/siproxd.conf.example +++ b/doc/siproxd.conf.example @@ -243,6 +243,20 @@ debug_port = 0 # #ua_string = Siproxd-UA +###################################################################### +# Use ;rport in via header +# +# may be required in some cases where the remote SIP Registrat +# uses asymmetric SIP signalling (you receive the SIP packets +# from another : combination than you send them to. +# Default is disabled +# 0 - do not add ;rport to via header +# 1 - do add ;rport to INCOMING via header only +# 2 - do add ;rport to OUTGOING via header only +# 3 - do add ;rport to OUTGOING and INCOMING via headers +# +# use_rport = 0 + ###################################################################### # Outbound proxy # diff --git a/src/readconf.c b/src/readconf.c index a7b26f5..b7c2209 100644 --- a/src/readconf.c +++ b/src/readconf.c @@ -184,6 +184,7 @@ static int parse_config (FILE *configfile) { { "pi_shortdial_akey", TYP_STRING, &configuration.pi_shortdial_akey }, { "pi_shortdial_entry", TYP_STRINGA,&configuration.pi_shortdial_entry }, { "ua_string", TYP_STRING, &configuration.ua_string }, + { "use_rport", TYP_INT4, &configuration.use_rport }, {0, 0, 0} }; diff --git a/src/sip_utils.c b/src/sip_utils.c index 66f970a..223b6e6 100644 --- a/src/sip_utils.c +++ b/src/sip_utils.c @@ -548,17 +548,31 @@ int sip_add_myvia (sip_ticket_t *ticket, int interface) { int sts; char branch_id[VIA_BRANCH_SIZE]; char *myaddr; + int add_rport=0; if (get_interface_ip(interface, &addr) != STS_SUCCESS) { return STS_FAILURE; } + /* evaluate if we need to include an ;rport */ + /* incoming */ + if ((configuration.use_rport & 1) && + ((ticket->direction==REQTYP_INCOMING) || + (ticket->direction==RESTYP_INCOMING)) ) { + add_rport=1; + } else if ((configuration.use_rport & 2) && + ((ticket->direction==REQTYP_OUTGOING) || + (ticket->direction==RESTYP_OUTGOING)) ) { + add_rport=1; + } + sts = sip_calculate_branch_id(ticket, branch_id); myaddr=utils_inet_ntoa(addr); - sprintf(tmp, "SIP/2.0/UDP %s:%i;branch=%s", + sprintf(tmp, "SIP/2.0/UDP %s:%i;branch=%s%s", myaddr, configuration.sip_listen_port, - branch_id); + branch_id, + (add_rport)? ";rport":""); DEBUGC(DBCLASS_BABBLE,"adding VIA:%s",tmp); diff --git a/src/siproxd.h b/src/siproxd.h index 9f6917f..94302a4 100644 --- a/src/siproxd.h +++ b/src/siproxd.h @@ -95,6 +95,7 @@ struct siproxd_config { char *pi_shortdial_akey; stringa_t pi_shortdial_entry; char *ua_string; + int use_rport; }; /*