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