mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #2489 from jvonau/pbx2
FreePBX fixes for php7.4 on Ubuntu 20.04
This commit is contained in:
commit
212d97e7ee
8 changed files with 89 additions and 34 deletions
|
@ -14,7 +14,7 @@
|
||||||
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
|
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
|
||||||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
||||||
|
|
||||||
pbx_installed: False
|
#pbx_installed: False
|
||||||
|
|
||||||
asterisk_url: http://downloads.asterisk.org/pub/telephony/asterisk/
|
asterisk_url: http://downloads.asterisk.org/pub/telephony/asterisk/
|
||||||
asterisk_src_file: asterisk-16-current.tar.gz
|
asterisk_src_file: asterisk-16-current.tar.gz
|
||||||
|
|
|
@ -37,6 +37,11 @@
|
||||||
src: "roles/pbx/templates/71-freepbx-framework.patch"
|
src: "roles/pbx/templates/71-freepbx-framework.patch"
|
||||||
dest: "{{ freepbx_src_dir }}/amp_conf/htdocs/admin/libraries/BMO/Framework.class.php"
|
dest: "{{ freepbx_src_dir }}/amp_conf/htdocs/admin/libraries/BMO/Framework.class.php"
|
||||||
|
|
||||||
|
- name: FreePBX - Patch FreePBX source - wants [] not {}
|
||||||
|
patch:
|
||||||
|
src: "roles/pbx/templates/pbx.patch"
|
||||||
|
dest: "{{ freepbx_src_dir }}/amp_conf/htdocs/admin/libraries/Composer/vendor/neitanod/forceutf8/src/ForceUTF8/Encoding.php"
|
||||||
|
|
||||||
- name: FreePBX - Disable & Stop asterisk service
|
- name: FreePBX - Disable & Stop asterisk service
|
||||||
systemd:
|
systemd:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
@ -97,13 +102,21 @@
|
||||||
recurse: yes
|
recurse: yes
|
||||||
|
|
||||||
- name: FreePBX - Install (just run once) - CAN TAKE 12 MIN OR LONGER!
|
- name: FreePBX - Install (just run once) - CAN TAKE 12 MIN OR LONGER!
|
||||||
command: "{{ item }}"
|
command: ./start_asterisk start
|
||||||
args:
|
args:
|
||||||
chdir: "{{ freepbx_src_dir }}"
|
chdir: "{{ freepbx_src_dir }}"
|
||||||
creates: "{{ freepbx_install_dir }}"
|
creates: "{{ freepbx_install_dir }}"
|
||||||
with_items:
|
|
||||||
- ./start_asterisk start
|
- name: FreePBX - Install (just run once) - CAN TAKE 12 MIN OR LONGER!
|
||||||
- ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }}
|
command: ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }}
|
||||||
|
args:
|
||||||
|
chdir: "{{ freepbx_src_dir }}"
|
||||||
|
creates: "{{ freepbx_install_dir }}"
|
||||||
|
|
||||||
|
- name: FreePBX - Patch FreePBX source - disable get_magic_quotes_gpc()
|
||||||
|
patch:
|
||||||
|
src: "roles/pbx/templates/pbx2.patch"
|
||||||
|
dest: "{{ freepbx_install_dir }}/freepbx/admin/libraries/view.functions.php"
|
||||||
|
|
||||||
- name: FreePBX - Create /etc/odbc.ini
|
- name: FreePBX - Create /etc/odbc.ini
|
||||||
template:
|
template:
|
||||||
|
@ -117,29 +130,16 @@
|
||||||
template:
|
template:
|
||||||
src: freepbx.conf.j2
|
src: freepbx.conf.j2
|
||||||
dest: /etc/apache2/sites-available/freepbx.conf
|
dest: /etc/apache2/sites-available/freepbx.conf
|
||||||
owner: {{ apache_user }}
|
owner: "{{ apache_user }}"
|
||||||
group: {{ apache_user }}
|
group: "{{ apache_user }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
|
||||||
- name: FreePBX - Enable http://box:{{ pbx_http_port }} via Apache, if pbx_enabled # http://box:83
|
|
||||||
command: a2ensite freepbx.conf
|
|
||||||
when: apache_installed and pbx_enabled
|
|
||||||
|
|
||||||
- name: FreePBX - Disable http://box:{{ pbx_http_port }} via Apache, if not pbx_enabled # http://box:83
|
|
||||||
command: a2dissite freepbx.conf
|
|
||||||
when: apache_installed and not pbx_enabled
|
|
||||||
|
|
||||||
- name: FreePBX - Add {{ pbx_http_port }} as a Listen directive to apache ports.conf
|
- name: FreePBX - Add {{ pbx_http_port }} as a Listen directive to apache ports.conf
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: /etc/apache2/ports.conf
|
path: /etc/apache2/ports.conf
|
||||||
line: "Listen {{ pbx_http_port }}"
|
line: "Listen {{ pbx_http_port }}"
|
||||||
insertafter: Listen 80
|
insertafter: Listen 80
|
||||||
|
|
||||||
- name: FreePBX - Restart Apache service ({{ apache_service }})
|
|
||||||
systemd:
|
|
||||||
name: "{{ apache_service }}" # httpd or apache2
|
|
||||||
state: restarted
|
|
||||||
|
|
||||||
- name: FreePBX - Install /etc/systemd/system/freepbx.service systemd unit file from template
|
- name: FreePBX - Install /etc/systemd/system/freepbx.service systemd unit file from template
|
||||||
template:
|
template:
|
||||||
src: freepbx.service.j2
|
src: freepbx.service.j2
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
- php-mbstring
|
- php-mbstring
|
||||||
- php-gd
|
- php-gd
|
||||||
- php-mysql
|
- php-mysql
|
||||||
- php-gettext
|
# - php-gettext
|
||||||
- php-bcmath
|
- php-bcmath
|
||||||
- php-zip
|
- php-zip
|
||||||
- php-xml
|
- php-xml
|
||||||
|
|
|
@ -13,3 +13,16 @@
|
||||||
enabled: no
|
enabled: no
|
||||||
state: stopped
|
state: stopped
|
||||||
when: not pbx_enabled
|
when: not pbx_enabled
|
||||||
|
|
||||||
|
- name: FreePBX - Enable http://box:{{ pbx_http_port }} via Apache, if pbx_enabled # http://box:83
|
||||||
|
command: a2ensite freepbx.conf
|
||||||
|
when: pbx_enabled | bool
|
||||||
|
|
||||||
|
- name: FreePBX - Disable http://box:{{ pbx_http_port }} via Apache, if not pbx_enabled # http://box:83
|
||||||
|
command: a2dissite freepbx.conf
|
||||||
|
when: not pbx_enabled
|
||||||
|
|
||||||
|
- name: FreePBX - Restart Apache service ({{ apache_service }})
|
||||||
|
systemd:
|
||||||
|
name: "{{ apache_service }}" # httpd or apache2
|
||||||
|
state: restarted
|
||||||
|
|
|
@ -15,8 +15,16 @@
|
||||||
- name: FAIL (STOP THE INSTALL) IF 'nodejs_version != "10.x"'
|
- name: FAIL (STOP THE INSTALL) IF 'nodejs_version != "10.x"'
|
||||||
fail:
|
fail:
|
||||||
msg: "PBX install cannot proceed, as it currently requires Node.js 10.x, whereas nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml, /etc/iiab/local_vars.yml, /opt/iiab/iiab/roles/nodejs, etc."
|
msg: "PBX install cannot proceed, as it currently requires Node.js 10.x, whereas nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml, /etc/iiab/local_vars.yml, /opt/iiab/iiab/roles/nodejs, etc."
|
||||||
when: nodejs_version != "10.x"
|
when: nodejs_version != "12.x"
|
||||||
|
|
||||||
|
- name: "Set 'apache_install: True' and 'apache_enabled: True'"
|
||||||
|
set_fact:
|
||||||
|
apache_install: True
|
||||||
|
apache_enabled: True
|
||||||
|
|
||||||
|
- name: APACHE - run 'httpd' role
|
||||||
|
include_role:
|
||||||
|
name: httpd
|
||||||
|
|
||||||
#- name: TODO: Check if asterisk and freepbx are already installed
|
#- name: TODO: Check if asterisk and freepbx are already installed
|
||||||
|
|
||||||
|
@ -40,24 +48,14 @@
|
||||||
|
|
||||||
- name: Install Asterisk (debuntu)
|
- name: Install Asterisk (debuntu)
|
||||||
include_tasks: asterisk.yml
|
include_tasks: asterisk.yml
|
||||||
when: internet_available and pbx_install and (not pbx_installed) and is_debuntu and (not freepbx_installed.stat.exists)
|
when: internet_available and pbx_install and (pbx_installed is undefined) and is_debuntu and (not freepbx_installed.stat.exists)
|
||||||
|
|
||||||
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
|
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
|
||||||
|
|
||||||
- name: Install FreePBX (debuntu)
|
- name: Install FreePBX (debuntu)
|
||||||
include_tasks: freepbx.yml
|
include_tasks: freepbx.yml
|
||||||
when: internet_available and pbx_install and (not pbx_installed) and is_debuntu and (not freepbx_installed.stat.exists)
|
when: internet_available and pbx_install and (pbx_installed is undefined) and is_debuntu and (not freepbx_installed.stat.exists)
|
||||||
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
|
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
|
||||||
|
|
||||||
- name: Enable FreePBX (debuntu)
|
|
||||||
include_tasks: freepbx_enable.yml
|
|
||||||
when: internet_available and pbx_install and (not pbx_installed) and is_debuntu
|
|
||||||
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
|
|
||||||
|
|
||||||
- name: Asterisk - Install chan_dongle
|
|
||||||
include: chan_dongle.yml
|
|
||||||
when: asterisk_chan_dongle | bool
|
|
||||||
|
|
||||||
|
|
||||||
# RECORD PBX AS INSTALLED
|
# RECORD PBX AS INSTALLED
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,13 @@
|
||||||
include_tasks: install.yml
|
include_tasks: install.yml
|
||||||
when: pbx_installed is undefined
|
when: pbx_installed is undefined
|
||||||
|
|
||||||
|
- name: Enable FreePBX (debuntu)
|
||||||
|
include_tasks: freepbx_enable.yml
|
||||||
|
when: pbx_installed is defined
|
||||||
|
|
||||||
|
- name: Asterisk - Install chan_dongle
|
||||||
|
include: chan_dongle.yml
|
||||||
|
when: asterisk_chan_dongle | bool
|
||||||
|
|
||||||
- name: Add 'pbx' variable values to {{ iiab_ini_file }}
|
- name: Add 'pbx' variable values to {{ iiab_ini_file }}
|
||||||
ini_file:
|
ini_file:
|
||||||
|
|
18
roles/pbx/templates/pbx.patch
Normal file
18
roles/pbx/templates/pbx.patch
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
--- /opt/iiab/freepbx/amp_conf/htdocs/admin/libraries/Composer/vendor/neitanod/forceutf8/src/ForceUTF8/Encoding.php.orig 2020-08-24 08:52:41.291376894 +0000
|
||||||
|
+++ /opt/iiab/freepbx/amp_conf/htdocs/admin/libraries/Composer/vendor/neitanod/forceutf8/src/ForceUTF8/Encoding.php 2020-08-24 08:55:36.429818838 +0000
|
||||||
|
@@ -193,11 +193,11 @@
|
||||||
|
|
||||||
|
$buf = "";
|
||||||
|
for($i = 0; $i < $max; $i++){
|
||||||
|
- $c1 = $text{$i};
|
||||||
|
+ $c1 = $text[$i];
|
||||||
|
if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already
|
||||||
|
- $c2 = $i+1 >= $max? "\x00" : $text{$i+1};
|
||||||
|
- $c3 = $i+2 >= $max? "\x00" : $text{$i+2};
|
||||||
|
- $c4 = $i+3 >= $max? "\x00" : $text{$i+3};
|
||||||
|
+ $c2 = $i+1 >= $max? "\x00" : $text[$i+1];
|
||||||
|
+ $c3 = $i+2 >= $max? "\x00" : $text[$i+2];
|
||||||
|
+ $c4 = $i+3 >= $max? "\x00" : $text[$i+3];
|
||||||
|
if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8
|
||||||
|
if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already
|
||||||
|
$buf .= $c1 . $c2;
|
19
roles/pbx/templates/pbx2.patch
Normal file
19
roles/pbx/templates/pbx2.patch
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
--- /var/www/html/freepbx/admin/libraries/view.functions.php.orig 2020-08-24 11:14:51.551433838 +0000
|
||||||
|
+++ /var/www/html/freepbx/admin/libraries/view.functions.php 2020-08-24 11:14:30.207107776 +0000
|
||||||
|
@@ -12,11 +12,11 @@
|
||||||
|
|
||||||
|
// send error if magic_quotes_gpc is enabled on this system as much of the code base assumes not
|
||||||
|
//
|
||||||
|
- if(get_magic_quotes_gpc()) {
|
||||||
|
- $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption"));
|
||||||
|
- } else {
|
||||||
|
- $nt->delete('core', 'MQGPC');
|
||||||
|
- }
|
||||||
|
+ //if(get_magic_quotes_gpc()) {
|
||||||
|
+ // $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption"));
|
||||||
|
+ //} else {
|
||||||
|
+ // $nt->delete('core', 'MQGPC');
|
||||||
|
+ //}
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup locale
|
Loading…
Add table
Add a link
Reference in a new issue