Browse Source

freepbx module install/upgrade fixes

hal 4 years ago
parent
commit
f61cc93791
2 changed files with 47 additions and 6 deletions
  1. 1 1
      Dockerfile
  2. 46 5
      filesystem/entrypoint-hooks.sh

+ 1 - 1
Dockerfile

@@ -257,7 +257,6 @@ RUN cd /usr/src && \
   curl -fSL --connect-timeout 30 http://mirror1.freepbx.org/modules-${FREEPBX_VER}.xml -o modules-${FREEPBX_VER}.xml && \
   mkdir -p amp_conf/htdocs/admin/modules/_cache && \
   for MODULE in \
-      pm2 \
       announcement \
       arimanager \
       asteriskinfo \
@@ -290,6 +289,7 @@ RUN cd /usr/src && \
       bulkhandler \
       speeddial \
       weakpasswords \
+      pm2 \
       ; do \
   mkdir -p amp_conf/htdocs/admin/modules/$MODULE && \
   MODULE_VER=$(php -r "echo json_encode(simplexml_load_file('modules-${FREEPBX_VER}.xml'));" | jq -r ".module[] | select(.rawname == \"${MODULE}\") | {version}".version) && \

+ 46 - 5
filesystem/entrypoint-hooks.sh

@@ -164,9 +164,9 @@ cfgService_postfix() {
 postconf -e inet_protocols=ipv4
 
 if [ ! -z "$HOSTNAME" ]; then
-	postconf -e myhostname="$HOSTNAME"
+  postconf -e myhostname="$HOSTNAME"
 else
-	postconf -# myhostname
+  postconf -# myhostname
 fi
 
 postconf -# relayhost
@@ -174,9 +174,9 @@ postconf -# smtp_sasl_auth_enable
 postconf -# smtp_sasl_password_maps
 postconf -# smtp_sasl_security_options
 if [ ! -z "$MYNETWORKS" ]; then
-	postconf -e mynetworks=$MYNETWORKS
+  postconf -e mynetworks=$MYNETWORKS
 else
-	postconf -e "mynetworks=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+  postconf -e "mynetworks=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
 fi
 [ ! -f /etc/aliases ] && echo "postmaster: root" > /etc/aliases
 [ ${ROOT_MAILTO} ] && echo "root: ${ROOT_MAILTO}" >> /etc/aliases && newaliases
@@ -480,6 +480,40 @@ cfgService_freepbx_install() {
      mailboxcontext VARCHAR(80) NULL DEFAULT NULL, \
      recording LONGBLOB NULL DEFAULT NULL, \
      msg_id VARCHAR(40) NULL DEFAULT NULL) ENGINE = InnoDB;"
+  mysql -h ${MYSQL_SERVER} -P ${APP_PORT_MYSQL} -u root --password=${MYSQL_ROOT_PASSWORD} -B -e \
+    "CREATE TABLE IF NOT EXISTS asteriskcdrdb.cdr \
+    (calldate datetime NOT NULL DEFAULT '1000-01-01 00:00:00', \
+     clid varchar(80) NOT NULL DEFAULT '', \
+     src varchar(80) NOT NULL DEFAULT '', \
+     dst varchar(80) NOT NULL DEFAULT '', \
+     dcontext varchar(80) NOT NULL DEFAULT '', \
+     channel varchar(80) NOT NULL DEFAULT '', \
+     dstchannel varchar(80) NOT NULL DEFAULT '', \
+     lastapp varchar(80) NOT NULL DEFAULT '', \
+     lastdata varchar(80) NOT NULL DEFAULT '', \
+     duration int(11) NOT NULL DEFAULT 0, \
+     billsec int(11) NOT NULL DEFAULT 0, \
+     disposition varchar(45) NOT NULL DEFAULT '', \
+     amaflags int(11) NOT NULL DEFAULT 0, \
+     accountcode varchar(20) NOT NULL DEFAULT '', \
+     uniqueid varchar(32) NOT NULL DEFAULT '', \
+     userfield varchar(255) NOT NULL DEFAULT '', \
+     did varchar(50) NOT NULL DEFAULT '', \
+     recordingfile varchar(255) NOT NULL DEFAULT '', \
+     cnum varchar(80) NOT NULL DEFAULT '', \
+     cnam varchar(80) NOT NULL DEFAULT '', \
+     outbound_cnum varchar(80) NOT NULL DEFAULT '', \
+     outbound_cnam varchar(80) NOT NULL DEFAULT '', \
+     dst_cnam varchar(80) NOT NULL DEFAULT '', \
+     linkedid varchar(32) NOT NULL DEFAULT '', \
+     peeraccount varchar(80) NOT NULL DEFAULT '', \
+     sequence int(11) NOT NULL DEFAULT 0, \
+     KEY calldate (calldate), \
+     KEY dst (dst), \
+     KEY accountcode (accountcode), \
+     KEY uniqueid (uniqueid), \
+     KEY did (did), \
+     KEY recordingfile (recordingfile)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
 
   FPBX_OPTS+=" --webroot=${fpbxDirs[AMPWEBROOT]}"
   FPBX_OPTS+=" --astetcdir=${fpbxDirs[ASTETCDIR]}"
@@ -527,6 +561,7 @@ cfgService_freepbx_install() {
     "}
 
     : ${FREEPBX_MODULES_PRE:="
+      pm2
       userman
     "}
 
@@ -568,7 +603,6 @@ cfgService_freepbx_install() {
       queues
       cel
       timeconditions
-      pm2
     "}
 
     : ${FREEPBX_MODULES_DISABLED="
@@ -588,6 +622,8 @@ cfgService_freepbx_install() {
     done
     echo "--> fixing FreePBX permissions..."
     fwconsole chown
+    echo "--> enabling pm2 module..."
+    fwconsole ma enable pm2
     freepbx_reload
     echo "--> installing Extra FreePBX modules from local install into '${fpbxDirs[AMPWEBROOT]}/admin/modules'"
     for module in ${FREEPBX_MODULES_EXTRA}; do
@@ -596,6 +632,11 @@ cfgService_freepbx_install() {
     echo "--> fixing FreePBX permissions..."
     fwconsole chown
     freepbx_reload
+    echo "--> upgrading modules..."
+    fwconsole ma upgradeall
+    echo "--> fixing FreePBX permissions..."
+    fwconsole chown
+    freepbx_reload
     echo "--> stopping cron..."
     killall -9 cron
     touch "${APP_DATA}/.initialized"