[asterisk-commits] russell: branch 1.2-netsec r115613 - in /branches/1.2-netsec: ./ channels/ in...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 12 09:52:51 CDT 2008


Author: russell
Date: Mon May 12 09:52:51 2008
New Revision: 115613

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115613
Log:
sync with 1.2

Removed:
    branches/1.2-netsec/include/asterisk/dlinkedlists.h
Modified:
    branches/1.2-netsec/   (props changed)
    branches/1.2-netsec/channels/chan_iax2.c

Propchange: branches/1.2-netsec/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon May 12 09:52:51 2008
@@ -1,1 +1,1 @@
-/branches/1.2:1-115471
+/branches/1.2:1-115612

Modified: branches/1.2-netsec/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.2-netsec/channels/chan_iax2.c?view=diff&rev=115613&r1=115612&r2=115613
==============================================================================
--- branches/1.2-netsec/channels/chan_iax2.c (original)
+++ branches/1.2-netsec/channels/chan_iax2.c Mon May 12 09:52:51 2008
@@ -89,7 +89,6 @@
 #include "asterisk/dnsmgr.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/netsock.h"
-#include "asterisk/dlinkedlists.h"
 #include "asterisk/astobj2.h"
 
 #include "iax2.h"
@@ -613,8 +612,6 @@
 	int frames_dropped;
 	/*! received frame count: (just for stats) */
 	int frames_received;
-
-	AST_DLLIST_ENTRY(chan_iax2_pvt) entry;
 };
 
 static struct ast_iax2_queue {
@@ -3556,9 +3553,41 @@
 static int iax2_indicate(struct ast_channel *c, int condition)
 {
 	unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
+	struct chan_iax2_pvt *pvt;
+	int res;
+
 	if (option_debug && iaxdebug)
 		ast_log(LOG_DEBUG, "Indicating condition %d\n", condition);
-	return send_command_locked(callno, AST_FRAME_CONTROL, condition, 0, NULL, 0, -1);
+
+	ast_mutex_lock(&iaxsl[callno]);
+
+	pvt = iaxs[callno];
+
+	if (!pvt->peercallno) {
+		/* We don't know the remote side's call number, yet.  :( */
+		int count = 10;
+		while (count-- && pvt && !pvt->peercallno) {
+			ast_mutex_unlock(&iaxsl[callno]);
+			usleep(1);
+			ast_mutex_lock(&iaxsl[callno]);
+			pvt = iaxs[callno];
+		}
+		
+		if (!pvt->peercallno) {
+			/* Even after waiting, we still haven't completed a handshake with
+			 * our peer, so we can't send this frame.  Bail out. */
+			res = -1;
+			goto done;
+		}
+	}
+
+
+	res = send_command(iaxs[callno], AST_FRAME_CONTROL, condition, 0, NULL, 0, -1);
+
+done:
+	ast_mutex_unlock(&iaxsl[callno]);
+
+	return res;
 }
 	
 static int iax2_transfer(struct ast_channel *c, const char *dest)




More information about the asterisk-commits mailing list