initial commit of file from CVS for smeserver-freepbx on Sat Sep 7 20:25:35 AEST 2024

This commit is contained in:
Trevor Batley 2024-09-07 20:25:35 +10:00
parent bd24175623
commit 190a3e0d7a
80 changed files with 3092 additions and 2 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.rpm
*.log
*spec-20*
*.tar.gz

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
# Makefile for source rpm: smeserver-freepbx
# $Id: Makefile,v 1.1 2021/11/11 04:44:26 jpp Exp $
NAME := smeserver-freepbx
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,3 +1,19 @@
# smeserver-freepbx
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-freepbx
SMEServer Koozali developed git repo for smeserver-freepbx smecontribs
SMEServer Koozali developed git repo for smeserver-freepbx smecontribs
## Wiki
<br />https://wiki.koozali.org/FreePBX
<br />https://wiki.koozali.org/FreePBX/DAHDI
<br />https://wiki.koozali.org/FreePBX/mISDN
<br />https://wiki.koozali.org/FreePBX/fr
<br />https://wiki.koozali.org/Freepbx/fr
## Bugzilla
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-freepbx&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
## Description
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
*Once it has been checked, then this comment will be deleted*
<br />

1
contriborbase Normal file
View File

@ -0,0 +1 @@
contribs10

100
createlinks Normal file
View File

