<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=koi8-r">
<META content="MSHTML 6.00.6000.20753" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>We try to write&nbsp;some script extensions 
for&nbsp;application&nbsp; LUA &amp; JS &amp; Perl.<BR>There are some 
questions&nbsp;:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>1. Seems,&nbsp;that for use LUA there is no 
necessity to install&nbsp;lua-5.1.3.tar.gz from<BR><A 
href="http://www.lua.org/ftp/">http://www.lua.org/ftp/</A>, also that&nbsp;LUA 
environment is built&nbsp;in a kernel of&nbsp;FreeSWITCH. Is it 
correct?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>2. In the catalogue scripts it is placed test 
files:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>- 
2004.pl<BR>#!/usr/bin/perl<BR>freeswitch::console_log('info', 
"******Perl*********\n");<BR>my $res = `uname 
-a`;<BR>freeswitch::console_log('notice', "OS Info: $res\n");<BR>1;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>- 2005.lua<BR>freeswitch.consoleLog( "info", 
"*************LUA************\n" );</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>- 2006.js<BR>console_log( 
"*************JavaScript************\n" 
);<BR>session.answer();<BR>exit();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>also we make in addition:<BR>$ luac 2005.lua -o 
2005.luac</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>and add&nbsp;extensions into 
dialplan:<BR>&nbsp;<BR>&lt;extension name="2004"&gt;<BR>&nbsp; &lt;condition 
field="destination_number" expression="^2004$" &gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;action application="perl" data="2004.pl" /&gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;action application="answer" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;action 
application="sleep" data="1000" /&gt;<BR>&nbsp; 
&lt;/condition&gt;<BR>&lt;/extension&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&lt;extension name="2005"&gt;<BR>&nbsp; &lt;condition 
field="destination_number" expression="^2005$" &gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;action application="lua" data="2005.lua" /&gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;action application="answer" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;action 
application="sleep" data="1000" /&gt;<BR>&nbsp; 
&lt;/condition&gt;<BR>&lt;/extension&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&lt;extension name="20051"&gt;<BR>&nbsp; &lt;condition 
field="destination_number" expression="^20051$" &gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;action application="lua" data="2005.luac" /&gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;action application="answer" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;action 
application="sleep" data="1000" /&gt;<BR>&nbsp; 
&lt;/condition&gt;<BR>&lt;/extension&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>extension name="2006"&gt;<BR>&nbsp; &lt;condition field="destination_number" 
expression="^2006$" &gt;<BR>&nbsp;&nbsp;&nbsp; &lt;action application="jsrun" 
data="2006.js" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;action application="sleep" 
data="1000" /&gt;<BR>&nbsp; 
&lt;/condition&gt;<BR>&lt;/extension&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>We fulfil inquiries SIPp to the corresponding extension:<BR>$ ./sipp -sn uac 
-s 2004 -m 1 opos8:5070<BR>And we takes on FreeSWITCH's console:</FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=Arial size=2>
<DIV><BR>2008-08-29 12:28:07 [NOTICE] switch_channel.c:538 
switch_channel_set_name() New Channel <A 
href="mailto:sofia/nat/sipp@192.168.2.108:5061">sofia/nat/sipp@192.168.2.108:5061</A> 
[7ac768e8-2673-465b-98a4-bba7f1f42f80]<BR>2008-08-29 12:28:07 [INFO] 
mod_dialplan_xml.c:228 dialplan_hunt() Processing sipp-&gt;2004 in context 
public<BR>2008-08-29 12:28:07 [INFO] switch_cpp.cpp:1050 console_log() 
******Perl*********<BR>2008-08-29 12:28:07 [NOTICE] switch_cpp.cpp:1050 
console_log() OS Info: Linux opos8.altron.lan 2.6.18-53.1.19.el5 #1 SMP Wed May 
7 08:20:19 EDT 2008 i686 i686 i386 GNU/Linux<BR>&nbsp;<BR>2008-08-29 12:35:32 
[NOTICE] switch_channel.c:538 switch_channel_set_name() New Channel <A 
href="mailto:sofia/nat/sipp@192.168.2.108:5061">sofia/nat/sipp@192.168.2.108:5061</A> 
[bc778692-309e-43a7-be3d-e4fa8465fc14]<BR>2008-08-29 12:35:32 [INFO] 
mod_dialplan_xml.c:228 dialplan_hunt() Processing sipp-&gt;2005 in context 
public<BR>2008-08-29 12:35:32 [INFO] switch_cpp.cpp:1050 console_log() </DIV>
<DIV>*************LUA************</DIV>
<DIV>&nbsp;</DIV>
<DIV>2008-08-29 12:40:10 [NOTICE] switch_channel.c:538 switch_channel_set_name() 
New Channel <A 
href="mailto:sofia/nat/sipp@192.168.2.108:5061">sofia/nat/sipp@192.168.2.108:5061</A> 
[335f6192-fb5a-43ed-91ce-c8c40f3973b7]<BR>2008-08-29 12:40:10 [INFO] 
mod_dialplan_xml.c:228 dialplan_hunt() Processing sipp-&gt;20051 in context 
public<BR>2008-08-29 12:40:10 [INFO] switch_cpp.cpp:1050 console_log() </DIV>
<DIV>*************LUA************</DIV>
<DIV>&nbsp;</DIV>
<DIV>LUA&nbsp;script is fulfilled both in initial and in compiled sort...</DIV>
<DIV>&nbsp;</DIV>
<DIV>2008-08-29 12:41:38 [NOTICE] switch_channel.c:538 switch_channel_set_name() 
New Channel <A 
href="mailto:sofia/nat/sipp@192.168.2.108:5061">sofia/nat/sipp@192.168.2.108:5061</A> 
[2feb67bb-d54b-49ba-a9f2-0d10c0fd5044]<BR>2008-08-29 12:41:38 [INFO] 
mod_dialplan_xml.c:228 dialplan_hunt() Processing sipp-&gt;2006 in context 
public<BR>2008-08-29 12:41:38 [ERR] switch_core_session.c:1034 
switch_core_session_execute_application() Invalid Application jsrun<BR>&nbsp; 
<BR>- and that is a strange error, ÐÒÉ Þ£Í, if to change 
in&nbsp;extension<BR>&lt;action application="jsrun" data="2006.js" 
/&gt;<BR>for:<BR>&lt;action application="javascript" data="2006.js" 
/&gt;<BR>that:</DIV>
<DIV>&nbsp;</DIV>
<DIV>2008-08-29 12:48:16 [NOTICE] switch_channel.c:538 switch_channel_set_name() 
New Channel <A 
href="mailto:sofia/nat/sipp@192.168.2.108:5061">sofia/nat/sipp@192.168.2.108:5061</A> 
[1cc1f4d6-2986-4733-a2bf-84806ff0b681]<BR>2008-08-29 12:48:16 [INFO] 
mod_dialplan_xml.c:228 dialplan_hunt() Processing sipp-&gt;2006 in context 
public<BR>2008-08-29 12:48:16 [NOTICE] mod_spidermonkey.c:2034 session_answer() 
Channel [sofia/nat/sipp@192.168.2.108:5061] has been answered</DIV>
<DIV>&nbsp;</DIV>
<DIV>- then&nbsp;error do not arise: </DIV>
<DIV>&nbsp;</DIV>
<DIV>2008-08-29 12:50:12 [DEBUG] switch_core_state_machine.c:140 
switch_core_standard_on_execute() <A 
href="mailto:sofia/nat/sipp@192.168.2.108:5061">sofia/nat/sipp@192.168.2.108:5061</A> 
Execute javascript(2006.js)<BR>2008-08-29 12:50:12 [DEBUG] 2006.js:1 
console_log() </DIV>
<DIV>*************JavaScript***********</DIV>
<DIV>&nbsp;</DIV>
<DIV>But&nbsp;FreeSWITCH tells:<BR>&gt; help<BR>....<BR>jsrun,jsrun 
&lt;script&gt; [additional_vars [...]],run a 
script</FONT></DIV></FONT></DIV></BODY></HTML>