ussd

What is USSD ?

USSD or Unstructured Supplementary Service Data is the ussd full form , is the basic service provided by GSM network operators for sending  and receiving data (or strings) on a mobile device to/from core network of a mobile operator. It comes under the basic services in all mobile network along with voice and sms. Does not require internet ,this enables  ussd to run on very basic phones.  According to gsm network  specifications , a ussd message can be maximum 160 bytes long. This make it very important to reach people where most of  the population living in rural areas and can nor afford smart phones.

The number of character depends on encoding scheme. E.g With GSM 7 (English alphabets )bit encoding, ussd string can be maximum 182 bytes long. While for UCS-2  (Arabic, ), where a character is two bytes long, this results the ussd string to be 80 characters long.

USSD enables a mobile operator to provide , call back service while in roaming, location based services, balance services, content marketing based on location etc.

Protocol standards are defined in GSM MAP 09:02 and GSM 03.90 .

To get a service via ussd, user dials a known string (e.g *123#) for a service, home network of mobile operator response with the required menu or content A ussd session established between handset and ussd application.

USSD Code : 

For accessing network initiated IVR services. Mobile subscriber needs to dial a number , some time its long and some time its short. E.g Airtel India provides 121 number for IVR and customer care for its subscribers.  This initiates a call towards the IVR and setup a voice session. For a USSD based session, user dials a code this is called USSD Code.  E.g for customer services Airtel India have *121# USSD Code  .  The roaming network  routes the USSD code towards the home network. The code should not be from any MMI code used by the device.

Home network ussd application, decides the menus based on ussd code.

USSD Mode:

There are two modes. MMI mode and Application Mode. In MMI mode mobile user dials string to start a menu based session with the home network.  In Application mode, an application transfer binary data from handset to the HPLMN.

MMI Mode And Application Mode

 What is  MMI Code or Man Machine Interface Code: 

GSM network provides many supplementary services to a mobile subscriber. User can activate/register/deactivate  services from a mobile device.  Supplementary services are , call forwarding no conditional, call forwarding when busy  etc. Now a days mobile phones are very advance for supplementary service management. You can activate/deactivate/register services from a graphical user interface. The full details are specified in GSM Spec. This spec have standard mmi interface for GSM services. A phone manufacture cab define its own mmi codes. This provides flexibility to the manufactures for providing new features and can compete in the market.

But these services should be supported on all GSM phones, to achieve this every phones comes with MMI or man machine interface to interact with the phone.As MMI full form form is Man Machine Interface , so a  MME code is the command to the phone. A code can display device information (e.g *#06#, displays IMEI number), can generate a protocol message on network or can send dialed string in a USSD message.

E.g *21*787687878# <SEND>, will activate the call forwarding. Here 21 is the  supplementary service code. List of other code can be get at  SS Code List.

Mobile device parses the MMI code and generate a MAP 09:02 protocol message for activating/deactivating  /register a service. HLR holds the status of each supplementary service for a subscriber or IMSI.

If a user dials a code which is not in list of MMI codes provided by device, the dialed string is transferred in USSD message from device to home network.

 

USSD Network:

The network have roaming MSC/VLR connected via SS7/Sigtran links to the home network.  A device connects to the MSC/VLR via BTS/BSC.

USSD Network
USSD Network

HLR or Home Location Register:

HLR is subscriber data base in home network. After successful location update, vlr stores the GT of HLR. When a user dials a ussd string,  VLR  sends a GSM MAP operation to the HLR in HPLMN.  The destination GT , is the HLR number received in Location Update.

MSC or Mobile Switching Center:

A MSC or mobile switching center, is a GSM node in visiting network , one side it connects to wireless network via BSC or RNC. Other side it connects to the PSTN or SS7 network. Mostly it is co located with the VLR.

VLR or Visitor Location Register:

A VLR , is database which stores the mobile station profile temporary. Profile is downloaded from HLR upon location update.  Roaming network provides services based on the profile downloaded.

USSD Gateway :

This is a dedicated node which convert menu based business logic to the signaling on wire and vise versa.  For mobile initiated USSD, HLR sends the signaling to the USSDGW, while in network initiated, string may be directly passed to the roaming network using SS7 connection.

Gateway opens new opportunities for providing ussd based platform for advertisement same as sms gateway does for sms.

Gateway connects with mobile operators over ss7/sigtran  (GT and Point code). Provider of USSDGW, purchases ussd codes and all mobile operator set the outing of short codes towards gateway.

USSD Application:

An application is the actual business logic for service. E.g A prepaid balance application. One side connect to the HLR or USSDGW, other side connects to the subscriber profile for billing. When a balance request (e.g *2345#) arrives to the HLR, a USSD application is invoked with mobile number of IMSI. Applications returns a menu , which is send to the phone via HLR or USSDGW.

There are situations when a VAS provider want to develop an ussd application and want to reach the mobile subscribes with in a area. Following is required to develop ussd application.

USSD Application over ss7/sigtran:

With this option, the ussd gateway of mobile operators  do not get over loaded. But same time, its difficult to get this kind of connection.

  • VAS provider gets a USSD code. It is not required, if the service logic only involves network initiated USSD.
  • Need to connect the mobile operators for the SS7/Sigtran.  There can be multiple mobile operators.
  • VAS provide gets Global title and a Point Code. This is the address of VAS node in the mobile network.
  • SS7 stack required to receive and send ss7 messages from/to the roaming network.
  • Develop the actual application on top of stack.
USSD Application via ussd gateway:

With this option, the APIs provided by the mobile operator will be used. Most of the time these are http apis.

USSD parameters :

Data Coding Scheme,

This parameter identifies  , string characters encoding in bytes. The receiving side, drives user readable string from bytes value and data coding scheme. A character may be encode in different bits or byte sizes. E.g GSM 7 encoding, encodes a character in 7 bits and a UCS2 encoding encodes a character in 2 bytes or 16 bits.

String :

This is the sequence of characters shown on mobile device or a device sends to the home network. Size of string depends on encoding scheme.

Alerting Pattern:

This parameters set the alert  type , which mobile gives to its user upon receiving USSD string. E.g Beep Once.

IMSI :

A imsi identifies a subscriber globally, a unique identity of a sim card globally.

USSD Protocol: 

Service uses standard GSM MAP 09:02 protocol. GSM MAP , which uses  services of SS7/Sigtran protocol. In this example, protocol stack is sigtran, in case of the SS7 (E1/T1), the M3UA layer will be replaced by MTP3, SCTP with MTP2 and IP with MTP1.  In sigtran no soecial hardware required for IP links, sigtran links the ethernet card work.

Protocol Stack:

USSD Protocol Stack
USSD Protocol Stack

 

IP or Internet Protocol Layer , ip layers routes the user (here its SCTP) messages over IP network. Both peers assigned an ip address.

SCTP or Stream Control Transmission Protocol Layer, it s a transport layer, setup a connection with peer node. SCTP provides error free messages in both the directions.

M3UA or MTP3 User Adaptation Layer in sigtran, carries SS7 signaling over ip for the upper SS7 layers. A ss7 point code identifies a m3ua layer.

Other layers belongs to SS7 protocol standard. Please check at  SS7 Layers.

USSD Protocol Messages:

Every layer usese protocol messages for a USSD session, below table mentioned the protocol messages used by layers.

GSM MAP TCAP SCCP  M3UA SCTP
PUSSSD TC-BEGIN UDT DATA DATA Chunk
USSD TC-CONTINUE
NOFIFY TC-END

USSD Message Flow: 

Mobile Initiated :

Mobile Initiated USSD Call
Mobile Initiated USSD Call

When a mobile subscriber dials a string (*123#), a ussd call starts.  The first message of call is from VLR to the HLR.  E.g

Mobile user dials *123# for prepaid balance.

User Receives a menu

1, for main balance 2, for data balanceMobile subscriber press 2

On Screen mobile subscriber gets ussd menu:

Your data balance is 200MBm valid for next 10 days. Thank you

Network Initiated Call Flow:

Network Initiated USSD Call
Network Initiated USSD Call

When mobile operator or a gateway wants to display menu to the mobile user, network initiated session starts.  USSDGW can send menu directly to the roaming MSC/VLR or it can be via HLR. Direct sending, offloads the hlr.  To send menu directly, the USSDGW should know the IMSI and visiting MSC/VLR. HLR lookup is one of the option to get IMSI and roaming MSC.

Example Call Flow  :

Mobile Subscriber Receives Menu

Select 1. For activate free Roaming, 2. For No Free Roaming.Mobile Subscriber Selects 1

Mobile Subscriber Receives String

Thank You

Difference between USSD and SMS:  

USSD and SMS both enables a mobile user to send text to home network and to receive text from home network. But there are many differences which which makes these two to fit at difference places.

USSD Is session based while sms is not, upon dialing string on device , a session is setup with the home network. If a response does not come in time , session is terminated. In sms there is no session is maintained.

No long text in USSD, A sms can be more that 160 bytes, this is achieved by doing segmentation on smsc and reassembly at mobile device. No segmentation on USDGW and reassembly on mobile device.

USSD Enable a two way communication.  While doing an advertisement, the advertiser might get a immediate response from mobile user if uses USSD session. In sms , the mobile user may not to send response immediately or forget after some time.

1 thought on “ussd”

  1. I have read about SS7 and USSD in the Internet for a long time, to build USSD application/GW, and this is the most useful article I have ever read since my research

Leave a Comment

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