Changeset 12942

Show
Ignore:
Timestamp:
11/09/11 13:27:55 (2 years ago)
Author:
mbrevda
Message:

closes #5443 - paging improvements, revert some accidental checkins. Bugs/more features in NEW tickets please

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/backup/page.backup.php

    r12848 r12942  
    6262    } 
    6363 
    64     ob_start(); 
     64    ob_start($amp_conf['buffering_callback']); 
    6565    header('Content-Type: text/event-stream'); 
    6666    header('Cache-Control: no-cache'); 
  • modules/branches/2.10/package.php

    r12903 r12942  
    9090foreach ($vars['modules'] as $mod) { 
    9191  $mod    = trim($mod, '/'); 
    92   $tar_dir  = $mod; 
     92  $mod_dir  = dirname(__FILE__) . '/' . $mod; 
     93  $tar_dir  = $mod_dir; 
    9394  $exclude[]  = '.*'; 
    9495  $files    = 
     
    102103   
    103104  echo 'Packaging ' . $mod . '...' . PHP_EOL; 
    104   if (!file_exists($mod . '/module.xml')) { 
    105     echo $mod . '/module.xml dose not exists, ' . $mod . ' will not be built!' . PHP_EOL; 
     105  if (!file_exists($mod_dir . '/module.xml')) { 
     106    echo $mod_dir . '/module.xml dose not exists, ' . $mod . ' will not be built!' . PHP_EOL; 
    106107    continue; 
    107108  } 
    108   $xml = file_get_contents($mod . '/module.xml'); 
     109  $xml = file_get_contents($mod_dir . '/module.xml'); 
    109110   
    110111  //test xml file and get some of its values 
     
    124125   
    125126  //include module specifc hook, if present 
    126   if (file_exists($mod . '/' . 'package_hook.php')) { 
    127     echo 'Running ' . $mod . '/' . 'package_hook.php...' . PHP_EOL; 
     127  if (file_exists($mod_dir . '/' . 'package_hook.php')) { 
     128    echo 'Running ' . $mod_dir . '/' . 'package_hook.php...' . PHP_EOL; 
    128129     
    129130    //test include so that includes can return false and prevent further execution if it fail 
    130     if (!include($mod . '/' . 'package_hook.php')) { 
    131       echo '[FATAL] retrurned from ' . $mod . '/' . 'package_hook.php with an error, '  
     131    if (!include($mod_dir . '/' . 'package_hook.php')) { 
     132      echo '[FATAL] retrurned from ' . $mod_dir . '/' . 'package_hook.php with an error, '  
    132133        . $mod . ' wont be built' . PHP_EOL; 
    133134        continue; 
     
    157158   
    158159  //check php files for syntax errors 
    159   $bail = false; 
    160   $files = scandirr($mod, true, $file_scan_exclude_list); 
    161   foreach ($files as $f) { 
    162     if (pathinfo($f, PATHINFO_EXTENSION) == 'php') { 
    163       $ret_val = 0; 
    164       system('php -l ' . $f, $ret_val); 
    165       if ($ret_val != 0) { 
    166         echo('syntax error detected in ' . $f . ',' .  $mod . ' won\'t be packaged' . PHP_EOL); 
    167         $bail=true; // finish scanning all files before bailing 
     160  if ($vars['checkphp']) { 
     161    var_dump($tar_dir); 
     162    $files = scandirr($tar_dir, true, $file_scan_exclude_list); 
     163    foreach ($files as $f) { 
     164      if (pathinfo($f, PATHINFO_EXTENSION) == 'php') { 
     165        $ret_val = 0; 
     166        system('php -l ' . $f, $ret_val); 
     167        if ($ret_val != 0) { 
     168          echo('syntax error detected in ' . $f . ', ' .  $mod . ' won\'t be packaged' . PHP_EOL); 
     169          continue 2; 
     170        } 
    168171      } 
    169172    } 
    170   } 
    171   if ($bail && $vars['checkphp']) { 
    172     echo('syntax error detecteded in ' .  $mod . ' skipping packaging going to next' . PHP_EOL); 
    173     continue; 
     173    unset($files, $list); 
    174174  } 
    175175   
    176176  //check in any out standing files 
    177   if (run_cmd('svn st ' . $mod . '|wc -l') > 0) { 
    178     run_cmd('svn ci -m "Auto Check-in of any outstanding changes in ' . $mod . '" ' . $mod); 
     177  if (run_cmd('svn st ' . $mod_dir . '|wc -l') > 0) { 
     178    run_cmd('svn ci -m "Auto Check-in of any outstanding changes in ' . $mod . '" ' . $mod_dir); 
    179179  } 
    180180   
     
    190190  //tell tar to change directoires (-C) to one level above 
    191191  $tar_dir_path   = explode('/', trim($tar_dir, '/')); 
    192   $tar_dir        = (is_array($tar_dir_path) && (count($tar_dir_path) > 1))? array_pop($tar_dir_path) : $mod
     192  $tar_dir        = (is_array($tar_dir_path) && (count($tar_dir_path) > 1))? array_pop($tar_dir_path) : $mod_dir
    193193  $tar_dir_path   = (is_array($tar_dir_path) && (count($tar_dir_path) > 1))  
    194194          ? ' -C /' . implode('/', $tar_dir_path) : ''; 
     
    196196   
    197197  //update md5 sum 
    198   $module_xml = file_get_contents($mod . '/' . 'module.xml'); 
     198  $module_xml = file_get_contents($mod_dir . '/' . 'module.xml'); 
    199199  if(file_exists($filename)) { 
    200200    $md5 = md5_file($filename); 
     
    209209  } 
    210210 
    211   file_put_contents($mod . '/' . 'module.xml', $module_xml); 
     211  file_put_contents($mod_dir . '/' . 'module.xml', $module_xml); 
    212212 
    213213   
     
    222222   
    223223  //set latpublished property 
    224   $lastpub = run_cmd('svn info ' . $mod . ' | grep Revision: | awk \'{print $2}\''); 
    225   run_cmd('svn ps lastpublish ' . $lastpub . ' ' . $mod); 
     224  $lastpub = run_cmd('svn info ' . $mod_dir . ' | grep Revision: | awk \'{print $2}\''); 
     225  run_cmd('svn ps lastpublish ' . $lastpub . ' ' . $mod_dir); 
    226226   
    227227  //check in new tarball and module.xml 
    228   run_cmd('svn ci ../../release/' . $vars['rver'] . '/' . $filename . ' ' . $mod  
     228  run_cmd('svn ci ../../release/' . $vars['rver'] . '/' . $filename . ' ' . $mod_dir  
    229229          . ' -m"Module package script: ' . $rawname . ' ' . $ver . '"'); 
    230230           
    231231  //cleanup any remaining files 
    232 /*  foreach($vars['rm_files'] as $f) { 
     232  foreach($vars['rm_files'] as $f) { 
    233233    if (file_exists($f)) { 
    234       run_cmd('rm -rf ' . $f); 
    235     } 
    236   }*/ 
    237   echo $mod . ' version ' . $ver . ' has been successfully packaged!' . PHP_EOL; 
     234      //run_cmd('rm -rf ' . $f); 
     235    } 
     236  } 
     237  echo $mod . ' version ' . $ver . ' has been sucsessfuly packaged!' . PHP_EOL; 
    238238   
    239239} 
     
    311311//test xml file for validity and extract some info from it 
    312312function check_xml($mod, $xml) { 
     313  global $mod_dir; 
    313314  //check the xml script integrity 
    314   $xml_contents = file_get_contents($mod . '/' . 'module.xml'); 
     315  $xml_contents = file_get_contents($mod_dir . '/' . 'module.xml'); 
    315316  $xml_loaded_contents = simplexml_load_string($xml_contents); 
    316317  if($xml_loaded_contents === FALSE) {  
    317     echo $mod . '/module.xml seems corrupt, ' . $mod . ' won\'t be packaged' . PHP_EOL; 
     318    echo $mod_dir . '/module.xml seems corrupt, ' . $mod . ' won\'t be packaged' . PHP_EOL; 
    318319    return array(false, false); 
    319320  } 
     
    321322  //check that module name is set in module.xml 
    322323  if (!preg_match('/<rawname>(.*?)<\/rawname>/', $xml, $rawname)) { 
    323     echo $mod . '/module.xml is missing a module name, ' . $mod . ' won\'t be packaged' . PHP_EOL; 
     324    echo $mod_dir . '/module.xml is missing a module name, ' . $mod . ' won\'t be packaged' . PHP_EOL; 
    324325    $rawname = false; 
    325326  } else { 
     
    329330  //check that module version is set in module.xml 
    330331  if (!preg_match('/<version>(.*?)<\/version>/', $xml, $version)) { 
    331     echo $mod . '/module.xml is missing a version number, ' . $mod . ' won\'t be packaged' . PHP_EOL; 
     332    echo $mod_dir . '/module.xml is missing a version number, ' . $mod . ' won\'t be packaged' . PHP_EOL; 
    332333    $ver = false; 
    333334  } else { 
  • modules/branches/2.10/paging/functions.inc.php

    r11761 r12942  
    3838      $callinfo  = 'Call-Info: <uri>\;answer-after=0'; 
    3939      $sipuri    = 'intercom=true'; 
    40       $doptions = 'A(beep)'; 
     40      //$doptions = 'A(beep)'; 
    4141      $vxml_url = ''; 
    4242      $dtime = '5'; 
     
    7373      } 
    7474 
    75       $extpaging = 'ext-paging'; 
     75      $apppaging = 'app-paging'; 
    7676      if (!empty($intercom_code)) { 
    7777        $code = '_'.$intercom_code.'.'; 
     
    130130        $ext->add($context, $code, '', new ext_macro('hangupcall')); 
    131131        if (!$ast_ge_14) { 
    132           $ext->add($context, $code, '', new ext_execif('$[${INTERCOM_RETURN}]', 'Return'),'check',101); 
    133           $ext->add($context, $code, '', new ext_busy()); 
    134           $ext->add($context, $code, '', new ext_macro('hangupcall')); 
     132             $ext->add($context, $code, '', new ext_execif('$[${INTERCOM_RETURN}]', 'Return'),'check',101); 
     133        $ext->add($context, $code, '', new ext_busy()); 
     134        $ext->add($context, $code, '', new ext_macro('hangupcall')); 
    135135        } 
    136136        $ext->add($context, $code, 'pagemode', new ext_setvar('ITER', '1')); 
    137137        $ext->add($context, $code, '', new ext_setvar('DIALSTR', '')); 
    138         $ext->add($context, $code, 'begin', new ext_setvar('DIALSTR', '${DIALSTR}&LOCAL/PAGE${CUT(DEVICES,&,${ITER})}@'.$extpaging)); 
     138        $ext->add($context, $code, 'begin', new ext_setvar('DIALSTR', '${DIALSTR}&LOCAL/PAGE${CUT(DEVICES,&,${ITER})}@'.$apppaging)); 
    139139        $ext->add($context, $code, '', new ext_setvar('ITER', '$[${ITER} + 1]')); 
    140140        $ext->add($context, $code, '', new ext_gotoif('$[${ITER} <= ${LOOPCNT}]', 'begin')); 
     
    142142        $ext->add($context, $code, '', new ext_setvar('_AMPUSER', '${AMPUSER}')); 
    143143        $ext->add($context, $code, '', new ext_page('${DIALSTR},d')); 
    144         $ext->add($context, $code, '', new ext_execif('$[${INTERCOM_RETURN}]', 'Return')); 
     144           $ext->add($context, $code, '', new ext_execif('$[${INTERCOM_RETURN}]', 'Return')); 
    145145        $ext->add($context, $code, '', new ext_busy()); 
    146146        $ext->add($context, $code, '', new ext_macro('hangupcall')); 
    147147 
    148148        $ext->add($context, $code, 'nointercom', new ext_noop('Intercom disallowed by ${dialnumber}')); 
    149         $ext->add($context, $code, '', new ext_execif('$[${INTERCOM_RETURN}]', 'Return')); 
     149           $ext->add($context, $code, '', new ext_execif('$[${INTERCOM_RETURN}]', 'Return')); 
    150150        $ext->add($context, $code, '', new ext_playback('intercom&for&extension')); 
    151151        $ext->add($context, $code, '', new ext_saydigits('${dialnumber}')); 
     
    324324        $ext->add($macro, "s", 'macro2', new ext_macro('${ANSWERMACRO}','${ARG1}'), 'n',2); 
    325325      } 
    326  
    327  
    328       // Create the paging context that is used in the paging application for each phone to auto-answer 
    329       // 
    330       $ext->addInclude('from-internal-noxfer-additional',$extpaging); 
    331          
     326       
     327      //auto answer stuff 
     328      //set autoanswer variables 
     329      $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_SIPURI', '')); 
     330      if (isset($alertinfo) && trim($alertinfo) != "") { 
     331              $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_ALERTINFO', $alertinfo)); 
     332      } 
     333       
     334      if (isset($callinfo) && trim($callinfo) != "") { 
     335              $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_CALLINFO', $callinfo)); 
     336      } 
     337      if (isset($sipuri) && trim($sipuri) != "") { 
     338              $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_SIPURI', $sipuri)); 
     339      } 
     340      if (isset($vxml_url) && trim($vxml_url) != "") { 
     341              $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_VXML_URL', $vxml_url)); 
     342      } 
     343      if (isset($doptions) && trim($doptions) != "") { 
     344              $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_DOPTIONS', $doptions)); 
     345      } 
     346      $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_DTIME', $dtime)); 
     347      $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_ANSWERMACRO', '')); 
     348      foreach ($custom_vars as $key => $value) { 
     349              $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_'.ltrim($key,'_'), $value)); 
     350      } 
     351      $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('__FORWARD_CONTEXT', 'block-cf')); 
     352      $ext->add($apppaging, '_AUTOASWER.', '', new ext_macro('autoanswer','${EXTEN:9}')); 
     353      $ext->add($apppaging, '_AUTOASWER.', '', new ext_return()); 
     354       
    332355      // Normal page version 
    333       $ext->add($extpaging, "_PAGE.", '', new ext_gotoif('$[ ${AMPUSER} = ${EXTEN:4} ]','skipself')); 
    334       if ($ast_ge_14) { 
    335         $ext->add($extpaging, "_PAGE.", 'AVAIL', new ext_chanisavail('${DB(DEVICE/${EXTEN:4}/dial)}', 's')); 
    336         $ext->add($extpaging, "_PAGE.", '', new ext_noop_trace('AVAILCHAN: ${AVAILCHAN}, AVAILORIGCHAN: ${AVAILORIGCHAN}, AVAILSTATUS: ${AVAILSTATUS}',5)); 
    337         $ext->add($extpaging, "_PAGE.", '', new ext_gotoif('$["${AVAILORIGCHAN}" = ""]', 'skipself'));       
    338       } else { 
    339         $ext->add($extpaging, "_PAGE.", 'AVAIL', new ext_chanisavail('${DB(DEVICE/${EXTEN:4}/dial)}', 'js')); 
    340       } 
    341       $ext->add($extpaging, "_PAGE.", '', new ext_gotoif('$["${DB(DND/${DB(DEVICE/${EXTEN:4}/user)})}" = "YES"]', 'skipself'));      
    342       $ext->add($extpaging, "_PAGE.", 'SKIPCHECK', new ext_macro('autoanswer','${EXTEN:4}')); 
    343       $ext->add($extpaging, "_PAGE.", '', new ext_dial('${DIAL}','${DTIME},${DOPTIONS}')); 
    344       $ext->add($extpaging, "_PAGE.", 'skipself', new ext_hangup()); 
    345       if (!$ast_ge_14) { 
    346         $ext->add($extpaging, "_PAGE.", '', new ext_hangup(''), 'AVAIL',101); 
    347       } 
     356      $ext->add($apppaging, "_PAGE.", '', new ext_gotoif('$[ "${AMPUSER}" = "${EXTEN:4}" ]','skipself')); 
     357      $ext->add($apppaging, "_PAGE.", 'AVAIL', new ext_chanisavail('${DB(DEVICE/${EXTEN:4}/dial)}', 'js')); 
     358      $ext->add($apppaging, "_PAGE.", '', new ext_gotoif('$["${DB(DND/${DB(DEVICE/${EXTEN:4}/user)})}" = "YES"]', 'skipself'));      
     359      $ext->add($apppaging, "_PAGE.", 'SKIPCHECK', new ext_gosub('AUTOASWER${EXTEN:4},1')); 
     360      $ext->add($apppaging, "_PAGE.", '', new ext_dial('${DIAL}','${DTIME},${DOPTIONS}')); 
     361      $ext->add($apppaging, "_PAGE.", 'skipself', new ext_hangup()); 
     362      $ext->add($apppaging, "_PAGE.", '', new ext_hangup(''), 'AVAIL',101); 
    348363 
    349364      // Try ChanSpy Version 
    350       $ext->add($extpaging, "_SPAGE.", '', new ext_gotoif('$[ ${AMPUSER} = ${EXTEN:5} ]','skipself')); 
    351       if ($ast_ge_14) { 
    352         $ext->add($extpaging, "_SPAGE.", 'AVAIL', new ext_chanisavail('${DB(DEVICE/${EXTEN:5}/dial)}', 's')); 
    353         $ext->add($extpaging, "_SPAGE.", '', new ext_noop_trace('AVAILCHAN: ${AVAILCHAN}, AVAILORIGCHAN: ${AVAILORIGCHAN}, AVAILSTATUS: ${AVAILSTATUS}',5)); 
    354         $ext->add($extpaging, "_SPAGE.", '', new ext_gotoif('$["${AVAILORIGCHAN}" = ""]', 'chanspy'));       
    355       } else { 
    356         $ext->add($extpaging, "_SPAGE.", 'AVAIL', new ext_chanisavail('${DB(DEVICE/${EXTEN:5}/dial)}', 'js')); 
    357       } 
    358       $ext->add($extpaging, "_SPAGE.", '', new ext_gotoif('$["${DB(DND/${DB(DEVICE/${EXTEN:5}/user)})}" = "YES"]', 'chanspy'));      
    359       $ext->add($extpaging, "_SPAGE.", 'SKIPCHECK', new ext_macro('autoanswer','${EXTEN:5}')); 
    360       $ext->add($extpaging, "_SPAGE.", '', new ext_dial('${DIAL}','${DTIME},${DOPTIONS}')); 
    361       $ext->add($extpaging, "_SPAGE.", 'skipself', new ext_hangup()); 
    362       $ext->add($extpaging, "_SPAGE.", 'chanspy', new ext_execif('$["${CUT(DB(DEVICE/${EXTEN:5}/dial),/,1)}" = "SIP"]', 'ChanSpy','${DB(DEVICE/${EXTEN:5}/dial)}-,qW')); 
    363       $ext->add($extpaging, "_SPAGE.", '', new ext_noop_trace('Comparison: ${EXTEN:5}, "${CUT(DB(DEVICE/${EXTEN:5}/dial),/,1)}" = "SIP"',9)); 
    364       $ext->add($extpaging, "_SPAGE.", '', new ext_hangup()); 
    365       if (!$ast_ge_14) { 
    366         $ext->add($extpaging, "_SPAGE.", '', new ext_hangup(''), 'AVAIL',101); 
    367       } 
     365      $ext->add($apppaging, "_SPAGE.", '', new ext_gotoif('$[ "${AMPUSER}" = "${EXTEN:5}" ]','skipself')); 
     366      $ext->add($apppaging, "_SPAGE.", 'AVAIL', new ext_chanisavail('${DB(DEVICE/${EXTEN:5}/dial)}', 'js')); 
     367      $ext->add($apppaging, "_SPAGE.", '', new ext_gotoif('$["${DB(DND/${DB(DEVICE/${EXTEN:5}/user)})}" = "YES"]', 'chanspy'));      
     368      $ext->add($apppaging, "_SPAGE.", 'SKIPCHECK', new ext_gosub('AUTOASWER${EXTEN:5},1')); 
     369      $ext->add($apppaging, "_SPAGE.", '', new ext_dial('${DIAL}','${DTIME},${DOPTIONS}')); 
     370      $ext->add($apppaging, "_SPAGE.", 'skipself', new ext_hangup()); 
     371      $ext->add($apppaging, "_SPAGE.", 'chanspy', new ext_execif('$["${CUT(DB(DEVICE/${EXTEN:5}/dial),/,1)}" = "SIP"]', 'ChanSpy','${DB(DEVICE/${EXTEN:5}/dial)}-,qW')); 
     372      $ext->add($apppaging, "_SPAGE.", '', new ext_noop_trace('Comparison: ${EXTEN:5}, "${CUT(DB(DEVICE/${EXTEN:5}/dial),/,1)}" = "SIP"',9)); 
     373      $ext->add($apppaging, "_SPAGE.", '', new ext_hangup()); 
     374      $ext->add($apppaging, "_SPAGE.", '', new ext_hangup(''), 'AVAIL',101); 
     375 
    368376 
    369377      // Force page version 
    370       $ext->add($extpaging, "_FPAGE.", '', new ext_gotoif('$[ ${AMPUSER} = ${EXTEN:5} ]','skipself')); 
    371       $ext->add($extpaging, "_FPAGE.", 'SKIPCHECK', new ext_macro('autoanswer','${EXTEN:5}')); 
    372       $ext->add($extpaging, "_FPAGE.", '', new ext_dial('${DIAL}','${DTIME},${DOPTIONS}')); 
    373       $ext->add($extpaging, "_FPAGE.", 'skipself', new ext_hangup()); 
    374  
    375       // 
     378      $ext->add($apppaging, "_FPAGE.", '', new ext_gotoif('$[ "${AMPUSER}" = "${EXTEN:5}" ]','skipself')); 
     379      $ext->add($apppaging, "_FPAGE.", 'SKIPCHECK', new ext_gosub('AUTOASWER${EXTEN:5},1')); 
     380      $ext->add($apppaging, "_FPAGE.", '', new ext_dial('${DIAL}','${DTIME},${DOPTIONS}')); 
     381      $ext->add($apppaging, "_FPAGE.", 'skipself', new ext_hangup()); 
     382       
    376383      // Now get a list of all the paging groups... 
    377384      $sql = "SELECT page_group, force_page, duplex FROM paging_config"; 
     
    394401        $all_exts = $db->getAll($sql); 
    395402        $dialstr=''; 
     403         
     404        // Create the paging context that is used in the paging application for each phone to auto-answer 
     405        //add ext-paging with goto's to our app-paging context and a hint for the page 
     406        $extpaging = 'ext-paging'; 
     407        $ext->add($extpaging, $grp, '', new ext_goto($apppaging . ',' . $grp . ',1')); 
     408        $ext->addInclude('from-internal-noxfer-additional',$extpaging); 
     409        $ext->addHint($extpaging, $grp, 'Custom:PAGE' . $grp); 
     410         
     411        //app-page dialplan 
    396412        foreach($all_exts as $local_dial) { 
    397413          if (strtoupper(substr($local_dial[0],-1)) == "X") { 
    398414            $local_dial[0] = rtrim($local_dial[0],"xX"); 
    399415          } 
    400  
    401           $dialstr .= "LOCAL/$pagemode".trim($local_dial[0])."@".$extpaging."&"; 
    402         } 
    403         // It will always end with an &, so lets take that off. 
    404         $dialstr = rtrim($dialstr, "&"); 
    405  
    406         if ($thisgroup['duplex']) { 
    407           $dialstr .= ",d"; 
    408         } 
    409         $ext->add($extpaging, $grp, '', new ext_answer('')); 
    410         $ext->add($extpaging, $grp, '', new ext_macro('user-callerid')); 
    411         // make AMPUSER inherited here, so we can skip the proper 'self' if using cidnum masquerading 
    412         $ext->add($extpaging, $grp, '', new ext_setvar('_AMPUSER', '${AMPUSER}')); 
    413  
    414         $ext->add($extpaging, $grp, '', new ext_setvar('_SIPURI', '')); 
    415         if (isset($alertinfo) && trim($alertinfo) != "") { 
    416           $ext->add($extpaging, $grp, '', new ext_setvar('_ALERTINFO', $alertinfo)); 
    417         } 
    418         if (isset($callinfo) && trim($callinfo) != "") { 
    419           $ext->add($extpaging, $grp, '', new ext_setvar('_CALLINFO', $callinfo)); 
    420         } 
    421         if (isset($sipuri) && trim($sipuri) != "") { 
    422           $ext->add($extpaging, $grp, '', new ext_setvar('_SIPURI', $sipuri)); 
    423         } 
    424         if (isset($vxml_url) && trim($vxml_url) != "") { 
    425           $ext->add($extpaging, $grp, '', new ext_setvar('_VXML_URL', $vxml_url)); 
    426         } 
    427         if (isset($doptions) && trim($doptions) != "") { 
    428           $ext->add($extpaging, $grp, '', new ext_setvar('_DOPTIONS', $doptions)); 
    429         } 
    430         $ext->add($extpaging, $grp, '', new ext_setvar('_DTIME', $dtime)); 
    431         $ext->add($extpaging, $grp, '', new ext_setvar('_ANSWERMACRO', '')); 
    432         foreach ($custom_vars as $key => $value) { 
    433           $ext->add($extpaging, $grp, '', new ext_setvar('_'.ltrim($key,'_'), $value)); 
    434         } 
    435         $ext->add($extpaging, $grp, '', new ext_setvar('__FORWARD_CONTEXT', 'block-cf')); 
    436  
    437         $ext->add($extpaging, $grp, '', new ext_page($dialstr)); 
    438       } 
     416          $page_memebers[] = "LOCAL/$pagemode".trim($local_dial[0])."@".$apppaging; 
     417 
     418        } 
     419         
     420        $ext->add($apppaging, $grp, '', new ext_macro('user-callerid')); 
     421        $ext->add($apppaging, $grp, '', new ext_setvar('_PAGEGROUP', $grp)); 
     422        $ext->add($apppaging, $grp, '', new ext_setvar('PAGE${PAGEGROUP}ADMIN', 'TRUE')); 
     423         
     424        //if page group it in use, got to busy 
     425        $ext->add($apppaging, $grp, '',  
     426          new ext_gotoif('$[${TRYLOCK(apppaging'. $grp .')}]', '', 'busy')); 
     427         
     428        //set blf to in use 
     429        $ext->add($apppaging, $grp, 'devstate',  
     430          new ext_setvar('DEVICE_STATE(Custom:PAGE' . $grp .')', 'INUSE')); 
     431         
     432        $ext->add($apppaging, $grp, '', new ext_answer('')); 
     433        $ext->add($apppaging, $grp, '', new ext_set('PAGE_CONF', '${EPOCH}${RAND(100,999)}')); 
     434        $ext->add($apppaging, $grp, '',  
     435          new ext_set('PAGE_CONF_OPTS', '1doqsx' . (!$thisgroup['duplex'] ? 'm' : ''))); 
     436        $ext->add($apppaging, $grp, 'agi', new ext_agi('page.agi,' 
     437                        . 'extensions=' . implode(':',$page_memebers) . ',' 
     438                        . 'meetmeopts=${PAGE_CONF}\,${PAGE_CONF_OPTS}\,\,,' 
     439                        . 'AMPUSER=${AMPUSER}' 
     440                        )); 
     441        //we cant use originate from the dialplan as the dialplan command is not asynchronous 
     442        //we would like to though... 
     443        //this code here as a sign of hope -MB 
     444        /*foreach ($page_memebers as $member) { 
     445          $ext->add($apppaging, $grp, 'page', new ext_originate($member,'app','meetme', '${PAGE_CONF}\,${PAGE_CONF_OPTS}')); 
     446        }*/          
     447        unset($page_memebers); 
     448        $ext->add($apppaging, $grp, 'page', new ext_meetme('${PAGE_CONF},doqwxCAG(beep)')); 
     449        $ext->add($apppaging, $grp, '', new ext_hangup()); 
     450        $ext->add($apppaging, $grp, 'busy', new ext_set('PAGE${PAGEGROUP}BUSY', 'TRUE')); 
     451        $ext->add($apppaging, $grp, 'play-busy', new ext_busy(3)); 
     452        $ext->add($apppaging, $grp, 'busy-hang', new ext_goto('ext-paging,h,1')); 
     453         
     454      } 
     455      //h 
     456      $ext->add($apppaging, 'h', '',  
     457        new ext_execif('$[' 
     458                . '$["${PAGE${PAGEGROUP}ADMIN}" = "TRUE"]' 
     459                . ' & $[${ISNULL(${PAGE${PAGEGROUP}BUSY})}]' 
     460                . ']',  
     461                'Set', 'DEVICE_STATE(Custom:PAGE${PAGEGROUP})=NOT_INUSE')); 
    439462       
    440463    break; 
  • modules/branches/2.10/paging/module.xml

    r12563 r12942  
    33  <repo>standard</repo> 
    44  <name>Paging and Intercom</name> 
    5   <version>2.10.0.0</version> 
     5  <version>2.10.0.1</version> 
    66  <publisher>FreePBX</publisher> 
    77  <license>GPLv2+</license> 
    88  <category>Applications</category> 
    99  <changelog> 
     10    *2.10.0.1* #729 
    1011    *2.10.0.0* new version changes 
    1112    *2.9.0.5* #5000 
  • modules/branches/2.10/paging/page.paging.php

    r12445 r12942  
    171171  </td></tr> 
    172172 
    173   <tr><td><a href='#' class='info'><?php echo _("Force if busy") ?><span> 
    174   <?php echo _("If yes, will not check if the device is in use before paging it. This means conversations can be interrupted by a page (depending on how the device handles it). This is useful for \"emergency\" paging groups. Setting to 'Whisper' will attempt to use the ChanSpy capability on SIP channels, resulting in the page being sent to the device's ear piece but not heard by the remote party. If ChanSpy is not supported on the device or otherwise fails, no page will get through. It probably does not make too much sense to choose duplex if using Whisper mode.").' '._("The Whisper mode is new and considered experimental.") ?></span></a></td> 
     173  <tr><td> 
     174    <?php echo fpbx_label(_("Busy Extensions"),  
     175      _('<ul><li>"Skip" will not page any busy extension. All other extensions will ' 
     176      . 'be paged as normal</li>' 
     177      . '<li>"Force" will not check if the device is in use before paging it. ' 
     178      . 'This means conversations can be interrupted by a page (depending ' 
     179      . 'on how the device handles it). This is useful for "emergency" ' 
     180      . 'paging groups.</li>' 
     181      . '<li>"Whisper" will attempt to use the ChanSpy ' 
     182      . 'capability on SIP channels, resulting in the page being sent to ' 
     183      . 'the device\'s ear piece but not heard by the remote party. If ' 
     184      . 'ChanSpy is not supported on the device or otherwise fails, no page ' 
     185      . 'will get through. It probably does not make too much sense to choose ' 
     186      . 'duplex if using Whisper mode.</li></ul>') 
     187      . ' '  
     188      . _('The Whisper mode is new and considered experimental.') 
     189      ); ?> 
     190  </td> 
    175191  <td> 
    176192  <span class="radioset"> 
    177193      <input id="force_page_no" type="radio" name="force_page" value="0" <?php echo $force_page == 0 ? "checked=\"yes\"":""?>/> 
    178       <label for="force_page_no"><?php echo _("No") ?></label> 
     194      <label for="force_page_no"><?php echo _("Skip") ?></label> 
    179195      <input id="force_page_yes" type="radio" name="force_page" value="1" <?php echo $force_page == 1 ? "checked=\"yes\"":""?>/> 
    180       <label for="force_page_yes"><?php echo _("Yes") ?></label> 
     196      <label for="force_page_yes"><?php echo _("Force") ?></label> 
    181197      <input id="force_page_whisper" type="radio" name="force_page" value="2" <?php echo $force_page == 2 ? "checked=\"yes\"":""?>/> 
    182198      <label for="force_page_whisper"><?php echo _("Whisper") ?></label>