Pbx_lua: how to create a dynamic hints for each extension?

In extensions.conf you can:

exten = _11XX,hint,PJSIP/${EXTEN}

But there’s no way to do that in Lua:

hints = {    
        ["default"] = {    
                ["_11XX"] = "PJSIP/" .. channel.EXTEN:get();    

leads to error:

 ERROR[258560]: pbx_lua.c:1660 load_or_reload_lua_stuff: Error loading extensions.lua: 
[string "extensions.lua"]:73: attempt to index a nil value (global 'channel')
stack traceback:
        [string "extensions.lua"]:73: in main chunk


hints = {
        ["default"] = {
                ["_11XX"] = function(c, e)
                        dev = string.format("PJSIP/%s", e)
                        return dev                  

just doesn’t work.

The pbx_lua module may predate such functionality, and thus not support it.

Oh, just now a kind person suggested a working method:

["_11XX"] = "PJSIP/${EXTEN}"; 

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