This project is a Python-based SMS gateway that listens to an MQTT topic for incoming messages and sends them via a GSM modem using the Gammu library.
- Listens to an MQTT broker for incoming SMS messages.
- Sends SMS messages using Gammu.
- Configurable via environment variables.
- Logs message sending status and errors.
- A GSM modem compatible with Gammu.
- An MQTT broker (e.g., Mosquitto).
- Python 3 installed with required dependencies.
- Clone the repository:
git clone git@github.com:khaledbenmachiche/taqwim-messaging-gateway.git cd taqwim-messaging-gateway - Install dependencies:
pip install -r requirements.txt
- Configure Gammu by setting up a
~/.gammurcfile with the correct modem settings. - Create a
.envfile to configure MQTT settings:MQTT_BROKER=mqtt-broker MQTT_TOPIC=sms/outgoing
Run the script:
python sms_gateway.pyMQTT_BROKER: Address of the MQTT broker.MQTT_TOPIC: Topic to listen for incoming SMS messages.
The script expects messages in JSON format with the following structure:
{
"phone_number": "+1234567890",
"message": "Hello, this is a test SMS!"
}Logs are printed to the console and include timestamps, message statuses, and errors.
- Ensure the modem is properly configured with Gammu (
gammu --identify). - Check MQTT broker connectivity.
- Verify the
.envfile has correct values.
This project is licensed under the MIT License.