[asterisk-commits] twilson: branch 1.4 r306617 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 7 15:51:48 CST 2011


Author: twilson
Date: Mon Feb  7 15:51:43 2011
New Revision: 306617

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=306617
Log:
Don't allow a REFER w/replaces to replace its own dialog

Asterisk currently accepts a REFER with a Refer-To with an embedded Replaces
header that matches the dialog of the REFER. This would be a situation like A
calls B, A calls C, A transfers B to A, which is just silly. This patch makes
the transfer fail instead of making Asterisk freak out and forget to hang other
channels up.

Review: https://reviewboard.asterisk.org/r/1093/

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=306617&r1=306616&r2=306617
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Mon Feb  7 15:51:43 2011
@@ -10386,7 +10386,15 @@
 				*to = '\0';
 			ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag));
 		}
-		
+
+		if (!strcmp(referdata->replaces_callid, transferer->callid) &&
+			(!pedanticsipchecking ||
+			(!strcmp(referdata->replaces_callid_fromtag, transferer->tag) &&
+			!strcmp(referdata->replaces_callid_totag, transferer->theirtag)))) {
+				ast_log(LOG_WARNING, "Got an attempt to replace own Call-ID on %s\n", transferer->callid);
+				return -4;
+		}
+
 		if (option_debug > 1) {
 			if (!pedanticsipchecking)
 				ast_log(LOG_DEBUG,"Attended transfer: Will use Replace-Call-ID : %s (No check of from/to tags)\n", referdata->replaces_callid );




More information about the asterisk-commits mailing list