Calculating time difference in Asterisk

Hello experts,

In Asterisk I have a specific time stored in the db, and I have the following dial plan:

exten => 123,1,GotoIf(CONDITION?TRUE:FALSE)

CONDITION shall be TRUE if the time difference between the stored db time and the current time  is less than one hour.

Would anybody please provide the required condition code?
MuhajreenAsked:
Who is Participating?
 
grbladesCommented:
What format is the time in?
You will first want to read the time out of the database into a variable. Then if it is not in epoch format convert it using http://www.voip-info.org/wiki/view/Asterisk+func+strptime

Epoch is measured in seconds so assuming ${dbval} holds the db value in epoch format you can use the following as the condition.
$[${EPOCH} < (${dbval}+3600)]
0
 
MuhajreenAuthor Commented:
Thank you !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.