NightModeA
From Etel
Contents |
[edit]
Title
Night Mode
[edit]
Problem
You need a hybrid solution for setting your system into night mode. The system should automatically turn itself on in the morning, should turn itself off at night, but there needs to be an ability to turn off the system early.
[edit]
Solution
Use a database, such as the AstDB, to store system state.
extensions.conf:
[incoming]
exten => s,1,GotoIf($[${DB(system/state)} = off]?night,s,1)
exten => s,n,Background(greeting)
exten => s,n,WaitExten(10)
...
[night] exten => s,1,Background(night-greeting) exten => s,n,WaitExten(10) ...
[internal] ; Turn system off before scheduled time exten => 300,1,Set(DB(system/state)=off) exten => 300,n,Playback(system-off)
Cron entries:
# Open the office at 8:00 a.m., Monday-Friday 0 8 * * 1-5 /usr/sbin/asterisk -rx 'database put system state on' # Close the office at 5:30 p.m., Monday-Friday 30 17 * * 1-5 /usr/sbin/asterisk -rx 'database put system state off'
[edit]
Discussion
[edit]
See Also:
[edit]
Metadata
- By: TilghmanLesher
