[Freeswitch-users] playing with sessions in lua

Cavalera Claudio Luigi Claudio.Cavalera at italtel.it
Tue Jan 12 01:43:34 PST 2010


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");

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.


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.

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. 
-----------------------------------------------------------------------------------------------------





More information about the FreeSWITCH-users mailing list