From 8030d246c298290c8ce56c478c2ee2853b89f681 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 13 Aug 2021 16:47:36 -0500 Subject: [PATCH] tweaks for CDR --- roles/pbx/tasks/freepbx.yml | 20 +++++++++++++++----- roles/pbx/templates/cdr_mysql.conf | 6 ++++++ 2 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 roles/pbx/templates/cdr_mysql.conf diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index 5296df332..8a2d45a55 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -135,9 +135,9 @@ name: "{{ asterisk_db_dbname }}" # asterisk encoding: utf8 collation: utf8_general_ci - # login_host: "{{ asterisk_db_host }}" - # login_user: root - # login_password: "{{ mysql_root_password }}" + login_host: "{{ asterisk_db_host }}" + login_user: "{{ asterisk_db_user }}" + login_password: "{{ asterisk_db_password }}" state: present - name: FreePBX - Add cdr MySQL db ({{ asterisk_db_cdrdbname }}) @@ -147,6 +147,9 @@ collation: utf8_general_ci login_host: "{{ asterisk_db_host }}" state: present + login_host: "{{ asterisk_db_host }}" + login_user: "{{ asterisk_db_user }}" + login_password: "{{ asterisk_db_password }}" - name: FreePBX - Create new php sessions dir /var/lib/php/asterisk_sessions/ - SEE 'php_value session.save_path /var/lib/php/asterisk_sessions/' IN pbx/templates/freepbx.conf.j2 file: @@ -193,6 +196,13 @@ - odbc.ini - odbcinst.ini +- name: FreePBX - Create /etc/asterisk/cdr_mysql.conf + template: + src: "{{ item }}" + dest: /etc/asterisk/ + with_items: + - cdr_mysql.conf + - name: FreePBX - 2-step install - won't run if {{ freepbx_install_dir }} already exists - CAN TAKE 3-12 MIN OR LONGER! command: "{{ item }}" args: @@ -200,14 +210,14 @@ creates: "{{ freepbx_install_dir }}" # /var/www/html/freepbx with_items: - ./start_asterisk start - - ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }} + - ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} - name: "Run 'fwconsole stop' and 'killall -9 safe_asterisk' to stop both Asterisk processes -- this avoids \"Unable to run Pre-Asterisk hooks, because Asterisk is already running\" in 'journalctl -u freepbx' logs" command: "{{ item }}" with_items: + - killall -9 "PM2 v4.5.0: God" # 2021-08-09: Missed by fwconsole (does this matter?) - fwconsole stop - killall -9 safe_asterisk # 2021-08-08: Stronger medicine needed for 64-bit Ubuntu Server 21.04 on RPi 4. Originally from @jvonau's PR #2912. - - killall -9 "PM2 v4.5.0: God" # 2021-08-09: Missed by fwconsole (does this matter?) # - killall -9 asterisk # 2021-08-05: Also from @jvonau's PR #2912, to brute force this. In the end, above 'fwconsole stop' works more gracefully. # - ./start_asterisk stop # Buggy! # - /usr/sbin/asterisk -rx "core stop gracefully" diff --git a/roles/pbx/templates/cdr_mysql.conf b/roles/pbx/templates/cdr_mysql.conf new file mode 100644 index 000000000..572f0bcce --- /dev/null +++ b/roles/pbx/templates/cdr_mysql.conf @@ -0,0 +1,6 @@ +[global] +hostname = localhost +dbname = asteriskcdrdb +user = asterisk +password = asterisk +userfield=1