DayNight aka Call Flow Control – More than 10

This information is provided without warranty – although I have been using this configuration successfully for over 12 months.

In FreePBX there is a module which has changed it’s name but remains an extremely useful one. Day/Night control, now called Call Flow Control, allows you to set a toggle-switch to change how a call is routed within the system. Typically this could be a Day or Night mode service, but you might also want a ‘We are closed for Christmas’ message for example. Using an announcement as the ‘night’ destination, using a recording linked to a feature code before going to a voicemail box, gives you a very quick way to temporarily close the office, with whatever message your users want to record themselves.

However, the module has a limitation; it only allows you to setup Callflows 0-9, for a total of 10 call-flow options. Should you need more than this, you would either need to program them manually, or else you can edit the module thus:

(This information was taken from here: http://www.freepbx.org/forum/freepbx/users/number-of-day-night-mode-controls-available-in-freepbx although this guide is a more basic version of the proposed patch)

  1. SSH into your phone system
  2. nano -w /var/www/html/admin/modules/daynight/functions.inc.php

    (the folder is still named daynight even when the module in FreePBX is named CallFlow)

  3. Find (ctrl-w in nano) i=0
  4. You’ll see a few lines up “global db;” – add the following line:
    $NUMDAYNIGHT = 99;
  5. replace the section starting “for ($i=0…” ending with “return $list;” with the following:
    for ($i=0;$i<=($NUMDAYNIGHT-1);$i++) {
    $n=ceil(log10($NUMDAYNIGHT));
    $format="%0".$n."d";
    $j=sprintf($format,$i);
    if (!in_array($j,$results)) {
    $list[]=$j;
    }
    }
    return $list;
  6. Save and go back to the web-interface
  7. Observe CallFlow Feature Code Index options now range from 00 to 99 = hurrah!

As noted on freepbx.org link, this doesn’t update any existing callflow controls, so if possible you’ll want to do this before you set any up. In theory there’s no reason that 1-9 shouldn’t still work alongside 01-09 and 10-99; you’d just potentially have *280 and *2800 as 2 separate callflow toggles.

 

4 thoughts on “DayNight aka Call Flow Control – More than 10

  1. Joe

    there’s a problem with your code. The “less than” symbol has been converted to “html”. If people cut/paste as is, it will complete break the admin portion of the site.

Comments are closed.