comparison doc/Proto-SMSC-testing @ 15:ce6bcb84ca30

doc/Proto-SMSC-testing: document written
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 27 Aug 2023 21:47:19 -0800
parents
children 1c0773eba65e
comparison
equal deleted inserted replaced
14:d9db8661d9f3 15:ce6bcb84ca30
1 The present code repository contains a proto-SMSC test framework: a pair of
2 programs that connect to OsmoHLR in the role of a GSUP-speaking SMSC and allow
3 the rest of SMS-over-GSUP path to be exercised and tested.
4
5 To exercise SMS flow between an MS and the present proto-SMSC, set up your test
6 environment as follows:
7
8 0) Locate branch falconia/os6135 in osmo-hlr and osmo-msc git repositories;
9 compile and run osmo-hlr and osmo-msc versions from this branch.
10
11 1) Configure OsmoHLR to expect an SMSC at a certain IPA name, and to route
12 MO SMS to this SMSC. Example config:
13
14 hlr
15 reject-cause not-found plmn-not-allowed
16 reject-cause no-proxy net-fail
17 gsup
18 bind ip 127.0.0.1
19 ipa-name Example-HLR
20 ussd route prefix *#100# internal own-msisdn
21 ussd route prefix *#101# internal own-imsi
22 smsc entity Example-SMSC
23 smsc route 19990014444 Example-SMSC
24
25 In this example the SMSC is operated at SC-address (fake Global Title)
26 +19990014444 (a number falling into a reserved/invalid range in the North
27 American Numbering Plan), with IPA name Example-SMSC, and you are configuring
28 OsmoHLR to map this SC-address to this IPA name. SM-RP messages addressed to
29 any other SMSC will be rejected - a user trying to send something to a
30 commercial operator's SMSC will get an error during SMS send attempt, instead
31 of her message being sneakily intercepted and diverted to Example-SMSC.
32
33 OTOH, if you prefer to operate your network in a guest roaming manner, allowing
34 foreign SIMs without an actual roaming interconnection in place, and you wish
35 to operate so that all such guest-roaming users will send their MO SMS to your
36 SMSC while their phones "think" that they are addressing their native operator's
37 SMSC, change the last line to:
38
39 smsc default-route Example-SMSC
40
41 2) Ensure that your OsmoMSC configuration includes the following bits:
42
43 msc
44 sms-over-gsup
45 hlr
46 ipa-name Example-MSC
47
48 The sms-over-gsup bit should be obvious, but the need for an explicitly set
49 ipa-name is much less so. The explicitly set ipa-name doesn't matter for MO
50 SMS, but it is needed for MT SMS to work. When an MT-forwardSM.req message
51 arrives at the MSC from an SMSC, routed via OsmoHLR, the MSC will need to
52 respond to it, and this response needs to reach the MT-sending SMSC. These
53 responses are routed passively by OsmoHLR, and for this passive routing to work,
54 the sender of the response message needs to include source_name IE. Thus
55 explicitly set ipa-name for the MSC becomes a requirement, just like with
56 inter-MSC handover.
57
58 3) Run proto-smsc-daemon like this:
59
60 proto-smsc-daemon Example-SMSC mo-sms-log /tmp/sendmt_socket
61
62 The first argument is the IPA name this proto-SMSC should give itself (needs to
63 match OsmoHLR config), the second argument is the name of a log file that will
64 be opened for writing, and the third argument is the pathname to which a local
65 UNIX domain socket will be bound.
66
67 Any time an MS sends MO SMS to this proto-SMSC, the message will be written
68 into the line-oriented log file which you named as the second argument to
69 proto-smsc-daemon. Here is what messages will look like:
70
71 2023-08-25T23:53:01Z Rx MO SM
72 IMSI: 310xxxxxxxxxxxx
73 SM-RP-MR: 0x03
74 SM-RP-DA: SMSC TON=1 NPI=1 1xxxxxxxxxx
75 SM-RP-OA: MSISDN TON=1 NPI=1 1xxxxxxxxxx
76 SM-RP-UI: 13 bytes
77 010304814444000004D4F29C0E
78
79 ('x' characters in the above fragment are [0-9] digits in reality, but the
80 numbers had to be redacted out for privacy, as the test was done on a live
81 network that operates with real NANP phone numbers.)
82
83 The string of hex digits that makes up the final line of each recorded message
84 is the GSM 03.40 SMS-SUBMIT TPDU that has been received from the MS in the
85 SM-RP-UI field. proto-smsc-daemon writes it out in raw hex, but you can get a
86 complete decoding by feeding this log file to sms-pdu-decode utility from
87 freecalypso-tools Hg repository. You will need to run sms-pdu-decode with -n
88 option so it will know not to expect a prepended SC-address in front of the TPDU
89 (as happens in GSM 07.05), and you will need to compile from "bleeding edge" Hg
90 code: the addition of this option has not made it into a release yet.
91
92 Running the above log fragment through sms-pdu-decode -np, we get the following
93 decoding:
94
95 2023-08-25T23:53:01Z Rx MO SM
96 IMSI: 310xxxxxxxxxxxx
97 SM-RP-MR: 0x03
98 SM-RP-DA: SMSC TON=1 NPI=1 1xxxxxxxxxx
99 SM-RP-OA: MSISDN TON=1 NPI=1 1xxxxxxxxxx
100 SM-RP-UI: 13 bytes
101 010304814444000004D4F29C0E
102
103 First-Octet: 0x01
104 MR: 0x03
105 To: 4444 (type 0x81)
106 PID: 0x00
107 DCS: 0x00 (7-bit)
108 Length: 4
109
110 Test
111
112 4) To test MT SMS, you will need to compile and install this additional sw
113 package (very small):
114
115 https://www.freecalypso.org/hg/sms-coding-utils/
116
117 To send a test MT SMS, run a shell pipeline like the following:
118
119 sms-encode-text 'Message text blah blah' | gen-sms-deliver-pdu 1234 | proto-smsc-sendmt 19990014444 310999-001 /tmp/sendmt_socket
120
121 The various bits are:
122
123 * The argument to sms-encode-text is the human-level message body to be sent.
124 One can also omit this command line argument and supply the message body on
125 stdin instead.
126
127 * The argument to gen-sms-deliver-pdu is the "From" number to be inserted into
128 the SMS-DELIVER TPDU being generated.
129
130 * The first argument to proto-smsc-sendmt is the SC-address to be transmitted
131 in SM-RP-OA. This SMSC address is passed through to the MS, and savvy users
132 of hacker-friendly MS can see it: it is written into SIM SMS storage which
133 can then be read out and decoded, it can be retrieved via GSM 07.05, plus
134 other MS-specific options like /pcm/SMS on Pirelli DP-L10 running that phone's
135 original proprietary fw.
136
137 * The second argument to proto-smsc-sendmt is the IMSI to which the message
138 should be sent. (Key point: MT SMS recipients in SMS-over-GSUP are addressed
139 by IMSI, not by MSISDN!) proto-smsc-sendmt supports FreeCalypso shorthand
140 notation for IMSI entry: 310999-001 in this example expands into
141 310999000000001. Of course you can also enter the full IMSI manually, if you
142 don't mind torturing your eyes counting all those zeros.
143
144 * The third argument to proto-smsc-sendmt is the local UNIX domain socket to
145 which the composed GSUP message should be sent; it needs to match the socket
146 pathname you gave to proto-smsc-daemon.