sms gateway and routing to banks - idrbt kaushik_sms gateway...this is to certify that the summer...
TRANSCRIPT
1 | P a g e
Summer Internship
Project Report
On SMS Gateway and Routing to Banks
Carried Out At
IDRBT Hyderabad
15th May 2014 to 11th July 2014
Submitted By: Guided By: Kuldeep Kaushik Dr. V. N. Sastry
Roll No: 1101CS22 Professor
B. Tech. CSE, (3rd year) IDRBT Hyderabad
Indian Institute of Technology Patna
2 | P a g e
Acknowledgement
It gives me immense pleasure in presenting my summer internship report. I
would like to take this opportunity to express my deepest gratitude to the
people, who have contributed their valuable time for helping me to successfully
complete this internship.
With great pleasure and acknowledgement i extend my deep gratitude to Shri
B. Sambamurthy Director, IDRBT Hyderabad, for giving me opportunity to
accomplish internship at this esteemed organization.
It is my profound privilege to express my deep sense of gratitude to Dr. V. N.
Sastry Professor, IDRBT Hyderabad for his precious guidance, constructive
encouragement and support throughout the internship tenure and he helped
selflessly during each phase of development of the project. Without his help and
guidance, it was really difficult to complete this project on time.
I also thankful to Dr. N. Raghu Kisore, Assistant Professor, IDRBT Hyderabad and
Shri Patrick Kishore, Chief Operating Officer, IDRBT Hyderabad for their guidance
and support.
Finally, I would like to thank to Institute for Development and Research in
Banking Technology Hyderabad for conducting such kind of training and I am
also grateful to all the other people who were directly or indirectly helped me in
my summer internship.
Kuldeep Kaushik
B. Tech. (3rd Year)
Computer Science and Engineering
IIT Patna
3 | P a g e
Certificate
This is to certify that the summer internship project report entitled SMS
Gateway and Routing to Banks submitted by Kuldeep Kaushik, B. Tech. (3rd
Year) in Computer Science and Engineering, IIT Patna to Institute of
Development and Research in Banking Technology (IDRBT), Hyderabad is a
record of bonafide work carried out by him under my supervision and guidance
during 15th May 2014 to 9th July 2014.
(Dr. V. N. Sastry)
Professor, IDRBT Hyderabad
Project Guide
4 | P a g e
Table of Contents
Acknowledgement .................................................................................................................................. 2
Certificate ................................................................................................................................................ 3
Chapter 1: Introduction .......................................................................................................................... 5
1.1 Objectives.......................................................................................................................................... 5
1.2 Motivation ......................................................................................................................................... 5
1.3 SMS ................................................................................................................................................... 5
1.4 Working of SMS ................................................................................................................................. 6
1.5 SMS structure ................................................................................................................................... 7
1.6 SMS having more than 160 characters ............................................................................................. 8
1.7 Short Codes and Long Codes ............................................................................................................ 8
Chapter 2: Literature Survey ................................................................................................................ 10
Chapter 3: SMS Gateway ..................................................................................................................... 12
3.1 SMS Gateway .................................................................................................................................. 12
3.2 Functions of SMS Gateway ............................................................................................................. 12
3.3 Types of SMS gateway .................................................................................................................... 13
3.4 Architecture of SMS Gateway ......................................................................................................... 13
3.5 Requirements to send SMS ............................................................................................................ 14
3.6 Conclusion ...................................................................................................................................... 15
Chapter 4: SMS Routing to Banks ........................................................................................................ 16
4.1 Routing to Banks ............................................................................................................................. 16
4.2 Conclusion ...................................................................................................................................... 18
References ............................................................................................................................................. 19
5 | P a g e
Chapter 1: Introduction
1.1 Objectives
The objectives of this project are as follows:
To set up an SMS gateway such that all customers can send an SMS for a transaction to a common short code or long code irrespective of their banks.
Then the SMS received can be routed to the respective banks to perform the transaction.
1.2 Motivation
Currently if the customers of a bank have to perform a transaction then they have to send the
SMS to the short codes of their banks. i.e. suppose Ram having an account in Axis Bank wants
to transfer Rs. 20000 to Mohan`s account in ICICI Bank then he has to send a SMS to the short
code of Axis Bank and after receiving the SMS the axis bank will debit the money from his
account and ask ICICI Bank to credit the money to Mohan`s account. So here the short code
is bank dependent.
So it desired to set up an SMS gateway such that all customers can send SMS for transaction
to a common short code irrespective to their banks and after receiving the SMS this gateway
will route the SMS to the respective banks.
1.3 SMS
SMS is Short Message Service which can be sent over the wireless channel using certain
standardized communication methods over the Mobile Application Part (MAP) of the SS7
protocol. The GSM 7-bit alphabet encoding scheme limits the maximum payload length to
160 alphanumeric characters.
First SMS Was sent in December 1992, to a Vodafone device and this SMS was sent by Neil
Papworth, saying “Merry Christmas”.
Guaranteed delivery: if the wireless mobile device of recipient is switched off, out of range
or if there is a network outage, the SMS message will be stored in the Short Message Service
Center (SMSC) of the receiver Telco and delivered when the recipient announces its presence,
or when the outage is rectified. This is the basis of the store-and-forward concept.
Note: The actual limit of size of SMS is 160 characters if Latin alphabets are used. If non-Latin
alphabets like Chinese or Arabic are used, the limit is 70 characters.
6 | P a g e
1.4 Working of SMS
SMS works as follows:
Once a message is sent by the sender, it is received by a Short Message Service Center
(SMSC).
Then SMSC sends a SMS Request to the Home Location Register (HLR) to find whether
the customer is in roaming and the device is active or not. Once the HLR receives the
request, it will respond to the SMSC with the subscriber's status:
1) Inactive or Active
2) Whether subscriber is in roaming.
If the response is "inactive", then the SMSC will hold onto the message for a period of
time called validity period (generally 2 days). When the subscriber accesses his device, the
HLR sends a SMS Notification to the SMSC, and then SMSC will attempt delivery.
The SMSC receives verification that the message was received by the end user, then
categorizes the message as "sent" and will not attempt to send again.
The basic network structure of the SMS in an IS–41 network.
Short Message Service Center (SMSC): SMSC is a combination of hardware and software
responsible for the storing and forwarding of a short message between a Short Message
Entity (SME) and mobile device. The SMS message will be stored at this location on a FIFO
basis. Its purpose is to store, forward, convert and deliver SMS messages. In this way, if one’s
phone is switched off or the storage for SMS is full, the SMSC will retain any messages until
the user can receive them. The SMSC must have high reliability, subscriber capacity, and
message throughput. In addition, the system should be easily scalable to accommodate
growing demand for SMS in the network.
So the tasks of an SMSC can be described as
7 | P a g e
1. Reception of text messages (SMS) from wireless network users. 2. Storage of text messages. 3. Forwarding of text messages. 4. Delivery of text messages (SMS) to wireless network users. 5. Maintenance of unique time stamps in text messages.
Home Location Register (HLR): The Home Location Register (HLR), an integral part of any
cellular network, contains the data relevant to network subscribers: their status and location.
Thus routing information on how to access them. The SMSC will interrogate the HLR in order
to obtain routing information for SMSs submitted, destined for mobile recipients.
The HLR will also inform the SMSC if previously unavailable subscribers have now registered
on the network, allowing the delivery of messages that were buffered in the SMSC for those
users. So the HLR is a database that contains temporary information about subscribers who
are in roaming. It checks whether the device is active or inactive.
Mobile Switching Center (MSC): The Mobile Switching Center (MSC) delivers the short
message to the specific mobile subscriber through the proper base station. MSC acts like a
switching hub in an Ethernet network. It switches the data between users on the network, in
accordance with the routing information provided by the HLR.
Signal Transfer Point (STP): A Signal Transfer Point (STP) is a router that relays SS7 messages
between signalling end-points (SEPs) and other signalling transfer points (STPs). Typical SEPs
include service switching points (SSPs) and service control points (SCPs).
SMPP: It stands for the Short Message Peer to Peer and it’s a protocol which is used to
exchange the SMS between SMSC and external entities.
1.5 SMS structure
The SMS structure is used to create and read an SMS. The structure contains the following
members:
Receive Date: Date and time when the SMS was received.
Attempt Boolean: Indicates whether the message must be sent on a regular basis if no
reception. It is true by default.
Subscript: Integer corresponding to the subscript of the incoming SMS.
Message: Character string containing the outgoing message or the incoming message (up to
160 characters).
Number: Character string containing the recipient number or the sender number.
Country Prefix: Character string containing the international prefix (91 for India). If the
recipient number starts with "0" and if a national prefix is specified, "0" will be replaced by
this prefix. If no national prefix is specified, use a number in international format. For example
916123456789.
8 | P a g e
Number Type: Indicates the type of number used:
SMS International Number: These numbers can be accessed from anywhere and they are in
94.xx.xx.xx.xx format. It is default value.
SMS National Number: short numbers, accessible within the country.
Members Data Type Length
Receive Date Char 6
Attempt Boolean Char 1
Message Char 160 (Max)
Number Char 10
Country Prefix Char 2
1.6 SMS having more than 160 characters
When SMS has more than 160 characters then the sending device (mobile phone) splits the
message in parts. User Data Header (UDH) will be assigned to beginning of each message part
so that receiving device can identify them as belonging to a single message and recombine
them.
The UDH look like this:
The last two hex values will be the most important values in the UDH.
The second to last digit is 02 in the above codes defines the total number of parts in the
message. So, this message was split into two parts. If three parts were available, then this
value should be 03, and so on.
The next digit defines the part number of the message. 01 means it’s the first part, 02 mean
the second part, etc.
A concatenated SMS is formed from several standards SMS containing a 7 byte concatenation
header at the beginning of each one. Since this 7 byte header is within the message so it
reduces the total size of the SMS to 153 characters each.
1.7 Short Codes and Long Codes
Short Codes:
Short codes are special telephone numbers, significantly shorter than full telephone
numbers.
Short codes are designed to be easier to read and remember than normal telephone
numbers.
They are costly compared to long code due to more demand and less availability.
9 | P a g e
Limited to national Borders.
Short code generally rented for a short term.
Short codes are widely used for value-added services such as television program voting,
ordering ringtones, charity donations and mobile services.
Long Codes:
Long codes are the same length as a traditional telephone number.
Long Code is very cheaper than Short Code.
International accessibility
Assigned for long term.
SMS sending rate for long code is 1 SMS/Second but for Short Code it is 40 SMS/Second.
10 | P a g e
Chapter 2: Literature Survey
SMS is the most widely used data application, with an estimated 3.9 billion active users, or
about 85% of all mobile phone subscribers at the end of 2013. The term "SMS" is used for
both the user activity and all types of short text messaging in many parts of the world.
These were defined in 1985 as part of the Global System for Mobile Communications (GSM)
series of standards as a means of sending messages of up to 160 characters to and from GSM
mobile handsets. Though most SMS messages are mobile-to-mobile text messages, support
for the service has expanded to include other mobile technologies, such as ANSI CDMA
networks and Digital AMPS, as well as satellite and landline networks.
The first SMS message was sent over the Vodafone GSM network in the United Kingdom on
3 December 1992, from Neil Papworth of Sema Group (now Mavenir Systems) using a
personal computer to Richard Jarvis of Vodafone using an Orbitel 901 handset. The text of
the message was “Merry Christmas.”
The first commercial deployment of a short message service center (SMSC) was by Aldiscon
part of Logica (now part of Acision) with Telia (now TeliaSonera) in Sweden in 1993, followed
by Fleet Call (now Nextel) in the US, Telenor in Norwayand BT Cellnet (now O2 UK) later in
1993. All first installations of SMS gateways were for network notifications sent to mobile
phones, usually to inform of voice mail messages. The first commercially sold SMS service was
offered to consumers, as a person-to-person text messaging service by Radiolinja (now part
of Elisa) in Finland in 1993. Most early GSM mobile phone handsets did not support the ability
to send SMS text messages, and Nokia was the only handset manufacturer whose total GSM
phone line in 1993 supported user-sending of SMS text messages.
Initial growth of SMS was slow, with customers in 1995 sending on average only 0.4 messages
per GSM customer per month. One factor in the slow take up of SMS was that operators were
slow to set up charging systems, especially for prepaid subscribers, and eliminate billing fraud
which was possible by changing SMSC settings on individual handsets to use the SMSCs of
other operators. Initially, networks in the UK only allowed customers to send messages to
other users on the same network, limiting the usefulness of the service. This restriction was
lifted in 1999.
Over time, this issue was eliminated by switch billing instead of billing at the SMSC and by
new features within SMSCs to allow blocking of foreign mobile users sending messages
through it. By the end of 2000, the average number of messages reached 35 per user per
month and on Christmas Day 2013, over 320 million messages were sent in the UK alone. It is
also alleged that the fact that roaming customers, in the early days, rarely received bills for
their SMSs after holidays abroad which gave a boost to text messaging as an alternative to
voice calls.
11 | P a g e
Text messaging outside GSM: SMS was originally designed as part of GSM, but is now
available on a wide range of networks, including 3G networks.However, not all text messaging
systems use SMS, and some notable alternative implementations of the concept include J-
Phone's SkyMail and NTT Docomo's Short Mail, both in Japan. Email messaging from phones,
as popularized by NTT Docomo's i-mode and the RIM BlackBerry, also typically uses standard
mail protocols such as SMTP over TCP/IP.
SMS Now a days: In 2013, 6.9 trillion SMS text messages were sent. This translates into an
average of 193,000 SMS per second. SMS has become a huge commercial industry, earning
$125 billion globally in 2013. The global average price for an SMS message is US$0.11, while
mobile networks charge each other interconnect fees of at least US$0.04 when connecting
between different phone networks.
While SMS is still a growing market, traditional SMS is becoming increasingly challenged by
alternative messaging services available on smart phones with data connections, especially in
Western countries where these services are growing in popularity.
With the growing popularity SMS is considered to be an alternative for banking services. So
SMS banking was started for customers.
On SMS Gateway few studies were conducted
1. Short Message Service using SMS Gateway Veena K.Katankar et. al. / (IJCSE) International
Journal on Computer Science and Engineering Vol. 02, No. 04, 2010, 1487-1491
This explained about short messaging service (SMS) system for delivering messages through
SMS gateway. Main goal of their system was to provide multilevel local authentication to the
SMS gateway service. This service can be implemented in any multi departmental
organization where SMS service is used for notification system and marketing purpose.
Proposed system has web interface and the encryption method for providing service.
2. SMS: The Short Message Service Jeff Brown, Bill Shipman, and Ron Vetter University of
North Carolina, Wilmington, IEEE Computer Society, December 2007, Vol. 40 no. 12, pp.
106-110
This explained about the SMS specification, SMS concepts and system architecture, short
codes, long codes, e-mail gateways, SMS centers.
3. A Web Service Gateway for SMS-based Services Giuseppe Attardi, Daniele Picciaia,
Antonio Zoglio Dipartimento di Informatica, Università di Pisa – Italy,
http://www.garr.it/eventiGARR/conf_05/articoli/GARR05-Attardi.doc
This explained about Web applications for mobile users i.e. developing a gateway that allows
real-time interaction through GSM SMS messages. The gateway implements a pattern of
subscribe/notify accessible through Web methods according to the Parlay X Web Service
Specifications. As an application they built an exam registration service, which allows
professors to register exam votes in real time through cellular phones.
12 | P a g e
Chapter 3: SMS Gateway
3.1 SMS Gateway
An SMS gateway is a mechanism by which SMS are sent and received and often do conversion
to different format. The SMS gateway is connected directly to the GSM network via a GSM
Modem with an ordinary SIM card.
Once the SMS is received by the gateway, it should be routed to the application for
processing. Before routing the message the gateway needs to do two things.
1. Prepare the message data in a way that the application can understand it.
2. Map an application URL to the dedicated long code or short code.
3.2 Functions of SMS Gateway
Every different kind of SMS Center uses different protocol. SMS gateway translate one
SMSC protocol to another one.
An SMS gateway is used to handle connection with SMS centers and to relay them
onward in a unified form.
Before routing the SMS for processing to application, the SMS gateway needs to
prepare the message data in a way that can be understood by application.
The SMS Gateway can be set up to handle the connections to the SMSCs to support
many type of protocols to connect to the external entity.
13 | P a g e
SMS Gateway solve a common telecommunications problem that of different wireless
telephony providers using different or proprietary communication protocols. The
gateway acts as a relay, translating one protocol into another. Wireless network
operators use SMS gateways to connect SMS center. An SMSC is the portion of a
wireless network that handles SMS operation such as routing, forwarding and storing
incoming text messages on their way to desired endpoints.
A SMS Gateway provider facilitates the SMS traffic between subscribers acting as the
server or network hub for the individual message much like a service provider for
internet or websites. The SMS Gateway provides the path so that the SMS message
can be sent directly to and from recipients avoiding delays and message loss, through
optimized routing and is frequently used corporately for communications. After
submitting the SMS request and the delivery receipt will be delivered by replacing the
values in the callback URL. This callback URL is a servlet which will simply get the
parameter and value from the URL and logged it to a file or database for tracing
purpose.
When gateway submits the SMS to the SMSC then SMSC will return the results
whether SMS has been delivered or lost or any other information as a delivery report
back to gateway. This information will be stored in a database for an intermediate use
and will be processed again when the application requests for delivery reports.
3.3 Types of SMS gateway
1. One Way SMS gateway (Push): In one way SMS gateway messages are sent only from
one side. eg. Gmail and Facebook uses one way gateway to improve their security.
2. Two Way SMS gateway (Push & Pull): In two way SMS gateway messages are sent
from both sides. It is complex compared to one way SMS gateway. Eg. SMS Banking.
3.4 Architecture of SMS Gateway
An SMS gateway would receive and process incoming SMS from users, extracting the data
required to take the appropriate action, and sending the response message back to the user.
Kannel as an open SMS gateway for sending/receiving SMS can be more preferable to use
because of its strongest and free software. This SMS gateway will divide its various duties into
two different kinds of processes, called boxes based on what kinds of external agents needs
to interact with it.
1. Bearerbox:
It receives UDP messages from mobile phone via SMSC.
It Routes UDP packets (Send and Receives) to SMSBox.
It Sends the UDP message back to mobile phone.
it connects to the SMS center and accepts the message from phone and sends it
to SMSbox.
14 | P a g e
2. SMSbox:
It receives SMS messages from the BearerBox via its TCP connection.
Parse each of them in order to extract keywords and parameters from it.
And then executes a service according to keyword which the message contains.
Listens to SMS messages via HTTP and converts them into true SMS format.
The smsbox implements the rest of the SMS gateway functionality. It receives
textual SMS messages from the bearerbox, and interprets them as service
requests, and responds to them in the appropriate way.
There can be only one bearerbox, but any number of smsboxes.
Having multiple smsboxes can be beneficial when the load is very high.
Each box is internally multithreaded. For example, in the bearerbox, each SMS center
connection will be handled by a separate thread.
3.5 Requirements to send SMS
In Addition to SMS Gateway we need access to (an Operator`s) SMS Center.
If we don`t have such access we can still send SMS using a GSM phone as a virtual SMS
center.
In Addition to an SMS center (Real or Virtual) we need a Server to handle any SMS
request received.
This Server has cgi-bins, program or scripts to serve HTTP requests generated by SMS
gateway.
15 | P a g e
3.6 Conclusion
This chapter explains about SMS gateway and the functionalities of SMS gateway. It also tells
about the internal architecture of SMS gateway and how we can set up our own SMS gateway.
This chapter also mentions about the requirements to send SMS in addition to SMS gateway.
So this chapter`s overall focus is on SMS gateway and its implementation.
16 | P a g e
Chapter 4: SMS Routing to Banks
4.1 SMS routing to Banks
When a device has multiple paths to reach a destination it always selects one path by
preferring it over others. This selection process is termed as Routing. Routing is done by
special network devices called routers or it can be done by means of software processes, but
software based routers have limited functionality and limited scope. A router is always
configured with some default route. A default route tells the router where to forward a packet
if there is no route found for specific destination. Routes can be statically configured or
dynamically learnt. One route can be configured to be preferred over others.
SMS Routing uses the recipient network Home Location Register (HLR) to change the flow of
inbound off-net messages, directing them to an SMS router, rather than straight to target
handsets. There, advanced services such as divert, copy, archiving and anti-spam can be
applied before messages are delivered.
SMS Routing was standardized by the 3GPP in two forms Non-Transparent Home Routing
supporting all types of advanced SMS services and, in response to lobbying from bulk SMS
service providers, Transparent Home Routing supporting a limited sub-set of advanced SMS
services and the issuance of delivery receipts.
SMS can be routed in two ways:
Based on the destination phone number: Here the routing is done based on the receiver`s
phone number.
Based on global commands or prefix: Here the routing is done based on prefix which can be
either a name (characters) or numbers (digits).
The operator will know about the location of the receiver as the SMSC will make a query on
the SS7 network to the Home Location Register (HLR) in order to find the user not just the
user's home operator, but also the operator on which the user is currently roaming, so that
the message can be delivered. It is like a DNS lookup on the internet. Except that this SS7
network is not IP based, and it is private. And commercial roaming arrangements are required
between carriers in order to facilitate the exchange of SMS messages between the networks.
As we saw that we need to route the SMS Sent at the common short code to the
corresponding banks to perform the transaction. Now the question arises as how do we
identify that a customer belongs to which bank. So this can be identified using the first four
digits of the MMID of the customer.
Mobile Money Identification Number (MMID): It is a seven digit number of which the first
four digits are the unique identification number of the bank offering IMPS.
In simple words the first four digits of the MMID tell us that to which bank this customer
belongs to. It is given by NPCI.
17 | P a g e
The complete procedure of SMS routing of a transaction for example to transfer Rs. 20000
from customer 1`s account to customer 2`s account is as follows:
First of all when customer 1 sends an SMS to the common source code of SMS gateway
then it will be received by SMS gateway through Telco.
Then this SMS gateway passes this message to the corresponding bank of the
customer 1.
Then using the first four digits of the MMID of the customer 2 this bank will identify
to which bank the customer 2 belongs to.
If the customer 2 belongs to same bank as of customer 1 then it will debit Rs. 20000
from customer 1`s account and credit Rs. 20000 to the customer`2 account. And send
the SMS notification regarding the transaction to IDRBT Server as push. And then this
gateway will transfer this SMS to the corresponding customers.
And if customer 2 belongs to different bank as that of customer 1 then the bank of
customer 1 will debit the Rs. 20000 from the account of customer 1 and transfer Rs.
20000 to the bank of customer 2 through NPCI Network. And send the SMS
notification regarding the transaction to IDRBT Server as push. And then this gateway
will transfer this SMS to the corresponding customers.
So this way the complete routing will take place.
Figure Showing the SMS Routing to Banks
18 | P a g e
4.2 Conclusion
This Chapter explains that how we can route the SMS to the banks using the first four digits
of the Mobile Money Identification Number (MMID) of the customer. And also explains that
we can perform the transaction in the banks using a common short code irrespective of the
banks. The SMS received at the IDRBT server can be forwarded to the corresponding banks to
perform the transaction through NPCI Network.
19 | P a g e
References
[1] Short Message Service using SMS Gateway Veena K.Katankar et. al. / (IJCSE)
International Journal on Computer Science and Engineering Vol. 02, No. 04, 2010,
1487-1491
[2] SMS: The Short Message Service Jeff Brown, Bill Shipman, and Ron Vetter University
of North Carolina, Wilmington, IEEE Computer Society, December 2007, Vol. 40 no.
12, pp. 106-110
[3] A Web Service Gateway for SMS-based Services Giuseppe Attardi, Daniele Picciaia,
Antonio Zoglio Dipartimento di Informatica, Università di Pisa – Italy
http://www.garr.it/eventiGARR/conf_05/articoli/GARR05-Attardi.doc
[4] http://en.wikipedia.org/wiki/Short_Message_Service
[5] http://mobileforensics.wordpress.com/2007/02/22/how-sms-works/
[6] http://en.wikipedia.org/wiki/SMS_gateway
[7] http://forums.hostsearch.com/showthread.php?14352-How-does-SMS-gateway-
work
[8] http://www.kannel.org/download/kannel-userguide-snapshot/userguide.pdf
[9] http://www.tutorialspoint.com/data_communication_computer_network/network_
layer_routing.htm