@ -0,0 +1,100 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
# force default php to php56
safe_symlink("/usr/bin/php74", "root/usr/sbin/php");
safe_symlink("/usr/bin/php74", "root/usr/local/sbin/php");
#safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/httpd-fpbx');
#safe_symlink("/var/service/httpd-fpbx" , 'root/service/httpd-fpbx');
# Panel links
panel_link("freepbx", 'manager');
#panel_link("fop", 'manager');
# Events links
my $event = 'freepbx-update';
templates2events("/etc/asterisk/asterisk.conf", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/asterisk/cdr_mysql.conf", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/asterisk/manager.conf", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/logrotate.d/asterisk", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/odbc.ini", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/httpd/conf/httpd.conf", $event);
templates2events("/etc/httpd/fpbx-conf/httpd.conf", qw(freepbx-update bootstrap-console-save conf-userpanel));
templates2events("/etc/e-smith/sql/init/30freepbx_mysql_create_database", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/opt/remi/php74/php-fpm.d/www.conf", $event);
templates2events("/opt/remi/php56/root/etc/php-fpm.d/www.conf", $event);
event_link("freepbx-checkinstall", $event, "10");
event_link("freepbx-checkinstall-backup", $event, "11");
event_link("freepbx-amportal.conf", $event, "91");
event_link("freepbx-clean-crontab", $event, "40");
event_link("freepbx-cron", $event, "40");
event_link("freepbx-dump-astdb", "pre-backup", "30");
event_link("freepbx-backup", "pre-backup", "31");
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-fpbx");
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php56-php-fpm");
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php74-php-fpm");
safe_symlink("sigusr1", "root/etc/e-smith/events/logrotate/services2adjust/httpd-fpbx");
safe_symlink("sigusr1", "root/etc/e-smith/events/conf-userpanel/services2adjust/httpd-fpbx");
# Create empty files
#safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/fpbx_access_log");
#safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/fpbx_error_log");
#safe_touch("root/var/service/httpd-fpbx/down");
# Create empty directories
system("/bin/mkdir -p root/var/service/httpd-fpbx/supervise");
system("/bin/mkdir -p root/var/service/httpd-fpbx/log/supervise");
system("/bin/mkdir -p root/var/log/httpd-fpbx");
## systemd install/update
$event = 'smeserver-freepbx-update';
templates2events("/etc/asterisk/asterisk.conf", $event);
templates2events("/etc/asterisk/cdr_mysql.conf", $event);
templates2events("/etc/asterisk/manager.conf", $event);
templates2events("/etc/logrotate.d/asterisk", $event);
templates2events("/etc/logrotate.d/vsftpd", $event);
templates2events("/etc/httpd/conf/httpd.conf", $event);
templates2events("/etc/httpd/fpbx-conf/httpd.conf", $event);
templates2events("/etc/e-smith/sql/init/30freepbx_mysql_create_database", $event);
templates2events("/etc/opt/remi/php74/php-fpm.d/www.conf", $event);
templates2events("/opt/remi/php56/root/etc/php-fpm.d/www.conf", $event);
templates2events("/etc/odbc.ini", $event);
event_link("freepbx-checkinstall", $event, "10");
event_link("freepbx-checkinstall-backup", $event, "11");
event_link("freepbx-amportal.conf", $event, "91");
event_link("freepbx-clean-crontab", $event, "40");
event_link("freepbx-cron", $event, "40");
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-fpbx");
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php56-php-fpm");
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php74-php-fpm");
#action needed in case we have a systemd unit
event_link("systemd-default", $event, "88");
event_link("systemd-reload", $event, "89");
use esmith::Build::Backup qw(:all);
backup_includes("smeserver-freepbx", qw(
/opt/freepbx
/var/lib/asterisk/
/etc/asterisk
/var/spool/asterisk/
/var/log/asterisk
/usr/sbin/amportal
/usr/sbin/fwconsole
));

View File

@ -0,0 +1,5 @@
[blacklist]
directory = /tmp/
[custom]
rdir = /home/e-smith/files/freepbx,0750,asterisk,asterisk
rdir = /usr/share/asterisk/sounds,0754,asterisk,asterisk

View File

@ -0,0 +1 @@
system

View File

@ -0,0 +1 @@
url

View File

@ -0,0 +1 @@
url

View File

@ -0,0 +1 @@
url

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
service

View File

@ -0,0 +1 @@
asteriskcdrdb

View File

@ -0,0 +1 @@
freepbxdb

View File

@ -0,0 +1 @@
freepbxuser

View File

@ -0,0 +1 @@
5061

View File

@ -0,0 +1 @@
5060,5061,5160,5161,4569,10000:20000

View File

@ -0,0 +1 @@
private

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
service

View File

@ -0,0 +1 @@
960

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
service

View File

@ -0,0 +1,46 @@
{
my $freepbx = $DB->get('freepbx') || $DB->new_record('freepbx', {type => 'service'});
my $dbpass = $freepbx->prop('DbPassword') ||
$freepbx->set_prop('DbPassword', `/usr/bin/openssl rand -base64 40 | /usr/bin/tr -c -d '[:graph:]'`);
my $managerpass = $freepbx->prop('ManagerPassword') ||
$freepbx->set_prop('ManagerPassword', `/usr/bin/openssl rand -base64 10 | /usr/bin/tr -c -d '[:alnum:]'`);
my $aripass = $freepbx->prop('AriPassword') ||
$freepbx->set_prop('AriPassword', `/usr/bin/openssl rand -base64 10 | /usr/bin/tr -c -d '[:alnum:]'`);
# FOP not compatible with latest astersisk
my $fop = $DB->get("fop");
$fop->delete if $fop;
# with freepbx 13, we have a new port
my $UDPPorts = $freepbx->prop('UDPPorts') || '5060,5061,5160,5161,4569,10000:20000';
my @UDPlist= split(',',$UDPPorts);
unless ('5061' ~~ @UDPlist){
$UDPPorts = "$UDPPorts,5061";
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
unless ('5160' ~~ @UDPlist){
$UDPPorts = "$UDPPorts,5160";
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
unless ('5161' ~~ @UDPlist){
$UDPPorts = "$UDPPorts,5161";
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
if ('10000-20000' ~~ @UDPlist){
$UDPPorts =~ s/,10000-20000//;
$UDPPorts = "$UDPPorts,10000:20000";
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
if ('1000-2000' ~~ @UDPlist){
$UDPPorts =~ s/,1000-2000//;
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
}
#remove DeviceAndUser property
my $DeviceAndUser = $freepbx->prop('DeviceAndUser');
$frepbx->delete_prop('DeviceAndUser') if defined $DeviceAndUser;

View File

@ -0,0 +1,33 @@
#!/bin/bash
version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/core/module.xml|cut -d. -f1)
if [[ $version -ge 15 ]] ; then
fwconsole="/sbin/e-smith/fwconsole"
$fwconsole setting DISABLE_CSS_AUTOGEN 1
$fwconsole setting CHECKREFERER 0
$fwconsole setting AUTHTYPE none
$fwconsole setting AMPWEBROOT /opt/freepbx
$fwconsole setting MODULEADMINWGET 1
$fwconsole setting DYNAMICHINTS 1
$fwconsole setting ARI_ADMIN_PASSWORD $(/sbin/e-smith/db configuration getprop freepbx AriPassword) 2>/dev/null 1>&2
$fwconsole setting AMPMGRPASS $(/sbin/e-smith/db configuration getprop freepbx ManagerPassword)
$fwconsole setting RSSFEEDS 'http://www.freepbx.org/rss.xml'
$fwconsole setting BRAND_FREEPBX_ALT_FOOT FreePBX
else
# Change FreePBX database settings that should have come from /etc/amportal.conf,
# this is a dynamic template for FreePBX > 1.9 as it update the file on the fly, and also the db
FPBX_SETTING_PATH="/var/lib/asterisk/bin/freepbx_setting"
$FPBX_SETTING_PATH DISABLE_CSS_AUTOGEN 1
$FPBX_SETTING_PATH CHECKREFERER 0
$FPBX_SETTING_PATH AUTHTYPE none
$FPBX_SETTING_PATH AMPWEBROOT /opt/freepbx
$FPBX_SETTING_PATH MODULEADMINWGET 1
$FPBX_SETTING_PATH DYNAMICHINTS 1
$FPBX_SETTING_PATH ARI_ADMIN_PASSWORD $(/sbin/e-smith/db configuration getprop freepbx AriPassword)
$FPBX_SETTING_PATH AMPMGRPASS $(/sbin/e-smith/db configuration getprop freepbx ManagerPassword)
$FPBX_SETTING_PATH RSSFEEDS 'http://www.freepbx.org/rss.xml'
$FPBX_SETTING_PATH BRAND_FREEPBX_ALT_FOOT FreePBX
fi
# now regenrate the amportal.conf from mysql
/sbin/e-smith/fwconsole r

View File

@ -0,0 +1,20 @@
#!/bin/bash
#version
version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/backup/module.xml|cut -d. -f1)
#if version >=15
if [[ $version -ge 15 ]]
then
#backup id SELECT `id` FROM `kvstore_FreePBX_modules_Backup` WHERE `key` LIKE 'backup_name' and `val` LIKE 'Default-backup';
backupid=$(echo 'SELECT `id` FROM `kvstore_FreePBX_modules_Backup` WHERE `key` LIKE "backup_name" and `val` LIKE "Default-backup"'| mysql -u root freepbxdb -s)
#if backupid empty need to set one of manually backup something
if [ -z $backupid ] ; then
echo "missing backupid, we create the db entries"
/etc/e-smith/events/actions/freepbx-checkinstall-backup pre-backup
fi
echo "backup for freepbx version 15 or above"
/usr/sbin/fwconsole bu --backup $backupid 1>/dev/null
else
echo "backup for freepbx version 14 or below"
su asterisk -s /bin/bash -c '/usr/sbin/php56 /var/lib/asterisk/bin/backup.php --id=1'
fi

View File

@ -0,0 +1,130 @@
#!/bin/bash
DBNAME=$(/sbin/e-smith/db configuration getprop freepbx DbName)
DBUSER=$(/sbin/e-smith/db configuration getprop freepbx DbUser)
DBPASS=$(/sbin/e-smith/db configuration getprop freepbx DbPassword)
CDRDBNAME=$(/sbin/e-smith/db configuration getprop freepbx CdrDbName)
MANAGERPASSWORD=$(/sbin/e-smith/db configuration getprop freepbx ManagerPassword)
DomainName=$(/sbin/e-smith/db configuration get DomainName)
if [ $(mysqlshow | grep -c $DBNAME) -lt 1 ]; then
mysql -e "create database $DBNAME CHARACTER SET utf8 COLLATE utf8_unicode_ci ;"
mysql -e "grant all privileges on $DBNAME.* to '$DBUSER'@'localhost' identified by '$DBPASS';"
mysql -e 'flush privileges;'
if [ -e /usr/share/freepbx/sql/asterisk.sql ]; then
mysql $DBNAME < /usr/share/freepbx/sql/asterisk.sql
else
echo "Error: file /usr/share/freepbx/sql/asterisk.sql doesn't exists"
exit 1
fi
fi
if [ $(mysqlshow | grep -c $CDRDBNAME) -lt 1 ]; then
mysql -e "create database $CDRDBNAME CHARACTER SET utf8 COLLATE utf8_unicode_ci ;"
mysql -e "grant all privileges on $CDRDBNAME.* to '$DBUSER'@'localhost' identified by '$DBPASS';"
mysql -e 'flush privileges;'
if [ -e /usr/share/freepbx/sources/freepbx/installlib/SQL/cdr.sql ]; then
mysql $CDRDBNAME < /usr/share/freepbx/sources/freepbx/installlib/SQL/cdr.sql
else
echo "Error: file /usr/share/freepbx/sources/freepbx/installlib/SQL/cdr.sql doesn't exists"
exit 1
fi
fi
# set user and passwords
/usr/bin/mysql $DBNAME -e "INSERT INTO \`admin\` (\`variable\`, \`value\`) VALUES ('email', 'admin\@$DomainName') ON DUPLICATE KEY UPDATE \`value\` = 'admin\@$DomainName';"
/usr/bin/mysql $DBNAME -e "INSERT INTO \`ampusers\` (\`username\`, \`password_sha1\`, \`extension_low\`, \`extension_high\`, \`deptname\`, \`sections\`) VALUES
('admin', sha1('$MANAGERPASSWORD '), '', '', '', 0x2a) ON DUPLICATE KEY UPDATE \`password_sha1\` = sha1('$ManagerPassword ');"
# Chown dir to allow user asterisk to create its files
chown asterisk:asterisk /var/lib/asterisk
# workaround as freepbx is expecting them in /var not /usr/share
cd /var/lib/asterisk
if [[ ! -d /var/lib/asterisk/documentation ]]; then ln -s /usr/share/asterisk/documentation ; fi
if [[ ! -d /var/lib/asterisk/moh ]]; then ln -s /usr/share/asterisk/moh ; fi
if [[ ! -d /var/lib/asterisk/sounds ]]; then ln -s /usr/share/asterisk/sounds/ ; fi
mkdir -p /usr/share/asterisk/sounds/tmp
chown asterisk: /usr/share/asterisk/sounds/tmp
chown asterisk: /usr/share/asterisk/sounds/ /usr/share/asterisk/moh
# Run the install script only if it's a new install
# Upgrades have to be done through freePBX and the online repository
if [ ! -d /opt/freepbx/admin ]; then
mkdir -p /opt/freepbx
# we need the right php version available
version=$(/usr/bin/rpm -q freepbx-src --qf "%{version}"|cut -d. -f1)
php="/usr/bin/php56"
if [[ $version -ge 16 ]]
then
php="/usr/bin/php74"
elif [[ $version -le 15 ]]
then
php="/usr/bin/php56"
fi
ln -sf $php /usr/sbin/php
ln -sf $php /usr/local/sbin/php
if [ -e /usr/share/freepbx/sources/freepbx/ ]; then
cd /usr/share/freepbx/sources/freepbx/
echo "Starting Asterisk..." > /root/freepbx_install.log
./start_asterisk start >> /root/freepbx_install.log 2>&1
echo "" >> /root/freepbx_install.log
echo "Installing FreePBX..." >> /root/freepbx_install.log
echo "a" |$php --define sys_temp_dir=/var/spool/asterisk/tmp/ --define allow_url_fopen=1 --define memory_limit=256M /usr/share/freepbx/sources/freepbx/install --webroot="/opt/freepbx" \
--dbengine="mysql" --dbname="freepbxdb" --dbuser="freepbxuser" --dbpass="$DBPASS" -n \
--cdrdbname="$CDRDBNAME" --astmoddir=/usr/lib64/asterisk/modules/ \
--astagidir=/usr/share/asterisk/agi-bin/ --ampsbin=/usr/sbin --ampcgibin=/opt/freepbx/cgi-bin \
>> /root/freepbx_install.log 2>&1
else
echo "error: /usr/share/freepbx/sources/freepbx/ doesn't exists"
exit 1
fi
else
if [ -x /var/lib/asterisk/bin/freepbx_engine ]; then
/var/lib/asterisk/bin/freepbx_engine chown > /dev/null 2>&1
else
echo "error: /var/lib/asterisk/bin/freepbx_engine is not executable"
exit 1
fi
if [ -x /var/lib/asterisk/bin/retrieve_conf ]; then
/var/lib/asterisk/bin/retrieve_conf > /dev/null 2>&1
else
echo "error: /var/lib/asterisk/bin/freepbx_engine is not executable"
exit 1
fi
fi
if [ ! -d /opt/freepbx/digium_phones ]; then
mkdir -p /opt/freepbx/digium_phones
chown asterisk:asterisk /opt/freepbx/digium_phones
fi
#change the links to get the right php
ln -sf /usr/sbin/e-smith/fwconsole /usr/sbin/fwconsole
ln -sf /usr/sbin/e-smith/fwconsole /usr/local/sbin/fwconsole
version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/core/module.xml|cut -d. -f1)
php="56"
if [[ $version -ge 16 ]]
then
#version we have is not fully compatible, need newer source
php="74"
elif [[ $version -le 15 ]]
then
php="56"
fi
forcephp=$(/sbin/e-smith/db configuration getprop freepbx PHPVersion 2>/dev/null || echo $php )
php=$forcephp
ln -sf /usr/bin/php$php /usr/sbin/php
ln -sf /usr/bin/php$php /usr/local/sbin/php
# update modules
/usr/sbin/e-smith/fwconsole ma upgrade framework 2>/dev/null
/usr/sbin/e-smith/fwconsole ma upgrade core 2>/dev/null
/usr/sbin/e-smith/fwconsole ma upgradeall -R standard -R extended 2>/dev/null
/usr/sbin/e-smith/fwconsole ma refreshsignatures 2>/dev/null
/usr/sbin/e-smith/fwconsole ma downloadinstall userman certman arimanager 2>/dev/null
/usr/sbin/e-smith/fwconsole ma downloadinstall ucp 2>/dev/null
exit 0

View File

@ -0,0 +1,211 @@
#!/bin/sh
DBNAME=$(/sbin/e-smith/db configuration getprop freepbx DbName)
backuppath='/home/e-smith/files/freepbx'
# check if backup module is local, enabled and running
# if not solve this...
if [[ ! `/usr/sbin/fwconsole ma list|/bin/grep backup` ]] ;then
/usr/sbin/fwconsole ma download backup -R standard -R extended >/dev/null 2>&1
fi
#force install
/usr/sbin/fwconsole ma install backup -R standard -R extended >/dev/null 2>&1
# force enable
/usr/sbin/fwconsole ma enable backup >/dev/null 2>&1
/usr/sbin/fwconsole r >/dev/null
# check our freepbx backup folder is there and accessible
if [[ ! -d $backuppath ]] ; then
/bin/mkdir -p $backuppath
fi
version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/backup/module.xml|cut -d. -f1)
#if version >=15
if [[ $version -ge 15 ]]
then
############
# FILE STORE
############
# check local space is defined, if not do it kvstore_FreePBX_modules_Filestore
filestore=$(echo 'SELECT `id` FROM `kvstore_FreePBX_modules_Filestore` WHERE `key` LIKE "path" and `val` LIKE "/home/e-smith/files/freepbx/"'| mysql -u root freepbxdb -s)
if [ -z $filestore ] ; then
filestore=$(/usr/bin/uuidgen)
echo "creating new filestore id $filestore"
else
echo "filestore $filestore will be used"
fi
# we need existing servers value to update it
servers=$(echo 'SELECT `val` FROM `kvstore_FreePBX_modules_Filestore` WHERE `key` LIKE "servers" and `id` LIKE "noid"'| mysql -u root freepbxdb -s)
servers=$(echo $servers| jq '. |= . + {"'$filestore'" : { "id": "'$filestore'","name": "Local Storage","desc": "Storage location for backups", "driver": "Local" }}')
mysql -e "use $DBNAME; INSERT INTO \`kvstore_FreePBX_modules_Filestore\` (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
('servers', '$servers', 'json-arr', 'noid')
ON DUPLICATE KEY UPDATE val=VALUES(val);"
mysql -e "use $DBNAME; INSERT INTO \`kvstore_FreePBX_modules_Filestore\` (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
('name', 'Local Storage', NULL, '$filestore'),
('desc', 'Storage location for backups', NULL, '$filestore'),
('path', '/home/e-smith/files/freepbx/', NULL, '$filestore'),
('immortal', 'true', NULL, '$filestore'),
('driver', 'Local', NULL, '$filestore')
ON DUPLICATE KEY UPDATE val=VALUES(val);"
###########
# BACKUP
###########
# check Default-backup exists, if not set it, else update it
backupid=$(echo 'SELECT `id` FROM `kvstore_FreePBX_modules_Backup` WHERE `key` LIKE "backup_name" and `val` LIKE "Default-backup"'| mysql -u root freepbxdb -s)
if [ -z $backupid ] ; then
backupid=$(/usr/bin/uuidgen)
echo "creating new backup id $backupid"
mysql -e "use $DBNAME; CREATE TABLE IF NOT EXISTS \`kvstore_FreePBX_modules_Backup\` (
\`key\` char(255) NOT NULL,
\`val\` varchar(4096) DEFAULT NULL,
\`type\` char(16) DEFAULT NULL,
\`id\` char(255) DEFAULT NULL,
UNIQUE KEY \`uniqueindex\` (\`key\`(190),\`id\`(190)),
KEY \`keyindex\` (\`key\`(190)),
KEY \`idindex\` (\`id\`(190))
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
##TODO SELECT * FROM `kvblobstore` WHERE `uuid` LIKE 'a9fe727b-fc4c-40c4-ad45-bcabd075302a'
### TODO : list modules enabled and populate
blobstore=$(/usr/bin/uuidgen)
mysql -e "use $DBNAME;INSERT INTO kvstore_FreePBX_modules_Backup (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
('backup_items', '$blobstore', 'blob', '$backupid')
ON DUPLICATE KEY UPDATE val=VALUES(val);"
# create an empty blob store, it seems to not be a problem to actually run the backup
mysql -e "use $DBNAME;INSERT INTO kvblobstore (\`uuid\`, \`type\`, \`content\`) VALUES
('$blobstore', NULL, '');" || exit 1
# we do this only if the other did not failed to avoid hitting one existing uuid
mysql -e "use $DBNAME;INSERT INTO kvstore_FreePBX_modules_Backup (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
('backup_items', '$blobstore', 'blob', '$backupid')
ON DUPLICATE KEY UPDATE val=VALUES(val);"
else
echo "Updating backup $backupid"
fi
mysql -e "use $DBNAME;INSERT INTO kvstore_FreePBX_modules_Backup (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
('backup_name', 'Default-backup', NULL, '$backupid'),
('backup_description', 'Default SME PBX backup; automatically installed', NULL, '$backupid'),
('backup_email', 'admin', NULL, '$backupid'),
('created_by', 'SME Server Event', NULL, '$backupid'),
('desc', 'Default SME PBX backup; automatically installed', NULL, '$backupid'),
('warmspare_remoteip', '', NULL, '$backupid'),
('warmspare_user', '', NULL, '$backupid'),
('maintruns', '2', NULL, '$backupid'),
('backup_emailtype', 'failure', NULL, '$backupid'),
('backup_schedule', '31 5 * * 0', NULL, '$backupid'),
('schedule_enabled', 'yes', NULL, '$backupid'),
('backup_storage', '[\\\"Local_$filestore\\\"]', 'json-arr', '$backupid'),
('backup_items', 'a9fe727b-fc4c-40c4-ad45-bcabd075302a', 'blob', '$backupid'),
('maintage', 'Unlimited', NULL, '$backupid'),
('backup_emailinline', '', NULL, '$backupid'),
('backup_addbjname', 'yes', NULL, '$backupid'),
('warmspareenabled', 'on', NULL, '$backupid'),
('warmspare_remotenat', 'on', NULL, '$backupid'),
('warmspare_cert', 'on', NULL, '$backupid'),
('warmspare_remotebind', 'on', NULL, '$backupid'),
('warmspare_remotedns', 'on', NULL, '$backupid'),
('warmspare_remoteapply', 'on', NULL, '$backupid'),
('publickey', '', NULL, '$backupid'),
('warmsparewayofrestore', 'API', NULL, '$backupid'),
('warmspare_remoteapi_filestoreid', '', NULL, '$backupid'),
('warmspare_remoteapi_accesstoken', '', NULL, '$backupid'),
('warmspare_remoteapi_accesstokenurl', '', NULL, '$backupid'),
('warmspare_remoteapi_accesstoken_expire', '', NULL, '$backupid'),
('warmspare_remoteapi_clientid', '', NULL, '$backupid'),
('warmspare_remoteapi_secret', '', NULL, '$backupid'),
('warmspare_remoteapi_gql', '', NULL, '$backupid'),
('warmspare_excludetrunks', 'on', NULL, '$backupid'),
('warmspare_remotessh_filestoreid', '', NULL, '$backupid'),
('custom_files', '[{\"type\":\"dir\",\"path\":\"__ASTETCDIR__\",\"exclude\":[]}]', NULL, '$backupid'),
('prebu_hook', '', NULL, '$backupid'),
('postbu_hook', '', NULL, '$backupid'),
('prere_hook', '', NULL, '$backupid'),
('postre_hook', '', NULL, '$backupid'),
('core_disabletrunks', '', NULL, '$backupid'),
('$backupid', '{\\\"id\\\":\\\"$backupid\\\",\\\"name\\\":\\\"Default-backup\\\",\\\"description\\\":\\\"Default SME PBX backup; automatically installed\\\"}', 'json-arr', 'backupList'),
('bu_1', '{\\\"id\\\":\\\"1\\\",\\\"name\\\":\\\"Default backup\\\",\\\"description\\\":\\\"Default SME PBX backup; automatically installed\\\",\\\"immortal\\\":\\\"true\\\",\\\"data\\\":{\\\"created_by\\\":\\\"install.php\\\",\\\"desc\\\":\\\"Default SME PBX backup; automatically installed\\\",\\\"cron_schedule\\\":\\\"weekly\\\",\\\"storage_servers\\\":[\\\"1\\\"],\\\"bu_server\\\":\\\"0\\\",\\\"delete_amount\\\":\\\"2\\\",\\\"delete_time_type\\\":\\\"days\\\",\\\"cron_random\\\":\\\"on\\\",\\\"cron_month\\\":\\\"\\\",\\\"cron_minute\\\":\\\"0\\\",\\\"cron_hour\\\":\\\"0\\\",\\\"cron_dow\\\":\\\"0\\\",\\\"cron_dom\\\":\\\"\\\",\\\"delete_time\\\":\\\"0\\\",\\\"email\\\":\\\"admin\\\",\\\"emailfailonly\\\":\\\"1\\\"},\\\"email\\\":\\\"admin\\\",\\\"uuid\\\":\\\"$backupid\\\",\\\"items\\\":[{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"mysql\\\",\\\"path\\\":\\\"server-2\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"astdb\\\",\\\"path\\\":\\\"astdb\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"\\/etc\\/dahdi\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"__ASTSPOOLDIR__\\/voicemail\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"mysql\\\",\\\"path\\\":\\\"server-3\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"__ASTETCDIR__\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"__AMPWEBROOT__\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"__AMPBIN__\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"\\/tftpboot\\\",\\\"exclude\\\":[]}]}', 'json-arr', 'migratedbackups'),
('arimanager', '1', NULL, 'modules_$backupid'),
('backup', '1', NULL, 'modules_$backupid'),
('blacklist', '1', NULL, 'modules_$backupid'),
('callrecording', '1', NULL, 'modules_$backupid'),
('cdr', '1', NULL, 'modules_$backupid'),
('cel', '1', NULL, 'modules_$backupid'),
('certman', '1', NULL, 'modules_$backupid'),
('cidlookup', '1', NULL, 'modules_$backupid'),
('conferences', '1', NULL, 'modules_$backupid'),
('core', '1', NULL, 'modules_$backupid'),
('customappsreg', '1', NULL, 'modules_$backupid'),
('dashboard', '1', NULL, 'modules_$backupid'),
('fax', '1', NULL, 'modules_$backupid'),
('filestore', '1', NULL, 'modules_$backupid'),
('findmefollow', '1', NULL, 'modules_$backupid'),
('framework', '1', NULL, 'modules_$backupid'),
('infoservices', '1', NULL, 'modules_$backupid'),
('ivr', '1', NULL, 'modules_$backupid'),
('languages', '1', NULL, 'modules_$backupid'),
('logfiles', '1', NULL, 'modules_$backupid'),
('manager', '1', NULL, 'modules_$backupid'),
('music', '1', NULL, 'modules_$backupid'),
('phonebook', '1', NULL, 'modules_$backupid'),
('pm2', '1', NULL, 'modules_$backupid'),
('recordings', '1', NULL, 'modules_$backupid'),
('ringgroups', '1', NULL, 'modules_$backupid'),
('sipsettings', '1', NULL, 'modules_$backupid'),
('soundlang', '1', NULL, 'modules_$backupid'),
('ucp', '1', NULL, 'modules_$backupid'),
('userman', '1', NULL, 'modules_$backupid'),
('voicemail', '1', NULL, 'modules_$backupid')
ON DUPLICATE KEY UPDATE val=VALUES(val);"
# TODO update
#mysql -e "use $DBNAME;INSERT INTO kvstore_FreePBX_modules_Backup (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
#('backup_items', 'a9fe727b-fc4c-40c4-ad45-bcabd075302a', 'blob', '$backupid')
#ON DUPLICATE KEY UPDATE val=VALUES(val);"
elif [[ $version -lt 15 ]] ; then
# set first backup as the one for SME way
# set destination
mysql -e "use $DBNAME;UPDATE backup_server_details set value = '/home/e-smith/files/freepbx' WHERE server_id = 1;"
# set info for backup 1
#data = a:1:{s:10:"created_by";s:11:"install.php";}
mysql -e "use $DBNAME;INSERT INTO backup (\`id\`, \`name\`, \`description\` , \`immortal\` ,\`data\`, \`email\` ) VALUES (1, 'Default backup', 'Default SME PBX backup; automatically installed', 'true','', 'admin' ) ON DUPLICATE KEY UPDATE \`description\` = 'Default SME PBX backup; automatically installed', \`immortal\` = 'true', \`email\` = 'admin' , \`name\`= 'Default backup' ;" 2>/dev/null || mysql -e "use $DBNAME;INSERT INTO backup (\`id\`, \`name\`, \`emailaddr\` ) VALUES (1, 'SMEbackup', 'admin' ) ON DUPLICATE KEY UPDATE \`name\` = 'SMEbackup', \`emailaddr\` = 'admin' ;"
mysql -e "use $DBNAME;ALTER TABLE backup_details ADD UNIQUE uniq ( \`backup_id\` , \`key\` , \`index\` ) ;"
mysql -e "use $DBNAME;INSERT INTO backup_details (\`backup_id\`, \`key\`, \`index\`, \`value\`) VALUES
(1, 'delete_time_type', '', 'days'),
(1, 'delete_amount', '', '2'),
(1, 'desc', '', 'Default SME PBX backup; automatically installed'),
(1, 'cron_schedule', '', 'weekly'),
(1, 'cron_random', '', 'on'),
(1, 'cron_month', '', ''),
(1, 'cron_minute', '', '0'),
(1, 'cron_hour', '', '0'),
(1, 'cron_dow', '', '0'),
(1, 'cron_dom', '', ''),
(1, 'bu_server', '', '0'),
(1, 'delete_time', '', '0'),
(1, 'email', '', 'admin'),
(1, 'emailfailonly', '', '1'),
(1, 'storage_servers', '0', '1') ON DUPLICATE KEY UPDATE \`value\`=VALUES(\`value\`) ;"
mysql -e "use $DBNAME;ALTER TABLE backup_details DROP INDEX uniq;"
# set what to backup
mysql -e "use $DBNAME;ALTER TABLE backup_items ADD UNIQUE \`uniq\` ( \`backup_id\` , \`type\` , \`path\` ( 15 ) ) ;"
mysql -e "use freepbxdb;INSERT INTO backup_items (\`backup_id\`, \`type\`, \`path\`, \`exclude\`) VALUES
(1, 'dir', '/etc/dahdi', 'a:0:{}'),
(1, 'dir', '__ASTSPOOLDIR__/voicemail', 'a:0:{}'),
(1, 'mysql', 'server-2', 'a:0:{}'),
(1, 'astdb', 'astdb', 'a:0:{}'),
(1, 'mysql', 'server-3', 'a:0:{}'),
(1, 'dir', '__ASTETCDIR__', 'a:0:{}'),
(1, 'dir', '__AMPWEBROOT__', 'a:0:{}'),
(1, 'dir', '__AMPBIN__', 'a:0:{}'),
(1, 'dir', '/tftpboot', 'a:0:{}') ON DUPLICATE KEY UPDATE \`exclude\`=VALUES(\`exclude\`) ;";
mysql -e "use $DBNAME;ALTER TABLE backup_items DROP INDEX \`uniq\` ;"
fi
# make sure all perms are ok for backup
/usr/sbin/fwconsole chown > /dev/null 2>&1

View File

@ -0,0 +1,20 @@
#/bin/bash
# Remove crontab entry automatically added by FreePBX
# as it generate an error (run as root before asterisk
# which means asterisk won't be allowed to open the debug
# file /tmp/freepbx_debug.log, and send a email to the admin
crontab -l > /tmp/freepbx_old_crontab
awk '$0!~/freepbx-cron-scheduler.php/ { print $0 }' /tmp/freepbx_old_crontab > /tmp/freepbx_new_crontab
crontab /tmp/freepbx_new_crontab
rm -f /tmp/freepbx_old_crontab
rm -f /tmp/freepbx_new_crontab
# Now change permissions on /tmp/freepbx_debug.log to be sure
# asterisk user has write permission
if [ -e /tmp/freepbx_debug.log ]; then
chown asterisk:asterisk /tmp/freepbx_debug.log
chmod 700 /tmp/freepbx_debug.log
fi

View File

@ -0,0 +1,22 @@
#!/bin/bash
path='PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/root\/bin'
cronfile='/var/spool/cron/asterisk'
[ ! -f $cronfile ] && exit 0
status=$(/sbin/e-smith/config getprop freepbx status || echo "disabled")
# add PATH to fist line if not present; else update it
sed -i "1!b;s/^PATH.*/$path/; t; 1i $path" $cronfile
# remove any other occurence of PATH
sed -i "1p;t; /^PATH.*/d" $cronfile
# check if freepbx enabled
if [[ $status == "enabled" ]]; then
# if enabled uncomment
sed -ri 's/^#(\@[a-zA-Z]+ .*|[0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ .*)/\1/' $cronfile
else
# if disabled comment out
sed -ri 's/^(\@[a-zA-Z]+ .*|[0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ .*)/#\1/' $cronfile
fi
#remove any duplicate entry
awk '!x[$0]++' ${cronfile} >${cronfile}-tmp && cat ${cronfile}-tmp > ${cronfile} && rm -f ${cronfile}-tmp

View File

@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php
// No use outputting anything, as env forces php headers to appear. Sigh.
function getconf($filename) {
$file = file($filename);
foreach ($file as $line) {
if (preg_match("/^\s*([\w]+)\s*=\s*\"?([\w\/\:\.\%-]*)\"?\s*([;#].*)?/",$line,$matches)) {
$conf[ $matches[1] ] = $matches[2];
}
}
return $conf;
}
$amp_conf = getconf("/etc/amportal.conf");
// Start quickly.
$bootstrap_settings['freepbx_auth'] = false; // Just in case.
$restrict_mods = true; // Takes startup from 0.2 seconds to 0.07 seconds.
include '/etc/freepbx.conf';
$astman = new AGI_AsteriskManager();
if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {
unset( $astman );
}
@mkdir("/home/e-smith/db/freepbx/");
$fh = fopen("/home/e-smith/db/freepbx/astdb.dump", "w");
$astdb = $astman->database_show();
foreach ($astdb as $key => $val) {
if ($key == "") { continue; }
if ($key == "Privilege") { continue; }
fwrite($fh, "[$key] [$val]\n");
}
fclose($fh);
?>

View File

@ -0,0 +1,4 @@
PERMS=0660
UID="root"
GID="asterisk"

View File

@ -0,0 +1,13 @@
[directories]
astetcdir => /etc/asterisk
astmoddir => { return '/usr/lib64/asterisk/modules' if -d '/usr/lib64/asterisk/modules';
return '/usr/lib/asterisk/modules' if -d '/usr/lib/asterisk/modules'; }
astvarlibdir => /var/lib/asterisk
astdatadir => { return '/var/lib/asterisk' if -d '/var/lib/asterisk/documentation' ;
return '/usr/share/asterisk' if -d '/usr/share/asterisk/documentation';}
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk

View File

@ -0,0 +1,39 @@
[options]
languageprefix = yes ; Use the new sound prefix path syntax
;verbose = 3
;debug = 3
;alwaysfork = yes ; same as -F at startup
;nofork = yes ; same as -f at startup
;quiet = yes ; same as -q at startup
;timestamp = yes ; same as -T at startup
execincludes = yes ; support #exec in config files
;console = yes ; Run as console (same as -c at startup)
highpriority = yes ; Run realtime priority (same as -p at startup)
;initcrypto = yes ; Initialize crypto keys (same as -i at startup)
nocolor = yes ; Disable console colors
;dontwarn = yes ; Disable some warnings
;dumpcore = yes ; Dump core on crash (same as -g at startup)
;internal_timing = yes
;systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues
;maxcalls = 10 ; Maximum amount of calls allowed
;maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit
;cache_record_files = yes ; Cache recorded sound files to another directory during recording
;record_cache_dir = /tmp ; Specify cache directory (used in conjunction with cache_record_files)
;transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded
;transmit_silence = yes ; Transmit silence while a channel is in a waiting state, a recording only state, or when DTMF is
; being generated. Note that the silence internally is generated in raw signed linear format.
; This means that it must be transcoded into the native format of the channel before it can be sent
; to the device. It is for this reason that this is optional, as it may result in requiring a
; temporary codec translation path for a channel that may not otherwise require one.
;transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly
;runuser = asterisk ; The user to run as
;rungroup = asterisk ; The group to run as
;dahdichanname = yes ; Channels created by chan_dahdi will be called 'DAHDI', otherwise 'Zap'
; Changing the following lines may compromise your security.
;[files]
;astctlpermissions = 0660
;astctlowner = root
;astctlgroup = apache
;astctl = asterisk.ctl

View File

@ -0,0 +1,20 @@
;
; Note - if the database server is hosted on the same machine as the
; asterisk server, you can achieve a local Unix socket connection by
; setting hostname = localhost
;
; port and sock are both optional parameters. If hostname is specified
; and is not "localhost", then cdr_mysql will attempt to connect to the
; port specified or use the default port. If hostname is not specified
; or if hostname is "localhost", then cdr_mysql will attempt to connect
; to the socket file specified by sock or otherwise use the default socket
; file.
;
[global]
hostname = localhost
dbname = {${'freepbx'}{'CdrDbName'};}
password = {${'freepbx'}{'DbPassword'};}
user = {${'freepbx'}{'DbUser'};}
userfield=1
sock = /var/lib/mysql/mysql.sock

View File

@ -0,0 +1,11 @@
;------------------------------------------------------------
; !!DO NOT MODIFY THIS FILE!!
;
; Manual changes will be lost when this file is regenerated.
;
; Please read the developer's guide, which is available
; at http://www.contribs.org/development/
;
; Copyright (C) 1999-2006 Mitel Networks Corporation
;------------------------------------------------------------

View File

@ -0,0 +1,8 @@
;
; Asterisk Call Management support
;
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0

View File

@ -0,0 +1,7 @@
[admin]
secret = {${'freepbx'}{'ManagerPassword'};}
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

View File

@ -0,0 +1,4 @@
#include manager_additional.conf
#include manager_custom.conf

View File

@ -0,0 +1,11 @@
;------------------------------------------------------------
; !!DO NOT MODIFY THIS FILE!!
;
; Manual changes will be lost when this file is regenerated.
;
; Please read the developer's guide, which is available
; at http://www.contribs.org/development/
;
; Copyright (C) 1999-2006 Mitel Networks Corporation
;------------------------------------------------------------

View File

@ -0,0 +1,51 @@
{
my $dbname = $freepbx{'DbName'} || 'freepbxdb';
my $cdrdbname = $freepbx{'CdrDbName'} || 'asteriskcdrdb';
my $dbuser = $freepbx{'DbUser'} || 'freepbxuser';
my $dbpass = $freepbx{'DbPassword'} || 'secret';
my $cdrdbpass = $freepbx{'CdrDbPassword'} || 'secret';
my $ManagerPassword = $freepbx{'ManagerPassword'} || 'secret';
$OUT .= << "HERE";
#! /bin/sh
if [ ! -d /var/lib/mysql/$dbname ]; then
mysql -e "create database $dbname CHARACTER SET utf8 COLLATE utf8_unicode_ci ;"
if [ -e /usr/share/freepbx/sql/asterisk.sql ]; then
mysql $dbname < /usr/share/freepbx/sql/asterisk.sql
else
echo "Error: file /usr/share/freepbx/sql/asterisk.sql doesn't exists"
exit 1
fi
fi
if [ ! -d /var/lib/mysql/$cdrdbname ]; then
mysql -e "create database $cdrdbname CHARACTER SET utf8 COLLATE utf8_unicode_ci ;"
if [ -e /usr/share/freepbx/sources/freepbx/installlib/SQL/cdr.sql ]; then
mysql $cdrdbname < /usr/share/freepbx/sources/freepbx/installlib/SQL/cdr.sql
else
echo "Error: file /usr/share/freepbx/sources/freepbx/installlib/SQL/cdr.sql doesn't exists"
exit 1
fi
fi
/usr/bin/mysql $dbname -e 'INSERT INTO `admin` (`variable`, `value`) VALUES ("email", "admin\@$DomainName") ON DUPLICATE KEY UPDATE `value` = "admin\@$DomainName";'
/usr/bin/mysql $dbname -e 'INSERT INTO `ampusers` (`username`, `password_sha1`, `extension_low`, `extension_high`, `deptname`, `sections`) VALUES
("admin", sha1("$ManagerPassword"), "", "", "", 0x2a) ON DUPLICATE KEY UPDATE `password_sha1` = sha1("$ManagerPassword");'
/usr/bin/mysql <<EOF
USE mysql;
GRANT ALL PRIVILEGES ON ${dbname} TO '$dbuser'\@'localhost' identified by '$dbpass';
GRANT ALL PRIVILEGES ON ${cdrdbname} TO '$dbuser'\@'localhost' identified by '$dbpass';
FLUSH PRIVILEGES;
EOF
HERE
}

View File

@ -0,0 +1,47 @@
{
# vim: ft=perl:
$haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ? 'yes' : 'no';
$OUT = '';
if ((${'freepbx'}{'status'} || 'disabled') eq 'enabled' &&
(${'httpd-fpbx'}{'status'} || 'disabled') eq 'enabled'){
if (($port eq "80") && ($haveSSL eq 'yes')){
$OUT .= " RewriteRule ^/freepbx(/.*|\$) https://%{HTTP_HOST}/freepbx\$1 [L,R]\n";
$OUT .= " RewriteRule ^/ucp(/.*|\$) https://%{HTTP_HOST}/ucp\$1 [L,R]\n";
}
else{
$OUT .= " ProxyPass /freepbx http://127.0.0.1:${'httpd-fpbx'}{TCPPort}/freepbx\n";
$OUT .= " ProxyPassReverse /freepbx http://127.0.0.1:${'httpd-fpbx'}{TCPPort}/freepbx\n";
$OUT .= " ProxyPass /ucp http://127.0.0.1:${'httpd-fpbx'}{TCPPort}/ucp\n";
$OUT .= " ProxyPassReverse /ucp http://127.0.0.1:${'httpd-fpbx'}{TCPPort}/ucp\n";
}
foreach my $url qw(recordings){
$OUT .= " RewriteRule ^/$url(.*|\$) /freepbx/$url\$1 [L,R]\n";
}
$OUT .=<<"HERE";
<Location /freepbx>
SSLRequireSSL on
Require ip $localAccess $externalSSLAccess
</Location>
<Location /freepbx/admin>
Require ip $localAccess $externalSSLAccess
</Location>
<Location /freepbx/recordings>
Require all granted
</Location>
<Location /ucp>
SSLRequireSSL on
Require ip $localAccess $externalSSLAccess
</Location>
HERE
}
}

View File

@ -0,0 +1,28 @@
{
use esmith::AccountsDB;
sub getUsersList ($){
my ($panelName) = @_;
my $a = esmith::AccountsDB->open_ro || die "Error opening accounts db";
my @users = $a->users();
my @groups = $a->groups();
my @fpbxUsers = ();
foreach my $user (@users){
my $panels = $user->prop('AdminPanels') || '';
push(@fpbxUsers,$user->key) if ($panels =~ /^(.*,)?$panelName(,.*)?$/);
}
foreach my $group (@groups){
$panels = $group->prop('AdminPanels') || '';
if ($panels =~ /^(.*,)?$panelName(,.*)?$/){
my @members = split(/,/,($group->prop('Members') || ''));
push(@fpbxUsers,@members);
}
}
my %seen = ();
my $u = join (' ', grep { ! $seen{ $_ }++ } @fpbxUsers);
return $u;
}
}

View File

@ -0,0 +1,22 @@
{
#---------------------------------------------------------------------
# Grab ValidFrom access list property of httpd-admin
# SSL enabled virtual hosts should only allow access from IP's in
# this list, as well as local networks.
#---------------------------------------------------------------------
use esmith::NetworksDB;
my $ndb = esmith::NetworksDB->open_ro();
my @localAccess = $ndb->local_access_spec();
my $validFrom = ${'httpd-admin'}{'ValidFrom'};
if ($validFrom)
{
push @localAccess, split /,/, $validFrom;
}
$localAccess .= join ' ',
map { s:/255.255.255.255::; $_ }
@localAccess;
"";
}

View File

@ -0,0 +1,7 @@
{
$OUT .= "LoadModule auth_tkt_module modules/mod_auth_tkt.so\n";
my $secret = ${'httpd-admin'}{TKTAuthSecret} || "34322500-7330-4400-423A-3A00434F5245";
$OUT .= "TKTAuthSecret \"$secret\"\n";
$OUT .= "TKTAuthDigestType SHA256\n";
}

View File

@ -0,0 +1,152 @@
{
$OUT .= "Listen 127.0.0.1:${'httpd-fpbx'}{TCPPort}\n";
$OUT .= <<HERE;
HostnameLookups off
ServerAdmin admin@$DomainName
ServerRoot /etc/httpd
ServerTokens ProductOnly
User asterisk
Group asterisk
ErrorLog /var/log/httpd/fpbx_error_log
LogLevel warn
HERE
foreach (qw(
env
log_config
mime
proxy
proxy_fcgi
authz_core
authn_core
unixd
systemd
mpm_prefork
negotiation
status
info
include
autoindex
dir
asis
imap
imagemap
actions
userdir
alias
rewrite
access
authz_host
authz_user
auth
auth_anon
auth_digest
expires
headers
usertrack
setenvif
))
{
next unless -f "/usr/lib/httpd/modules/mod_${_}.so" ||
-f "/usr/lib64/httpd/modules/mod_${_}.so";
$OUT .= "LoadModule ${_}_module modules/mod_${_}.so\n";
}
# we do not use php module anymore, but php-fpm
$OUT .= <<HERE;
PidFile /var/run/httpd-fpbx.pid
UseCanonicalName off
LogFormat "%h %l %u %t \\"%r\\" %>s %b" common
LogFormat "%{User-agent}i" agent
CustomLog /var/log/httpd/fpbx_access_log common
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MaxClients 150
MaxRequestsPerChild 100
ServerName www.$DomainName
MinSpareServers 1
MaxSpareServers 5
StartServers 1
Timeout 300
DefaultIcon /icons/unknown.gif
DirectoryIndex index.htm index.html index.php index.cgi
IndexOptions FancyIndexing VersionSort NameWidth=*
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
AccessFileName .htaccess
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
TypesConfig /etc/mime.types
AddEncoding x-compress Z
AddEncoding x-gzip gz
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
AddLanguage en .en
AddLanguage fr .fr
AddLanguage de .de
AddLanguage da .da
AddLanguage el .el
AddLanguage it .it
LanguagePriority en fr de
AddType text/html .shtml
AddType application/x-pkcs7-crl .crl
AddType application/x-x509-ca-cert .crt
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
AddHandler cgi-script .cgi
AddHandler server-parsed .shtml
AddHandler imap-file map
DocumentRoot /opt/freepbx/
HERE
}

View File

@ -0,0 +1,10 @@
# First, we configure the "default" to be a very restrictive set of
# permissions.
<Directory />
Options None
AllowOverride None
Require all denied
</Directory>

View File

@ -0,0 +1,4 @@
Alias /freepbx /opt/freepbx/
Alias /ucp /opt/freepbx/ucp/

View File

@ -0,0 +1,16 @@
<Directory /opt/freepbx/>
Options +followSymlinks
{
my $key = "freepbx";
my $pool_name = lc $key;
my $version = ( $freepbx{PHPVersion} eq '74' )? '74' : '56';
$OUT .="
<FilesMatch .php\$>
SetHandler \"proxy:unix:/var/run/php-fpm/php${version}-${pool_name}.sock|fcgi://localhost\"
</FilesMatch>\n";
}
AllowOverride All
Require host 127.0.0.1
</Directory>

View File

@ -0,0 +1,24 @@
<Directory /opt/freepbx/admin/>
Options +followSymlinks
</Directory>
<Directory /opt/freepbx/admin/modules/>
Require host 127.0.0.1
</Directory>
<Location /freepbx/admin>
AuthType Basic
TKTAuthLoginURL /server-common/cgi-bin/login
Require user admin {getUsersList('freepbx');}
{
my $ManagerTimeout = ${'httpd-admin'}{ManagerTimeout} || "30m";
$OUT = " TKTAuthTimeout $ManagerTimeout\n";
my $Cookie = ${'httpd-admin'}{Cookie} || "disabled";
$OUT .= " TKTAuthCookieExpires $ManagerTimeout\n" if "$Cookie" eq "enabled";
my $ManagerTimeoutReset = ${'httpd-admin'}{ManagerTimeoutReset} || "0.66";
$OUT .= " TKTAuthTimeoutRefresh $ManagerTimeoutReset\n";
}
#Satisfy all
</Location>

View File

@ -0,0 +1,36 @@
/var/log/asterisk/messages
/var/log/asterisk/event_log
/var/log/asterisk/queue_log
/var/log/asterisk/full
/var/log/asterisk/security
/var/log/asterisk/freepbx.log
/var/log/asterisk/freepbx_security.log
/var/log/asterisk/ucp_err.log
/var/log/asterisk/ucp_out.log
/var/log/asterisk/cdr-csv/Master.csv
/var/log/asterisk/warnings
/var/log/asterisk/misdn.log
/var/log/asterisk/backup.log
/var/log/asterisk/backup-*.log
/var/log/asterisk/freepbx_dbug
/var/log/asterisk/core-fastagi_out.log
/var/log/asterisk/core-calltransfer-monitor_err.log
/var/log/asterisk/core-calltransfer-monitor_out.log
\{
missingok
notifempty
compress
compressoptions -T0
compresscmd /usr/bin/xz
compressext .xz
uncompresscmd /usr/bin/unxz
daily
rotate 365
su asterisk asterisk
create 0640 asterisk asterisk
sharedscripts
postrotate
/usr/sbin/asterisk -rx 'logger reload' >/dev/null 2>/dev/null || true
endscript
\}

View File

@ -0,0 +1 @@
# /var/log/xferlog already handled in /etc/logrotate.d/proftpd

View File

@ -0,0 +1,12 @@
[MySQL-{ ${freepbx}{CdrDbName} || 'asteriskcdrdb' }]
Description=MySQL connection to '{ ${freepbx}{CdrDbName} || 'asteriskcdrdb' }' database
driver=MySQL
server=localhost
database={ ${freepbx}{CdrDbName} || 'asteriskcdrdb' }
Port=3306
Socket=/var/lib/mysql/mysql.sock
option=3
Charset=utf8
User = { ${freepbx}{DbUser} || 'freepbxuser'}
Password = { ${freepbx}{DbPassword} || 'freepbxuser'}

View File

@ -0,0 +1,70 @@
{
my $PHPVersion = ( $freepbx{PHPVersion} eq '74' )? '74' : '56';
if ($PHP_VERSION eq $PHPVersion){
if (($freepbx{'status'} || 'disabled') eq 'enabled'){
my $max_upload_size = ($freepbx{MaxUploadSize} || '100M');
$max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
my $memory_limit = ($freepbx{MemoryLimit} || '512M');
$memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
my $open_basedir= $freepbx{PHPBaseDir} || '';
$open_basedir = "/usr/share/freepbx:/var/lib/freepbx:/var/log/freepbx/:/var/lib/php/freepbx:/home/e-smith/files/freepbx:/dev/urandom:/proc/meminfo:$open_basedir";
my $id = 'freepbx';
my $max_children = $freepbx{'PHPmaxChildren'} || 15;
my $min_spare_servers = $freepbx{'PHPminServers'} || 3;
my $start_servers = $freepbx{'PHPstartServers'} || 3;
my $max_spare_servers = $freepbx{'PHPmaxServers'} || 6;
my $max_requests = $freepbx{'PHPmaxRequests'} || 5000;
$min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
$start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
$OUT .=<<_EOF;
[freepbx]
listen.owner = root
listen.group = asterisk
listen.mode = 0660
listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
user = asterisk
group = asterisk
catch_workers_output = yes
pm = dynamic
pm.max_children = $max_children
pm.start_servers = $start_servers
pm.min_spare_servers = $min_spare_servers
pm.max_spare_servers = $max_spare_servers
pm.max_requests = $max_requests
request_terminate_timeout = 60m
php_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[error_log] = /var/log/$id/error.log
php_admin_value[memory_limit] = $memory_limit
php_admin_value[session.save_path] = /var/lib/php/fpbx-session
php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
php_admin_value[sys_temp_dir] = /var/lib/php/$id/tmp
php_admin_value[post_max_size] = $max_upload_size
php_admin_value[upload_max_filesize] = $max_upload_size
php_admin_value[max_execution_time] = 900
php_admin_value[max_input_time] = 900
php_admin_flag[allow_url_include] = off
php_admin_flag[allow_url_fopen] = on
php_admin_flag[file_uploads] = on
php_admin_flag[session.cookie_httponly] = on
; Needed so that the #!/usr/bin/env php shebang will point to the correct PHP version
env[PATH] = /opt/remi/php{{ fpbx_php_version }}/root/usr/bin:/opt/remi/php{{ fpbx_php_version }}/root/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
;env[http_proxy] = {{ system_proxy }}
;env[https_proxy] = {{ system_proxy }}
;env[no_proxy] =
_EOF
}
else{
$OUT .= '; Nextcloud is disabled';
}
}
}

View File

@ -0,0 +1,31 @@
#!/usr/bin/perl
#----------------------------------------------------------------------
# heading : Telephony
# description : FreePBX
# navigation : 4000 4200
#----------------------------------------------------------------------
use strict;
use CGI':all';
use CGI::Carp qw(fatalsToBrowser);
BEGIN
{
$ENV {'PATH'} = '/bin:/usr/bin:/sbin';
$ENV {'SHELL'} = '/bin/bash';
delete $ENV {'ENV'};
}
my $q = new CGI;
my $content="0; url=https://".$ENV {'HTTP_X_FORWARDED_HOST'}."/freepbx/admin";
$q->default_dtd('-//W3C//DTD XHTML 1.0 Transitional//EN');
print $q->header ('text/html');
print $q->start_html (-head=>meta({-http_equiv=>'refresh', -content=>$content}));
print $q->end_html;

View File

View File

@ -0,0 +1,202 @@
#------------------------------------------------------------
# !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------
LoadModule auth_tkt_module modules/mod_auth_tkt.so
TKTAuthSecret "1234"
Listen 127.0.0.1:960
HostnameLookups off
ServerAdmin admin
ServerRoot /etc/httpd
ServerTokens ProductOnly
User asterisk
Group asterisk
ErrorLog /var/log/httpd/fpbx_error_log
LogLevel warn
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule status_module modules/mod_status.so
LoadModule info_module modules/mod_info.so
LoadModule include_module modules/mod_include.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule asis_module modules/mod_asis.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule php4_module modules/libphp4.so
<IfModule mod_php4.c>
AddIcon /icons/php4.gif .php3 .php4 .php .phtml
AddIcon /icons/phps.gif .phps
</IfModule>
<IfModule mod_php5.c>
AddIcon /icons/php5.gif .php3 .php4 .php5 .php .phtml
AddIcon /icons/phps.gif .phps
</IfModule>
PidFile /var/run/httpd-fpbx.pid
ScoreBoardFile /var/run/httpd-fpbx.scoreboard
UseCanonicalName off
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{User-agent}i" agent
CustomLog /var/log/httpd/fpbx_access_log common
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MaxClients 150
MaxRequestsPerChild 100
ServerName www.domain.tld
MinSpareServers 1
MaxSpareServers 5
StartServers 1
Timeout 300
DefaultIcon /icons/unknown.gif
DirectoryIndex index.htm index.html index.php index.cgi
IndexOptions FancyIndexing VersionSort NameWidth=*
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
AccessFileName .htaccess
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
DefaultType text/plain
TypesConfig /etc/mime.types
AddEncoding x-compress Z
AddEncoding x-gzip gz
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
AddLanguage en .en
AddLanguage fr .fr
AddLanguage de .de
AddLanguage da .da
AddLanguage el .el
AddLanguage it .it
LanguagePriority en fr de
AddType text/html .shtml
AddType application/x-pkcs7-crl .crl
AddType application/x-x509-ca-cert .crt
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4.0" force-response-1.0
BrowserMatch "Java/1.0" force-response-1.0
BrowserMatch "JDK/1.0" force-response-1.0
AddHandler cgi-script .cgi
AddHandler server-parsed .shtml
AddHandler imap-file map
DocumentRoot /opt/freepbx/
# First, we configure the "default" to be a very restrictive set of
# permissions.
<Directory />
Options None
AllowOverride None
order deny,allow
deny from all
allow from none
</Directory>
Alias /freepbx /opt/freepbx/
<Directory /opt/freepbx/>
AddType application/x-httpd-php .php
AllowOverride None
order deny,allow
deny from all
allow from 127.0.0.1
</Directory>
<Directory /opt/freepbx/admin/>
Options +followSymlinks
php_admin_flag allow_url_fopen 1
php_admin_value max_execution_time 600
php_admin_value memory_limit 100M
php_admin_value upload_max_filesize 100M
php_admin_value post_max_size 100M
php_admin_flag file_upload 1
AuthType Basic
TKTAuthLoginURL /server-common/cgi-bin/login
require user admin
SetEnv IMGHDR_SRC "/server-common/server-manager.jpg"
Satisfy all
</Directory>
<Directory /opt/freepbx/panel/>
AuthType Basic
TKTAuthLoginURL /server-common/cgi-bin/login
require user admin
SetEnv IMGHDR_SRC "/server-common/server-manager.jpg"
Satisfy all
</Directory>
<Directory /opt/freepbx/admin/modules/>
deny from all
</Directory>

View File

@ -0,0 +1,13 @@
/var/log/freepbx/*.log {
missingok
notifempty
sharedscripts
delaycompress
su asterisk asterisk
create 660 asterisk asterisk
postrotate
/sbin/e-smith/service php56-php-fpm reload >/dev/null 2>&1 || true
/sbin/e-smith/service php74-php-fpm reload >/dev/null 2>&1 || true
endscript
}

View File

@ -0,0 +1,2 @@
asterisk-sound*:any:chown asterisk:asterisk -R /usr/share/asterisk/sounds
asterisk-moh-opsound:any:chown asterisk:asterisk -R /usr/share/asterisk/sounds

View File

@ -0,0 +1,14 @@
#!/bin/bash
version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/core/module.xml|cut -d. -f1)
php="56"
if [[ $version -ge 16 ]]
then
php="74"
elif [[ $version -le 15 ]]
then
php="56"
fi
forcephp=$(/sbin/e-smith/db configuration getprop freepbx PHPVersion 2>/dev/null || echo $php )
php=$forcephp
/usr/bin/php$php --define sys_temp_dir=/var/spool/asterisk/tmp/ --define allow_url_fopen=1 /var/lib/asterisk/bin/fwconsole $@

View File

@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=/dev/null

View File

@ -0,0 +1,19 @@
[Unit]
Description=FreePBX VoIP Server
Requires=mariadb.service
[Service]
Type=forking
ExecStartPre=/sbin/e-smith/service-status freepbx
ExecStart=/usr/sbin/fwconsole start -q
ExecStop=/usr/sbin/fwconsole stop -q
ExecReload=/usr/sbin/fwconsole reload -q
SyslogIdentifier=FreePBX
Restart=on-failure
StartLimitInterval=0
RestartSec=30
[Install]
WantedBy=multi-user.target sme-server.target

View File

@ -0,0 +1,21 @@
[Unit]
Description=The Koozali SME Server FreePBX web service
After=network.service remote-fs.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)
[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStartPre=/sbin/e-smith/service-status httpd-fpbx
ExecStartPre=/sbin/e-smith/expand-template /etc/httpd/fpbx-conf/httpd.conf
ExecStart=/usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -DFOREGROUND
ExecReload=/usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
KillSignal=SIGCONT
PrivateTmp=true
[Install]
WantedBy=sme-server.target

228
root/usr/sbin/safe_asterisk Normal file
View File

@ -0,0 +1,228 @@
#!/bin/sh
ASTETCDIR="/etc/asterisk"
ASTSBINDIR="/usr/sbin"
ASTVARRUNDIR="/var/run/asterisk"
ASTVARLOGDIR="/var/log/asterisk"
CLIARGS="$*" # Grab any args passed to safe_asterisk
TTY=9 # TTY (if you want one) for Asterisk to run on
CONSOLE=yes # Whether or not you want a console
#NOTIFY=root@localhost # Who to notify about crashes
#EXEC=/path/to/somescript # Run this command if Asterisk crashes
#LOGFILE="${ASTVARLOGDIR}/safe_asterisk.log" # Where to place the normal logfile (disabled if blank)
#SYSLOG=local0 # Which syslog facility to use (disabled if blank)
MACHINE=`hostname` # To specify which machine has crashed when getting the mail
DUMPDROP="${DUMPDROP:-/tmp}"
RUNDIR="${RUNDIR:-/tmp}"
SLEEPSECS=4
ASTPIDFILE="${ASTVARRUNDIR}/asterisk.pid"
# comment this line out to have this script _not_ kill all mpg123 processes when
# asterisk exits
KILLALLMPG123=1
# run asterisk with this priority
PRIORITY=0
# set system filemax on supported OSes if this variable is set
# SYSMAXFILES=262144
# Asterisk allows full permissions by default, so set a umask, if you want
# restricted permissions.
#UMASK=022
# set max files open with ulimit. On linux systems, this will be automatically
# set to the system's maximum files open devided by two, if not set here.
# MAXFILES=32768
message() {
if test -n "$TTY" && test "$TTY" != "no"; then
echo "$1" >/dev/${TTY}
fi
if test -n "$SYSLOG"; then
logger -p "${SYSLOG}.warn" -t safe_asterisk[$$] "$1"
fi
if test -n "$LOGFILE"; then
echo "safe_asterisk[$$]: $1" >>"$LOGFILE"
fi
}
# Check if Asterisk is already running. If it is, then bug out, because
# starting safe_asterisk when Asterisk is running is very bad.
VERSION=`"${ASTSBINDIR}/asterisk" -nrx 'core show version' 2>/dev/null`
if test "`echo $VERSION | cut -c 1-8`" = "Asterisk"; then
message "Asterisk is already running. $0 will exit now."
exit 1
fi
# since we're going to change priority and open files limits, we need to be
# root. if running asterisk as other users, pass that to asterisk on the command
# line.
# if we're not root, fall back to standard everything.
if test `id -u` != 0; then
echo "Oops. I'm not root. Falling back to standard prio and file max." >&2
echo "This is NOT suitable for large systems." >&2
PRIORITY=0
message "safe_asterisk was started by `id -n` (uid `id -u`)."
else
if `uname -s | grep Linux >/dev/null 2>&1`; then
# maximum number of open files is set to the system maximum
# divided by two if MAXFILES is not set.
if test -z "$MAXFILES"; then
# just check if file-max is readable
if test -r /proc/sys/fs/file-max; then
MAXFILES=$((`cat /proc/sys/fs/file-max` / 2))
# don't exceed upper limit of 2^20 for open
# files on systems where file-max is > 2^21
if test $MAXFILES -gt 1048576; then
MAXFILES=1048576
fi
fi
fi
SYSCTL_MAXFILES="fs.file-max"
elif `uname -s | grep Darwin /dev/null 2>&1`; then
SYSCTL_MAXFILES="kern.maxfiles"
fi
if test -n "$SYSMAXFILES"; then
if test -n "$SYSCTL_MAXFILES"; then
sysctl -w $SYSCTL_MAXFILES=$SYSMAXFILES
fi
fi
# set the process's filemax to whatever set above
ulimit -n $MAXFILES
if test ! -d "${ASTVARRUNDIR}"; then
mkdir -p "${ASTVARRUNDIR}"
chmod 770 "${ASTVARRUNDIR}"
fi
fi
if test -n "$UMASK"; then
umask $UMASK
fi
#
# Let Asterisk dump core
#
ulimit -c unlimited
#
# Don't fork when running "safely"
#
ASTARGS=""
if test -n "$TTY" && test "$TTY" != "no"; then
if test -c /dev/tty${TTY}; then
TTY=tty${TTY}
elif test -c /dev/vc/${TTY}; then
TTY=vc/${TTY}
elif test "$TTY" = "9"; then # ignore default if it was untouched
# If there is no /dev/tty9 and not /dev/vc/9 we don't
# necessarily want to die at this point. Pretend that
# TTY wasn't set.
TTY=
else
message "Cannot find specified TTY (${TTY})"
exit 1
fi
if test -n "$TTY"; then
ASTARGS="${ASTARGS} -vvvg"
if test "$CONSOLE" != "no"; then
ASTARGS="${ASTARGS} -c"
fi
fi
fi
if test ! -d "${RUNDIR}"; then
message "${RUNDIR} does not exist, creating"
if ! mkdir -p "${RUNDIR}"; then
message "Unable to create ${RUNDIR}"
exit 1
fi
fi
if test ! -w "${DUMPDROP}"; then
message "Cannot write to ${DUMPDROP}"
exit 1
fi
#
# Don't die if stdout/stderr can't be written to
#
trap '' PIPE
#
# Run scripts to set any environment variables or do any other system-specific setup needed
#
if test -d "${ASTETCDIR}/startup.d"; then
for script in "${ASTETCDIR}/startup.d/"*.sh; do
if test -r "${script}"; then
. "${script}"
fi
done
fi
run_asterisk()
{
while :; do
if test -n "$TTY" && test "$TTY" != "no"; then
cd "${RUNDIR}"
stty sane </dev/${TTY}
nice -n $PRIORITY "${ASTSBINDIR}/asterisk" -f ${CLIARGS} ${ASTARGS} >/dev/${TTY} 2>&1 </dev/${TTY}
else
cd "${RUNDIR}"
nice -n $PRIORITY "${ASTSBINDIR}/asterisk" -f ${CLIARGS} ${ASTARGS} >/dev/null 2>&1 </dev/null
fi
EXITSTATUS=$?
message "Asterisk ended with exit status $EXITSTATUS"
if test $EXITSTATUS -eq 0; then
# Properly shutdown....
message "Asterisk shutdown normally."
exit 0
elif test $EXITSTATUS -gt 128; then
EXITSIGNAL=$((EXITSTATUS - 128))
message "Asterisk exited on signal $EXITSIGNAL."
if test -n "$NOTIFY"; then
echo "Asterisk on $MACHINE exited on signal $EXITSIGNAL. Might want to take a peek." | \
mail -s "Asterisk on $MACHINE died (sig $EXITSIGNAL)" $NOTIFY
fi
if test -n "$EXEC"; then
$EXEC
fi
PID=`cat ${ASTPIDFILE}`
DATE=`date "+%Y-%m-%dT%H:%M:%S%z"`
if test -f "${RUNDIR}/core.${PID}"; then
mv "${RUNDIR}/core.${PID}" "${DUMPDROP}/core.`hostname`-$DATE" &
elif test -f "${RUNDIR}/core"; then
mv "${RUNDIR}/core" "${DUMPDROP}/core.`hostname`-$DATE" &
fi
else
message "Asterisk died with code $EXITSTATUS."
PID=`cat ${ASTPIDFILE}`
DATE=`date "+%Y-%m-%dT%H:%M:%S%z"`
if test -f "${RUNDIR}/core.${PID}"; then
mv "${RUNDIR}/core.${PID}" "${DUMPDROP}/core.`hostname`-$DATE" &
elif test -f "${RUNDIR}/core"; then
mv "${RUNDIR}/core" "${DUMPDROP}/core.`hostname`-$DATE" &
fi
fi
message "Automatically restarting Asterisk."
sleep $SLEEPSECS
if test "0$KILLALLMPG123" -gt 0; then
pkill -9 mpg123
fi
done
}
if test -n "$ASTSAFE_FOREGROUND"; then
run_asterisk
else
run_asterisk &
fi

View File

@ -0,0 +1,62 @@
#!/usr/bin/env php
<?php
// No use outputting anything, as env forces php headers to appear. Sigh.
// Astdb trees that should be deleted before the restore
//
$deltree = array(
'AMPUSER',
'DEVICE',
'CF',
'CFB',
'CFU',
'CW',
'DND',
'DAYNIGHT',
);
function getconf($filename) {
$file = file($filename);
foreach ($file as $line) {
if (preg_match("/^\s*([\w]+)\s*=\s*\"?([\w\/\:\.\%-]*)\"?\s*([;#].*)?/",$line,$matches)) {
$conf[ $matches[1] ] = $matches[2];
}
}
return $conf;
}
$amp_conf = getconf("/etc/amportal.conf");
require_once($amp_conf['AMPWEBROOT']."/admin/common/php-asmanager.php");
$astman = new AGI_AsteriskManager();
if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {
unset( $astman );
}
$dump = file_get_contents("/home/e-smith/db/freepbx/astdb.dump");
// Before restoring, let's clear out all of the current settings for the main objects
// but as a safety, if the dump file is empy, we won't clear it out.
//
if (!empty($dump)) {
$arr = explode("\n", $dump);
foreach ($deltree as $family) {
$astman->database_deltree($family);
}
foreach ($arr as $line) {
$result = preg_match("/\[(.+)\] \[(.+)\]/", $line, $matches);
// Now, the bad ones we know about are the ones that start with //, anything starting with SIP or IAX,
// and RG (which are only temporary anyway).
if (!isset($matches[1]) || $matches[1] == "") { continue; }
$pattern = "/(^\/\/)|(^\/IAX)|(^\/SIP)|(^\/RG)|(^\/BLKVM)|(^\/FM)|(^\/dundi)/";
if (preg_match($pattern, $matches[1])) { continue; }
preg_match("/(.+)\/(.+)$/", $matches[1], $famkey);
$famkey[1]=trim($famkey[1], '/');
$astman->database_put($famkey[1], $famkey[2], '"'.$matches[2].'"');
}
}
?>

View File

@ -0,0 +1,36 @@
#!/bin/bash
clear
echo "----------------------------"
echo "!!!!! WARNING !!!!!"
echo "----------------------------"
echo ""
echo "This script will remove from your server:"
echo " - freepbx and asterisk cdr MySQL databases"
echo " - freepbx MySQL User"
echo " - freepbx DB entries (freepbx, httpd-fpbx and dahdi)"
echo " - /opt/freepbx"
echo ""
echo -n "Are you sure you want to remove FreePBX permanently ? (y/n) [n] "
read confirm
if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
echo "Droping MySQL databases..."
DBNAME=$(/sbin/e-smith/db configuration getprop freepbx DbName)
CDRDBNAME=$(/sbin/e-smith/db configuration getprop freepbx CdrDbName)
mysql -e "DROP DATABASE $DBNAME"
mysql -e "DROP DATABASE $CDRDBNAME"
echo "Deleting MySQL User..."
DBUSER=$(/sbin/e-smith/db configuration getprop freepbx DbUser)
mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$DBUSER'@'localhost';"
mysql -u root -e "DROP USER '$DBUSER'@'localhost';" > /dev/null 2>&1
echo "Removing SME DB entries..."
/sbin/e-smith/db configuration delete freepbx
/sbin/e-smith/db configuration delete httpd-fpbx
/sbin/e-smith/db configuration delete dahdi
echo "Removing /opt/freepbx ..."
rm -rf /opt/freepbx
echo "Removing this script ..."
rm -f /root/uninstall-freepbx.sh
echo "Done!"
fi

View File

View File

@ -0,0 +1,687 @@
-- MySQL dump 10.13 Distrib 5.1.69, for redhat-linux-gnu (x86_64)
--
-- Host: localhost Database: asterisk
-- ------------------------------------------------------
-- Server version 5.1.69
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
set @@default_storage_engine = 'MyISAM';
--
-- Table structure for table `admin`
--
DROP TABLE IF EXISTS `admin`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin` (
`variable` varchar(20) NOT NULL DEFAULT '',
`value` varchar(80) NOT NULL DEFAULT '',
PRIMARY KEY (`variable`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `admin`
--
LOCK TABLES `admin` WRITE;
/*!40000 ALTER TABLE `admin` DISABLE KEYS */;
INSERT INTO `admin` VALUES ('need_reload','true'),('version','2.11.0rc1'),('default_directory','1'),('directory28_migrated','1');
/*!40000 ALTER TABLE `admin` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ampusers`
--
DROP TABLE IF EXISTS `ampusers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ampusers` (
`username` varchar(255) NOT NULL,
`password_sha1` varchar(40) NOT NULL,
`extension_low` varchar(20) NOT NULL DEFAULT '',
`extension_high` varchar(20) NOT NULL DEFAULT '',
`deptname` varchar(20) NOT NULL DEFAULT '',
`sections` blob NOT NULL,
PRIMARY KEY (`username`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ampusers`
--
LOCK TABLES `ampusers` WRITE;
/*!40000 ALTER TABLE `ampusers` DISABLE KEYS */;
/*!40000 ALTER TABLE `ampusers` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `cronmanager`
--
DROP TABLE IF EXISTS `cronmanager`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cronmanager` (
`module` varchar(24) NOT NULL DEFAULT '',
`id` varchar(24) NOT NULL DEFAULT '',
`time` varchar(5) DEFAULT NULL,
`freq` int(11) NOT NULL DEFAULT '0',
`lasttime` int(11) NOT NULL DEFAULT '0',
`command` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`module`,`id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cronmanager`
--
LOCK TABLES `cronmanager` WRITE;
/*!40000 ALTER TABLE `cronmanager` DISABLE KEYS */;
INSERT INTO `cronmanager` VALUES ('module_admin','UPDATES','22',24,0,'/var/lib/asterisk/bin/module_admin listonline > /dev/null 2>&1');
/*!40000 ALTER TABLE `cronmanager` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `dahdi`
--
DROP TABLE IF EXISTS `dahdi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dahdi` (
`id` varchar(20) NOT NULL DEFAULT '-1',
`keyword` varchar(30) NOT NULL DEFAULT '',
`data` varchar(255) NOT NULL DEFAULT '',
`flags` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`keyword`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `dahdi`
--
LOCK TABLES `dahdi` WRITE;
/*!40000 ALTER TABLE `dahdi` DISABLE KEYS */;
/*!40000 ALTER TABLE `dahdi` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `devices`
--
DROP TABLE IF EXISTS `devices`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `devices` (
`id` varchar(20) NOT NULL DEFAULT '',
`tech` varchar(10) NOT NULL DEFAULT '',
`dial` varchar(255) NOT NULL DEFAULT '',
`devicetype` varchar(5) NOT NULL DEFAULT '',
`user` varchar(50) DEFAULT NULL,
`description` varchar(50) DEFAULT NULL,
`emergency_cid` varchar(100) DEFAULT NULL,
KEY `id` (`id`),
KEY `tech` (`tech`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `devices`
--
LOCK TABLES `devices` WRITE;
/*!40000 ALTER TABLE `devices` DISABLE KEYS */;
/*!40000 ALTER TABLE `devices` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `extensions`
--
DROP TABLE IF EXISTS `extensions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `extensions` (
`context` varchar(45) NOT NULL DEFAULT 'default',
`extension` varchar(45) NOT NULL DEFAULT '',
`priority` varchar(5) NOT NULL DEFAULT '1',
`application` varchar(45) NOT NULL DEFAULT '',
`args` varchar(255) DEFAULT NULL,
`descr` text,
`flags` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`context`,`extension`,`priority`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `extensions`
--
LOCK TABLES `extensions` WRITE;
/*!40000 ALTER TABLE `extensions` DISABLE KEYS */;
INSERT INTO `extensions` VALUES ('outrt-001-9_outside','_9.','1','Macro','dialout-trunk,1,${EXTEN:1}',NULL,0),('outrt-001-9_outside','_9.','2','Macro','outisbusy','No available circuits',0),('outbound-allroutes','include','1','outrt-001-9_outside','','',2);
/*!40000 ALTER TABLE `extensions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `fax_details`
--
DROP TABLE IF EXISTS `featurecodes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `featurecodes` (
`modulename` varchar(50) NOT NULL DEFAULT '',
`featurename` varchar(50) NOT NULL DEFAULT '',
`description` varchar(200) NOT NULL DEFAULT '',
`helptext` varchar(250) NOT NULL DEFAULT '',
`defaultcode` varchar(20) DEFAULT NULL,
`customcode` varchar(20) DEFAULT NULL,
`enabled` tinyint(4) NOT NULL DEFAULT '0',
`providedest` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`modulename`,`featurename`),
KEY `enabled` (`enabled`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `featurecodes`
--
LOCK TABLES `featurecodes` WRITE;
/*!40000 ALTER TABLE `featurecodes` DISABLE KEYS */;
INSERT INTO `featurecodes` VALUES ('core','userlogon','User Logon','','*11',NULL,1,0),('core','userlogoff','User Logoff','','*12',NULL,1,0),('core','zapbarge','ZapBarge','','888',NULL,1,1),('core','chanspy','ChanSpy','','555',NULL,1,1),('core','simu_pstn','Simulate Incoming Call','','7777',NULL,1,1),('core','pickup','Directed Call Pickup','','**',NULL,1,0),('core','pickupexten','Asterisk General Call Pickup','','*8',NULL,1,0),('core','blindxfer','In-Call Asterisk Blind Transfer','','##',NULL,1,0),('core','atxfer','In-Call Asterisk Attended Transfer','','*2',NULL,1,0),('core','automon','In-Call Asterisk Toggle Call Recording','','*1',NULL,1,0),('core','disconnect','In-Call Asterisk Disconnect Code','','**',NULL,1,0),('pbdirectory','app-pbdirectory','Phonebook dial-by-name directory','','411',NULL,1,1),('donotdisturb','dnd_on','DND Activate','','*78',NULL,1,0),('donotdisturb','dnd_off','DND Deactivate','','*79',NULL,1,0),('donotdisturb','dnd_toggle','DND Toggle','','*76',NULL,1,0),('recordings','record_save','Save Recording','','*77',NULL,1,0),('recordings','record_check','Check Recording','','*99',NULL,1,0),('callwaiting','cwon','Call Waiting - Activate','','*70',NULL,1,0),('callwaiting','cwoff','Call Waiting - Deactivate','','*71',NULL,1,0),('voicemail','myvoicemail','My Voicemail','','*97',NULL,1,0),('voicemail','dialvoicemail','Dial Voicemail','','*98',NULL,1,1),('voicemail','directdialvoicemail','Direct Dial Prefix','','*',NULL,1,0),('paging','intercom-prefix','Intercom prefix','','*80',NULL,1,0),('paging','intercom-on','User Intercom Allow','','*54',NULL,1,0),('paging','intercom-off','User Intercom Disallow','','*55',NULL,1,0),('blacklist','blacklist_add','Blacklist a number','','*30',NULL,1,1),('blacklist','blacklist_remove','Remove a number from the blacklist','','*31',NULL,1,1),('blacklist','blacklist_last','Blacklist the last caller','','*32',NULL,1,0),('fax','simu_fax','Dial System FAX','','666',NULL,1,1),('dictate','dodictate','Perform dictation','','*34',NULL,1,0),('dictate','senddictate','Email completed dictation','','*35',NULL,1,0),('findmefollow','fmf_toggle','Findme Follow Toggle','','*21',NULL,1,0),('campon','request','Camp-On Request','','*82',NULL,1,0),('campon','cancel','Camp-On Cancel','','*83',NULL,1,0),('campon','toggle','Camp-On Toggle','','*84',NULL,1,0),('parking','parkedcall','Pickup ParkedCall Prefix','','*85',NULL,1,1),('infoservices','calltrace','Call Trace','','*69',NULL,1,0),('infoservices','echotest','Echo Test','','*43',NULL,1,1),('infoservices','speakingclock','Speaking Clock','','*60',NULL,1,1),('infoservices','speakextennum','Speak Your Exten Number','','*65',NULL,1,0),('callforward','cfon','Call Forward All Activate','','*72',NULL,1,0),('callforward','cfoff','Call Forward All Deactivate','','*73',NULL,1,0),('callforward','cfoff_any','Call Forward All Prompting Deactivate','','*74',NULL,1,0),('callforward','cfbon','Call Forward Busy Activate','','*90',NULL,1,0),('callforward','cfboff','Call Forward Busy Deactivate','','*91',NULL,1,0),('callforward','cfboff_any','Call Forward Busy Prompting Deactivate','','*92',NULL,1,0),('callforward','cfuon','Call Forward No Answer/Unavailable Activate','','*52',NULL,1,0),('callforward','cfuoff','Call Forward No Answer/Unavailable Deactivate','','*53',NULL,1,0),('callforward','cf_toggle','Call Forward Toggle','','*740',NULL,1,0),('queues','que_toggle','Queue Toggle','','*45',NULL,1,0),('queues','que_pause_toggle','Queue Pause Toggle','','*46',NULL,1,0),('speeddial','callspeeddial','Speeddial prefix','','*0',NULL,1,0),('speeddial','setspeeddial','Set user speed dial','','*75',NULL,1,0),('hotelwakeup','hotelwakeup','Wake Up Calls','','*68',NULL,1,0);
/*!40000 ALTER TABLE `featurecodes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `freepbx_log`
--
DROP TABLE IF EXISTS `freepbx_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `freepbx_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`section` varchar(50) DEFAULT NULL,
`level` enum('error','warning','debug','devel-debug') NOT NULL DEFAULT 'error',
`status` int(11) NOT NULL DEFAULT '0',
`message` text NOT NULL,
PRIMARY KEY (`id`),
KEY `time` (`time`,`level`)
) AUTO_INCREMENT=3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `freepbx_log`
--
LOCK TABLES `freepbx_log` WRITE;
/*!40000 ALTER TABLE `freepbx_log` DISABLE KEYS */;
/*!40000 ALTER TABLE `freepbx_log` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `freepbx_settings`
--
DROP TABLE IF EXISTS `freepbx_settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `freepbx_settings` (
`keyword` varchar(50) NOT NULL DEFAULT '',
`value` varchar(255) DEFAULT NULL,
`name` varchar(80) DEFAULT NULL,
`level` tinyint(1) DEFAULT '0',
`description` text,
`type` varchar(25) DEFAULT NULL,
`options` text,
`defaultval` varchar(255) DEFAULT NULL,
`readonly` tinyint(1) DEFAULT '0',
`hidden` tinyint(1) DEFAULT '0',
`category` varchar(50) DEFAULT NULL,
`module` varchar(25) DEFAULT NULL,
`emptyok` tinyint(1) DEFAULT '1',
`sortorder` int(11) DEFAULT '0',
PRIMARY KEY (`keyword`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `globals`
--
DROP TABLE IF EXISTS `globals`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `globals` (
`variable` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`variable`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `globals` WRITE;
/*!40000 ALTER TABLE `globals` DISABLE KEYS */;
/*!40000 ALTER TABLE `globals` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `iax`
--
DROP TABLE IF EXISTS `iax`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `iax` (
`id` varchar(20) NOT NULL DEFAULT '-1',
`keyword` varchar(30) NOT NULL DEFAULT '',
`data` varchar(255) NOT NULL,
`flags` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`keyword`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `iax`
--
LOCK TABLES `iax` WRITE;
/*!40000 ALTER TABLE `iax` DISABLE KEYS */;
/*!40000 ALTER TABLE `iax` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `incoming`
--
DROP TABLE IF EXISTS `incoming`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `incoming` (
`cidnum` varchar(20) DEFAULT NULL,
`extension` varchar(50) NOT NULL,
`destination` varchar(50) DEFAULT NULL,
`faxexten` varchar(20) DEFAULT NULL,
`faxemail` varchar(50) DEFAULT NULL,
`answer` tinyint(1) DEFAULT NULL,
`wait` int(2) DEFAULT NULL,
`privacyman` tinyint(1) DEFAULT NULL,
`alertinfo` varchar(255) DEFAULT NULL,
`ringing` varchar(20) DEFAULT NULL,
`mohclass` varchar(80) NOT NULL DEFAULT 'default',
`description` varchar(80) DEFAULT NULL,
`grppre` varchar(80) DEFAULT NULL,
`delay_answer` int(2) DEFAULT NULL,
`pricid` varchar(20) DEFAULT NULL,
`pmmaxretries` varchar(2) DEFAULT NULL,
`pmminlength` varchar(2) DEFAULT NULL
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `incoming`
--
LOCK TABLES `incoming` WRITE;
/*!40000 ALTER TABLE `incoming` DISABLE KEYS */;
/*!40000 ALTER TABLE `incoming` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `module_xml`
--
DROP TABLE IF EXISTS `module_xml`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `module_xml` (
`id` varchar(20) NOT NULL DEFAULT 'xml',
`time` int(11) NOT NULL DEFAULT '0',
`data` longblob NOT NULL,
PRIMARY KEY (`id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `modules`
--
DROP TABLE IF EXISTS `modules`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `modules` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`modulename` varchar(50) NOT NULL DEFAULT '',
`version` varchar(20) NOT NULL DEFAULT '',
`enabled` tinyint(4) NOT NULL DEFAULT '0',
`signature` blob,
PRIMARY KEY (`id`)
) AUTO_INCREMENT=1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `notifications`
--
DROP TABLE IF EXISTS `notifications`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `notifications` (
`module` varchar(24) NOT NULL DEFAULT '',
`id` varchar(24) NOT NULL DEFAULT '',
`level` int(11) NOT NULL DEFAULT '0',
`display_text` varchar(255) NOT NULL DEFAULT '',
`extended_text` blob NOT NULL,
`link` varchar(255) NOT NULL DEFAULT '',
`reset` tinyint(4) NOT NULL DEFAULT '0',
`candelete` tinyint(4) NOT NULL DEFAULT '0',
`timestamp` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`module`,`id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `outbound_route_patterns`
--
DROP TABLE IF EXISTS `outbound_route_patterns`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `outbound_route_patterns` (
`route_id` int(11) NOT NULL,
`match_pattern_prefix` varchar(60) NOT NULL DEFAULT '',
`match_pattern_pass` varchar(60) NOT NULL DEFAULT '',
`match_cid` varchar(60) NOT NULL DEFAULT '',
`prepend_digits` varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY (`route_id`,`match_pattern_prefix`,`match_pattern_pass`,`match_cid`,`prepend_digits`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `outbound_route_patterns`
--
LOCK TABLES `outbound_route_patterns` WRITE;
/*!40000 ALTER TABLE `outbound_route_patterns` DISABLE KEYS */;
/*!40000 ALTER TABLE `outbound_route_patterns` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `outbound_route_sequence`
--
DROP TABLE IF EXISTS `outbound_route_sequence`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `outbound_route_sequence` (
`route_id` int(11) NOT NULL,
`seq` int(11) NOT NULL,
PRIMARY KEY (`route_id`,`seq`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `outbound_route_sequence`
--
LOCK TABLES `outbound_route_sequence` WRITE;
/*!40000 ALTER TABLE `outbound_route_sequence` DISABLE KEYS */;
/*!40000 ALTER TABLE `outbound_route_sequence` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `outbound_route_trunks`
--
DROP TABLE IF EXISTS `outbound_route_trunks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `outbound_route_trunks` (
`route_id` int(11) NOT NULL,
`trunk_id` int(11) NOT NULL,
`seq` int(11) NOT NULL,
PRIMARY KEY (`route_id`,`trunk_id`,`seq`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `outbound_route_trunks`
--
LOCK TABLES `outbound_route_trunks` WRITE;
/*!40000 ALTER TABLE `outbound_route_trunks` DISABLE KEYS */;
/*!40000 ALTER TABLE `outbound_route_trunks` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `outbound_routes`
--
DROP TABLE IF EXISTS `outbound_routes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `outbound_routes` (
`route_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(40) DEFAULT NULL,
`outcid` varchar(40) DEFAULT NULL,
`outcid_mode` varchar(20) DEFAULT NULL,
`password` varchar(30) DEFAULT NULL,
`emergency_route` varchar(4) DEFAULT NULL,
`intracompany_route` varchar(4) DEFAULT NULL,
`mohclass` varchar(80) DEFAULT NULL,
`time_group_id` int(11) DEFAULT NULL,
`dest` varchar(255) DEFAULT NULL,
PRIMARY KEY (`route_id`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `outbound_routes`
--
LOCK TABLES `outbound_routes` WRITE;
/*!40000 ALTER TABLE `outbound_routes` DISABLE KEYS */;
/*!40000 ALTER TABLE `outbound_routes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sip`
--
DROP TABLE IF EXISTS `sip`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sip` (
`id` varchar(20) NOT NULL DEFAULT '-1',
`keyword` varchar(30) NOT NULL DEFAULT '',
`data` varchar(255) NOT NULL,
`flags` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`keyword`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sip`
--
LOCK TABLES `sip` WRITE;
/*!40000 ALTER TABLE `sip` DISABLE KEYS */;
/*!40000 ALTER TABLE `sip` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sip`
--
DROP TABLE IF EXISTS `pjsip`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pjsip` (
`id` varchar(20) NOT NULL DEFAULT '-1',
`keyword` varchar(30) NOT NULL DEFAULT '',
`data` varchar(255) NOT NULL,
`flags` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`keyword`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pjsip`
--
LOCK TABLES `pjsip` WRITE;
/*!40000 ALTER TABLE `pjsip` DISABLE KEYS */;
/*!40000 ALTER TABLE `pjsip` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `trunk_dialpatterns`
--
DROP TABLE IF EXISTS `trunk_dialpatterns`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `trunk_dialpatterns` (
`trunkid` int(11) NOT NULL DEFAULT '0',
`match_pattern_prefix` varchar(50) NOT NULL DEFAULT '',
`match_pattern_pass` varchar(50) NOT NULL DEFAULT '',
`prepend_digits` varchar(50) NOT NULL DEFAULT '',
`seq` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`trunkid`,`match_pattern_prefix`,`match_pattern_pass`,`prepend_digits`,`seq`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `trunk_dialpatterns`
--
LOCK TABLES `trunk_dialpatterns` WRITE;
/*!40000 ALTER TABLE `trunk_dialpatterns` DISABLE KEYS */;
/*!40000 ALTER TABLE `trunk_dialpatterns` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `trunks`
--
DROP TABLE IF EXISTS `trunks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `trunks` (
`trunkid` int(11) NOT NULL DEFAULT '0',
`name` varchar(50) NOT NULL DEFAULT '',
`tech` varchar(20) NOT NULL,
`outcid` varchar(40) NOT NULL DEFAULT '',
`keepcid` varchar(4) DEFAULT 'off',
`maxchans` varchar(6) DEFAULT '',
`failscript` varchar(255) NOT NULL DEFAULT '',
`dialoutprefix` varchar(255) NOT NULL DEFAULT '',
`channelid` varchar(255) NOT NULL DEFAULT '',
`usercontext` varchar(255) DEFAULT NULL,
`provider` varchar(40) DEFAULT NULL,
`disabled` varchar(4) DEFAULT 'off',
`continue` varchar(4) DEFAULT 'off',
PRIMARY KEY (`trunkid`,`tech`,`channelid`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `trunks`
--
LOCK TABLES `trunks` WRITE;
/*!40000 ALTER TABLE `trunks` DISABLE KEYS */;
INSERT INTO `trunks` VALUES (1,'','dahdi','','','','','','g0','',NULL,'off','off');
/*!40000 ALTER TABLE `trunks` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`extension` varchar(20) NOT NULL DEFAULT '',
`password` varchar(20) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`voicemail` varchar(50) DEFAULT NULL,
`ringtimer` int(3) DEFAULT NULL,
`noanswer` varchar(100) DEFAULT NULL,
`recording` varchar(50) DEFAULT NULL,
`outboundcid` varchar(50) DEFAULT NULL,
`sipname` varchar(50) DEFAULT NULL,
`noanswer_cid` varchar(20) NOT NULL DEFAULT '',
`busy_cid` varchar(20) NOT NULL DEFAULT '',
`chanunavail_cid` varchar(20) NOT NULL DEFAULT '',
`noanswer_dest` varchar(255) NOT NULL DEFAULT '',
`busy_dest` varchar(255) NOT NULL DEFAULT '',
`chanunavail_dest` varchar(255) NOT NULL DEFAULT '',
`mohclass` varchar(80) DEFAULT 'default',
KEY `extension` (`extension`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `dahdichandids`
--
DROP TABLE IF EXISTS `dahdichandids`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dahdichandids` (
`channel` int(11) NOT NULL DEFAULT '0',
`description` varchar(40) NOT NULL DEFAULT '',
`did` varchar(60) NOT NULL DEFAULT '',
PRIMARY KEY (`channel`)
);
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `dahdichandids`
--
LOCK TABLES `dahdichandids` WRITE;
/*!40000 ALTER TABLE `dahdichandids` DISABLE KEYS */;
/*!40000 ALTER TABLE `dahdichandids` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2013-12-04 1:30:59

View File

View File

0
root/var/log/.gitignore vendored Normal file
View File

View File

View File

@ -0,0 +1,27 @@
#!/bin/sh
#----------------------------------------------------------------------
# copyright (C) 2005 Mitel Networks Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Technical support for this program is available from Mitel Networks
# Please visit our web site www.mitel.com/sme/ for details.
#----------------------------------------------------------------------
exec \
/usr/local/bin/setuidgid smelog \
/usr/local/bin/multilog t s5000000 \
/var/log/httpd-fpbx

11
root/var/service/httpd-fpbx/run Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
#----------------------------------------------------------------------
# copyright (C) 1999-2004 Mitel Networks Corporation
#----------------------------------------------------------------------
config=/etc/httpd/fpbx-conf/httpd.conf
[ -e $config ] || exit 1
exec 2>&1
exec chpst -P /usr/sbin/httpd -f $config -D FOREGROUND

452
smeserver-freepbx.spec Normal file
View File

@ -0,0 +1,452 @@
# $Id: smeserver-freepbx.spec,v 1.28 2024/04/23 03:27:22 jpp Exp $
# Authority: vip-ire
# Name: Daniel Berteaud
#%define fpbxversion 2.5.0
%define version 14
%define release 15
%define name smeserver-freepbx
Summary: Asterisk web GUI
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GPL
Group: System/Servers
Source: %{name}-%{version}.tar.xz
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
URL: http://www.freepbx.org/
BuildRequires: e-smith-devtools
BuildRequires: tar
Requires: mariadb
Requires: nodejs >= 10
Requires: jq
# freepbx 14 requires php56
Requires: php56-php-pear php56-php-cgi php56-php-common php56-php-curl php56-php-mbstring php56-php-gd php56-php-mysql php56-php-gettext php56-php-bcmath php56-php-zip php56-php-xml php56-php-imap php56-php-json php56-php-process php56-php-snmp
# freepbx 15 and 16
Requires: php74-php-pear php74-php-cgi php74-php-common php74-php-curl php74-php-mbstring php74-php-gd php74-php-mysql php74-php-gettext php74-php-bcmath php74-php-zip php74-php-xml php74-php-imap php74-php-json php74-php-process php74-php-snmp
# freepbx 16
Requires: php80-php-pear php80-php-cgi php80-php-common php80-php-curl php80-php-mbstring php80-php-gd php80-php-mysql php80-php-gettext php80-php-bcmath php80-php-zip php80-php-xml php80-php-imap php80-php-json php80-php-process php80-php-snmp
Requires: httpd
Requires: php-pear
Requires: /usr/sbin/asterisk
#Requires: dahdi-tools
#Requires: dahdi-linux
Requires: sox
Requires: mod_auth_tkt
Requires: e-smith-base
Requires: freepbx-src
Requires: asterisk-sounds-core-en-ulaw
Requires: asterisk-voicemail
Requires: asterisk-configs
#SME10
Requires: asterisk-mysql asterisk-odbc asterisk-pjsip asterisk-sip asterisk-festival asterisk-moh-opsound asterisk-snmp asterisk-mp3 asterisk-sounds-core-en asterisk-moh-opsound
Requires: asterisk-voicemail-plain
# conlicts with imap asterisk-voicemail-odbc asterisk-voicemail-plain
Requires: ffmpeg
Requires: mpg123
Requires: mysql-connector-odbc
Requires: unixODBC
Requires: asterisk-odbc
Requires: lame
Requires: xz
Requires: asterisk-ael asterisk-iax2 asterisk-fax asterisk-ldap asterisk-misdn
Requires: MySQL-python opus nmap icu vsftpd libicu-devel gcc-c++
Requires: asterisk-moh-opsound-alaw asterisk-moh-opsound-g722 asterisk-moh-opsound-g729 asterisk-moh-opsound-gsm asterisk-moh-opsound-siren14 asterisk-moh-opsound-siren7 asterisk-moh-opsound-sln16 asterisk-moh-opsound-ulaw asterisk-moh-opsound-wav
Requires: asterisk-sounds-core-en-alaw asterisk-sounds-core-en-g722 asterisk-sounds-core-en-g729 asterisk-sounds-core-en-gsm asterisk-sounds-core-en-siren14 asterisk-sounds-core-en-siren7 asterisk-sounds-core-en-sln16 asterisk-sounds-core-en-ulaw asterisk-sounds-core-en-wav
# Requires: asterisk-sounds-core-fr-alaw asterisk-sounds-core-fr-g722 asterisk-sounds-core-fr-g729 asterisk-sounds-core-fr-gsm asterisk-sounds-core-fr-siren14 asterisk-sounds-core-fr-siren7 asterisk-sounds-core-fr-sln16 asterisk-sounds-core-fr-ulaw asterisk-sounds-core-fr-wav
# Requires: asterisk-sounds-core-it-alaw asterisk-sounds-core-it-g722 asterisk-sounds-core-it-g729 asterisk-sounds-core-it-gsm asterisk-sounds-core-it-siren14 asterisk-sounds-core-it-siren7 asterisk-sounds-core-it-sln16 asterisk-sounds-core-it-ulaw asterisk-sounds-core-it-wav
# Requires: asterisk-sounds-core-es-alaw asterisk-sounds-core-es-g722 asterisk-sounds-core-es-g729 asterisk-sounds-core-es-gsm asterisk-sounds-core-es-siren14 asterisk-sounds-core-es-siren7 asterisk-sounds-core-es-sln16 asterisk-sounds-core-es-ulaw asterisk-sounds-core-es-wav
Requires: e-smith-apache >= 2.6.0-19
Requires: smeserver-php >= 3.0.0-43
#Buildarch: noarch
AutoReqProv: no
%description
FreePBX is a Standardised Implementation of Asterisk that gives you a GUI to manage your system. If you have looked into Asterisk, you would know that it does not come with any built in programming. You cannot plug a phone into it and make it work without editing configuration files, writing dialplans, and various messing about. FreePBX simplifies this by giving you a pre-written set of dialplans that allow you to have a fully functional PBX pretty much straight away.
This package provide the integration of FreePBX on SME Server.
%changelog
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 14-15.sme
- Roll up patches and move to git repo [SME: 12338]
* Sat Sep 07 2024 BogusDateBot
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
by assuming the date is correct and changing the weekday.
* Mon Apr 22 2024 Jean-Philippe Pialasse <jpp@koozali.org> 14-14.sme
- some logs not rotated [SME: 12506]
- moving freepbx php error log from /var/log/php [SME: 12481]
* Wed Jan 04 2023 Jean-Philippe Pialasse <tests@pialasse.com> 14-13.sme
- fix permission denied on /usr/local/sbin/fwconsole from cron
* Wed Dec 14 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-11.sme
- fix bugs installing FPBX 15
- fix amportal alerts [SME: 12259]
- compatible FBX 16 [SME: 12276]
- fix duplicate logrotate [SME: 12237]
- force php memory on install [SME: 10221]
* Tue Dec 13 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-10.sme
- fix backup for FreePBX 15 and higher [SME: 12256]
- make compatible up to FreePBX 16 [SME: 11923]
* Wed Dec 07 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-9.sme
- improve backup [SME: 10703]
* Wed Dec 07 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-8.sme
- fix patch for asterisk crontab [SME: 12227]
* Wed Dec 07 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-7.sme
- fix voicemail not visible in UCP [SME: 12254]
force asterisk-voicemail-plain
* Fri Nov 18 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-6.sme
- fix creation of folder preventing migration [SME: 12226]
* Sat Jul 30 2022 Brian Read <brianr@bjsystems.co.uk> 14-5.sme
- Re-build and link to latest devtools [SME: 11997]
* Fri Jul 22 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-4.sme
- add to core backup [SME: 12009]
- httpd 2.4 syntax [SME: 12046]
* Tue May 31 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-3.sme
- Re-build and link to latest devtools service file fwconsole path [SME: 11986]
* Sat Apr 16 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-2.sme
- Re-build and link to latest devtools huge amount of error if asterisk disabled [SME: 9756]
- Re-build and link to latest devtools multiple email sent because of asterisk cron php path [SME: 11940]
- on uninstall remove asterisk crontab to avoid noise [SME: 10131]
- allow access to sounds folder for gui [SME: 11924]
* Sun Mar 27 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-1.sme
- first version 14 [SME: 11613]
* Wed Nov 10 2021 Jean-Philippe Pialasse <tests@pialasse.com> 13-17.sme
- first import to SME10 [SME: 11613]
- make it Freepbx 14 compatible [SME: 10705] 
add dependencies for SME10 mariadb nodejs >= 10 php70*
remove missing rpms asterisk-sounds-extra-en-ulaw asterisk-resample asterisk-addons
remove double owned folders /etc/asterisk /var/lib/asterisk
systemd ready for asterisk(disabled), freepbx, httpd-fpbx
smeserver-freepbx-update event created NEED TEST
php70-php-fpm fragment
update httpd-fpbx template for php-fpm use
update httpd-e-smith to use php-fpm for fpbx
update install script for php74
add a copy of safe_asterisk
create php folders and set rights
improve logrotate
* Mon Jan 20 2020 Jean-Philipe Pialasse <tests@pialasse.com> 13-16.sme
- add required modules to enable cel and cdr logging and search [SME: 10620]
- add requires lame [SME: 9859]
- Re-build and link to latest devtools sounds ownership so they can be handled via gui [SME: 11924]
* Mon Jan 29 2018 Jean-Philipe Pialasse <tests@pialasse.com> 13-15.sme
- Re-build and link to latest devtools warning tampered files in GUI [SME: 10496]
- remove DeviceAndUser property [SME: 10503]
* Wed May 03 2017 Jean-Philipe Pialasse <tests@pialasse.com> 13-14.sme
- update TKT auth parameter for SME 9.2 [SME: 10268]
* Sat Feb 25 2017 Jean-Philipe Pialasse <tests@pialasse.com> 13-13.sme
- Re-build and link to latest devtools noise rebooting and restarting freepbx [SME: 10120]
* Wed Jan 25 2017 Jean-Philipe Pialasse <tests@pialasse.com> 13-11.sme
- NFR: auto backup of whole FBX config during pre-backup event [SME: 9637]
- both asdb and fpbx, asterisk config files, freepbx folders, voicemails are part of backup
- 2 versions are kepts
- weekly backup is also done.
* Mon Jan 23 2017 Jean-Philipe Pialasse <tests@pialasse.com> 13-10.sme
- Re-build and link to latest devtools Missing HTML5 format converters [SME: 9859]
- added requirement for mpg123 and ffmpeg available in smecontribs
* Mon Jan 23 2017 Jean-Philipe Pialasse <tests@pialasse.com> 13-9.sme
- update framework before other modules [SME: 9860]
* Mon Jan 09 2017 Jean-Philipe Pialasse <tests@pialasse.com> 13-8.sme
- autoupgrade modules [SME: 9860]
* Mon Jan 09 2017 Jean-Philipe Pialasse <tests@pialasse.com> 13-7.sme
- Re-build and link to latest devtools wrong default UDPPorts on new install [SME: 9918]
* Mon Oct 24 2016 Jean-Philipe Pialasse <tests@pialasse.com> 13-6.sme
- Re-build and link to latest devtools error while backup with workstation [SME: 9760]
* Mon Oct 24 2016 Jean-Philipe Pialasse <tests@pialasse.com> 13-5.sme
-fix typo in smeserver-freepbx-13.bz9744.patch
* Sun Oct 23 2016 Jean-Philipe Pialasse <tests@pialasse.com> 13-4.sme
- Re-build and link to latest devtools [SME: 9702]
- corrected syntax for port range
* Sun Oct 23 2016 Jean-Philipe Pialasse <tests@pialasse.com> 13-3.sme
- Re-build and link to latest devtools [SME: 9744]
- Re-build and link to latest devtools wrong /tmp folder permission after update
- Thank you Hsing-Foo Wang.
* Tue Jul 26 2016 Jean-Philipe Pialasse <tests@pialasse.com> 13-2.sme
- Re-build and link to latest devtools wrong UDP ports change 1000:2000 to 10000:20000 [SME: 9702]
* Mon Jun 13 2016 Jean-Philipe Pialasse <tests@pialasse.com> 13-1.sme
- bump version to current Freepbx version 13
* Mon Jun 13 2016 Jean-Philipe Pialasse <tests@pialasse.com> -47.sme
- add all needed port for Freepbx sip pjsip and RTP [SME: 9495]
* Sat Jun 11 2016 Jean-Philipe Pialasse <tests@pialasse.com> -46.sme
- Re-build and link to latest devtools missing config files (requires asterisk-configs) [SME: 9577]
- Re-build and link to latest devtools recuring reconfiguration error while installing digium phone module [SME: 9575]
- added port 5061 for tls to TCP ports [SME: 9576]
* Thu Jun 09 2016 Jean-Philipe Pialasse <tests@pialasse.com> -45.sme
- Re-build and link to latest devtools wrong logrotate pattern [SME: 9516]
- as the contrib is only in smedev, i do not fix existing log files badly rotated
* Mon May 16 2016 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-44.sme
- remove fop db [SME: 9495]
- add some mysql setting for freepbxdb (user, email)
- smeserver-freepbx-0.1-Sme9Ast13Fpbx13-7.patch
* Sun May 15 2016 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-43.sme
- add path to ucp module [SME: 9495]
- add 256Mo as default for freepbx php Memory
- add AllowOveride All for .htaccess
- remove httpd config to old FOP panel
- add port 5061 for freepbx
- smeserver-freepbx-0.1-Sme9Ast13Fpbx13-5.patch
- configuration of amportal.conf and its mysql equivalent
- smeserver-freepbx-0.1-Sme9Ast13Fpbx13-6.patch
* Sun May 15 2016 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-42.sme
- remove FOP patches [SME: 9495]
- deleted link to expand amportal.conf
- smeserver-freepbx-0.1-Sme9Ast13Fpbx13-4.patch
* Sun May 15 2016 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-41.sme
- remove heading of /etc/asterisk/asterisk.conf [SME: 9495]
- smeserver-freepbx-0.1-Sme9Ast13Fpbx13-3.patch
- bump
* Sun May 15 2016 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-38.sme
- remove expand template amportal.conf [SME: 9495]
- chown /var/lib/asterisk
- installation configuration options
- smeserver-freepbx-0.1-Sme9Ast13Fpbx13-2.patch
- Requires: asterisk-sounds-core-en-ulaw asterisk-sounds-extra-en-ulaw asterisk-voicemail
* Sun May 15 2016 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-37.sme
- new path to sql files [SME: 9495]
- smeserver-freepbx-0.1-Sme9Ast13Fpbx13-1.patch
* Fri May 06 2016 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-36.sme
- adapt script to fpbx13 and asterisk 13 [SME: 9495]
- change Requires Requires: %{_libdir}/asterisk/modules/app_addon_sql_mysql.so to
- Requires: asterisk-addons as this is the paquet providing it, and it changed name to app_mysql.so
* Fri May 06 2016 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-35.sme
- adapt script to fpbx13 and asterisk 13 [SME: 9495]
- smeserver-freepbx-0.1-Sme9Ast13Fpbx13-0.patch
* Fri May 06 2016 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-34.sme
- first import to SME9 [SME: 9495]
* Sun May 12 2013 JP Pialasse <tests@pialasse.com> 0.1-33.sme
- buildarch removed in order to find the correct %{_libdir}/asterisk/modules/app_addon_sql_mysql.so
* Thu Oct 20 2011 Daniel B. <daniel@firewall-services.com> 0.1-32.sme
- Protect by locations (so other alias can be defined to protect with LL::NG for example)
* Mon Oct 17 2011 Daniel B. <daniel@firewall-services.com> 0.1-31.sme
- Add misdn.log to logrotate
* Thu Oct 13 2011 Daniel B. <daniel@firewall-services.com> 0.1-30.sme
- Change session path [SME: 6661]
* Wed Jan 05 2011 Daniel B. <daniel@firewall-services.com> 0.1-29.sme
- astdatadir is /var/lib/asterisk
- templates for /etc/logrotate.d/asterisk
* Mon Sep 20 2010 Daniel B. <daniel@firewall-services.com> 0.1-28.sme
- Create and populate the mysql databases in mysql.init
- Templates for /etc/asterisk/asterisk.conf
* Thu Jul 15 2010 Daniel B. <daniel@firewall-services.com> [0.1-27]
- Read ARI password from the DB (and initialize a random one)
* Mon Feb 22 2010 Daniel B. <daniel@firewall-services.com> [0.1-26]
- Remove hard-coded dependencies on asterisk and asterisk-addons14
Depends now on asterisk binary and app_addon_sql_mysql.so files
(so it can work with asterisk or asterisk14)
* Mon Feb 15 2010 Daniel B. <daniel@firewall-services.com> [0.1-25]
- Remove /etc/logrotate.d/asterisk which is now included in asterisk14
* Tue Feb 09 2010 Daniel B. <daniel@firewall-services.com> [0.1-24]
- Depends now on asterisk14 and asterisk-addons14
* Wed Jan 06 2010 Daniel B. <daniel@firewall-services.com> [0.1-23]
- disable dynamic hints
* Tue Oct 06 2009 Daniel B. <daniel@firewall-services.com> [0.1-22]
- include /opt/freepbx/admin/functions.inc.php in freepbx-dump-astdb
action script for FreePBX 2.6 compatibility
* Tue May 19 2009 Daniel B. <daniel@firewall-services.com> [0.1-21]
- Add CHECKREFERER=FALSE in amportal.conf to repvent error message in some
modules (due to the ProxyPass configuration)
* Tue Apr 28 2009 Daniel B. <daniel@firewall-services.com> [0.1-20]
- Fix CDR db password in cdr_mysql.conf template
- Use a separate service in SME db for FOP
* Thu Apr 16 2009 Daniel B. <daniel@firewall-services.com> [0.1-19]
- remove scoreboard directive from httpd-fpbx config
- remove some modules (mod_ssl, mod_proxy)
* Sat Apr 11 2009 Daniel B. <daniel@firewall-services.com> [0.1-18]
- templatize cdr_mysql.conf [SME: 5153]
- templatize manager.conf
- remove freepbx-cron-scheduler.php from root crontab so only
asterisk user runs it (prevent email error sent from cron)
* Fri Mar 27 2009 Daniel B. <daniel@firewall-services.com> [0.1-17]
- Remove obsolete /admin Alias from apache
- Run the security script on bootsrape-console-save event
* Mon Mar 23 2009 Daniel B. <daniel@firewall-services.com> [0.1-16]
- Security Fixe: put a random password for ARI admin (this should be documented)
* Thu Mar 19 2009 Daniel B. <daniel@firewall-services.com> [0.1-15]
- Check if /opt/freepbx/admin exists (retry the install if a first one failed)
- Remove tabs from spec
* Wed Mar 18 2009 Daniel B. <daniel@firewall-services.com> [0.1-14]
- Remove speex from dependencies
* Thu Mar 12 2009 Daniel B. <daniel@firewall-services.com> [0.1-13]
- Remove zaptel dependency, replaced with dahdi-tools and dahdi-linux
* Mon Feb 23 2009 Daniel B. <daniel@firewall-services.com> [0.1-12]
- Fix logrotate issue (send a sigusr1 signal to httpd-fpbx)
* Thu Feb 12 2009 Daniel B. <daniel@firewall-services.com> [0.1-11]
- Full support for the new DAHDI driver, droping zaptel
* Mon Feb 09 2009 Daniel B. <daniel@firewall-services.com> [0.1-10]
- add support for DAHDI channel
* Mon Dec 08 2008 Daniel B. <daniel@firewall-services.com> [0.1-9]
- move expand-templates from post-upgrade event to bootstrap-console-save
* Thu Nov 27 2008 Daniel B. <daniel@firewall-services.com> [0.1-8]
- Add support for trunk name in mail alerts
* Wed Nov 26 2008 Daniel B. <daniel@firewall-services.com> [0.1-7]
- Add a simple script to alert admin by mail on trunk errors
* Thu Nov 20 2008 Daniel B. <daniel@firewall-services.com> [0.1-6]
- Use AdminPanels props so access can be configured using
smeserver-userpanels contrib. AdminUsers and FopUsers
props aren't used anymore
* Wed Nov 19 2008 Daniel B. <daniel@firewall-services.com> [0.1-5]
- add logrotate default config file for asterisk's logs
- spec cleanup
* Thu Nov 13 2008 Daniel B. <daniel@firewall-services.com> [0.1-4]
- Re-build and link to latest devtools logrotate issue
* Wed Nov 05 2008 Daniel B. <daniel@firewall-services.com> [0.1-3]
- split freepbx sources in a separate package (freepbx-src)
- alternative genzaptelconf
* Mon Oct 13 2008 Daniel B. <daniel@firewall-services.com> [0.1-2]
- Fix fop not being displayed in admin page
* Sat Sep 20 2008 Daniel B. <daniel@firewall-services.com> [0.1-1]
- updated to 2.5.0 final
- spec cleaning
- templates cleaning
- templates to update mysql informations
* Mon Aug 04 2008 daniel B. <daniel@firewall-services.com> [0.1-0]
- initial release
%prep
%setup -q -n %{name}-%{version}
rm -rf root/var/log/php
%build
# Build symlinks
perl createlinks
%install
rm -rf $RPM_BUILD_ROOT
%{__mkdir_p} $RPM_BUILD_ROOT/var/lib/php/fpbx-session
%{__mkdir_p} $RPM_BUILD_ROOT/var/log/freepbx
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--file /sbin/e-smith/fwconsole 'attr(0755,root,root)' \
--file /usr/share/freepbx/scripts/uninstall.sh 'attr(0750,root,root)' \
--file /usr/share/freepbx/scripts/restore-astdb.php 'attr(0750,root,root)' \
--dir /var/service/httpd-fpbx 'attr(01755,root,root)' \
--dir /var/service/httpd-fpbx/supervise 'attr(0700,root,root)' \
--dir /var/service/httpd-fpbx/log 'attr(0755,root,root)' \
--file /var/service/httpd-fpbx/log/run 'attr(0755,root,root)' \
--dir /var/service/httpd-fpbx/log/supervise 'attr(0700,root,root)' \
--file /var/lib/asterisk/bin/genzaptelconf 'attr(0750,root,root)' \
--file /usr/share/asterisk/agi-bin/trunk_alert_mail.agi 'attr(0750,asterisk,asterisk)' \
--file /etc/logrotate.d/asterisk 'config(noreplace)' \
--dir /var/lib/php/fpbx-session 'attr(0770,root,asterisk)' \
--file /usr/sbin/safe_asterisk 'attr(0755,root,root)' \
--dir /var/log/freepbx 'attr(0770,root,asterisk)' \
--dir /var/lib/php/freepbx/sessions 'attr(0770,root,asterisk)' \
--dir /var/lib/php/freepbx/temp 'attr(0770,root,asterisk)' \
|grep -v '/var/lib/asterisk$'| grep -v '/etc/asterisk$' \
> %{name}-%{version}-%{release}-filelist
%clean
rm -rf $RPM_BUILD_ROOT
%files -f %{name}-%{version}-%{release}-filelist
%defattr(-,root,root)
%post
#bug 9744, restore tmp permissions
if [ `stat -c %U /tmp` == "asterisk" ]; then
chmod o+rwxt /tmp/
chown root:root /tmp/
fi
if [ -f /var/log/php/freepbx/error.log ]; then
mv /var/log/php/freepbx/* /var/log/freepbx/ >& /dev/null || :
fi
%preun
if [ $1 = 0 ] ; then
/usr/bin/systemctl stop freepbx >& /dev/null || :
fi
true
%postun
if [ $1 = 0 ] ; then
#remove cron for asterisk on uninstallation to avoid noise
/usr/bin/crontab -u asterisk -r >& /dev/null || :
fi
true