Showing posts with label voip. Show all posts
Showing posts with label voip. Show all posts

Friday, October 18, 2013

FreePBX BLF Time Conditions

My previous post was about increasing the number of Call Routing toggles in FreePBX because I thought that was what I would need to do in order to get BLF (Busy Lamp Field) working with the presence feature on our Polycom SoundPoint phones. The reason I wanted to do that was that so users could have an indication if their phone was in "night mode" or not. As it turns out there is a MUCH better way to handle this.

Step 1
In FreePBX, go to Settings -> Advanced Settings and change "Enable Custom Device States" to True

Step 2
In Applications -> Time Conditions, create your Time Condition. You'll notice that by enabling the previous option, you now have a "Generate BLF Hint" checkbox. Be sure to set that to ON, make sure you also set the "Enable Override Code" box to ON. Once you save the Time Condition, make a note of the override code assigned to it (likely something like *270)

Step 3
On your phone, enable the presence feature. For my SoundPoint IP 601, this meant setting         feature.1.enabled="{$feature_1_enabled|1}" in my server.cfg
I had tried to set feature.1.enabled="1" in sip.cfg which I had seen referenced multiple times, however it never seemed to enable the presence feature.

Step 4
Add the extension *270 to the list of watched extensions on your phone. You can provision it via config file, or set up the extension in the local directory on the phone, and while doing so, scroll down to the "Buddy Watch" option and toggle it to "Enabled"

Thursday, October 17, 2013

Increasing the number of FreePBX Call Flow Control Options

We're starting to retool our VOIP infrastructure, and consolidate down from 30+ Trixbox servers to a single FreePBX server. One issue with the amalgamation however is that by default, FreePBX only allows you 10 Call Flow Control indexes. Since we have some 30 odd sites, this wouldn't work for us. However, this fantastic blog post: http://sysadminman.net/blog/2013/daynight-aka-call-flow-control-more-than-10-4884 shows you how to increase that to the number of your choosing. I'll repost the gist here.

1. copy /var/www/html/admin/modules/daynight/functions.inc.php to /var/www/html/admin/modules/daynight/functions.inc.php.dist (good to have a backup)
2. edit /var/www/html/admin/modules/daynight/functions.inc.php and find function daynight_get_avail() { (should start around line 258)
3. under global $db; add another line that reads $NUMDAYNIGHT = 99;
4. comment out the section that starts for ($i=0;$i<=9;$i++) { and ends return $list; (since this is PHP, just add // to the start of those lines
5. under the commented out lines, add 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;

The whole block of code from line 258 function daynight_get_avail() { to line 284 } should look like:

function daynight_get_avail() {
        global $db;
        $NUMDAYNIGHT = 99;

        $sql = "SELECT ext FROM daynight ORDER BY ext";
        $results = $db->getCol($sql);
        if(DB::IsError($results)) {
                $results = array();
        }

//      for ($i=0;$i<=9;$i++) {
//              if (!in_array($i,$results)) {
//                      $list[]=$i;
//              }
//      }
//      return $list;

        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;
}

Now if you go to Applications -> Call Flow Control you will have 99 options for Flow Toggles!