Howwise RSS
VoIP & Phone Systems9 min read

FreePBX Call Flow Control Night Mode: Setup and BLF Toggle

Short answer

FreePBX call flow control night mode is a manual toggle (Applications > Call Flow Control) that staff flip by dialing *28 plus the toggle number, e.g. *280, and a BLF key shows its state. Put it in front of your time condition.

Key takeaways
  • Dial *28 plus the toggle digit (*280 to *289) from any extension to flip a Call Flow Control toggle; each dial changes state and announces the new mode.
  • Point the inbound route at the toggle, set Normal Flow to your time condition and Override Flow to voicemail, an announcement or an IVR, so the schedule still works when the toggle is off.
  • The BLF hint is Custom:DAYNIGHTn, and a phone key set to *28n lights when override is active; verify with 'core show hints'.
  • State lives in AstDB under DAYNIGHT, so include it in backups, and make any nightly reset update both AstDB and the device state so the lamp follows.
  • Use a manual toggle for unpredictable closures and a time condition for the regular schedule; combine them rather than choosing one.

Manual toggle or time condition: which one do you need?

A Time Condition decides by clock and calendar. It cannot know about a snow day, a power cut or a staff lunch. A Call Flow Control toggle (the old Day/Night module) holds a single bit of state that a person flips, and it sends calls to one of two destinations.

The robust design is both: the toggle sits in front and the time condition sits behind it. With the toggle in Normal, the schedule runs the office. With the toggle in Override, everything goes to your closed destination regardless of the clock.

SituationBest toolWhy
Mon-Fri 9-17, lunch closedTime ConditionPredictable, needs no human
Public holidays known in advanceTime Condition with a holiday group or calendarSet once, no one has to remember
Snow day, outage, early closeCall Flow Control toggleNeeds an instant flip from any phone
Staff-controlled lunch breakCall Flow Control toggle with BLFOne keypress and visible state

How do I set up FreePBX call flow control night mode?

Open Applications > Call Flow Control and add a new toggle. The module must be installed and enabled, and the feature code must not be disabled in Admin > Feature Codes. Example setup: toggle 0 is Night override, toggle 1 is Holiday override.

  1. Set Call Flow Object Id to 0 (digits 0 to 9 are allowed, giving up to ten toggles).
  2. Enter a Description such as 'Night Override'. It appears in the destination list and in the announcements.
  3. Set Password (optional PIN, digits only). Staff are prompted for it after dialing the code. Use one, or anyone with a handset can close the office.
  4. Optionally choose recordings for the Normal and Override states. These are played when someone flips the toggle, so they confirm state to the caller of the code.
  5. Set Normal Flow destination to your Time Condition (this is the key part).
  6. Set Override Flow destination to your closed handling, then submit and click Apply Config.
Warning: Nothing takes effect until you click Apply Config. A saved but unapplied toggle is the most common reason a new feature code does nothing.

What should the override destination be?

Pick the destination by what a caller needs when you are closed. Voicemail is the simplest. Use a shared mailbox so the unavailable or busy greeting plays, and configure email delivery on that mailbox so messages are not missed.

An IVR is better when callers need options, for example 1 for emergencies, which can ring a cell phone ring group. A plain Announcement followed by Hangup suits a short notice such as 'We are closed today due to weather'.

Avoid destinations that route back into the same inbound route or a ring group that includes the extensions people are trying to close. That creates a loop or sends calls to desks nobody is at.

Override destinationUse whenWatch for
Voicemail (shared mailbox)After hours voicemail onlySet email delivery and a greeting
Announcement then HangupShort known closureCallers cannot leave a message
IVR with after-hours messageEmergency option neededKeep the timeout destination sane
Ring group of a cell phoneOn-call coverageSet a ring timeout and failover to voicemail

How do I wire it to the inbound route and Time Condition?

Set the inbound route's destination to Call Flow Control: Night Override (0). The call arrives at the toggle first. In Normal it continues to the Time Condition, which sends matching calls to the reception ring group or IVR and non-matching calls to the closed destination. In Override it skips the schedule completely.

For holidays there are two layouts. Chaining is the clearest: inbound route to Toggle 1 (Holiday), whose Normal Flow is Toggle 0 (Night), whose Normal Flow is the Time Condition. Either toggle closes the office. The alternative is a single toggle with a different Override destination for each case, which is simpler but can only express one closed state at a time.

Time Conditions also have their own temporary override, set from the GUI or its own feature code. Newer releases let it revert when the schedule next changes, which suits a one-off closure. Where your version also offers a Call Flow Control association on the Time Condition, the toggle can force the matching or non-matching result. The chained layout needs neither option and works on every version.

How do I flip it from a phone and read the state?

The default feature code is *28 plus the toggle number, so *280 for toggle 0 and *281 for toggle 1. You can change the base code under Admin > Feature Codes.

Dialing the code is a toggle, not a status query. After the PIN, the system flips the state and announces the new mode, so dial once to flip and again to flip back. To read state without changing it, look at the BLF lamp (lit means override active, off means normal) or query the database.

The state is stored in AstDB as DAYNIGHT/C0 for toggle 0. Check it from the shell:

asterisk -rx "database show DAYNIGHT"
# /DAYNIGHT/C0 : NIGHT   <- override active
# /DAYNIGHT/C0 : DAY     <- normal flow
asterisk -rx "core show hints" | grep -i daynight

