Changeset 11342

Show
Ignore:
Timestamp:
02/11/11 18:40:47 (2 years ago)
Author:
p_lindheimer
Message:

adds a toggle feature code and hints to go in conjunction with Asterisk patch submission 18788 on review board as 1105 re #778

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.9/amp_conf/bin/generate_hints.php

    r10866 r11342  
    1212// 
    1313$intercom_code = isset($argv[1]) ? $argv[1] : ''; 
    14 $dnd_mode      = isset($argv[2]) ? $argv[2] : ''; 
     14$campon_toggle = isset($argv[2]) ? $argv[2] : ''; 
     15$dnd_mode      = isset($argv[3]) ? $argv[3] : ''; 
    1516 
    1617$ast_with_dahdi = ast_with_dahdi(); 
     
    3940  global $dnd_mode; 
    4041  global $intercom_code; 
     42  global $campon_toggle; 
    4143 
    4244  $dnd_string = ($dnd_mode == 'dnd')?"&Custom:DND$user":''; 
     
    4749    if ($intercom_code != 'nointercom' && $intercom_code != '') { 
    4850      echo "exten => $intercom_code"."$user,hint,$dial_string"."$dnd_string\n"; 
     51    } 
     52    if ($campon_toggle != 'nocampon' && $campon_toggle != '') { 
     53 
     54      $dev_arr = explode('&',$dial_string); 
     55      $hint_val = 'ccss:'.implode('&ccss:',$dev_arr); 
     56      echo "exten => $campon_toggle"."$user,hint,$hint_val"."\n"; 
    4957    } 
    5058  } else if ($dnd_mode == 'dnd') { 
  • modules/branches/2.9/campon/functions.inc.php

    r11338 r11342  
    234234  $ext->add($id, $c, '', new ext_playback('beep')); 
    235235  $ext->add($id, $c, '', new ext_macro('hangupcall')); 
     236} 
     237 
     238function campon_toggle($c) { 
     239  global $ext; 
     240  global $amp_conf; 
     241 
     242  $id = "app-campon-toggle"; // The context to be included 
     243  $hint_context = 'ext-local'; 
     244 
     245  $ext->addInclude('from-internal-additional', $id); // Add the include from from-internal 
     246  $ext->add($id, $c, '', new ext_answer('')); 
     247  $ext->add($id, $c, '', new ext_set('CCSS_SETUP', 'TRUE')); // keep from calling normal sub-ccss 
     248  $ext->add($id, $c, '', new ext_macro('user-callerid')); 
     249  $ext->add($id, $c, '', new ext_execif('$["${EXTENSION_STATE(' . $c . '${AMPUSER}@' . $hint_context . ')}" = "INUSE"]','CallCompletionCancel','','CallCompletionRequest','')); 
     250  $ext->add($id, $c, '', new ext_noop_trace('CC_REQUEST_RESULT: ${CC_REQUEST_RESULT} CC_REQUEST_REASON: ${CC_REQUEST_REASON}')); 
     251  $ext->add($id, $c, '', new ext_noop_trace('CC_CANCEL_RESULT: ${CC_CANCEL_RESULT} CC_CANCEL_REASON: ${CC_CANCEL_REASON}')); 
     252  $ext->add($id, $c, '', new ext_playback('beep')); 
     253  $ext->add($id, $c, '', new ext_macro('hangupcall')); 
     254 
     255  $ext->addGlobal('CAMPONTOGGLE',$c); 
     256 
     257  $userlist = core_users_list(); 
     258  if (is_array($userlist)) { 
     259    foreach($userlist as $item) { 
     260      $hint_code = $c.$item[0]; 
     261      $ext->add($hint_context, $hint_code, '', new ext_goto('1',$c,$id)); 
     262      if (!$amp_conf['DYNAMICHINTS']) { 
     263        $devices = core_hint_get($item[0]); 
     264        $dev_arr = explode('&',$devices); 
     265        $hint_val = 'ccss:'.implode('&ccss:',$dev_arr); 
     266        $ext->addHint($hint_context, $hint_code, $hint_val); 
     267      } 
     268    } 
     269  } 
    236270} 
    237271 
  • modules/branches/2.9/campon/install.php

    r11338 r11342  
    2121unset($fcc); 
    2222 
     23// TODO: do I make this dependant on a patch 
     24// 
     25// Camp-On Toggle Feature Code 
     26$fcc = new featurecode('campon', 'toggle'); 
     27$fcc->setDescription('Camp-On Toggle'); 
     28$fcc->setDefault('*84'); 
     29$fcc->update(); 
     30unset($fcc); 
     31 
    2332$freepbx_conf =& freepbx_conf::create(); 
    2433 
  • modules/branches/2.9/core/agi-bin/user_login_out.agi

    r9667 r11342  
    5252  $que_devstate = get_var( "QUEDEVSTATE" ) == "TRUE" ? true : false; 
    5353  $intercom_code = get_var( "INTERCOMCODE" ); 
     54  $campon_toggle = get_var( "CAMPONTOGGLE" ); 
    5455 
    5556  $ast_version14 = version_compare($ast_version, "1.4", "ge"); 
     
    278279    global $dnd_devstate; 
    279280    global $intercom_code; 
     281    global $campon_toggle; 
    280282    global $ast_version14; 
    281283 
     
    285287    if ($devices) { 
    286288      $dial_string = get_dial_string($devices); 
     289 
     290      if ($campon_toggle != 'nocampon' && $campon_toggle != '') { 
     291        $dev_arr = explode('&',$dial_string); 
     292        $hint_val = 'ccss:'.implode('&ccss:',$dev_arr); 
     293        $response = $astman->send_request('Command',array('Command'=>$dp_pre."add extension {$campon_toggle}{$user},hint,{$hint_val} into ext-local replace")); 
     294      } 
    287295      if ($dnd_devstate) { 
    288296        $dial_string .= "&Custom:DND$user"; 
     
    298306      if ($intercom_code != 'nointercom' && $intercom_code != '') { 
    299307        $response = $astman->send_request('Command',array('Command'=>$dp_pre."remove extension {$intercom_code}{$user}@ext-local hint")); 
     308      } 
     309      if ($campon_toggle != 'nocampon' && $campon_toggle != '') { 
     310        $response = $astman->send_request('Command',array('Command'=>$dp_pre."remove extension {$campon_toggle}{$user}@ext-local hint")); 
    300311      } 
    301312    } 
  • modules/branches/2.9/core/functions.inc.php

    r11306 r11342  
    219219      $ver16 = false; 
    220220    } 
     221    // TODO: Temporary Kludge until CCSS is fixed 
     222    // 
     223    if (version_compare($ast_version, "1.8", "ge")) { 
     224      $cc_monitor_policy = "cc_monitor_policy=generic\n"; 
     225    } else { 
     226      $cc_monitor_policy = ""; 
     227    } 
    221228 
    222229    $sql = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1"; 
     
    350357            $output .= $faxdetect; 
    351358          } 
     359          if ($cc_monitor_policy) { 
     360            $output .= $cc_monitor_policy; 
     361          } 
    352362      } 
    353363      $output .= $additional."\n"; 
     
    12821292      $intercom_code = ($intercom_code == '') ? 'nointercom' : $intercom_code; 
    12831293 
     1294      $fcc = new featurecode('campon', 'toggle'); 
     1295      $campon_toggle = $fcc->getCodeActive(); 
     1296      unset($fcc); 
     1297 
     1298      $campon_toggle = ($campon_toggle == '') ? 'nocampon' : $campon_toggle; 
     1299 
    12841300      // Pass the code so agi scripts like user_login_logout know to generate hints 
    12851301      // 
     
    12881304      if ($amp_conf['DYNAMICHINTS']) { 
    12891305        if ($amp_conf['USEDEVSTATE'] && function_exists('donotdisturb_get_config')) { 
    1290           $add_dnd = ' dnd'; 
     1306          $add_dnd = 'dnd'; 
    12911307        } else { 
    12921308          $add_dnd = ''; 
    12931309        } 
    1294         $ext->addExec('ext-local',$amp_conf['AMPBIN'].'/generate_hints.php '.$intercom_code.$add_dnd); 
     1310        $ext->addExec('ext-local',$amp_conf['AMPBIN'].'/generate_hints.php '.$intercom_code.' '.$campon_toggle .' '.$add_dnd); 
    12951311      } 
    12961312      $userlist = core_users_list();