Saltar al contenido principal

USSD

This document describes the Unstructured Supplementary Service Data (USSD) implementation in OmniMSC, covering HLR relay, local handling, the diagnostic easter egg menu, the USSD codec, and the SS message flow.

For supplementary service codes handled via USSD (call forwarding MMI codes, call barring, call waiting), see Supplementary Services. For the MAP ProcessUnstructuredSS-Request operation and dialogue management, see MAP Operations. For USSD-related Prometheus metrics, see Metrics and Monitoring. For USSD gateway configuration, see Configuration Reference. For troubleshooting USSD issues, see Troubleshooting.


USSD Relay to HLR

When a subscriber sends a USSD string that is not handled locally by the MSC, the request is relayed to the HLR via MAP. The MS sends a REGISTER message containing a Facility IE with a processUnstructuredSS-Request (opcode 59). The MSC extracts the USSD string and forwards the request to the HLR using the same MAP operation.

For multi-step interactive sessions, the HLR responds with an unstructuredSS-Request (opcode 60) instead of a final response. The MSC relays this to the UE as a FACILITY message, and the UE's reply is forwarded back to the HLR. This dialogue continues until the HLR sends a final processUnstructuredSS-Response.


Local USSD Handling

The MSC can handle certain USSD codes locally without forwarding to the HLR or an external gateway. Local handling is used for:

  • Supplementary service activation/deactivation codes (CFU, CFB, CFNR, CFNRC, CLIP, CLIR, Call Barring, Call Waiting) using the standard MMI format defined in 3GPP TS 22.030
  • Operator-defined diagnostic codes handled internally by the MSC

When a USSD string matches a locally handled service code, the USSD Handler routes it to the SS Handler or the appropriate internal module. The response is sent directly to the UE without MAP signaling.

For codes in the operator-defined range (100-199), the USSD Gateway module routes the request to an external USSD gateway if one is configured, or rejects the request if no gateway is available.


Easter Egg: System Diagnostic Menu

OmniMSC includes a hidden diagnostic menu accessible by dialing *#6664# (which spells *#OMNI# on a phone keypad). The MSC recognizes several keypad variants of this code and responds with an interactive USSD menu.

The main menu provides the following options:

KeyMenu ItemInformation Displayed
1System StatusUptime, registered subscribers, active connections, active calls, memory usage, scheduler count
2VLRRegistered subscriber count, active LU FSMs, active Auth FSMs
3Active CallsCount and summary of active calls (direction, calling/called numbers)
4SS7 StackSCCP connection count, TCAP transaction count, pending paging requests
5BEAM VMProcess count/limit, run queue depth, reduction count, memory breakdown (total, ETS, binary)
6AboutOmniMSC version info, OTP release, Omnitouch Network Services branding
9Sales EnquiryContact information
0ExitEnds the session

Each submenu displays a "0. Back" option that returns to the main menu. The diagnostic data is gathered from live system metrics at the time of the request.

The easter egg is handled entirely within the MSC without any MAP signaling. The USSD Handler detects the magic code, routes it to the EasterEgg module, and manages the multi-step menu dialogue using network-initiated unstructuredSS-Request messages to the UE.


USSD Codec

The USSD codec handles encoding and decoding of USSD protocol elements per 3GPP TS 24.080 and TS 24.090.

Facility IE Structure

The Facility IE (tag 0x1C) wraps an ASN.1 BER-encoded component:

Component TypeASN.1 TagUsage
Invoke0xA1Carries a request (processUnstructuredSS-Request, unstructuredSS-Request, unstructuredSS-Notify)
ReturnResultLast0xA2Carries a response (processUnstructuredSS-Response, unstructuredSS-Response)

Each component contains an invoke ID, an operation code, and an optional parameter SEQUENCE with the USSD data coding scheme and USSD string.

MAP Operation Codes

OpcodeOperationDirection
59processUnstructuredSS-RequestMO: UE → MSC → HLR
60unstructuredSS-RequestMT: HLR → MSC → UE (interactive menu step)
61unstructuredSS-NotifyMT: HLR → MSC → UE (notification, no response expected)

GSM 7-bit Encoding

USSD strings are encoded using the GSM 7-bit default alphabet defined in 3GPP TS 23.038. Each character is represented as a 7-bit septet, and septets are packed into octets (8 septets fit into 7 bytes). The data coding scheme byte (DCS=0x0F) indicates GSM 7-bit encoding.

For strings requiring characters outside the GSM 7-bit alphabet, UCS-2 encoding (DCS=0x48) is used, where each character occupies two bytes in big-endian UTF-16.

The maximum USSD string length is 182 characters for GSM 7-bit encoding (160 bytes packed) or 80 characters for UCS-2 (160 bytes).


SS REGISTER and RELEASE COMPLETE Message Flow

USSD sessions use the Supplementary Service (SS) message types defined in 3GPP TS 24.010:

MessageDirectionPurpose
REGISTERUE → MSCInitiates a new SS transaction. Contains a Facility IE with the USSD request.
FACILITYBothCarries mid-session data (interactive menu steps). Used for multi-step USSD dialogues.
RELEASE COMPLETEBothEnds the SS transaction. May contain a Facility IE with the final response.

A simple USSD request-response uses REGISTER (from UE) followed by RELEASE COMPLETE (from MSC). An interactive multi-step session uses REGISTER, then one or more FACILITY exchanges, then RELEASE COMPLETE.

The session has a configurable guard timeout (default 30 seconds). If neither the UE nor the gateway responds within this window, the MSC terminates the session with RELEASE COMPLETE.


References

SpecificationTitleRelevance
TS 24.090Unstructured Supplementary Service Data (USSD)USSD procedures, session management
TS 29.002 Section 14MAP Specification - Supplementary service operationsMAP processUnstructuredSS-Request (opcode 59), unstructuredSS-Request (opcode 60), unstructuredSS-Notify (opcode 61)
TS 24.080Mobile radio interface layer 3 SS specification - Formats and codingFacility IE structure, component encoding
TS 23.038Alphabets and language-specific informationGSM 7-bit default alphabet, septet packing
TS 22.030Man-Machine Interface (MMI)Service code format, USSD string syntax
TS 24.010Mobile radio interface layer 3 SS specification - General aspectsREGISTER, FACILITY, RELEASE COMPLETE message types