Closed phrohdoh closed 7 years ago
This test is there to make sure that both sox and mpg123 are found and are available for use. If we change that to (!$sox && !$mpg123) it will only be true, and generate a warning, if both sox and mpg123 are missing but it wont generate any warning if only one is missing.
Regarding the failure to detect the binaries in your system, can you please provide some more info like: OS/Distro And the output of: whereis which whereis sox whereis mpg123
Also the user that invokes the script and if possible its ENV vars (mostly interested in PATH). And finally, are you sure it's not some crazy SELinux / AppArmor issue?
Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-105-generic x86_64)
thill@arsenic2:~$ whereis which
which: /bin/which /usr/bin/which /usr/share/man/man1/which.1.gz
thill@arsenic2:~$ whereis sox
sox: /usr/bin/sox /usr/share/man/man1/sox.1.gz
thill@arsenic2:~$ whereis mpg123
mpg123: /usr/bin/mpg123.bin /usr/bin/mpg123 /usr/share/man/man1/mpg123.1.gz
I assume the user that invokes the script is the same as the one running asterisk which in my case is the root user.
root@arsenic2:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
All looks right, quite bizarre. Try adding some print statements, or better use console_log() to see the values of $sox and $mpg123 before the test happens in line 99.
<SIP/kazoo-00000007>AGI Rx << NOOP " -- googletts.agi: /usr/bin/sox
[..snip..]
<SIP/kazoo-00000007>AGI Rx << NOOP " -- googletts.agi: /usr/bin/mpg123
Looks like both variables have a value, (!$mpg123 || !$sox) is false and the script should continue to run without throwing an error that some of the dependencies are missing. Isn't this the case?
Yes that is the case, sorry. Mentally I was still working on #34 here. This can be closed but the README / information should state that both sox and mpg123 are required.
@Phrohdoh
Good Morning,
Were you able to solve the flaws in your google tts?
I'm with the same problem = (
I'll put down my log:
Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi <SIP/8004-00000003>AGI Tx >> agi_request: googletts.agi <SIP/8004-00000003>AGI Tx >> agi_channel: SIP/8004-00000003 <SIP/8004-00000003>AGI Tx >> agi_language: br <SIP/8004-00000003>AGI Tx >> agi_type: SIP <SIP/8004-00000003>AGI Tx >> agi_uniqueid: 1515936324.3 <SIP/8004-00000003>AGI Tx >> agi_version: certified/13.13-cert9 <SIP/8004-00000003>AGI Tx >> agi_callerid: 8004 <SIP/8004-00000003>AGI Tx >> agi_calleridname: 8004 <SIP/8004-00000003>AGI Tx >> agi_callingpres: 0 <SIP/8004-00000003>AGI Tx >> agi_callingani2: 0 <SIP/8004-00000003>AGI Tx >> agi_callington: 0 <SIP/8004-00000003>AGI Tx >> agi_callingtns: 0 <SIP/8004-00000003>AGI Tx >> agi_dnid: 8002 <SIP/8004-00000003>AGI Tx >> agi_rdnis: unknown <SIP/8004-00000003>AGI Tx >> agi_context: ivrtime <SIP/8004-00000003>AGI Tx >> agi_extension: s <SIP/8004-00000003>AGI Tx >> agi_priority: 4 <SIP/8004-00000003>AGI Tx >> agi_enhanced: 0.0 <SIP/8004-00000003>AGI Tx >> agi_accountcode: <SIP/8004-00000003>AGI Tx >> agi_threadid: 139829338539776 <SIP/8004-00000003>AGI Tx >> agi_arg_1: Digite o seu numero de cliente assim eu posso lhe identificar <SIP/8004-00000003>AGI Tx >> agi_arg_2: pt-BR <SIP/8004-00000003>AGI Tx >> <SIP/8004-00000003>AGI Rx << NOOP " -- googletts.agi: sox or mpg123 is missing. Aborting." <SIP/8004-00000003>AGI Tx >> 200 result=0 -- <SIP/8004-00000003>AGI Script googletts.agi completed, returning 0 -- Executing [s@ivrtime:5] NoOp("SIP/8004-00000003", "..::: ENCERRANDO CHAMADA - IVRTIME ::...") in new stack -- Executing [s@ivrtime:6] Hangup("SIP/8004-00000003", "") in new stack == Spawn extension (ivrtime, s, 6) exited non-zero on 'SIP/8004-00000003'
Hi @janduy, as indicated in my previous comment both sox and mpg123 are required (because of this if
).
Please verify that they both are installed (and install them if not).
Hi, @Phrohdoh yes, they are installed, I checked and reinstalled both.
Please provide the information I provided in previous comments.
1) values of $sox
and $mpg123
in the perl script at runtime
2) $PATH
of the user invoking the script
3) Where both of these executables are installed on your system
Okay, I'm not at home now. I'll send it to you at night, okay? thank you!
@Phrohdoh
Hi, below the data.
Commands: [root@bu7bu12 ~]# whereis which which: /usr/bin/which /usr/share/man/man1/which.1.gz [root@bu7bu12 ~]# whereis sox sox: /usr/bin/sox /usr/lib64/sox /usr/include/sox /usr/share/man/man1/sox.1.gz [root@bu7bu12 ~]# whereis mpg123 mpg123: /usr/bin/mpg123 /usr/local/bin/mpg123 /usr/local/lib/mpg123 /usr/src/mpg123-1.25.6/mpg123.spec [root@bu7bu12 ~]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
I did a second test, I put the absolute paths of "SOX" and "MPG123" there is another bizarre error.
Original:
my $sox = /usr/bin/which sox
;
my $mpg123 = /usr/bin/which mpg123
;
Changed:
my $sox = /usr/bin/sox
;
my $mpg123 = /usr/bin/mpg123
;
[root@bu7bu12 ~]# perl googletts.agi /usr/bin/sox FAIL sox: Not enough input filenames specified
Can't exec "/usr/bin/mpg123": Permissão negada at /var/lib/asterisk/agi-bin/googletts.agi line 87.
I already checked the permissions, I left all "chmod 777"
(!$sox || !$mpg123)
should probably use&&
.