Dude, look very hard at your code. All the API commands you are using are Async. You start the file playing, and right away you stop it, and then hangup the channel "sesison.hangup()".
 
Why are you stopping the displace right away. If you want the whole thing to keep going, till it's done, then don't stop it, and don't hangup the channel. Maybe you should change the "session.hangup" to "session.execute("park")?
 
--Dave


From: Khue Nguyen Minh [mailto:khuenm@vega.com.vn]
To: FreeSWITCH Users Help [mailto:freeswitch-users@lists.freeswitch.org]
Sent: Tue, 30 Oct 2012 05:46:33 -0700
Subject: Re: [Freeswitch-users] How to mix audio in FreeSWITCH

Hi Michael,

I create a js script as follow:
session.answer()
while (session.ready())
{
apiExecute("uuid_displace", session.uuid + " start /opt/freeswitch/sounds/welcome.wav 60 mux");
apiExecute("uuid_displae", session.uuid + " stop /opt/freeswitch/sounds/welcome.wav");
session.hangup()
}
When I make a new call, script run normal but I do not see anything (the call hangup immediately) and I don't know How I can save "mux audio" to new file? Please guide me.

Brs,
Khue

2012/10/30 Michael Collins <msc@freeswitch.org>
You might also try uuid_displace API with the "mux" option, although I kind of like the idea of getting a group of uninhibited users all in a conference room singing "Love Shack" by the B52's.
-MC


On Sun, Oct 28, 2012 at 10:45 PM, SamyGo <govoiper@gmail.com> wrote:
Hi,

You should try using "sox" if there is nothing you've found in freeswitch. Execute a system sox command and input the two recordings. Later the mixed audio can be played back to user.
 
Another approach can be to use a conference bridge in which a local channel and the incoming caller are bridged and the conference is recorded. The recorded conference can be played back or used as well.

BR
Sammy


On Mon, Oct 29, 2012 at 8:46 AM, Khue Nguyen Minh <khuenm@vega.com.vn> wrote:
Hi all,

I want create a js scripts to execute a simple karaoke application. When user make call to my system, js scripts will play a audio file and user can sing. The js scripts will record the song and mix it with audio that is playing. Now, I can create a js to play audio, record call but I don't know how I can mix audio. Please help me.

Thanks & Best regards,
Khue.

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




--
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org