It'm my macro from extensions.ael

macro randomfile() {
set(DZIEL=${TIMESTAMP:0:8}${TIMESTAMP:9}); set(DZIEL=${DZIEL:6});
               math(WYNIK,${DZIEL}/${NumberOfFiles);
               set(ROZMIAR=${LEN(${WYNIK})});
               MATH(ROZMIAR,${ROZMIAR}-7);
               set(WYNIK=${WYNIK:0:${ROZMIAR}});
               math(WYNIK,${WYNIK}*${NumberOfFiles});
               math(WYNIK,${DZIEL}-${WYNIK});
               math(WYNIK,${WYNIK}+1);
                        };
I have specified NumberOfFiles and want to randomly play one of them.
This macro gets hours and minutes from TIMESTAMP (first two lines) and store it as 4 digit number (DZIEL). It is divided by NumberOfFiles, cuted (-7 digits) to discard comma and all behind.
...
at the end random number is created as result of HHMM number mod NumberOfFiles

-mayby that will help You a little

I want to get a variable, depending on the time.
I tried this one, but it does not work:

exten => 75,1,Set(guess=SYSTEM(echo $((1 + $(date +%S)*100 % 23)))

The idea is that the variable guess will change every 23 times per minute.

How would be the right syntax?


bye

Ronald Wiplinger



_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to