Hi guys,
I want to do date comparison in Asterisk. I mean compare 2 dates. For example
If user_date >= asterisk server_date then the call should proceed.
I get the server date and store in a variable like this
same => n,Set(GLOBAL(server_date)=${STRFTIME(,%Y-%m-%d)}})
Then in my func_odbc.conf I have a function that get the date of the user
[DATE]
prefix = START
dsn = asterisk
readsql = SELECT date(user_date) from customers WHERE user_id =’${SQL_ESC(${ARG1})}’
So in the extensions.conf I want to check if the user_date is reached like then the call should proceed. I did it like this
same => n,Set(start_date=${START_DATE(${user_id})})
same => n,GotoIf($[${server_date} >= ${start_date}]?continue,1:availtocall,1)
In my head, the above statement will do 2017-01-31 >= 2017-02-02 which I am not sure it is correct for date comparison.