[Freeswitch-users] 'outbound' IVR with JavaScript - garbage collection issues

Anthony Minessale anthmct at yahoo.com
Thu Jan 24 06:15:29 PST 2008


looking at the C code in mod_spidermonkey I can see
that session.originate and session.waitForAnswer/Media
did not suspend the garbage collector.

Most often, when the host system spidermonkey is embedded
in calls something that will block in the C code we
should use special code around it to disable garbage collection.

It's sort of like a mutex only it's backwards where you
want to unlock it while you do anything that blocks
and re-lock it when you resume.


Since these 3 function can delay execution of more
javascript I added code to revision 7343 to do this.

Please test.

Also, even if it works, you can still be more efficient by
doing what Mike suggested and use the new bgapi FSAPI
call together with the originate FSAPI call to originate
the call in the core then execute the script.

bgapi originate {ignore_early_media=true}sofia/default/user at domain.com &javascript(myscript.js)

This will launch your script with the session already created.  If you omit bgapi the xmlrpc call will block until the call is established, if it's present it will run in it's own thread to establish the call and fire and event to indicate the results.





 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org
pstn:213-799-1400


----- Original Message ----
From: "tuhl at ix.netcom.com" <tuhl at ix.netcom.com>
To: freeswitch-users at lists.freeswitch.org
Sent: Wednesday, January 23, 2008 7:55:23 PM
Subject: [Freeswitch-users] 'outbound' IVR with JavaScript - garbage collection issues


My application dials 100's of numbers, waits for user to answer, 
plays a .wav file, and waits for some DTMF. I'm using the Javascript 
interface to do all this now (actually it's a Perl script which 
launches JS by sending jsrun commands through the RPC XML interface). 
But at high call rates, I'm running into JS garbage collection issues 
fairly quickly. At 10 calls per second, after about 300 calls it 
looks like JS GC kicks in and runs for like 45 seconds, during which 
time I can't launch any more calls with JS (RPC XML accepts them, but 
then they are getting Q'd up inside the spidermonkey code, and 
eventually some of them fail because GC is taking so long, etc).

Is JS the best way to do this application, and if so, any ideas how I 
workaround the GC? If not, what is the alternative (where I would 
still have access to the simple programming interface that JS gives 
me, as far as all the session. functions like waitForAnswer, 
streamFile, getDigits).

Tom


===============
tuhl at ix.netcom.com 



_______________________________________________
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






      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20080124/a1a9847a/attachment-0002.html 


More information about the FreeSWITCH-users mailing list