What is USSD – MMI Code – USSD Code?
USSD or Unstructured Supplementary Service Data is the USSD full form. USSD is the basic service provided by GSM network operators for sending and receiving data (or strings) on a mobile device to/from the core network of a mobile operator. It comes under the basic services in all mobile networks along with voice and SMS. It does not require the internet connection from the device, this enables USSD to run on very basic phones. According to gsm network specifications, a USSD message can be a maximum of 160 bytes long. This makes it very important to reach people where most of the population living in rural areas and can not afford smartphones.
The number of user-entered characters depends on the encoding scheme. E.g With GSM 7 (English alphabets )bit encoding, USSD string can be a maximum of 182 bytes long. While for UCS-2 (Arabic), where a single character is two bytes long, this results in the USSD string to be a maximum of 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 service via USSD, a user dials a known string (e.g *123#) for a service, the home network of mobile operator response with the required menu or content. A USSD session established between the handset and a USSD application for an interactive interaction.
USSD Code :
For accessing IVR services. Mobile subscriber needs to dial a number, sometimes it is long and sometimes it is short. E.g Airtel India provides a 121 number for IVR and customer care for its subscribers. This initiates a call towards the IVR and sets up a voice session. For a USSD based session, a user dials a fixed string, which is called the USSD Code. E.g for customer services Airtel India has *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. We are providing details of MMI code in the coming paragraphs. USSD code decides what services a mobile user need.
Home network USSD application decides the menus based on USSD code.
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.
What is MMI Code or Man-Machine Interface Code:
An MMI code is a value that works as a command to the device. For example, the GSM network provides many supplementary services to a mobile subscriber. Users can activate/register/deactivate services from a mobile device. Supplementary services are, call forwarding no conditional, call forwarding when busy, etc. These days mobile phones are very advance (smartphones) for supplementary service management. You can activate/deactivate/register services from a graphical user interface. But before smartphones, only MMI Code was the option. The full details for MMI Codes are specified in GSM Spec. This spec has a standard MMI interface for GSM services. Phone manufacturers can define its own MMI codes too. 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 phone comes with MMI or man-machine interface to interact with the phone. MMI full form is Man-Machine Interface, so an 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 a 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. A list of other codes can get at the SS Code List.
The mobile device parses the MMI code and generates 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 that is not in the list of MMI codes provided by the device manufacturer, the dialed string is transferred in the USSD message from the device to the home network.
The network has roaming MSC/VLR connected via SS7/Sigtran links to the home network. A device connects to the MSC/VLR via BTS/BSC.
HLR or Home Location Register:
HLR is a subscriber database in-home network. After a successful location update, VLR stores the GT (SCCPaddress) 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:
An MSC or mobile switching center is a GSM node in a visiting network, one side connects to the wireless network via BSC or RNC. Another side connects to the PSTN or SS7 network. Mostly it is co-located with the VLR.
VLR or Visitor Location Register:
A VLR is a database that stores the subscriber profile temporary. The profile is downloaded from HLR upon a location update gsm map protocol procedure. The roaming network provides services based on the profile downloaded.
USSD Gateway :
This is a dedicated node that converts 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, the string may be directly passed to the roaming network using SS7 connection.
Gateway opens new opportunities for providing USSD based platform for advertisement the same text as SMS gateway does for SMS.
The gateway connects with mobile operators over ss7/sigtran (GT and Point code). Provider of USSDGW purchases USSD codes and all mobile operators set the outing of shortcodes towards the gateway.
An application is the actual business logic for service. E.g A prepaid balance application. One side connects to the HLR or USSDGW, the other side connects to the subscriber profile for billing. When a balance request (e.g *2345#) arrives at the HLR, a USSD application is invoked with a mobile number of IMSI. Applications return a menu, which is sent to the phone via HLR or USSDGW.
There are situations when a VAS provider wants to develop a USSD application and want to reach the mobile subscribes within an area. The following is required to develop a USSD application.
USSD Application over ss7/sigtran:
With this option, the USSD gateway of mobile operators does not get overloaded. But at the same time, it is difficult to get this kind (ss7/sigtran) of connection.
- VAS provider gets a USSD code. It is not required if the service logic only involves network initiated USSD.
- We 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 the 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 the 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 a user-readable string from bytes value and data coding scheme. A character may be encoded 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.
This is the sequence of characters shown on the mobile device or a device sends to the home network. The size of the string depends on the encoding scheme.
This parameter sets the alert type, which mobile gives to its user upon receiving USSD string. E.g Beep Once.
An IMSI identifies a subscriber globally, a unique identity of a sim card globally.
Service uses standard GSM MAP 09:02 protocol. GSM MAP, which uses the services of SS7/Sigtran protocol. In this example, the protocol stack is SIGTRAN, in the case of the SS7 (E1/T1), the M3UA layer will be replaced by MTP3, SCTP with MTP2 and IP with MTP1. In SIGTRAN no special hardware required for IP links, SIGTRANlinks the ethernet card work.
IP or Internet Protocol Layer, IP layers routes the user (here its SCTP) messages over the IP network. Both peers assigned an IP address.
SCTP or Stream Control Transmission Protocol Layer, it s a transport layer, set up a connection with the peer node. SCTP provides error-free messages in both directions.
M3UA or MTP3 User Adaptation Layer in SIGTRAN carries SS7 signaling over IP for the upper SS7 layers. An ss7 point code identifies an m3ua layer.
Other layers belong to the SS7 protocol standard. Please check at SS7 Layers.
USSD Protocol Messages:
Every layer uses protocol messages for a USSD session, below table mentioned the protocol messages used by layers.
USSD Message Flow:
Mobile Initiated :
When a mobile subscriber dials a string (*123#), a USSD call starts. The first message of the 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 balanced mobile subscriber press 2
The on-screen mobile subscriber gets the USSD menu:
Your data balance is 200MBm valid for the next 10 days. Thank you
Network Initiated Call Flow:
When a mobile operator or a gateway wants to display a menu to the mobile user, a network-initiated session starts. USSDGW can send the menu directly to the roaming MSC/VLR or it can be via HLR. Direct sending, offloads the HLR. To send the menu directly, the USSDGW should know the IMSI and visiting MSC/VLR. HLR lookup is one of the options 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
Difference between USSD and SMS:
USSD and SMS both enable a mobile user to send a text to the home network and to receive a text from the home network. But there are many differences which make these two to fit in different places.
USSD is session-based while SMS is not, upon dialing string on a device, a session is set up with the home network. If a response does not come in time, the session is terminated. In SMS there is no session is maintained.
No long text in USSD, A SMS can be more than 160 bytes, this is achieved by doing segmentation on SMSC and reassembly at the mobile device. No segmentation on USDGW and reassembly on the mobile devices.
USSD enables two-way communication. While doing an advertisement, the advertiser might get an immediate response from a mobile user if it uses the USSD session. In SMS, the mobile user may not send a response immediately or forget after some time.