Nowadays sending SMS has become a common requirement for notifications, alerts and for authentications etc. There are many service provider companies which provide SMS APIs and gateways to send bulk...
This page will guide to how to send and receive gnokii-SMS using Linux PC. There are many other ways through which we can send and receive bulk SMS but it is better to use gnokii-smsd-pgsql because it will help you to send SMS in a short period of time. GNOKii-SMS is a mature solution to send SMS, It is a stand-alone application with a daemon. This application uses MySQL database as a data store to store data that will require while sending SMS.
The best thing about this application is you don’t need any API in order to integrate it with the application. You only need to design an application that will query the gnokii-SMS backend. There is no need to modify the structure of the gnokii-SMS database, your application will easily support gnokii SMS facility. No application logic will be added to gnokii-SMS.
You will need following things to Send and Receive Bulk SMS via USB Modem and gnokii–smsd–pgsql:
* A Linux PC. It should work properly on the Debian derivatives like Ubuntu, Xubuntu, Mint etc.
* A USB modem. You can use both postpaid and prepaid plan for work.
* sudo apt-get update
* sudo apt-get install MySQL-server
* sudo apt-get install gnokii-smsd-mysql
Then connect the USB modem to your computer system and find out which port it is using sudo lsusb.
Another command that could be is sudo dmesg | grep USB. Normally the modem is at /dev/tty0, is used but make sure it must be run on either lsusb or the dmesg command as stated above. Always remember the name of a device because you will require it when you edit the configuration file for gnokii.
On Crunchbang, it is not necessary to create gnokii config during the installation, just create the config file manually. Add port number and model number in the config file to their appropriate values like port=/dev/tty0, model=AT. There might be any default value for the model property, it may be 6510. But we are using a USB modem, so set AT as the model value. When you completed the configuration then do a quick test so that you may know whether all things are working properly or not. Gnokii has a command sudo gnokii –identify that can identify if we are doing things correctly. If we did something wrong with configuration file then it gives diagnostics and a quick peek so that we can correct our mistakes on time. The gnokii-smsd-pgsql package contains the SQL scripts which is necessary to create the table structure. But its database should be prepared manually.
mysql -u root -p
mysql> create database smsgw;
mysql> use smsgw;
mysql> \. /usr/share/doc/gnokii-smsd-mysql/sms.tables.mysql.sql;
Now for Sending/Receiving Bulk SMS via USB Modem and gnokii-smsd-pgsql follow following steps:
*, First of all, run the daemon smsg process from another terminal window
for example sudo smsd -u root -p smsgw -c localhost -m mysql
* For sending an SMS message, use the command echo “Test message | gnokii –sendsmsd +MobileNumber
Always use the international code of mobile phone.
* When you send a message to the number which is of different USB modem, then all the incoming messages will store in the inbox table of the database
mysql -u root -p
mysql> use smsgw;
mysql> select * from inbox;