Looping Dialplan With Labels

Will goto work if the label appears above it? In the example below, the caller doesn’t press 1, I want them to loop up to the tryagain label. I wasn’t sure if the system would go back up in the dial plan or if its only going to look down. I am not in a place where I can test this myself. Does anyone know? Thanks for any insight you can provide.

exten => s,n,Set(ATTEMPTS=1)
exten => s,n(tryagain),GotoIf(["{ATTEMPTS}" = “4”]?optedno)
exten => s,n,Read(ALTCALLBACKID,custom/enteraltnumber,10,n,3,15)
exten => s,n,Playback(custom/youenterednum)
exten => s,n,SayDigits({ALTCALLBACKID}) exten => s,n,Read(ALTID,custom/callbackconfirm,1,n,3,15) exten => s,n,GotoIf(["{ALTID}" = "1"]?altidconfirmed) exten => s,n,Set(Attempts={MATH({ATTEMPTS}+1,i)}) exten => s,n,goto(tryagain) exten => s,n,Set(CALLBACKNUM={ALTCALLBACKID})
exten => s,n,GotoIf(["{ALTID}" = “1”]?buildcallfile)

Dialplans are fully fledged programming languages, even wihtout the use of While().

Thanks for replying, but I am not sure if that is a yes or no to my question. Asterisk is my first, for now, language that I do anything like this for. It’s great, and has been fun to learn on. Looking into Python next, to combine with Asterisk.

You can implement loops without using While().

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.