What is USSD – MMI Code – USSD Code?

USSD is a fundamental service that all GSM network operators support to enable the exchange of menus (or strings) between a subscriber and an operator.

The acronym USSD stands for Unstructured Supplementary Service Data. It does not require the device to be connected to the internet, which enables it to function on even the most basic phones. Very useful for approaching rural residents who cannot afford smartphones. Along with voice and text, a mobile operator provides it as an essential service.

How long could a USSD menu be?

As per gsm network specifications, a USSD message can be a maximum of 160 bytes long. A byte is a basic unit of data transfer on the wire.

The number of characters in the menu depends on the encoding scheme of the characters. E.g., With GSM 7 (English alphabet)bit encoding, each character is encoded in 7 bits, which makes the USSD string a maximum of 182 bytes long. While for UCS-2  (For example, Arabic), where a single character is two bytes long, the USSD string is a maximum of 80 characters long.

What are the possible services with the USSD?

USSD enables a mobile operator to provide call-back service while 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. A USSD message uses a gsm map protocol over SS7.

How to access a USSD service?

To access a service over USSD, a mobile subscriber dials a known string (e.g., *123#), and the home network of the cellular operator responds with the required menu or content. A USSD session establishes between the handset and a USSD application for an interactive interaction.

What are USSD Code and IVR? 

A mobile operator may provide an IVR option too. A mobile subscriber needs to dial a number to access the IVR. Sometimes it is long, and sometimes it is short. E.g., Airtel India provides 121 to its subscribers for IVR/customer care. The dialing a number initiates a call to the IVR and sets up a voice session.

A user dials a fixed string to initiate a USSD session called the USSD Code. E.g. for customer services, Airtel India has *121# USSD Code. The roaming network routes the USSD code toward the USSD server in-home network.

The dialed string should not be from any MMI code the device hardware uses.

We are providing details of the MMI code in the coming paragraphs. A USSD code decides what service a mobile user needs.

The home network USSD application decides the menus based on the USSD code.

USSD Mode:

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

MMI Mode And Application Mode

 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 its mobile subscribers. Users can activate/register/deactivate services from a mobile device. Supplementary services examples are, call forwarding no conditional, call forwarding when busy, etc. These days mobile phones are very advanced (smartphones) for supplementary service management. You can activate/deactivate/register services from a graphical user interface. But before smartphones, only MMI Code was an 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 their own MMI codes too. This provides flexibility to the manufacturers for delivering 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’s 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#, shows IMEI number), generate a protocol message on a network, or 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  /registering a service. HLR holds the status of each supplementary service for a subscriber or IMSI.

If a user dials a code 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.

USSD Network:

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

USSD Network
USSD Network

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 temporarily. 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 dedicated node converts menu-based business logic to the signaling on wire and vice 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 an SS7 connection.

Gateway opens new opportunities for providing a USSD-based platform for advertising 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.

USSD Application:

An application is the actual business logic for service. E.g., A prepaid balance application. One side connects to the HLR or USSDGW, and the other 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 sent to the phone via HLR or USSDGW.

There are situations when a VAS provider wants to develop a USSD application and intends to reach mobile subscribers within an area. The following is required to create a USSD application.

USSD Application over ss7/Sigtran:

With this option, the USSD gateway of mobile operators does not get overloaded. But simultaneously, it isn’t easy 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 provides a Global title and a Point Code. This is the address of the VAS node in the mobile network.
  • SS7 stack must 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 encoded 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.

String :

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

Alerting Pattern:

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


An IMSI identifies a subscriber globally, a unique identity of a sim card.

USSD Protocol: 

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), MTP3, SCTP with MTP2, and IP with MTP1 will replace the M3UA layer. In SIGTRAN, no special hardware is 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 route the user (here, SCTP) messages over the IP network. Both peers were assigned an IP address.

SCTP, or Stream Control Transmission Protocol Layer, it s a transport layer that sets 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. The below table mentions the protocol messages used by layers.


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 the call is from VLR to the HLR. E.g

A mobile user dials *123# for prepaid balance.

The 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 ten days. Thank you

Network Initiated Call Flow:

Network Initiated USSD Call
Network Initiated USSD Call

A network-initiated session starts when a mobile operator or a gateway wants to display a menu to the mobile user. USSDGW can send the menu directly to the roaming MSC/VLR or via HLR. Direct sending offloads the HLR. The USSDGW should know the IMSI and roaming MSC/VLR to send the menu directly. HLR lookup is one of the options to get IMSI and roaming MSC.

Example Call Flow  :

Mobile Subscriber Receives Menu

Select 1. To 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 enable a mobile user to send a text to the home network and receive a text from the home network. But many differences make these two services fit in different places.

USSD is session-based, while SMS is not. Upon dialing the 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 the SMS, there is no session 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 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 the SMS, the mobile user may not send a reply immediately or forget after some time.