- 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:
Thomas Ries
2007-05-27 18:25:49 +00:00
parent 4ff6e84e72
commit 8c27d38ee3
5 changed files with 89 additions and 4 deletions
+53 -1
View File
@@ -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);
+1
View File
@@ -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}
};
+1
View File
@@ -96,6 +96,7 @@ struct siproxd_config {
stringa_t pi_shortdial_entry;
char *ua_string;
int use_rport;
int obscure_loops;
};
/*