]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 306617 via svnmerge from
authorTerry Wilson <twilson@digium.com>
Mon, 7 Feb 2011 21:59:54 +0000 (21:59 +0000)
committerTerry Wilson <twilson@digium.com>
Mon, 7 Feb 2011 21:59:54 +0000 (21:59 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r306617 | twilson | 2011-02-07 13:51:43 -0800 (Mon, 07 Feb 2011) | 10 lines

  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/
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@306618 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 3666367c70b08a34b4fe91027e03ba51576d1c92..1d52334cb98420313d8ea5fffb9c092449ea80ff 100644 (file)
@@ -14045,7 +14045,15 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
                                *to = '\0';
                        ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag));
                }
-               
+
+               if (!strcmp(referdata->replaces_callid, transferer->callid) &&
+                       (!sip_cfg.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 (!sip_cfg.pedanticsipchecking)
                        ast_debug(2, "Attended transfer: Will use Replace-Call-ID : %s (No check of from/to tags)\n", referdata->replaces_callid );
                else