WORKINGCHAPTER 12

Voice and SMS: circuit-switched, VoLTE and the SMSC

A call and a text are not data. Voice is a reserved circuit or an IMS session with its own quality flow; a text waits in a server until the phone can take it

45 MINHOW MOBILE NETWORKS WORKUPDATED 2026-11-13
PREDICT

A phone is on a voice call on a 5G standalone network with voice over new radio (VoNR). Which of these carries the voice packets?

Chapter 1.4 followed a call, a text and a data session from the outside. This chapter opens the two that are not data. Both have older forms that still carry traffic in Nigeria and everywhere else, so you meet three generations of each: the circuit-switched form (2G and 3G), the fallback forms that let a 4G phone borrow it, and the IMS form (4G and 5G). The lab carries data only, so the live part is small. You read the voice session in a trace and build a text by hand.

Circuit-switched voice: a path held for the call

On 2G and 3G a voice call used the circuit-switched (CS) core. When a call is set up, the network reserves a channel on the radio side and a timeslot in the core, and holds both until someone hangs up, even through silence. In the core, speech moved as 64 kbit/s timeslots. On the radio side the phone’s codec cut your voice into 20 ms frames; the narrowband AMR codec makes 12.2 kbit/s at its top mode (3GPP TS 26.071).

Three pieces do the work. The MSC (mobile switching centre) connects calls and pages phones. The VLR (visitor location register) is the MSC’s short-term list of the phones in its area; it sits beside the MSC. The GMSC (gateway MSC) is the MSC where calls from other networks enter. A call to a mobile number reaches the GMSC and then finds the phone in four steps:

  1. The call arrives at the GMSC as an ISUP initial address message, the circuit-call signalling of the SS7 family.
  2. The GMSC asks the HLR (home location register, the 2G and 3G subscriber database) where the subscriber is. The operation is the MAP message SendRoutingInfo.
  3. The HLR asks the VLR that serves her for a temporary roaming number and returns it.
  4. The GMSC routes the call to the MSC that owns that number. The MSC pages the phone in its location area, the phone answers, a channel is assigned, and the phone rings.

You do not need the message names yet. The Signalling chapter of this module covers MAP and ISUP, and the module 3 chapter on interconnect covers how calls cross between networks.

The strength of this design is that it is simple and has no dependency on data. A call needs a signal and nothing else. The weakness is that it is a whole second network: switches, links, a radio layer in spectrum that could carry data, and nothing on it but voice. That is why operators want to switch 3G off, as chapter 1.5 (2G to 5G) set out.

Circuit-switched fallback: borrowing the old network

A 4G core has no circuit-switched part, and the first 4G networks had no IMS. A phone on 4G still had to make calls. The answer was CS fallback, defined in 3GPP TS 23.272. A new interface called SGs joins the MME (the 4G control function that tracks the phone) to an MSC. The phone does a combined attach: it registers with the MME for data and, through it, with the MSC for voice.

  • A call from the phone. The phone sends an Extended service request to the MME. The MME tells the cell to move the phone to 2G or 3G, by handover or by redirection. The phone sets up the call there, as in the previous section.
  • A call to the phone. The MSC sends a page to the MME over SGs. The MME pages the phone on 4G. The phone answers with the same Extended service request and is moved the same way.

Name what goes wrong. The call takes longer to set up, because the phone changes network first. While it is on 2G or 3G, its data session runs at that network’s speed or is suspended. When the call ends the phone has to find its way back to 4G, and some do not return until they next go idle. And the operator has to keep the 2G or 3G layer alive in every area where 4G phones live, which defeats the aim of switching it off.

Texts have a gentler version. SMS over SGs carries a text between the phone and the MSC through the MME, in NAS, without moving the phone off 4G. It is defined in the same specification, TS 23.272.

Voice over IMS: VoLTE and VoNR

