This REST API allow you to send and receive SMS using gammu-smsd.
A 2.0 swagger documentation is provided at the root URL.
All routes can be protected by an authentication methode (Basic, Bearer).
- Requirements
- Installation (docker-compose)
- Run containers
- Environment Variables
- My setup
- Screenshots
This project require a SQL
database (mySQL, MariaDB, ...).
A device supported by Gammu library
A sim card to send and received SMS.
Create a folder into the host for persistant data (SQL data)
$ mkdir -p /opt/mariadb
Create docker-complose.yml
file then modify or add environment variables if necessary
version: '3'
services:
db:
image: mariadb:11.4-ubi
container_name: sms-gateway_db
restart: always
command: --wait_timeout=28800 --interactive_timeout=28800
volumes:
- /opt/mariadb:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=UP5yeFxRcvtMBzjdfNmT6p
- MYSQL_USER=sms-gateway
- MYSQL_PASSWORD=Bpj7hXNCextgnzSWckFybV
- MYSQL_DATABASE=smsd
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 15s
interval: 15s
timeout: 5s
retries: 5
backend:
image: fizcko/sms-gateway:latest
container_name: sms-gateway_server
restart: always
ports:
- 5000:5000
devices:
- "/dev/ttyUSB2:/dev/phone"
depends_on:
db:
condition: service_healthy
environment:
- MYSQL_HOST=db
- MYSQL_USER=sms-gateway
- MYSQL_PASSWORD=Bpj7hXNCextgnzSWckFybV
- MYSQL_DATABASE=smsd
- GAMMU_DEVICE=/dev/phone
$ docker-compose up -d
default value : "0.0.0.0"
description : Bind to a specific interface
default value : "5000"
description : Define server port for backend API
default value : "/etc/gammu-smsdrc"
description : Set path of the configuration file for gammu-smsd. This file is dynamically generated at container startup
default value : "/dev/ttyUSB0"
description : Path of the modem device mounted into the container
more : https://wammu.eu/docs/manual/config/index.html#option-Device
default value : "at"
description : Protocol which will be used to talk to your device
more : https://wammu.eu/docs/manual/config/index.html#option-Connection
default value : "1234"
description : PIN for SIM card. If no pin on the SIM card leave default value
more : https://wammu.eu/docs/manual/smsd/config.html#option-PIN
default value : "0"
description : Log level for gammu-smsd
more : https://wammu.eu/docs/manual/smsd/config.html#option-DebugLevel
default value : "localhost"
description : Database server address
default value : "root"
description : User name used for connection to a database
default value : "toor"
description : Password used for connection to a database
default value : "smsd"
description : Name of database dedicated for gammu-smsd
default value : "Change-this-secret-phrase"
description : The secret key needed for symmetric based signing algorithms
default value : "HS256"
description : Which algorithm to sign the JWT with
more : https://pyjwt.readthedocs.io/en/latest/algorithms.html
default value : "900"
description : How long (in ms) an access token should live before it expires. Can be set to 0 to disable expiration.
default value : "None"
allowed values : "None" | "Bearer" | "Basic"
description : Select the authentication methode for the routes of the Rest API
default value : "admin"
description : User name used for connection to the rest API
default value : "admin"
description : Password used for connection to the rest API