[Asterisk-cvs] asterisk/channels chan_sip.c,1.190,1.191

markster at lists.digium.com markster at lists.digium.com
Thu Oct 9 17:24:39 CDT 2003


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv12624/channels

Modified Files:
	chan_sip.c 
Log Message:
Consider "from" when getting destination (bug #368)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- chan_sip.c	6 Oct 2003 00:39:34 -0000	1.190
+++ chan_sip.c	9 Oct 2003 22:50:42 -0000	1.191
@@ -3543,6 +3543,7 @@
 static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
 {
 	char tmp[256] = "", *c, *a;
+	char tmpf[256]= "", *fr;
 	struct sip_request *req;
 	
 	req = oreq;
@@ -3551,6 +3552,13 @@
 	if (req->rlPart2)
 		strncpy(tmp, req->rlPart2, sizeof(tmp) - 1);
 	c = ditch_braces(tmp);
+	
+	strncpy(tmpf, get_header(oreq, "From"), sizeof(tmpf) - 1);
+	fr = ditch_braces(tmpf);
+	
+	if (fr && !strlen(fr))
+		fr = NULL;
+	
 	if (strncmp(c, "sip:", 4)) {
 		ast_log(LOG_WARNING, "Huh?  Not a SIP header (%s)?\n", c);
 		return -1;
@@ -3561,14 +3569,14 @@
 	}
 	if (sipdebug)
 		ast_verbose("Looking for %s in %s\n", c, p->context);
-	if (ast_exists_extension(NULL, p->context, c, 1, NULL) ||
+	if (ast_exists_extension(NULL, p->context, c, 1, fr) ||
 		!strcmp(c, ast_pickup_ext())) {
 		if (!oreq)
 			strncpy(p->exten, c, sizeof(p->exten) - 1);
 		return 0;
 	}
 
-	if (ast_canmatch_extension(NULL, p->context, c, 1, NULL) ||
+	if (ast_canmatch_extension(NULL, p->context, c, 1, fr) ||
 	    !strncmp(c, ast_pickup_ext(),strlen(c))) {
 		return 1;
 	}




More information about the svn-commits mailing list