IMS (IP multimedia subsystem) is the voice core for 4G and 5G. It is a set of servers that speak SIP (session initiation protocol) and sit on top of the data network. The phone reaches them through a data session, and its voice is IP packets. On 4G this is VoLTE (voice over LTE); on 5G standalone it is VoNR (voice over new radio). The main servers are:

  • P-CSCF (proxy call session control function): the phone’s entry point. Every SIP message to and from the phone passes through it.
  • I-CSCF (interrogating) and S-CSCF (serving): the I-CSCF finds the right S-CSCF; the S-CSCF registers the phone and runs the call.
  • An application server, the telephony service that does call forwarding, barring and the other features of a phone line.
  • The HSS (home subscriber server), which also holds the IMS part of the subscription and talks to the CSCFs over a Diameter interface called Cx.

That last point is visible in the lab. In the Diameter capabilities answer in traces/s6a.pcapng, the lab’s HSS lists Diameter applications 16777216, 16777251 and 16777265 (and a relay entry). The second is S6a, which you use in the Subscriber databases chapter. The first is Cx, the IMS interface; the third is SWx, used for non-3GPP access. The HSS software is ready for an IMS; the lab has none to ask it.

What the phone does first

Three things happen before the first call.

1. A second data session. Alongside its internet session the phone opens one to a data network named ims. Its subscription must allow that: the lab’s subscriber.sh add-ims adds it. The network’s Registration accept also tells the phone whether voice over this network is supported, in a flag called IMS VoPS (voice over packet-switched session). A phone that sees “not supported” does not register for voice here.

2. Find the P-CSCF. The phone needs the P-CSCF’s address. There are three ways. It asks in its session request, in the protocol configuration options (PCO), by including the container for a P-CSCF address (container 0x000C in TS 24.008); the SMF puts the address in the accept. It can be given one by DHCP. Or it builds a DNS name from its own IMSI, in the form ims.mnc070.mcc999.3gppnetwork.org for the lab’s 999/70 (TS 23.003), and resolves that. A phone that does none of these cannot register for voice.

3. SIP REGISTER. The phone sends a REGISTER through the P-CSCF. The S-CSCF asks the HSS for an authentication vector and answers 401 Unauthorized with a challenge. The phone’s SIM computes the response with the same secret key K that authenticated it to the radio network (see the SIM; on a phone with an ISIM application the key sits in that application), and the phone sends REGISTER again. A 200 OK completes it. This is IMS-AKA, the same mechanism as before, running at a second layer.

A call is then a SIP INVITE. The called side rings and answers; between the two, the phone and the network agree what voice quality they need, and the voice itself flows as RTP packets, one for each 20 ms frame, about 50 a second. The Voice and Real-Time Communications course owns SIP, RTP and call quality; this chapter stops where SIP starts.

The quality flows

Voice must not sit in the same queue as a download. Each flow in a session carries a 5QI (5G QoS identifier), a number that stands for a set of delay and loss targets (TS 23.501, table 5.7.4-1). Three matter here:

Flow 5QI Type Packet delay budget Carries
Default flow of the internet session 9 Non-GBR 300 ms Web, apps, everything else
Default flow of the ims session 5 Non-GBR 100 ms SIP signalling
Conversational voice 1 GBR 100 ms Voice packets (RTP)

GBR means guaranteed bit rate: the network reserves capacity for the flow and refuses the call if it cannot. Non-GBR flows share what is left. The 5QI 1 flow does not exist when the session opens. During call set-up the P-CSCF tells the PCF (policy control function) what the call needs; the PCF tells the SMF; the SMF tells the UPF over PFCP and the phone over NAS. The session’s own AMBR (aggregate maximum bit rate) limits only the non-GBR flows, so it does not cap the voice. The Mobile data chapter covers QoS flows and policy in depth. You will see the first half of this in the lab: the ims session with its 5QI 5 flow. The 5QI 1 flow is not there, because no call is made.

Phoneone SIMCellUPF10.33.0.7Data networkinternet, 10.34.0.80IMS serversP-CSCF and the restinternet session (PSI 1)5QI 9 · phone gets 10.45.0.xims session (PSI 2)5QI 5: SIP · phone gets 10.46.0.xadded during a call: 5QI 1, voicenot in the lab: no IMS, no call

5G voice and what happens when it is missing

