Currently text messaging via SMS is an important part of the mobile experience along with email via the Internet. At the business level, mobile messaging in many cases continues to be the most effective and universal communication channel currently in use. And compared to other communication channels such as mail, mobile SMS messaging contains much less spam and is more likely to be read by all recipients immediately upon delivery.
Due to this it is important to always have on hand in our server infrastructure under Linux an SMS Messaging Server with Gammu, ready for activation if required. AND These are the steps that will serve many as a guide or model to achieve the installation and configuration of the same within its Farm of Servants.
Introduction
gammu is quoting one's own Official website in Spanish
»The name of the project, as well as the name of the command line utility that you can use to control your phone. It is written in C and built on libGammu«.
In common words it can be said that Gammu is a Management System for Mobile Devices with Telephone Lines, that is, it is a project that provides the abstraction layer to access mobile phones and their functions. It covers a wide range of phone brands, focusing on compatible AT phones and Nokia phones.
Gammu is a command line (terminal) library and utility, although it comes with a graphic layer called Wammu to facilitate its use by end users. It has a GNU GPL version 2 license.
This project was started by Marcin Wiacek and together with others, and is currently led by Michal Čihař with the help of many other collaborators.
Gammu provides access to a wide variety of features. However, the level of support varies from phone to phone. You can view the Gammu Phone Database to learn about user experiences with various phones. The following features are generally supported:
- Call listing, initiation and handling
- Recovery, backup and sending of SMS
- MMS recovery
- List, import and export of contacts (vCard)
- Listing, import and export of calendar and tasks (vCalendar or iCalendar).
- Recovery of phone and network information
- Access to phone file system.
Step 1 - Gammu Installation
For its installation, the packages will depend on the Distro and its version, but in the cases of DEBIAN 8 and DEBIAN 9, they will be described below:
apt install gammu gammu-doc gammu-smsd libgammu7 libgsmsd7 # DEBIAN 8 apt install gammu gammu-doc gammu-smsd libgammu8 libgsmsd8 # DEBIAN 9 apt install mobile-broadband-provider-info ppp pppconfig modemmanager usb-modeswitch usb-modeswitch-data wvdial # Useful and common packages for Managing Internet Devices / SMS on USB Ports.
Step 2 - Verification of «DIALOUT» Ports
Your USB "Dialout" ports when listed may come with the nomenclature "ttyUSB0, ttyUSB1, ttyUSB2, ttyUSB3" or ttyS0, ttyS1, ttyS2, ttyS3.
Run tty port list - dialout:
ls -l / dev / tty * # List TTY ports
Step 3 - Connect the SMS Modem Device and validate its detection
Run lspci command:
lsusb # Command to list connected USB devices
Let's imagine that the Device connected and detected appears on the screen as follows in the terminal:
Bus 001 Device 013: ID 19d2: 0031 ZTE WCDMA Technologies MSM MF110 / MF627 / MF636 # Phone provider internet pendriver
Run list of serial devices:
ls / dev / serial / by-id -ls # Command to list connected and detected serial devices
Step 4 - Gammu Configuration
.Gammurc file
To configure Gammu you can manually create a file called ".Gammurc" in the "Root home" with the following content and using the command command:
nano /root/.gammurc ########## EXAMPLE CONTENT ########## [gammo] port = / dev / ttyUSB1 -> ttyUSB ports enabled (ttyUSB0 - ttyUSB1 - ttyUSB2) pattern = connection = at19200 -> Type of connection to be configured. synchronizetime = yes logfile = logformat = nothing use_locking = gammuloc = ######################################
Or you can execute the following command that will guide us in its creation:
gamma-config # Command to create configuration file
.Gammu-smsdrc file
To configure Gammu manually edit the file named ".Gammu-smsdrc" in the folder "etc" of the Operating System with the following content and using the command command:
nano / etc / gammu-smsdrc ########## EXAMPLE CONTENT ########## # Configuration file for Gammu SMS Daemon # Gammu library configuration, see gammurc (5) [gammo] # Please configure this! port = / dev / ttyUSB1 connection = at # Debug #logformat = text all # SMSD configuration, see gammu-smsdrc (5) [smsd] service=files logfile = syslog # Increase for debugging information debuglevel = 0 # Paths where messages are stored inboxpath = / var / spool / gammu / inbox / outboxpath = / var / spool / gammu / outbox / sentsmspath = / var / spool / gammu / sent / errorsmspath = / var / spool / gammu / error / ######################################
Step 5 - Identify SMS / Mobile Internet Device
This procedure can be done in 2 ways:
1 form
Using the gammu-smsdrc file As follows:
gammu -c / etc / gammu-smsdrc --identify ########## EXAMPLE CONTENT ########## Device: / dev / ttyUSB1 Manufacturer: ZTE CORPORATION Model: unknown (MF190) Firmware: BD_MF190V1.0.0B06 IMEI: 355435048527666 IMSI SIM: 734061006753643 ##########################################
2 form
Using the gammu identify command As follows:
gammu identify ########## EXAMPLE CONTENT ########## Device: / dev / ttyUSB1 Manufacturer: ZTE CORPORATION Model: unknown (MF190) Firmware: BD_MF190V1.0.0B06 IMEI: 355435048527666 IMSI SIM: 734061006753643 ######################################
Step 6 - Test the Gammu program
You can test the installation and configuration of Gammu in 2 ways:
1 form
Executing the following command:
gammu getallsms ########## EXAMPLE CONTENT ########## 0 SMS parts in 0 SMS sequences ######################################
2 form
Executing the following command:
gammu send sms text 04161234567 Enter the text of the message and press Ctrl + D: THIS IS A PROOF OF SHIPPING. If you want to cancel, press Ctrl + C ... Sending SMS 1/1 ... waiting for network response .. OK, message reference = 7
Now it only remains to verify that the SMS message has reached its destination! And if so far everything has gone well, you already have the Program installed and perfectly configured to send SMS messages from the Console of your Terminal.
For mass shipments only We need to create the Database and do new shipping tests. We will see all this part in part 2 of this article and in part 3 its integration with the Kalkun web application.
If you only need a simpler application even for a normal user you could try this: blue phone
If you want to review a little more about gammu they can go to official manual or read the news about the application on your news section or watch the following video:
Hello, this SMS server is used to send SMS desde linux to any type of phone with any operator??
If you notice, it refers to sending at commands to devices. In other words, messages could be sent to any operator, but a modem or telephone is used for this.
Hello, Excellent tutorial I have followed everything, but there is something that I have not been able to solve, I do not know if you can help me, and it is to connect the Modem remotely, that is, having 2 servers, in one the Gamm server, in the other server the USB MODEM, then how should I configure the parameter "port = / dev / ttyUSB1"?
Thank you very much in advance.
all the best
Greetings, Otoniel. I really have no idea how that should be done. He even believed that this is not possible ... I hope someone with more experience with Gammu can answer your question.