Changeset 3629

Show
Ignore:
Timestamp:
01/24/07 13:09:53 (2 years ago)
Author:
p_lindheimer
Message:

added followme, VmX Locator, CFB, CFU, help on feature codes pulled from database so it is accurate, and I think there is a tweak to help find monitor files for an extension more often

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/recordings/includes/main.conf.php

    r1825 r3629  
    224224# 
    225225$ARI_HELP_FEATURE_CODES = array(); 
    226 $ARI_HELP_FEATURE_CODES['*411'] = _("Directory"); 
    227 $ARI_HELP_FEATURE_CODES['*43'] = _("Echo Test"); 
    228 $ARI_HELP_FEATURE_CODES['*60'] = _("Time"); 
    229 $ARI_HELP_FEATURE_CODES['*61'] = _("Weather"); 
    230 $ARI_HELP_FEATURE_CODES['*62'] = _("Schedule wakeup call"); 
    231 $ARI_HELP_FEATURE_CODES['*65'] = _("festival test (your extension is XXX)"); 
    232 $ARI_HELP_FEATURE_CODES['*70'] = _("Activate Call Waiting (deactivated by default)"); 
    233 $ARI_HELP_FEATURE_CODES['*71'] = _("Deactivate Call Waiting"); 
    234 $ARI_HELP_FEATURE_CODES['*72'] = _("Call Forwarding System"); 
    235 $ARI_HELP_FEATURE_CODES['*73'] = _("Disable Call Forwarding"); 
    236 $ARI_HELP_FEATURE_CODES['*77'] = _("IVR Recording"); 
    237 $ARI_HELP_FEATURE_CODES['*78'] = _("Enable Do-Not-Disturb"); 
    238 $ARI_HELP_FEATURE_CODES['*79'] = _("Disable Do-Not-Disturb"); 
    239 $ARI_HELP_FEATURE_CODES['*90'] = _("Call Forward on Busy"); 
    240 $ARI_HELP_FEATURE_CODES['*91'] = _("Disable Call Forward on Busy"); 
    241 $ARI_HELP_FEATURE_CODES['*97'] = _("Message Center (does not ask for extension)"); 
    242 $ARI_HELP_FEATURE_CODES['*98'] = _("Enter Message Center"); 
    243 $ARI_HELP_FEATURE_CODES['*99'] = _("Playback IVR Recording"); 
    244 $ARI_HELP_FEATURE_CODES['666'] = _("Test Fax"); 
    245 $ARI_HELP_FEATURE_CODES['7777'] = _("Simulate incoming call"); 
     226//$ARI_HELP_FEATURE_CODES['*411'] = _("Directory"); 
     227//$ARI_HELP_FEATURE_CODES['*43'] = _("Echo Test"); 
     228//$ARI_HELP_FEATURE_CODES['*60'] = _("Time"); 
     229//$ARI_HELP_FEATURE_CODES['*61'] = _("Weather"); 
     230//$ARI_HELP_FEATURE_CODES['*62'] = _("Schedule wakeup call"); 
     231//$ARI_HELP_FEATURE_CODES['*65'] = _("festival test (your extension is XXX)"); 
     232//$ARI_HELP_FEATURE_CODES['*77'] = _("IVR Recording"); 
     233//$ARI_HELP_FEATURE_CODES['*99'] = _("Playback IVR Recording"); 
     234//$ARI_HELP_FEATURE_CODES['666'] = _("Test Fax"); 
     235//$ARI_HELP_FEATURE_CODES['7777'] = _("Simulate incoming call"); 
     236 
     237$ARI_HELP_FEATURE_CODES['*72'] = _("Call Forward All Activate"); 
     238$ARI_HELP_FEATURE_CODES['*73'] = _("Call Forward All Deactivate"); 
     239$ARI_HELP_FEATURE_CODES['*74'] = _("Call Forward All Prompting Deactivate"); 
     240$ARI_HELP_FEATURE_CODES['*90'] = _("Call Forward Busy Activate"); 
     241$ARI_HELP_FEATURE_CODES['*91'] = _("Call Forward Busy Deactivate"); 
     242$ARI_HELP_FEATURE_CODES['*92'] = _("Call Forward Busy Prompting Deactivate"); 
     243$ARI_HELP_FEATURE_CODES['*52'] = _("Call Forward No Answer/Unavailable Activate"); 
     244$ARI_HELP_FEATURE_CODES['*53'] = _("Call Forward No Answer/Unavailable Deactivate"); 
     245$ARI_HELP_FEATURE_CODES['*70'] = _("Call Waiting - Activate"); 
     246$ARI_HELP_FEATURE_CODES['*71'] = _("Call Waiting - Deactivate"); 
     247$ARI_HELP_FEATURE_CODES['*78'] = _("Do-Not-Disturb Activate"); 
     248$ARI_HELP_FEATURE_CODES['*79'] = _("Do-Not-Disturb Deactivate"); 
     249$ARI_HELP_FEATURE_CODES['*97'] = _("My Voicemail"); 
     250$ARI_HELP_FEATURE_CODES['*98'] = _("Dial Voicemail"); 
    246251 
    247252############################### 
     
    260265$ASTERISK_PROTOCOLS['zap']['config_files'] = "/etc/asterisk/zapata.conf;/etc/asterisk/zapata_additional.conf"; 
    261266 
     267# Settings for Follow-Me Select Boxes in seconds 
     268# 
     269 
     270$SETTINGS_PRERING_LOW = 4; 
     271$SETTINGS_PRERING_HIGH = 30; 
     272$SETTINGS_LISTRING_LOW = 6; 
     273$SETTINGS_LISTRING_HIGH = 60; 
     274 
     275$SETTINGS_FOLLOW_ME_LIST_MAX = 5; 
     276$SETTINGS_ALLOW_VMX_SETTINGS = true; 
    262277# 
    263278# For setting  
     
    265280#           1 - show controls 
    266281# 
     282$SETTINGS_ALLOW_CALLFORWARD_SETTINGS = 1; 
     283$SETTINGS_ALLOW_VOICEMAIL_SETTINGS = 1; 
    267284$SETTINGS_ALLOW_VOICEMAIL_PASSWORD_SET = 1; 
    268285 
     
    304321#           1 - show controls 
    305322# 
    306 $SETTINGS_ALLOW_CALL_RECORDING_SET = 1
     323$SETTINGS_ALLOW_CALL_RECORDING_SET = 0
    307324 
    308325 
  • freepbx/trunk/amp_conf/htdocs/recordings/modules/callmonitor.module

    r1773 r3629  
    587587      // allow entries to be viewed with users extension 
    588588      $searchText .= "(src = '" . $_SESSION['ari_user']['extension'] . "' 
    589                       OR dst = '" . $_SESSION['ari_user']['extension'] . "')"; 
     589                      OR dst = '" . $_SESSION['ari_user']['extension'] . "' 
     590                      OR channel LIKE 'SIP/" . $_SESSION['ari_user']['extension'] ."-%' 
     591                      OR dstchannel LIKE 'SIP/" . $_SESSION['ari_user']['extension'] ."-%')"; 
    590592 
    591593      // allow entries to be viewed with users outbound CID 
  • freepbx/trunk/amp_conf/htdocs/recordings/modules/help.module

    r1773 r3629  
    8383 
    8484    // handset feature code body 
    85     foreach($ARI_HELP_FEATURE_CODES as $key => $feature_code) { 
     85    if (isset($_SESSION['dbh_asterisk'])) { 
    8686 
    87       $handset_feature_codes_body .=  
    88         "<tr> 
    89            <td class='feature_codes'> 
    90              " . $key . " 
    91            </td> 
    92            <td> 
    93              " . $feature_code . " 
    94            </td> 
    95          </tr>"; 
     87      $sql = " 
     88             SELECT keycode, description 
     89             FROM ( 
     90               SELECT modulename, description, defaultcode keycode 
     91               FROM featurecodes  
     92               WHERE customcode IS NULL  
     93               AND enabled = '1' 
     94               UNION ALL SELECT modulename, description, customcode keycode 
     95               FROM featurecodes 
     96               WHERE customcode IS NOT NULL  
     97               AND enabled = '1' 
     98             )c 
     99             WHERE modulename NOT  
     100             IN ( 'core', 'recordings', 'infoservices', 'polycomreassign') 
     101             ORDER BY modulename, keycode 
     102             "; 
     103 
     104      $results = $_SESSION['dbh_asterisk']->getAll($sql, DB_FETCHMODE_ASSOC); 
     105      if(DB::IsError($results)) { 
     106        $_SESSION['ari_error'] = $results->getMessage(); 
     107      } 
     108      else { 
     109        foreach ($results as $item ) { 
     110 
     111        $handset_feature_codes_body .=  
     112          "<tr> 
     113             <td class='feature_codes'> 
     114               " . $item['keycode'] . " 
     115             </td> 
     116             <td> 
     117               " . $item['description'] . " 
     118             </td> 
     119           </tr>"; 
     120        } 
     121      } 
     122    } 
     123    else { 
     124 
     125      // handset feature code body 
     126      foreach($ARI_HELP_FEATURE_CODES as $key => $feature_code) { 
     127 
     128        $handset_feature_codes_body .=  
     129          "<tr> 
     130             <td class='feature_codes'> 
     131               " . $key . " 
     132             </td> 
     133             <td> 
     134               " . $feature_code . " 
     135             </td> 
     136           </tr>"; 
     137      } 
    96138    } 
    97139 
  • freepbx/trunk/amp_conf/htdocs/recordings/modules/settings.module

    r1773 r3629  
    7878    global $ARI_ADMIN_USERNAME; 
    7979    global $ASTERISK_VOICEMAIL_CONF; 
     80    global $SETTINGS_ALLOW_CALLFORWARD_SETTINGS; 
     81    global $SETTINGS_ALLOW_VOICEMAIL_SETTINGS; 
    8082    global $SETTINGS_ALLOW_VOICEMAIL_PASSWORD_SET; 
    8183    global $SETTINGS_VOICEMAIL_PASSWORD_LENGTH; 
    8284    global $SETTINGS_VOICEMAIL_PASSWORD_EXACT; 
    8385    global $SETTINGS_ALLOW_CALL_RECORDING_SET; 
     86    global $SETTINGS_ALLOW_VMX_SETTINGS; 
    8487 
    8588    // args 
     
    9194    $call_forward_enable  = getArgument($args,'call_forward_enable'); 
    9295    $call_forward_number  = getArgument($args,'call_forward_number'); 
     96 
     97    $call_forward_busy_enable  = getArgument($args,'call_forward_busy_enable'); 
     98    $call_forward_busy_number  = getArgument($args,'call_forward_busy_number'); 
     99 
     100    $call_forward_unavailable_enable  = getArgument($args,'call_forward_unavailable_enable'); 
     101    $call_forward_unavailable_number  = getArgument($args,'call_forward_unavailable_number'); 
     102 
     103    $follow_me_prering_time  = getArgument($args,'follow_me_prering_time'); 
     104    $follow_me_listring_time  = getArgument($args,'follow_me_listring_time'); 
     105    $follow_me_list  = getArgument($args,'follow_me_list'); 
     106    $follow_me_confirm  = getArgument($args,'follow_me_confirm'); 
     107    $follow_me_disabled = getArgument($args,'follow_me_disabled'); 
     108 
     109                $vmx_option_0_number                                    = getArgument($args, 'vmx_option_0_number'); 
     110                $vmx_option_0_system_default    = getArgument($args, 'vmx_option_0_system_default'); 
     111                $vmx_option_1_number                                    = getArgument($args, 'vmx_option_1_number'); 
     112                $vmx_option_2_number                                    = getArgument($args, 'vmx_option_2_number'); 
     113                $vmx_unavail_enabled                                    = getArgument($args, 'vmx_unavail_enabled'); 
     114                $vmx_busy_enabled                                                       = getArgument($args, 'vmx_busy_enabled'); 
     115                $vmx_play_instructions                          = getArgument($args, 'vmx_play_instructions'); 
     116    $vmx_disabled                                                               = getArgument($args,'vmx_disabled'); 
    93117 
    94118    $voicemail_password = getArgument($args,'voicemail_password'); 
     
    118142 
    119143        // update call forward number 
    120         if (!$STANDALONE['use']) { 
    121  
     144        if ($SETTINGS_ALLOW_CALLFORWARD_SETTINGS && !$STANDALONE['use']) { 
     145 
     146          // normal call forward 
    122147          $stripped_call_forward_number = preg_replace('/-|\(|\)|\s/','',$call_forward_number); 
    123148          if ($call_forward_enable && !is_numeric($stripped_call_forward_number)) { 
     
    137162            } 
    138163          } 
     164 
     165          // call forward busy 
     166          $stripped_call_forward_busy_number = preg_replace('/-|\(|\)|\s/','',$call_forward_busy_number); 
     167          if ($call_forward_busy_enable && !is_numeric($stripped_call_forward_busy_number)) { 
     168            $_SESSION['ari_error'] =  
     169              _("Call forward number not changed") . "<br>" . 
     170              sprintf(_("Number %s must contain dial numbers (characters like '(', '-', and ')' are ok)"),$call_forward_busy_number); 
     171          } 
     172          else { 
     173 
     174            // set database 
     175            $this->setCallForward($exten,$call_forward_busy_enable,$stripped_call_forward_busy_number, "CFB"); 
     176 
     177            // store cookie 
     178            $stripped = preg_replace('/-|\(|\)|\s/','',$_COOKIE['ari_call_forward_busy_number']); 
     179            if ($call_forward_busy_number && $stripped!=$stripped_call_forward_busy_number) { 
     180              setcookie("ari_call_forward_busy_number", $call_forward_busy_number, time()+365*24*60*60); 
     181            } 
     182          } 
     183 
     184          // call forward unavailable 
     185          $stripped_call_forward_unavailable_number = preg_replace('/-|\(|\)|\s/','',$call_forward_unavailable_number); 
     186          if ($call_forward_unavailable_enable && !is_numeric($stripped_call_forward_unavailable_number)) { 
     187            $_SESSION['ari_error'] =  
     188              _("Call forward number not changed") . "<br>" . 
     189              sprintf(_("Number %s must contain dial numbers (characters like '(', '-', and ')' are ok)"),$call_forward_unavailable_number); 
     190          } 
     191          else { 
     192 
     193            // set database 
     194            $this->setCallForward($exten,$call_forward_unavailable_enable,$stripped_call_forward_unavailable_number, "CFU"); 
     195 
     196            // store cookie 
     197            $stripped = preg_replace('/-|\(|\)|\s/','',$_COOKIE['ari_call_forward_unavailable_number']); 
     198            if ($call_forward_unavailable_number && $stripped!=$stripped_call_forward_unavailable_number) { 
     199              setcookie("ari_call_forward_unavailable_number", $call_forward_unavailable_number, time()+365*24*60*60); 
     200            } 
     201          } 
     202 
    139203        } 
    140204 
     205        // Make sure Follow-Me setup has not been deleted for this user since the last refresh 
     206        $follow_me_disabled_delayed = $_COOKIE['ari_follow_me_disabled']; 
     207 
     208        if (! $_COOKIE['ari_follow_me_disabled']) { 
     209 
     210          $follow_me_disabled = ($this->getFollowMeListRingTime($exten) > 0)?0:1; 
     211 
     212          if ($follow_me_disabled) { 
     213 
     214            setcookie("ari_follow_me_disabled", $follow_me_disabled, time()+365*24*60*60); 
     215            $follow_me_disabled_delayed = $follow_me_disabled; 
     216            $_SESSION['ari_error'] =  
     217              _("Your Follow-Me has been disabled, REFRESH your browser to remove this message") . "<br>" . 
     218              sprintf(_("Check with your Telephone System Administrator if you think there is a problem")); 
     219          } 
     220                                } 
     221 
     222        $vmx_disabled_delayed = $_COOKIE['ari_vmx_disabled']; 
     223        if (! $_COOKIE['ari_vmx_disabled']) { 
     224 
     225                                        $vmx_disabled = $this->getVmxState($exten,'unavail'); 
     226                                        if ($vmx_disabled === false) { 
     227                                                $vmx_disabled = true; 
     228                        $SETTINGS_ALLOW_VMX_SETTINGS=false; 
     229                                        } else { 
     230                                                $vmx_disabled = false; 
     231                                        } 
     232          if ($vmx_disabled) { 
     233 
     234            setcookie("ari_vmx_disabled", $vmx_disabled, time()+365*24*60*60); 
     235            $vmx_disabled_delayed = $vmx_disabled; 
     236            $_SESSION['ari_error'] =  
     237              _("Your Premium VmX Locator service has been disabled, REFRESH your browser to remove this message") . "<br>" . 
     238              sprintf(_("Check with your Telephone System Administrator if you think there is a problem")); 
     239          } 
     240                                } 
     241 
     242                                if (! $vmx_disabled_delayed) { 
     243          if (!$STANDALONE['use']) { 
     244   
     245            // set database 
     246            $this->setVmxState($exten,'unavail',$vmx_unavail_enabled); 
     247            $this->setVmxState($exten,'busy',$vmx_busy_enabled); 
     248            $this->setVmxPlayInstructions($exten,'unavail',$vmx_play_instructions); 
     249            $this->setVmxPlayInstructions($exten,'busy',$vmx_play_instructions); 
     250   
     251            // store cookie 
     252            setcookie("ari_vmx_unavail_enabled", $vmx_unavail_enabled, time()+365*24*60*60); 
     253            setcookie("ari_vmx_busy_enabled", $vmx_busy_enabled, time()+365*24*60*60); 
     254            setcookie("ari_vmx_play_instructions", $vmx_play_instructions, time()+365*24*60*60); 
     255 
     256                $stripped_vmx_option_0_number = preg_replace('/-|\(|\)|\s/','',$vmx_option_0_number); 
     257                                                if ($vmx_option_0_system_default) { 
     258                $this->setVmxOptionNumber($exten,'0','unavail',""); 
     259                $this->setVmxOptionNumber($exten,'0','busy',""); 
     260                setcookie("ari_vmx_option_0_system_default", $vmx_option_0_system_default, time()+365*24*60*60); 
     261                        if (is_numeric($stripped_vmx_option_0_number) || !$stripped_vmx_option_0_number) { 
     262                        $stripped = preg_replace('/-|\(|\)|\s/','',$_COOKIE['ari_vmx_option_0_number']); 
     263                        if ($vmx_option_0_number && $stripped!=$stripped_vmx_option_0_number) { 
     264                        setcookie("ari_vmx_option_0_number", $call_vmx_option_0_number, time()+365*24*60*60); 
     265                        } 
     266                                                        } 
     267                                                } else { 
     268                        if (!is_numeric($stripped_vmx_option_0_number) && $stripped_vmx_option_0_number) { 
     269                                $_SESSION['ari_error'] =  
     270                                _("Option 0 not changed") . "<br>" . 
     271                                sprintf(_("Number %s must contain dial numbers (characters like '(', '-', and ')' are ok)"),$vmx_option_0_number); 
     272                        } 
     273                        else { 
     274 
     275                                // set database 
     276                                $this->setVmxOptionNumber($exten,'0','unavail',$stripped_vmx_option_0_number); 
     277                                $this->setVmxOptionNumber($exten,'0','busy',$stripped_vmx_option_0_number); 
     278 
     279                                // store cookie 
     280                                $stripped = preg_replace('/-|\(|\)|\s/','',$_COOKIE['ari_vmx_option_0_number']); 
     281                                if ($vmx_option_0_number && $stripped!=$stripped_vmx_option_0_number) { 
     282                                setcookie("ari_vmx_option_0_number", $call_vmx_option_0_number, time()+365*24*60*60); 
     283                                } 
     284                                                        } 
     285                                                } 
     286 
     287                $stripped_vmx_option_1_number = preg_replace('/-|\(|\)|\s/','',$vmx_option_1_number); 
     288                if (!is_numeric($stripped_vmx_option_1_number) && $stripped_vmx_option_1_number) { 
     289                $_SESSION['ari_error'] =  
     290                _("Option 1 not changed") . "<br>" . 
     291                sprintf(_("Number %s must contain dial numbers (characters like '(', '-', and ')' are ok)"),$vmx_option_1_number); 
     292                } 
     293                else { 
     294 
     295                // set database 
     296                $this->setVmxOptionNumber($exten,'1','unavail',$stripped_vmx_option_1_number); 
     297                $this->setVmxOptionNumber($exten,'1','busy',$stripped_vmx_option_1_number); 
     298         
     299                // store cookie 
     300                $stripped = preg_replace('/-|\(|\)|\s/','',$_COOKIE['ari_vmx_option_1_number']); 
     301                if ($vmx_option_1_number && $stripped!=$stripped_vmx_option_1_number) { 
     302                setcookie("ari_vmx_option_1_number", $call_vmx_option_1_number, time()+365*24*60*60); 
     303                } 
     304                } 
     305 
     306                $stripped_vmx_option_2_number = preg_replace('/-|\(|\)|\s/','',$vmx_option_2_number); 
     307                if (!is_numeric($stripped_vmx_option_2_number) && $stripped_vmx_option_2_number) { 
     308                $_SESSION['ari_error'] =  
     309                _("Option 2 not changed") . "<br>" . 
     310                sprintf(_("Number %s must contain dial numbers (characters like '(', '-', and ')' are ok)"),$vmx_option_2_number); 
     311                } 
     312                else { 
     313 
     314                // set database 
     315                $this->setVmxOptionNumber($exten,'2','unavail',$stripped_vmx_option_2_number); 
     316                $this->setVmxOptionNumber($exten,'2','busy',$stripped_vmx_option_2_number); 
     317 
     318                // store cookie 
     319                $stripped = preg_replace('/-|\(|\)|\s/','',$_COOKIE['ari_vmx_option_2_number']); 
     320                if ($vmx_option_2_number && $stripped!=$stripped_vmx_option_2_number) { 
     321                setcookie("ari_vmx_option_2_number", $call_vmx_option_2_number, time()+365*24*60*60); 
     322                } 
     323                } 
     324          } 
     325                                } // vmx_disabled_delayed false 
     326 
     327        if (! $follow_me_disabled_delayed) { 
     328 
     329          // assume no errors, don't update SQL if errors occured 
     330          $follow_me_update_succeeded=1; 
     331   
     332          // update follow me pre-ring time 
     333          if (!$STANDALONE['use']) { 
     334   
     335            $stripped_follow_me_prering_time = preg_replace('/-|\s/','',$follow_me_prering_time); 
     336            if (!is_numeric($stripped_follow_me_prering_time)) { 
     337              $_SESSION['ari_error'] =  
     338                _("Follow-Me pre-ring time not changed") . "<br>" . 
     339                sprintf(_("Number %s must be an interger number of seconds"),$follow_me_prering_time); 
     340              $follow_me_update_succeeded=0; 
     341            } 
     342            else { 
     343   
     344              // set database 
     345              $this->setFollowMePreRingTime($exten,$stripped_follow_me_prering_time); 
     346   
     347              // store cookie 
     348              $stripped = preg_replace('/-|\s/','',$_COOKIE['ari_follow_me_prering_time']); 
     349              if ($follow_me_prering_time && $stripped!=$stripped_follow_me_prering_time) { 
     350                setcookie("ari_follow_me_prering_time", $follow_me_prering_time, time()+365*24*60*60); 
     351              } 
     352            } 
     353          } 
     354   
     355          // update follow me list ring time 
     356          if (!$STANDALONE['use']) { 
     357   
     358            $stripped_follow_me_listring_time = preg_replace('/-|\s/','',$follow_me_listring_time); 
     359            if (!is_numeric($stripped_follow_me_listring_time)) { 
     360              $_SESSION['ari_error'] =  
     361                _("Follow-Me list ring time not changed") . "<br>" . 
     362                sprintf(_("Number %s must be an interger number of seconds"),$follow_me_listring_time); 
     363              $follow_me_update_succeeded=0; 
     364            } 
     365            else { 
     366   
     367              // set database 
     368              $this->setFollowMeListRingTime($exten,$stripped_follow_me_listring_time); 
     369   
     370              // store cookie 
     371              $stripped = preg_replace('/-|\s/','',$_COOKIE['ari_follow_me_listring_time']); 
     372              if ($follow_me_listring_time && $stripped!=$stripped_follow_me_listring_time) { 
     373                setcookie("ari_follow_me_listring_time", $follow_me_listring_time, time()+365*24*60*60); 
     374              } 
     375            } 
     376          } 
     377   
     378          // update follow me list  
     379          if (!$STANDALONE['use']) { 
     380   
     381            $grplist = explode("\n", $follow_me_list); 
     382   
     383            if (!$grplist) { 
     384                    $grplist = null; 
     385            } 
     386   
     387            foreach (array_keys($grplist) as $key) { 
     388              //trim it 
     389              $grplist[$key] = trim($grplist[$key]); 
     390   
     391                                                        // Lookup the extension and append hash if not a user, and remove invalid chars 
     392                                                        $grplist[$key] = $this->lookupSetExtensionFormat($grplist[$key]); 
     393   
     394              // remove blanks 
     395              if ($grplist[$key] == "") unset($grplist[$key]); 
     396            } 
     397   
     398            // check for duplicates, and re-sequence 
     399            $grplist = array_values(array_unique($grplist)); 
     400 
     401            $stripped_follow_me_list = implode("-",$grplist); 
     402   
     403            if ($stripped_follow_me_list == "") { 
     404              $_SESSION['ari_error'] =  
     405                _("Follow-Me list must contain at least one valid number") . "<br>" . 
     406                sprintf(_("The following: %s is not valid"),$follow_me_list); 
     407              $follow_me_update_succeeded=0; 
     408            } 
     409            else { 
     410   
     411              // set database 
     412              $this->setFollowMeList($exten,$stripped_follow_me_list); 
     413   
     414              // store cookie 
     415              $stripped = preg_replace('/|\(|\)|\s/','',$_COOKIE['ari_follow_me_list']); 
     416              if ($follow_me_list && $stripped!=$stripped_follow_me_list) { 
     417                setcookie("ari_follow_me_list", $follow_me_list, time()+365*24*60*60); 
     418              } 
     419            } 
     420          } 
     421   
     422          // update follow me confirm 
     423          if (!$STANDALONE['use']) { 
     424   
     425            // set database 
     426            $this->setFollowMeConfirm($exten,$follow_me_confirm); 
     427   
     428            // store cookie 
     429            setcookie("ari_follow_me_confirm", $follow_me_confirm, time()+365*24*60*60); 
     430          } 
     431   
     432          //If no errors than update the SQL table to keep in sync 
     433          if ($follow_me_update_succeeded) { 
     434            $this->setFollowMeMySQL($exten, $follow_me_prering_time, $follow_me_listring_time, $follow_me_list, $follow_me_confirm); 
     435          } 
     436 
     437        } //if !follow_me_disabled 
     438 
    141439        // voicemail settings 
    142         if ($_SESSION['ari_user']['voicemail_enabled']==1) { 
     440        if ($SETTINGS_ALLOW_VOICEMAIL_SETTINGS && $_SESSION['ari_user']['voicemail_enabled']==1) { 
    143441 
    144442 
     
    356654    global $STANDALONE; 
    357655    global $ARI_ADMIN_USERNAME; 
     656    global $SETTINGS_ALLOW_CALLFORWARD_SETTINGS; 
     657    global $SETTINGS_ALLOW_VOICEMAIL_SETTINGS; 
    358658    global $SETTINGS_ALLOW_VOICEMAIL_PASSWORD_SET; 
    359659    global $SETTINGS_VOICEMAIL_PASSWORD_LENGTH; 
     
    361661    global $ARI_VOICEMAIL_AUDIO_FORMAT_DEFAULT; 
    362662    global $SETTINGS_ALLOW_CALL_RECORDING_SET; 
     663    global $SETTINGS_PRERING_LOW; 
     664    global $SETTINGS_PRERING_HIGH; 
     665    global $SETTINGS_LISTRING_LOW; 
     666    global $SETTINGS_LISTRING_HIGH; 
     667 
     668    global $SETTINGS_FOLLOW_ME_LIST_MAX; 
     669    global $SETTINGS_ALLOW_VMX_SETTINGS; 
    363670 
    364671    global $loaded_modules; 
     
    394701      if (!$STANDALONE['use']) { 
    395702 
     703 
    396704        $call_forward_number = $this->getCallForwardNumber($exten); 
    397705        if ($call_forward_number) {  
     
    403711        } 
    404712 
    405         $set_call_forward_text = " 
    406           <table class='settings'> 
     713        $call_forward_busy_number = $this->getCallForwardNumber($exten, 'CFB'); 
     714        if ($call_forward_busy_number) {  
     715          $call_forward_busy_enable = 'checked'; 
     716        } 
     717        else { 
     718          $call_forward_busy_number = $_COOKIE['ari_call_forward_busy_number']; 
     719          $call_forward_busy_text_box_options = "disabled style='background: #DDD;'"; 
     720        } 
     721 
     722        $call_forward_unavailable_number = $this->getCallForwardNumber($exten, 'CFU'); 
     723        if ($call_forward_unavailable_number) {  
     724          $call_forward_unavailable_enable = 'checked'; 
     725        } 
     726        else { 
     727          $call_forward_unavailable_number = $_COOKIE['ari_call_forward_unavailable_number']; 
     728          $call_forward_unavailable_text_box_options = "disabled style='background: #DDD;'"; 
     729        } 
     730 
     731        $follow_me_prering_time = $this->getFollowMePreRingTime($exten); 
     732        $follow_me_listring_time = $this->getFollowMeListRingTime($exten); 
     733        $follow_me_list =  explode("-", $this->getFollowMeList($exten) ); 
     734        $follow_me_confirm = $this->getFollowMeConfirm($exten); 
     735 
     736                                $FOLLOW_ME_LIST_MAX = (count($follow_me_list) > $SETTINGS_FOLLOW_ME_LIST_MAX) ? count($follow_me_list):$SETTINGS_FOLLOW_ME_LIST_MAX; 
     737 
     738                                //TODO: Set this better than this? 
     739                                $follow_me_disabled = ($follow_me_listring_time > 0)?0:1; 
     740        setcookie("ari_follow_me_disabled", $follow_me_disabled, time()+365*24*60*60); 
     741 
     742        $set_call_forward_text = "<table class='settings'>"; 
     743 
     744        $set_call_forward_text .= (!$SETTINGS_ALLOW_CALLFORWARD_SETTINGS)?'':" 
     745                <table class='settings'> 
    407746            <tr> 
    408               <td><h3>" . _("Call Routing") . "</h3></td> 
     747                               <td><h3>" . _("Call Forwarding") . "</h3></td> 
    409748            </tr> 
    410749            <tr> 
    411               <td>" . _("Call Forwarding:") . "</td> 
    412               <td> 
    413                 <input " . $call_forward_text_box_options . " name='call_forward_number' type='text' size=24 value='" . $call_forward_number . "'> 
    414               </td> 
    415             <tr> 
    416               <td></td> 
    417               <td> 
    418                 <input " . $call_forward_enable . " type=checkbox name='call_forward_enable' value='checked' OnClick=\"disable_fields(); return true;\"> 
    419                 <small>" . _("Enable") . "</small> 
    420               </td> 
    421             </tr> 
    422           </table>"; 
    423       } 
    424  
    425       // voicemail settings 
    426       if ($_SESSION['ari_user']['voicemail_enabled']==1 &&  
    427             in_array('voicemail',array_keys($loaded_modules))) { 
    428         if ($SETTINGS_ALLOW_VOICEMAIL_PASSWORD_SET) { 
    429  
    430           if ($SETTINGS_VOICEMAIL_PASSWORD_EXACT) { 
    431             $voicemail_password_length_message = sprintf(_("Passwords must be all numbers and only %s digits"),$SETTINGS_VOICEMAIL_PASSWORD_LENGTH); 
    432           } 
    433           else { 
    434             $voicemail_password_length_message = sprintf(_("Passwords must be all numbers and at least %s digits"),$SETTINGS_VOICEMAIL_PASSWORD_LENGTH); 
    435           } 
    436  
    437           $set_voicemail_password_text = " 
    438             <tr> 
    439               <td>" . _("Voicemail Password:") . "</td> 
    440               <td> 
    441                 <input name='voicemail_password' type='password' size=16 value=" . $_SESSION['ari_user']['voicemail_password'] . "> 
    442               </td> 
     750                                <td>" . _("Unconditional:") . "</td> 
     751                                <td> 
     752                                        <input " . $call_forward_text_box_options . " name='call_forward_number' type='text' size=24 value='" . $call_forward_number . "'> 
     753                                </td> 
     754                                <td> 
     755                                        <input " . $call_forward_enable . " type=checkbox name='call_forward_enable' value='checked' OnClick=\"disable_fields(); return true;\"> 
     756                                        <small>" . _("Enable") . "</small> 
     757                                </td> 
    443758            </tr> 
    444759            <tr> 
    445               <td>" . _("Enter again to confirm:") . "</td> 
    446               <td> 
    447                 <input name='voicemail_password_confirm' type='password' size=16 value=" . $_SESSION['ari_user']['voicemail_password'] . "> 
    448               </td> 
     760                                <td>" . _("Unavailable:") . "</td> 
     761                                <td> 
     762                                        <input " . $call_forward_unavailable_text_box_options . " name='call_forward_unavailable_number' type='text' size=24 value='" . $call_forward_unavailable_number . "'> 
     763                                </td> 
     764                                <td> 
     765                                        <input " . $call_forward_unavailable_enable . " type=checkbox name='call_forward_unavailable_enable' value='checked' OnClick=\"disable_fields(); return true;\"> 
     766                                        <small>" . _("Enable") . "</small> 
     767                                </td> 
    449768            </tr> 
    450769            <tr> 
    451              <td class='note' colspan=2><small>" . $voicemail_password_length_message . "</small></td> 
    452             </tr>"; 
    453         } 
    454  
    455         if (isset($_SESSION['ari_user']['voicemail_email'])) { 
    456  
    457           if ($_SESSION['ari_user']['voicemail_email_enable']) {  
    458             $voicemail_email_address = $_SESSION['ari_user']['voicemail_email_address']; 
    459             $voicemail_pager_address = $_SESSION['ari_user']['voicemail_pager_address']; 
    460             $voicemail_email_enable = 'checked'; 
    461  
    462             foreach (array_keys($_SESSION['ari_user']['voicemail_email']) as $key) { 
    463               $var = "voicemail_email_$key"; 
    464               $var_enable = $var . "enable"; 
    465               if ($_SESSION['ari_user']['voicemail_email'][$key]=='yes') { 
    466                 $$var_enable = 'checked'; 
    467               } 
    468             } 
    469           } 
    470           else { 
    471  
    472             $voicemail_email_address = $_COOKIE['ari_voicemail_email_address']; 
    473             $voicemail_email_text_box_options = "disabled style='background: #DDD;'"; 
    474             $voicemail_pager_address = $_COOKIE['ari_voicemail_pager_address']; 
    475             $voicemail_pager_text_box_options = "disabled style='background: #DDD;'"; 
    476  
    477             foreach ($_SESSION['ari_user']['voicemail_email'] as $key => $value) { 
    478               $var = "voicemail_email_$key"; 
    479               $var_cookie = "ari_" . $var; 
    480               $var_enable = $var . "enable"; 
    481               $var_text_box_options = $var . "text_box_options"; 
    482  
    483               $$var_text_box_options = "disabled"; 
    484               if ($_COOKIE[$var_cookie]=='yes') { 
    485                 $$var_enable = 'checked'; 
    486               } 
    487             } 
    488           } 
    489  
    490           $set_voicemail_email_text = " 
     770                                <td>" . _("Busy:") . "</td> 
     771                                <td> 
     772                                        <input " . $call_forward_busy_text_box_options . " name='call_forward_busy_number' type='text' size=24 value='" . $call_forward_busy_number . "'> 
     773                                </td> 
     774                                <td> 
     775                                        <input " . $call_forward_busy_enable . " type=checkbox name='call_forward_busy_enable' value='checked' OnClick=\"disable_fields(); return true;\"> 
     776                                        <small>" . _("Enable") . "</small> 
     777                                </td> 
     778            </tr> 
     779 
     780        "; 
     781 
     782        $set_call_forward_text .= ($follow_me_disabled)?'':" 
    491783            <tr> 
    492               <td>" . _("Email Voicemail To:") . "</td> 
    493               <td> 
    494                 <input " . $voicemail_email_text_box_options . " name='voicemail_email_address' type='text' size=48 value='" . $voicemail_email_address . "'> 
    495               </td> 
     784                                <td><h3><br>" . _("Follow Me") . "</h3></td> 
    496785            </tr> 
    497786            <tr> 
    498               <td>" . _("Pager Voicemail To:") . "</td> 
    499               <td> 
    500                 <input " . $voicemail_pager_text_box_options . " name='voicemail_pager_address' type='text' size=48 value='" . $voicemail_pager_address . "'> 
    501               </td> 
    502             </tr> 
    503             <tr> 
    504               <td></td> 
    505               <td> 
    506                 <input " . $voicemail_email_enable . " type=checkbox name='voicemail_email_enable' value='1' OnClick=\"disable_fields(); return true;\"> 
    507                 <small>" . _("Enable") . "</small> 
    508               </td> 
    509            </tr>"; 
    510  
    511           foreach ($_SESSION['ari_user']['voicemail_email'] as $key => $value) { 
    512  
    513             $var = "voicemail_email_$key"; 
    514             $var_enable = $var . "enable"; 
    515             $var_text_box_options = $var . "text_box_options"; 
    516             if ($SETTINGS_VOICEMAIL_EMAIL_OPTION_DESCRIPTIONS[$key]) { 
    517               $var_text = $SETTINGS_VOICEMAIL_EMAIL_OPTION_DESCRIPTIONS[$key]; 
    518             } 
    519             else { 
    520               $var_text = $key; 
    521             } 
    522  
    523             if ($value != 'yes' && $value != 'no' && $value !='') { 
    524  
    525               $size = strlen($value) - 1; 
    526               $set_voicemail_email_text .= " 
    527                 <tr> 
    528                   <td></td> 
    529                   <td> 
    530                     <input type=text size='" . $size . "' name='" . $var . "' value='" . $value . "' OnClick=\"disable_fields(); return true;\"> 
    531                     <small>" . $var_text . "</small> 
    532                   </td> 
    533                 </tr>"; 
    534             }  
    535             else { 
    536  
    537               $set_voicemail_email_text .= " 
    538                 <tr> 
    539                   <td></td> 
    540                   <td> 
    541                     <input " . $$var_enable . " " . $$var_text_box_options . " type=checkbox name='" . $var . "' value='yes' OnClick=\"disable_fields(); return true;\"> 
    542                     <small>" . $var_text . "</small> 
    543                   </td> 
    544                 </tr>"; 
    545             } 
    546           } 
    547         } 
    548   
    549         $wav_enable = 'selected'; 
    550         if ($_COOKIE['ari_voicemail_audio_format']=='.gsm'||  
    551               ($_COOKIE['ari_voicemail_audio_format']=='' && $ARI_VOICEMAIL_AUDIO_FORMAT_DEFAULT='.gsm')) { 
    552           $wav_enable = ''; 
    553           $gsm_enable = 'selected'; 
    554         }  
    555  
    556         $set_voicemail_audio_format_text = " 
    557           <tr> 
    558             <td>" . _("Audio Format:") . "</td> 
    559             <td> 
    560               <select name='voicemail_audio_format'> 
    561                 <option value='.wav' " . $wav_enable .  ">" . _("Best Quality") . " (.wav)</option> 
    562                 <option value='.gsm' " . $gsm_enable .  ">" . _("Smallest Download") . " (.gsm)</option> 
    563               </select> 
    564             </td> 
    565           </tr>"; 
    566  
    567         $set_voicemail_text = " 
    568           <table class='settings'> 
    569             <tr> 
    570               <td><h3>" . _("Voicemail Settings") . "</h3></td> 
    571             </tr> 
    572             " . $set_voicemail_password_text . " 
    573             " . $set_voicemail_email_text . " 
    574             " . $set_voicemail_audio_format_text . " 
    575           </table>"; 
    576       } 
    577  
    578       // call monitor settings 
    579       if ($this->getFreePBXVersion() && 
    580             $SETTINGS_ALLOW_CALL_RECORDING_SET &&  
    581             in_array('callmonitor',array_keys($loaded_modules))) { 
    582  
    583         foreach($data as $key=>$value) { 
    584           if ($key=='record_in') { 
    585             if ($value=='Always') { 
    586               $ri_always = 'checked=checked'; 
    587             } 
    588             elseif ($value=='Never') { 
    589               $ri_never = 'checked=checked'; 
    590             } 
    591             elseif ($value=='Adhoc') { 
    592               $ri_on_demand = 'checked=checked'; 
    593             } 
    594           } 
    595           if ($key=='record_out') { 
    596             if ($value=='Always') { 
    597               $ro_always = 'checked=checked'; 
    598             } 
    599             elseif ($value=='Never') { 
    600               $ro_never = 'checked=checked'; 
    601             } 
    602             elseif ($value=='Adhoc') { 
    603               $ro_on_demand = 'checked=checked'; 
    604             } 
    605           } 
    606         } 
    607  
    608         $set_callmonitor_text = " 
    609           <table class='settings'> 
     787                                <td>" . _("Initial Ring Time:") . "</td> 
     788                                <td> 
     789                                        <select " . $follow_me_prering_time_text_box_options . " name='follow_me_prering_time'/>"; 
     790        if (!$follow_me_disabled) { 
     791          $default_prering = $follow_me_prering_time; 
     792          for ($i=$SETTINGS_PRERING_LOW; $i <= $SETTINGS_PRERING_HIGH; $i++) { 
     793            $set_call_forward_text .=  '<option value="'.$i.'" '.($i == $default_prering ? 'SELECTED' : '').'>'.$i.'</option>'; 
     794          } 
     795        } 
     796        $set_call_forward_text .= ($follow_me_disabled)?'':" 
     797                </select> 
     798                                        <small>" . _("seconds") . "</small> 
     799                                </td> 
    610800            <tr> 
    611               <td><h3>" . _("Call Monitor Settings") . "</h3></td> 
     801                                <td valign='top'>" . _("Follow Me List:") . "</td> 
     802                                <td> 
     803                                        <textarea " . $follow_me_list_options . " id='follow_me_list' name='follow_me_list' type='text' cols='20' rows='".$FOLLOW_ME_LIST_MAX."' value='' onKeyUp='rowCounter(this.form.follow_me_list, ".$FOLLOW_ME_LIST_MAX.");' onKeyDown='rowCounter(this.form.follow_me_list, ".$FOLLOW_ME_LIST_MAX.");'>".implode("\n",$follow_me_list)."</textarea> 
     804                                </td> 
     805                        <tr> 
     806                                <td>" . _("List Ring Time:") . "</td> 
     807                                <td> 
     808                                        <select " . $follow_me_listring_time_text_box_options . " name='follow_me_listring_time'/>"; 
     809        if (!$follow_me_disabled) { 
     810          $default_listring = $follow_me_listring_time; 
     811          for ($i=$SETTINGS_LISTRING_LOW; $i <= $SETTINGS_LISTRING_HIGH; $i++) { 
     812            $set_call_forward_text .=  '<option value="'.$i.'" '.($i == $default_listring ? 'SELECTED' : '').'>'.$i.'</option>'; 
     813          } 
     814        } 
     815        $set_call_forward_text .= ($follow_me_disabled)?'':" 
     816                                        </select> 
     817                                        <small>" . _("seconds") . "</small> 
     818                                </td> 
     819                        <tr> 
     820                                <td>" . _("Use Confirmation:") . "</td> 
     821                                <td> 
     822                                        <input " . $follow_me_confirm . " type=checkbox name='follow_me_confirm' value='checked'> 
     823                                        <small>" . _("Enable") . "</small> 
     824                                </td> 
     825        "; 
     826 
    &nbs