]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
stasis/control.c: Set Hangup Cause to No Answer on Dial timeout
authorMike Bradeen <mbradeen@sangoma.com>
Thu, 17 Apr 2025 15:50:21 +0000 (09:50 -0600)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 1 May 2025 12:41:17 +0000 (12:41 +0000)
Other Dial operations (dial, app_dial) use Q.850 cause 19 when a dial timeout occurs,
but the Dial command via ARI did not set an explicit reason. This resulted in a
CANCEL with Normal Call Clearing and corresponding ChannelDestroyed.

This change sets the hangup cause to AST_CAUSE_NO_ANSWER to be consistent with the
other operations.

Fixes: #963
UserNote:  A Dial timeout on POST /channels/{channelId}/dial will now result in a
CANCEL and ChannelDestroyed with cause 19 / User alerting, no answer.  Previously
no explicit cause was set, resulting in a cause of 16 / Normal Call Clearing.

(cherry picked from commit 4dc3ca4c9a4a339e14d1b2a042443176199ffd7a)

res/stasis/control.c

index 78f4391d34338ac5718d8616c30080da1a3bfd1a..74ebccdda2907cab34620f885e5bf9c0ddad3b96 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "asterisk/stasis_channels.h"
 #include "asterisk/stasis_app.h"
+#include "asterisk/causes.h"
 
 #include "command.h"
 #include "control.h"
@@ -1221,6 +1222,10 @@ struct ast_datastore_info timeout_datastore = {
 static int hangup_channel(struct stasis_app_control *control,
        struct ast_channel *chan, void *data)
 {
+       /* Set cause code to No Answer to be consistent with other dial timeout operations */
+       ast_channel_lock(chan);
+       ast_channel_hangupcause_set(chan, AST_CAUSE_NO_ANSWER);
+       ast_channel_unlock(chan);
        ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT);
        return 0;
 }