execute("api", "args")<div>executeString("api args")</div><div><br></div><div>one needs the api name as a separate arg<br><br><div class="gmail_quote">On Wed, Jan 13, 2010 at 9:51 AM, Cavalera Claudio Luigi <span dir="ltr"><<a href="mailto:Claudio.Cavalera@italtel.it">Claudio.Cavalera@italtel.it</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Also after</font></span><span><font face="Arial" color="#0000ff" size="2"></font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">api = freeswitch.API();</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">what is the difference between</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">api:execute()</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">and</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">api:executeString() ?</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">I've found example of both uses in <a href="http://wiki.freeswitch.org/wiki/Mod_lua" target="_blank">http://wiki.freeswitch.org/wiki/Mod_lua</a></font></span></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><font color="#0000ff"><span>and in </span></font></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><font color="#0000ff"><span><a href="http://wiki.freeswitch.org/wiki/Make_API_calls_directly_from_Lua_code" target="_blank">http://wiki.freeswitch.org/wiki/Make_API_calls_directly_from_Lua_code</a></span></font></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><font color="#0000ff"><span></span><span></span></font></font></font> </div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Thanks,</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Claudio</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span> </div><br>
<blockquote dir="ltr" style="padding-left:5px;margin-left:5px;border-left:#0000ff 2px solid;margin-right:0px">
<div lang="en-us" dir="ltr" align="left">
<hr>
<font face="Tahoma" size="2"><b>From:</b>
<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>
[mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of
</b>Cavalera Claudio Luigi<br><b>Sent:</b> Wednesday, January 13, 2010 11:22
AM<div class="im"><br><b>To:</b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br></div><b>Subject:</b> Re:
[Freeswitch-users] playing with sessions in lua<br></font><br></div><div><div></div><div class="h5">
<div></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Thanks a lot Anthony,</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">some comments inline (and please forgive me for my broken
email client).</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span> </div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><span>>> </span>example1: Consider this simple
lua script in which i create two<span><font color="#0000ff"> </font></span>sessions:<br><br><span><font color="#0000ff"> <font color="#000000">>> </font> </font></span>api =
freeswitch.API();<br><span><font color="#0000ff"> <font color="#000000">>>
</font> </font></span>api:execute("originate",
"sofia/internal/1001%192.168.1.1 &park");<br><span><font color="#0000ff"> <font color="#000000">>> </font> </font></span>api:execute("originate",
"sofia/internal/1002%192.168.1.1 &park");<br><br><span><font color="#0000ff"> <font color="#000000">>
</font> </font></span>capture the output from api:execute the uuid is in
there<br><br><span><font color="#0000ff">Thx a
lot,</font></span></font></font></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">this was one piece i was missing although it's
already on the wiki here:</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"><a href="http://wiki.freeswitch.org/wiki/Mod_lua#For_making_API_calls" target="_blank">http://wiki.freeswitch.org/wiki/Mod_lua#For_making_API_calls</a></font></span><span><font face="Arial" size="2"> </font></span></div>
<font color="#0000ff"></font><font color="#0000ff"></font>
<div dir="ltr" align="left"><br><br><font face="Arial"><font size="2"><span><font color="#0000ff"><font color="#000000"> ></font> </font></span>because lua calls it
freeswitch.bridge<br><br><span><font color="#0000ff"> <font color="#000000">></font> </font></span>session1 =
freeswitch.Session("sofia/internal/1001%192.168.1.1");<br><span><font color="#0000ff"> <font color="#000000">></font> </font></span>session2 =
freeswitch.Session("sofia/internal/1002%192.168.1.1", session1);<br><span><font color="#0000ff"> <font color="#000000">></font> </font></span>freeswitch.bridge(session1,
session2);<span><font color="#0000ff"> </font></span></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><span></span></font></font> </div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><span><font color="#0000ff">good to now, there isn't
any example of freeswitch.bridge in the wiki and i would like to add
one.</font></span></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><span><font color="#0000ff">Where I could find the full api
of</font></span></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><span><font color="#0000ff">freeswitch.Session( )
?</font></span></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><span><font color="#0000ff">because I've seen this
working also without "session1" in the second
line:</font></span></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><span><font color="#0000ff">session1 =
freeswitch.Session("sofia/internal/1001%192.168.1.1");<br>session2 =
freeswitch.Session("sofia/internal/1002%192.168.1.1");<br>freeswitch.bridge(session1,
session2);<span> </span></font></span><br><br><span><font color="#0000ff"> also is there any
difference between freeswitch.bridge
and freeswitch.execute(uuid_bridge ...)
?</font></span><br></font></font><font face="Arial"><font size="2"><span><font color="#0000ff"> </font></span></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><span> >> </span>example3: yet another
possibility<br><span> >> </span>local
session1 = freeswitch.Session("sofia/internal/1001%192.168.1.1");<br><span> >> </span>session1:originate(session2,
"sofia/internal/1002%192.168.1.1", 1000);<br><span> >> </span>but it does not work
either.<br><br></font></font><font face="Arial"><font size="2"><span><font color="#0000ff"> <font color="#000000">></font> </font></span>The above is gibberish
try:<br><span><font color="#0000ff"> <font color="#000000">></font> </font></span>local session1 =
freeswitch.Session("sofia/internal/1001%192.168.1.1");<br><span><font color="#0000ff"> <font color="#000000">></font> </font></span>session1:execute("bridge",
"sofia/internal/1002%192.168.1.1");<span><font color="#0000ff"> </font></span></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font size="2"><span></span></font></font><font face="Arial"><font size="2"><span></span></font></font> </div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff" size="2"><span>Okay i will report also this bridge example on the
wiki which was missing.</span></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff" size="2"><span>But does session:originate make sense in some cases
or not? Otherwise i'm going to remove this line on the
wiki</span></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff" size="2"><span> </span></font><a href="http://wiki.freeswitch.org/wiki/Mod_lua#session:originate" target="_blank"><font size="2">http://wiki.freeswitch.org/wiki/Mod_lua#session:originate</font></a></font></div>
<div dir="ltr" align="left"><font face="Arial" color="#0000ff" size="2"></font> </div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Thanks,</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Claudio</font></span></div>
<p style="margin-top:0px;margin-bottom:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px"><font style="font-size:8pt" face="Courier New"><span lang="EN-GB">Internet Email Confidentiality
Footer</span></font></p>
<p style="margin-top:0px;margin-bottom:0px"><font style="font-size:8pt" face="Courier New">********************************************************************************************************************************************</font></p>
<p style="margin-top:0px;margin-bottom:0px"><font style="font-size:8pt" face="Courier New">La presente comunicazione, con le informazioni in essa
contenute e ogni documento o file allegato, e' rivolta unicamente alla/e
persona/e cui e' indirizzata ed alle altre da questa autorizzata/e a
riceverla. Se non siete i destinatari/autorizzati siete avvisati che qualsiasi
azione, copia, comunicazione, divulgazione o simili basate sul contenuto di
tali informazioni e' vietata e potrebbe essere contro la legge (art. 616 C.P.,
D.Lgs n. 196/2003 Codice in materia di protezione dei dati personali). Se
avete ricevuto questa comunicazione per errore, vi preghiamo di darne
immediata notizia al mittente e di distruggere il messaggio originale e ogni
file allegato senza farne copia alcuna o riprodurne in alcun modo il
contenuto. <br><br>This e-mail and its attachments are intended for the
addressee(s) only and are confidential and/or may contain legally privileged
information. If you have received this message by mistake or are not one of
the addressees above, you may take no action based on it, and you may not copy
or show it to anyone; please reply to this e-mail and point out the error
which has occurred.
<br>********************************************************************************************************************************************</font></p></div></div></blockquote></div>
<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" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-Rupa<br>
</div>