diff -Nur --no-dereference smeserver-freepbx-13.old/createlinks smeserver-freepbx-13/createlinks --- smeserver-freepbx-13.old/createlinks 2022-03-24 23:13:37.415000000 -0400 +++ smeserver-freepbx-13/createlinks 2022-03-27 22:17:06.363000000 -0400 @@ -2,25 +2,12 @@ use esmith::Build::CreateLinks qw(:all); -# Start and stop links +# force default php to php56 +safe_symlink("/usr/bin/php56", "root/usr/sbin/php"); +safe_symlink("/usr/bin/php56", "root/usr/local/sbin/php"); -service_link_enhanced("freepbx", "S98", "7"); -service_link_enhanced("freepbx", "K10", "6"); -service_link_enhanced("freepbx", "K10", "0"); -service_link_enhanced("freepbx", "K10", "1"); - -service_link_enhanced("httpd-fpbx", "S86", "7"); -service_link_enhanced("httpd-fpbx", "K15", "6"); -service_link_enhanced("httpd-fpbx", "K15", "0"); -service_link_enhanced("httpd-fpbx", "K15", "1"); - -service_link_enhanced("dahdi", "S09", "7"); -service_link_enhanced("dahdi", "K16", "6"); -service_link_enhanced("dahdi", "K16", "0"); -service_link_enhanced("dahdi", "K16", "1"); - -safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/httpd-fpbx'); -safe_symlink("/var/service/httpd-fpbx" , 'root/service/httpd-fpbx'); +#safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/httpd-fpbx'); +#safe_symlink("/var/service/httpd-fpbx" , 'root/service/httpd-fpbx'); # Panel links @@ -37,6 +24,8 @@ 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/php56/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"); @@ -48,17 +37,46 @@ 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("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"); +#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/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/php56/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"); + +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"); +#action needed in case we have a systemd unit +event_link("systemd-default", $event, "88"); +event_link("systemd-reload", $event, "89"); + diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/events/actions/freepbx-checkinstall smeserver-freepbx-13/root/etc/e-smith/events/actions/freepbx-checkinstall --- smeserver-freepbx-13.old/root/etc/e-smith/events/actions/freepbx-checkinstall 2022-03-24 23:13:37.431000000 -0400 +++ smeserver-freepbx-13/root/etc/e-smith/events/actions/freepbx-checkinstall 2022-03-27 22:48:08.732000000 -0400 @@ -4,23 +4,24 @@ 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;" + 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/sources/freepbx/installlib/SQL/asterisk.sql ]; then - mysql $DBNAME < /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql + if [ -e /usr/share/freepbx/sql/asterisk.sql ]; then + mysql $DBNAME < /usr/share/freepbx/sql/asterisk.sql else - echo "Error: file /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql doesn't exists" + 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;" + 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 @@ -31,9 +32,23 @@ 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 /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 @@ -44,7 +59,11 @@ ./start_asterisk start >> /root/freepbx_install.log 2>&1 echo "" >> /root/freepbx_install.log echo "Installing FreePBX..." >> /root/freepbx_install.log - echo "a" | ./install --webroot="/opt/freepbx" --dbengine="mysql" --dbname="freepbxdb" --dbuser="freepbxuser" --dbpass="$DBPASS" -n >> /root/freepbx_install.log 2>&1 + echo "a" | ./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 @@ -72,6 +91,6 @@ # update modules /usr/sbin/fwconsole ma upgrade framework /usr/sbin/fwconsole ma upgradeall -R standard -R extended -/usr/sbin/fwconsole ma refreshsignatures - +/usr/sbin/fwconsole ma refreshsignatures +/usr/sbin/fwconsole ma downloadinstall userman certman ucp exit 0 diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/asterisk/asterisk.conf/10dirs smeserver-freepbx-13/root/etc/e-smith/templates/etc/asterisk/asterisk.conf/10dirs --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/asterisk/asterisk.conf/10dirs 2016-06-13 08:03:08.000000000 -0400 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/asterisk/asterisk.conf/10dirs 2022-03-27 21:39:15.866000000 -0400 @@ -3,7 +3,8 @@ 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 => /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 diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/e-smith/sql/init/30freepbx_mysql_create_database smeserver-freepbx-13/root/etc/e-smith/templates/etc/e-smith/sql/init/30freepbx_mysql_create_database --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/e-smith/sql/init/30freepbx_mysql_create_database 2016-06-13 08:03:08.000000000 -0400 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/e-smith/sql/init/30freepbx_mysql_create_database 2022-03-27 16:11:55.804000000 -0400 @@ -11,18 +11,18 @@ #! /bin/sh if [ ! -d /var/lib/mysql/$dbname ]; then - mysqladmin create $dbname + mysql -e "create database $dbname CHARACTER SET utf8 COLLATE utf8_unicode_ci ;" - if [ -e /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql ]; then - mysql $dbname < /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql + if [ -e /usr/share/freepbx/sql/asterisk.sql ]; then + mysql $dbname < /usr/share/freepbx/sql/asterisk.sql else - echo "Error: file /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql doesn't exists" + echo "Error: file /usr/share/freepbx/sql/asterisk.sql doesn't exists" exit 1 fi fi if [ ! -d /var/lib/mysql/$cdrdbname ]; then - mysqladmin create $cdrdbname + 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 @@ -38,45 +38,8 @@ /usr/bin/mysql < - AddIcon /icons/php4.gif .php3 .php4 .php .phtml - AddIcon /icons/phps.gif .phps - - - - AddIcon /icons/php5.gif .php3 .php4 .php5 .php .phtml - AddIcon /icons/phps.gif .phps - +$OUT .= < Options None AllowOverride None - order deny,allow - deny from all - allow from none + #order deny,allow + #deny from all + #allow from none + Require all denied diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX20Root smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX20Root --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX20Root 2016-06-13 08:03:08.000000000 -0400 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX20Root 2022-03-27 16:11:54.373000000 -0400 @@ -1,11 +1,19 @@ - AddType application/x-httpd-php .php Options +followSymlinks +{ + my $key = "freepbx"; + my $pool_name = lc $key; + my $version = 56; + $OUT .=" + + SetHandler \"proxy:unix:/var/run/php-fpm/php${version}-${pool_name}.sock|fcgi://localhost\" + \n"; +} AllowOverride All - order deny,allow - deny from all - allow from 127.0.0.1 - php_admin_value session.save_path /var/lib/php/fpbx-session + #order deny,allow + #deny from all + #allow from 127.0.0.1 + Require host 127.0.0.1 diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX30Admin smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX30Admin --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX30Admin 2022-03-24 23:13:37.426000000 -0400 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX30Admin 2022-03-27 16:11:54.582000000 -0400 @@ -1,31 +1,26 @@ Options +followSymlinks - php_admin_flag allow_url_fopen On - php_admin_value memory_limit 256M - php_admin_value upload_max_filesize 100M - php_admin_value post_max_size 100M - php_admin_flag file_upload On - php_admin_flag magic_quotes_gpc Off - deny from all - Allow from 127.0.0.1 + #deny from all + #Allow from 127.0.0.1 + Require host 127.0.0.1 AuthType Basic TKTAuthLoginURL /server-common/cgi-bin/login - require user admin {getUsersList('freepbx');} + Require user admin {getUsersList('freepbx');} { my $ManagerTimeout = ${'httpd-admin'}{ManagerTimeout} || "30m"; - $OUT = " TKTAuthTimeout $ManagerTimeout\n"; + $OUT = " TKTAuthTimeout $ManagerTimeout\n"; my $Cookie = ${'httpd-admin'}{Cookie} || "disabled"; - $OUT .= " TKTAuthCookieExpires $ManagerTimeout\n" if "$Cookie" eq "enabled"; + $OUT .= " TKTAuthCookieExpires $ManagerTimeout\n" if "$Cookie" eq "enabled"; my $ManagerTimeoutReset = ${'httpd-admin'}{ManagerTimeoutReset} || "0.66"; - $OUT .= " TKTAuthTimeoutRefresh $ManagerTimeoutReset\n"; + $OUT .= " TKTAuthTimeoutRefresh $ManagerTimeoutReset\n"; } - Satisfy all + #Satisfy all diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/logrotate.d/asterisk/All smeserver-freepbx-13/root/etc/e-smith/templates/etc/logrotate.d/asterisk/All --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/logrotate.d/asterisk/All 2016-06-13 08:03:08.000000000 -0400 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/logrotate.d/asterisk/All 2022-03-25 00:20:25.749000000 -0400 @@ -1,9 +1,26 @@ -/var/log/asterisk/messages /var/log/asterisk/freepbx.log /var/log/asterisk/event_log /var/log/asterisk/queue_log /var/log/asterisk/full /var/log/asterisk/warnings /var/log/asterisk/misdn.log \{ +/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 +\{ missingok notifempty compress + compressoptions -T0 + compresscmd /usr/bin/xz + compressext .xz + uncompresscmd /usr/bin/unxz daily - rotate 60 + rotate 365 + su asterisk asterisk create 0640 asterisk asterisk sharedscripts postrotate diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/16freepbx smeserver-freepbx-13/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/16freepbx --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/16freepbx 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/16freepbx 2022-03-27 16:11:56.037000000 -0400 @@ -0,0 +1,69 @@ +{ + +if ($PHP_VERSION eq '56'){ + 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.log:/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/php/$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'; + } +} +} diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/rc.d/init.d/freepbx smeserver-freepbx-13/root/etc/rc.d/init.d/freepbx --- smeserver-freepbx-13.old/root/etc/rc.d/init.d/freepbx 2008-08-05 17:07:12.000000000 -0400 +++ smeserver-freepbx-13/root/etc/rc.d/init.d/freepbx 1969-12-31 19:00:00.000000000 -0500 @@ -1,85 +0,0 @@ -#! /bin/sh -# chkconfig: 98 10 - -if [ -f /etc/init.d/functions ] ; then - . /etc/init.d/functions -elif [ -f /etc/rc.d/init.d/functions ] ; then - . /etc/rc.d/init.d/functions -else - exit 0 -fi - - - - -# make sure config file exists -if [ ! -e "/etc/amportal.conf" ]; then - echo "" - echo "/etc/amportal.conf does not exist!" - echo "Have you installed the AMP configuration?" - exit 1 -fi -. /etc/amportal.conf - -if [ -x ${AMPBIN}/freepbx_engine ]; then - FPBXENGINE=${AMPBIN}/freepbx_engine -elif [ -x ${ASTVARLIBDIR}/bin/freepbx_engine ]; then - FPBXENGINE=${ASTVARLIBDIR}/bin/freepbx_engine -elif [ -x /var/lib/asterisk/bin/freepbx_engine ]; then - FPBXENGINE=/var/lib/asterisk/bin/freepbx_engine -else - echo "FATAL: can not find freepbx_engine to start Asterisk" - exit 1 -fi - -FPBXSTATUS=$(/sbin/e-smith/db configuration getprop freepbx status) - -case "$1" in - start) - $FPBXENGINE start > /dev/null 2>&1 - echo -n "Starting FreePBX: " - RETVAL=$? - ;; - stop) - $FPBXENGINE stop > /dev/null 2>&1 - echo -n "Stoping FreePBX: " - RETVAL=$? - ;; - restart) - $FPBXENGINE restart > /dev/null 2>&1 - echo -n "Restarting FreePBX: " - RETVAL=$? - ;; - reload) - /usr/sbin/asterisk -rx 'reload' > /dev/null 2>&1 - echo -n "Reloading FreePBX: " - RETVAL=$? - ;; - kill) - $FPBXENGINE kill > /dev/null 2>&1 - echo -n "Killing FreePBX: " - RETVAL=$? - ;; - adjust) - if [ $FPBXSTATUS == 'enabled' ]; then - $FPBXENGINE restart > /dev/null 2>&1 - else - $FPBXENGINE stop > /dev/null 2>&1 - fi - echo -n "Adjusting FreePBX: " - RETVAL=$? - ;; - *) - echo "Usage: $0 {start|stop|restart|reload|adjust|kill}" - exit 1 -esac - -if [ $RETVAL -eq 0 ]; then - echo_success -else - echo_failure -fi -echo - -exit $RETVAL - diff -Nur --no-dereference smeserver-freepbx-13.old/root/usr/lib/systemd/system/asterisk.service.d/50-koozali.conf smeserver-freepbx-13/root/usr/lib/systemd/system/asterisk.service.d/50-koozali.conf --- smeserver-freepbx-13.old/root/usr/lib/systemd/system/asterisk.service.d/50-koozali.conf 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-freepbx-13/root/usr/lib/systemd/system/asterisk.service.d/50-koozali.conf 2022-03-27 16:13:01.588000000 -0400 @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=/dev/null diff -Nur --no-dereference smeserver-freepbx-13.old/root/usr/lib/systemd/system/freepbx.service smeserver-freepbx-13/root/usr/lib/systemd/system/freepbx.service --- smeserver-freepbx-13.old/root/usr/lib/systemd/system/freepbx.service 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-freepbx-13/root/usr/lib/systemd/system/freepbx.service 2022-03-24 23:17:16.044000000 -0400 @@ -0,0 +1,19 @@ +[Unit] +Description=FreePBX VoIP Server +Requires=mariadb.service + +[Service] +Type=forking + +ExecStartPre=/sbin/e-smith/service-status freepbx + +ExecStart=/usr/local/bin/fwconsole start -q +ExecStop=/usr/local/bin/fwconsole stop -q +ExecReload=/usr/local/bin/fwconsole reload -q +SyslogIdentifier=FreePBX +Restart=on-failure +StartLimitInterval=0 +RestartSec=30 + +[Install] +WantedBy=multi-user.target sme-server.target diff -Nur --no-dereference smeserver-freepbx-13.old/root/usr/lib/systemd/system/httpd-fpbx.service smeserver-freepbx-13/root/usr/lib/systemd/system/httpd-fpbx.service --- smeserver-freepbx-13.old/root/usr/lib/systemd/system/httpd-fpbx.service 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-freepbx-13/root/usr/lib/systemd/system/httpd-fpbx.service 2022-03-24 23:40:24.092000000 -0400 @@ -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 + diff -Nur --no-dereference smeserver-freepbx-13.old/root/usr/sbin/safe_asterisk smeserver-freepbx-13/root/usr/sbin/safe_asterisk --- smeserver-freepbx-13.old/root/usr/sbin/safe_asterisk 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-freepbx-13/root/usr/sbin/safe_asterisk 2022-03-24 23:26:33.185000000 -0400 @@ -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} 2>&1 /dev/null 2>&1 /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 diff -Nur --no-dereference smeserver-freepbx-13.old/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi smeserver-freepbx-13/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi --- smeserver-freepbx-13.old/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi 2016-06-13 08:03:08.000000000 -0400 +++ smeserver-freepbx-13/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi 1969-12-31 19:00:00.000000000 -0500 @@ -1,44 +0,0 @@ -#!/bin/bash - -declare -a array -while read -e ARG && [ "$ARG" ] ; do -array=(` echo $ARG | sed -e 's/://'`) -export ${array[0]}=${array[1]} -done - -TRUNK=$1 -DOMAIN=`dnsdomainname` -HOST=`hostname` - -EMAIL=admin@$DOMAIN - -DATE=`date "+%d-%m-%Y %H:%M"` - -CID=`echo $agi_callerid` -CIDNAME=`echo $agi_calleridname` -EXTENSION=`echo $agi_extension` -#CHANNEL=`echo $agi_channel` -TYPE=`echo $agi_type` -DNID=`echo $agi_dnid` - -REPORT=$EXTENSION - -if [ "$EXTENSION" = "s-CHANUNAVAIL" ]; then - REPORT="Channel Unavailable" -elif [ "$EXTENSION" = "s-CONGESTION" ]; then - REPORT="Congestion" -fi - -# Message Formating - -MSG="\n\n A call from \"$CIDNAME\" <$CID> (Type $TYPE)\n" -MSG="$MSG To : $DNID\n" -MSG="$MSG Using Trunk : $TRUNK\n" -MSG="$MSG Has failed on host $HOST.$DOMAIN at $DATE\n\n" -MSG="$MSG The error is : $REPORT \n\n" - -# Send an email - -echo -e "$MSG" | mail -s "[FAILED CALL] on host $HOST.$DOMAIN" "$EMAIL" - -