Call recording stops working after a few hours of restarting asterisk

We have a strange issue with call recording. Our setup is Freepbx 12 (build 6.12.65.23) based on asterisk 11.14.2. We are able to start call recording and it will work during testing. Once we get the users starting to use it, the call recording will work for some period of time then stop. Once it stops all future calls show in CDR as having the same call recording file as the last call that worked. It will stay like that indefinitely until we restart asterisk. Then the first few calls will work as expected. The calls that start the issue have been inbound and outbound direct or to call queues. So it’s tough to find the culprit.

I’m pretty sure this is not categorized correctly, but I wasn’t sure where it should fall. These recordings are being generated ad-hoc from the isymphony module.

are you saying that you are using isymphony to start and stop recording?

Yes, I originate them in isymphony typically. I have raised this issue with iSymphony and they have replied letting me know that when call recording is originated inside their panel it simply calls the built in PHP script /var/lib/asterisk/bin/one_touch_record.php. They suggested i use the freepbx “In-Call Asterisk Toggle Call Recording” feature, which uses the same script to test. So I have tested with the *1 and the result is identical. When the system call recording is hung it behaves exactly the same in isymphony as it does when dialing the code.

More info: I have found that once I restart asterisk and call recording is working again, as long as I just record my own call, call recording does not seem to break. The issue arises when I try to record someone else’s call within the isymphony portal, which of course I can’t do by dialing *1 on an active call.

Furthermore, the file name seems to show part of what I feel may be the issue. Typically when you record your own call the file name is ondemand-exten-exten-date-time-callid-??.wav When I try to record somone elses call I get a filename of ondemand-exten–date-time-callid-??.wav.

Then when call recording is broken each subsequent attempt to record a call changes the time stamp on that file itself, although the time stamp in the file name does not change.

for example: /var/spool/asterisk/monitor/2015/02/16/ondemand-4574–20150204-155048-1423090235.81836

Plus each time I start or stop the recording asterisk CLI logs the following letting me know that it’s calling the script.

== Begin MixMonitor Recording SIP/8888-0001b14a
to start, and:
== End MixMonitor Recording SIP/8888-0001b14a
to end.

Okay, I believe I have found the main reason that the script fails. The channel variable CALLFILENAME is getting set on certain call recordings, it seems they get set when recording a call of another user. That file name is now appended to all future calls for any user. So they are recorded in the CDR table for the recordingfile for all calls. And any new recordings use that same file name. Here is an example of the CDR:

| 2015-02-17 16:43:55 | “User Name” <3601> | 3601 | 3601 | ext-local | Local/3601@from-internal-00000ba4;2 | SIP/3601-00001557 | Dial | SIP/3601,15,TtrI | 2 | 0 | ANSWERED | 3 | | 1424216635.11614 | | | ondemand-4567-4567-20150217-164300-1424216580.11531.wav | 3601 | User Name | | | |
| 2015-02-17 16:43:53 | “+15554264586” <5554264586> | 5554264586 | 4512 | ext-local | Local/4512@from-queue-00000b9e;2 | SIP/4512-0000154c | Dial | SIP/4512,15,TtrM(auto-blkvm) | 1 | 0 | NO ANSWER | 3 | | 1424216633.11577 | | | ondemand-4567-4567-20150217-164300-1424216580.11531.wav | 5554264586 | +15554264586 | | | |
| 2015-02-17 16:43:53 | “+15554264586” <5554264586> | 5554264586 | 4533 | ext-local | Local/4533@from-queue-00000b9a;2 | SIP/4533-00001552 | Dial | SIP/4533,15,TtrM(auto-blkvm) | 1 | 0 | NO ANSWER | 3 | | 1424216633.11569 | | | ondemand-4567-4567-20150217-164300-1424216580.11531.wav | 5554264586 | +15554264586 | | | |
| 2015-02-17 16:43:53 | “+15554264586” <5554264586> | 5554264586 | 3646 | ext-local | Local/3646@from-queue-00000b9f;2 | SIP/3646-00001551 | Dial | SIP/3646,15,TtrM(auto-blkvm) | 1 | 0 | NO ANSWER | 3 | | 1424216633.11579 | | | ondemand-4567-4567-20150217-164300-1424216580.11531.wav | 5554264586 | +15554264586 | | | |
| 2015-02-17 16:43:53 | “+15554264586” <5554264586> | 5554264586 | 4532 | from-internal | Local/4532@from-queue-00000ba0;2 | Local/LC-4532@from-internal-00000ba3;1 | Dial | Local/LC-4532@from-internal,17,TtrM(auto-blkvm)I | 1 | 0 | NO ANSWER | 3 | | 1424216633.11581 | | | | 5554264586 | +15554264586 |

I think we are dealing with a bug in the call recording. Specifically the one_touch_record.php

Please report this on the FreePBX bug tracker at issues.freepbx.org with all the details and information

Okay that is done: [FREEPBX-8803] one_touch_record.php CALLFILENAME variable getting stuck - Sangoma Issue Tracker

There has been no activity on this bug. Any feedback you can offer Tonyclewis?