[svn-commits] russell: trunk r56786 - in /trunk: ./ channels/chan_iax2.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Feb 26 09:54:17 MST 2007


Author: russell
Date: Mon Feb 26 10:54:17 2007
New Revision: 56786

URL: http://svn.digium.com/view/asterisk?view=rev&rev=56786
Log:
Merged revisions 56785 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r56785 | russell | 2007-02-26 10:51:18 -0600 (Mon, 26 Feb 2007) | 3 lines

Do more complete locking of the chan_iax2_pvt struct in the indicate callback.
(Problem brought up by Ben Smithurst on the asterisk-dev list)

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_iax2.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=56786&r1=56785&r2=56786
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Mon Feb 26 10:54:17 2007
@@ -3323,23 +3323,34 @@
 static int iax2_indicate(struct ast_channel *c, int condition, const void *data, size_t datalen)
 {
 	unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
+	struct chan_iax2_pvt *pvt = c->tech_pvt;
+	int res = 0;
 
 	if (option_debug && iaxdebug)
 		ast_log(LOG_DEBUG, "Indicating condition %d\n", condition);
 
-	if (!strcasecmp(iaxs[callno]->mohinterpret, "passthrough"))
-		return send_command_locked(callno, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
+	ast_mutex_lock(&iaxsl[callno]);
+
+	if (!strcasecmp(pvt->mohinterpret, "passthrough")) {
+		res = send_command(pvt, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
+		ast_mutex_unlock(&iaxsl[callno]);
+		return res;
+	}
 
 	switch (condition) {
 	case AST_CONTROL_HOLD:
-		ast_moh_start(c, data, iaxs[callno]->mohinterpret);
-		return 0;
+		ast_moh_start(c, data, pvt->mohinterpret);
+		break;
 	case AST_CONTROL_UNHOLD:
 		ast_moh_stop(c);
-		return 0;
+		break;
 	default:
-		return send_command_locked(callno, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
-	}
+		res = send_command(pvt, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
+	}
+
+	ast_mutex_unlock(&iaxsl[callno]);
+
+	return res;
 }
 	
 static int iax2_transfer(struct ast_channel *c, const char *dest)



More information about the svn-commits mailing list