diff --git a/main/pbx.c b/main/pbx.c
index 18778fac7679e1320a98148f2cbdb64d7e0b2f1e..e00ba70b18207e958c74a8935119aeb23fc52730 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -9977,7 +9977,6 @@ static void *pbx_outgoing_exec(void *data)
 		return NULL;
 	}
 
-	ast_mutex_lock(&outgoing->lock);
 	if (!ast_strlen_zero(outgoing->app)) {
 		struct ast_app *app = pbx_findapp(outgoing->app);
 
@@ -10012,6 +10011,7 @@ static void *pbx_outgoing_exec(void *data)
 	}
 
 	/* 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);