Changeset 7753

Show
Ignore:
Timestamp:
05/26/09 18:27:57 (3 years ago)
Author:
p_lindheimer
Message:

use the STAT() function in place of the checksound.agi script for Asterisk 1.4+ systems, in vmx locater, to check for file

Files:

Legend:

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

    r7752 r7753  
    21632163      // If the required voicemail file does not exist, then abort and go to normal voicemail behavior 
    21642164      // 
    2165       // TODO: there have been errors using System() with jump to 101 where asterisk works fine at the begining and 
    2166       //       then starts to jump to 101 even on success. This new mode is being tried with the SYSTEM Status which 
    2167       //       returns SUCCESS when the command returned succcessfully with a 0 app return code. 
     2165      // If 1.4 or above, use the STAT function to check for the file. Prior to 1.4, use the AGI script since the System() command tried 
     2166      // in the past had errors. 
    21682167      // 
    21692168      $ext->add('macro-vm', 'vmx', '', new ext_macro('get-vmcontext', '${ARG1}'));       
    21702169      //$ext->add('macro-vm', 'vmx', '', new ext_trysystem('/bin/ls ${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.[wW][aA][vV]')); 
    2171       $ext->add('macro-vm', 'vmx', '',new ext_agi('checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp')); 
    2172       $ext->add('macro-vm','vmx', '', new ext_gotoif('$["${SYSTEMSTATUS}" = "SUCCESS"]','tmpgreet')); 
    2173       $ext->add('macro-vm', 'vmx', '',new ext_agi('checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}')); 
    2174       $ext->add('macro-vm','vmx', '', new ext_gotoif('$["${SYSTEMSTATUS}" != "SUCCESS"]','nofile')); 
     2170      if ($ast_ge_14) { 
     2171        $ext->add('macro-vm','vmx', '', new ext_gotoif('$[(${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp.wav)} = 1) || (${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp.WAV)} = 1)]','tmpgreet')); 
     2172        $ext->add('macro-vm','vmx', '', new ext_gotoif('$[(${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.wav)} = 0) && (${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.WAV)} = 0)]','nofile')); 
     2173      } else { 
     2174        $ext->add('macro-vm', 'vmx', '',new ext_agi('checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp')); 
     2175        $ext->add('macro-vm','vmx', '', new ext_gotoif('$["${SYSTEMSTATUS}" = "SUCCESS"]','tmpgreet')); 
     2176        $ext->add('macro-vm', 'vmx', '',new ext_agi('checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}')); 
     2177        $ext->add('macro-vm','vmx', '', new ext_gotoif('$["${SYSTEMSTATUS}" != "SUCCESS"]','nofile')); 
     2178      } 
    21752179 
    21762180      $ext->add('macro-vm','vmx', '', new ext_setvar("LOOPCOUNT", '0'));