Changeset 6009

Show
Ignore:
Timestamp:
07/14/08 17:01:02 (4 years ago)
Author:
p_lindheimer
Message:

#2510 - fix directed call pickup to work with extensions whether they come in from inside, outside or ringgoups

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5/core/functions.inc.php

    r5981 r6009  
    695695      // Call pickup using app_pickup - Note that '**xtn' is hard-coded into the GXPs and SNOMs as a number to dial 
    696696      // when a user pushes a flashing BLF.  
     697      // 
     698      // We need to add ringgoups to this so that if an extension is part of a ringgroup, we can try to pickup that 
     699      // extension by trying the ringgoup which is what the pickup application is going to respond to. 
     700      // 
     701      // NOTICE: this may be confusing, we check if this is a BRI build of Asterisk and use dpickup instead of pickup 
     702      //         if it is. So we simply assign the varaible $ext_pickup which one it is, and use that variable when 
     703      //         creating all the extnesions below. So those are "$ext_pickup" on purpose! 
     704      // 
    697705      if ($fc_pickup != '') { 
    698706        $ext->addInclude('from-internal-additional', 'app-pickup'); 
    699707        $fclen = strlen($fc_pickup); 
    700708        $ext->add('app-pickup', "_$fc_pickup.", '', new ext_NoOp('Attempt to Pickup ${EXTEN:'.$fclen.'} by ${CALLERID(num)}')); 
    701         if (strstr($version, 'BRI'))  
    702           $ext->add('app-pickup', "_$fc_pickup.", '', new ext_dpickup('${EXTEN:'.$fclen.'}')); 
    703         else 
    704           $ext->add('app-pickup', "_$fc_pickup.", '', new ext_pickup('${EXTEN:'.$fclen.'}')); 
     709        $ext_pickup = (strstr($version, 'BRI')) ? 'ext_dpickup' : 'ext_pickup'; 
     710        $ext->add('app-pickup', "_$fc_pickup.", '', new $ext_pickup('${EXTEN:'.$fclen.'}')); 
     711        $ext->add('app-pickup', "_$fc_pickup.", '', new $ext_pickup('${EXTEN:'.$fclen.'}@from-internal')); 
     712        $ext->add('app-pickup', "_$fc_pickup.", '', new $ext_pickup('${EXTEN:'.$fclen.'}@from-did-direct')); 
     713        // In order to do call pickup in ringgroups, we will need to try the ringgoup number 
     714        // when doing call pickup for that ringgoup so we must see who is a member of what ringgroup 
     715        // and then generate the dialplan 
     716        // 
     717        if (function_exists('ringgroups_list')) { 
     718          $rg_members = array(); 
     719          $rg_list = ringgroups_list(true); 
     720          foreach ($rg_list as $item) { 
     721            $thisgrp = ringgroups_get($item['grpnum']); 
     722            $grpliststr = $thisgrp['grplist']; 
     723            $grplist = explode("-", $grpliststr); 
     724            foreach ($grplist as $exten) { 
     725              if (strpos($exten,"#") === false) { 
     726                $rg_members[$exten][] = $item['grpnum']; 
     727              } 
     728            } 
     729          } 
     730          // Now we have a hash of extensions and what ringgoups they are members of 
     731          // so we need to generate the callpickup dialplan for these specific extensions 
     732          // to try the ringgoup. 
     733          foreach ($rg_members as $exten => $grps) { 
     734            $ext->add('app-pickup', "$fc_pickup".$exten, '', new $ext_pickup($exten)); 
     735            $ext->add('app-pickup', "$fc_pickup".$exten, '', new $ext_pickup($exten.'@from-internal')); 
     736            $ext->add('app-pickup', "$fc_pickup".$exten, '', new $ext_pickup($exten.'@from-did-direct')); 
     737            foreach ($grps as $grp) { 
     738              $ext->add('app-pickup', "$fc_pickup".$exten, '', new $ext_pickup($grp.'@from-internal')); 
     739            } 
     740          } 
     741        } 
     742        $ext->add('app-pickup', "$fc_pickup".$exten, '', new ext_hangup('')); 
    705743      } 
    706744