Changeset 11036

Show
Ignore:
Timestamp:
01/20/11 14:17:22 (2 years ago)
Author:
p_lindheimer
Message:

closes #4752 adds outbound concurrency limit options to extensions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/libfreepbx.install.php

    r11033 r11036  
    718718  $freepbx_conf->define_conf_setting('CFRINGTIMERDEFAULT',$set); 
    719719  unset($opts);   
     720  
     721  // CONCURRENCYLIMITDEFAULT 
     722  $opts = array(); 
     723  for ($i=0;$i<=120;$i++) { 
     724      $opts[]=$i; 
     725  } 
     726  $set['value'] = '0'; 
     727  $set['options'] = $opts; 
     728  $set['name'] = 'Extension Concurrency Limit'; 
     729  $set['description'] = 'Default maximum number of outbound simultaneous calls that an extension can make. This is also very useful as a Security Protection against a system that has been compromised. It will limit the number of simultaneous calls that can be made on the compromised extension. This default is used when an extension is created. A default of 0 means no limit.'; 
     730  $set['emptyok'] = 0; 
     731  $set['type'] = CONF_TYPE_SELECT; 
     732  $freepbx_conf->define_conf_setting('CONCURRENCYLIMITDEFAULT',$set); 
     733  unset($opts);   
    720734 
    721735  // 
  • modules/branches/2.9/core/functions.inc.php

    r11023 r11036  
    17901790          // CID part of the dialplan will not get executed 
    17911791          if (!isset($add_extra_pri1[$fpattern['base_pattern']])) { 
    1792             $ext->add($context, $fpattern['base_pattern'], '', new ext_macro('user-callerid,SKIPTTL'));  
     1792            $ext->add($context, $fpattern['base_pattern'], '', new ext_macro('user-callerid,LIMIT'));  
    17931793            $add_extra_pri1[$fpattern['base_pattern']] = true; 
    17941794          } 
    17951795          if ($fpattern['base_pattern'] != $exten) { 
    1796             $ext->add($context, $exten, '', new ext_macro('user-callerid,SKIPTTL'));  
     1796            $ext->add($context, $exten, '', new ext_macro('user-callerid,LIMIT'));  
    17971797          } 
    17981798          $ext->add($context, $exten, '', new ext_noop_trace(sprintf(_('Calling Out Route: %s'),$route['name']),1));  
     
    23372337      $ext->add($context, $exten, '', new ext_set('AMPUSERCID', '${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}" = "1"]?${DB_RESULT}:${AMPUSER})}')); 
    23382338      $ext->add($context, $exten, '', new ext_set('CALLERID(all)', '"${AMPUSERCIDNAME}" <${AMPUSERCID}>')); 
     2339 
     2340      $ext->add($context, $exten, '', new ext_noop_trace('Current Concurrency Count for ${AMPUSER}: ${GROUP_COUNT(${AMPUSER}@concurrency_limit)}, User Limit: ${DB(AMPUSER/${AMPUSER}/concurrency_limit)}')); 
     2341      $ext->add($context, $exten, '', new ext_gotoif('$["${ARG1}"="LIMIT" & ${LEN(${AMPUSER})} & "${DB(AMPUSER/${AMPUSER}/concurrency_limit)}">"0" & ${GROUP_COUNT(${AMPUSER}@concurrency_limit)}>=${DB(AMPUSER/${AMPUSER}/concurrency_limit)}]', 'limit')); 
     2342      $ext->add($context, $exten, '', new ext_execif('$["${ARG1}"="LIMIT" & ${LEN(${AMPUSER})}]', 'Set', 'GROUP(concurrency_limit)=${AMPUSER}')); 
    23392343      /* 
    23402344       * This is where to splice in things like setting the language based on a user's astdb setting, 
    23412345       * or where you might set the CID account code based on a user instead of the device settings. 
    23422346       */ 
    2343       $ext->add($context, $exten, 'report', new ext_gotoif('$[ "${ARG1}" = "SKIPTTL" ]', 'continue')); 
     2347 
     2348      $ext->add($context, $exten, 'report', new ext_gotoif('$[ "${ARG1}" = "SKIPTTL" | "${ARG1}" = "LIMIT" ]', 'continue')); 
    23442349      $ext->add($context, $exten, 'report2', new ext_set('__TTL', '${IF($["foo${TTL}" = "foo"]?64:$[ ${TTL} - 1 ])}')); 
    23452350      $ext->add($context, $exten, '', new ext_gotoif('$[ ${TTL} > 0 ]', 'continue')); 
    23462351      $ext->add($context, $exten, '', new ext_wait('${RINGTIMER}'));  // wait for a while, to give it a chance to be picked up by voicemail 
    23472352      $ext->add($context, $exten, '', new ext_answer()); 
    2348       $ext->add($context, $exten, '', new ext_wait('2')); 
     2353      $ext->add($context, $exten, '', new ext_wait('1')); 
    23492354      $ext->add($context, $exten, '', new ext_playback('im-sorry&an-error-has-occured&with&call-forwarding')); 
     2355      $ext->add($context, $exten, '', new ext_macro('hangupcall')); 
     2356      $ext->add($context, $exten, 'limit', new ext_answer()); 
     2357      $ext->add($context, $exten, '', new ext_wait('1')); 
     2358      $ext->add($context, $exten, '', new ext_playback('beep&im-sorry&your&simul-call-limit-reached&goodbye')); 
    23502359      $ext->add($context, $exten, '', new ext_macro('hangupcall')); 
    23512360      $ext->add($context, $exten, '', new ext_congestion(20)); 
     
    45344543    $astman->database_put("AMPUSER",$extension."/ringtimer",isset($ringtimer)?$ringtimer:''); 
    45354544    $astman->database_put("AMPUSER",$extension."/cfringtimer",isset($cfringtimer)?$cfringtimer:0); 
     4545    $astman->database_put("AMPUSER",$extension."/concurrency_limit",isset($concurrency_limit)?$concurrency_limit:0); 
    45364546    $astman->database_put("AMPUSER",$extension."/noanswer",isset($noanswer)?$noanswer:''); 
    45374547    $astman->database_put("AMPUSER",$extension."/recording",isset($recording)?$recording:''); 
     
    46514661   
    46524662    $results['cfringtimer'] = (int) $astman->database_get("AMPUSER",$extension."/cfringtimer"); 
     4663    $results['concurrency_limit'] = (int) $astman->database_get("AMPUSER",$extension."/concurrency_limit"); 
    46534664  } else { 
    46544665    die_freepbx("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
     
    58715882    $currentcomponent->addoptlistitem('cfringtime', '0', _("Default")); 
    58725883    $currentcomponent->addoptlistitem('cfringtime', '-1', _("Always")); 
     5884    $currentcomponent->addoptlistitem('concurrency_limit', '0', _("No Limit")); 
    58735885    for ($i=1; $i <= 120; $i++) { 
    58745886      $currentcomponent->addoptlistitem('ringtime', "$i", "$i"); 
    58755887      $currentcomponent->addoptlistitem('cfringtime', "$i", "$i"); 
     5888      $currentcomponent->addoptlistitem('concurrency_limit', "$i", "$i"); 
    58765889    } 
    58775890    $currentcomponent->setoptlistopts('ringtime', 'sort', false); 
    58785891    $currentcomponent->setoptlistopts('cfringtime', 'sort', false); 
     5892    $currentcomponent->setoptlistopts('concurrency_limit', 'sort', false); 
    58795893 
    58805894    // Special CID handling to deal with Private, etc. 
     
    60526066      } 
    60536067    } 
     6068 
     6069    $concurrency_limit = isset($concurrency_limit) ? $concurrency_limit : $amp_conf['CONCURRENCYLIMITDEFAULT']; 
     6070    $currentcomponent->addguielem($section, new gui_selectbox('concurrency_limit', $currentcomponent->getoptlist('concurrency_limit'), $concurrency_limit, _("Outbound Councurrency Limit"), _("Maximum number of outbound simultaneous calls that an extension can make. This is also very useful as a Security Protection against a system that has been compromised. It will limit the number of simultaneous calls that can be made on the compromised extension."), false)); 
     6071 
    60546072    $currentcomponent->addguielem($section, new gui_selectbox('callwaiting', $currentcomponent->getoptlist('callwaiting'), $callwaiting, _("Call Waiting"), _("Set the initial/current Call Waiting state for this user's extension"), false)); 
    60556073    if (function_exists('paging_get_config')) {