VoNR needs 5G standalone with IMS behind it. If the cell or the network does not support voice on 5G, the network can move the phone to 4G when a call starts. That is EPS fallback, and the voice runs as VoLTE. If 4G cannot carry voice either, the phone uses circuit-switched fallback to 2G or 3G. A call that starts on VoLTE and leaves 4G coverage while it is running can be handed to the circuit-switched network without breaking: SRVCC (single radio voice call continuity, TS 23.216). Each rung adds set-up time and has to be provisioned in the network and the phone. GSMA IR.92 lists what a VoLTE phone and network must support.

A text, three ways

An SMS reaches a phone by one of three roads, depending on what the network and the phone support:

SMS over SGs SMS over NAS SMS over IMS
Generation 4G, with a circuit core behind it 5G (the SMSF function) 4G and 5G
Phone to network NAS, to the MME NAS, to the AMF SIP MESSAGE through the P-CSCF
What carries it on MME to MSC over SGs AMF to the SMSF (SMS function) IP-SM-GW (a gateway)
Needs IMS? No No Yes
Needs a circuit core? Yes No No
In the lab No No (see step 2) No

All three end at the same place: the SMSC (short message service centre). It follows the rule chapter 1.4 gave: texts are stored, not streamed. Two flows matter.

A text from a phone (mobile-originated). The phone sends the message to the SMSC’s address, which it reads from a file on its SIM (EF-SMSP; the SIM describes what else the card holds) or from a setting. The SMSC accepts it and returns a receipt, so the sender’s phone shows “sent”.

A text to a phone (mobile-terminated). The SMSC does not know where the phone is:

  1. It asks the subscriber database (HLR or HSS) where the subscriber is, with the MAP operation SendRoutingInfoForSM. The answer names the serving node: an MSC, an SGSN, an MME, an SMSF or an IP-SM-GW. The Diameter form of the same exchange is used in 4G.
  2. It sends the message to that node (MT-ForwardSM).
  3. The node pages the phone if it is idle and delivers the message. The phone’s acknowledgement travels back to the SMSC as a delivery report.
  4. If the phone cannot be reached, the SMSC keeps the message and the database remembers which SMSC is waiting. When the phone next registers, the database sends the SMSC an alert (AlertServiceCentre), and the SMSC tries again at once.

That fourth step is what Rahma’s text did not get. Without the alert the SMSC waits for its next scheduled retry. A message also does not wait for ever: the sender sets a validity period, from five minutes to 63 weeks, and the SMSC discards the message when it runs out (TS 23.040). The gateway roles that sit between the SMSC and the network, the SMS-GMSC for incoming texts and the SMS-IWMSC for outgoing ones, are built into the SMSC product in many networks. Messaging, a later course, owns SMS as a product and the protocol that applications use to hand texts to an SMSC (SMPP).

What a text is made of

