1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Merge pull request #217 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2019-02-11 15:27:28 -05:00 committed by GitHub
commit 0f957d536d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 86 additions and 40 deletions

View file

@ -14,7 +14,7 @@ Connecting to the Server
To connect to the server, you will also need to download Minetest client software for each of your client devices, e.g. from: https://www.minetest.net/downloads/ To connect to the server, you will also need to download Minetest client software for each of your client devices, e.g. from: https://www.minetest.net/downloads/
The port is nominally the standard 30000. This can be changed in `/etc/iiab/local_vars.yml <http://wiki.laptop.org/go/IIAB/FAQ#What_is_local_vars.yml_and_how_do_I_customize_it.3F>`_ using variable: ``minetest_port`` The port is nominally the standard 30000. If necessary, change the ``minetest_port`` as explained below.
The admin user is the usual: ``Admin`` The admin user is the usual: ``Admin``
@ -23,6 +23,8 @@ No password is required.
Configurable Parameters Configurable Parameters
----------------------- -----------------------
If changes are necessary, please edit `/etc/iiab/local_vars.yml <http://wiki.laptop.org/go/IIAB/FAQ#What_is_local_vars.yml_and_how_do_I_customize_it.3F>`_ (adding any variables that you need) prior to installation if possible:
- ``minetest_install:`` set Minetest up to install; default is False - ``minetest_install:`` set Minetest up to install; default is False
- ``minetest_enabled:`` set Minetest up to be enabled; default is False - ``minetest_enabled:`` set Minetest up to be enabled; default is False
- ``minetest_port:`` port on which client should connect; default is 30000 - ``minetest_port:`` port on which client should connect; default is 30000
@ -31,6 +33,10 @@ Configurable Parameters
- ``minetest_default_game:`` only carbone-ng and minetest are supported; default is `carbone-ng <https://github.com/Calinou/carbone-ng>`_ - ``minetest_default_game:`` only carbone-ng and minetest are supported; default is `carbone-ng <https://github.com/Calinou/carbone-ng>`_
- ``minetest_flat_world:`` use a flat mapgen engine to lower computation on client; default is False - ``minetest_flat_world:`` use a flat mapgen engine to lower computation on client; default is False
After installation, you can monitor the 'minetest-server' service with command::
systemctl minetest-server freepbx
File Locations File Locations
-------------- --------------
@ -46,12 +52,14 @@ File Locations on Raspberry Pi
File Locations on Other Platforms File Locations on Other Platforms
--------------------------------- ---------------------------------
- The server binary is ``/usr/lib/minetest/minetestserver`` - The server binary is ``/usr/lib/minetest/minetestserver``
- The working directory is ``/usr/share/games/minetest`` - The working directory is ``/usr/share/games/minetest``
- mods are in ``/usr/share/games/minetest/games/<game>/mods`` - mods are in ``/usr/share/games/minetest/games/<game>/mods``
To Do To Do
----- -----
- Add more mods — currently only the default mods are there in carbone-ng - Add more mods — currently only the default mods are there in carbone-ng
- Add more games - Add more games
- Minetest client software for Windows and Android, included onboard IIAB for offline communities (`#1465 <https://github.com/iiab/iiab/issues/1465>`_) - Minetest client software for Windows and Android, included onboard IIAB for offline communities (`#1465 <https://github.com/iiab/iiab/issues/1465>`_)

View file

