I’m trying to create a custom channel variable in a LUA dialplan.
So I set the channel variable inside of the default context:
channel[“newVar”] = “value”
and in my hangup function, I try to call back that variable:
app.verbose("CHANNEL VARIABLE TEST: "…channel.newVar:get())
This results in the following error:
ERROR[C-00000002]: pbx_lua.c:1456 exec: Error executing lua extension:
[string “extensions.lua”]:227: attempt to concatenate a nil value
However, if I set the channel variable inside of the hangup function itself using the same method, the variable is correctly collected and printed.
I’ve also attempted to set the channel variable with the following two methods, with the same results:
alternate method #1:
channel.newVar = “value”
alternate method #2:
var = channel.newVar
I’ve uploaded my current dialplan here:
Can anyone sugggest a work around for this problem? Many thanks in advance!