1. Problem with lua.scripts:
[ERR] mod_lua.cpp: /usr/local/freeswitch/scripts/app/ring_groups/index.lua:241: invalid escape sequence near '\$'Solution:
In strings, there are special character combos that start with \. For example, \n means for anything interpreting the string to start a new line. You must be accidentally using one of these combinations. Using / instead of \ (i.e. '/$' instead of '\$') solves the problem.2. Another problem with lua.scripts:
When using external PosgreSQL server as your db, you might run into this error:[ERR] freeswitch_lua.cpp: Connection failed. DBH NOT Connected.
[ERR] freeswitch_lua.cpp: DBH NOT Connected.
Solution:
The problem is in how lua interacts with db. Changing --database information section to use odbc to connect to db in /usr/local/freeswitch/scripts/resources/config.lua solves the problem:--database information
database = {}
database["type"] = "odbc";
database["name"] = "fusionpbx";
database["path"] = "";
database["system"] = "odbc://fusionpbx:fusionpbx:password";
database["switch"] = "odbc://freeswitch:freeswitch:password";
3. Permissions problem:
One of the most common problems observed in the FusionPBX forum are permission issues.By default, the Centos ISO comes with freeswitch having an owner of freeswitch and a group of freeswitch and fusionpbx has an owner of apache and a group of daemon. As a result there are problems of interoperability between the two that have to be solved by using chmod to set permissions for group and other and by using chgrp to change the group on some directories.
Where do the file permissions come from.
FusionPBX gets its file permissions from the user account that the web server is running under.
FreeSWITCH gets its file permissions under the user account that it runs under
What needs to be achieved with permissions.
FusionPBX needs permission to read and write to most of FreeSWITCH's files.
FreeSWITCH needs permission to read all its files and write to the storage directory and its sub directories.
FreeSWITCH needs read permissions on the fusionpbx/secure directory and execute on the cli conf file and the fax and email php files.
One solution to this dilemma is to set the owner and group on both to be the same as each other. wiki.fusionpbx.com suggests to use this script:
#!/bin/bash
FSDIR="/usr/local/freeswitch"
FPBXDIR="/var/www/html/fusionpbx"
WWWUSER="apache"
echo "setting FreeSWITCH owned by $WWWUSER.$WWWUSER"
chown -R $WWWUSER.$WWWUSER $FSDIR
#remove 'other' permissions on freeswitch
chmod -R o-rwx $FSDIR/
#set FreeSWITCH directories full permissions for user/group with group sticky
echo "Setting group ID sticky for FreeSWITCH"
find $FSDIR -type d -exec chmod u=rwx,g=srx,o= {} \;
#make sure FreeSWITCH directories have group write
echo "Setting Group Write for FreeSWITCH files"
find $FSDIR -type f -exec chmod g+w {} \;
#make sure FreeSWITCH files have group write
echo "Setting Group Write for FreeSWITCH directories"
find $FSDIR -type d -exec chmod g+w+s {} \;
echo "setting FusionPBX owned by $WWWUSER.$WWWUSER just in case"
if [[ -e "$FPBXDIR" ]]; then
/bin/chown -R $WWWUSER.$WWWUSER $FPBXDIR
fi
echo "Changing /etc/init.d/freeswitch to start with user $WWWUSER"
sed -i -e s,'USER=freeswitch','USER=$WWWUSER', /etc/init.d/freeswitch
Still, you need to keep the chmod as 775 on /usr/local/freeswitch and 755 on /var/www/fusionpbx.
You also need to edit /etc/group and change the line "apache:x:48:" to "apache:x:48:freeswitch,apache". With this change freeswitch is able to start without needing to be run by root.
4. Recordings download link is not available in App/Call Detail Records:
Previous solution by wiki.fusionpbx.com didn't solve my problem with call recordings. Fusionpbx creates directories from user apache and permissions 764. Thus freeswitch can't write files ro recordings dir. Manually changing permissions to 775 is bothersome. Also, without previous script, granting writes on recordings dir to freeswitch helps to solve problem with writing record files, but creates another one - recording link becomes unavailable in the CDR app.Solution:
Changing permissions and user for creating recording directories in /var/www/html/fusionpbx/resources/switch.php solves the problem://create the recordings/archive/year/month/day directory structure
$recording_archive_dir = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d");
$freeswitch_user = "freeswitch";
if(!is_dir($recording_archive_dir)) {
mkdir($recording_archive_dir, 0775, true);
chmod($_SESSION['switch']['recordings']['dir']."/archive/".date("Y"), 0775);
chgrp($_SESSION['switch']['recordings']['dir']."/archive/".date("Y"), $freeswitch_user);
chmod($_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M"), 0775);
chgrp($_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M"), $freeswitch_user);
chmod($recording_archive_dir, 0775);
chgrp($recording_archive_dir, $freeswitch_user);
}
No comments:
Post a Comment