An SMS is not a packet from the internet. It is a TPDU (transfer protocol data unit) defined in TS 23.040, with a header of a few octets and a payload of at most 140 octets. What fits in 140 octets depends on the alphabet:

  • GSM 7-bit packs each character in 7 bits, so 140 octets hold 160 characters. The alphabet is fixed by TS 23.038: the Latin letters, digits and common punctuation, a few accented letters and symbols. A few characters, such as [, { and the euro sign, take two positions.
  • UCS-2 uses 16 bits for every character, so 140 octets hold 70.

A phone uses 7-bit only if every character is in the alphabet. One character outside it switches the whole message to UCS-2. The naira sign is outside it. A confirmation that begins Recharge ₦500 OK can hold 70 characters, not 160, which doubles the number of messages for a long text. When a text is longer than one message, it is cut into parts, each with a six-octet header that lets the phone reassemble them; the parts hold 153 characters in 7-bit and 67 in UCS-2. You will count this in the lab. The cost for an operator that bills its own application traffic is real: for a long message, a sender who writes N500 instead of ₦500 roughly halves the parts.

Kolanut Mobile and its SMSC

In its launch year Kolanut Mobile runs one piece of this chapter. The NCC framework lets a Tier 1 operator run an SMSC, and gives it no switching and no intelligent network and no control of numberingas of 2026-11. So Kolanut’s SMSC sends its own messages: recharge confirmations, balance alerts, notices to its agents. It does not run the MSC, the IMS or the subscriber database. Core elements for switching and interconnection, the IMS, the MSC and the gateway MSC among them, come with Tier 3as of 2026-11. In the launch year all of that is Lumora Mobile’s.

Three consequences follow, and each is a place to look when something goes wrong.

  • Voice is Lumora’s, but the customer is Kolanut’s. If a batch of Kolanut SIMs has no IMS profile, calls fail while data works, the case chapter 1.4 opened with. Kolanut’s care team cannot fix it. It has to know to ask Lumora to check the subscription, and what to send: the symptom, the batch and a failing and a working SIM.
  • A text crosses a boundary. Kolanut’s SMSC hands its messages to Lumora’s network for delivery, and Lumora’s subscriber database is the one asked where the phone is. The retry schedule and validity period are Kolanut’s to set. Whether the database’s alert reaches Kolanut’s SMSC is a matter for the host agreement, because the alert goes to an address the host’s systems must be told to use. Module 1’s chapter on who does what asked who routes a text to a Kolanut number and who is told when it fails. Here is the second question again, with an answer: the SMSC owner sees the failure; the host’s database knows when the phone is back.
  • The SIM decides where phones send their texts. Phones read the SMSC address from the SIM. In the launch year the SIMs are Lumora’s. At Tier 2 Kolanut issues its own, and the address on them becomes a choice it makes with its host.

Where voice and texts go wrong

Symptom Likely place First check
Data works, every call fails at once No IMS session or profile; phone cannot register for voice The subscription: is ims allowed? Does the Registration accept say IMS VoPS supported?
Calls connect, but after a long delay; data slows during the call Circuit-switched fallback What share of calls use it, and why those phones do not use VoLTE
Call rings, no sound or one-way sound The voice flow or the media path A voice-quality problem; the Voice and Real-Time Communications course
A text arrives late The SMSC’s retry schedule, no alert from the database, or the phone was away The SMSC log: first attempt, failure reason, next retry
A text never arrives The validity period ran out, or the number or route is wrong The validity period and the delivery report
A short text counts as two A character outside the 7-bit alphabet Search the text for ₦, curly quotes and accents
The ims session is refused The subscriber is not provisioned for ims The AMF’s answer, as in the break at the end of the lab
LAB Open the voice session and build a text ~45 MIN
YOU NEEDDocker with Compose v2Python 3.9 or laterabout 2 GB of disk and 2 GB of free memorya Linux kernel with SCTP for step 5 only (Linux, or Docker Desktop; most cloud sandboxes lack it)the labs/telecoms folder

The lab has no IMS and no SMS function, so it cannot make a call or send a text. It can open the first thing a voice phone does: the ims data session. Steps 1 to 4 read that session from traces/ims-session.pcapng and work on any machine with Docker. Step 5 opens the session live and needs the 5G core, which needs SCTP. Steps 6 and 7 are Python and need nothing else. The break is live and has a trace you can read instead. Run everything from the labs/telecoms folder.

1. Find the second session (any machine).

cd labs/telecoms
scripts/ladder.sh traces/ims-session.pcapng | grep -E "dnn=ims|PDU session establishment|Registration accept"
The phone registers first: Registration accept at 9.734 s. The first PDU session request rides with Registration complete at 9.941 s, and its accept is at 10.234 s: the internet session. The phone’s ims request does not appear until 36.882 s. Its first attempt was dropped inside UERANSIM and never reached the wire; the phone’s T3580 timer resent it (the README lists this quirk). The SMF’s lookups at the UDM and the PCF now say dnn=ims instead of dnn=internet (37.019 s, 37.068 s and 37.319 s). The accept leaves the SMF at 37.520 s and reaches the cell at 37.543 s, 0.66 s after the request. Same functions, same ladder as the data session in chapter 1.4, with a different DNN.

2. What the network says about voice and texts (any machine).

docker run --rm -v "$PWD/traces:/t:ro" nicolaka/netshoot:v0.13 \
  tshark -r /t/ims-session.pcapng -o nas-5gs.null_decipher:TRUE \
  -Y 'nas-5gs.mm.message_type == 0x42' -V | grep -E "SMS over NAS|IMS VoPS|5G-GUTI"
                                                    .... 0... = SMS over NAS: Not Allowed
                                                5GS mobile identity - 5G-GUTI
                                                    .... .010 = Type of identity: 5G-GUTI (2)
                                                    .... ...1 = IMS voice over PS session indicator (IMS VoPS): Supported
The Registration accept answers two questions for the phone. SMS over NAS is not allowed: there is no SMSF, so this core cannot carry texts over NAS. IMS VoPS is supported: the core says voice over packet data is available here. That is the setting of Open5GS, not a fact about the lab: nothing is behind the ims network, so a phone that believed it and tried to register for voice would get no answer. The 5G-GUTI is the temporary identity the phone is given in place of the IMSI; the Numbers and identifiers chapter returns to it.

3. Read the voice session’s quality settings (any machine).

docker run --rm -v "$PWD/traces:/t:ro" nicolaka/netshoot:v0.13 \
  tshark -r /t/ims-session.pcapng -o nas-5gs.null_decipher:TRUE -d tcp.port==7777,http2 \
  -Y 'frame.time_relative > 37.54 && frame.time_relative < 37.55 && nas-5gs' -V \
  | grep -E "5QI|Session-AMBR for|PDU address information|IPv4: |DNN:"
                                                                        Unit for Session-AMBR for downlink: value is incremented in multiples of 1 Kbps (1)
                                                                        Session-AMBR for downlink: 3850 Kbps (3850)
                                                                        Unit for Session-AMBR for uplink: value is incremented in multiples of 1 Kbps (1)
                                                                        Session-AMBR for uplink: 1530 Kbps (1530)
                                                                        PDU address information: 10.46.0.2
                                                                        QoS flow description 1 - 5QI
                                                                                Parameter identifier: 5QI (1)
                                                                                5QI: 5
                                                                            IPv4: 10.34.0.53
                                                                        DNN: ims
                                                                                                    qosCharacteristics: nonDynamic5QI (0)
                                                                                                            nonDynamic5QI
The last two lines come from the NGAP copy of the same message and can be ignored. Frame 949 is the PDU session establishment accept that the AMF forwards to the phone inside a DL NAS transport. The phone is given an address from the ims pool, 10.46.0.2, not from the internet pool 10.45.0.0/16. The one flow is 5QI 5, the SIP-signalling flow of the table above. The session’s AMBR is 3,850 kbit/s down and 1,530 kbit/s up, enough for signalling. The only DNS server is 10.34.0.53. To see the same numbers on the radio side, run -d tcp.port==7777,http2 -Y 'ngap.fiveQI' -T fields -e frame.time_relative -e ngap.fiveQI -e ngap.priorityLevelARP: the internet session shows 5QI 9 with ARP priority 8 (10.2335 s) and the ims session 5QI 5 with ARP priority 1 (37.5198 s). A lower ARP number means a more important flow.

4. What the phone did not ask for (any machine).

docker run --rm -v "$PWD/traces:/t:ro" nicolaka/netshoot:v0.13 \
  tshark -r /t/ims-session.pcapng -o nas-5gs.null_decipher:TRUE -d tcp.port==7777,http2 \
  -Y 'gsm_a.gm.sm.pco_pid && frame.time_relative > 36' \
  -T fields -e frame.time_relative -e ip.src -e ip.dst -e gsm_a.gm.sm.pco_pid
36.881897120	10.33.0.50	10.33.0.5	0x000a,0x000d
36.939987970	10.33.0.5	10.33.0.200	0x000a,0x000d
36.952024880	10.33.0.200	10.33.0.4	0x000a,0x000d
37.519777340	10.33.0.4	10.33.0.200	0x000d
37.521831600	10.33.0.200	10.33.0.5	0x000d
37.542692960	10.33.0.5	10.33.0.50	0x000d
Each message appears once for every hop it takes: cell to AMF, AMF to the SCP, the SCP to the SMF, and back. In the request the phone lists two protocol configuration containers: 0x000a (it wants its address by NAS signalling) and 0x000d (it wants a DNS server). It does not list 0x000c, the P-CSCF address. The SMF’s configuration has a P-CSCF, 10.33.0.60 in core/smf.yaml, but it sends it only to a phone that asks. The accept therefore carries only 0x000d, the DNS server. A real VoLTE phone asks. UERANSIM does not, so the lab’s phone cannot get as far as a SIP REGISTER even if an IMS were there.

5. Open the session yourself (live core).

docker compose up -d
sleep 30
scripts/subscriber.sh add 999700000000001 465B5CE8B199B49FAA5F0A2EE238A6BC E8ED289DEBA952E4283B54E88E6183CA 2340000000001
scripts/subscriber.sh add-ims 999700000000001
docker compose --profile phone up -d ue
sleep 12
docker compose exec ue nr-cli imsi-999700000000001 --exec "ps-establish IPv4 --sst 1 --dnn ims"
sleep 15
docker compose exec ue nr-cli imsi-999700000000001 --exec "ps-list"

The sleep 30 gives the functions time to find each other, as in chapter 1.4. add-ims prints ims added: 999700000000001. The sleep 15 is the README’s advice: on a slow machine UERANSIM drops the first ims request and the phone resends it after 8 s. ps-list then shows two sessions: the first as in chapter 1.4 (apn: internet, 10.45.0.2) and a second with apn: ims, address 10.46.0.2 and ambr: up[1530Kb/s] down[3850Kb/s], the limits from step 3 (recorded run, 2026-11-13). The phone’s log, docker compose logs ue, shows a second TUN interface line, for uesimtun1. Addresses and timestamps can differ in your run.

6. Build a text (any machine with Python). Save this as sms.py and run python3 sms.py. It packs text into 7-bit septets, counts the parts of two messages, and builds the SMS-DELIVER TPDU that Kolanut’s SMSC would send for a recharge confirmation.

# The GSM 7-bit default alphabet (3GPP TS 23.038), in code order 0x00 to 0x7F.
BASIC = ("@£$¥èéùìòÇ\nØø\rÅå" "Δ_ΦΓΛΩΠΨΣΘΞ\x1bÆæßÉ" " !\"#¤%&'()*+,-./"
         "0123456789:;<=>?" "¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ" "¿abcdefghijklmnopqrstuvwxyzäöñüà")
EXT = {"^": 0x14, "{": 0x28, "}": 0x29, "\\": 0x2F, "[": 0x3C, "~": 0x3D, "]": 0x3E, "|": 0x40, "€": 0x65}

def septets(text):
    out = []
    for ch in text:
        if ch in BASIC: out.append(BASIC.index(ch))
        elif ch in EXT: out += [0x1B, EXT[ch]]   # an extension character costs two septets
        else: return None                        # not in the alphabet: the phone must use UCS-2
    return out

def pack(sept):                                  # 8 septets fit in 7 octets
    acc = n = 0; out = bytearray()
    for s in sept:
        acc |= s << n; n += 7
        while n >= 8: out.append(acc & 0xFF); acc >>= 8; n -= 8
    if n: out.append(acc & 0xFF)
    return bytes(out)

def parts(text):
    s = septets(text)
    if s is not None:                            # 160 septets in one message, 153 in each part of a longer one
        return "GSM 7-bit", len(s), 1 if len(s) <= 160 else -(-len(s) // 153)
    u = len(text.encode("utf-16-le")) // 2       # 70 UCS-2 units in one message, 67 in each part
    return "UCS-2", u, 1 if u <= 70 else -(-u // 67)

body = "Recharge N500 OK. Balance N512.40. Your 30-day bundle runs to 30 Nov. Thank you, Kolanut Mobile."
for text in (body, body.replace("N5", "₦5")):
    alphabet, units, n = parts(text)
    print(f"{alphabet:9} {units:3} units -> {n} message(s): {text}")

print("hellohello ->", pack(septets("hellohello")).hex().upper(), "(10 characters in 9 octets)")
print("160 characters ->", len(pack(septets("x" * 160))), "octets")

# An SMS-DELIVER TPDU (TS 23.040, 9.2.2.1): what the SMSC sends towards the phone.
sender = pack(septets("KOLANUT"))                # an alphanumeric sender, address type 0xD0
scts = bytes.fromhex("62113190510040")           # 2026-11-13 09:15:00, UTC+1, digits swapped in pairs
tpdu = (bytes([0x04, 0x0D, 0xD0]) + sender       # first octet, sender length, sender type, sender
        + bytes([0x00, 0x00]) + scts             # protocol id, data coding scheme, time stamp
        + bytes([len(septets(body))]) + pack(septets(body)))
print(len(tpdu), "octets:", tpdu.hex().upper())
GSM 7-bit  96 units -> 1 message(s): Recharge N500 OK. Balance N512.40. Your 30-day bundle runs to 30 Nov. Thank you, Kolanut Mobile.
UCS-2      96 units -> 2 message(s): Recharge ₦500 OK. Balance ₦512.40. Your 30-day bundle runs to 30 Nov. Thank you, Kolanut Mobile.
hellohello -> E8329BFD4697D9EC37 (10 characters in 9 octets)
160 characters -> 140 octets
104 octets: 040DD0CB2733E8AC520100006211319051004060D2F2181D969FCB20670D06033D972E9030CC0EBBC76590B31693B968301728FBAECB4133588B1CCE83C47537995D06C9EBEE3988FE06CD6020E7DBEE0251D161F71A947FD759A0E59B1D76D7E9A0E65B9C66975D
The two messages are the same 96 characters. The one with N fits in a single message; swapping two Ns for the naira sign pushes it into UCS-2 and it needs two. hellohello packs into 9 octets, and 160 characters into 140, the SMS payload limit. The TPDU opens with 04 (SMS-DELIVER, no more messages waiting), 0D and D0 (a sender of 13 half-octets, of the alphanumeric type), then the packed sender KOLANUT, two zero octets (protocol identifier and the 7-bit coding scheme), a seven-octet time stamp with its digits swapped in pairs (62 11 31 90 51 00 40 is 26-11-13 09:15:00, UTC+1), the length in septets (60, 96 characters) and the packed text. Paste the hex into any SMS PDU decoder to check it.

7. Watch an SMSC wait (any machine with Python). Save this as smsc.py and run python3 smsc.py. It is Rahma’s Friday in 15 lines. The schedule and the 12 minutes are the story’s numbers, not a standard.

# A store-and-forward SMSC in a few lines. Times are minutes after the text was submitted.
RETRIES = [0, 1, 5, 30, 120]     # the SMSC's retry schedule: an operator's choice
BACK_AT = 12                     # the phone is out of coverage until minute 12

def deliver(validity, alert):
    for t in RETRIES:
        if t >= validity: break                      # the validity period has run out
        if t >= BACK_AT: return t, "scheduled retry"
        if alert and BACK_AT < validity:             # the subscriber database tells the SMSC the phone is back
            return BACK_AT, "alert from the subscriber database"
    return None, "expired, never delivered"

for validity in (24 * 60, 10):
    for alert in (False, True):
        t, how = deliver(validity, alert)
        print(f"validity {validity:4} min, alert {'on ' if alert else 'off'}: minute {t}  ({how})")
validity 1440 min, alert off: minute 30  (scheduled retry)
validity 1440 min, alert on : minute 12  (alert from the subscriber database)
validity   10 min, alert off: minute None  (expired, never delivered)
validity   10 min, alert on : minute None  (expired, never delivered)
With a day’s validity, the text arrives at minute 30 on the schedule alone, which is Rahma’s Friday, and at minute 12 when the database alerts the SMSC. With a validity of 10 minutes, it never arrives in either case: the phone came back after the message had expired. Short validity suits a one-time code that is useless after five minutes. It is wrong for a recharge confirmation.

The break: ims without add-ims (live core, or read a trace). Start from a core where the subscriber has never been allowed ims. On your own machine, down -v wipes the lab’s subscriber database, which is what you want here:

docker compose --profile phone --profile epc down -v
docker compose up -d
sleep 30
scripts/subscriber.sh add 999700000000001 465B5CE8B199B49FAA5F0A2EE238A6BC E8ED289DEBA952E4283B54E88E6183CA 2340000000001
docker compose --profile phone up -d ue
sleep 12
docker compose exec ue nr-cli imsi-999700000000001 --exec "ps-establish IPv4 --sst 1 --dnn ims"
sleep 15
docker compose exec ue nr-cli imsi-999700000000001 --exec "ps-list"

Registration succeeds and the internet session works, but the ims session never comes up: the subscriber was never allowed it. In the recorded run (2026-11-13) ps-list showed PDU Session2 with apn: ims stuck at state: PS-ACTIVE-PENDING and address: null, and the phone’s log ended:

[nas] [warning] Retransmitting PDU Session Establishment Request due to T3580 expiry
[nas] [error] MM status received with cause [DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED]

The capture of that run showed the AMF answering 3 ms after the request, with 5GMM status (DNN not supported or not subscribed in the slice). Without a live core, see the same refusal in the reference trace:

scripts/ladder.sh traces/wrong-dnn.pcapng | grep -E "5GMM status|PDU session"

In that trace the phone asked for a data network called corp that the core does not serve. The AMF answers at 9.980 s, 14 ms after the request at 9.966 s, with 5GMM status (DNN not supported or not subscribed in the slice) and never calls an SMF. The phone retries at 25.882 s and gets the same answer at 25.885 s. The refusal for ims on a subscriber without add-ims is the same. From the user’s side this is the symptom chapter 1.4 opened with: data works and voice does not, with the fault in the subscription and not the radio. Fix it with scripts/subscriber.sh add-ims 999700000000001 and by opening the session again. Finish with docker compose --profile phone down.

DECIDE

Mariam runs Kolanut Mobile's SMSC in its launch year. On market days a few hundred recharge confirmations a day arrive 30 minutes late, always for traders who were out of coverage for a few minutes after their recharge. The SMSC retries a failed delivery after 1, 5, 30 and 120 minutes and keeps messages for 24 hours. Kolanut's SMSC runs on a link into Lumora Mobile's network, and Lumora's subscriber database is the one that knows when a phone returns. Which change does Mariam ask for first?

READING
  1. DOC
    3GPP TS 23.228: IP Multimedia Subsystem (IMS), Stage 2 3GPP

    The architecture of the IMS: the CSCFs, the HSS and the application servers, with the registration and call flows drawn message by message. Read the architecture overview and the P-CSCF discovery text; the supplementary-service detail can wait for the Voice course.

  2. DOC
    3GPP TS 23.272: Circuit Switched (CS) fallback in Evolved Packet System (EPS) 3GPP

    The source for the SGs interface, the combined attach, mobile-originated and mobile-terminated fallback, and SMS over SGs. Read the overview and the mobile-originating and mobile-terminating call flows; skip the detailed error handling.

  3. DOC
    3GPP TS 23.040: Technical realization of the Short Message Service (SMS) 3GPP

    The definition of the SMSC's behaviour and of the SMS-DELIVER and SMS-SUBMIT TPDUs you built in step 6. Read the architecture and the short message transfer clauses and the TPDU layouts; skip the concatenation and application-port detail on a first read.

  4. DOC
    3GPP TS 23.501: System architecture for the 5G System 3GPP

    Table 5.7.4-1 lists every standardised 5QI with its resource type, delay budget and loss target, so you can check the table in this chapter and read what the other values mean. Read the QoS model clause 5.7 around it; skip the rest on a first read. Read: clause 5.7, table 5.7.4-1.

  5. DOC
    GSMA IR.92: IMS Profile for Voice and SMS GSMA

    What a VoLTE phone and network must support at a minimum, written for operators and handset makers. Use it to see which of the 3GPP options an operator is expected to pick, for voice and for SMS over IP. The GSMA hosts it on its IREG documentation page; choose the current version.

  6. DOC
    RFC 3261: SIP: Session Initiation Protocol IETF, 2002

    The protocol under every IMS call: the REGISTER, INVITE and response codes in the outline above. Read the overview and the section on registrations; the Voice and Real-Time Communications course takes it from there.

  7. BOOK
    From GSM to LTE-Advanced Pro and 5G: An Introduction to Mobile Networks and Mobile Broadband, 4th edition Martin Sauter, 2021

    A plain-language account of how a call and a text are routed in each generation, with the same terms in pictures. Read it before the specifications; skip the radio and Wi-Fi chapters. Read: the sections on GSM voice and SMS, on circuit-switched fallback, and on voice over LTE.

  8. DOC
    NCC: License Framework for the Establishment of Mobile Virtual Network Operators in Nigeria Nigerian Communications Commission

    The tier table that decides what Kolanut may run. Read section 4.2 for what each tier adds, including the SMSC at Tier 1 and the IMS and MSC at Tier 3.

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: Mobile data: access point names, bearers and policy control →