Custom Flow Control not changing after database update

I have a situation where i want to reset a DAYNIGHT custom flow control. User can press the *289 BLF to force night mode prior to the Time Condition routing to the answering service. BLF works correctly.

FreePBX; Elastix 4 on top of FreePBX.

I found this snippet of code (very sufficient way to change call flow control!):
asterisk -rx ‘devstate change Custom:DAYNIGHT9 NOT_INUSE’

INUSE = call path 2
NOT_INUSE = call path 1

When run from a prompt, devstate changes (according to database show) - and BLF changes to Green.
However the call path does not follow the normal path - and when i dial *288 - the system says feature code deactivated.

It seems the devstate command does not change the actual state of flow control, it only changes BLF, not the actual call flow.

Any clues on what I am doing wrong?

Err - typo. I am dialing *289 to toggle on/off. Disregard the *288 in the middle part of the post.


I don’t understand your question, in that “Day/Night” mode is handled in its own module. From what I understand about that module, you are updating the database, but not updating the actual day/night mode settings. The BLF uses the database for matching, but the day/night mode doesn’t, IIRC.

Have you looked into using the actual day/night mode stuff instead of using Custom Flow Control?

Thanks for the reply. Let me clarify:
A. I have a day/night condition connected to a Time condition - that works fine.
B. Customer wants to force calls to night mode prior to time condition triggering on some days. (CFC *289 - works fine)
C. Customer would like forced condition to be reset prior to start of next work day.

To implement C, I imagine that

  1. doing a cron + script would be the easiest way.
  2. Script would have a database command it appears to be more than setting the custom mode to NOT_INUSE in the database.

However, the database update does change the BLF, but does not change call flow control.

Hope this helps - thanks for any pointing in the right direction…

I do this for all of my customers, and A. handles C. nicely, in that the automatic Day Mode toggle resets the mode when you use the override code option on the toggle.

There have been a couple of posts here lately that the toggle might not be working all the time - I (in fact) ran into a problem with one of my customers overriding night mode (so he could get a call) and the toggle button (programmed as *281) didn’t actually reset the mode correctly. This is probably situational - I have other installations where the toggle works flawlessly.

Forgive the likely stupid question, but how do I BLF to trigger A?

Daynight is handled in astdb so if you are changing MySQL then you are doing it wrong. In general native functions and methods should be used to ensure that changes and things that rely on those changes are all handled correctly.

if ([email protected]_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
$id = 1;
$dn = new dayNightObject($id);

Now if something changes, your changes don’t go :boom: