You can use the uuid_dump command to get all the channel variables and values. Here's some rudimentary code which accepts the uuid as an argument:-- Lua has no split function, so we need to create onefunction string:split( inSplitPattern, outResults )if not outResults thenoutResults = {}endlocal theStart = 1local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart )while theSplitStart dotable.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) )theStart = theSplitEnd + 1theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart )endtable.insert( outResults, string.sub( self, theStart ) )return outResultsendapi = freeswitch.API()uuid = argv[1]-- uuid_dump gets all vars for a particular channelres = api:execute('uuid_dump',uuid)freeswitch.consoleLog('INFO',"Complete vars list: " .. res .. "\n")-- lines is a table, one row per var: val pairlines = string.split(res,"\n")for i=1,#lines do-- check for variable name using pattern match-- Adjust the pattern to whatever you are trying to findmyPattern = 'variable_'if string.match(lines[i], myPattern) thenvarval = string.split(lines[i],": ")freeswitch.consoleLog("NOTICE","Variable '" .. varval[1] .. "' contains '" .. varval[2] .. "'\n")endendI don't know if this is the most efficient way of doing what you're trying to do but it does demonstrate the power and flexibility of Lua and FreeSWITCH API's like uuid_dump.-MCOn Wed, Mar 2, 2016 at 12:05 PM, Oleg Stolyar <olegstolyar@gmail.com> wrote:_________________________________________________________________________Hi guys,is there a way to find all the session variable with a certain name pattern in lua?For example I need to find all the session variables whose names start with "bla_"As an alternative is there a way to iterate over all the session variables? Then I can just do that and find the variables I need this way.
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org