Dotnet Sms Gateway is a lightweight application for sending and receiving SMS messages using AT Commands, with Redis Pub/Sub integration for message queuing. It is designed for simplicity and extensibility, enabling SMS handling via serial communication with a GSM modem.
- AT Command SMS Sending: Send SMS messages using AT commands.
- Redis Pub/Sub Integration: Manage message queues for sending and receiving SMS.
- UCS-2 Encoding: Reading and sending UCS-2 (Unicode) encoded messages.
- Message Queue Persistence: Persistent message queuing support.
-
Clone the repository:
git clone https://github.com/ecebeci/DotnetSmsGateway.git
-
Navigate to the project directory:
cd DotnetSmsGateway
-
Install dependencies:
dotnet restore
-
Configure the
.env
file:Copy
.env.example
to.env
and update the following environment variables:MODEM_PORTNAME
: The port name for the GSM modem (e.g.,COM3
).REDIS_CONNECTION_STRING
: Redis connection string (e.g.,localhost:6379
).REDIS_CHANNEL_RECEIVED
: Redis channel name for received messages.REDIS_CHANNEL_SEND
: Redis channel name for sending messages.
-
Start the program:
dotnet run
-
Interact with the application:
- Type commands directly to the serial interface.
- Publish messages to the Redis send channel to send SMS.
-
Stop the program:
- Type
QUIT
and press Enter.
- Type
Here are some commonly used AT commands for interacting with the GSM modem:
-
Set SMS storage to SIM card:
- Command:
AT+CPMS="ME"
- Ensures that SMS messages are stored on the SIM card.
- Command:
-
Set text mode for SMS:
- Command:
AT+CMGF=1
- Switches the modem to text mode for SMS operations.
- Command:
-
Read all messages:
- Command:
AT+CMGL="ALL"
- Retrieves all messages stored on the SIM card.
- Command:
-
Send an SMS:
- Command:
AT+CMGS="<phone_number>"
- After entering the command, type the message content, then press
Ctrl+Z
and enter to send.
- Command:
Contributions are welcome! If you'd like to help improve Sms Gateway, please fork the repository and submit a pull request.
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.