mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-04 05:15:22 +00:00 
			
		
		
		
	Merged revisions 181032-181033 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r181032 | mmichelson | 2009-03-10 19:46:47 -0500 (Tue, 10 Mar 2009) | 19 lines Merged revisions 181029,181031 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r181029 | mmichelson | 2009-03-10 19:30:26 -0500 (Tue, 10 Mar 2009) | 9 lines Fix incorrect tag checking on transfers when pedantic=yes is enabled. (closes issue #14611) Reported by: klaus3000 Patches: patch_chan_sip_attended_transfer_1.4.23.txt uploaded by klaus3000 (license 65) Tested by: klaus3000 ........ r181031 | mmichelson | 2009-03-10 19:32:40 -0500 (Tue, 10 Mar 2009) | 3 lines Remove unused variables. ........ ................ r181033 | mmichelson | 2009-03-10 19:49:00 -0500 (Tue, 10 Mar 2009) | 3 lines Add missing comment that quotes RFC 3891 ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@181035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		@@ -11612,22 +11612,49 @@ static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *t
 | 
			
		||||
		/* Go ahead and lock it (and its owner) before returning */
 | 
			
		||||
		sip_pvt_lock(sip_pvt_ptr);
 | 
			
		||||
		if (pedanticsipchecking) {
 | 
			
		||||
			const char *pvt_fromtag, *pvt_totag;
 | 
			
		||||
			unsigned char frommismatch = 0, tomismatch = 0;
 | 
			
		||||
 | 
			
		||||
			if (sip_pvt_ptr->outgoing_call == TRUE) {
 | 
			
		||||
				/* Outgoing call tags : from is "our", to is "their" */
 | 
			
		||||
				pvt_fromtag = sip_pvt_ptr->tag ;
 | 
			
		||||
				pvt_totag = sip_pvt_ptr->theirtag ;
 | 
			
		||||
			} else {
 | 
			
		||||
				/* Incoming call tags : from is "their", to is "our" */
 | 
			
		||||
				pvt_fromtag = sip_pvt_ptr->theirtag ;
 | 
			
		||||
				pvt_totag = sip_pvt_ptr->tag ;
 | 
			
		||||
			}
 | 
			
		||||
			if (ast_strlen_zero(fromtag) || strcmp(fromtag, pvt_fromtag) || (!ast_strlen_zero(totag) && strcmp(totag, pvt_totag))) {
 | 
			
		||||
			if (ast_strlen_zero(fromtag)) {
 | 
			
		||||
				sip_pvt_unlock(sip_pvt_ptr);
 | 
			
		||||
				ast_debug(4, "Matched %s call for callid=%s - But the pedantic check rejected the match; their tag is %s Our tag is %s\n",
 | 
			
		||||
				ast_debug(4, "Matched %s call for callid=%s - no from tag specified, pedantic check fails\n",
 | 
			
		||||
					  sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING", sip_pvt_ptr->callid);
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (ast_strlen_zero(totag)) {
 | 
			
		||||
				sip_pvt_unlock(sip_pvt_ptr);
 | 
			
		||||
				ast_debug(4, "Matched %s call for callid=%s - no to tag specified, pedantic check fails\n",
 | 
			
		||||
					  sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING", sip_pvt_ptr->callid);
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
			/* RFC 3891
 | 
			
		||||
			 * > 3.  User Agent Server Behavior: Receiving a Replaces Header
 | 
			
		||||
			 * > The Replaces header contains information used to match an existing
 | 
			
		||||
			 * > SIP dialog (call-id, to-tag, and from-tag).  Upon receiving an INVITE
 | 
			
		||||
			 * > with a Replaces header, the User Agent (UA) attempts to match this
 | 
			
		||||
			 * > information with a confirmed or early dialog.  The User Agent Server
 | 
			
		||||
			 * > (UAS) matches the to-tag and from-tag parameters as if they were tags
 | 
			
		||||
			 * > present in an incoming request.  In other words, the to-tag parameter
 | 
			
		||||
			 * > is compared to the local tag, and the from-tag parameter is compared
 | 
			
		||||
			 * > to the remote tag.
 | 
			
		||||
			 *
 | 
			
		||||
			 * Thus, the totag is always compared to the local tag, regardless if
 | 
			
		||||
			 * this our call is an incoming or outgoing call.
 | 
			
		||||
			 */
 | 
			
		||||
			frommismatch = !!strcmp(fromtag, sip_pvt_ptr->theirtag);
 | 
			
		||||
			tomismatch = !!strcmp(totag, sip_pvt_ptr->tag);
 | 
			
		||||
			if (frommismatch || tomismatch) {
 | 
			
		||||
				sip_pvt_unlock(sip_pvt_ptr);
 | 
			
		||||
				if (frommismatch) {
 | 
			
		||||
					ast_debug(4, "Matched %s call for callid=%s - But the pedantic check rejected the match; their tag is %s Our tag is %s\n",
 | 
			
		||||
							  sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING", sip_pvt_ptr->callid, 
 | 
			
		||||
							  fromtag, sip_pvt_ptr->theirtag);
 | 
			
		||||
				}
 | 
			
		||||
				if (tomismatch) {
 | 
			
		||||
					ast_debug(4, "Matched %s call for callid=%s - pedantic to tag check fails; their tag is %s our tag is %s\n",
 | 
			
		||||
						  sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING", sip_pvt_ptr->callid, 
 | 
			
		||||
						  sip_pvt_ptr->theirtag, sip_pvt_ptr->tag);
 | 
			
		||||
						  totag, sip_pvt_ptr->tag);
 | 
			
		||||
				}
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user