Asterisk ARI originate() Call Defaults to "default" Context Instead of Custom Context

I am using Asterisk ARI to originate a call and explicitly set a custom context (e.g., “test2”), but when the call reaches the StasisStart event, it appears in the default context instead. Why is the context being overridden or ignored?

  1. Log Before Originate Call (Expected Context: “test2”)

Screenshot from 2025-03-25 20-00-10

  1. Originate Code Snippet
    Channel channel = ari.channels().originate(endpoint)
    .setContext(context)
    .setApp(asteriskApp)
    .setCallerId(fromWithout0)
    .setAppArgs(args)
    .setExtension(fromWithout0)
    .execute();

  2. onStasisStart Log (Unexpected: Context Defaults to “default”)
    Screenshot from 2025-03-25 20-02-09

Verified the context value before originating the call – It is set to test2.
Checked extensions.conf for the context "test2" – It exists in the dialplan.
Tried setting setContext() before setApp(), but the issue persists.

What could be causing Asterisk to override or ignore the context set during originate()? Could it be an issue with ARI, dialplan configuration, or something else? Any guidance would be appreciated!

The dialplan target information is where the channel will go upon answer. It’s not set on the channel otherwise. You can’t specify both an ARI application and a dialplan target, though. Since you’ve specified an ARI application, the context/extension is ignored.

Thank you so much! Your explanation clarified the issue perfectly. After removing setApp(asteriskApp), the context is now correctly applied, and it’s working as expected. Really appreciate your help