; lines commented out are written if leading 0s exist in file name [foo-main] ; jukebox context exten = s,1,Answer() ; Hello? You'll have to speak up I'm wearing a towel. same =n,Set(VOLUME(TX)=-3) ; My Canadian friend said everything was too loud same = n(return),Set(m=1) ; set/reset loop counter same = n(loop),Background(bar/foo) ; play background same = n,WaitExten(5) ; wait 5 seconds same = n,Set(m=$[${m} + 1]) ; increment loop same = n,GoToIf($["${m}" < "5"]?loop) ; while loops suck same = n,Background(bar/bar) ; play outro same = n,Hangup() ; "and your mother! *SLAM*" exten = _00XX,1,Set(aa=bar/foobar) ; pattern match for album and write folder location same = n,GoToIf($["${EXTEN:-2}" = "00"]?full) ; check for 00 in track number same = n,Goto(foo-juke-one,${EXTEN:-2},1) ; go to single playback routine, use stripped ext same = n(full),Set(tt=6) ; this is one more than actual album track number same = n,Goto(foo-juke-full,s,1) ; go to album playback routine exten = _01XX,1,Set(aa=bar2/bar) ; Second verse, same as the first. A little bit louder a little bit worse same = n,GoToIf($["${EXTEN:-2}" = "00"]?full) ; I'm Henry the eighth I am. Henry the eighth I am I am same = n,Goto(foo2-juke-one,${EXTEN:-2},1) ; I got married to the window next door, she's been married seven times before same = n(full),Set(tt=5) ; And ev'ry one was a Henry (Henry!). She wouldn't have a Willy or a Sam (no Sam) same = n,Goto(foo-juke-full,s,1) ; I'm her eighth old man, I'm Henry. Henry the eighth I am. [foo-juke-one] ; single playback routine ;exten = _0X,1,Wait(.25) ; extension for tracks without leading 0 ;same= n,Background(${aa}/${EXTEN:-1}) ; pull only the last digit of called extension, play ;same= n,Goto(foo-main,s,1) ; go back to main menu exten = _XX,1,Wait(.25) ; tracks with leading 0 or > 10 same= n,Background(${aa}/${EXTEN}) ; play file same = n,Goto(foo-main,s,return) ; go home exten = 0,1,Goto(foo-main,s,return) ; press 0 to go home [foo-juke-full] ; full album context exten = s,1,Set(t=1) ; reset track counter ;same = n(lead),GoToIf($[${t} > 9]?hax) ; leading 0 file name hack ;same = n,Background(${aa}/0${t}) ; only written if needed ;same = n,Goto(s,next) ; make sure you pick the right option in wizard same = n(hax),Background(${aa}/${t}) ; play the thing same = n(next),Set(t=$[${t} + 1]) ; increment the track counter same = n(skip),GoToIf($[${t} < ${tt}]?hax) ; Asterisk while sucks. We'll make our own. ;same = n(skip),GoToIf($[${t} < ${tt}]?lead) ; This line is used instead if you have leading 0s same= n,Background(bar/bar) ; play the outro same = n,Hangup() ; GTFO exten = 1,1,GoToIf($["${t}" = "1"]?wait) ; We can't play track 0. same = n,Set(t=$[${t} - 1]) ; decrement track counter same = n(wait),Wait(.25) ; wait for dtmf same = n,Goto(s,hax) ; go play the thing ;same = n,Goto(s,lead) ; if leading 0s is true exten = 2,1,Wait(.25) ; shut up DTMF same = n,Goto(s,hax) ; go play the thing ;same = n,Goto(s,lead) ; if leading 0s is true exten = 3,1,Wait(.25) ; DTMF hax same = n,Goto(s,next) ; go to next track exten = 0,1,Goto(foo-main,s,return) ; go home dad you're drunk