[asterisk-bugs] [JIRA] (ASTERISK-30497) ChannelRedirect aborting hangup handler execution

Joshua C. Colp (JIRA) noreply at issues.asterisk.org
Wed Apr 19 03:37:03 CDT 2023


     [ https://issues.asterisk.org/jira/browse/ASTERISK-30497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joshua C. Colp updated ASTERISK-30497:
--------------------------------------

    Description: 
A ChannelRedirect on a channel that is in the process of hanging up can prevent hangup handler on the channel to complete. I believe this is a bug.

I improved the situation for our part with the following patch 

<inline patch removed>

Not sure if this is the right upstream fix for the problem.

Background: For my employer I have been crafting a queuing application to our liking through dialplan programming, relying heavily on ChannelRedirect to manipulate queue call legs, func_odbc to keep track of call(_leg) states, and hangup handlers to clean up call(_leg) records in the database.


  was:
A ChannelRedirect on a channel that is in the process of hanging up can prevent hangup handler on the channel to complete. I believe this is a bug.

I improved the situation for our part with the following patch 

{code:none}
$ git diff 18.17.1 main/pbx.c
diff --git a/main/pbx.c b/main/pbx.c
index c655f1bcfc..68d3044cdb 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7016,6 +7016,13 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex
        struct ast_channel *newchan;
 
        ast_channel_lock(chan);
+
+       if (ast_channel_softhangup_internal_flag(chan) & ~AST_SOFTHANGUP_ASYNCGOTO) {
+               ast_log(LOG_WARNING, "ast_async_goto refusing on dying channel %s\n", ast_channel_name(chan));
+               ast_channel_unlock(chan);
+               return -1;
+       }
+
        /* Channels in a bridge or running a PBX can be sent directly to the specified destination */
        if (ast_channel_is_bridged(chan) || ast_channel_pbx(chan)) {
                if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) {
{code}

Not sure if this is the right upstream fix for the problem.

Background: For my employer I have been crafting a queuing application to our liking through dialplan programming, relying heavily on ChannelRedirect to manipulate queue call legs, func_odbc to keep track of call(_leg) states, and hangup handlers to clean up call(_leg) records in the database.



> ChannelRedirect aborting hangup handler execution
> -------------------------------------------------
>
>                 Key: ASTERISK-30497
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30497
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Applications/app_channelredirect
>    Affects Versions: 18.17.0
>            Reporter: Egil Hjelmeland
>
> A ChannelRedirect on a channel that is in the process of hanging up can prevent hangup handler on the channel to complete. I believe this is a bug.
> I improved the situation for our part with the following patch 
> <inline patch removed>
> Not sure if this is the right upstream fix for the problem.
> Background: For my employer I have been crafting a queuing application to our liking through dialplan programming, relying heavily on ChannelRedirect to manipulate queue call legs, func_odbc to keep track of call(_leg) states, and hangup handlers to clean up call(_leg) records in the database.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list