Years ago, when I worked selling SIM cards, I regularly used a command to activate the starting balance:
*101*1111#
Back then, it was just another routine task. Now, as someone studying software development, I find myself looking at the same process from a completely different perspective.
What happens behind those few characters? Where does the request go? What happens if something breaks along the way?
To explore these questions, I built a simplified experimental model using Node.js, Express, and Termux on my Android smartphone.
1. What is USSD?
USSD stands for Unstructured Supplementary Service Data. It allows mobile devices to exchange messages with services provided through a mobile network.
Unlike an ordinary HTTP request, USSD relies on mobile network signalling mechanisms.
My experiment does not implement the actual telecommunications protocol. Instead, it uses HTTP to explore the more general principles of request routing, separation of responsibilities, and failure handling.
2. Building an experimental model
My application consists of three separate components:
- Client: sends a command and receives a response.
- Gateway: forwards the request and handles communication failures.
- Application server: validates, parses, and processes the command.
The request follows this path:
Client → Gateway → Application Server
The response travels in the opposite direction.
Why separate these responsibilities?
Think of shelves in a wardrobe. One holds notebooks, another holds clothes, and another holds SIM cards. Each shelf has its own purpose.
Software components can follow a similar principle, known as Separation of Concerns.
3. Validation, parsing, and routing
The application server performs three operations:
- Validation: checks whether the command matches the expected format.
- Parsing: extracts the service code and its parameter.
- Routing: selects a simulated operation based on the service code.
For example, the command *101*1111# is parsed into service code 101 and parameter 1111.
These are interpretations within my experimental model, not verified descriptions of the operator's internal implementation.
The application returns a simulated response:
Balance activated
No real balance is activated.
4. Experimental results
I tested several scenarios by sending different commands and deliberately stopping individual components.
| Experiment | HTTP status | Result | Duration |
|---|---|---|---|
| Valid command | 200 | Balance activated | 1238 ms |
| Invalid format | 400 | Invalid USSD format | 609 ms |
| Unknown service | 200 | Unknown service | 532 ms |
| Application server stopped | 502 | Application server unavailable | 618 ms |
| Gateway stopped | No response | fetch failed | Not recorded |
I also repeated the successful request multiple times. Six recorded measurements were available for analysis:
- Minimum: 516 ms
- Maximum: 576 ms
- Mean: 545.5 ms
- Median: 542.5 ms
These measurements describe my local experimental environment, not real mobile network performance.
5. What happens when a server goes out to buy bread?
Imagine that the application server is an employee and the gateway is a receptionist.
If the employee goes out to buy bread, the receptionist can still tell a customer that the employee is unavailable.
In my experiment, this produced a 502 Bad Gateway response.
But what if the receptionist goes out to buy bread instead?
There is nobody available to answer the customer's call.
When I stopped the gateway, the client received a network error:
fetch failed
There was no HTTP status code because no HTTP response was received.
The location of a failure matters.
6. Why HTTP 200 does not always mean business success
Imagine a bakery with a sign saying that bread is available.
However, that does not guarantee that the bakery has exactly what you want: a loaf, a baguette, or a bagel.
Something similar happened in my experiment.
Both a successful command and a command requesting an unknown service returned HTTP 200.
However, their response messages were different:
- Balance activated
- Unknown service
In this particular API implementation, the HTTP status alone was not sufficient to determine whether the requested business operation had succeeded.
A different API might represent an unknown service using a 4xx status instead.
Developers need to understand both the HTTP response and the API contract.
7. Limitations
This experiment uses a simplified HTTP-based model rather than an actual USSD implementation.
It does not reproduce mobile network signalling, subscriber authentication, billing systems, or the internal infrastructure of a telecommunications operator.
The command parser supports only a limited format, and its parameter does not affect the simulated operation.
The latency measurements are exploratory and cannot support conclusions about telecommunications network performance.
Conclusion
When I worked selling SIM cards, entering a USSD command seemed like a simple everyday operation.
Looking at it from a software developer's perspective helped me discover a more interesting problem: how independent components communicate, distribute responsibilities, and handle failures.
This small experiment taught me to distinguish between network failures, HTTP responses, and business operation results.
Sometimes an ordinary action that takes only a few seconds hides an interesting engineering problem.
Part of The Curious Developer series — exploring software engineering through everyday experiences and practical experiments.
AI disclosure: AI assistance was used for technical review, editing, and English translation. The experiments were executed by the author.
Top comments (0)