PHP AGI - SAY DIGITS returns from asterisk early


I am having a problem with PHPAGI. I send the command $agi->say_digits(“1234567”) from a PHP script and it returns immediately, prior to asterisk completing its stream of the digit sound files. I have tried with and without the 2nd parameter to say_digits() where 2nd parm is a string of acceptable early term digits. Both cases the say_digits() call returns to the AGI script immediately after the command is queued which is not the functionality if the same command (SayDigits) is used within a dialplan.

If I execute the PHP function sleep(10) after the say_digits() call asterisk streams the digits in their entirety. It seems that if asterisk receives an additional AGI command prior to completion of the say_digits() the playback is terminated. Same thing happens if say_digits() is called at the end of the script… as soon as the script ends the playback of the digits is terminated.

What am I missing? Is there some timeout taking effect of which I am unaware? I would like control to stay with asterisk until all of the digits in the say_digits() call are streamed on the channel.

Thanks in advance for everyone’s help!


Figured out the problem. I was receiving an error msg from PHP re: an undefined constant. The error msgs hit asterisk. Processing continued, including several AGI calls, but the error finally caught up with me. The PHPAGI interface became out of sync with replies from asterisk… this led to the $agi->say_digits() call returning immediately because $agi->evaluate received a reply from an earlier AGI call…

Once the RX TX sequence is out of sync, problems will eventually surface!