@ -48,5 +48,5 @@
mode: 0644 mode: 0644
with_items: with_items:
- { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' } - { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' }
- { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-server.service' } - { src: 'minetest-server.service.j2', dest: '/etc/systemd/system/minetest-server.service' }
when: minetest_install when: minetest_install

View file

@ -66,6 +66,10 @@ sugarizer_port={{ sugarizer_port }}
nodered_port={{ nodered_port }} nodered_port={{ nodered_port }}
mosquitto_port={{ mosquitto_port }} mosquitto_port={{ mosquitto_port }}
minetest_port={{ minetest_port }} minetest_port={{ minetest_port }}
pbx_signaling_ports_chan_sip={{ pbx_signaling_ports_chan_sip }}
pbx_signaling_ports_chan_pjsip={{ pbx_signaling_ports_chan_pjsip }}
pbx_data_ports={{ pbx_data_ports }}
pbx_enabled={{ pbx_enabled }}
block_DNS={{ block_DNS }} block_DNS={{ block_DNS }}
echo "LAN is $lan and WAN is $wan" echo "LAN is $lan and WAN is $wan"
@ -106,6 +110,12 @@ if [ "$services_externally_visible" == "True" ]; then
$IPTABLES -A INPUT -p tcp --dport $transmission_http_port -m state --state NEW -i $wan -j ACCEPT $IPTABLES -A INPUT -p tcp --dport $transmission_http_port -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport $transmission_peer_port -m state --state NEW -i $wan -j ACCEPT $IPTABLES -A INPUT -p tcp --dport $transmission_peer_port -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p udp --dport $minetest_port -m state --state NEW -i $wan -j ACCEPT $IPTABLES -A INPUT -p udp --dport $minetest_port -m state --state NEW -i $wan -j ACCEPT
if [ "$pbx_enabled" == "True" ]; then
$IPTABLES -A INPUT -p udp --dport $pbx_signaling_ports_chan_sip -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p udp --dport $pbx_signaling_ports_chan_pjsip -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p udp --dport $pbx_data_ports -m state --state NEW -i $wan -j ACCEPT
fi
fi fi
if [ "$iiab_gateway_enabled" == "True" ]; then if [ "$iiab_gateway_enabled" == "True" ]; then

View file

@ -4,14 +4,14 @@ PBX README
This 'pbx' playbook adds `Asterisk <https://asterisk.org/>`_ and `FreePBX <https://freepbx.org/>`_ to Internet-in-a-Box (IIAB) for VoIP and SIP functionality e.g. for rural telephony. This 'pbx' playbook adds `Asterisk <https://asterisk.org/>`_ and `FreePBX <https://freepbx.org/>`_ to Internet-in-a-Box (IIAB) for VoIP and SIP functionality e.g. for rural telephony.
This initial release (for IIAB 6.7 in February 2019) supports Ubuntu 18.04 and Debian 9 "Stretch" — in future Raspberry Pi (Raspbian) might also be possible! (`#1467 <https://github.com/iiab/iiab/issues/1467>`_) This initial release (for IIAB 6.7 in February 2019) supports Ubuntu 18.04, Debian 9 "Stretch" — and experimentally supports Raspberry Pi: `#1467 <https://github.com/iiab/iiab/issues/1467>`_
Explanation What Asterisk & FreePBX Do
----------- --------------------------
Asterisk is a software implementation of a private branch exchange (PBX). In conjunction with suitable telephony hardware interfaces and network applications, Asterisk is used to establish and control telephone calls between telecommunication endpoints, such as customary telephone sets, destinations on the public switched telephone network (PSTN), and devices or services on Voice over Internet Protocol (VoIP) networks. Its name comes from the asterisk (*) symbol for a signal used in dual-tone multi-frequency (DTMF) dialing. Asterisk is a software implementation of a private branch exchange (PBX). In conjunction with suitable telephony hardware interfaces and network applications, Asterisk is used to establish and control telephone calls between telecommunication endpoints, such as customary telephone sets, destinations on the public switched telephone network (PSTN), and devices or services on Voice over Internet Protocol (VoIP) networks. Its name comes from the asterisk (*) symbol for a signal used in dual-tone multi-frequency (DTMF) dialing.
FreePBX is a web-based open source GUI (graphical user interface) that controls and manages Asterisk (PBX), an open source communication server. FreePBX is a web-based open source GUI (graphical user interface) that controls and manages Asterisk (PBX), the open source communication server.
Using It Using It
-------- --------
@ -25,9 +25,11 @@ Optionally, you may want to enable `chan_dongle <https://github.com/wdoekes/aste
asterisk_chan_dongle: True asterisk_chan_dongle: True
After installing PBX as part of IIAB, please visit http://pbx.lan/freepbx and proceed with initial configuration (no login/password is required initially — you will be asked to set this up). **CAUTION: as of 2019-02-10 it is sometimes necessary to put "[ACTUAL IP ADDRESS] pbx.lan" into the 'hosts' file on the client machine (where the browser is being used) to get http://pbx.lan/freepbx name resolution to work.** After installing PBX as part of IIAB, please visit http://pbx.lan/freepbx and proceed with initial configuration (no login/password is required initially — you will be asked to set this up).
You can monitor the PBX service with command:: **CAUTION: it is sometimes necessary to put "[ACTUAL IP ADDRESS] pbx.lan" into the 'hosts' file on the client machine (where the browser is being used) to get http://pbx.lan/freepbx to work.** This file is ``/etc/hosts`` on Linux and macOS, or ``c:\Windows\System32\Drivers\etc\hosts`` on most Windows machines (conversely, customizing the hosts file is *not* necessary if your browser is able to access the `'LAN' side <https://github.com/iiab/iiab/wiki/IIAB-Networking#internet-in-a-box-iiab-networking>`_ of your IIAB server).
You can monitor the FreePBX service with command::
systemctl status freepbx systemctl status freepbx

View file

@ -1,6 +1,9 @@
# pbx_install: False # pbx_install: False
# pbx_enabled: False # pbx_enabled: False
# asterisk_chan_dongle: False # asterisk_chan_dongle: False
# pbx_signaling_ports_chan_sip: "5160:5161"
# pbx_signaling_ports_chan_pjsip: "5060"
# pbx_data_ports: "10000:20000"
# 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!

View file

@ -43,7 +43,7 @@
name: aptitude name: aptitude
state: latest state: latest
- name: Asterisk - Ensure all dependencies are resolved - CAN TAKE 2 MIN OR LONGER! - name: Asterisk - Ensure all dependencies are resolved - CAN TAKE 5 MIN OR LONGER!
shell: export DEBIAN_FRONTEND=noninteractive && ./contrib/scripts/install_prereq install shell: export DEBIAN_FRONTEND=noninteractive && ./contrib/scripts/install_prereq install
args: args:
chdir: "{{ asterisk_src_dir }}" chdir: "{{ asterisk_src_dir }}"
@ -68,13 +68,13 @@
args: args:
chdir: "{{ asterisk_src_dir }}" chdir: "{{ asterisk_src_dir }}"
- name: Asterisk - Run 'make' - CAN TAKE 10 MIN OR LONGER! - name: Asterisk - Run 'make' - CAN TAKE 30 MIN OR LONGER!
command: make command: make
args: args:
chdir: "{{ asterisk_src_dir }}" chdir: "{{ asterisk_src_dir }}"
creates: "defaults.h" creates: "defaults.h"
- name: Asterisk - Run 'make install' - CAN TAKE 3 MIN OR LONGER! - name: Asterisk - Run 'make install' - CAN TAKE 2 MIN OR LONGER!
command: make install command: make install
args: args:
chdir: "{{ asterisk_src_dir }}" chdir: "{{ asterisk_src_dir }}"
@ -145,7 +145,3 @@
path: /etc/asterisk/asterisk.conf path: /etc/asterisk/asterisk.conf
regexp: 'rungroup =' regexp: 'rungroup ='
line: 'rungroup = asterisk' line: 'rungroup = asterisk'
- name: Asterisk - Install chan_dongle
include: chan_dongle.yml
when: asterisk_chan_dongle

View file

@ -91,7 +91,7 @@
group: asterisk group: asterisk
recurse: yes recurse: yes
- name: FreePBX - Install (just run once) - CAN TAKE 2 MIN OR LONGER! - name: FreePBX - Install (just run once) - CAN TAKE 12 MIN OR LONGER!
command: "{{ item }}" command: "{{ item }}"
args: args:
chdir: "{{ freepbx_src_dir }}" chdir: "{{ freepbx_src_dir }}"
@ -108,7 +108,7 @@
group: root group: root
mode: 0644 mode: 0644
- name: FreePBX - Copy freepbx.conf - name: FreePBX - Install Apache's sites-available/freepbx.conf from template
template: template:
src: freepbx.conf.j2 src: freepbx.conf.j2
dest: /etc/apache2/sites-available/freepbx.conf dest: /etc/apache2/sites-available/freepbx.conf
@ -116,37 +116,26 @@
group: www-data group: www-data
mode: 0644 mode: 0644
- name: FreePBX - Link freepbx.conf apache file to sites-enabled - name: FreePBX - Create symlink freepbx.conf from sites-enabled to sites-available (if pbx_enabled)
file: file:
src: /etc/apache2/sites-available/freepbx.conf src: /etc/apache2/sites-available/freepbx.conf
dest: /etc/apache2/sites-enabled/freepbx.conf dest: /etc/apache2/sites-enabled/freepbx.conf
state: link state: link
when: pbx_enabled when: pbx_enabled
- name: FreePBX - Unlink freepbx.conf apachefile from sites-enabled - name: FreePBX - Remove symlink /etc/apache2/sites-enabled/freepbx.conf (if not pbx_enabled)
file: file:
path: /etc/apache2/sites-enabled/freepbx.conf path: /etc/apache2/sites-enabled/freepbx.conf
state: absent state: absent
when: (not pbx_enabled) when: not pbx_enabled
- name: FreePBX - Copy systemd unit file - 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
template: template:
src: freepbx.service.j2 src: freepbx.service.j2
dest: /etc/systemd/system/freepbx.service dest: /etc/systemd/system/freepbx.service
mode: 755 mode: 755
- name: FreePBX - Enable and Start freepbx service
systemd:
daemon_reload: yes
name: freepbx
enabled: yes
state: started
when: pbx_enabled
- name: FreePBX - Disable & Stop freepbx service
systemd:
daemon_reload: yes
name: freepbx
enabled: no
state: stopped
when: (not pbx_enabled)

View file

@ -0,0 +1,15 @@
- name: FreePBX - Enable & (Re)start 'freepbx' systemd service (if pbx_enabled)
systemd:
daemon_reload: yes
name: freepbx
enabled: yes
state: restarted
when: pbx_enabled
- name: FreePBX - Disable & Stop 'freepbx' systemd service (if not pbx_enabled)
systemd:
daemon_reload: yes
name: freepbx
enabled: no
state: stopped
when: not pbx_enabled

View file

@ -16,12 +16,32 @@
Asterisk and FreePBX work on other OS's / distros, Thank Asterisk and FreePBX work on other OS's / distros, Thank
You! http://FAQ.IIAB.IO ############################################################################### You! http://FAQ.IIAB.IO ###############################################################################
- name: Check if freepbx is already installed
stat:
path: /etc/systemd/system/freepbx.service
register: freepbx_installed
- debug:
msg: >-
FreePBX already installed. Reinstall shall be skipped
when: freepbx_installed.stat.exists
- 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 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 (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 (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_debuntu
#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: Asterisk - Install chan_dongle
include: chan_dongle.yml
when: asterisk_chan_dongle

View file

@ -301,6 +301,9 @@ nextcloud_enabled: False
pbx_install: False pbx_install: False
pbx_enabled: False pbx_enabled: False
asterisk_chan_dongle: False asterisk_chan_dongle: False
pbx_signaling_ports_chan_sip: "5160:5161"
pbx_signaling_ports_chan_pjsip: "5060"
pbx_data_ports: "10000:20000"
# If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER
wordpress_install: False wordpress_install: False

View file

@ -197,8 +197,8 @@ nextcloud_enabled: True
# A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX. # A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX.
# So far, supported on Ubuntu 18.x and Debian 9 ONLY. Uses Node.js 10.x # So far, supported on Ubuntu 18.x and Debian 9 ONLY. Uses Node.js 10.x
pbx_install: False pbx_install: True
pbx_enabled: False pbx_enabled: True
asterisk_chan_dongle: False asterisk_chan_dongle: False
# If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER