root/modules/branches/2.4/core/agi-bin/checksound.agi

Revision 4521, 1.8 kB (checked in by p_lindheimer, 5 years ago)

#2046: workaround for Asterisk bug that breaks VmX on some systems

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/php -q
2 <?php
3
4 // Copyright (C) 2007 Atengo LLC
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16
17 /* --------WARNING---------
18  *
19  * This script is auto-copied from an included module and will get overwritten.
20  * If you modify it, you must change it to write only, in the agi-bin directory,
21  * to keep it from getting changed.
22  */
23
24 /** This function is to replace the following command, which attempts to check if a wav
25  *  file is present. At the time of writing, Asterisk had a bug that would return
26  *  bogus SYSTEMSTATUS results. This script is written to use the SYSTEMSTATUS variable
27  *  for now so that it may no longer be necessary when that command is functioning.
28  *
29  *  exten => vmx,n,TrySystem(/bin/ls ${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.[wW][aA][vV])
30  */
31
32 require_once "phpagi.php";
33
34 $AGI = new AGI();
35 $file   = $argv[1];
36
37 if (file_exists($file.".wav") || file_exists($file.".WAV")) {
38   $AGI->set_variable('SYSTEMSTATUS','SUCCESS');
39 } else {
40   $AGI->set_variable('SYSTEMSTATUS','APPERROR');
41   debug("VmX requires: $file.wav or .WAV exist in order to function",1);
42 }
43
44 // EOF dialparties.agi
45 exit( 0 );
46
47 // helper functions
48 function get_var( $agi, $value)
49 {
50   $r = $agi->get_variable( $value );
51  
52   if ($r['result'] == 1)
53   {
54     $result = $r['data'];
55     return $result;
56   }
57   else
58     return '';
59 }
60
61 function debug($string, $level=3)
62 {
63   global $AGI;
64   $AGI->verbose($string, $level);
65 }
66
67 ?>
Note: See TracBrowser for help on using the browser.