From 2da8430d52fa551e26def36aaf64d25e6eed7068 Mon Sep 17 00:00:00 2001 From: Jay Moore Date: Wed, 21 Sep 2022 12:39:42 -0400 Subject: [PATCH] Forgot the HOWITWORKS --- HOWITWORKS.MD | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/HOWITWORKS.MD b/HOWITWORKS.MD index a6a6da4..222ae29 100644 --- a/HOWITWORKS.MD +++ b/HOWITWORKS.MD @@ -32,7 +32,7 @@ exten = s,1,Answer() # Answer the channel. same = n,Set(VOLUME(TX)=-3) # Lower volume since that seems necessary. same = n,Set(c=examplejuke-main) # Set the "c" variable so we can return to this context. same = n(loop),Background(foobar/menu) # Label for "loop", plays the menu audio. -same = n,WaitExten(5) # Wait a few seconds +same = n,WaitExten(5) # Wait a few seconds (AJW won't write this if delay is skipped) same = n,Set(m=$[${m} + 1]) # Increase "m" by one. same = n,GoToIf($["${m}" < "5"]?loop) # Compare to "5", return to "loop" if true. same = n,(goodbye)Background(foobar/bye) # It was false...good bye. "Goodbye" label. @@ -40,16 +40,25 @@ same = n,Hangup() # SLAM exten = _00XX,1,Set(aa=foobar/00album) # Set the aa variable to the album directory for leading 00 same = n,GoToIf($["${EXTEN:-2}" = "00"]?8track-player,*11,1) # Check last two dialed. If album playback, pass total tracks as extension. +same = n,GoToIf($["${EXTEN:-2}" > "19"]?9999) # Make sure we don't exceed the actual number of tracks same = n,GoTo(cart-player,*${EXTEN:-2},1) # Pass the last two digits to cart-player as *ext +same = 9999,Playback(option-is-invalid) # WRONG! +same = n,GoTo(examplejuke-main,s,1) # Go back and try again exten = _01XX,1,Set(aa=foobar/01album) # Repeat for album leading 01 same = n,GoToIf($["${EXTEN:-2}" = "00"]?8track-player,*15,1) +same = n,GoToIf($["${EXTEN:-2}" > "19"]?9999) same = n,GoTo(cart-player,*${EXTEN:-2},1) +same = 9999,Playback(option-is-invalid) +same = n,GoTo(examplejuke-main,s,1) exten = _02XX,1,Set(aa=foobar/02album) # Album 02 is different. Files do not have a leading 0. same = n,GoToIf($["${EXTEN:-2}" = "00"]?8track-player,#12,1) # Pass last two to 8track-player's # pattern. +same = n,GoToIf($["${EXTEN:-2}" > "19"]?9999) # Make sure we don't exceed the actual number of tracks same = n,GoToIf($["${EXTEN:-2}" < "10"]?cart-player,#${EXTEN:-1},1) # If the last two are less than 10; pass to single digit to cart-player #ext same = n,GoTo(cart-player,*${EXTEN:-2},1) # Use the "standard" call for tracks more than 10. +same = 9999,Playback(option-is-invalid) # WRONG! +same = n,GoTo(examplejuke-main,s,1) # Go back and try again ``` The setup for the jukeboxes has undergone about as much optimization as I think I can perform. I did trade a few variables for reducing the overall number of lines.