Discussion:
[Freeswitch-users] Playing multiple files in lua script
John Nash
2015-05-18 21:22:54 UTC
Permalink
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?
Abaci B
2015-05-18 21:37:04 UTC
Permalink
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")
Post by John Nash
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?
_________________________________________________________________________
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
John Nash
2015-05-18 22:13:29 UTC
Permalink
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?
Post by Abaci B
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")
Post by John Nash
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?
_________________________________________________________________________
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.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
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Abaci B
2015-05-18 23:15:56 UTC
Permalink
This post might be inappropriate. Click to display it.
Mario
2015-05-19 18:32:21 UTC
Permalink
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
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
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?
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")
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?
_________________________________________________________________________
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
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/>
_________________________________________________________________________
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
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/>
_________________________________________________________________________
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
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/>
_________________________________________________________________________
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Loading...