Changeset 6026

Show
Ignore:
Timestamp:
07/15/08 20:05:28 (5 years ago)
Author:
p_lindheimer
Message:

#2908 change hints to associate with device not user, requires some core changes for deviceanduser login/off

Files:

Legend:

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

    r6013 r6026  
    99  switch($engine) { 
    1010    case "asterisk": 
     11      if ($amp_conf['USEDEVSTATE']) { 
     12        $ext->addGlobal('FMDEVSTATE','TRUE'); 
     13      } 
    1114 
    1215      $fcc = new featurecode('findmefollow', 'fmf_toggle'); 
     
    2124      $ext->addInclude('from-internal-additional','fmgrps'); 
    2225      $contextname = 'ext-findmefollow'; 
     26 
     27      // Before creating all the contexts, let's make a list of hints if needed 
     28      // 
     29      if ($amp_conf['USEDEVSTATE'] && $fmf_code != '') { 
     30        $device_list = core_devices_list("all", false, true); 
     31        foreach ($device_list as $device) { 
     32          $ext->add($contextname, $fmf_code.$device['id'], '', new ext_goto("1",$fmf_code,"app-fmf-toggle")); 
     33          $ext->addHint($contextname, $fmf_code.$device['id'], "Custom:FOLLOWME".$device['id']); 
     34        } 
     35      } 
     36 
    2337      $ringlist = findmefollow_full_list(); 
    2438      if (is_array($ringlist)) { 
     
    4761            $sops = sql("SELECT value from globals where variable='DIAL_OPTIONS'", "getRow"); 
    4862            $dialopts = "m(${ringing})".str_replace('r', '', $sops[0]); 
    49           } 
    50  
    51           if ($fmf_code != '') { 
    52             $ext->add($contextname, $fmf_code.$grpnum, '', new ext_goto("1",$fmf_code,"app-fmf-toggle")); 
    53             if ($amp_conf['USEDEVSTATE']) { 
    54               $ext->addHint($contextname, $fmf_code.$grpnum, "Custom:FOLLOWME".$grpnum); 
    55             } 
    5663          } 
    5764 
     
    429436  $ext->add($id, $c, 'deactivate', new ext_setvar('DB(AMPUSER/${AMPUSER}/followme/ddial)', 'EXTENSION')); 
    430437  if ($amp_conf['USEDEVSTATE']) { 
    431     $ext->add($id, $c, '', new ext_setvar('DEVSTATE(Custom:FOLLOWME${AMPUSER})', 'NOT_INUSE')); 
     438    $ext->add($id, $c, '', new ext_setvar('STATE', 'NOT_INUSE')); 
     439    $ext->add($id, $c, '', new ext_gosub('1', 'sstate')); 
     440    //$ext->add($id, $c, '', new ext_setvar('DEVSTATE(Custom:FOLLOWME${AMPUSER})', 'NOT_INUSE')); 
    432441  } 
    433442  $ext->add($id, $c, 'end', new ext_playback('followme&de-activated')); 
     
    436445  $ext->add($id, $c, 'activate', new ext_setvar('DB(AMPUSER/${AMPUSER}/followme/ddial)', 'DIRECT')); 
    437446  if ($amp_conf['USEDEVSTATE']) { 
    438     $ext->add($id, $c, '', new ext_setvar('DEVSTATE(Custom:FOLLOWME${AMPUSER})', 'INUSE')); 
     447    $ext->add($id, $c, '', new ext_setvar('STATE', 'INUSE')); 
     448    $ext->add($id, $c, '', new ext_gosub('1', 'sstate')); 
     449    //$ext->add($id, $c, '', new ext_setvar('DEVSTATE(Custom:FOLLOWME${AMPUSER})', 'INUSE')); 
    439450  } 
    440451  $ext->add($id, $c, '', new ext_playback('followme&activated')); 
    441452  $ext->add($id, $c, '', new ext_macro('hangupcall')); 
    442453 
    443 
    444  
     454  if ($amp_conf['USEDEVSTATE']) { 
     455  $c = 'sstate'; 
     456    $ext->add($id, $c, '', new ext_dbget('DEVICES','AMPUSER/${AMPUSER}/device')); 
     457    $ext->add($id, $c, '', new ext_gotoif('$["${DEVICES}" = "" ]', 'return')); 
     458    $ext->add($id, $c, '', new ext_setvar('LOOPCNT', '${FIELDQTY(DEVICES,&)}')); 
     459    $ext->add($id, $c, '', new ext_setvar('ITER', '1')); 
     460    $ext->add($id, $c, 'begin', new ext_setvar('DEVSTATE(Custom:FOLLOWME${CUT(DEVICES,&,${ITER})})','${STATE}')); 
     461    $ext->add($id, $c, '', new ext_setvar('ITER', '$[${ITER} + 1]')); 
     462    $ext->add($id, $c, '', new ext_gotoif('$[${ITER} <= ${LOOPCNT}]', 'begin')); 
     463    $ext->add($id, $c, 'return', new ext_return()); 
     464  } 
     465
    445466?>