Shell script disobeying phpagi call flow


#1

I have a system where the call lands on a call flow script which is a php script that uses phpagi. The call flow script calls a shell script which uses sox to concate two real time generated audio file by the call flow.

ISSUE IS: The shell SCRIPT GETS EXECUTED WHEN RUN FROM TERMINAL command BUT when the call
flow is executed THROUGH PHONE CALL, THE SHELL script DO NOT run and hence no concatenated output.

In short, the shell script executes through terminal command BUT not through phone call.

Please advice.


#2

That’s typically because you have not used full pathnames and the PATH environment variable is set differently.


#3

My content of the .php script is as below

#!/usr/bin/php -q

<?php require "phpagi.php"; error_reporting(E_ALL); ob_implicit_flush(true); set_time_limit(0); $agi= new AGI(); $agi->answer(); shell_exec("sh ./concate.sh"); ?>

The shell script has the full path

#!/bin/bash
/usr/bin/sox /home/ast6/two.wav /home/ast6/three.wav /home/ast6/out.wav

Can you help me identify the issue.
Also how do I set the env for this.


#4

The current directory is wrong.


#5

I think David is suggesting to use the full path of both /bin/sh and /path/to/shell/script/concate.sh. Potentially also the full path to /var/lib/asterisk/agi-bin/phpagi.php.