JSON query trought StasisApp


I need to send vía WS on the JSON from StasisApp parameters like call time in progress for example.
I see that can send that via “args” on the Stasis. Smth like: Stasis(test,{args})
But I want to add lines to the json response with channel variables, Like:

time progres: 1:03

Is that possible?

Thanks in advance

ARI can be configured[1] to emit channel variables on every channel related event. Outside of that there is only the arguments you mention.

[1] https://github.com/asterisk/asterisk/blob/master/configs/samples/ari.conf.sample#L17

Hi jcolp!

Do you mean that if I uncomment “;channelvars = var1,var2,var3”
And for example:

channelvars = callerid,timeofthecall,example3

I will see that on JSON respones if i have it previously declared?


They would be added to JSON events in ARI for channels that have the variables set, from what I understand. I haven’t used it though.

Hi again jcolp,

Tested and working!!! Now variables appears on JSON response with this query:

“channelvars”: {
“var1”: “”,
“var2”: “”,
“var3”: “”

Too much thanks! Do you know if its possible to make a channel variable that counts the calltime in progress?

The CDR dialplan function[1] may provide such information. I do not know if it can be used in said variables.

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_CDR

Hi again master!

Working perfectly: 2 options.

  • Declaring a channel variable with cdr variable —> Set(timetest=${CDR(duration)});
  • Or directly printing on ari.conf —> CDR (duration)



Too much thanks!!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.