BLF key setup for Yealink, Poly and Sangoma

FreePBX generates a hint for each toggle, equivalent to exten => *280,hint,Custom:DAYNIGHT0. The phone subscribes to the extension *280 on the PBX and the lamp follows the custom device state. Pressing the key dials *280, so one key both flips and displays.

Yealink: set the line key type to BLF (type 16) and the value to the feature code. Poly (VVX): use an attendant resource list entry. Sangoma/Digium: add a BLF key with the value in the phone's key configuration.

# Yealink auto-provision (y000000000000.cfg or MAC cfg)
linekey.1.type = 16
linekey.1.line = 1
linekey.1.value = *280
linekey.1.label = Night

# Poly VVX
attendant.resourceList.1.address = *280
attendant.resourceList.1.label = Night
attendant.resourceList.1.type = normal
Tip: If you have EPM or another provisioning module, set the same value (*280) in the key's value field. Do not create a Custom:DAYNIGHT0 value yourself; the PBX supplies it.

Why does the BLF lamp not change?

The lamp depends on three links: the hint exists, the phone is subscribed, and the state changes. Test them in that order.

SymptomLikely causeCheck and fix
Lamp never lights, key dials fineHint missing'core show hints' should list *280 with Custom:DAYNIGHT0; apply config and confirm the module is enabled
Key shows nothing or an error statePhone not subscribed'pjsip set logger on' and look for SUBSCRIBE to *280; expect 200 OK, a 404 means no hint in that context
SUBSCRIBE rejectedWrong context or subscriptions offEndpoint context should be from-internal and allow_subscribe should be yes (the default)
Lamp lags or drops after a whileSubscription expiry or NATShorten the phone's subscription period and fix NAT (local_net, external addresses)
Lamp invertedWrong expectationLit means Override, which is the closed state
Toggle flips but state revertsAstDB lost or cleared'database show DAYNIGHT' after a flip; if empty, check for a restore or reset job
Lamp disagrees with 'database show DAYNIGHT'State changed in AstDB only, for example by a scriptSet the device state too: 'devstate change Custom:DAYNIGHT0 NOT_INUSE' for normal, INUSE for override

Persistence, mistakes and a test checklist

Toggle state lives in AstDB, so it survives a reload and a restart. It is lost if AstDB is deleted or replaced by a restore, so include it in your backups and re-check state after any restore.

The costliest mistake is a toggle left in Override over the weekend or after a snow day, so the schedule is ignored on Monday. Add an automatic reset, but write both halves of the state. The toggle updates AstDB and the Custom:DAYNIGHT0 device state that the BLF lamp follows. A bare 'database put' changes only AstDB, so the routing would be right while the lamp could keep showing override until the next toggle.

The cron example below sets both. Do not originate a call to *280 for this job: the code flips state rather than setting it, so a reset that runs while the toggle is already Normal would close the office. Run the two commands by hand once, then confirm with 'database show DAYNIGHT' and 'core show hints' (the hint should show Idle for normal) and check a handset lamp before trusting the job.

  1. Call in from an outside line with the toggle in Normal and confirm the schedule path.
  2. Dial *280, enter the PIN, and confirm the announcement says override.
  3. Call in again and confirm the override audio or voicemail greeting plays.
  4. Leave a message and verify the voicemail email arrives.
  5. Flip back and confirm calls reach the normal path again.
  6. Check the lamp on every phone with a key and test from an extension with limited outbound permissions.
  7. Set the toggle to override, run the reset commands by hand, and confirm both 'database show DAYNIGHT' and the handset lamp return to normal.
# /etc/cron.d/daynight-reset  (reset toggle 0 to normal at 06:00 weekdays)
# Writes AstDB (routing) AND device state (BLF lamp), as the toggle does.
0 6 * * 1-5 root /usr/sbin/asterisk -rx "database put DAYNIGHT C0 DAY" && /usr/sbin/asterisk -rx "devstate change Custom:DAYNIGHT0 NOT_INUSE"
Warning: This job overwrites live state and does not ask for the PIN. A deliberate all-day closure on toggle 0 will reopen at 06:00 on weekdays, so use a separate holiday toggle with no reset for planned closures. Test the job by hand first, and re-run the lamp check after any change to the cron line.

Common questions

Can I change *28 to a different feature code?

Yes. Under Admin > Feature Codes, edit the Call Flow Control entry and apply config. The toggle digit is still appended, and your BLF key values must be updated to match.

Do I need a PIN on the toggle?

It is optional, but recommended for any office where accidental dialing is possible. Without one, any extension that can reach the feature code can switch the whole system to override.

Can I use more than one toggle at once?

Yes, there are ten, 0 through 9. Chain them in the dialplan, for example Holiday, then Night, then the Time Condition, so any active one closes the office.

Why does dialing the code flip it when I only wanted to check?

The feature code is a toggle by design, with no read-only mode. Check the BLF lamp or run 'database show DAYNIGHT' to read state safely.

Will the toggle survive an Asterisk restart?

Yes, state is held in AstDB on disk. It is lost only if the database is wiped or a restore overwrites it, so verify state after any restore.

Related topics:freepbxcall flow controltime conditionsblfasterisk