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

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


Author: file
Date: Sat May 18 19:49:15 2013
New Revision: 389116

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389116
Log:
If the caller of the originate API calls wants the channel ensure it has been requested and dialed.

Modified:
    trunk/main/pbx.c

Modified: trunk/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/pbx.c?view=diff&rev=389116&r1=389115&r2=389116
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Sat May 18 19:49:15 2013
@@ -10115,6 +10115,8 @@
 
 	ao2_ref(outgoing, +1);
 
+	ast_mutex_lock(&outgoing->lock);
+
 	if (ast_pthread_create_detached(&thread, NULL, pbx_outgoing_exec, outgoing)) {
 		ast_log(LOG_WARNING, "Unable to spawn dialing thread for '%s/%s'\n", type, addr);
 		if (channel) {
@@ -10125,8 +10127,7 @@
 	}
 
 	/* Wait for dialing to complete */
-	if (synchronous) {
-		ast_mutex_lock(&outgoing->lock);
+	if (channel || synchronous) {
 		if (channel) {
 			ast_channel_unlock(*channel);
 		}
@@ -10136,17 +10137,16 @@
 		if (channel) {
 			ast_channel_lock(*channel);
 		}
-		ast_mutex_unlock(&outgoing->lock);
 	}
 
 	/* Wait for execution to complete */
 	if (synchronous > 1) {
-		ast_mutex_lock(&outgoing->lock);
 		while (!outgoing->executed) {
 			ast_cond_wait(&outgoing->cond, &outgoing->lock);
 		}
-		ast_mutex_unlock(&outgoing->lock);
-	}
+	}
+
+	ast_mutex_unlock(&outgoing->lock);
 
 	if (reason) {
 		*reason = ast_dial_reason(outgoing->dial, 0);




More information about the asterisk-commits mailing list