[Asterisk-Users] Trouble with AGI and SAY DIGITS and WAIT FOR DIGIT using PHP

Philipp von Klitzing klitzing at pool.informatik.rwth-aachen.de
Wed Dec 10 08:28:34 MST 2003


Hi there,

AGI is partially not working for me with SAY DIGITS, SAY NUMBER, WAIT FOR 
DIGITS etc. It appears that result is always one for any function that 
looks for user input, regardless of which key was pressed. Playing sound 
is only possible using EXEC. This applies to two * servers with RH 7.2 
and RH 7.3 and very recent CVS. Any suggestion or tips about where I 
goofed?

Thanks, Philipp


-- [CLI output] --
  demo.agi: write: ANSWER
  demo.agi: read: 200 result=1
  demo.agi: write: SAY DIGITS 68 7
    -- Playing 'digits/6' (language 'en')    	<-- no sound & 6 only
  demo.agi: read: 200 result=1
  (null): write: EXEC SayNumber 34	   	<-- but this works fine
    -- AGI Script Executing Application: (SayNumber) Options: (34)
    -- Playing 'digits/30' (language 'en')
    -- Playing 'digits/4' (language 'en')
  (null): read: 200 result=1
  (null): write: WAIT FOR DIGIT 5000
  (null): read: 200 result=1	    	<-- user pressed 4, but we get result=1


-- [extensions.conf] --
exten => _104[013-9],1,Answer
exten => _104[013-9],2,Playback(beep)
exten => _104[013-9],3,AGI(demo.agi)
exten => _104[013-9],4,Playback(beep)
exten => _104[013-9],5,Hangup


-- [demo.agi] --
#!/usr/bin/php -q
<?php
 ob_implicit_flush(true);
 set_time_limit(0);
 $in = fopen("php://stdin","r");
...
 function __read__() {
   global $in, $debug;
   $input = str_replace("\n", "", fgets($in, 4096));
   return $input;
 }
 function __write__($line) {
   print $line."\n";
 }
...
 __write__("ANSWER");
 __read__();
 __write__("SAY DIGITS 68 \"7\"");
 __read__();
 __write__("EXEC SayNumber 34");
 __read__();
__write__("WAIT FOR DIGIT 5000");
__read__();





More information about the asterisk-users mailing list