blob: 6100c93794606be85141893288bb75610e8fb0b4 [file] [log] [blame]
Harald Welteb41394a2018-08-06 22:18:33 +02001[[ussd]]
2== Unstructured Supplementary Services Data (USSD)
3
4The _Unstructured Supplementary Services Data (USSD)_ is one service within
52G/3G networks next to other services such as circuit-switched voice, packet-switched
6data and SMS (Short Message Service).
7
8It is on an abstract level quite similar to SMS in that USSD can be used to send
9textual messages. However, there are the following differences:
10
11* USSD is between the MS (phone) and an USSD application on the network, while
12 SMS is primarily between two subscribers identified by their MSISDN
13* USSD is faster, as it doesn't suffer from the complicated three-layer CP/RP/TP
14 protocol stack of SMS with it's acknowledgement of the acknowledged acknowledgement.
15* USSD is session-oriented, i.e. a dialogue/session between subscriber and application
16 can persist for the transfer of more than one message. The dedicated radio channel
17 on the RAN remains established throughout that dialogue.
18
19=== USSD in Osmocom
20
21Until August 2018, OsmoMSC contained some minimalistic internal USSD
22handling with no
23ability to attach/extend it with external USSD applications.
24
25From August 2018 onwards, OsmoMSC doesn't contain any internal USSD
26handlers/applications anymore. Instead, all USSD is transported to/from
27OsmoHLR via the GSUP protocol.
28
29OsmoHLR contains some intenal USSD handlers and can route USSD messages
30to any number of external USSD entities (EUSEs). The EUSE also use GSUP
31to communicate USSD from/to OsmoHLR.
32
33Each EUSE is identified by its name. The name consists of a single-word
34string preceding a currently fixed ("-00-00-00-00-00-00") suffix.
35There is no authentication between EUSE and OsmoHLR: Any client program
36able to connect to the GSUP port of OsmoHLR can register as any EUSE
37(name).
38
39NOTE:: We plan to remove the requirement for this suffix as soon as we
40are done resolving all more important issues.
41
42=== USSD Configuration
43
44USSD configuration in OsmoHLR happens within the `hlr` VTY node.
45
46`euse foobar-00-00-00-00-00-00` defines an EUSE with the given name `foobar`
47
48`ussd route prefix *123 external foobar-00-00-00-00-00-00` installs a
49prefix route to the named EUSE. All USSD short codes starting with *123 will be
50routed to the named EUSE.
51
52`ussd route prefix *#100# internal own-msisdn` installs a prefix route
Vadim Yanitskiy66f0b5f2020-11-17 18:27:21 +070053to the named internal USSD handler. The above command will restore
Harald Welteb41394a2018-08-06 22:18:33 +020054the old behavior, in which *#100# will return a text message containing
Vadim Yanitskiy6cfef3a2020-11-17 18:47:33 +070055the subscribers own phone number. More information on internal USSD
56handlers can be found in <<iuse_handlers>>.
Harald Welteb41394a2018-08-06 22:18:33 +020057
58`ussd default-route external foobar-00-00-00-00-00-00` installs a
59default route to the named EUSE. This means that all USSD codes for
60which no more specific route exists will be routed to the named EUSE.
61
Vadim Yanitskiy6cfef3a2020-11-17 18:47:33 +070062[[iuse_handlers]]
63=== Built-in USSD handlers
64
65OsmoHLR has an Internal USSD Entity (IUSE) that allows to handle some
66USSD requests internally. It features a set of simple handlers, which
67can be assigned to one or more USSD request prefixes:
68
69* `own-msisdn` returns subscriber's MSISDN (if assigned);
Vadim Yanitskiydac855e2020-11-17 04:17:46 +070070* `own-imsi` returns subscriber's IMSI;
71* `test-idle` keeps the session idle until the MS terminates it, or
72 the guard timer expires (may be useful for testing).
Vadim Yanitskiy6cfef3a2020-11-17 18:47:33 +070073
74Additional handlers can be added on request.
75
Harald Welteb41394a2018-08-06 22:18:33 +020076=== Example EUSE program
77
78We have provided an example EUSE developed in C language using existing
79Osmocom libraries for GSUP protocol handling and USSD encoding/decoding.
80It will register as `foobar` EUSE to OsmoHLR on localhost. You can run
81it on a different machine by specifying e.g. `osmo-euse-demo 1.2.3.4 5678`
82to make it connect to OsmoHLR on IP address 1.2.3.4 and GSUP/TCP port
835678.
84
85The idea is that you can use this as a template to develop your own USSD
86applications, or any gateways to other protocols or interfaces.
87
88You can find it in `osmo-hlr/src/osmo-euse-demo.c` or online by
89following the link to http://git.osmocom.org/osmo-hlr/tree/src/osmo-euse-demo.c
90
91This demonstration program will echo back any USSD message sent/routed
92to it, quoted like _You sent "..."_.