For calculating the difference between two times in Asterisk dialplan, the time values should be converted to an epoch value first. This can be done using the asterisk function STRFTIME. Use the below dialplan to convert current time to an epoch value Set(time=${STRFTIME(${EPOCH},,%s)})