Problem triggering post recording script

Hi there,

I’m having issues setting up a post record script. Freepbx on Asterisk 11.2.1, call recording module Hosted on Debian using Nginx. System functioning fine, including standard recording (the wavs are there).

The problem is triggering the post recording script, a little python thing I whipped up to convert it into mp3. The script has a shebang and proper permissions, runs fine from command prompt as the asterisk user.

I’ve configured it in the appropriate place in settings/advanced (and applied), but when it executes, it just doesn’t seem to actually execute.

The value I have set is:

/var/lib/asterisk/bin/ --file=’^{MIXMON_DIR}^{YEAR}/^{MONTH}/^{DAY}/^{CALLFILENAME}.^{MIXMON_FORMAT}’ --outputdir=/home/blah/audio

In startup, it says:

“[2013-01-29 16:39:18] VERBOSE[28146] pbx.c: == Setting global variable ‘MIXMON_POST’ to ‘/var/lib/asterisk/bin/ --file=’^{MIXMON_DIR}^{YEAR}/^{MONTH}/^{DAY}/^{CALLFILENAME}.^{MIXMON_FORMAT}’ --outputdir=/home/blah/audio’”

But when it executes, I only see:

[2013-01-29 16:41:25] VERBOSE[28243] app_mixmonitor.c: == Executing [/var/lib/asterisk/bin/]

And nothing runs. The log file the code should write it if it runs at all is not touched.

If I put quotes around the entire phrase in settings, then I get:

[2013-01-29 16:22:59] VERBOSE[27607] app_mixmonitor.c: == Executing [/var/lib/asterisk/bin/ --file=’/var/spool/asterisk/monitor/2013/01/29/out-xxxx-xxx-20130129-x-1359436969.12.wav’ --outputdir=/home/blah/audio]

But still no output or evidence that the script has even run. What am I missing? I also tried wrapping it in a System() call, but that made no difference.

Is it something to do with using named arguments? Or am I missing something more obvious?


The home directory of asterisk is /var/lib/asterisk bu default can asterisk user write to /home/blah/audio ?

Thanks dicko. Yes it can. If I run the command as asterisk from the command line, it puts the file where it should be.

Hmm, should work, maybe have the script itself write out to a log file when it is run?

Yep, I’m doing that. Have even rewritten the script to dump its log to /tmp, just to weed out permissions issues. Even if it were to run with no arguments (as it appears to be doing), it would still log that it ran.

So, running the command as asterisk from the command line, behaviour as expected, log generated. Run from command line with missing option switches, it will still log failure to that file.

But there’s no evidence that, when triggered by MixMonitor, the script even attempts to run.

Also tried actually calling /usr/bin/python to explicitly run the script, but that does not help.

I’m utterly stumped.

For those interested, I’ve solved this - the recording script was a symlink. Though it executed fine on the command line as the user, it seems asterisk will not execute it that way. Copying it directly into the folder, it runs.

To ensure that all arguments were sent to the script, I also had to wrap the entire command in quotes. This doesn’t match the documentation I’ve seen, but there you have it.