Asterisk Jukebox

August 15, 2006

Author: jart — Originally Posted 1445 Days Ago Article Tags « asterisk c »

Asterisk Jukebox is an IVR application written for Asterisk, an open source PBX program. Asterisk Jukebox allows a caller to browse your music collection. All you have to do is tell Jukebox where your music is and callers will be able to browse the collection. For example a caller might hear: "Press 1 for Sisters Of Mercy", (Caller presses 1), "Press 1 for Marian, Press 2 for This Corrosion, etc." But that's not all! You can also tell the Jukebox to automatically pick random songs to play.

At the moment, the jukebox supports all the standard Asterisk formats such as GSM and μ-Law. There is also MP3 support if you have CPU to spare and mpg123 installed via app_mp3. You must also have Festival installed on your system so the Jukebox can generate text to speech.

This version of Jukebox is a rewrite of the old version written in Perl. This version is written in C, is more stable, and has more features.

Download

[zip] jukebox-0.9.1.tar.gz (59KB)
[zip] jukebox-0.9.tar.gz (31KB)
[txt] ChangeLog (811B)

To Do

This program isn't finished yet! Here's what's missing:

  • YOUR TESTING
  • Greeting prompt
  • Instructions prompt
  • 'Percent' prompt
  • 'Nothing matches' prompt

Usage Instructions

Press '*' to go up a directory. If you are in the root music folder you will be exited from the script unless the 't' option is set.

If you have a really long list of files, you can filter the list at any time by pressing '#' and spelling out a few letters you expect the files to start with. For example, if you wanted to know what extension 'Requiem For A Dream' was, you'd type: '#737'. Note: Phone keypads don't include Q and Z. Q is 7 and Z is 9. Star may be used as a character wildcard. To clear your filter after it's been applied, just press '#'.

Also remember that you may terminate any digit input by pressing the pound key. This helps to avoid the 5 second timeout.

Examples

exten => 666,1,Jukebox(default|gi)      ; Normal invokation
exten => 666,1,Jukebox(default|rn)      ; Just play random songs
exten => 666,1,Jukebox(/home/musak|rh)  ; Play one random song and hangup
exten => 666,1,Jukebox(default|R(6))    ; Recache all the TTS

** Note: 'default' points to /var/lib/asterisk/music

Documentation

  -= Info about application 'Jukebox' =-

[Synopsis]
IVR app to browse a hierarchy of music files

[Description]
JUKEBOX([dir[|options]])

Description:
  This jukebox application allows a caller to browse your music
  collection.  Essentially what happens here is you point this
  application in the direction of a folder containing a bunch of
  music.  The caller will be read off the files and folders using
  text2wave, which is provided by Festival.

  At the moment, the jukebox supports all the standard Asterisk
  formats such as GSM and uLaw.  There is also MP3 support if
  you have CPU to spare and mpg123 installed via app_mp3.

Usage Instructions:
  Press '*' to go up a directory.  If you are in the root music
  folder you will be exited from the script.

  If you have a really long list of files, you can filter the list
  at any time by pressing '#' and spelling out a few letters you
  expect the files to start with.  For example, if you wanted to
  know what extension 'Requiem For A Dream' was, you'd type:
  '#737'.  Note: Phone keypads don't include Q and Z.  Q is 7 and
  Z is 9.  Star may be used as a character wildcard.  To clear
  your filter after it's been applied, just press '#'.

  Also remember that you may terminate any digit input by pressing
  the pound key.  This helps to avoid the 5 second timeout.

Options:
  R(x) -- Re-cache all text to speech files using `x' number of
          threads
  F(x) -- Changes volume scale factor; see MP3Player2() for info.
          TIP: F(4096) makes mp3 files play quieter
  h -- Hangup after playing song
  g -- Play the greeting message
  i -- Play the instructions
  r -- Start with random song
  t -- Play random song on timeout
  n -- No IVR.  Must specify with 'r'

Returns:
  The JUKEBOX() application always returns 0 unless it has trouble
  parsing the arguments you pass it.  Upon completion, a JUKESTATUS
  variable is set to one of the following values:

   - HANGUP (User hungup or error occurred)
   - TIMEOUT (User didn't enter anything at a prompt)
   - MOVEUP (User hit '*' at base directory)
   - OK (Should only return if you specify 'n' w/o 'r')

Examples:
    exten => 666,1,Jukebox(default|gi)   ; Normal invokation
    exten => 666,1,Jukebox(default|rn)   ; Just play random songs
    exten => 666,1,Jukebox(default|rh)   ; Play one song and hangup
    exten => 666,1,Jukebox(default|R(6)) ; Recache all the TTS

Advanced Configuration:

  /etc/asterisk/jukebox.conf ** OPTIONAL **

  [jukebox]
  cachedir=/var/cache/jukebox
  text2wave=text2wave                      ; and optional switches
  defaultmusicdir=/var/lib/asterisk/music

Legal

Asterisk Jukebox
Copyright (c) 2006 Lobstertech Inc.
Keep it Open Source Pigs

The programs found on this page are free software and may be used, distributed, and modified under the terms of the GNU General Public License version 2.0.

These patches are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Comments

No comments found.

Post Comment