An Overview About SMS Gateway

While i've been seriously creating a module to support RAW printing procedure from Delphi running on LINUX box, let me explain a short overview about an SMS gateway engine i used to made. This parts has been often patched to build my existing SMS service application projects before.

What you need is knowledges about:
1. Linux (including syslog handling)
2. GSM modem
3. SMS daemon
4. PHP script
5. BASH shell script
6. C++ and SQL logging (for some cases)

Linux is the best environment ever to have a SMS gateway, in my opinion. It's stability, flexibility and powerfully console can't defeated by others operating systems. I used to installed Mandrake 8.2 to my prior projects for some reasons, such as user-friendly and low hardware requirements aspect.



Modem GSM is a part of hardware primarily targeted to code to. There were lots of products available but you have to watched carefully to their backwards compatibility. I always used a GSM modem TC35 series made by Siemens. It has no problems at all as long as I had used to. If you doesn't have any GSM modem, just replace it's functionality with Siemens cellular phone. I oftenly tested with x45 series with RS233 connectivity (such a SL45i or C45).

Next topic focused to SMS daemon it self. SMS daemon provide transactions API layer about sending, receiving and retrieving information from or to both sender and receiver. There were thousands SMS engines available on the internet. You have to selectively picking up the right choice. A good one engines has their support to provide an easy way connecting to the databases, inspite of the installation, stability, scripting and system supports. The more compatibilities to any GSM modem hardwares, the more grade it reached.

The SMS daemon I used to, supporting natively with PHP and BASH scripts. It makes more dynamics from it composition. This example below contains general operations regarding to SMS gateway development:

#!/bin/sh
#run this script only when a message was received.
if [[ "$1" != "RECEIVED" ]]; then exit; fi;

#Define the database parameters
SQL_HOST=localhost
SQL_USER=root
SQL_PASSWORD=
SQL_DATABASE=smsd
SQL_TABLE=demo

#Extract data from the SMS file
FROM=`formail -zx From: < $2` TEXT=`formail -I "" <$2 | sed -e"1d"`

#Set some SQL parameters
if [[ "$SQL_PASSWORD" != "" ]]; then SQL_ARGS="-p $SQL_PASSWORD"; else SQL_ARGS=""; fi SQL_ARGS="-h $SQL_HOST -u $SQL_USER $SQL_ARGS -D $SQL_DATABASE -s -e"

#Do the SQL Query
AMOUNT=`mysql $SQL_ARGS "select amount from $SQL_TABLE where msisdn=\"$FROM\" and password=\"$TEXT\" ;"`

#Create an answer SM with the amount
FILENAME=`mktemp /var/spool/sms/outgoing/answerXXXXXX` echo "To: $FROM" >$FILENAME
echo "" >> $FILENAME
echo "Your amount is $AMOUNT" >>$FILENAME
You see that there were SQL logging routines and internal command system executed by BASH scripts. For more expertise of use, you can combined to execute another binary right away you need to. This sample below is a routine to controlling electronics equipment on and off by SMS command (written in C++ and compiled with GCC, application is available and ready to modify as my prior project called “MIKROCERDAS” developed on 2004)

#include
#include
#include
#include

#define BASEPORT 0x378

int main() {

if (ioperm(BASEPORT,1,1)) {
perror("ioperm");
exit(1);
}

outb(0x80,BASEPORT);
usleep(100000);

if (ioperm(BASEPORT,1,0)) {
perror("ioperm");
exit(0);
}
}
Do you remember the announcement of my pre-project named SIAGA (Sistem Informasi Awas GempA)? Above is the secret how to develop the system. Any suggestion and question due to this article are widely acceptable.

Sincerelly,

Eko Wahyudiharto
PS: If you've benefit from this blog,
you can support it by making a small contribution.

Enter your email address:

Delivered by FeedBurner

Post a Comment Bookmark and Share

 

  1. Blogger Hitendra Solanki said,

    Wednesday, December 11, 2013 3:23:00 PM

    The blog posted is very interesting from all aspects and it will surely benefit the readers by all means.
    sms gateway

Post a Comment

Leave comments here...