Time counter?


i need a time counter in asterisk, for example:

i run a script with the System command and i need to do again after 20 minutes

how can i set the timer or counter to execute something after 20 minutes.

if some have an idea please tell me a nd i´ll prove it.

Regards Carlos

your description is a bit vague, can you give an example of what you an example to further try and offer a suggestion?

ok thanks for the ideas, but i posted wrong, it´s more complex:

these are the code lines:

exten => s,1,HasVoicemail(${ARG1}) ;check for new voicemails first
exten => s,102,Goto(${ARG1},1)

exten => 172,1,System(/usr/bin/minicom -S /var/01colomF)
exten => 173,1,System(/usr/bin/minicom -S /var/02colomA)
exten => 264,1,System(/usr/bin/minicom -S /var/03etbsar)
exten => 265,1,System(/usr/bin/minicom -S /var/04etbmplsF)
exten => 266,1,System(/usr/bin/minicom -S /var/05etbmplsA)
exten => 267,1,System(/usr/bin/minicom -S /var/06etbOUT)
exten => 355,1,System(/usr/bin/minicom -S /var/07epm)
exten => 446,1,System(/usr/bin/minicom -S /var/08inter)
exten => 537,1,System(/usr/bin/minicom -S /var/09diveo)
exten => 624,1,System(/usr/bin/minicom -S /var/10nisip)
exten => 712,1,System(/usr/bin/minicom -S /var/11nortel)

when i have a new voice mail on ext 172, it runs the 172 script (01colomF) and then it has to wait 20 minutes to check again if it has the new vm yet and runs the script again.

i have an idea, but i don´t know if works

exten => 172,1,System(/usr/bin/minicom -S /var/01colomF)
exten => 172,2,System(/usr/bin/minicom -S /var/SCRIPT2); SCRIPT2— sleep 1200
exten => 172,3,System(/usr/bin/minicom -S /var/SCRIPT3); SCRIPT3— sleep 2400
exten => 172,4,HasVoicemail(${ARG1})
exten => 172,5,System(killall -9 SCRIPT2)
exten => 172,6,System(killall -9 SCRIPT3)

exten =>172,105,Goto(172,4)

i don´t know what happend with the Goto, if it create a loop and stop the other operations

ok guys, i read cron functions and i understood that you can set the time to do some task. but i need to interact with the hasnewvoicemail() (asterisk). Remember i have to execute two time counters, first one with 20 minutes and the second one with 20 minutes after first one. all the time counters will be controled by the VM, for example:

  1. New voicemail stars time counters, First one 20 min, Second one 40 min.
  2. If the new voicemail is heard, kill the time counters.
  3. If the first counter was executed, it ran a minicom script.
  4. If the second counter was executed, it ran a minicom script.

that´s all.

[[email protected] 172]# ls
busy greet INBOX Old temp tmp unavail
[[email protected] 172]# cd INBOX/
[[email protected] INBOX]# ls ---------- i have two new voice mails
msg0000.txt msg0000.wav msg0000.WAV msg0001.txt msg0001.wav msg0001.WAV
[[email protected] INBOX]# cd …
[[email protected] 172]# cd Old
[[email protected] Old]# ls -------- Old is empty
[[email protected] Old]# ls -------- i heard the two voicemails and automatic pass to Old
msg0000.txt msg0000.wav msg0000.WAV msg0001.txt msg0001.wav msg0001.WAV
[[email protected] Old]# cd …
[[email protected] 172]# cd INBOX/
[[email protected] INBOX]# ls -------- INBOX is empty
[[email protected] INBOX]#

ok with this information i can create a linux script to check the INBOX or the Old and put the sleeps (20 min and 40 min). but i don´t know the correct command to check if the directories has something.