]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
pbx.c: When the AST_SOFTHANGUP_ASYNCGOTO flag is set, pbx_extension_helper should...
authorTinet-mucw <mucw@ti-net.com.cn>
Tue, 22 Jul 2025 09:36:11 +0000 (02:36 -0700)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Tue, 22 Jul 2025 18:58:48 +0000 (18:58 +0000)
Under certain circumstances the context/extens/prio are set in the ast_async_goto, for example action Redirect.
In the situation that action Redirect is broken by pbx_extension_helper this info is changed.
This will cause the current dialplan location to be executed twice.
In other words, the Redirect action does not take effect.

Resolves: #1315

main/pbx.c

index 65b9ce7f07ddab0a8a8592be93bade2c8d2717de..ae7e66bc9ce27e9bef18ec0a3c5629884632ac4d 100644 (file)
@@ -2942,11 +2942,17 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
                                ast_log(LOG_WARNING, "No application '%s' for extension (%s, %s, %d)\n", e->app, context, exten, priority);
                                return -1;
                        }
+                       ast_channel_lock(c);
+                       if (ast_channel_softhangup_internal_flag(c) & AST_SOFTHANGUP_ASYNCGOTO) {
+                               ast_channel_unlock(c);
+                               return 0;
+                       }
                        if (ast_channel_context(c) != context)
                                ast_channel_context_set(c, context);
                        if (ast_channel_exten(c) != exten)
                                ast_channel_exten_set(c, exten);
                        ast_channel_priority_set(c, priority);
+                       ast_channel_unlock(c);
                        if (substitute) {
                                pbx_substitute_variables_helper(c, substitute, passdata, sizeof(passdata)-1);
                        }