Some calls not being recorded

Hi,

I have a strange issue where sometimes a call is not being recorded on FreePBX

I have changed the record location and I’m also running the following script after the call:

mv ^{MIXMON_DIR}/^{CALLFILENAME}.^{MIXMON_FORMAT} ^{MIXMON_DIR}//usr/bin/mysql -u root -xxxxxxxxxxx -N -B -D asteriskcdrdb -e "SELECT REPLACE(calldate, ':','-'),dst,src FROM cdr WHERE uniqueid = ^{UNIQUEID}"|sed -s s'/\s/_/ g'.^{MIXMON_FORMAT}

The script works fine most of the time am I’m only processing about 20 calls per day. I have replicated the issue by calling in several times in the same manner only to notice that only 5 calls have actually been recorded. I have greped the full log looking for warnings and errors, also i have looked for any irregularities for MixMonitor logs but can see nothing relative. Can someone advise me how I may further diagnose the issue further?

Many Thanks.

What version of FreePBX and Asterisk?

FreePBX: 1.8.1 and Asterisk 1.8.20

Many Thanks.