Merge pull request #730 from benkuly/master

updates matrix-sms-bridge (changed SMS provider)
development
Slavi Pantaleev 4 years ago committed by GitHub
commit 47db2d5363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,11 @@
# 2020-11-23
## Breaking change matrix-sms-bridge
Because of many problems using gammu as SMS provider, matrix-sms-bridge now uses (https://github.com/RebekkaMa/android-sms-gateway-server) by default. See (the docs)[./docs/configuring-playbook-bridge-matrix-bridge-sms.md] which new vars you need to add.
If you are using this playbook to deploy matrix-sms-bridge and still really want to use gammu as SMS provider, we could possibly add support for both android-sms-gateway-server and gammu.
# 2020-11-13
## Breaking change matrix-sms-bridge

@ -1,11 +1,10 @@
# Setting up matrix-sms-bridge (optional)
The playbook can install and configure
[matrix-sms-bridge](https://github.com/benkuly/matrix-sms-bridge) for you.
The playbook can install and configure [matrix-sms-bridge](https://github.com/benkuly/matrix-sms-bridge) for you.
See the project page to learn what it does and why it might be useful to you.
First you need to ensure, that the bridge has unix read and write rights to your modem. On debian based distributions there is nothing to do. On others distributions you either add a group `dialout` to your host and assign it to your modem or you give the matrix user or group access to your modem.
** The bridge uses [android-sms-gateway-server](https://github.com/RebekkaMa/android-sms-gateway-server). You need to configure it first. **
To enable the bridge just use the following
playbook configuration:
@ -13,16 +12,23 @@ playbook configuration:
```yaml
matrix_sms_bridge_enabled: true
matrix_sms_bridge_gammu_modem: "/dev/serial/by-id/myDeviceId"
# generate a secret passwort e.g. with pwgen -s 64 1
matrix_sms_bridge_database_password: ""
# (optional) a room id to a default room
# (optional but recommended) a room id to a default room
matrix_sms_bridge_default_room: ""
# (optional) gammu reset frequencies (see https://wammu.eu/docs/manual/smsd/config.html#option-ResetFrequency)
matrix_sms_bridge_gammu_reset_frequency: 3600
matrix_sms_bridge_gammu_hard_reset_frequency: 0
# (optional) group with unix read and write rights to modem
matrix_sms_bridge_modem_group: 'dialout'
# (optional but recommended) configure your server location
matrix_sms_bridge_default_region: DE
matrix_sms_bridge_default_timezone: Europe/Berlin
# Settings to connect to android-sms-gateway-server
matrix_sms_bridge_provider_android_baseurl: https://192.168.24.24:9090
matrix_sms_bridge_provider_android_username: admin
matrix_sms_bridge_provider_android_password: supeSecretPassword
# (optional) if your android-sms-gateway-server uses a self signed vertificate, the bridge needs a "truststore". This can be the certificate itself.
matrix_sms_bridge_provider_android_truststore_local_path: android-sms-gateway-server.p12
matrix_sms_bridge_provider_android_truststore_password: 123
```

@ -3,18 +3,11 @@
matrix_sms_bridge_enabled: true
matrix_sms_bridge_docker_image: "docker.io/folivonet/matrix-sms-bridge:0.4.2.RELEASE"
matrix_sms_bridge_docker_image: "docker.io/folivonet/matrix-sms-bridge:0.5.2"
matrix_sms_bridge_base_path: "{{ matrix_base_data_path }}/matrix-sms-bridge"
matrix_sms_bridge_config_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/config"
matrix_sms_bridge_data_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data"
matrix_sms_bridge_data_log_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/log"
matrix_sms_bridge_data_spool_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool"
matrix_sms_bridge_data_spool_inbox_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/inbox"
matrix_sms_bridge_data_spool_inbox_processed_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/inbox_processed"
matrix_sms_bridge_data_spool_outbox_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/outbox"
matrix_sms_bridge_data_spool_sent_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/sent"
matrix_sms_bridge_data_spool_error_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/error"
matrix_sms_bridge_appservice_token: ''
matrix_sms_bridge_homeserver_token: ''
@ -40,11 +33,11 @@ matrix_sms_bridge_default_region: ''
matrix_sms_bridge_default_timezone: ''
matrix_sms_bridge_single_mode_enabled: false
matrix_sms_bridge_gammu_modem: ''
matrix_sms_bridge_modem_group: 'dialout'
matrix_sms_bridge_gammu_reset_frequency: 0
matrix_sms_bridge_gammu_hard_reset_frequency: 0
matrix_sms_bridge_gammu_smsc: ''
matrix_sms_bridge_provider_android_baseurl: ''
matrix_sms_bridge_provider_android_username: ''
matrix_sms_bridge_provider_android_password: ''
matrix_sms_bridge_provider_android_truststore_local_path: ''
matrix_sms_bridge_provider_android_truststore_password: ''
matrix_sms_bridge_configuration_yaml: |
@ -61,13 +54,22 @@ matrix_sms_bridge_configuration_yaml: |
defaultTimeZone: "{{ matrix_sms_bridge_default_timezone }}"
singleModeEnabled: "{{ matrix_sms_bridge_single_mode_enabled }}"
provider:
gammu:
android:
# (optional) default is disabled
enabled: true
# (optional) Path to the Gammu-Inbox directory.
inboxPath: /data/spool/inbox
# (optional) Path to the directory, where to put processed messages.
inboxProcessedPath: /data/spool/inbox_processed
# The url to the android-sms-gateway-server
baseUrl: {{ matrix_sms_bridge_provider_android_baseurl }}
# The username of the gateway
username: {{ matrix_sms_bridge_provider_android_username }}
# The password of the gateway
password: {{ matrix_sms_bridge_provider_android_password }}
# (optional) if you use a self signed certificate, you can add the public key here
{% if matrix_sms_bridge_provider_android_truststore_local_path %}
trustStore:
path: /config/matrix-sms-gateway-server.p12
password: {{ matrix_sms_bridge_provider_android_truststore_password }}
type: PKCS12
{% endif %}
bot:
# The domain-part of matrix-ids. E. g. example.org when your userIds look like @unicorn:example.org
serverName: {{ matrix_sms_bridge_homserver_domain }}
@ -104,34 +106,6 @@ matrix_sms_bridge_configuration_extension: "{{ matrix_sms_bridge_configuration_e
matrix_sms_bridge_configuration: "{{ matrix_sms_bridge_configuration_yaml|from_yaml|combine(matrix_sms_bridge_configuration_extension, recursive=True) }}"
matrix_sms_bridge_gammu_configuration: |
[gammu]
Device = {{ matrix_sms_bridge_gammu_modem }}
LogFile = /data/log/gammu.log
debugLevel = 1
[smsd]
Service = files
LoopSleep = 2
InboxPath = /data/spool/inbox/
OutboxPath = /data/spool/outbox/
SentSMSPath = /data/spool/sent/
ErrorSMSPath = /data/spool/error/
InboxFormat = detail
OutboxFormat = detail
TransmitFormat = auto
{% if matrix_sms_bridge_gammu_smsc is defined and matrix_sms_bridge_gammu_smsc|length %}
SMSC = {{ matrix_sms_bridge_gammu_smsc }}
{% endif %}
ResetFrequency = {{ matrix_sms_bridge_gammu_reset_frequency }}
HardResetFrequency = {{ matrix_sms_bridge_gammu_hard_reset_frequency }}
debugLevel = 1
LogFile = /data/log/smsd.log
DeliveryReport = no
HangupCalls = 1
CheckBattery = 0
matrix_sms_bridge_registration_yaml: |
id: sms
as_token: "{{ matrix_sms_bridge_appservice_token }}"

@ -16,13 +16,6 @@
- "{{ matrix_sms_bridge_base_path }}"
- "{{ matrix_sms_bridge_config_path }}"
- "{{ matrix_sms_bridge_data_path }}"
- "{{ matrix_sms_bridge_data_log_path }}"
- "{{ matrix_sms_bridge_data_spool_path }}"
- "{{ matrix_sms_bridge_data_spool_inbox_path }}"
- "{{ matrix_sms_bridge_data_spool_inbox_processed_path }}"
- "{{ matrix_sms_bridge_data_spool_outbox_path }}"
- "{{ matrix_sms_bridge_data_spool_sent_path }}"
- "{{ matrix_sms_bridge_data_spool_error_path }}"
- name: Ensure matrix-sms-bridge application.yml installed
copy:
@ -40,13 +33,14 @@
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-sms-bridge gammu-smsdrc installed
- name: Ensure android-sms-gateway-server cert installed
copy:
content: "{{ matrix_sms_bridge_gammu_configuration }}"
dest: "{{ matrix_sms_bridge_config_path }}/gammu-smsdrc"
src: "{{ matrix_sms_bridge_provider_android_truststore_local_path }}"
dest: "{{ matrix_sms_bridge_config_path }}/matrix-sms-gateway-server.p12"
mode: 0644
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
when: matrix_sms_bridge_provider_android_truststore_local_path != ""
- name: Ensure matrix-sms-bridge.service installed
template:

@ -8,6 +8,8 @@
with_items:
- "matrix_sms_bridge_appservice_token"
- "matrix_sms_bridge_homeserver_token"
- "matrix_sms_bridge_gammu_modem"
- "matrix_sms_bridge_default_region"
- "matrix_sms_bridge_default_timezone"
- "matrix_sms_bridge_provider_android_baseurl"
- "matrix_sms_bridge_provider_android_username"
- "matrix_sms_bridge_provider_android_password"

@ -1,36 +0,0 @@
#jinja2: lstrip_blocks: "True"
[Unit]
Description=Matrix sms bridge database
{% for service in matrix_sms_bridge_database_systemd_required_services_list %}
Requires={{ service }}
After={{ service }}
{% endfor %}
{% for service in matrix_sms_bridge_database_systemd_wanted_services_list %}
Wants={{ service }}
{% endfor %}
[Service]
Type=simple
ExecStartPre=-/usr/bin/docker kill matrix-sms-bridge-database
ExecStartPre=-/usr/bin/docker rm matrix-sms-bridge-database
# Intentional delay, so that the homeserver (we likely depend on) can manage to start.
ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/docker run --rm --name matrix-sms-bridge-database \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--network={{ matrix_docker_network }} \
-v {{ matrix_sms_bridge_database_path }}:/data:z \
-e NEO4J_AUTH={{ matrix_sms_bridge_database_username }}/{{ matrix_sms_bridge_database_password }} \
{{ matrix_sms_bridge_database_docker_image }}
ExecStop=-/usr/bin/docker kill matrix-sms-bridge-database
ExecStop=-/usr/bin/docker rm matrix-sms-bridge-database
Restart=always
RestartSec=30
SyslogIdentifier=matrix-sms-bridge
[Install]
WantedBy=multi-user.target

@ -20,7 +20,6 @@ ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/docker run --rm --name matrix-sms-bridge \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--group-add {{ matrix_sms_bridge_modem_group }} \
--cap-drop=ALL \
--network={{ matrix_docker_network }} \
{% if matrix_sms_bridge_container_http_host_bind_port %}
@ -28,9 +27,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-sms-bridge \
{% endif %}
-v {{ matrix_sms_bridge_config_path }}:/config:z \
-v {{ matrix_sms_bridge_data_path }}:/data:z \
-v {{ matrix_sms_bridge_config_path }}/gammu-smsdrc:/etc/gammu-smsdrc:z \
--privileged \
-v /dev:/dev:slave \
--env SPRING_CONFIG_ADDITIONAL_LOCATION=/config/application.yml \
{% for arg in matrix_sms_bridge_container_extra_arguments %}
{{ arg }} \
{% endfor %}

Loading…
Cancel
Save