[asterisk-commits] file: trunk r389085 - /trunk/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat May 18 17:49:18 CDT 2013


Author: file
Date: Sat May 18 17:49:14 2013
New Revision: 389085

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389085
Log:
Fix a bug where synchronous origination (oddly enough triggered by doing an async manager Originate) would not work properly.

Modified:
    trunk/main/pbx.c

Modified: trunk/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/pbx.c?view=diff&rev=389085&r1=389084&r2=389085
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Sat May 18 17:49:14 2013
@@ -9963,10 +9963,11 @@
 static void *pbx_outgoing_exec(void *data)
 {
 	RAII_VAR(struct pbx_outgoing *, outgoing, data, ao2_cleanup);
-	enum ast_dial_result res = ast_dial_run(outgoing->dial, NULL, 0);
+	enum ast_dial_result res;
 
 	/* Notify anyone interested that dialing is complete */
 	ast_mutex_lock(&outgoing->lock);
+	res = ast_dial_run(outgoing->dial, NULL, 0);
 	outgoing->dialed = 1;
 	ast_cond_signal(&outgoing->cond);
 	ast_mutex_unlock(&outgoing->lock);
@@ -9976,6 +9977,7 @@
 		return NULL;
 	}
 
+	ast_mutex_lock(&outgoing->lock);
 	if (!ast_strlen_zero(outgoing->app)) {
 		struct ast_app *app = pbx_findapp(outgoing->app);
 
@@ -10010,7 +10012,6 @@
 	}
 
 	/* Notify anyone else again that may be interested that execution is complete */
-	ast_mutex_lock(&outgoing->lock);
 	outgoing->executed = 1;
 	ast_cond_signal(&outgoing->cond);
 	ast_mutex_unlock(&outgoing->lock);
@@ -10126,8 +10127,14 @@
 	/* Wait for dialing to complete */
 	if (synchronous) {
 		ast_mutex_lock(&outgoing->lock);
+		if (channel) {
+			ast_channel_unlock(*channel);
+		}
 		while (!outgoing->dialed) {
 			ast_cond_wait(&outgoing->cond, &outgoing->lock);
+		}
+		if (channel) {
+			ast_channel_lock(*channel);
 		}
 		ast_mutex_unlock(&outgoing->lock);
 	}




More information about the asterisk-commits mailing list