Lesson 12: USSD Gateway and How USSD applications work

About USSD gateways

It has been long since the last  post. But, I am back. Good people read awesome stuff,and if you reading this, you are awesome for sure!

A USSD gateway is usually equipped with session management capabilities, that can handle cell switching, to make sure an USSD Session is preserved even when the subscriber changes cells. USSD is a protocol used by GSM cellular telephones to communicate with the service provider’s computers. USSD stands for Unstructured Supplementary Services Data. A gateway is the collection of hardware and software required to interconnect two or more disparate networks, including performing protocol conversion.

Many applications can be made from USSD technology. They are categorized as

1.Standard supplementary services e.g Call back services
2.GSM Network Operators value-added services e.g for promotions
3.Third party content and application providers e.g mobile banking

The diagram below give a gist of how USSD applications work

 From the diagram alongside, a request is sent from a mobile station (mobile phone) to a telecom network such Vodafone. This request is directed to a USSD gateway, which understands USSD menus. This gateway may be owned by the telecom (build in) or by other third party providers who offer other tailored services such as short codes and bulky messages. Remember that the USSD gateway adds some parameters, which are called USSD Parameters, to the call back URL, and then sent to the hosting server. This is where we have the callback URL, which tells the gateway where to find the hosted system, where we have the business logic which determines the menu to serve the use on receiving user’s request. 
The business logic hosted on a different server will process the request and respond with another menu if a USSD session has not expired or a final data when the request is marked as the last request. I mean that it is up to the programmer using the gateway documentation to tell the gateway either to just return response o the user or to ask a user to reply with something. For example a company in Kenya called Africa’s Talking (website: https://www.africastalking.com) has it that  a programmer preppend END when a session has to be terminated and CON when session is in progress and a user has to reply. 
Note that USSD is not a programming language but a GSM technology. Therefore, any web language can be used to implement USSD applications. However, for this tutorial we will use PHP and java to illustrate. 

What do we need to know or have to build a USSD application

A web programming language such java (jsp, servelets and other frameworks like play), PHP, Python etc. 
Note that you do not handle user interfaces. The display solely depends on the mobile station (mobile phone) being used by user. 
A web server to host our application. A database server of course because many applications will be database driven. More often, web and data servers one thing. We will do database in this tutorial because it is beyond scope.
We also need a USSD gateway to handle request between telecom network and web server.  This is at a fee from telecom or a third party company who have licenses from telecoms. Remember most USSD gateway providers will ask you to pay even for testing your application before hitting the switch going live: test bed
You realize this may be a bit hard if you are not planning to live any time soon. Good news is that you can all this without a real USSD gateway and a live server. So you need simply the following;
– A web browser of your choice
– A code editor for writing PHP code: We will begin with PHP
– A local server of your choice preferably XAMPP and for linux users, you know what you are supposed to do
We will test the USSD menus with our browser. 
Put this ready for our next lesson i.e install a browser, a local server that can support PHP an editor of your choice.


I know this lesson has been dense but was a good foundation to starting the real thing
Please feel free to ask a question or leave a comment.
    • Derdus Kenga

Add a Comment

Your email address will not be published. Required fields are marked *