diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-02-07 21:51:43 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-02-07 21:51:43 +0000 |
commit | 06657633626d4fd03311d2307e03ac5ceb201ecb (patch) | |
tree | 098a76f48c72e8919c2efaf084d3220a7f70f45b /channels | |
parent | 8abc01c95338c1b0882a107071f9919ba5477c11 (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.4@306617 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 87d6f34df..cf5a4dc87 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10386,7 +10386,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) && + (!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 ); |