On Fri, 28 Mar 2003, Michiel Betel wrote:
> Hi,
>
> We want to be able to switch to a night context when the last person
> leaves the office. (by having this person call a special extension) This
> context would then disallow anything but local outbound calls and wil
> handle inbound calls differently. Currently we use includes with a set
> time, but thats not ideal.
> I could do an agi which looks at a variable, checking the night-setting
> but that would mean it gets called for every in & outbound call and
I'm a
> bit afraid of the overhead involved. The other option I see is modifying
> the include functions in pbx.c to look at a settable variable or Asterisk
> database value.
> But helpfull suggestionsare very welcome!
>
This sounds like a perfect use for the astdb and channel variables
You would setup an extension that when you dial executes
DBPut(Flags,NightMode=Yes)
and then have your incoming context execute
DBGet(nightmode=Flags/NightMode)
and then use GotoIf to check if the channel variable nightmode = yes and
if so then jump to your night mode context
James