- new feature: "Obscure Loops" does modify the Call-IDs in
outgoing requests and thus allows incoming calls forked off such an outgoing call (redirect, transfer, ...) back to the same UA where the initial call did originate. This even seems to fix some issues with Asterisks Loop detection... :-)
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
0.6.0
|
||||
=====
|
||||
27-May-2007: - new feature: "Obscure Loops" does modify the Call-IDs in
|
||||
outgoing requests and thus allows incoming calls forked
|
||||
off such an outgoing call (redirect, transfer, ...) back
|
||||
to the same UA where the initial call did originate.
|
||||
This even seems to fix some issues with Asterisks
|
||||
Loop detection... :-)
|
||||
25-May-2007: - Just discovered some patches originating from Debian
|
||||
project - included most of them as they make sense.
|
||||
(Hint: People, if you get fixes, please drop me a note
|
||||
|
||||
@@ -246,9 +246,9 @@ debug_port = 0
|
||||
######################################################################
|
||||
# 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 <IP>:<port> combination than you send them to.
|
||||
# may be required in some cases where you have a NAT router that
|
||||
# remaps the source port 5060 to something different and the
|
||||
# registrar sends back the responses to port 5060.
|
||||
# Default is disabled
|
||||
# 0 - do not add ;rport to via header
|
||||
# 1 - do add ;rport to INCOMING via header only
|
||||
@@ -257,6 +257,31 @@ debug_port = 0
|
||||
#
|
||||
# use_rport = 0
|
||||
|
||||
######################################################################
|
||||
# Obscure SIP Loops
|
||||
#
|
||||
# By default, Siproxd can not handle the situation where a call
|
||||
# from an UA is made back to the *same* UA.
|
||||
#
|
||||
# E.g.
|
||||
#
|
||||
# UA ----- siproxd ----- Registrar
|
||||
#
|
||||
# and UA is registered with two accounts (A & B) at "Registrar".
|
||||
# If UA (account A) now initiates a Call to its second account (B)
|
||||
# this will result in a "loop" (if you use Asterisk as UA above, it
|
||||
# will react with an "482 Loop detected" error and does not accept the
|
||||
# call). Siproxd can not handle the RTP audio stream properly in such
|
||||
# a situation - you will most likely only hear silence.
|
||||
#
|
||||
# This expirmental feature does "obscure" this loop - well, actually
|
||||
# it does modify the OUTGOING Call-Id - and when the INVITE comes back,
|
||||
# it actually looks like a second (independend) call. This even makes
|
||||
# Asterisk work in the situation mentioned above.
|
||||
#
|
||||
# Default is disabled.
|
||||
# obscure_loops=1
|
||||
|
||||
######################################################################
|
||||
# Outbound proxy
|
||||
#
|
||||
|
||||
54
src/proxy.c
54
src/proxy.c
@@ -262,6 +262,30 @@ int proxy_request (sip_ticket_t *ticket) {
|
||||
rtp_stop_fwd(osip_message_get_call_id(request), DIR_OUTGOING);
|
||||
}
|
||||
|
||||
/*
|
||||
* "Obscure" SIP Loops - modify Call-IDs on outgoing REQs, so calls
|
||||
* forked / redirected from a Call originating here may be
|
||||
* passed back without breaking things
|
||||
*/
|
||||
if (configuration.obscure_loops) {
|
||||
osip_call_id_t *CID=NULL;
|
||||
char *tmp;
|
||||
|
||||
CID=osip_message_get_call_id(request);
|
||||
if (CID) {
|
||||
/* does CID->number already exist? */
|
||||
if (CID->number) { /* accoridng to RFC3261, this part is mandatory */
|
||||
/* modify it */
|
||||
tmp=osip_malloc(strlen(CID->number)+7+1);
|
||||
sprintf(tmp,"%s-siproxd",CID->number);
|
||||
osip_free(CID->number);
|
||||
CID->number=tmp;
|
||||
} else {
|
||||
WARN("CID without number part received, not RFC3261 conform!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -560,6 +584,35 @@ int proxy_response (sip_ticket_t *ticket) {
|
||||
response->from->url->username? response->from->url->username:"*NULL*",
|
||||
response->from->url->host? response->from->url->host : "*NULL*");
|
||||
|
||||
/*
|
||||
* "Obscure" SIP Loops - modify Call-IDs on incoming RESs, so calls
|
||||
* forked / redirected from a Call originating here may be
|
||||
* passed back without breaking things
|
||||
*/
|
||||
if (configuration.obscure_loops) {
|
||||
osip_call_id_t *CID=NULL;
|
||||
char *tmp, *tmp2;
|
||||
|
||||
CID=osip_message_get_call_id(response);
|
||||
if (CID) {
|
||||
/* does CID->number already exist? */
|
||||
if (CID->number) { /* accoridng to RFC3261, this part is mandatory */
|
||||
/* modify it back*/
|
||||
tmp=strstr(CID->number,"-siproxd");
|
||||
if (tmp) {
|
||||
/* make sure to cut only the last marker - in case
|
||||
of multiple siproxd instances... */
|
||||
for (;(tmp2=strstr(tmp+1, "-siproxd")) != NULL;) {
|
||||
tmp=tmp2;
|
||||
}
|
||||
tmp[0]='\0';
|
||||
}
|
||||
} else {
|
||||
WARN("CID without number part received, not RFC3261 conform!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Response for INVITE - deal with RTP data in body and
|
||||
* start RTP proxy stream(s). In case
|
||||
@@ -1221,7 +1274,6 @@ int proxy_rewrite_request_uri(osip_message_t *mymsg, int idx){
|
||||
*/
|
||||
int proxy_rewrite_useragent(sip_ticket_t *ticket){
|
||||
osip_header_t *ua_hdr=NULL;
|
||||
char *useragent;
|
||||
|
||||
osip_message_get_user_agent(ticket->sipmsg, 0, &ua_hdr);
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@ static int parse_config (FILE *configfile) {
|
||||
{ "pi_shortdial_entry", TYP_STRINGA,&configuration.pi_shortdial_entry },
|
||||
{ "ua_string", TYP_STRING, &configuration.ua_string },
|
||||
{ "use_rport", TYP_INT4, &configuration.use_rport },
|
||||
{ "obscure_loops", TYP_INT4, &configuration.obscure_loops },
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ struct siproxd_config {
|
||||
stringa_t pi_shortdial_entry;
|
||||
char *ua_string;
|
||||
int use_rport;
|
||||
int obscure_loops;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user