Custom Context Times not working with Asterisk 1.6

ric9887's picture

I guess this isn't really a FreePBX Beta issue, but it appears there is something wrong when Custom Context Times are used with FreePBX 2.6RC2 and Asterisk 1.6.1.1
I have created a custom contaxt whereby 2 different trunks are used during different times in the day as a simple LCR solution.

It appears that if the allow/disallow rules are used in the custom context, then they are respected, however if a Custom Conext Time Group is used then it is not matched.
This works fine on Asterisk 1.4.21.2 and FreePBX 2.6RC2.
Perhaps someone could confirm this and if there is a fix for it.
Regards
Rich


__________________


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

solved

paketecuento's picture

the problem is you must use "," not "|" to separate time conditions... and custom-contexts does not ;(

UPDATED: some minor modifications to /var/www/html/admin/modules/customcontexts/functions.inc.php and solved.

Attached diff

********** BEGIN DIFF *****************

--- functions.inc.php   2009-12-16 13:00:20.000000000 +0100
+++ functions.inc.php.orig 2009-12-16 12:00:48.000000000 +0100
@@ -316,7 +316,7 @@
                if(DB::IsError($results2))
                        $results2 = null;
                foreach ($results2 as $inc) {
-                       $time = isset($inc[1])?'|'.$inc[1]:'';
+                       $time = isset($inc[1])?','.$inc[1]:'';
                        switch ($inc[2]) {
                                case 'allowmatch':
                                        if (is_array($dialpattern)) {
@@ -972,7 +972,7 @@
        foreach ($times as $key=>$val) {
                extract($val);
                $time = customcontexts_customcontextstimes_buildtime( $hour_start, $minute_start, $hour_finish, $minute_finish, $wday_start, $wday_finish, $mday_start, $mday_finish, $month_start, $month_fini$
-               if (isset($time) && $time <> '*|*|*|*') {
+               if (isset($time) && $time <> '*,*,*,*') {
                        $sql = "insert customcontexts_timegroups_detail (timegroupid, time) values ($timegroup, '$time')";
                        $db->query($sql);
                }
@@ -986,7 +986,7 @@
        $html = '';
        // ----- Load Time Pattern Variables -----
        if (isset($time)) {
-               list($time_hour, $time_wday, $time_mday, $time_month) = explode('|', $time);
+               list($time_hour, $time_wday, $time_mday, $time_month) = explode(',', $time);
        } else {
                list($time_hour, $time_wday, $time_mday, $time_month) = Array('*','-','-','-');
        }
@@ -1399,7 +1399,7 @@
             } else {
                 $time_month = $time_month_start . '-' . $time_month_finish;
             }
-           $time = $time_hour . '|' . $time_wday . '|' . $time_mday . '|' . $time_month;
+           $time = $time_hour . ',' . $time_wday . ',' . $time_mday . ',' . $time_month;
            return $time;
}

********** END DIFF *****************

Thanks

JohnF's picture

I had been assuming that it was another third-party module (keylock)causing this.
Appreciate the fix.

Regards

John


Ok i am having this exact

tsukraw's picture

Ok i am having this exact issue and cannot seem to find the lines you are referencing above in my functions.inc.php file.

I am running version 2.9.0.0

Is there something different i need to do to resolve this issue?