FreePBX Post Call Recording Script not firing

Tags: #<Tag:0x00007f24c41e47c8>

(Tanmoy) #1

I need to work on the recording file. So was playing with the Post Call Recording Script. I’ve set that to

/var/lib/asterisk/agi-bin/ ^{MIXMONITOR_FILENAME}

Also tried replacing {MIXMONITOR_FILENAME} with {CALLFILENAME} with no luck. The script contains

 dt=$(date '+%m/%d/%Y %r');
 echo "$dt" >> test.txt
 echo "$var1" >> test.txt has asterisk:asterisk. I tried to run the script being asterisk, that worked as expected.

Call recording is turned on, but I cannot getting any output to my test.txt file when a recrording is being completed. Just manual run is giving result.

Any idea, guys?


Logs of a failure are often quite useful.

(Tanmoy) #3

Sorry, I could not get your point.


In the log file should be a line reflecting how your script was called after the call which was monitored is terminated. It should show the translated values of the parameters you choose to send the script.

(Tanmoy) #5

Well, in asterisk log, I found

app_mixmonitor.c: MixMonitor close filestream (mixed)
app_mixmonitor.c: Executing [/var/lib/asterisk/agi-bin/ /var/spool/asterisk/monitor/2021/07/12/out-XXXXXXXXX-XXX-20210712-142407-1626099847.2.wav]
app_mixmonitor.c: End MixMonitor Recording PJSIP/XXX-00000001

No error message was there. I manually run /var/lib/asterisk/agi-bin/ /var/spool/asterisk/monitor/2021/07/12/out-XXXXXXXXX-XXX-20210712-142407-1626099847.2.wav and that wrote the text file as I wanted.

Really weird…


when you run that script from a ‘shell’ it is not run in the same ‘environment’ as when run from the dial-plan. thusly I point out that your test.txt file is “un-rooted”, you would best fix that first.

(Tanmoy) #7

Yes, it worked. I specified the exact path of the text file in bash script and the text file was populated correctly. Thanks man for your help.


Given your bio, you might consider rewriting the script as, as you well know, python is well aware of it’s environment

(Tanmoy) #9

Yes, my goal is to update the record file to a different database. I’m listening AMI Cdr event to get the Cdr record, but that was not giving Recording file. So I’ll collect Record file and unique id and then update that in db using a python script.

Anyway, thanks for helping me to sort out the issue.


You can indirectly locate the file, if it exists, via the CDR table’s UNIQUEID record in this case 1626099847 which python’s datetime lib fully understands, the number after the decimal point is an enumeration of the number of calls since asterisk started


If you want to have real fun, install and include phonenumbers and parse your XXXXXXXXX with it.

(Tanmoy) #12

I’ll try, thanks for recommending.

(system) closed #13

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.