[Freeswitch-users] dialplan commands on playback

Michael Collins msc at freeswitch.org
Tue Jul 24 02:55:52 MSD 2012


Well, if you have soxi installed (Linux, of course) then you could always
use a system call to grab the file length. For kicks I whipped up a proof
of concept dial plan to demonstrate how it could work. If anyone finds it
useful please let me know and I'll wikify it.
-MC

  <extension name="soxi sound file length">
    <condition field="destination_number" expression="^(9904)$">
      <action application="answer"/>
      <action application="sleep" data="500"/>
      <action application="set"

data="sound_file=${sounds_dir}/music/8000/danza-espanola-op-37-h-142-xii-arabesca.wav"/>
      <action application="set"
              data="file_length=${system soxi -D ${sound_file} | tr -d
'\\n' }"/>
      <action application="log" data="INFO Sound file length is
'${file_length}'"/>
      <action application="set"
data="file_length=${expr(ceil(${file_length}))}"/>
      <action application="log" data="INFO Sound file length is
'${file_length}'"/>
      <action application="say" data="en number pronounced ${file_length}"/>
      <action application="playback" data="time/seconds.wav"/>
    </condition>
  </extension>


On Mon, Jul 23, 2012 at 9:09 AM, Alexandre Fiori <fiorix at gmail.com> wrote:

>
> that's the problem, I don't know the length, but playback does :)
>
> thanks anyway
>
> On 2012-07-23, at 11:53 AM, Michael Collins <msc at freeswitch.org> wrote:
>
> If you know the length of the file then you could use sched_api to
> schedule something. For example, if you know that your file is 12 seconds
> long you could do something like this:
>
> sched_api +9 none uuid_broadcast <uuid> <app>::<args> bleg
>
> Check out both of these on the wiki - there's a lot that these can do.
> -MC
>
> http://wiki.freeswitch.org/wiki/Mod_commands#uuid_broadcast
> http://wiki.freeswitch.org/wiki/Mod_commands#sched_api
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> Join Us At ClueCon - Aug 7-9, 2012
>
> 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
>
>
>
> - af
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> Join Us At ClueCon - Aug 7-9, 2012
>
> 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
>
>


-- 
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120723/7e78ecca/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list