[Amportal-users] Testers for FreeBX/FreePBX

Hi Philip

Below are the patches to the patched FreeBSD port of FreePBX 2.1. I hope the patches are of some assistance:

— …/freepbx-2.1.orig/work/freepbx-2.1.0/amp_conf/bin/retrieve_conf Sat May 13 16:33:44 2006
+++ work/freepbx-2.1.0/amp_conf/bin/retrieve_conf Wed Jun 7 12:56:40 2006
@@ -1,4 +1,4 @@
-#!/usr/bin/php -q
+#!/usr/local/bin/php -q

<?php define("AMP_CONF", "/etc/amportal.conf"); --- ../freepbx-2.1.orig/work/freepbx-2.1.0/amp_conf/sbin/amportal Tue May 16 03:06:29 2006 +++ work/freepbx-2.1.0/amp_conf/sbin/amportal Wed Jun 7 13:04:37 2006 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/local/bin/bash ROOT_UID=0 # root uid is 0 E_NOTROOT=67 # Non-root exit error @@ -25,35 +25,38 @@ chown_asterisk() { echo SETTING FILE PERMISSIONS - chown -R asterisk:asterisk $ASTRUNDIR - chown -R asterisk:asterisk /etc/asterisk - chmod -R g+w /etc/asterisk - chown -R asterisk:asterisk $ASTVARLIBDIR + [ ! -e $ASTRUNDIR ] && mkdir $ASTRUNDIR + chown -R asterisk:www $ASTRUNDIR + chown -R asterisk:www $ASTETCDIR + chmod -R g+w $ASTETCDIR + chown -R asterisk:www $ASTVARLIBDIR chmod -R g+w $ASTVARLIBDIR - chown -R asterisk:asterisk $ASTLOGDIR + chown -R asterisk:www $ASTLOGDIR chmod -R g+w $ASTLOGDIR - chown -R asterisk:asterisk $ASTSPOOLDIR + chown -R asterisk:www $ASTSPOOLDIR chmod -R g+w $ASTSPOOLDIR - chown -R asterisk:asterisk $AMPWEBROOT/admin + chown -R asterisk:www $AMPWEBROOT/admin chmod -R g+w $AMPWEBROOT/admin - chown -R asterisk:asterisk $FOPWEBROOT + chown -R asterisk:www $FOPWEBROOT chmod -R g+w $FOPWEBROOT - chown -R asterisk:asterisk $AMPWEBROOT/recordings + chown -R asterisk:www $AMPWEBROOT/recordings chmod -R g+w $AMPWEBROOT/recordings - chown -R asterisk:asterisk $AMPWEBROOT/_asterisk - chown -R asterisk:asterisk $AMPCGIBIN/vmail.cgi - chmod u+x,g+x $ASTVARLIBDIR/bin/* + chown -R asterisk:www $AMPWEBROOT/_asterisk + chown -R asterisk:www $AMPCGIBIN/vmail.cgi + [ -e $ASTVARLIBDIR/bin ] && chmod u+x,g+x $ASTVARLIBDIR/bin/* + chown asterisk:www $AMPBIN/retrieve_conf + chmod u+x,g+x $AMPBIN/retrieve_conf chmod u+x $ASTVARLIBDIR/agi-bin/* chmod u+x,g+x $AMPWEBROOT/admin/bounce_op.sh chmod u+x,g+x $AMPCGIBIN/vmail.cgi chmod u+x,g+x $FOPWEBROOT/*.pl chmod u+x $FOPWEBROOT/safe_opserver - chown asterisk /dev/tty9 + [ -e /dev/tty9 ] && chown asterisk /dev/tty9 # Ensure that various hardware devices are owned correctly. - [ -e /dev/zap ] && chown -R asterisk:asterisk /dev/zap - [ -e /dev/capi20 ] && chown -R asterisk:asterisk /dev/capi20 - [ -e /dev/misdn ] && chown -R asterisk:asterisk /dev/misdn - [ -e /dev/dsp ] && chown -R asterisk:asterisk /dev/dsp + [ -e /dev/zap ] && chown -R asterisk:www /dev/zap + [ -e /dev/capi20 ] && chown -R asterisk:www /dev/capi20 + [ -e /dev/misdn ] && chown -R asterisk:www /dev/misdn + [ -e /dev/dsp ] && chown -R asterisk:www /dev/dsp echo Permissions OK } @@ -86,7 +89,7 @@ else # su - asterisk -c "export PATH=$PATH:/usr/sbin && export LD_LIBRARY_PATH=/usr/local/lib && /usr/sbin/safe_asterisk" export LD_LIBRARY_PATH=/usr/local/lib - /usr/sbin/safe_asterisk -U asterisk -G asterisk + /usr/local/sbin/safe_asterisk -U asterisk -G asterisk sleep 5 check_asterisk sleep 1 @@ -101,7 +104,7 @@ pid_length=`pidof asterisk|awk '{print length($0)}'` if [ "$pid_length" != "0" -a "$pid_length" != "" ] then - /usr/sbin/asterisk -rx "stop gracefully" + /usr/local/sbin/asterisk -rx "stop gracefully" echo "Asterisk Stopped" fi } --- ../freepbx-2.1.orig/work/freepbx-2.1.0/apply_conf.sh Mon Jun 5 15:07:16 2006 +++ work/freepbx-2.1.0/apply_conf.sh Wed Jun 7 12:52:33 2006 @@ -57,9 +57,10 @@ fi -if [ -x /usr/sbin/amportal ]; then +if [ -x /usr/local/sbin/amportal ]; then echo "Adjusting File Permissions.." - /usr/sbin/amportal chown + /usr/local/sbin/amportal chown + fi echo "Done" --- ../freepbx-2.1.orig/work/freepbx-2.1.0/install_amp Mon Jun 5 15:07:16 2006 +++ work/freepbx-2.1.0/install_amp Wed Jun 7 13:19:43 2006 @@ -494,7 +494,7 @@ else $amp_conf["AMPEXTENSIONS"] = $key; $key = $bin; - if (preg_match('/^$/',$key)) $amp_conf["AMPBIN"] = "/var/lib/asterisk/bin"; + if (preg_match('/^$/',$key)) $amp_conf["AMPBIN"] = "/usr/local/share/asterisk/bin"; else $amp_conf["AMPBIN"] = rtrim($key,'/'); if (is_dir($amp_conf["AMPBIN"])) { } else if (amp_mkdir($amp_conf["AMPBIN"],"0755",true)){ @@ -594,7 +594,7 @@ $fopwebroot = "/var/www/html/panel"; $webroot = "/var/www/html"; $cgibin = "/var/www/cgi-bin"; -$bin = "/var/lib/asterisk/bin"; +$bin = "/usr/local/share/asterisk/bin"; $sbin = "/usr/sbin"; $asteriskuser = "admin"; $asteriskpass = "amp111"; @@ -680,8 +680,9 @@ // **** Replace the asterisk and ampconfig configuration paths: -exec("find amp_conf -type f |xargs sed -i.bak 's|/etc/asterisk|$systemconfig/asterisk|g'"); -exec("find amp_conf -type f |xargs sed -i.bak 's|/etc/amportal.conf|$systemconfig/amportal.conf|g'"); +// **** Protect against duplicate substitution on a rerun +exec("find amp_conf -type f |xargs sed -i.bak '\|$systemconfig/asterisk|n;s|/etc/asterisk|$systemconfig/asterisk|g '"); +exec("find amp_conf -type f |xargs sed -i.bak '\|$systemconfig/amportal.conf|n;s|/etc/amportal.conf|$systemconfig/ amportal.conf|g'"); exec("find amp_conf -name *.bak -type f |xargs rm "); // **** Look for user = root @@ -747,7 +748,7 @@ if (!array_key_exists("AMPBIN",$amp_conf)) { out("Adding AMPBIN option to amportal.conf - using AMP default"); - $amp_conf["AMPBIN"] = "/var/lib/asterisk/bin"; + $amp_conf["AMPBIN"] = "/usr/local/share/asterisk/bin"; } if (!array_key_exists("AMPSBIN",$amp_conf)) { --- End of Patch Cheers, Shane On Monday, June 05, 2006, at 04:24AM, Phillip Neumann wrote: [quote]El dom, 04-06-2006 a las 22:51 +1000, Shane MacPhillamy escribió: [quote] For FreeBSD the control scripts should use pgrep -f rather than pidof, and pkill -f -9 rather than killall -9. On FreeBSD pidof is a misc port and doesn't appear to work the same as on Linux, and killall seems to have trouble in finding the processes to kill. This affects how well amportal works in controlling the stopping and starting of asterisk and the management portal. Cheers, Shane [/quote] Hi Shane. you are using the amportal script to start all the components? if so, this means you are starting asterisk as "asterisk" user? would you share your modifications? good luck! _______________________________________________ Amportal-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/amportal-users [/quote] _______________________________________________ Amportal-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/amportal-users Post generated using Mail2Forum (http://www.mail2forum.com)