1GSM-USSD(1) User Contributed Perl Documentation GSM-USSD(1)
2
3
4
6 gsm-ussd - Send USSD queries by GSM/UMTS modem
7
9 gsm-ussd --help|-h|-?
10 gsm-ussd [-m <modem>] [-t <timeout>] [-p <pin>] [-d] [-l <logfile>] [<ussd-cmd>...]
11 gsm-ussd [-m <modem>] [-t <timeout>] [-d] [-l <logfile>] --cancel|-c
12
14 This script sends a USSD query to a modem, waits for the answer and
15 displays it. The modem type is detected and any necessary en-/decoding
16 and error checking is done.
17
19 --modem|-m <modem>
20 Sets the device file to use to connect to the modem. Default is
21 "/dev/ttyUSB1".
22
23 Please note: Depending on your modem's make and model, you might
24 get more than one serial USB interfaces when connecting the modem!
25 For example, the Huawei E160 gets two: "/dev/ttyUSB0" and
26 "/dev/ttyUSB1". The first is for data, commands and state messages
27 use the second port.
28
29 --timeout|-t <timeout_in_secs>
30 The timeout in seconds that the script will wait for an answer
31 after each command sent to the modem. Default is 20 seconds.
32
33 --pin|-p <PIN>
34 The SIM PIN to use if the card is still locked. This is typically
35 the case just after the modem got stuck into your computer.
36 Attention: The SIM PIN can be seen in the process list as long as
37 the script is running - use with care on multi user systems!
38 Attention again: If you are using a shell with a command line
39 history, your SIM PIN will be stored there for a while in clear.
40
41 --cleartext|-c
42 This option causes gsm-ussd to send USSD queries in cleartext, i.e.
43 without encoding them into a 7bit-packed-hex-string, as is needed
44 for Huaweis E160* series of UMTS modems. This takes precedence
45 before any detected modem type.
46
47 --no-cleartext
48 This is the opposite of the previous option: Use encoding, even if
49 the modem type does not indicate that it is needed. This
50 (obviously) takes precedence before any detected modem type.
51
52 --cancel|-c
53 Aborts an active USSD session. USSD sessions are queries for more
54 information by the provider; they can take the form of simple menus
55 with numbers to choose the menu entries or a query to enter a top
56 up code.
57
58 --help|-h|-?
59 Shows the online help.
60
61 The following options aren't meant for everyday usage, but as
62 diagnostic aids in development or for the pathologically curious.
63 Please be reminded again that any logs or debugging output will show
64 your PIN if you're using option "--pin <PIN>"! So use with care.
65
66 --logfile|-l <logfilename>
67 Writes the chat between modem and script into the named log file.
68 Useful to look for unexpected modem answers (or expected modem
69 answers that nevertheless weren't handled correctly). Clearly more
70 a debugging help than anything else.
71
72 --debug|-d
73 Switches debug mode on. The script will then explain its actions
74 and their results in high detail.
75
77 A USSD query is a "phone number" starting with "*" and ending with "#"
78 which let's you do interesting things in a GSM network. By default, if
79 you don't specify any USSD query, "*100#" will be used, which causes
80 all GSM network providers known to me to provide the balance of your
81 prepaid account.
82
83 If you enter more than one USSD query, they will be sent in order and
84 the result of each on its own line.
85
86 Please note: USSD queries are different for each provider!
87
88 List of interesting things:
89
90 • German Telecom/D1 (congstar)
91
92 • *100#
93
94 Show prepaid account balance.
95
96 • *101*cashcode#
97
98 Top up your prepaid account with a "Cashcode" (top up code).
99 Please note that a cash code consists only of numbers! Dashes
100 in your cash code are simply used for readability, don't enter
101 them. Use only the numbers.
102
103 • *135#
104
105 Displays your own phone number.
106
107 • Vodafone/D2
108
109 • *100#
110
111 Show prepaid account balance.
112
113 • *102#
114
115 Displays costs of your last connection.
116
117 • O2 (Tchibo, FONIC, ...)
118
119 • *100#
120
121 O2/Tchibo-Mobile: A menu with further options. This will start
122 an USSD session.
123
124 • *101#
125
126 Show prepaid account balance.
127
128 • *102#
129
130 Prepaid account validity.
131
132 • *103*topupcode#
133
134 Topping up your prepaid account. Please note that a top up code
135 consists of numbers only! Dashes in your top up code are
136 simply used for readability - don't enter them. Use only the
137 numbers.
138
139 Sending '*103#' without a top up code will start a USSD session
140 asking for the code.
141
142 • E-Plus & Resellers
143
144 • *100#
145
146 Show prepaid account balance.
147
148 • *104*cashcode#
149
150 Top up your prepaid account with a "Cashcode" (top up code).
151 Please note that a cash code consists only of numbers! Dashes
152 in your cash code are simply used for readability, don't enter
153 them. Use only the numbers.
154
155 This works for the E-Plus net, not only for the E-Plus
156 provider. So you can use this USSD query for E-Plus resellers
157 (AldiTalk, Simyo, Blue, ...) too.
158
160 "gsm-ussd(1)" sets its exit code as follows:
161
162 • 0 - Successful USSD query
163
164 • 1 - SIM is locked, PIN needed
165
166 • 2 - Wrong PIN given, SIM still locked
167
168 • 3 - No net registration
169
170 • 4 - Error ocurred (Timeouts etc.)
171
172 • 10 - Bug in program. This exit code should never be seen.
173
175 Jochen Gruse, <mailto:jochen@zum-quadrat.de>
176
177
178
179perl v5.34.0 2022-01-20 GSM-USSD(1)