<div dir="ltr">Thanks Michael, looks like a very workable solution!</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 2, 2016 at 2:57 PM, Michael Collins <span dir="ltr"><<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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:<div><br></div><div><div><font face="monospace, monospace">-- Lua has no split function, so we need to create one</font></div><div><font face="monospace, monospace">function string:split( inSplitPattern, outResults )</font></div><div><font face="monospace, monospace"> if not outResults then</font></div><div><font face="monospace, monospace"> outResults = {}</font></div><div><font face="monospace, monospace"> end</font></div><div><font face="monospace, monospace"> local theStart = 1</font></div><div><font face="monospace, monospace"> local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart )</font></div><div><font face="monospace, monospace"> while theSplitStart do</font></div><div><font face="monospace, monospace"> table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) )</font></div><div><font face="monospace, monospace"> theStart = theSplitEnd + 1</font></div><div><font face="monospace, monospace"> theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart )</font></div><div><font face="monospace, monospace"> end</font></div><div><font face="monospace, monospace"> table.insert( outResults, string.sub( self, theStart ) )</font></div><div><font face="monospace, monospace"> return outResults</font></div><div><font face="monospace, monospace">end</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">api = freeswitch.API()</font></div><div><font face="monospace, monospace">uuid = argv[1]</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">-- uuid_dump gets all vars for a particular channel</font></div><div><font face="monospace, monospace">res = api:execute('uuid_dump',uuid)</font></div><div><font face="monospace, monospace">freeswitch.consoleLog('INFO',"Complete vars list: " .. res .. "\n")</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">-- lines is a table, one row per var: val pair</font></div><div><font face="monospace, monospace">lines = string.split(res,"\n")</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">for i=1,#lines do</font></div><div><font face="monospace, monospace"> -- check for variable name using pattern match</font></div><div><font face="monospace, monospace"> -- Adjust the pattern to whatever you are trying to find</font></div><div><font face="monospace, monospace"> myPattern = 'variable_'</font></div><div><font face="monospace, monospace"> if string.match(lines[i], myPattern) then</font></div><div><font face="monospace, monospace"> varval = string.split(lines[i],": ")</font></div><div><font face="monospace, monospace"> freeswitch.consoleLog("NOTICE","Variable '" .. varval[1] .. "' contains '" .. varval[2] .. "'\n")</font></div><div><font face="monospace, monospace"> end</font></div><div><font face="monospace, monospace">end</font></div><div><br></div></div><div>I 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. </div><div><br></div><div>-MC</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Mar 2, 2016 at 12:05 PM, Oleg Stolyar <span dir="ltr"><<a href="mailto:olegstolyar@gmail.com" target="_blank">olegstolyar@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi guys,<div><br></div><div>is there a way to find all the session variable with a certain name pattern <b><u>in lua</u></b>?</div><div><br></div><div>For example I need to find all the session variables whose names start with "bla_"</div><div><br></div><div>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.</div></div>
<br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>