[asterisk-users] Executing Script after MixMonitor is called

Steve Edwards asterisk.org at sedwards.com
Thu Jan 26 18:36:25 CST 2012


On Thu, 26 Jan 2012, David Backeberg wrote:

> On Thu, Jan 26, 2012 at 7:18 PM, David Backeberg <dbackeberg at gmail.com> wrote:
>> shebang /path/to/bash
>>
>> PATH=$1
>> lame --arguments $1.wav $1.mp3
>> if [ -f {$1}.mp3 ] ; then
>>  rm {$1}.wav
>
> And my silly code sample hasn't been debugged, and I can spot one
> glaring bug, and another less important bug. (gotta close the if with
> a fi, I declare PATH and never use it, and I'm not certain that the
> declare will work without a 'declare' statement)
>
> Your dialplan sample was missing an essential step, which was
>
> System()
>
> that actually kicks off your command. You could also use it to kick
> off the bash script, like
> System(path_to_script path_argument_for_script)

+1 for anything that cleans up a bunch of ugly dialplan code :)

The OP was using MIXMONITOR_EXEC (although I wonder about the '&&' syntax) 
so he doesn't need to explicitly execute (via system()) his commands.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000


More information about the asterisk-users mailing list