end of repo
parent
4fe5c04855
commit
f61176d0b1
@ -1,57 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#ajw v1.02 - jukebox for asterisk wizard
|
|
||||||
#Jay Moore/NQ4T - https://git.pickmy.org/dewdude/ajw
|
|
||||||
#Twitter: @Music_OnHold
|
|
||||||
#Licensed under GPL-3.0-or-later
|
|
||||||
|
|
||||||
# Works like this:
|
|
||||||
# Put all your albums in your Asterisk sounds directory: /jukebox root/album/track#.ulaw
|
|
||||||
# Run script, enter prompts.
|
|
||||||
# Copy .conf, include in extensions.conf, assign extension.
|
|
||||||
|
|
||||||
setup() {
|
|
||||||
printf "[$name-main]\nexten = s,1,Answer()\nsame =n,Set(VOLUME(TX)=$vol)\nsame = n,Set(c=$name-main)\nsame = n(return),Set(m=1)\nsame = n(loop),Background($rootfolder/$introfile)\n"
|
|
||||||
[ "$delay" -ne 0 ] printf "same = n,WaitExten($delay)\n"
|
|
||||||
printf "same = n,Set(m=\$[\${m} + 1])\nsame = n,GoToIf(\$[\"\${m}\" > \"$loop\"]?loop)\nsame = n(goodbye),Background($rootfolder/$goodbye)\nsame = n,Hangup()\n\n"
|
|
||||||
} >> $name-juke.conf
|
|
||||||
|
|
||||||
album() {
|
|
||||||
printf "exten = _%02dXX,1,Set(aa=$rootfolder/$folder)\n" $a
|
|
||||||
[ "$lz" -eq 0 ] && printf "same = n,GoToIf(\$[\"\${EXTEN:-2}\" = \"00\"]?8track-player,#$tc,1)\n" || printf "same = n,GoToIf(\$[\"\${EXTEN:-2}\" = \"00\"]?8track-player,*$tc,1)\n"
|
|
||||||
[ "$lz" -eq 0 ] && printf "same = n,GoToIf(\$[\"\${EXTEN:-2}\" < \"10\"]?cart-player,#\${EXTEN:-1},1)\n"
|
|
||||||
printf "same = n,GoTo(cart-player,*\${EXTEN:-2},1)\n\n"
|
|
||||||
} >> $name-juke.conf
|
|
||||||
|
|
||||||
printf "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n |a|j|w| - asterisk jukebox wizard\n version 1.02 - Jay Moore/NQ4T\n https://git.pickmy.org/dewdude/jaw\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n\n\n"
|
|
||||||
printf "Pick a name/identifier for this jukebox: "
|
|
||||||
read name
|
|
||||||
printf "\nEnter the root folder name of your jukebox: "
|
|
||||||
read rootfolder
|
|
||||||
printf "\nEnter the filename of your menu/intro: "
|
|
||||||
read introfile
|
|
||||||
printf "\nHow many times do you want it to play? "
|
|
||||||
read loop
|
|
||||||
printf "\nHow many seconds between intro play? (Enter 0 for no delay)"
|
|
||||||
read delay
|
|
||||||
printf "\nEnter the filename of your exit file: "
|
|
||||||
read goodbye
|
|
||||||
printf "\nEnter a channel volume (I recommend -3): "
|
|
||||||
read vol
|
|
||||||
printf "\nWriting Basic Configuration.\n\nAuto-Generating Albums\n\n"
|
|
||||||
setup;
|
|
||||||
asd=/var/lib/asterisk/sounds/en/astjuke
|
|
||||||
dir=$(ls $asd/$rootfolder -l | awk '/^d/ {print $9}')
|
|
||||||
a=0
|
|
||||||
for folder in $dir
|
|
||||||
do
|
|
||||||
tracks=$(ls $asd/$rootfolder/$folder -l | grep "ulaw" | wc -l)
|
|
||||||
tracks=$((tracks + 1))
|
|
||||||
tc=$(printf "%02d" $tracks)
|
|
||||||
ld=$(ls $asd/$rootfolder/$folder -l | grep "ulaw" | awk '{print $9}' | awk '/^0/')
|
|
||||||
[ -z "$ld" ] && lz=0 || lz=1
|
|
||||||
album;
|
|
||||||
a=$((a + 1))
|
|
||||||
done
|
|
||||||
|
|
||||||
printf "\n\nDone.\n\n\nYour jukebox is located at $name-juke.conf.\n"
|
|
||||||
printf "Make sure to include it and the player conf in your dial plan somewhere.\n\n\n\n"
|
|
@ -1,23 +0,0 @@
|
|||||||
[examplejuke-main]
|
|
||||||
exten = s,1,Answer()
|
|
||||||
same =n,Set(VOLUME(TX)=-3)
|
|
||||||
same = n,Set(c=examplejuke-main)
|
|
||||||
same = n(loop),Background(foobar/menu)
|
|
||||||
same = n,WaitExten(5)
|
|
||||||
same = n,Set(m=$[${m} + 1])
|
|
||||||
same = n,GoToIf($["${m}" < "5"]?loop)
|
|
||||||
same = n,Background(foobar/bye)
|
|
||||||
same = n,Hangup()
|
|
||||||
|
|
||||||
exten = _00XX,1,Set(aa=foobar/00album)
|
|
||||||
same = n,GoToIf($["${EXTEN:-2}" = "00"]?8track-player,*11,1)
|
|
||||||
same = n,GoTo(cart-player,*${EXTEN:-2},1)
|
|
||||||
|
|
||||||
exten = _01XX,1,Set(aa=foobar/01album)
|
|
||||||
same = n,GoToIf($["${EXTEN:-2}" = "00"]?8track-player,*15,1)
|
|
||||||
same = n,GoTo(cart-player,*${EXTEN:-2},1)
|
|
||||||
|
|
||||||
exten = _02XX,1,Set(aa=foobar/02album)
|
|
||||||
same = n,GoToIf($["${EXTEN:-2}" = "00"]?8track-player,#12,1)
|
|
||||||
same = n,GoToIf($["${EXTEN:-2}" < "10"]?cart-player,#${EXTEN:-1},1) ; these files don't have a leading zero
|
|
||||||
same = n,GoTo(cart-player,*${EXTEN:-2},1)
|
|
@ -1,37 +0,0 @@
|
|||||||
[cart-player]
|
|
||||||
exten = _#X,1,Wait(.25)
|
|
||||||
same= n,Background(${aa}/${EXTEN:-1})
|
|
||||||
same = n,Goto(${c},s,return)
|
|
||||||
exten = _*XX,1,Wait(.25)
|
|
||||||
same= n,Background(${aa}/${EXTEN:-2})
|
|
||||||
same = n,Goto(${c},s,return)
|
|
||||||
exten = 0,1,Goto(${c},s,return)
|
|
||||||
|
|
||||||
[8track-player]
|
|
||||||
exten = _*XX,1,Set(tt=${IF($[${EXTEN:-2} < 10]?${EXTEN:-1}:${EXTEN:-2})})
|
|
||||||
same = n,Set(t=1)
|
|
||||||
same = n,Set(p=*)
|
|
||||||
same = n(lead),GoToIf($[${t} = 10]?tenplus)
|
|
||||||
same = n(hax),Background(${aa}/0${t})
|
|
||||||
same = n(next),Set(t=$[${t} + 1])
|
|
||||||
same = n,GoToIf($[${t} < ${tt}]?lead)
|
|
||||||
same = n,Goto(${c},s,goodbye)
|
|
||||||
same = n(tenplus),Set(p=#)
|
|
||||||
same = n,GoTo(#00,hax)
|
|
||||||
exten = _#XX,1,Set(tt=${IF($[${EXTEN:-2} < 10]?${EXTEN:-1}:${EXTEN:-2})})
|
|
||||||
same = n,Set(t=1)
|
|
||||||
same = n,Set(p=#)
|
|
||||||
same = n(hax),Background(${aa}/${t})
|
|
||||||
same = n(next),Set(t=$[${t} + 1])
|
|
||||||
same = n,GoToIf($[${t} < ${tt}]?hax)
|
|
||||||
same = n,Goto(${c},s,goodbye)
|
|
||||||
|
|
||||||
exten = 1,1,GoToIf($["${t}" = "1"]?wait)
|
|
||||||
same = n,Set(t=$[${t} - 1])
|
|
||||||
same = n(wait),Wait(.25)
|
|
||||||
same = n,Goto(${p}00,hax)
|
|
||||||
exten = 2,1,Wait(.25)
|
|
||||||
same = n,Goto(${p}00,hax)
|
|
||||||
exten = 3,1,Wait(.25)
|
|
||||||
same = n,Goto(${p}00,next)
|
|
||||||
exten = 0,1,Goto(${c},s,return)
|
|
Loading…
Reference in New Issue