[asterisk-commits] mmichelson: branch 1.6.1 r140303 - in /branches/1.6.1: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 27 15:14:25 CDT 2008


Author: mmichelson
Date: Wed Aug 27 15:14:24 2008
New Revision: 140303

URL: http://svn.digium.com/view/asterisk?view=rev&rev=140303
Log:
Merged revisions 140301 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r140301 | mmichelson | 2008-08-27 15:11:22 -0500 (Wed, 27 Aug 2008) | 19 lines

Merged revisions 140299 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r140299 | mmichelson | 2008-08-27 14:49:20 -0500 (Wed, 27 Aug 2008) | 11 lines

Fix tag checking in get_sip_pvt_byid_locked when
in pedantic mode. The problem was that the wrong
tags would be compared depending on the direction
of the call.

(closes issue #13353)
Reported by: flefoll
Patches:
      chan_sip.c.br14.139015.patch-refer-pedantic uploaded by flefoll (license 244)


........

................

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/channels/chan_sip.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/channels/chan_sip.c?view=diff&rev=140303&r1=140302&r2=140303
==============================================================================
--- branches/1.6.1/channels/chan_sip.c (original)
+++ branches/1.6.1/channels/chan_sip.c Wed Aug 27 15:14:24 2008
@@ -11216,9 +11216,6 @@
 }
 
 /*! \brief Lock dialog lock and find matching pvt lock  
-	- Their tag is fromtag, our tag is to-tag
-	- This means that in some transactions, totag needs to be their tag :-)
-	  depending upon the direction
 	\return a reference, remember to release it when done 
 */
 static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *totag, const char *fromtag) 
@@ -11235,21 +11232,32 @@
 	
 	sip_pvt_ptr = ao2_t_find(dialogs, &tmp_dialog, OBJ_POINTER, "ao2_find of dialog in dialogs table");
 	if (sip_pvt_ptr) {
-		char *ourtag = sip_pvt_ptr->tag;
 		/* Go ahead and lock it (and its owner) before returning */
 		sip_pvt_lock(sip_pvt_ptr);
-		
-		if (pedanticsipchecking && (strcmp(fromtag, sip_pvt_ptr->theirtag) || (!ast_strlen_zero(totag) && strcmp(totag, ourtag)))) {
-			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_test_flag(&sip_pvt_ptr->flags[0], SIP_OUTGOING) ? "OUTGOING": "INCOMING", sip_pvt_ptr->callid, 
-					  sip_pvt_ptr->theirtag, sip_pvt_ptr->tag);
-			return 0;
+		if (pedanticsipchecking) {
+			const char *pvt_fromtag, *pvt_totag;
+
+			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))) {
+				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",
+						  sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING", sip_pvt_ptr->callid, 
+						  sip_pvt_ptr->theirtag, sip_pvt_ptr->tag);
+				return NULL;
+			}
 		}
 		
 		if (totag)
 			ast_debug(4, "Matched %s call - their tag is %s Our tag is %s\n",
-					  ast_test_flag(&sip_pvt_ptr->flags[0], SIP_OUTGOING) ? "OUTGOING": "INCOMING",
+					  sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING",
 					  sip_pvt_ptr->theirtag, sip_pvt_ptr->tag);
 
 		/* deadlock avoidance... */




More information about the asterisk-commits mailing list