USSD are widely used for communicating with mobile operators: receiving information about balance, prepaid minutes or megabytes left. They were introduced in 1990's and a way they are accessed remains the same. Every time when user wants to know his balance he has to enter unintuitive code to get a message for a short period of time. USSD-widget introduces new usage pattern, which minimizes number of actions needed to make a query to bare minimum, which allows better balance control. This is useful because mobile operators tend to steal money in a hope that users won't notice it.

What this project brings

This project is intended to run on n900 and consists of two packages: USSD4all and USSD-widget. First one provides GUI and CLI interfaces for making USSD queries. The main innovation of this package is that it provides easy to use API for third-party applications and has proper locking infrastructure for excluding interference between applications which make use of USSD.
As far as USSD implementation from NOKIA in PR 1.2 is similar to any other phone and is intended to be the only application which works with USSD it interferes with any third-party application. USSD4all disables problem GUI part of that implementation and brings more permissive one. I hope one day it would be unneeded.
USSD-widget is a desktop widget, that makes user-defined queries on demand or on timer, filters them from SPAM, extracts valuable information, shows it on desktop and sends to other applications (for example to logger). It also can repeat failed queries, which is useful for areas with poor network coverage (underground trains for example). So if user wants to know his balance he only needs to make a glance on his desktop, he does not even need to press anything.


USSD codes used by operators can be divided in-to two groups:
  • Rarely used codes. Usually they activate various services. Every time you need another service, so different code is needed. Traditional approach suits well.
  • Codes used to get information and activate services, which are used every day. It is very convenient to have information ready on your desktop and to have buttons for these services. USSD-widget supports dynamic theming via DBus interface, which allows to have widget of different color, depending on service status. Some operators allows you to have several phone numbers on one SIM and switch between them with USSD codes. In such case you can have a button per number and active number would be highlighted.
    Even if your usage pattern doesn't match USSD-widget capabilities you still can automate your workflow with USSD4all in any scripting language.
  • Principal scheme

    The application consists of four modules: (CLI utility for making queries), qussd (traditional GUI (I would highly like to make buttons bigger, but current QT does not support buttons with height other than 72 px.)), USSD-widget (desktop widget) and ussdd (daemon, which listens for incoming USSD sessions and, if there is no application waiting for it, launches qussd).
    During testing period people complained, that many mobile operators add SPAM to USSD replies, so USSD-widget makes use of regular expressions to extrude valuable information from replies. Some operators prefer to return answer via SMS instead of USSD replies. This case can be handled by USSD-widget too.


    As far as there is only one GSM module USSD sessions must be queued. USSD4all ensures, that two application do not make queries simultaneously and that queries from one application won't be sent inside other application's session. The only weak place is network originated queries. Due to lack of needed notifications lock would be acquired after query is received. Theoretically this is a race condition. In practice network originated USSD sessions are rarely used (Current n900 phone implementation does no use USSD4all, so it's sesions would be threated as network originated). So this chance can be neglected or modem software (which i have no access to) could be extended.

    Additional documentation

    For additional information refer to USSD-widget homepage.