[Freeswitch-users] Playing multiple files in lua script

Mario mario_fs at mgtech.com
Tue May 19 22:32:21 MSD 2015


Here is how I construct a LUA variable to play multiple files in a ringback, syntax would be the same for your application. This is a complex one since it not only plays different files but sets a time limit for each:

   ringback = "file_string://"..em1.."!{timeout="..moh1_timeout.."}local_stream://mohmv!file_string://"..em2.."!local_stream://mohmv”

Also see https://wiki.freeswitch.org/wiki/Mod_local_stream <https://wiki.freeswitch.org/wiki/Mod_local_stream>, I added the timeout stuff at the bottom which shows syntax for a file.
Hope this helps a little
Mario G



> On May 18, 2015, at 4:15 PM, Abaci B <abaci64 at gmail.com> wrote:
> 
> no idea about timer=soft issues on centos, I switched from centos to debian when the core devs switch as I like to be on the platform best supported.
> as far as usig streamFile over playback it gives you more control if you need handling of DTMF (or speech recognition) and iirc using playback will give you more logs
> 
> On Mon, May 18, 2015 at 6:13 PM, John Nash <john.nash778 at gmail.com <mailto:john.nash778 at gmail.com>> wrote:
> Actually streamfile and playing using "!" (file_string") also had same issue. But this is solved when I used rtp-timer-name = soft . before I was using rtp-timer-name = none. I read in some posts that timer = soft causes performance issues in centos 6. Do you have any idea about this?
> 
> also is Session:streamfile different from session:playback in some way?...which should be preferred? 
> 
> 
> 
> 
> On Tue, May 19, 2015 at 3:07 AM, Abaci B <abaci64 at gmail.com <mailto:abaci64 at gmail.com>> wrote:
> is there anything in the logs when this happens?
> any reason not to play the files using file-string:///path/to/file1!/path/to/file2!/path/to/file3 ? not sure if it would mke a difference but you could try.
> did you also try if you see the same behavior when doing session:streamFile("/path/to/file1") instead of session:execute("playback", "/path/to/file1")
> 
> 
> On Mon, May 18, 2015 at 5:22 PM, John Nash <john.nash778 at gmail.com <mailto:john.nash778 at gmail.com>> wrote:
> I am trying to play some native files (Preencoded) in lua script and calling the lua script in dialpan like below..
> 
> session:execute("playback", <path to file1>);
> session:execute("playback", <path to file2>);
> session:execute("playback", <path to file3>);
> 
> When I make call I hear file1 clearly but after that for approx 10-15 seconds I do not hear anything (except some occasional noise like breaking voice) 
> 
> I tried commenting file1 (to check if file1 is corrupt or something) but then I hear file2 clearly and not file 3 for 10-15 seconds. I also tried session:sleep(100) between playbacks but issues remains same.
> 
> Am I doing something wrong?
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
> http://www.freeswitchsolutions.com <http://www.freeswitchsolutions.com/>
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org <http://www.freeswitch.org/>
> http://confluence.freeswitch.org <http://confluence.freeswitch.org/>
> http://www.cluecon.com <http://www.cluecon.com/>
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
> http://www.freeswitch.org <http://www.freeswitch.org/>
> 
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
> http://www.freeswitchsolutions.com <http://www.freeswitchsolutions.com/>
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org <http://www.freeswitch.org/>
> http://confluence.freeswitch.org <http://confluence.freeswitch.org/>
> http://www.cluecon.com <http://www.cluecon.com/>
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
> http://www.freeswitch.org <http://www.freeswitch.org/>
> 
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
> http://www.freeswitchsolutions.com <http://www.freeswitchsolutions.com/>
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org <http://www.freeswitch.org/>
> http://confluence.freeswitch.org <http://confluence.freeswitch.org/>
> http://www.cluecon.com <http://www.cluecon.com/>
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org <mailto:FreeSWITCH-users at lists.freeswitch.org>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users>
> http://www.freeswitch.org <http://www.freeswitch.org/>
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services: 
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150519/53ced856/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list