[Freeswitch-users] playing with sessions in lua

Anthony Minessale anthony.minessale at gmail.com
Tue Jan 12 15:35:38 PST 2010


On Tue, Jan 12, 2010 at 3:43 AM, Cavalera Claudio Luigi <
Claudio.Cavalera at italtel.it> wrote:

> Hello,
> this should be simple in theory therefore I'm probably missing the right
> way to do it.
> I want to play with sessions in lua, bridge them, park them, etc...
>
> example1: Consider this simple lua script in which i create two
> sessions:
>
> api = freeswitch.API();
> api:execute("originate", "sofia/internal/1001%192.168.1.1 &park");
> api:execute("originate", "sofia/internal/1002%192.168.1.1 &park");
>
>
capture the output from api:execute the uuid is in there



> now if i want to bridge them i suppose i should use something like
>
> api:execute("uuid_bridge", "uuid_1 uuid_2");
>
> but how do i get uuid_1 and uuid_2, i.e. the uuids of the two sessions?
>
>
> example2: I could create sessions with
>
> local session1 = freeswitch.Session("sofia/internal/1001%192.168.1.1");
> local session2 = freeswitch.Session("sofia/internal/1002%192.168.1.1");
>
> but then there is NOT a bridge API to bridge the sessions like:
> bridge(session1, session2);
>
> I admit I have not yet understood why such bridge possibility exist in
> javascript but does not exist in lua.
> http://wiki.freeswitch.org/wiki/Javascript_Misc_bridge
> I guess there is a reason for this but I can't figure it out.
>
>
>
because lua calls it freeswitch.bridge

session1 = freeswitch.Session("sofia/internal/1001%192.168.1.1");
session2 = freeswitch.Session("sofia/internal/1002%192.168.1.1", session1);
freeswitch.bridge(session1, session2);





> example3: yet another possibility
> local session1 = freeswitch.Session("sofia/internal/1001%192.168.1.1");
> session1:originate(session2, "sofia/internal/1002%192.168.1.1", 1000);
>
> but it does not work either.
>
>
The above is gibberish try:

local session1 = freeswitch.Session("sofia/internal/1001%192.168.1.1");
session1:execute("bridge", "sofia/internal/1002%192.168.1.1");




> Besides with this third example something strange happen:
>
> freeswitch at internal> show channels
> uuid,direction,created,created_epoch,name,state,cid_name,cid_num,ip_addr
> ,dest,application,application_data,dialplan,context,read_codec,read_rate
> ,write_codec,write_rate,secure
> 1c5db2df-14ce-4516-94f2-bb7c087e0802,outbound,2010-01-12
> 10:50:59,1263289859,sofia/internal/1004,CS_REPORTING,FreeSWITCH,00000000
> 00,,1004,,,,default,PCMA,8000,PCMA,8000,
>
> 1 total.
>
> freeswitch at internal> uuid_kill 1c5db2df-14ce-4516-94f2-bb7c087e0802
> -ERR No Such Channel!
>
> freeswitch at internal> show channels
> uuid,direction,created,created_epoch,name,state,cid_name,cid_num,ip_addr
> ,dest,application,application_data,dialplan,context,read_codec,read_rate
> ,write_codec,write_rate,secure
> 1c5db2df-14ce-4516-94f2-bb7c087e0802,outbound,2010-01-12
> 10:50:59,1263289859,sofia/internal/1004,CS_REPORTING,FreeSWITCH,00000000
> 00,,1004,,,,default,PCMA,8000,PCMA,8000,
>
> 1 total.
>
> freeswitch at internal>
>
> If you are interested the full log is here:
> http://pastebin.freeswitch.org/11757
> but I admit i'm not on latest trunk yet!
>
> Thanks.
> Ciao,
> Claudio
>
>
> PS: Is there a reason why there is a uuid_park command but not
> uuid_valet_park ?
>
>
> Internet Email Confidentiality Footer
>
> -----------------------------------------------------------------------------------------------------
> 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.
>
> 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.
>
> -----------------------------------------------------------------------------------------------------
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100112/6c46ba7a/attachment-0002.html 


More information about the FreeSWITCH-users mailing list