<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Lucida Console";
        panose-1:2 11 6 9 4 5 4 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Times New Roman","serif";
        color:#1F497D;}
..MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple style='word-wrap: break-word;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt'>Mathieu,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt'>Thanks for the reply. I&#8217;m
very new with FreeSWITCH and not familiar with api calls. I tried:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'>&nbsp;&nbsp;&nbsp;&nbsp;
user_data = apiExecute(&quot;user_data&quot;, &quot;1000@192.168.10.29 var
callgroup&quot;);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt'>But got a similar error:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>2009-07-16 17:01:47.212904 [ERR] mod_lua.cpp:182
/usr/local/freeswitch/scripts/helloworld.lua:13: attempt to call global
'apiExecute' (a nil value)<span style='background:black;mso-highlight:black'><o:p></o:p></span></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>stack traceback:<span style='background:black;
mso-highlight:black'><o:p></o:p></span></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/usr/local/freeswitch/scripts/helloworld.lua:13: in main chunk<span
style='background:black;mso-highlight:black'><o:p></o:p></span></span></p>

<p class=MsoNormal><span style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt'>I would appreciate an example
or a link to the pertinent documentation.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt'>Thanks, Lars<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
freeswitch-users-bounces@lists.freeswitch.org
[mailto:freeswitch-users-bounces@lists.freeswitch.org] <b>On Behalf Of </b>Mathieu
Rene<br>
<b>Sent:</b> Thursday, July 16, 2009 2:42 PM<br>
<b>To:</b> freeswitch-users@lists.freeswitch.org<br>
<b>Subject:</b> Re: [Freeswitch-users] Error in lua script with
session:getVariable<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>You need to make an API call, not get a variable.<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<div>

<div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'>Mathieu Rene<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'>Avant-Garde Solutions Inc<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'>Office: + 1 (514) 664-1044 x100<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'>Cell: +1 (514) 664-1044 x200<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'><a href="mailto:mrene@avgs.ca">mrene@avgs.ca</a><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'><o:p>&nbsp;</o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'><o:p>&nbsp;</o:p></span></p>

</div>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<div>

<p class=MsoNormal>Am 16-Jul-09 um 5:36 PM schrieb Lars Zeb:<o:p></o:p></p>

</div>

<p class=MsoNormal><br>
<br>
<o:p></o:p></p>

<div>

<div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;color:black'>I am getting an
error in a lua script which I don&#8217;t understand. Why is it returning nil
in the script yet something in the cli?</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;color:black'>&nbsp;</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;color:black'>lua snippet:</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>user_data = session:getVariable(</span><span style='font-size:
9.0pt;font-family:"Courier New";color:#BB0000'>'user_data<span
class=apple-converted-space>&nbsp;</span><a href="mailto:1000@192.168.10.29">1000@192.168.10.29</a><span
class=apple-converted-space>&nbsp;</span>var callgroup'</span><span
style='font-size:9.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>freeswitch.console_log(</span><span style='font-size:9.0pt;
font-family:"Courier New";color:#BB0000'>&quot;INFO&quot;</span><span
style='font-size:9.0pt;font-family:"Courier New";color:black'>,<span
class=apple-converted-space>&nbsp;</span></span><span style='font-size:9.0pt;
font-family:"Courier New";color:#BB0000'>&quot; UserData group &quot;</span><span
class=apple-converted-space><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>&nbsp;</span></span><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>.. user_data ..<span class=apple-converted-space>&nbsp;</span></span><span
style='font-size:9.0pt;font-family:"Courier New";color:#BB0000'>&quot;</span><span
style='font-size:9.0pt;font-family:"Courier New";color:#BB00BB'>\n</span><span
style='font-size:9.0pt;font-family:"Courier New";color:#BB0000'>&quot;</span><span
style='font-size:9.0pt;font-family:"Courier New";color:black'>)</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;color:black'>&nbsp;</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;color:black'>log:</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>2009-07-16 14:30:49.237343 [ERR] mod_lua.cpp:182
/usr/local/freeswitch/scripts/helloworld.lua:14: attempt to concatenate global
'user_data' (a nil value)</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>stack traceback:</span><span style='font-size:11.0pt;font-family:
"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/usr/local/freeswitch/scripts/helloworld.lua:14: in main chunk</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>&nbsp;</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console";
color:black'>&nbsp;</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;color:black'>cli:</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>freeswitch@internal&gt; user_data<span
class=apple-converted-space>&nbsp;</span><a href="mailto:1000@192.168.10.29">1000@192.168.10.29</a><span
class=apple-converted-space>&nbsp;</span>var callgroup</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New";
color:black'>techsupport</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;color:black'>&nbsp;</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;color:black'>Thanks, Lars</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif";
color:black'>_______________________________________________<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">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a
href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</div>

</div>

</body>

</html>