Call Recordings do not play or download (separate FOP2 server)
We have installed FOP2 version 2.31.32 on CentOS 7.9.2009, a separate server from our PBX. which is running FreePBX version 12 on CentOS SHMZ 6.5
After difficulties getting Call History to display, I verified that both config.php files agreed as to the mysql user and then granted permissions to the database for local and remote user.
Now we see call history in FOP2. I can see call recordings in FOP2 as well.
Where we have difficulty is that playing a recording does nothing, and attempting to download the recording results in "Error: File not found"
We mounted /var/spool/asterisk/monitor/ on the FOP2 server using NFS but the same problem exists, although the directory is visible and can be browsed in SSH.
How do we get that FOP2 Recordings panel to play or download the recordings?
Comments
I tracked the error message down to this section of var/www/html/fop2/download.php
if( $filename2 == "" ) {
echo "ERROR: download file NOT SPECIFIED.";
exit;
} elseif ( ! file_exists( $filename2 ) ) {
echo "ERROR: File not found.";
exit;
}
Checking the NFS share ownership I see user and group of "nobody":
[root@sigmafop ~]# ls -l /var/spool/asterisk
total 8
drwxrwxr-x 3 nobody nobody 4096 Oct 10 18:19 monitor
drwxrwxr-x 4 nobody nobody 4096 Jun 4 2021 voicemail
[root@sigmafop ~]#
Further checking, there are multiple NFS versions active in the process list on the server:
[root@localhost ~]# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100011 1 udp 875 rquotad
100011 2 udp 875 rquotad
100011 1 tcp 875 rquotad
100011 2 tcp 875 rquotad
100005 1 udp 53299 mountd
100005 1 tcp 38070 mountd
100005 2 udp 39056 mountd
100005 2 tcp 51792 mountd
100005 3 udp 58335 mountd
100005 3 tcp 40259 mountd
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049 nfs_acl
100227 3 tcp 2049 nfs_acl
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 2 udp 2049 nfs_acl
100227 3 udp 2049 nfs_acl
100021 1 udp 36225 nlockmgr
100021 3 udp 36225 nlockmgr
100021 4 udp 36225 nlockmgr
100021 1 tcp 49899 nlockmgr
100021 3 tcp 49899 nlockmgr
100021 4 tcp 49899 nlockmgr
Also, there are several versions of NFS in use on the client:
[root@sigmafop ~]# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 51861 status
100024 1 tcp 39364 status
100005 1 udp 20048 mountd
100005 1 tcp 20048 mountd
100005 2 udp 20048 mountd
100005 2 tcp 20048 mountd
100005 3 udp 20048 mountd
100005 3 tcp 20048 mountd
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049 nfs_acl
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 3 udp 2049 nfs_acl
100021 1 udp 60286 nlockmgr
100021 3 udp 60286 nlockmgr
100021 4 udp 60286 nlockmgr
100021 1 tcp 39903 nlockmgr
100021 3 tcp 39903 nlockmgr
100021 4 tcp 39903 nlockmgr
In conclusion, this last error with playback and download appears to be an issue with NFS permissions on the recording and voicemail directories and files. Does anyone have further advice? I am going to try disabling all but NFS4 and changing the domain of the server to match that of the client.
These other posts were helpful on the subject of Recordings panel in FOP2:
https://forum.fop2.com/discussion/comment/14270#Comment_14270
https://forum.fop2.com/discussion/1816/call-recordings
https://forum.fop2.com/discussion/990/recording-tab-under-the-phonebook-looks-faulty
These were helpful with the NFS configuration, troubleshooting, and differences in setup on the two versions of CentOS:
https://nfs.sourceforge.net/nfs-howto/ar01s07.html
https://softpanorama.org/Net/Application_layer/NFS/Troubleshooting/nfsv4_mounts_files_as_nobody.shtml
https://www.thegeekdiary.com/nfsv4-mountpoint-shows-incorrect-ownerships-as-nobodynobody-in-centos-rhel/
https://www.golinuxcloud.com/configure-nfs-server-client-rhel-centos-7-8/
https://ostechnix.com/setup-nfs-server-in-centos-rhel-scientific-linux-6-3-step-by-step/
While reading this, keep in mind that this is probably not needed at all if FreePBX or asterisk is installed on both servers. We wanted one server to have only FOP2 and apache running, so if you have that then this will apply. Also, the name parsing issues are solved by installing FOP2 version 2.31.33 or higher.
I fixed the recordings and voicemail panel access issues with these changes:
(I suggest reviewing NFS and id ampping documentation before making changes.)
On the PBX, in Idmapd.conf I added static mapping and then mapped “apache@localdomain = asterisk”
On the FOP2 server, I added static mapping and then mapped “asterisk@localdomain = apache”
Both servers had host names under the same public domain, but idmapd.conf was set to use localdomain.
While testing solutions, I had added the group “PBXshare” to both servers, made sure the guid matched, then added asterisk on the PBX to that group. Later, on the FOP2 server I added a group for asterisk and made that match the gid on the PBX. I added the Fop2 apache user to that FOP2 group. The PBX share group may not be needed for the solution, but I left it in place for now.
The end result is that the PBX sees apache:apache from the FOP2 server as asterisk:asterisk.
Now all admins can see recordings and play them or download them. All users can view and play or download voicemail. All users can see their own recordings, play and download them. The user restrictions within the FOP2 recordings panel are applied from fop2, not the NFS share.
The next and last issue was the filename is not parsed correctly to insert the extension number and context into the database table. See my forum post entry where this was solved:
https://forum.fop2.com/discussion/5030/call-recording-name-format-incompatible-with-freepbx-15#latest
Important note for setups with FOP2 server set up on a separate server from the PBX:
create a directory on the PBX, fop2 at /usr/local/fop2 and copy the script in that folder:
/usr/local/fop2/recording_fop2.pl
The script must run on the server where asterisk is running.