Misc. Dialplan Tools playback

From FreeSWITCH Wiki
Jump to: navigation, search

Plays a sound file on the current channel.

Contents

Example

<!--default terminator is *. Keyword 'none' disables on-key termination /-->
<action application="set" data="playback_terminators=none"/> 
<action application="playback" data="sounds/soundfile.wav"/>

The terminator used is available in channel variable "playback_terminator_used"

You can also append @@<samples> to the file name to specify a playback start position.

<action application="playback" data="/tmp/test.wav@@8000"/>

Example for specific playback variables

<action application="playback" data="{var1=val1,var2=val2}sounds/soundfile.wav"/>

The prefix "{var1=val1,var2=val2}" adds specific vars that will be sent in PLAYBACK_START and PLAYBACK_STOP events, this is expecially handy when build ESL applications. In the events the variables will be named the same way as the variable names you configured, for instance "var1" and "var2".

Please note that versions older the commit below, the prefix was instead a suffix set after the filename. So if you experience problems on later versions that you didn't see before, you must upgrade you application to reflect these changes. The events also used to prefix the variable names with "playback_variable_", this is not done anymore.

commit 042347802b2b4972a11212df0c84921b91b71d64
Author: Anthony Minessale <anthm@freeswitch.org>
Date:   Wed Feb 20 16:34:13 2013 -0600

Playback from remote server

<action application="playback" data="http://example.com/media/hello_world.wav"/>

Supported File Types

FreeSWITCH has an abstraction layer for file formats. Anyone can write a format module which allows file formats to be utilized from any of the places that would deal with them.

Most formats support both reading and writing, the ones that do not are identified below.

mod_sndfile

mod_sndfile libsndfile and therefore supports any format usable by libsndfile. As of libsndfile-1.0.17, the supported formats are:

  • AIFF (Apple/SGI) (extension "aiff")
  • AU (Sun/NeXT) (extension "au")
  • AVR (Audio Visual Research) (extension "avr")
  • CAF (Apple Core Audio File) (extension "caf")
  • HTK (HMM Tool Kit) (extension "htk")
  • IFF (Amiga IFF/SVX8/SV16) (extension "iff")
  • MAT4 (GNU Octave 2.0 / Matlab 4.2) (extension "mat")
  • MAT5 (GNU Octave 2.1 / Matlab 5.0) (extension "mat")
  • PAF (Ensoniq PARIS) (extension "paf")
  • PVF (Portable Voice Format) (extension "pvf")
  • RAW (header-less) (extension "raw" or "r8" )
  • SD2 (Sound Designer II) (extension "sd2")
  • SDS (Midi Sample Dump Standard) (extension "sds")
  • SF (Berkeley/IRCAM/CARL) (extension "sf")
  • VOC (Creative Labs) (extension "voc")
  • W64 (SoundFoundry WAVE 64) (extension "w64")
  • WAV (Microsoft) (extension "wav")
  • WAV (NIST Sphere) (extension "wav")
  • WAVEX (Microsoft) (extension "wav")
  • XI (FastTracker 2) (extension "xi")

mod_shout

Additionally, mod_shout supplies MP3 support for files and shoutcast streams

See Also