Skip to content

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

@rayanweragala

Description

@rayanweragala

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”)

2025-03-25 19:55:22 [pool-2-thread-4] INFO AUDIT_LOG - context is: test2

  1. Originate Code Snippet

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

  1. onStasisStart Log (Unexpected: Context Defaults to “default”)

2025-03-25 19:55:28 [pool-2-thread-57] INFO AUDIT_LOG - ,127.0.0.1,,1.1V,AVPPBX,,202503251955327,,onStasisStart,,details,{"args":["OUTBOUND_CONNECT_AGENT","2","0762192061","1742912718.0","781100996"],"asterisk_id":"90:e8:68:40:82:bd","application":"app-2","channel":{"connected":{"number":"117109638","name":""},"caller":{"number":"117109638","name":""},"name":"PJSIP/0762192061-00000001","dialplan":{"app_name":"Stasis","context":"default","app_data":"app-2,OUTBOUND_CONNECT_AGENT,2,0762192061,1742912718.0,781100996","priority":1,"exten":"s"},"language":"en","creationtime":"Tue Mar 25 19:55:22 IST 2025","id":"1742912722.1","state":"Up","accountcode":""},"type":"StasisStart","timestamp":"Tue Mar 25 19:55:28 IST 2025"},,,,,,,,,,,,

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions