<!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 some script extensions 
for application  LUA & JS & Perl.<BR>There are some 
questions :</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>1. Seems, that for use LUA there is no 
necessity to install lua-5.1.3.tar.gz from<BR><A 
href="http://www.lua.org/ftp/">http://www.lua.org/ftp/</A>, also that LUA 
environment is built in a kernel of FreeSWITCH. Is it 
correct?</FONT></DIV>
<DIV> </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> </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> </DIV>
<DIV><FONT face=Arial size=2>- 2005.lua<BR>freeswitch.consoleLog( "info", 
"*************LUA************\n" );</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>- 2006.js<BR>console_log( 
"*************JavaScript************\n" 
);<BR>session.answer();<BR>exit();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>also we make in addition:<BR>$ luac 2005.lua -o 
2005.luac</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>and add extensions into 
dialplan:<BR> <BR><extension name="2004"><BR>  <condition 
field="destination_number" expression="^2004$" ><BR>    
<action application="perl" data="2004.pl" /><BR>    
<action application="answer" /><BR>    <action 
application="sleep" data="1000" /><BR>  
</condition><BR></extension><BR>                              
<BR><extension name="2005"><BR>  <condition 
field="destination_number" expression="^2005$" ><BR>    
<action application="lua" data="2005.lua" /><BR>    
<action application="answer" /><BR>    <action 
application="sleep" data="1000" /><BR>  
</condition><BR></extension><BR>                                                                  
<BR><extension name="20051"><BR>  <condition 
field="destination_number" expression="^20051$" ><BR>    
<action application="lua" data="2005.luac" /><BR>    
<action application="answer" /><BR>    <action 
application="sleep" data="1000" /><BR>  
</condition><BR></extension><BR>                                                                                                      
<BR>extension name="2006"><BR>  <condition field="destination_number" 
expression="^2006$" ><BR>    <action application="jsrun" 
data="2006.js" /><BR>    <action application="sleep" 
data="1000" /><BR>  
</condition><BR></extension><BR>                                                                                                                                          
<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> </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->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> <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->2005 in context 
public<BR>2008-08-29 12:35:32 [INFO] switch_cpp.cpp:1050 console_log() </DIV>
<DIV>*************LUA************</DIV>
<DIV> </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->20051 in context 
public<BR>2008-08-29 12:40:10 [INFO] switch_cpp.cpp:1050 console_log() </DIV>
<DIV>*************LUA************</DIV>
<DIV> </DIV>
<DIV>LUA script is fulfilled both in initial and in compiled sort...</DIV>
<DIV> </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->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>  
<BR>- and that is a strange error, ÐÒÉ Þ£Í, if to change 
in extension<BR><action application="jsrun" data="2006.js" 
/><BR>for:<BR><action application="javascript" data="2006.js" 
/><BR>that:</DIV>
<DIV> </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->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> </DIV>
<DIV>- then error do not arise: </DIV>
<DIV> </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> </DIV>
<DIV>But FreeSWITCH tells:<BR>> help<BR>....<BR>jsrun,jsrun 
<script> [additional_vars [...]],run a 
script</FONT></DIV></FONT></DIV></BODY></HTML>