Retrieving variable in dialplan with CHANNEL set by AMI SetVar()

Hi,

I’m trying to retrieve a variable which I have set on a Channel with the SetVar() AMI Action. I can see that the variable has been set when I do a dumpchan in the dialplan. Now I want to retrieve this variable value in the the dialplan to do a GotoIf.

I have tried to use the next Verbose message to read it:

same = n,Verbose(Appdate → ${CHANNEL(varname)})

This result in the error:

[May 5 12:16:42] WARNING[89388][C-00000ea3]: func_channel.c:527 func_channel_read: Unknown or unavailable item requested: ‘varname’

This made me thinking that “varname” does not exist, which seems logic because this is not mentioned in syntax shown in Asterisk 20 Function_CHANNEL - Asterisk Project - Asterisk Project Wiki.

Then I thought I might need to use “appdata”, but this also shows the same error message:

[May 5 12:16:42] WARNING[89388][C-00000ea3]: func_channel.c:527 func_channel_read: Unknown or unavailable item requested: ‘appdata’

And this seems weird to me, because it’s the same syntax I use for “state”, which is fine. Bug?

How can I retrieve the variable?

Greetz,

Idsert

Channel variables are retrieved like:

${VARIABLE}
1 Like

Sometimes the solution is simple :slight_smile: Thanks! Works.

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