Hangup cause as unknown in case of timeout

While making a call to an extension (via ARI) (with specific timeout) and in case the agent doesn’t answer it, I’m getting the hangup cause as “unknown“ (cause code 0), which is weird as it should have been “No answer from user (user alerted)“ (cause code 19).

However, if I make the same call (with no timeout or timeout as -1), I’m getting the hangup cause “No answer from user (user alerted)” which is correct.

Is this a bug or is intentional from asterisk? Why is there a difference in hangup cause just because of timeout parameter?

The first call was terminated from the caller’s end. The second call was terminated from the callee’s end.

There are two ways to do this in ARI, and you haven’t stated which. When talking about ARI it is important to be specific. If using create and dial there was a pull request[1] merged in April to fix that scenario to be consistent to no answer. This would not be in the version of Asterisk you are using. If you aren’t a commercial agreement customer, then it’s up to you to either backport the fix or to switch away from certified.

[1] stasis/control.c: Set Hangup Cause to No Answer on Dial timeout by mbradeen · Pull Request #1203 · asterisk/asterisk

Thanks, will try to upgrade to the latest version

What about in case of originate? We are still getting 0 cause code.

The issue in question I linked was to do with ARI. If originate is doing something differently, then you’d probably need to file a different issue with actual information including instructions for reproduction and logging/details showing the result.

I have already posted a topic regarding this issue:
https://community.asterisk.org/t/channel-variable-is-not-set-while-originating/110677

Previously, when using Create and Dial, the cause code returned was 16. In the latest version, this issue has been fixed. (Above mentioned)

However, when using Originate and the channel times out, we are still receiving a cause code of 0. Ideally, this should return a cause indicating User Alerting – No Answer.

Could you please clarify whether this behavior is expected, or if there is a recommended way to handle this scenario?

I’ve reopened that topic. You can add additional information there if you want - such as what event you are referring to. If I have anything to add then I’ll do so, if I don’t then I won’t.