<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><a href="http://wiki.freeswitch.org/wiki/Mod_lua#For_making_API_calls">http://wiki.freeswitch.org/wiki/Mod_lua#For_making_API_calls</a><div><br></div><div>Please READ that page. These details are there!</div><div><br></div><div>/b</div><div><br><div><div>On Jul 16, 2009, at 7:07 PM, Lars Zeb wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div 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"><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; ">Mathieu,<o:p></o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; "><o:p> </o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; ">Thanks for the reply. I’m very new with FreeSWITCH and not familiar with api calls. I tried:<o:p></o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; "><o:p> </o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 10pt; font-family: 'Lucida Console'; "> user_data = apiExecute("user_data", "<a href="mailto:1000@192.168.10.29" style="color: blue; text-decoration: underline; ">1000@192.168.10.29</a><span class="Apple-converted-space"> </span>var callgroup");<o:p></o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 10pt; font-family: 'Lucida Console'; "><o:p> </o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; ">But got a similar error:<o:p></o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 10pt; font-family: 'Lucida Console'; "><o:p> </o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; 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-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: black; background-position: initial initial; "><o:p></o:p></span></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: 'Courier New'; ">stack traceback:<span style="background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: black; background-position: initial initial; "><o:p></o:p></span></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: 'Courier New'; "> /usr/local/freeswitch/scripts/helloworld.lua:13: in main chunk<span style="background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: black; background-position: initial initial; "><o:p></o:p></span></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; "><o:p> </o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; ">I would appreciate an example or a link to the pertinent documentation.<o:p></o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; "><o:p> </o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; ">Thanks, Lars<o:p></o:p></span></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; color: rgb(31, 73, 125); "><o:p> </o:p></span></div><div style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-width: initial; border-color: initial; border-left-style: solid; border-left-color: blue; border-left-width: 1.5pt; padding-top: 0in; padding-right: 0in; padding-bottom: 0in; padding-left: 4pt; "><div><div style="border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-top-style: solid; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding-top: 3pt; padding-right: 0in; padding-bottom: 0in; padding-left: 0in; "><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; ">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; "><span class="Apple-converted-space"> </span><a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" style="color: blue; text-decoration: underline; ">freeswitch-users-bounces@lists.freeswitch.org</a><span class="Apple-converted-space"> </span>[<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" style="color: blue; text-decoration: underline; ">mailto:freeswitch-users-bounces@lists.freeswitch.org</a>]<span class="Apple-converted-space"> </span><b>On Behalf Of<span class="Apple-converted-space"> </span></b>Mathieu Rene<br><b>Sent:</b><span class="Apple-converted-space"> </span>Thursday, July 16, 2009 2:42 PM<br><b>To:</b><span class="Apple-converted-space"> </span><a href="mailto:freeswitch-users@lists.freeswitch.org" style="color: blue; text-decoration: underline; ">freeswitch-users@lists.freeswitch.org</a><br><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [Freeswitch-users] Error in lua script with session:getVariable<o:p></o:p></span></div></div></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><o:p> </o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">You need to make an API call, not get a variable.<o:p></o:p></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><o:p> </o:p></div><div><div><div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: Helvetica, sans-serif; color: black; ">Mathieu Rene<o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: Helvetica, sans-serif; color: black; ">Avant-Garde Solutions Inc<o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: Helvetica, sans-serif; color: black; ">Office: + 1 (514) 664-1044 x100<o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: Helvetica, sans-serif; color: black; ">Cell: +1 (514) 664-1044 x200<o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: Helvetica, sans-serif; color: black; "><a href="mailto:mrene@avgs.ca" style="color: blue; text-decoration: underline; ">mrene@avgs.ca</a><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: Helvetica, sans-serif; color: black; "><o:p> </o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: Helvetica, sans-serif; color: black; "><o:p> </o:p></span></div></div></div></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><o:p> </o:p></div></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><o:p> </o:p></div><div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">Am 16-Jul-09 um 5:36 PM schrieb Lars Zeb:<o:p></o:p></div></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><br><br><o:p></o:p></div><div><div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; color: black; ">I am getting an error in a lua script which I don’t understand. Why is it returning nil in the script yet something in the cli?</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; color: black; "> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; color: black; ">lua snippet:</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: 'Courier New'; color: black; ">user_data = session:getVariable(</span><span style="font-size: 9pt; font-family: 'Courier New'; color: rgb(187, 0, 0); ">'user_data<span class="apple-converted-space"> </span><a href="mailto:1000@192.168.10.29" style="color: blue; text-decoration: underline; ">1000@192.168.10.29</a><span class="apple-converted-space"> </span>var callgroup'</span><span style="font-size: 9pt; font-family: 'Courier New'; color: black; ">);</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: 'Courier New'; color: black; ">freeswitch.console_log(</span><span style="font-size: 9pt; font-family: 'Courier New'; color: rgb(187, 0, 0); ">"INFO"</span><span style="font-size: 9pt; font-family: 'Courier New'; color: black; ">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: 'Courier New'; color: rgb(187, 0, 0); ">" UserData group "</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: 'Courier New'; color: black; "> </span></span><span style="font-size: 9pt; font-family: 'Courier New'; color: black; ">.. user_data ..<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: 'Courier New'; color: rgb(187, 0, 0); ">"</span><span style="font-size: 9pt; font-family: 'Courier New'; color: rgb(187, 0, 187); ">\n</span><span style="font-size: 9pt; font-family: 'Courier New'; color: rgb(187, 0, 0); ">"</span><span style="font-size: 9pt; font-family: 'Courier New'; color: black; ">)</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; color: black; "> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; color: black; ">log:</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; 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: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: 'Courier New'; color: black; ">stack traceback:</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: 'Courier New'; color: black; "> /usr/local/freeswitch/scripts/helloworld.lua:14: in main chunk</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: 'Courier New'; color: black; "> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 10pt; font-family: 'Lucida Console'; color: black; "> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; color: black; ">cli:</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: 'Courier New'; color: black; ">freeswitch@internal> user_data<span class="apple-converted-space"> </span><a href="mailto:1000@192.168.10.29" style="color: blue; text-decoration: underline; ">1000@192.168.10.29</a><span class="apple-converted-space"> </span>var callgroup</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 9pt; font-family: 'Courier New'; color: black; ">techsupport</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; color: black; "> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div><div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-size: 11pt; color: black; ">Thanks, Lars</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: black; "><o:p></o:p></span></div></div></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><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" style="color: blue; text-decoration: underline; ">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" style="color: blue; text-decoration: underline; ">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" style="color: blue; text-decoration: underline; ">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" style="color: blue; text-decoration: underline; ">http://www.freeswitch.org</a><o:p></o:p></span></div></div></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; "><o:p> </o:p></div></div></div></div>_______________________________________________<br>FreeSWITCH-users mailing list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" style="color: blue; text-decoration: underline; ">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" style="color: blue; text-decoration: underline; ">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" style="color: blue; text-decoration: underline; ">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" style="color: blue; text-decoration: underline; ">http://www.freeswitch.org</a><br></div></blockquote></div><br></div></body></html>