[Freeswitch-users] Question about javascript

Michael Jerris mike at jerris.com
Sun Jan 31 21:58:21 PST 2010


You can see if you have a memory leak by running in valgrind.  In the mean time, why would you do this in a lua script, all of this is easier and more clear to do right in dialplan.
also, your running ring ready, then answering, then setting ringback?  it seems like you have everything mixed up here.

This probably should just be a 5 line dialplan.  
set ringback
set continue on fail true
set hangup after bridge true
bridge (with api on answer)
playback test02.wav

Mike

On Jan 26, 2010, at 10:35 PM, Tomoya Matsubara wrote:

> Hello,
> 
> When the following scripts were tested, it seems to do the memory leak. 
> Please teach when there is a problem in this script. 
> 
> -- test script --
> session.execute("ring_ready");
> session.answer();
> session.setVariable("ringback", "%(1000, 2000, 440, 460)");
> 
> var bleg = new Session();
> var sound_wav = "sounds/test01.wav";
> var sound_leg = "both";
> var op = "api_on_answer=uuid_broadcast "+session.uuid+" "+sound_wav+" "+sound_leg;
> var ret = bleg.originate(session, "{"+op+"}" + "sofia/gateway/profile0_gateway1/1000");
> if(!session.ready()){
>  return;
> }
> 
> if(!ret){ // bleg not answered.
>  var sound_wav = "sounds/test02.wav";
>  session.streamFile(sound_wav);
>  if(session.ready()){
>    session.hangup();
>  }
>  return;
> }
> 
> if(bleg.ready()){
>  bridge(session, bleg);
> }
> 
> _______________________________________________
> 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





More information about the FreeSWITCH-users mailing list