I’m just trying to run demo in PHPAGI folder available here: https://sourceforge.net/projects/phpagi/files/phpagi/2.20/
However, the text2wav is not working. When the script has to run text2wav (in dtmf.php for example), this error show:
0x7ff7b000bf30 -- Strict RTP switching to RTP target address 192.168.37.36:4010 as source
<SIP/phone1-00000005>AGI Rx << ANSWER
<SIP/phone1-00000005>AGI Tx >> 200 result=0
<SIP/phone1-00000005>AGI Rx << STREAM FILE /var/spool/asterisk//tmp//text2wav_ace75969fc9b3a79aef4da4291ca0646 "" 0
[Jul 6 11:19:20] WARNING[4081][C-00000006]: file.c:824 ast_openstream_full: File /var/spool/asterisk//tmp//text2wav_ace75969fc9b3a79aef4da4291ca0646 does not exist in any format
<SIP/phone1-00000005>AGI Tx >> 200 result=-1 endpos=0
<SIP/phone1-00000005>AGI Rx << STREAM FILE /var/spool/asterisk//tmp//text2wav_2ad655609cb6a3f021452a1bd8fa7b1a "" 0
I tried a lot of things: giving permission for every file, trying to understang text2wav source code (https://phpagi.sourceforge.net/phpagi22/api-docs/__filesource/fsource_phpAGI__phpagi.php.html#a1331), I put the max verbosity in asterisk console and activated agi debug on but still can’t understnand what’s happening. the fact is, the file in /var/spool/asterisk//tmp//text2wav_f87b365372c500c76e497087ac7e470a do exist in txt format but not in wav
Edit:
Here’s the code that does not work:
#!/usr/bin/php -q
<?php
set_time_limit(30);
require('phpagi.php');
error_reporting(E_ALL);
$agi = new AGI();
$agi->answer();
$cid = $agi->parse_callerid();
$agi->text2wav("Hello, {$cid['name']}.");
do
{
$agi->text2wav('Enter some numbers and then press the pound key. Press 1 1 1 followed by the pound key to quit.');
$result = $agi->get_data('beep', 3000, 20);
$keys = $result['result'];
$agi->text2wav("You entered $keys");
} while($keys != '111');
$agi->text2wav('Goodbye');
$agi->hangup();
?>
My dialplan :
exten => 42,1,Answer
exten => 42,2,agi(dtmf.php)
exten => 42,3,Hangup
2
Answers
Your message error is telling you that the can not found the path it tries to use
<SIP/phone1-00000005>AGI Rx << STREAM FILE /var/spool/asterisk//tmp//text2wav_ace75969fc9b3a79aef4da4291ca0646 "" 0
Asterisk use the path
/var/spool/asterisk
as part of the configuration, so when you try to play an audio using text2wav, this is taken that path to create the wav and play.You need to have the path
/var/spool/asterisk/tmp
. To create it, execute at linux shellBe aware that you must change permission to that new directory to be use be asterisk process
if the asterisk process is running with
asterisk
user.Hope this can help you.
stop asterisk service
run asterisk from ssh console via
asterisk -vvvvgc
check error. Now will be on console, when running service it go… somewhere. In most cases to /dev/tt9
Most likely cases are