/[smecontribs]/rpms/smeserver-freepbx/contribs10/smeserver-freepbx-bz11613-sme10.patch
ViewVC logotype

Annotation of /rpms/smeserver-freepbx/contribs10/smeserver-freepbx-bz11613-sme10.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (hide annotations) (download)
Sun Mar 27 20:13:43 2022 UTC (2 years, 7 months ago) by jpp
Branch: MAIN
Changes since 1.2: +1010 -37 lines
* 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
  TODO : update httpd-e-smith to use php-fpm for fpbx
  update install script for php74
  add a copy of safe_asterisk
  TODO : create php folders and set rights
  improve logrotate

1 jpp 1.1 diff -Nur --no-dereference smeserver-freepbx-13.old/createlinks smeserver-freepbx-13/createlinks
2     --- smeserver-freepbx-13.old/createlinks 2022-03-24 23:13:37.415000000 -0400
3 jpp 1.3 +++ smeserver-freepbx-13/createlinks 2022-03-27 04:14:51.166000000 -0400
4 jpp 1.1 @@ -4,23 +4,23 @@
5    
6     # Start and stop links
7    
8     -service_link_enhanced("freepbx", "S98", "7");
9     -service_link_enhanced("freepbx", "K10", "6");
10     -service_link_enhanced("freepbx", "K10", "0");
11     -service_link_enhanced("freepbx", "K10", "1");
12     -
13     -service_link_enhanced("httpd-fpbx", "S86", "7");
14     -service_link_enhanced("httpd-fpbx", "K15", "6");
15     -service_link_enhanced("httpd-fpbx", "K15", "0");
16     -service_link_enhanced("httpd-fpbx", "K15", "1");
17     -
18     -service_link_enhanced("dahdi", "S09", "7");
19     -service_link_enhanced("dahdi", "K16", "6");
20     -service_link_enhanced("dahdi", "K16", "0");
21     -service_link_enhanced("dahdi", "K16", "1");
22     +#service_link_enhanced("freepbx", "S98", "7");
23     +#service_link_enhanced("freepbx", "K10", "6");
24     +#service_link_enhanced("freepbx", "K10", "0");
25     +#service_link_enhanced("freepbx", "K10", "1");
26     +
27     +#service_link_enhanced("httpd-fpbx", "S86", "7");
28     +#service_link_enhanced("httpd-fpbx", "K15", "6");
29     +#service_link_enhanced("httpd-fpbx", "K15", "0");
30     +#service_link_enhanced("httpd-fpbx", "K15", "1");
31     +
32     +#service_link_enhanced("dahdi", "S09", "7");
33     +#service_link_enhanced("dahdi", "K16", "6");
34     +#service_link_enhanced("dahdi", "K16", "0");
35     +#service_link_enhanced("dahdi", "K16", "1");
36    
37     -safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/httpd-fpbx');
38     -safe_symlink("/var/service/httpd-fpbx" , 'root/service/httpd-fpbx');
39     +#safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/httpd-fpbx');
40     +#safe_symlink("/var/service/httpd-fpbx" , 'root/service/httpd-fpbx');
41    
42     # Panel links
43    
44 jpp 1.2 @@ -37,6 +37,8 @@
45     templates2events("/etc/httpd/conf/httpd.conf", $event);
46     templates2events("/etc/httpd/fpbx-conf/httpd.conf", qw(freepbx-update bootstrap-console-save conf-userpanel));
47     templates2events("/etc/e-smith/sql/init/30freepbx_mysql_create_database", qw(freepbx-update bootstrap-console-save));
48 jpp 1.3 +templates2events("/etc/opt/remi/php70/php-fpm.d/www.conf", $event);
49 jpp 1.2 +
50    
51     event_link("freepbx-checkinstall", $event, "10");
52     event_link("freepbx-checkinstall-backup", $event, "11");
53     @@ -48,17 +50,43 @@
54 jpp 1.1 safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
55     safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
56     safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-fpbx");
57 jpp 1.3 +safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php70-php-fpm");
58 jpp 1.1 +
59     safe_symlink("sigusr1", "root/etc/e-smith/events/logrotate/services2adjust/httpd-fpbx");
60    
61     safe_symlink("sigusr1", "root/etc/e-smith/events/conf-userpanel/services2adjust/httpd-fpbx");
62    
63     # Create empty files
64     -safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/fpbx_access_log");
65     -safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/fpbx_error_log");
66     -safe_touch("root/var/service/httpd-fpbx/down");
67     +#safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/fpbx_access_log");
68     +#safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/fpbx_error_log");
69     +#safe_touch("root/var/service/httpd-fpbx/down");
70    
71     # Create empty directories
72     system("/bin/mkdir -p root/var/service/httpd-fpbx/supervise");
73     system("/bin/mkdir -p root/var/service/httpd-fpbx/log/supervise");
74     system("/bin/mkdir -p root/var/log/httpd-fpbx");
75    
76     +
77     +## systemd install/update
78     +my $event = 'smeserver-freepbx-update';
79     +templates2events("/etc/asterisk/asterisk.conf", $event);
80     +templates2events("/etc/asterisk/cdr_mysql.conf", $event);
81     +templates2events("/etc/asterisk/manager.conf", $event);
82     +templates2events("/etc/logrotate.d/asterisk", $event);
83     +templates2events("/etc/httpd/conf/httpd.conf", $event);
84     +templates2events("/etc/httpd/fpbx-conf/httpd.conf", $event);
85     +templates2events("/etc/e-smith/sql/init/30freepbx_mysql_create_database", $event);
86 jpp 1.3 +templates2events("/etc/opt/remi/php70/php-fpm.d/www.conf", $event);
87 jpp 1.1 +event_link("freepbx-checkinstall", $event, "10");
88     +event_link("freepbx-checkinstall-backup", $event, "11");
89     +event_link("freepbx-amportal.conf", $event, "91");
90     +event_link("freepbx-clean-crontab", $event, "40");
91     +
92     +safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
93     +safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
94     +safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-fpbx");
95 jpp 1.3 +safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php70-php-fpm");
96 jpp 1.1 +#action needed in case we have a systemd unit
97     +event_link("systemd-default", $event, "88");
98     +event_link("systemd-reload", $event, "89");
99     +
100 jpp 1.3 diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/events/actions/freepbx-amportal.conf smeserver-freepbx-13/root/etc/e-smith/events/actions/freepbx-amportal.conf
101     --- smeserver-freepbx-13.old/root/etc/e-smith/events/actions/freepbx-amportal.conf 2022-03-24 23:13:37.422000000 -0400
102     +++ smeserver-freepbx-13/root/etc/e-smith/events/actions/freepbx-amportal.conf 2022-03-27 16:11:55.606000000 -0400
103     @@ -1,4 +1,5 @@
104     #!/bin/bash
105     +. /opt/remi/php56/enable
106    
107     # Change FreePBX database settings that should have come from /etc/amportal.conf,
108     # this is a dynamic template for FreePBX > 1.9 as it update the file on the fly, and also the db
109 jpp 1.1 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
110     --- smeserver-freepbx-13.old/root/etc/e-smith/events/actions/freepbx-checkinstall 2022-03-24 23:13:37.431000000 -0400
111 jpp 1.3 +++ smeserver-freepbx-13/root/etc/e-smith/events/actions/freepbx-checkinstall 2022-03-27 16:11:55.183000000 -0400
112     @@ -1,26 +1,28 @@
113     #!/bin/bash
114     +. /opt/remi/php56/enable
115    
116     DBNAME=$(/sbin/e-smith/db configuration getprop freepbx DbName)
117     DBUSER=$(/sbin/e-smith/db configuration getprop freepbx DbUser)
118     DBPASS=$(/sbin/e-smith/db configuration getprop freepbx DbPassword)
119     CDRDBNAME=$(/sbin/e-smith/db configuration getprop freepbx CdrDbName)
120     -
121     +MANAGERPASSWORD=$(/sbin/e-smith/db configuration getprop freepbx ManagerPassword)
122     +DomainName=$(/sbin/e-smith/db configuration get DomainName)
123    
124     if [ $(mysqlshow | grep -c $DBNAME) -lt 1 ]; then
125     - mysql -e "create database $DBNAME;"
126     + mysql -e "create database $DBNAME CHARACTER SET utf8 COLLATE utf8_unicode_ci ;"
127     mysql -e "grant all privileges on $DBNAME.* to '$DBUSER'@'localhost' identified by '$DBPASS';"
128     mysql -e 'flush privileges;'
129    
130     - if [ -e /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql ]; then
131     - mysql $DBNAME < /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql
132     + if [ -e /usr/share/freepbx/sql/asterisk.sql ]; then
133     + mysql $DBNAME < /usr/share/freepbx/sql/asterisk.sql
134     else
135     - echo "Error: file /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql doesn't exists"
136     + echo "Error: file /usr/share/freepbx/sql/asterisk.sql doesn't exists"
137     exit 1
138     fi
139     fi
140    
141     if [ $(mysqlshow | grep -c $CDRDBNAME) -lt 1 ]; then
142     - mysql -e "create database $CDRDBNAME;"
143     + mysql -e "create database $CDRDBNAME CHARACTER SET utf8 COLLATE utf8_unicode_ci ;"
144     mysql -e "grant all privileges on $CDRDBNAME.* to '$DBUSER'@'localhost' identified by '$DBPASS';"
145     mysql -e 'flush privileges;'
146     if [ -e /usr/share/freepbx/sources/freepbx/installlib/SQL/cdr.sql ]; then
147     @@ -31,8 +33,19 @@
148     fi
149     fi
150    
151     +# set user and passwords
152     +/usr/bin/mysql $DBNAME -e "INSERT INTO \`admin\` (\`variable\`, \`value\`) VALUES ('email', 'admin\@$DomainName') ON DUPLICATE KEY UPDATE \`value\` = 'admin\@$DomainName';"
153     +/usr/bin/mysql $DBNAME -e "INSERT INTO \`ampusers\` (\`username\`, \`password_sha1\`, \`extension_low\`, \`extension_high\`, \`deptname\`, \`sections\`) VALUES
154     +('admin', sha1('$MANAGERPASSWORD '), '', '', '', 0x2a) ON DUPLICATE KEY UPDATE \`password_sha1\` = sha1('$ManagerPassword ');"
155     +
156     # Chown dir to allow user asterisk to create its files
157     chown asterisk:asterisk /var/lib/asterisk
158     +# workaround as freepbx is expecting them in /var not /usr/share
159     +pushd /var/lib/asterisk
160     +if [[ ! -d /usr/share/asterisk/documentation ]]; then ln -s /usr/share/asterisk/documentation ; fi
161     +if [[ ! -d /usr/share/asterisk/moh ]]; then ln -s /usr/share/asterisk/moh ; fi
162     +if [[ ! -d /usr/share/asterisk/sounds ]]; then ln -s /usr/share/asterisk/sounds/ ; fi
163     +popd
164    
165     # Run the install script only if it's a new install
166     # Upgrades have to be done through freePBX and the online repository
167     @@ -44,7 +57,11 @@
168 jpp 1.1 ./start_asterisk start >> /root/freepbx_install.log 2>&1
169     echo "" >> /root/freepbx_install.log
170     echo "Installing FreePBX..." >> /root/freepbx_install.log
171     - echo "a" | ./install --webroot="/opt/freepbx" --dbengine="mysql" --dbname="freepbxdb" --dbuser="freepbxuser" --dbpass="$DBPASS" -n >> /root/freepbx_install.log 2>&1
172 jpp 1.3 + echo "a" | ./install --webroot="/opt/freepbx" \
173 jpp 1.1 + --dbengine="mysql" --dbname="freepbxdb" --dbuser="freepbxuser" --dbpass="$DBPASS" -n \
174     + --cdrdbname="$CDRDBNAME" --astmoddir=/usr/lib64/asterisk/modules/ \
175 jpp 1.3 + --astagidir=/usr/share/asterisk/agi-bin/ --ampsbin=/usr/sbin --ampcgibin=/opt/freepbx/cgi-bin \
176 jpp 1.1 + >> /root/freepbx_install.log 2>&1
177     else
178     echo "error: /usr/share/freepbx/sources/freepbx/ doesn't exists"
179     exit 1
180 jpp 1.3 @@ -73,5 +90,6 @@
181     /usr/sbin/fwconsole ma upgrade framework
182     /usr/sbin/fwconsole ma upgradeall -R standard -R extended
183     /usr/sbin/fwconsole ma refreshsignatures
184     -
185     +/usr/sbin/fwconsole ma download ucp
186     +/usr/sbin/fwconsole ma install ucp
187     exit 0
188     diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/events/actions/freepbx-checkinstall-backup smeserver-freepbx-13/root/etc/e-smith/events/actions/freepbx-checkinstall-backup
189     --- smeserver-freepbx-13.old/root/etc/e-smith/events/actions/freepbx-checkinstall-backup 2022-03-24 23:13:37.418000000 -0400
190     +++ smeserver-freepbx-13/root/etc/e-smith/events/actions/freepbx-checkinstall-backup 2022-03-27 16:11:54.985000000 -0400
191     @@ -1,4 +1,5 @@
192     #!/bin/sh
193     +. /opt/remi/php56/enable
194    
195     DBNAME=$(/sbin/e-smith/db configuration getprop freepbx DbName)
196     backuppath='/home/e-smith/files/freepbx'
197     diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/events/actions/freepbx-dump-astdb smeserver-freepbx-13/root/etc/e-smith/events/actions/freepbx-dump-astdb
198     --- smeserver-freepbx-13.old/root/etc/e-smith/events/actions/freepbx-dump-astdb 2022-03-24 23:13:37.403000000 -0400
199     +++ smeserver-freepbx-13/root/etc/e-smith/events/actions/freepbx-dump-astdb 2022-03-27 16:11:55.380000000 -0400
200     @@ -1,4 +1,4 @@
201     -#!/usr/bin/env php
202     +#!/usr/bin/env php56
203     <?php
204     // No use outputting anything, as env forces php headers to appear. Sigh.
205    
206     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
207     --- 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
208     +++ 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
209     @@ -11,18 +11,18 @@
210     #! /bin/sh
211    
212     if [ ! -d /var/lib/mysql/$dbname ]; then
213     - mysqladmin create $dbname
214     + mysql -e "create database $dbname CHARACTER SET utf8 COLLATE utf8_unicode_ci ;"
215    
216     - if [ -e /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql ]; then
217     - mysql $dbname < /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql
218     + if [ -e /usr/share/freepbx/sql/asterisk.sql ]; then
219     + mysql $dbname < /usr/share/freepbx/sql/asterisk.sql
220     else
221     - echo "Error: file /usr/share/freepbx/sources/freepbx/installlib/SQL/asterisk.sql doesn't exists"
222     + echo "Error: file /usr/share/freepbx/sql/asterisk.sql doesn't exists"
223     exit 1
224     fi
225     fi
226    
227     if [ ! -d /var/lib/mysql/$cdrdbname ]; then
228     - mysqladmin create $cdrdbname
229     + mysql -e "create database $cdrdbname CHARACTER SET utf8 COLLATE utf8_unicode_ci ;"
230     if [ -e /usr/share/freepbx/sources/freepbx/installlib/SQL/cdr.sql ]; then
231     mysql $cdrdbname < /usr/share/freepbx/sources/freepbx/installlib/SQL/cdr.sql
232     else
233     @@ -38,45 +38,8 @@
234     /usr/bin/mysql <<EOF
235     USE mysql;
236    
237     -REPLACE INTO user (
238     - host,
239     - user,
240     - password)
241     - VALUES (
242     - 'localhost',
243     - '$dbuser',
244     - PASSWORD ('$dbpass'));
245     -
246     -
247     -REPLACE INTO db (
248     - host,
249     - db,
250     - user,
251     - select_priv, insert_priv, update_priv, delete_priv,
252     - create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
253     - grant_priv, lock_tables_priv, references_priv)
254     - VALUES (
255     - 'localhost',
256     - '$dbname',
257     - '$dbuser',
258     - 'Y', 'Y', 'Y', 'Y',
259     - 'Y', 'Y', 'Y', 'Y', 'Y',
260     - 'N', 'Y', 'Y');
261     -REPLACE INTO db (
262     - host,
263     - db,
264     - user,
265     - select_priv, insert_priv, update_priv, delete_priv,
266     - create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
267     - grant_priv, lock_tables_priv, references_priv)
268     - VALUES (
269     - 'localhost',
270     - '$cdrdbname',
271     - '$dbuser',
272     - 'Y', 'Y', 'Y', 'Y',
273     - 'Y', 'Y', 'Y', 'Y', 'Y',
274     - 'N', 'Y', 'Y');
275     -
276     +GRANT ALL PRIVILEGES ON ${dbname} TO '$dbuser'\@'localhost' identified by '$dbpass';
277     +GRANT ALL PRIVILEGES ON ${cdrdbname} TO '$dbuser'\@'localhost' identified by '$dbpass';
278    
279     FLUSH PRIVILEGES;
280    
281 jpp 1.1 diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/20Modules smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/20Modules
282     --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/20Modules 2016-06-13 08:03:08.000000000 -0400
283 jpp 1.3 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/20Modules 2022-03-27 16:11:53.875000000 -0400
284     @@ -20,6 +20,13 @@
285     env
286     log_config
287     mime
288     + proxy
289     + proxy_fcgi
290     + authz_core
291     + authn_core
292     + unixd
293     + systemd
294     + mpm_prefork
295     negotiation
296     status
297     info
298     @@ -50,25 +57,10 @@
299 jpp 1.1 $OUT .= "LoadModule ${_}_module modules/mod_${_}.so\n";
300     }
301    
302     -if (exists $php{status} and $php{status} eq "enabled"){
303     - my $modphp = '4';
304     - if ( -r "/usr/lib/httpd/modules/libphp5.so" || -r "/usr/lib64/httpd/modules/libphp5.so" ){
305     - $modphp = '5';
306     - }
307     - $OUT .= "LoadModule php".$modphp."_module modules/libphp".$modphp.".so\n";
308     -}
309 jpp 1.3
310 jpp 1.1 -$OUT .= <<HERE;
311 jpp 1.3 +# we do not use php module anymore, but php-fpm
312    
313 jpp 1.1 -<IfModule mod_php4.c>
314     - AddIcon /icons/php4.gif .php3 .php4 .php .phtml
315     - AddIcon /icons/phps.gif .phps
316     -</IfModule>
317     -
318     -<IfModule mod_php5.c>
319     - AddIcon /icons/php5.gif .php3 .php4 .php5 .php .phtml
320     - AddIcon /icons/phps.gif .phps
321     -</IfModule>
322 jpp 1.3 +$OUT .= <<HERE;
323 jpp 1.1
324     PidFile /var/run/httpd-fpbx.pid
325     UseCanonicalName off
326 jpp 1.3 @@ -102,7 +94,6 @@
327     AddIconByType (IMG,/icons/image2.gif) image/*
328     AddIconByType (SND,/icons/sound2.gif) audio/*
329     AddIconByType (VID,/icons/movie.gif) video/*
330     -DefaultType text/plain
331     TypesConfig /etc/mime.types
332    
333     AddEncoding x-compress Z
334     diff -Nur --no-dereference smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/85DefaultAccess smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/85DefaultAccess
335     --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/85DefaultAccess 2008-08-04 09:17:11.000000000 -0400
336     +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/85DefaultAccess 2022-03-27 16:11:54.121000000 -0400
337     @@ -5,8 +5,9 @@
338     <Directory />
339     Options None
340     AllowOverride None
341     - order deny,allow
342     - deny from all
343     - allow from none
344     + #order deny,allow
345     + #deny from all
346     + #allow from none
347     + Require all denied
348     </Directory>
349    
350 jpp 1.1 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
351     --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX20Root 2016-06-13 08:03:08.000000000 -0400
352 jpp 1.3 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX20Root 2022-03-27 16:11:54.373000000 -0400
353     @@ -1,11 +1,19 @@
354    
355 jpp 1.1 <Directory /opt/freepbx/>
356 jpp 1.3 - AddType application/x-httpd-php .php
357 jpp 1.1 Options +followSymlinks
358     +{
359     + my $key = "freepbx";
360     + my $pool_name = lc $key;
361 jpp 1.3 + my $version = 56;
362 jpp 1.1 + $OUT .="
363     + <FilesMatch .php\$>
364     + SetHandler \"proxy:unix:/var/run/php-fpm/php${version}-${pool_name}.sock|fcgi://localhost\"
365     + </FilesMatch>\n";
366     +}
367     AllowOverride All
368 jpp 1.3 - order deny,allow
369     - deny from all
370     - allow from 127.0.0.1
371 jpp 1.1 - php_admin_value session.save_path /var/lib/php/fpbx-session
372 jpp 1.3 + #order deny,allow
373     + #deny from all
374     + #allow from 127.0.0.1
375     + Require host 127.0.0.1
376 jpp 1.1 </Directory>
377    
378     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
379     --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX30Admin 2022-03-24 23:13:37.426000000 -0400
380 jpp 1.3 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/httpd/fpbx-conf/httpd.conf/90FreePBX30Admin 2022-03-27 16:11:54.582000000 -0400
381     @@ -1,31 +1,26 @@
382 jpp 1.1
383     <Directory /opt/freepbx/admin/>
384     Options +followSymlinks
385     - php_admin_flag allow_url_fopen On
386     - php_admin_value memory_limit 256M
387     - php_admin_value upload_max_filesize 100M
388     - php_admin_value post_max_size 100M
389     - php_admin_flag file_upload On
390     - php_admin_flag magic_quotes_gpc Off
391     </Directory>
392    
393     <Directory /opt/freepbx/admin/modules/>
394 jpp 1.3 - deny from all
395     - Allow from 127.0.0.1
396     + #deny from all
397     + #Allow from 127.0.0.1
398     + Require host 127.0.0.1
399     </Directory>
400    
401     <Location /freepbx/admin>
402     AuthType Basic
403     TKTAuthLoginURL /server-common/cgi-bin/login
404     - require user admin {getUsersList('freepbx');}
405     + Require user admin {getUsersList('freepbx');}
406     {
407     my $ManagerTimeout = ${'httpd-admin'}{ManagerTimeout} || "30m";
408     - $OUT = " TKTAuthTimeout $ManagerTimeout\n";
409     + $OUT = " TKTAuthTimeout $ManagerTimeout\n";
410     my $Cookie = ${'httpd-admin'}{Cookie} || "disabled";
411     - $OUT .= " TKTAuthCookieExpires $ManagerTimeout\n" if "$Cookie" eq "enabled";
412     + $OUT .= " TKTAuthCookieExpires $ManagerTimeout\n" if "$Cookie" eq "enabled";
413     my $ManagerTimeoutReset = ${'httpd-admin'}{ManagerTimeoutReset} || "0.66";
414     - $OUT .= " TKTAuthTimeoutRefresh $ManagerTimeoutReset\n";
415     + $OUT .= " TKTAuthTimeoutRefresh $ManagerTimeoutReset\n";
416     }
417     - Satisfy all
418     + #Satisfy all
419     </Location>
420    
421 jpp 1.1 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
422     --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/logrotate.d/asterisk/All 2016-06-13 08:03:08.000000000 -0400
423     +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/logrotate.d/asterisk/All 2022-03-25 00:20:25.749000000 -0400
424     @@ -1,9 +1,26 @@
425     -/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 \{
426     +/var/log/asterisk/messages
427     +/var/log/asterisk/event_log
428     +/var/log/asterisk/queue_log
429     +/var/log/asterisk/full
430     +/var/log/asterisk/security
431     +/var/log/asterisk/freepbx.log
432     +/var/log/asterisk/freepbx_security.log
433     +/var/log/asterisk/ucp_err.log
434     +/var/log/asterisk/ucp_out.log
435     +/var/log/asterisk/cdr-csv/Master.csv
436     +/var/log/asterisk/warnings
437     +/var/log/asterisk/misdn.log
438     +\{
439     missingok
440     notifempty
441     compress
442     + compressoptions -T0
443     + compresscmd /usr/bin/xz
444     + compressext .xz
445     + uncompresscmd /usr/bin/unxz
446     daily
447     - rotate 60
448     + rotate 365
449     + su asterisk asterisk
450     create 0640 asterisk asterisk
451     sharedscripts
452     postrotate
453     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
454     --- smeserver-freepbx-13.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/16freepbx 1969-12-31 19:00:00.000000000 -0500
455 jpp 1.3 +++ smeserver-freepbx-13/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/16freepbx 2022-03-27 16:11:56.037000000 -0400
456 jpp 1.1 @@ -0,0 +1,69 @@
457     +{
458     +
459 jpp 1.3 +if ($PHP_VERSION eq '56'){
460 jpp 1.1 + if (($freepbx{'status'} || 'disabled') eq 'enabled'){
461     + my $max_upload_size = ($freepbx{MaxUploadSize} || '100M');
462     + $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
463     + my $memory_limit = ($freepbx{MemoryLimit} || '512M');
464     + $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
465     + my $open_basedir= $freepbx{PHPBaseDir} || '';
466     + $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";
467     + my $id = 'freepbx';
468     + my $max_children = $freepbx{'PHPmaxChildren'} || 15;
469     + my $min_spare_servers = $freepbx{'PHPminServers'} || 3;
470     + my $start_servers = $freepbx{'PHPstartServers'} || 3;
471     + my $max_spare_servers = $freepbx{'PHPmaxServers'} || 6;
472     + my $max_requests = $freepbx{'PHPmaxRequests'} || 5000;
473     + $min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
474     + $start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
475     +
476     +
477     + $OUT .=<<_EOF;
478     +
479     +[freepbx]
480     +
481     +listen.owner = root
482 jpp 1.3 +listen.group = asterisk
483 jpp 1.1 +listen.mode = 0660
484     +listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
485     +user = asterisk
486     +group = asterisk
487     +catch_workers_output = yes
488     +
489     +pm = dynamic
490     +pm.max_children = $max_children
491     +pm.start_servers = $start_servers
492     +pm.min_spare_servers = $min_spare_servers
493     +pm.max_spare_servers = $max_spare_servers
494     +pm.max_requests = $max_requests
495     +request_terminate_timeout = 60m
496     +
497     +php_flag[display_errors] = off
498     +php_admin_flag[log_errors] = on
499 jpp 1.3 +php_admin_value[error_log] = /var/log/php/$id/error.log
500 jpp 1.1 +php_admin_value[memory_limit] = $memory_limit
501 jpp 1.3 +php_admin_value[session.save_path] = /var/lib/php/fpbx-session
502 jpp 1.1 +php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
503     +php_admin_value[sys_temp_dir] = /var/lib/php/$id/tmp
504     +php_admin_value[post_max_size] = $max_upload_size
505     +php_admin_value[upload_max_filesize] = $max_upload_size
506     +php_admin_value[max_execution_time] = 900
507     +php_admin_value[max_input_time] = 900
508     +php_admin_flag[allow_url_include] = off
509     +php_admin_flag[allow_url_fopen] = on
510     +php_admin_flag[file_uploads] = on
511     +php_admin_flag[session.cookie_httponly] = on
512     +
513     +; Needed so that the #!/usr/bin/env php shebang will point to the correct PHP version
514     +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
515     +;env[http_proxy] = {{ system_proxy }}
516     +;env[https_proxy] = {{ system_proxy }}
517     +;env[no_proxy] =
518     +_EOF
519     +
520     + }
521     + else{
522     + $OUT .= '; Nextcloud is disabled';
523     + }
524     +}
525     +}
526     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
527     --- smeserver-freepbx-13.old/root/etc/rc.d/init.d/freepbx 2008-08-05 17:07:12.000000000 -0400
528     +++ smeserver-freepbx-13/root/etc/rc.d/init.d/freepbx 1969-12-31 19:00:00.000000000 -0500
529     @@ -1,85 +0,0 @@
530     -#! /bin/sh
531     -# chkconfig: 98 10
532     -
533     -if [ -f /etc/init.d/functions ] ; then
534     - . /etc/init.d/functions
535     -elif [ -f /etc/rc.d/init.d/functions ] ; then
536     - . /etc/rc.d/init.d/functions
537     -else
538     - exit 0
539     -fi
540     -
541     -
542     -
543     -
544     -# make sure config file exists
545     -if [ ! -e "/etc/amportal.conf" ]; then
546     - echo ""
547     - echo "/etc/amportal.conf does not exist!"
548     - echo "Have you installed the AMP configuration?"
549     - exit 1
550     -fi
551     -. /etc/amportal.conf
552     -
553     -if [ -x ${AMPBIN}/freepbx_engine ]; then
554     - FPBXENGINE=${AMPBIN}/freepbx_engine
555     -elif [ -x ${ASTVARLIBDIR}/bin/freepbx_engine ]; then
556     - FPBXENGINE=${ASTVARLIBDIR}/bin/freepbx_engine
557     -elif [ -x /var/lib/asterisk/bin/freepbx_engine ]; then
558     - FPBXENGINE=/var/lib/asterisk/bin/freepbx_engine
559     -else
560     - echo "FATAL: can not find freepbx_engine to start Asterisk"
561     - exit 1
562     -fi
563     -
564     -FPBXSTATUS=$(/sbin/e-smith/db configuration getprop freepbx status)
565     -
566     -case "$1" in
567     - start)
568     - $FPBXENGINE start > /dev/null 2>&1
569     - echo -n "Starting FreePBX: "
570     - RETVAL=$?
571     - ;;
572     - stop)
573     - $FPBXENGINE stop > /dev/null 2>&1
574     - echo -n "Stoping FreePBX: "
575     - RETVAL=$?
576     - ;;
577     - restart)
578     - $FPBXENGINE restart > /dev/null 2>&1
579     - echo -n "Restarting FreePBX: "
580     - RETVAL=$?
581     - ;;
582     - reload)
583     - /usr/sbin/asterisk -rx 'reload' > /dev/null 2>&1
584     - echo -n "Reloading FreePBX: "
585     - RETVAL=$?
586     - ;;
587     - kill)
588     - $FPBXENGINE kill > /dev/null 2>&1
589     - echo -n "Killing FreePBX: "
590     - RETVAL=$?
591     - ;;
592     - adjust)
593     - if [ $FPBXSTATUS == 'enabled' ]; then
594     - $FPBXENGINE restart > /dev/null 2>&1
595     - else
596     - $FPBXENGINE stop > /dev/null 2>&1
597     - fi
598     - echo -n "Adjusting FreePBX: "
599     - RETVAL=$?
600     - ;;
601     - *)
602     - echo "Usage: $0 {start|stop|restart|reload|adjust|kill}"
603     - exit 1
604     -esac
605     -
606     -if [ $RETVAL -eq 0 ]; then
607     - echo_success
608     -else
609     - echo_failure
610     -fi
611     -echo
612     -
613     -exit $RETVAL
614     -
615 jpp 1.3 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
616     --- smeserver-freepbx-13.old/root/usr/lib/systemd/system/asterisk.service.d/50-koozali.conf 1969-12-31 19:00:00.000000000 -0500
617     +++ smeserver-freepbx-13/root/usr/lib/systemd/system/asterisk.service.d/50-koozali.conf 2022-03-27 16:13:01.588000000 -0400
618     @@ -0,0 +1,3 @@
619 jpp 1.1 +[Service]
620     +ExecStart=
621     +ExecStart=/dev/null
622     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
623     --- smeserver-freepbx-13.old/root/usr/lib/systemd/system/freepbx.service 1969-12-31 19:00:00.000000000 -0500
624     +++ smeserver-freepbx-13/root/usr/lib/systemd/system/freepbx.service 2022-03-24 23:17:16.044000000 -0400
625     @@ -0,0 +1,19 @@
626     +[Unit]
627     +Description=FreePBX VoIP Server
628     +Requires=mariadb.service
629     +
630     +[Service]
631     +Type=forking
632     +
633     +ExecStartPre=/sbin/e-smith/service-status freepbx
634     +
635     +ExecStart=/usr/local/bin/fwconsole start -q
636     +ExecStop=/usr/local/bin/fwconsole stop -q
637     +ExecReload=/usr/local/bin/fwconsole reload -q
638     +SyslogIdentifier=FreePBX
639     +Restart=on-failure
640     +StartLimitInterval=0
641     +RestartSec=30
642     +
643     +[Install]
644     +WantedBy=multi-user.target sme-server.target
645     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
646     --- smeserver-freepbx-13.old/root/usr/lib/systemd/system/httpd-fpbx.service 1969-12-31 19:00:00.000000000 -0500
647     +++ smeserver-freepbx-13/root/usr/lib/systemd/system/httpd-fpbx.service 2022-03-24 23:40:24.092000000 -0400
648     @@ -0,0 +1,21 @@
649     +[Unit]
650     +Description=The Koozali SME Server FreePBX web service
651     +After=network.service remote-fs.target
652     +Documentation=man:httpd(8)
653     +Documentation=man:apachectl(8)
654     +
655     +[Service]
656     +Type=notify
657     +EnvironmentFile=/etc/sysconfig/httpd
658     +ExecStartPre=/sbin/e-smith/service-status httpd-fpbx
659     +ExecStartPre=/sbin/e-smith/expand-template /etc/httpd/fpbx-conf/httpd.conf
660     +ExecStart=/usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -DFOREGROUND
661     +ExecReload=/usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -k graceful
662     +ExecStop=/bin/kill -WINCH ${MAINPID}
663     +KillSignal=SIGCONT
664     +PrivateTmp=true
665     +
666     +
667     +[Install]
668     +WantedBy=sme-server.target
669     +
670 jpp 1.3 diff -Nur --no-dereference smeserver-freepbx-13.old/root/usr/sbin/safe_asterisk smeserver-freepbx-13/root/usr/sbin/safe_asterisk
671     --- smeserver-freepbx-13.old/root/usr/sbin/safe_asterisk 1969-12-31 19:00:00.000000000 -0500
672     +++ smeserver-freepbx-13/root/usr/sbin/safe_asterisk 2022-03-24 23:26:33.185000000 -0400
673 jpp 1.1 @@ -0,0 +1,228 @@
674     +#!/bin/sh
675     +
676     +ASTETCDIR="/etc/asterisk"
677     +ASTSBINDIR="/usr/sbin"
678     +ASTVARRUNDIR="/var/run/asterisk"
679     +ASTVARLOGDIR="/var/log/asterisk"
680     +
681     +CLIARGS="$*" # Grab any args passed to safe_asterisk
682     +TTY=9 # TTY (if you want one) for Asterisk to run on
683     +CONSOLE=yes # Whether or not you want a console
684     +#NOTIFY=root@localhost # Who to notify about crashes
685     +#EXEC=/path/to/somescript # Run this command if Asterisk crashes
686     +#LOGFILE="${ASTVARLOGDIR}/safe_asterisk.log" # Where to place the normal logfile (disabled if blank)
687     +#SYSLOG=local0 # Which syslog facility to use (disabled if blank)
688     +MACHINE=`hostname` # To specify which machine has crashed when getting the mail
689     +DUMPDROP="${DUMPDROP:-/tmp}"
690     +RUNDIR="${RUNDIR:-/tmp}"
691     +SLEEPSECS=4
692     +ASTPIDFILE="${ASTVARRUNDIR}/asterisk.pid"
693     +
694     +# comment this line out to have this script _not_ kill all mpg123 processes when
695     +# asterisk exits
696     +KILLALLMPG123=1
697     +
698     +# run asterisk with this priority
699     +PRIORITY=0
700     +
701     +# set system filemax on supported OSes if this variable is set
702     +# SYSMAXFILES=262144
703     +
704     +# Asterisk allows full permissions by default, so set a umask, if you want
705     +# restricted permissions.
706     +#UMASK=022
707     +
708     +# set max files open with ulimit. On linux systems, this will be automatically
709     +# set to the system's maximum files open devided by two, if not set here.
710     +# MAXFILES=32768
711     +
712     +message() {
713     + if test -n "$TTY" && test "$TTY" != "no"; then
714     + echo "$1" >/dev/${TTY}
715     + fi
716     + if test -n "$SYSLOG"; then
717     + logger -p "${SYSLOG}.warn" -t safe_asterisk[$$] "$1"
718     + fi
719     + if test -n "$LOGFILE"; then
720     + echo "safe_asterisk[$$]: $1" >>"$LOGFILE"
721     + fi
722     +}
723     +
724     +# Check if Asterisk is already running. If it is, then bug out, because
725     +# starting safe_asterisk when Asterisk is running is very bad.
726     +VERSION=`"${ASTSBINDIR}/asterisk" -nrx 'core show version' 2>/dev/null`
727     +if test "`echo $VERSION | cut -c 1-8`" = "Asterisk"; then
728     + message "Asterisk is already running. $0 will exit now."
729     + exit 1
730     +fi
731     +
732     +# since we're going to change priority and open files limits, we need to be
733     +# root. if running asterisk as other users, pass that to asterisk on the command
734     +# line.
735     +# if we're not root, fall back to standard everything.
736     +if test `id -u` != 0; then
737     + echo "Oops. I'm not root. Falling back to standard prio and file max." >&2
738     + echo "This is NOT suitable for large systems." >&2
739     + PRIORITY=0
740     + message "safe_asterisk was started by `id -n` (uid `id -u`)."
741     +else
742     + if `uname -s | grep Linux >/dev/null 2>&1`; then
743     + # maximum number of open files is set to the system maximum
744     + # divided by two if MAXFILES is not set.
745     + if test -z "$MAXFILES"; then
746     + # just check if file-max is readable
747     + if test -r /proc/sys/fs/file-max; then
748     + MAXFILES=$((`cat /proc/sys/fs/file-max` / 2))
749     + # don't exceed upper limit of 2^20 for open
750     + # files on systems where file-max is > 2^21
751     + if test $MAXFILES -gt 1048576; then
752     + MAXFILES=1048576
753     + fi
754     + fi
755     + fi
756     + SYSCTL_MAXFILES="fs.file-max"
757     + elif `uname -s | grep Darwin /dev/null 2>&1`; then
758     + SYSCTL_MAXFILES="kern.maxfiles"
759     + fi
760     +
761     +
762     + if test -n "$SYSMAXFILES"; then
763     + if test -n "$SYSCTL_MAXFILES"; then
764     + sysctl -w $SYSCTL_MAXFILES=$SYSMAXFILES
765     + fi
766     + fi
767     +
768     + # set the process's filemax to whatever set above
769     + ulimit -n $MAXFILES
770     +
771     + if test ! -d "${ASTVARRUNDIR}"; then
772     + mkdir -p "${ASTVARRUNDIR}"
773     + chmod 770 "${ASTVARRUNDIR}"
774     + fi
775     +
776     +fi
777     +
778     +if test -n "$UMASK"; then
779     + umask $UMASK
780     +fi
781     +
782     +#
783     +# Let Asterisk dump core
784     +#
785     +ulimit -c unlimited
786     +
787     +#
788     +# Don't fork when running "safely"
789     +#
790     +ASTARGS=""
791     +if test -n "$TTY" && test "$TTY" != "no"; then
792     + if test -c /dev/tty${TTY}; then
793     + TTY=tty${TTY}
794     + elif test -c /dev/vc/${TTY}; then
795     + TTY=vc/${TTY}
796     + elif test "$TTY" = "9"; then # ignore default if it was untouched
797     + # If there is no /dev/tty9 and not /dev/vc/9 we don't
798     + # necessarily want to die at this point. Pretend that
799     + # TTY wasn't set.
800     + TTY=
801     + else
802     + message "Cannot find specified TTY (${TTY})"
803     + exit 1
804     + fi
805     + if test -n "$TTY"; then
806     + ASTARGS="${ASTARGS} -vvvg"
807     + if test "$CONSOLE" != "no"; then
808     + ASTARGS="${ASTARGS} -c"
809     + fi
810     + fi
811     +fi
812     +
813     +if test ! -d "${RUNDIR}"; then
814     + message "${RUNDIR} does not exist, creating"
815     + if ! mkdir -p "${RUNDIR}"; then
816     + message "Unable to create ${RUNDIR}"
817     + exit 1
818     + fi
819     +fi
820     +
821     +if test ! -w "${DUMPDROP}"; then
822     + message "Cannot write to ${DUMPDROP}"
823     + exit 1
824     +fi
825     +
826     +#
827     +# Don't die if stdout/stderr can't be written to
828     +#
829     +trap '' PIPE
830     +
831     +#
832     +# Run scripts to set any environment variables or do any other system-specific setup needed
833     +#
834     +
835     +if test -d "${ASTETCDIR}/startup.d"; then
836     + for script in "${ASTETCDIR}/startup.d/"*.sh; do
837     + if test -r "${script}"; then
838     + . "${script}"
839     + fi
840     + done
841     +fi
842     +
843     +run_asterisk()
844     +{
845     + while :; do
846     + if test -n "$TTY" && test "$TTY" != "no"; then
847     + cd "${RUNDIR}"
848     + stty sane </dev/${TTY}
849     + nice -n $PRIORITY "${ASTSBINDIR}/asterisk" -f ${CLIARGS} ${ASTARGS} >/dev/${TTY} 2>&1 </dev/${TTY}
850     + else
851     + cd "${RUNDIR}"
852     + nice -n $PRIORITY "${ASTSBINDIR}/asterisk" -f ${CLIARGS} ${ASTARGS} >/dev/null 2>&1 </dev/null
853     + fi
854     + EXITSTATUS=$?
855     + message "Asterisk ended with exit status $EXITSTATUS"
856     + if test $EXITSTATUS -eq 0; then
857     + # Properly shutdown....
858     + message "Asterisk shutdown normally."
859     + exit 0
860     + elif test $EXITSTATUS -gt 128; then
861     + EXITSIGNAL=$((EXITSTATUS - 128))
862     + message "Asterisk exited on signal $EXITSIGNAL."
863     + if test -n "$NOTIFY"; then
864     + echo "Asterisk on $MACHINE exited on signal $EXITSIGNAL. Might want to take a peek." | \
865     + mail -s "Asterisk on $MACHINE died (sig $EXITSIGNAL)" $NOTIFY
866     + fi
867     + if test -n "$EXEC"; then
868     + $EXEC
869     + fi
870     +
871     + PID=`cat ${ASTPIDFILE}`
872     + DATE=`date "+%Y-%m-%dT%H:%M:%S%z"`
873     + if test -f "${RUNDIR}/core.${PID}"; then
874     + mv "${RUNDIR}/core.${PID}" "${DUMPDROP}/core.`hostname`-$DATE" &
875     + elif test -f "${RUNDIR}/core"; then
876     + mv "${RUNDIR}/core" "${DUMPDROP}/core.`hostname`-$DATE" &
877     + fi
878     + else
879     + message "Asterisk died with code $EXITSTATUS."
880     +
881     + PID=`cat ${ASTPIDFILE}`
882     + DATE=`date "+%Y-%m-%dT%H:%M:%S%z"`
883     + if test -f "${RUNDIR}/core.${PID}"; then
884     + mv "${RUNDIR}/core.${PID}" "${DUMPDROP}/core.`hostname`-$DATE" &
885     + elif test -f "${RUNDIR}/core"; then
886     + mv "${RUNDIR}/core" "${DUMPDROP}/core.`hostname`-$DATE" &
887     + fi
888     + fi
889     + message "Automatically restarting Asterisk."
890     + sleep $SLEEPSECS
891     + if test "0$KILLALLMPG123" -gt 0; then
892     + pkill -9 mpg123
893     + fi
894     + done
895     +}
896     +
897     +if test -n "$ASTSAFE_FOREGROUND"; then
898     + run_asterisk
899     +else
900     + run_asterisk &
901     +fi
902 jpp 1.3 diff -Nur --no-dereference smeserver-freepbx-13.old/root/usr/share/freepbx/sql/asterisk.sql smeserver-freepbx-13/root/usr/share/freepbx/sql/asterisk.sql
903     --- smeserver-freepbx-13.old/root/usr/share/freepbx/sql/asterisk.sql 1969-12-31 19:00:00.000000000 -0500
904     +++ smeserver-freepbx-13/root/usr/share/freepbx/sql/asterisk.sql 2022-03-27 16:11:54.792000000 -0400
905     @@ -0,0 +1,687 @@
906     +-- MySQL dump 10.13 Distrib 5.1.69, for redhat-linux-gnu (x86_64)
907     +--
908     +-- Host: localhost Database: asterisk
909     +-- ------------------------------------------------------
910     +-- Server version 5.1.69
911     +
912     +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
913     +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
914     +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
915     +/*!40101 SET NAMES utf8 */;
916     +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
917     +/*!40103 SET TIME_ZONE='+00:00' */;
918     +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
919     +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
920     +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
921     +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
922     +set @@default_storage_engine = 'MyISAM';
923     +
924     +--
925     +-- Table structure for table `admin`
926     +--
927     +
928     +DROP TABLE IF EXISTS `admin`;
929     +/*!40101 SET @saved_cs_client = @@character_set_client */;
930     +/*!40101 SET character_set_client = utf8 */;
931     +CREATE TABLE `admin` (
932     + `variable` varchar(20) NOT NULL DEFAULT '',
933     + `value` varchar(80) NOT NULL DEFAULT '',
934     + PRIMARY KEY (`variable`)
935     +);
936     +/*!40101 SET character_set_client = @saved_cs_client */;
937     +
938     +--
939     +-- Dumping data for table `admin`
940     +--
941     +
942     +LOCK TABLES `admin` WRITE;
943     +/*!40000 ALTER TABLE `admin` DISABLE KEYS */;
944     +INSERT INTO `admin` VALUES ('need_reload','true'),('version','2.11.0rc1'),('default_directory','1'),('directory28_migrated','1');
945     +/*!40000 ALTER TABLE `admin` ENABLE KEYS */;
946     +UNLOCK TABLES;
947     +
948     +--
949     +-- Table structure for table `ampusers`
950     +--
951     +
952     +DROP TABLE IF EXISTS `ampusers`;
953     +/*!40101 SET @saved_cs_client = @@character_set_client */;
954     +/*!40101 SET character_set_client = utf8 */;
955     +CREATE TABLE `ampusers` (
956     + `username` varchar(255) NOT NULL,
957     + `password_sha1` varchar(40) NOT NULL,
958     + `extension_low` varchar(20) NOT NULL DEFAULT '',
959     + `extension_high` varchar(20) NOT NULL DEFAULT '',
960     + `deptname` varchar(20) NOT NULL DEFAULT '',
961     + `sections` blob NOT NULL,
962     + PRIMARY KEY (`username`)
963     +);
964     +/*!40101 SET character_set_client = @saved_cs_client */;
965     +
966     +--
967     +-- Dumping data for table `ampusers`
968     +--
969     +
970     +LOCK TABLES `ampusers` WRITE;
971     +/*!40000 ALTER TABLE `ampusers` DISABLE KEYS */;
972     +/*!40000 ALTER TABLE `ampusers` ENABLE KEYS */;
973     +UNLOCK TABLES;
974     +
975     +
976     +--
977     +-- Table structure for table `cronmanager`
978     +--
979     +
980     +DROP TABLE IF EXISTS `cronmanager`;
981     +/*!40101 SET @saved_cs_client = @@character_set_client */;
982     +/*!40101 SET character_set_client = utf8 */;
983     +CREATE TABLE `cronmanager` (
984     + `module` varchar(24) NOT NULL DEFAULT '',
985     + `id` varchar(24) NOT NULL DEFAULT '',
986     + `time` varchar(5) DEFAULT NULL,
987     + `freq` int(11) NOT NULL DEFAULT '0',
988     + `lasttime` int(11) NOT NULL DEFAULT '0',
989     + `command` varchar(255) NOT NULL DEFAULT '',
990     + PRIMARY KEY (`module`,`id`)
991     +);
992     +/*!40101 SET character_set_client = @saved_cs_client */;
993     +
994     +--
995     +-- Dumping data for table `cronmanager`
996     +--
997     +
998     +LOCK TABLES `cronmanager` WRITE;
999     +/*!40000 ALTER TABLE `cronmanager` DISABLE KEYS */;
1000     +INSERT INTO `cronmanager` VALUES ('module_admin','UPDATES','22',24,0,'/var/lib/asterisk/bin/module_admin listonline > /dev/null 2>&1');
1001     +/*!40000 ALTER TABLE `cronmanager` ENABLE KEYS */;
1002     +UNLOCK TABLES;
1003     +
1004     +--
1005     +-- Table structure for table `dahdi`
1006     +--
1007     +
1008     +DROP TABLE IF EXISTS `dahdi`;
1009     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1010     +/*!40101 SET character_set_client = utf8 */;
1011     +CREATE TABLE `dahdi` (
1012     + `id` varchar(20) NOT NULL DEFAULT '-1',
1013     + `keyword` varchar(30) NOT NULL DEFAULT '',
1014     + `data` varchar(255) NOT NULL DEFAULT '',
1015     + `flags` int(1) NOT NULL DEFAULT '0',
1016     + PRIMARY KEY (`id`,`keyword`)
1017     +);
1018     +/*!40101 SET character_set_client = @saved_cs_client */;
1019     +
1020     +--
1021     +-- Dumping data for table `dahdi`
1022     +--
1023     +
1024     +LOCK TABLES `dahdi` WRITE;
1025     +/*!40000 ALTER TABLE `dahdi` DISABLE KEYS */;
1026     +/*!40000 ALTER TABLE `dahdi` ENABLE KEYS */;
1027     +UNLOCK TABLES;
1028     +
1029     +--
1030     +-- Table structure for table `devices`
1031     +--
1032     +
1033     +DROP TABLE IF EXISTS `devices`;
1034     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1035     +/*!40101 SET character_set_client = utf8 */;
1036     +CREATE TABLE `devices` (
1037     + `id` varchar(20) NOT NULL DEFAULT '',
1038     + `tech` varchar(10) NOT NULL DEFAULT '',
1039     + `dial` varchar(255) NOT NULL DEFAULT '',
1040     + `devicetype` varchar(5) NOT NULL DEFAULT '',
1041     + `user` varchar(50) DEFAULT NULL,
1042     + `description` varchar(50) DEFAULT NULL,
1043     + `emergency_cid` varchar(100) DEFAULT NULL,
1044     + KEY `id` (`id`),
1045     + KEY `tech` (`tech`)
1046     +);
1047     +/*!40101 SET character_set_client = @saved_cs_client */;
1048     +
1049     +--
1050     +-- Dumping data for table `devices`
1051     +--
1052     +
1053     +LOCK TABLES `devices` WRITE;
1054     +/*!40000 ALTER TABLE `devices` DISABLE KEYS */;
1055     +/*!40000 ALTER TABLE `devices` ENABLE KEYS */;
1056     +UNLOCK TABLES;
1057     +
1058     +--
1059     +-- Table structure for table `extensions`
1060     +--
1061     +
1062     +DROP TABLE IF EXISTS `extensions`;
1063     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1064     +/*!40101 SET character_set_client = utf8 */;
1065     +CREATE TABLE `extensions` (
1066     + `context` varchar(45) NOT NULL DEFAULT 'default',
1067     + `extension` varchar(45) NOT NULL DEFAULT '',
1068     + `priority` varchar(5) NOT NULL DEFAULT '1',
1069     + `application` varchar(45) NOT NULL DEFAULT '',
1070     + `args` varchar(255) DEFAULT NULL,
1071     + `descr` text,
1072     + `flags` int(1) NOT NULL DEFAULT '0',
1073     + PRIMARY KEY (`context`,`extension`,`priority`)
1074     +);
1075     +/*!40101 SET character_set_client = @saved_cs_client */;
1076     +
1077     +--
1078     +-- Dumping data for table `extensions`
1079     +--
1080     +
1081     +LOCK TABLES `extensions` WRITE;
1082     +/*!40000 ALTER TABLE `extensions` DISABLE KEYS */;
1083     +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);
1084     +/*!40000 ALTER TABLE `extensions` ENABLE KEYS */;
1085     +UNLOCK TABLES;
1086     +
1087     +--
1088     +-- Table structure for table `fax_details`
1089     +--
1090     +
1091     +DROP TABLE IF EXISTS `featurecodes`;
1092     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1093     +/*!40101 SET character_set_client = utf8 */;
1094     +CREATE TABLE `featurecodes` (
1095     + `modulename` varchar(50) NOT NULL DEFAULT '',
1096     + `featurename` varchar(50) NOT NULL DEFAULT '',
1097     + `description` varchar(200) NOT NULL DEFAULT '',
1098     + `helptext` varchar(250) NOT NULL DEFAULT '',
1099     + `defaultcode` varchar(20) DEFAULT NULL,
1100     + `customcode` varchar(20) DEFAULT NULL,
1101     + `enabled` tinyint(4) NOT NULL DEFAULT '0',
1102     + `providedest` tinyint(4) NOT NULL DEFAULT '0',
1103     + PRIMARY KEY (`modulename`,`featurename`),
1104     + KEY `enabled` (`enabled`)
1105     +);
1106     +/*!40101 SET character_set_client = @saved_cs_client */;
1107     +
1108     +--
1109     +-- Dumping data for table `featurecodes`
1110     +--
1111     +
1112     +LOCK TABLES `featurecodes` WRITE;
1113     +/*!40000 ALTER TABLE `featurecodes` DISABLE KEYS */;
1114     +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);
1115     +/*!40000 ALTER TABLE `featurecodes` ENABLE KEYS */;
1116     +UNLOCK TABLES;
1117     +
1118     +--
1119     +-- Table structure for table `freepbx_log`
1120     +--
1121     +
1122     +DROP TABLE IF EXISTS `freepbx_log`;
1123     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1124     +/*!40101 SET character_set_client = utf8 */;
1125     +CREATE TABLE `freepbx_log` (
1126     + `id` int(11) NOT NULL AUTO_INCREMENT,
1127     + `time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1128     + `section` varchar(50) DEFAULT NULL,
1129     + `level` enum('error','warning','debug','devel-debug') NOT NULL DEFAULT 'error',
1130     + `status` int(11) NOT NULL DEFAULT '0',
1131     + `message` text NOT NULL,
1132     + PRIMARY KEY (`id`),
1133     + KEY `time` (`time`,`level`)
1134     +) AUTO_INCREMENT=3;
1135     +/*!40101 SET character_set_client = @saved_cs_client */;
1136     +
1137     +--
1138     +-- Dumping data for table `freepbx_log`
1139     +--
1140     +
1141     +LOCK TABLES `freepbx_log` WRITE;
1142     +/*!40000 ALTER TABLE `freepbx_log` DISABLE KEYS */;
1143     +/*!40000 ALTER TABLE `freepbx_log` ENABLE KEYS */;
1144     +UNLOCK TABLES;
1145     +
1146     +--
1147     +-- Table structure for table `freepbx_settings`
1148     +--
1149     +
1150     +DROP TABLE IF EXISTS `freepbx_settings`;
1151     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1152     +/*!40101 SET character_set_client = utf8 */;
1153     +CREATE TABLE `freepbx_settings` (
1154     + `keyword` varchar(50) NOT NULL DEFAULT '',
1155     + `value` varchar(255) DEFAULT NULL,
1156     + `name` varchar(80) DEFAULT NULL,
1157     + `level` tinyint(1) DEFAULT '0',
1158     + `description` text,
1159     + `type` varchar(25) DEFAULT NULL,
1160     + `options` text,
1161     + `defaultval` varchar(255) DEFAULT NULL,
1162     + `readonly` tinyint(1) DEFAULT '0',
1163     + `hidden` tinyint(1) DEFAULT '0',
1164     + `category` varchar(50) DEFAULT NULL,
1165     + `module` varchar(25) DEFAULT NULL,
1166     + `emptyok` tinyint(1) DEFAULT '1',
1167     + `sortorder` int(11) DEFAULT '0',
1168     + PRIMARY KEY (`keyword`)
1169     +);
1170     +/*!40101 SET character_set_client = @saved_cs_client */;
1171     +
1172     +--
1173     +-- Table structure for table `globals`
1174     +--
1175     +
1176     +DROP TABLE IF EXISTS `globals`;
1177     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1178     +/*!40101 SET character_set_client = utf8 */;
1179     +CREATE TABLE `globals` (
1180     + `variable` varchar(255) NOT NULL,
1181     + `value` varchar(255) NOT NULL,
1182     + PRIMARY KEY (`variable`)
1183     +);
1184     +/*!40101 SET character_set_client = @saved_cs_client */;
1185     +
1186     +LOCK TABLES `globals` WRITE;
1187     +/*!40000 ALTER TABLE `globals` DISABLE KEYS */;
1188     +/*!40000 ALTER TABLE `globals` ENABLE KEYS */;
1189     +UNLOCK TABLES;
1190     +
1191     +--
1192     +-- Table structure for table `iax`
1193     +--
1194     +
1195     +DROP TABLE IF EXISTS `iax`;
1196     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1197     +/*!40101 SET character_set_client = utf8 */;
1198     +CREATE TABLE `iax` (
1199     + `id` varchar(20) NOT NULL DEFAULT '-1',
1200     + `keyword` varchar(30) NOT NULL DEFAULT '',
1201     + `data` varchar(255) NOT NULL,
1202     + `flags` int(1) NOT NULL DEFAULT '0',
1203     + PRIMARY KEY (`id`,`keyword`)
1204     +);
1205     +/*!40101 SET character_set_client = @saved_cs_client */;
1206     +
1207     +--
1208     +-- Dumping data for table `iax`
1209     +--
1210     +
1211     +LOCK TABLES `iax` WRITE;
1212     +/*!40000 ALTER TABLE `iax` DISABLE KEYS */;
1213     +/*!40000 ALTER TABLE `iax` ENABLE KEYS */;
1214     +UNLOCK TABLES;
1215     +
1216     +--
1217     +-- Table structure for table `incoming`
1218     +--
1219     +
1220     +DROP TABLE IF EXISTS `incoming`;
1221     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1222     +/*!40101 SET character_set_client = utf8 */;
1223     +CREATE TABLE `incoming` (
1224     + `cidnum` varchar(20) DEFAULT NULL,
1225     + `extension` varchar(50) NOT NULL,
1226     + `destination` varchar(50) DEFAULT NULL,
1227     + `faxexten` varchar(20) DEFAULT NULL,
1228     + `faxemail` varchar(50) DEFAULT NULL,
1229     + `answer` tinyint(1) DEFAULT NULL,
1230     + `wait` int(2) DEFAULT NULL,
1231     + `privacyman` tinyint(1) DEFAULT NULL,
1232     + `alertinfo` varchar(255) DEFAULT NULL,
1233     + `ringing` varchar(20) DEFAULT NULL,
1234     + `mohclass` varchar(80) NOT NULL DEFAULT 'default',
1235     + `description` varchar(80) DEFAULT NULL,
1236     + `grppre` varchar(80) DEFAULT NULL,
1237     + `delay_answer` int(2) DEFAULT NULL,
1238     + `pricid` varchar(20) DEFAULT NULL,
1239     + `pmmaxretries` varchar(2) DEFAULT NULL,
1240     + `pmminlength` varchar(2) DEFAULT NULL
1241     +);
1242     +/*!40101 SET character_set_client = @saved_cs_client */;
1243     +
1244     +--
1245     +-- Dumping data for table `incoming`
1246     +--
1247     +
1248     +LOCK TABLES `incoming` WRITE;
1249     +/*!40000 ALTER TABLE `incoming` DISABLE KEYS */;
1250     +/*!40000 ALTER TABLE `incoming` ENABLE KEYS */;
1251     +UNLOCK TABLES;
1252     +
1253     +--
1254     +-- Table structure for table `module_xml`
1255     +--
1256     +
1257     +DROP TABLE IF EXISTS `module_xml`;
1258     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1259     +/*!40101 SET character_set_client = utf8 */;
1260     +CREATE TABLE `module_xml` (
1261     + `id` varchar(20) NOT NULL DEFAULT 'xml',
1262     + `time` int(11) NOT NULL DEFAULT '0',
1263     + `data` longblob NOT NULL,
1264     + PRIMARY KEY (`id`)
1265     +);
1266     +/*!40101 SET character_set_client = @saved_cs_client */;
1267     +
1268     +--
1269     +-- Table structure for table `modules`
1270     +--
1271     +
1272     +DROP TABLE IF EXISTS `modules`;
1273     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1274     +/*!40101 SET character_set_client = utf8 */;
1275     +CREATE TABLE `modules` (
1276     + `id` int(11) NOT NULL AUTO_INCREMENT,
1277     + `modulename` varchar(50) NOT NULL DEFAULT '',
1278     + `version` varchar(20) NOT NULL DEFAULT '',
1279     + `enabled` tinyint(4) NOT NULL DEFAULT '0',
1280     + `signature` blob,
1281     + PRIMARY KEY (`id`)
1282     +) AUTO_INCREMENT=1;
1283     +/*!40101 SET character_set_client = @saved_cs_client */;
1284     +
1285     +--
1286     +-- Table structure for table `notifications`
1287     +--
1288     +
1289     +DROP TABLE IF EXISTS `notifications`;
1290     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1291     +/*!40101 SET character_set_client = utf8 */;
1292     +CREATE TABLE `notifications` (
1293     + `module` varchar(24) NOT NULL DEFAULT '',
1294     + `id` varchar(24) NOT NULL DEFAULT '',
1295     + `level` int(11) NOT NULL DEFAULT '0',
1296     + `display_text` varchar(255) NOT NULL DEFAULT '',
1297     + `extended_text` blob NOT NULL,
1298     + `link` varchar(255) NOT NULL DEFAULT '',
1299     + `reset` tinyint(4) NOT NULL DEFAULT '0',
1300     + `candelete` tinyint(4) NOT NULL DEFAULT '0',
1301     + `timestamp` int(11) NOT NULL DEFAULT '0',
1302     + PRIMARY KEY (`module`,`id`)
1303     +);
1304     +/*!40101 SET character_set_client = @saved_cs_client */;
1305     +
1306     +--
1307     +-- Table structure for table `outbound_route_patterns`
1308     +--
1309     +
1310     +DROP TABLE IF EXISTS `outbound_route_patterns`;
1311     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1312     +/*!40101 SET character_set_client = utf8 */;
1313     +CREATE TABLE `outbound_route_patterns` (
1314     + `route_id` int(11) NOT NULL,
1315     + `match_pattern_prefix` varchar(60) NOT NULL DEFAULT '',
1316     + `match_pattern_pass` varchar(60) NOT NULL DEFAULT '',
1317     + `match_cid` varchar(60) NOT NULL DEFAULT '',
1318     + `prepend_digits` varchar(100) NOT NULL DEFAULT '',
1319     + PRIMARY KEY (`route_id`,`match_pattern_prefix`,`match_pattern_pass`,`match_cid`,`prepend_digits`)
1320     +);
1321     +/*!40101 SET character_set_client = @saved_cs_client */;
1322     +
1323     +--
1324     +-- Dumping data for table `outbound_route_patterns`
1325     +--
1326     +
1327     +LOCK TABLES `outbound_route_patterns` WRITE;
1328     +/*!40000 ALTER TABLE `outbound_route_patterns` DISABLE KEYS */;
1329     +/*!40000 ALTER TABLE `outbound_route_patterns` ENABLE KEYS */;
1330     +UNLOCK TABLES;
1331     +
1332     +--
1333     +-- Table structure for table `outbound_route_sequence`
1334     +--
1335     +
1336     +DROP TABLE IF EXISTS `outbound_route_sequence`;
1337     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1338     +/*!40101 SET character_set_client = utf8 */;
1339     +CREATE TABLE `outbound_route_sequence` (
1340     + `route_id` int(11) NOT NULL,
1341     + `seq` int(11) NOT NULL,
1342     + PRIMARY KEY (`route_id`,`seq`)
1343     +);
1344     +/*!40101 SET character_set_client = @saved_cs_client */;
1345     +
1346     +--
1347     +-- Dumping data for table `outbound_route_sequence`
1348     +--
1349     +
1350     +LOCK TABLES `outbound_route_sequence` WRITE;
1351     +/*!40000 ALTER TABLE `outbound_route_sequence` DISABLE KEYS */;
1352     +/*!40000 ALTER TABLE `outbound_route_sequence` ENABLE KEYS */;
1353     +UNLOCK TABLES;
1354     +
1355     +--
1356     +-- Table structure for table `outbound_route_trunks`
1357     +--
1358     +
1359     +DROP TABLE IF EXISTS `outbound_route_trunks`;
1360     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1361     +/*!40101 SET character_set_client = utf8 */;
1362     +CREATE TABLE `outbound_route_trunks` (
1363     + `route_id` int(11) NOT NULL,
1364     + `trunk_id` int(11) NOT NULL,
1365     + `seq` int(11) NOT NULL,
1366     + PRIMARY KEY (`route_id`,`trunk_id`,`seq`)
1367     +);
1368     +/*!40101 SET character_set_client = @saved_cs_client */;
1369     +
1370     +--
1371     +-- Dumping data for table `outbound_route_trunks`
1372     +--
1373     +
1374     +LOCK TABLES `outbound_route_trunks` WRITE;
1375     +/*!40000 ALTER TABLE `outbound_route_trunks` DISABLE KEYS */;
1376     +/*!40000 ALTER TABLE `outbound_route_trunks` ENABLE KEYS */;
1377     +UNLOCK TABLES;
1378     +
1379     +--
1380     +-- Table structure for table `outbound_routes`
1381     +--
1382     +
1383     +DROP TABLE IF EXISTS `outbound_routes`;
1384     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1385     +/*!40101 SET character_set_client = utf8 */;
1386     +CREATE TABLE `outbound_routes` (
1387     + `route_id` int(11) NOT NULL AUTO_INCREMENT,
1388     + `name` varchar(40) DEFAULT NULL,
1389     + `outcid` varchar(40) DEFAULT NULL,
1390     + `outcid_mode` varchar(20) DEFAULT NULL,
1391     + `password` varchar(30) DEFAULT NULL,
1392     + `emergency_route` varchar(4) DEFAULT NULL,
1393     + `intracompany_route` varchar(4) DEFAULT NULL,
1394     + `mohclass` varchar(80) DEFAULT NULL,
1395     + `time_group_id` int(11) DEFAULT NULL,
1396     + `dest` varchar(255) DEFAULT NULL,
1397     + PRIMARY KEY (`route_id`)
1398     +);
1399     +/*!40101 SET character_set_client = @saved_cs_client */;
1400     +
1401     +--
1402     +-- Dumping data for table `outbound_routes`
1403     +--
1404     +
1405     +LOCK TABLES `outbound_routes` WRITE;
1406     +/*!40000 ALTER TABLE `outbound_routes` DISABLE KEYS */;
1407     +/*!40000 ALTER TABLE `outbound_routes` ENABLE KEYS */;
1408     +UNLOCK TABLES;
1409     +
1410     +--
1411     +-- Table structure for table `sip`
1412     +--
1413     +
1414     +DROP TABLE IF EXISTS `sip`;
1415     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1416     +/*!40101 SET character_set_client = utf8 */;
1417     +CREATE TABLE `sip` (
1418     + `id` varchar(20) NOT NULL DEFAULT '-1',
1419     + `keyword` varchar(30) NOT NULL DEFAULT '',
1420     + `data` varchar(255) NOT NULL,
1421     + `flags` int(1) NOT NULL DEFAULT '0',
1422     + PRIMARY KEY (`id`,`keyword`)
1423     +);
1424     +/*!40101 SET character_set_client = @saved_cs_client */;
1425     +
1426     +--
1427     +-- Dumping data for table `sip`
1428     +--
1429     +
1430     +LOCK TABLES `sip` WRITE;
1431     +/*!40000 ALTER TABLE `sip` DISABLE KEYS */;
1432     +/*!40000 ALTER TABLE `sip` ENABLE KEYS */;
1433     +UNLOCK TABLES;
1434     +
1435     +--
1436     +-- Table structure for table `sip`
1437     +--
1438     +
1439     +DROP TABLE IF EXISTS `pjsip`;
1440     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1441     +/*!40101 SET character_set_client = utf8 */;
1442     +CREATE TABLE `pjsip` (
1443     + `id` varchar(20) NOT NULL DEFAULT '-1',
1444     + `keyword` varchar(30) NOT NULL DEFAULT '',
1445     + `data` varchar(255) NOT NULL,
1446     + `flags` int(1) NOT NULL DEFAULT '0',
1447     + PRIMARY KEY (`id`,`keyword`)
1448     +);
1449     +/*!40101 SET character_set_client = @saved_cs_client */;
1450     +
1451     +--
1452     +-- Dumping data for table `pjsip`
1453     +--
1454     +
1455     +LOCK TABLES `pjsip` WRITE;
1456     +/*!40000 ALTER TABLE `pjsip` DISABLE KEYS */;
1457     +/*!40000 ALTER TABLE `pjsip` ENABLE KEYS */;
1458     +UNLOCK TABLES;
1459     +
1460     +--
1461     +-- Table structure for table `trunk_dialpatterns`
1462     +--
1463     +
1464     +DROP TABLE IF EXISTS `trunk_dialpatterns`;
1465     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1466     +/*!40101 SET character_set_client = utf8 */;
1467     +CREATE TABLE `trunk_dialpatterns` (
1468     + `trunkid` int(11) NOT NULL DEFAULT '0',
1469     + `match_pattern_prefix` varchar(50) NOT NULL DEFAULT '',
1470     + `match_pattern_pass` varchar(50) NOT NULL DEFAULT '',
1471     + `prepend_digits` varchar(50) NOT NULL DEFAULT '',
1472     + `seq` int(11) NOT NULL DEFAULT '0',
1473     + PRIMARY KEY (`trunkid`,`match_pattern_prefix`,`match_pattern_pass`,`prepend_digits`,`seq`)
1474     +);
1475     +/*!40101 SET character_set_client = @saved_cs_client */;
1476     +
1477     +--
1478     +-- Dumping data for table `trunk_dialpatterns`
1479     +--
1480     +
1481     +LOCK TABLES `trunk_dialpatterns` WRITE;
1482     +/*!40000 ALTER TABLE `trunk_dialpatterns` DISABLE KEYS */;
1483     +/*!40000 ALTER TABLE `trunk_dialpatterns` ENABLE KEYS */;
1484     +UNLOCK TABLES;
1485     +
1486     +--
1487     +-- Table structure for table `trunks`
1488     +--
1489     +
1490     +DROP TABLE IF EXISTS `trunks`;
1491     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1492     +/*!40101 SET character_set_client = utf8 */;
1493     +CREATE TABLE `trunks` (
1494     + `trunkid` int(11) NOT NULL DEFAULT '0',
1495     + `name` varchar(50) NOT NULL DEFAULT '',
1496     + `tech` varchar(20) NOT NULL,
1497     + `outcid` varchar(40) NOT NULL DEFAULT '',
1498     + `keepcid` varchar(4) DEFAULT 'off',
1499     + `maxchans` varchar(6) DEFAULT '',
1500     + `failscript` varchar(255) NOT NULL DEFAULT '',
1501     + `dialoutprefix` varchar(255) NOT NULL DEFAULT '',
1502     + `channelid` varchar(255) NOT NULL DEFAULT '',
1503     + `usercontext` varchar(255) DEFAULT NULL,
1504     + `provider` varchar(40) DEFAULT NULL,
1505     + `disabled` varchar(4) DEFAULT 'off',
1506     + `continue` varchar(4) DEFAULT 'off',
1507     + PRIMARY KEY (`trunkid`,`tech`,`channelid`)
1508     +);
1509     +/*!40101 SET character_set_client = @saved_cs_client */;
1510     +
1511     +--
1512     +-- Dumping data for table `trunks`
1513     +--
1514     +
1515     +LOCK TABLES `trunks` WRITE;
1516     +/*!40000 ALTER TABLE `trunks` DISABLE KEYS */;
1517     +INSERT INTO `trunks` VALUES (1,'','dahdi','','','','','','g0','',NULL,'off','off');
1518     +/*!40000 ALTER TABLE `trunks` ENABLE KEYS */;
1519     +UNLOCK TABLES;
1520     +
1521     +--
1522     +-- Table structure for table `users`
1523     +--
1524     +
1525     +DROP TABLE IF EXISTS `users`;
1526     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1527     +/*!40101 SET character_set_client = utf8 */;
1528     +CREATE TABLE `users` (
1529     + `extension` varchar(20) NOT NULL DEFAULT '',
1530     + `password` varchar(20) DEFAULT NULL,
1531     + `name` varchar(50) DEFAULT NULL,
1532     + `voicemail` varchar(50) DEFAULT NULL,
1533     + `ringtimer` int(3) DEFAULT NULL,
1534     + `noanswer` varchar(100) DEFAULT NULL,
1535     + `recording` varchar(50) DEFAULT NULL,
1536     + `outboundcid` varchar(50) DEFAULT NULL,
1537     + `sipname` varchar(50) DEFAULT NULL,
1538     + `noanswer_cid` varchar(20) NOT NULL DEFAULT '',
1539     + `busy_cid` varchar(20) NOT NULL DEFAULT '',
1540     + `chanunavail_cid` varchar(20) NOT NULL DEFAULT '',
1541     + `noanswer_dest` varchar(255) NOT NULL DEFAULT '',
1542     + `busy_dest` varchar(255) NOT NULL DEFAULT '',
1543     + `chanunavail_dest` varchar(255) NOT NULL DEFAULT '',
1544     + `mohclass` varchar(80) DEFAULT 'default',
1545     + KEY `extension` (`extension`)
1546     +);
1547     +/*!40101 SET character_set_client = @saved_cs_client */;
1548     +
1549     +--
1550     +-- Dumping data for table `users`
1551     +--
1552     +
1553     +LOCK TABLES `users` WRITE;
1554     +/*!40000 ALTER TABLE `users` DISABLE KEYS */;
1555     +/*!40000 ALTER TABLE `users` ENABLE KEYS */;
1556     +UNLOCK TABLES;
1557     +
1558     +--
1559     +-- Table structure for table `dahdichandids`
1560     +--
1561     +
1562     +DROP TABLE IF EXISTS `dahdichandids`;
1563     +/*!40101 SET @saved_cs_client = @@character_set_client */;
1564     +/*!40101 SET character_set_client = utf8 */;
1565     +CREATE TABLE `dahdichandids` (
1566     + `channel` int(11) NOT NULL DEFAULT '0',
1567     + `description` varchar(40) NOT NULL DEFAULT '',
1568     + `did` varchar(60) NOT NULL DEFAULT '',
1569     + PRIMARY KEY (`channel`)
1570     +);
1571     +/*!40101 SET character_set_client = @saved_cs_client */;
1572     +
1573     +--
1574     +-- Dumping data for table `dahdichandids`
1575     +--
1576     +
1577     +LOCK TABLES `dahdichandids` WRITE;
1578     +/*!40000 ALTER TABLE `dahdichandids` DISABLE KEYS */;
1579     +/*!40000 ALTER TABLE `dahdichandids` ENABLE KEYS */;
1580     +UNLOCK TABLES;
1581     +
1582     +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
1583     +
1584     +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
1585     +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
1586     +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
1587     +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
1588     +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
1589     +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
1590     +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
1591     +
1592     +-- Dump completed on 2013-12-04 1:30:59
1593     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
1594     --- smeserver-freepbx-13.old/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi 2016-06-13 08:03:08.000000000 -0400
1595     +++ smeserver-freepbx-13/root/var/lib/asterisk/agi-bin/trunk_alert_mail.agi 1969-12-31 19:00:00.000000000 -0500
1596     @@ -1,44 +0,0 @@
1597     -#!/bin/bash
1598     -
1599     -declare -a array
1600     -while read -e ARG && [ "$ARG" ] ; do
1601     -array=(` echo $ARG | sed -e 's/://'`)
1602     -export ${array[0]}=${array[1]}
1603     -done
1604     -
1605     -TRUNK=$1
1606     -DOMAIN=`dnsdomainname`
1607     -HOST=`hostname`
1608     -
1609     -EMAIL=admin@$DOMAIN
1610     -
1611     -DATE=`date "+%d-%m-%Y %H:%M"`
1612     -
1613     -CID=`echo $agi_callerid`
1614     -CIDNAME=`echo $agi_calleridname`
1615     -EXTENSION=`echo $agi_extension`
1616     -#CHANNEL=`echo $agi_channel`
1617     -TYPE=`echo $agi_type`
1618     -DNID=`echo $agi_dnid`
1619     -
1620     -REPORT=$EXTENSION
1621     -
1622     -if [ "$EXTENSION" = "s-CHANUNAVAIL" ]; then
1623     - REPORT="Channel Unavailable"
1624     -elif [ "$EXTENSION" = "s-CONGESTION" ]; then
1625     - REPORT="Congestion"
1626     -fi
1627     -
1628     -# Message Formating
1629     -
1630     -MSG="\n\n A call from \"$CIDNAME\" <$CID> (Type $TYPE)\n"
1631     -MSG="$MSG To : $DNID\n"
1632     -MSG="$MSG Using Trunk : $TRUNK\n"
1633     -MSG="$MSG Has failed on host $HOST.$DOMAIN at $DATE\n\n"
1634     -MSG="$MSG The error is : $REPORT \n\n"
1635     -
1636     -# Send an email
1637     -
1638     -echo -e "$MSG" | mail -s "[FAILED CALL] on host $HOST.$DOMAIN" "$EMAIL"
1639     -
1640     -

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed