How to create a loop in Asterisk

Asterisk PBX

Let we have some variable like:
Set(Asterisk=1,2,3,4,5)
We need to go through the variable, using «,» as a separator.

Solution:

same => n,Set(Asterisk=1,2,4,3,5)
same => n,Set(X=1)
same => n,Set(DEV=${CUT(Asterisk,\,,1)})
same => n,While($[${EXISTS(${DEV})}])
same => n,NoOp(DEV = ${DEV})
same => n,Set(X=$[${X} + 1])
same => n,Set(DEV=${CUT(Asterisk,\,,${X})})
same => n,EndWhile()

Want me to do this for you? Drop me a line: itgalaxyzzz {at} gmail [dot] com