[asterisk-users] Resetting Day/Night setting

Benny Amorsen benny+usenet at amorsen.dk
Tue Jul 7 15:44:42 CDT 2009


Jared Smith <jsmith at digium.com> writes:

> Sounds like overkill to me... why not just use a GotoIfTime clause in
> your dialplan?

Because he already has one, but also an override. The override should go
away at midnight, which normally requires a cron job.

A stateless way of doing it is something like:

 exten => _X.,1,GotoIf($["${DB(number1/forceopen)}"="STRFTIME(,,%F)"]?open)
 exten => _X.,n,GotoIf($["${DB(number1/forceclose)}"="STRFTIME(,,%F)"]?close)
 exten => _X.,n,GotoIfTime(...?open)
 exten => _X.,n(close),...
 exten => _X.,n,Hangup
 exten => _X.,n(open),...
 exten => _X.,n,Hangup

 exten => _198,1,Set(DB(number1/forceopen)=STRFTIME(,,%F))
 exten => _199,1,Set(DB(number1/forceclose)=STRFTIME(,,%F))

This should make any overrideopen/overrideclose settings only apply for
the day when they were set. Beware, not tested, not even loaded into an
Asterisk.

I actually feel quite clever for coming up with this :) Of course now
everyone will tell me that they have something twice as clever running
in production since '98...


/Benny




More information about the asterisk-users mailing list