[asterisk-commits] russell: branch russell/iax2_find_callno r114865 - /team/russell/iax2_find_ca...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 29 17:45:34 CDT 2008


Author: russell
Date: Tue Apr 29 17:45:34 2008
New Revision: 114865

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114865
Log:
Fix various bugs involving swapping the callno/peercallno, and not properly getting
the pvt in the hash table.  The module appears to be properly pulling the pvt out of
the hash table when receiving media frames now.  yay

Modified:
    team/russell/iax2_find_callno/channels/chan_iax2.c

Modified: team/russell/iax2_find_callno/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_find_callno/channels/chan_iax2.c?view=diff&rev=114865&r1=114864&r2=114865
==============================================================================
--- team/russell/iax2_find_callno/channels/chan_iax2.c (original)
+++ team/russell/iax2_find_callno/channels/chan_iax2.c Tue Apr 29 17:45:34 2008
@@ -1610,8 +1610,8 @@
 		if (callno) {
 			struct chan_iax2_pvt *pvt;
 			struct chan_iax2_pvt tmp_pvt = {
-				.callno = callno,
-				.peercallno = dcallno,
+				.callno = dcallno,
+				.peercallno = callno,
 				/* hack!! */
 				.frames_received = full_frame,
 			};
@@ -1620,11 +1620,12 @@
 
 			if ((pvt = ao2_find(iax_peercallno_pvts, &tmp_pvt, OBJ_POINTER))) {
 				if (return_locked) {
-					ast_mutex_lock(&iaxsl[callno]);
+					ast_mutex_lock(&iaxsl[pvt->callno]);
 				}
+				res = pvt->callno;
 				ao2_ref(pvt, -1);
 				pvt = NULL;
-				return dcallno;
+				return res;
 			}
 		}
 
@@ -7989,7 +7990,16 @@
 	if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) && !minivid &&
 		f.subclass != IAX_COMMAND_TXCNT &&		/* for attended transfer */
 		f.subclass != IAX_COMMAND_TXACC) {		/* for attended transfer */
-		iaxs[fr->callno]->peercallno = (unsigned short) (ntohs(mh->callno) & ~IAX_FLAG_FULL);
+		unsigned short new_peercallno;
+		
+		new_peercallno = (unsigned short) (ntohs(mh->callno) & ~IAX_FLAG_FULL);
+		if (new_peercallno && new_peercallno != iaxs[fr->callno]->peercallno) {
+			if (iaxs[fr->callno]->peercallno) {
+				remove_by_peercallno(iaxs[fr->callno]);
+			}
+			iaxs[fr->callno]->peercallno = new_peercallno;
+			store_by_peercallno(iaxs[fr->callno]);
+		}
 	}
 	if (ntohs(mh->callno) & IAX_FLAG_FULL) {
 		if (iaxdebug)
@@ -11905,7 +11915,7 @@
 	/* The frames_received field is used to hold whether we're matching
 	 * against a full frame or not ... */
 
-	return match(&pvt2->addr, pvt2->callno, pvt2->peercallno, pvt, 
+	return match(&pvt2->addr, pvt2->peercallno, pvt2->callno, pvt, 
 		pvt2->frames_received) ? CMP_MATCH : 0;
 }
 




More information about the asterisk-commits mailing list