Complex phrase macro
I'd like a macro that can play multiple sound files from a specific directory. eg. here's one that should (though I've not tested it!) play 3 sound files: phrase "xplay3:/home/pabx/004-3774/x,001,002,003" <macro name="xplay3"> <input pattern="(.*),(.*),(.*),(.*)"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="$1/$3.wav"/> <action function="play-file" data="$1/$4.wav"/> </match> </input> </macro> What I'd like to do is one that can play an arbitrary number of files.
BTW - Is something like this possible (using recursion): <macro name="xplayN"> <input pattern="(.*),(.*),(.*)"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="phrase:xplayN:$1,$3"/> </match> </input> <input pattern="(.*),(.*)"> <match> <action function="play-file" data="$1/$2.wav"/> </match> </input> </macro> On 29/07/2015 12:42, Alex Lake wrote:
I'd like a macro that can play multiple sound files from a specific directory.
eg. here's one that should (though I've not tested it!) play 3 sound files:
phrase "xplay3:/home/pabx/004-3774/x,001,002,003"
<macro name="xplay3"> <input pattern="(.*),(.*),(.*),(.*)"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="$1/$3.wav"/> <action function="play-file" data="$1/$4.wav"/> </match> </input> </macro>
What I'd like to do is one that can play an arbitrary number of files.
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
OK - Got this working. Just in case anyone is interested: <macro name="xplayN"> <input pattern="^([^,]*),([^,]*),(.*)$"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="phrase:xplayN:$1,$3"/> </match> </input> <input pattern="^([^,]*),([^,]*)$"> <match> <action function="play-file" data="$1/$2.wav"/> </match> </input> </macro> Example of use: <action application="playback" data="phrase:xplayN:/home/pabx/004-3774/x,001,0211,0221,0231"/>
clever! On Wed, Jul 29, 2015 at 3:06 PM, Alex Lake <alex@digitalmail.com> wrote:
OK - Got this working. Just in case anyone is interested:
<macro name="xplayN"> <input pattern="^([^,]*),([^,]*),(.*)$"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="phrase:xplayN:$1,$3"/> </match> </input> <input pattern="^([^,]*),([^,]*)$"> <match> <action function="play-file" data="$1/$2.wav"/> </match> </input> </macro>
Example of use:
<action application="playback" data="phrase:xplayN:/home/pabx/004-3774/x,001,0211,0221,0231"/>
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Sincerely, Giovanni Maruzzelli Cell : +39-347-2665618
Why not just using Lua instead? On Jul 29, 2015 3:08 PM, "Alex Lake" <alex@digitalmail.com> wrote:
OK - Got this working. Just in case anyone is interested:
<macro name="xplayN"> <input pattern="^([^,]*),([^,]*),(.*)$"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="phrase:xplayN:$1,$3"/> </match> </input> <input pattern="^([^,]*),([^,]*)$"> <match> <action function="play-file" data="$1/$2.wav"/> </match> </input> </macro>
Example of use:
<action application="playback" data="phrase:xplayN:/home/pabx/004-3774/x,001,0211,0221,0231"/>
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Or even dialplan. When would this actually add any value over maybe just calling playback multiple times in a row?
On Jul 29, 2015, at 1:02 PM, Stanislav Sinyagin <ssinyagin@gmail.com> wrote:
Why not just using Lua instead? On Jul 29, 2015 3:08 PM, "Alex Lake" <alex@digitalmail.com <mailto:alex@digitalmail.com>> wrote: OK - Got this working. Just in case anyone is interested:
<macro name="xplayN"> <input pattern="^([^,]*),([^,]*),(.*)$"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="phrase:xplayN:$1,$3"/> </match> </input> <input pattern="^([^,]*),([^,]*)$"> <match> <action function="play-file" data="$1/$2.wav"/> </match> </input> </macro>
Example of use:
<action application="playback" data="phrase:xplayN:/home/pabx/004-3774/x,001,0211,0221,0231"/>
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org <mailto:consulting@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@lists.freeswitch.org <mailto:FreeSWITCH-users@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@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
It's because the whole dialplan is templated and I wanted to have one piece of data that could neatly go in. Lua would have been a possibility, I guess, but I quite like the phrase macro system. On 29/07/2015 18:16, Michael Jerris wrote:
Or even dialplan. When would this actually add any value over maybe just calling playback multiple times in a row?
On Jul 29, 2015, at 1:02 PM, Stanislav Sinyagin <ssinyagin@gmail.com <mailto:ssinyagin@gmail.com>> wrote:
Why not just using Lua instead?
On Jul 29, 2015 3:08 PM, "Alex Lake" <alex@digitalmail.com <mailto:alex@digitalmail.com>> wrote:
OK - Got this working. Just in case anyone is interested:
<macro name="xplayN"> <input pattern="^([^,]*),([^,]*),(.*)$"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="phrase:xplayN:$1,$3"/> </match> </input> <input pattern="^([^,]*),([^,]*)$"> <match> <action function="play-file" data="$1/$2.wav"/> </match> </input> </macro>
Example of use:
<action application="playback" data="phrase:xplayN:/home/pabx/004-3774/x,001,0211,0221,0231"/>
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org <mailto:consulting@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@lists.freeswitch.org <mailto: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 <http://www.freeswitch.org/>
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org <mailto:consulting@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@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
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.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
I like LUA for this. I have a LUA that builds long sentences that even include music in different places. The LUA builds the sound string from multiple files dynamically and even adjusts the length of various sections (like music) so the message is a fairly consistent length even though the parts are different. Yes, LUA is more work up front but then you can do much more and use the logic for multiple sound purposes. Mario
On Jul 31, 2015, at 3:03 AM, Alex Lake <alex@digitalmail.com> wrote:
It's because the whole dialplan is templated and I wanted to have one piece of data that could neatly go in. Lua would have been a possibility, I guess, but I quite like the phrase macro system.
On 29/07/2015 18:16, Michael Jerris wrote:
Or even dialplan. When would this actually add any value over maybe just calling playback multiple times in a row?
On Jul 29, 2015, at 1:02 PM, Stanislav Sinyagin <ssinyagin@gmail.com <mailto:ssinyagin@gmail.com>> wrote:
Why not just using Lua instead? On Jul 29, 2015 3:08 PM, "Alex Lake" <alex@digitalmail.com <mailto:alex@digitalmail.com>> wrote: OK - Got this working. Just in case anyone is interested:
<macro name="xplayN"> <input pattern="^([^,]*),([^,]*),(.*)$"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="phrase:xplayN:$1,$3"/> </match> </input> <input pattern="^([^,]*),([^,]*)$"> <match> <action function="play-file" data="$1/$2.wav"/> </match> </input> </macro>
Example of use:
<action application="playback" data="phrase:xplayN:/home/pabx/004-3774/x,001,0211,0221,0231"/>
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org <mailto:consulting@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@lists.freeswitch.org <mailto:FreeSWITCH-users@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@freeswitch.org <mailto:consulting@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@lists.freeswitch.org <mailto:FreeSWITCH-users@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@freeswitch.org <mailto:consulting@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@lists.freeswitch.org <mailto:FreeSWITCH-users@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@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Agreed. I tend to be using Lua wherever I can these days. If I were doing it again from scratch, that's what I'd use. Dialplan still the king for managing multithreads (and it seems to do this by magic as far as I can tell) but Lua is so much more readable for an old dinosaur like me. On 31/07/2015 18:32, Mario wrote:
I like LUA for this. I have a LUA that builds long sentences that even include music in different places. The LUA builds the sound string from multiple files dynamically and even adjusts the length of various sections (like music) so the message is a fairly consistent length even though the parts are different. Yes, LUA is more work up front but then you can do much more and use the logic for multiple sound purposes. Mario
On Jul 31, 2015, at 3:03 AM, Alex Lake <alex@digitalmail.com <mailto:alex@digitalmail.com>> wrote:
It's because the whole dialplan is templated and I wanted to have one piece of data that could neatly go in. Lua would have been a possibility, I guess, but I quite like the phrase macro system.
On 29/07/2015 18:16, Michael Jerris wrote:
Or even dialplan. When would this actually add any value over maybe just calling playback multiple times in a row?
On Jul 29, 2015, at 1:02 PM, Stanislav Sinyagin <ssinyagin@gmail.com <mailto:ssinyagin@gmail.com>> wrote:
Why not just using Lua instead?
On Jul 29, 2015 3:08 PM, "Alex Lake" <alex@digitalmail.com <mailto:alex@digitalmail.com>> wrote:
OK - Got this working. Just in case anyone is interested:
<macro name="xplayN"> <input pattern="^([^,]*),([^,]*),(.*)$"> <match> <action function="play-file" data="$1/$2.wav"/> <action function="play-file" data="phrase:xplayN:$1,$3"/> </match> </input> <input pattern="^([^,]*),([^,]*)$"> <match> <action function="play-file" data="$1/$2.wav"/> </match> </input> </macro>
Example of use:
<action application="playback" data="phrase:xplayN:/home/pabx/004-3774/x,001,0211,0221,0231"/>
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org <mailto:consulting@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@lists.freeswitch.org <mailto: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 <http://www.freeswitch.org/>
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org <mailto:consulting@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@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
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.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 <mailto:consulting@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@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
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.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
participants (5)
-
Alex Lake
-
Giovanni Maruzzelli
-
Mario
-
Michael Jerris
-
Stanislav Sinyagin