BEGINNERCHAPTER 04

A call, a text and a data session, end to end

Registration first, then three separate services: a tunnel for data, a SIP call over IMS, a stored-and-forwarded text. Data working tells you nothing about the other two

45 MINHOW MOBILE NETWORKS WORKUPDATED 2026-11-12
PREDICT

A phone shows full signal, loads web pages and sends messages in a chat app. Every phone call fails the moment it is dialled. Which is the most likely cause?

A phone that “works” has done several different things, in a fixed order. First it registers: the network learns the phone is there and decides it is allowed. Only then can it ask for anything. Each thing it asks for is a different service with its own path through the network: a data session, a call and a text. This chapter walks each one end to end. You can run the data session on your own machine. The call and the text you read from the standards, because the lab’s core has no voice or SMS function (the lab README lists this under the things that differ from a live network).

Registration first

When you switch a phone on, it finds a cell, sets up a radio connection and sends a Registration request to the network. The request travels in NAS messages (non-access stratum): the conversation between the phone and the core, which the cell carries but does not read. The cell packs each NAS message into an NGAP message (the cell’s protocol to the core, run over SCTP, a transport that keeps message boundaries) and sends it to the AMF, the access and mobility function.

The AMF asks the authentication function to check the SIM, as the previous chapter showed. It then sends Registration accept. In traces/attach-and-browse.pcapng the request is at 8.058 s and the accept at 8.659 s: about 0.6 s, most of it spent on requests between core functions that share one machine in the lab. Times in a trace are seconds from the start of the capture.

After registration the AMF holds a record: which phone, which cell, whether the phone has a radio connection right now. Two small state machines describe it. The registration state is RM-REGISTERED or RM-DEREGISTERED. The connection state is CM-CONNECTED (a signalling connection exists) or CM-IDLE (it does not, to save the phone’s battery and the cell’s resources). The lab’s phone reports both: rm-state: RM-REGISTERED and cm-state: CM-CONNECTED.

Registration gives the phone an identity in the network and nothing else. No IP address, no voice, no texts. Each of those is a request made afterwards.

A data session: the part you can run

The phone now asks for a PDU session (protocol data unit session): a connection between the phone and a data network, such as the internet. It sends a PDU session establishment request inside an uplink NAS message. The request names a DNN (data network name), the 5G name for what 4G calls an access point name. The lab’s DNN is internet.

The AMF does not build the session. It finds a session management function (SMF) through the directory the core keeps, and passes the request on. In the trace this is the AMF’s POST /nsmf-pdusession/v1/sm-contexts to the SMF at 8.898 s. The AMF’s log later shows the follow-up, /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify, once the cell has answered. The SMF does four things:

  1. It asks the subscriber database what this subscription allows (which DNNs, what speed limits).
  2. It asks the policy function for rules.
  3. It picks the phone’s IP address. In the lab that is IPv4[10.45.0.2], the first address of the pool 10.45.0.0/16.
  4. It programs the UPF, the user plane function, over PFCP (packet forwarding control protocol): install a rule that says packets in this tunnel go to the data network, and packets for 10.45.0.2 come back this way.

In the trace the SMF sends PFCP Session Establishment Request at 9.127 s and the UPF answers at 9.151 s. The AMF then sends the cell a PDU session resource setup at 9.186 s, carrying the PDU session establishment accept for the phone. That is 0.31 s after the phone asked at 8.873 s. A last PFCP Session Modification at 9.228 s tells the UPF where the cell’s end of the tunnel is.

PhoneUECellgNBAMF10.33.0.5SMF10.33.0.4UPF10.33.0.7Registration request (8.058 s)Authentication, security mode (8.245 to 8.370 s)Registration accept (8.659 s)PDU session establishment request (8.873 s)create session context (HTTP/2, via the SCP)PFCP session establishment (9.127 s)PDU session accept, IP 10.45.0.2 (9.186 s)PFCP session modification (9.228 s)packets in the GTP-U tunnel (22.126 s on)

Read the diagram from the top. The cell sits between the phone and the core, so every arrow on the left passes through it. The AMF talks to the SMF in the middle. The SMF controls the UPF but never sees a user’s packet. This split is the control plane (the signalling) and the user plane (the data it sets up), and you saw it in the first chapter. Here you see the control plane build the user plane, then step back.

What a tunnel is

The phone does not have a cable to the UPF. Its packets cross the cell and the core network, which is a network of its own with its own addresses. So the cell wraps each packet from the phone in a new one addressed to the UPF. The wrapper is GTP-U (GPRS tunnelling protocol, user plane), carried in UDP on port 2152. The inner packet travels untouched; the UPF removes the wrapper and sends the inner packet on to the internet. Replies take the reverse path.

A wrapper has to say which session it belongs to, because one UPF carries thousands. The GTP header holds a TEID (tunnel endpoint identifier), a 32-bit number each end chooses for the packets it receives. In the reference trace the cell sends to the UPF with TEID 0x00009f8a, and the UPF sends to the cell with TEID 0x00000001. Those numbers are different in every run. What does not change is the rule: two numbers, one per direction, and the session is whichever one they name.

The tunnel costs space. In the trace an 84-byte ICMP packet (a ping, 20 bytes of IP header, 8 of ICMP header and 56 of data) becomes a 128-byte IP packet on the core network: the wrapper adds a 20-byte IP header, an 8-byte UDP header and a 16-byte GTP-U header. That is 44 bytes of overhead, so the phone’s interface in the lab has a smaller maximum packet size (MTU, 1400 bytes in the live output, against 1500 on an ordinary Ethernet link). A packet that does not fit is split or dropped, which is why a wrong MTU makes some sites load and others hang.

Two numbers come from the subscriber’s record and arrive in the session: the AMBR (aggregate maximum bit rate), the cap on the phone’s total speed. The lab’s ps-list shows up[50000Kb/s] down[100000Kb/s]. The UPF enforces this session-level cap on the data path, and the cell enforces a similar per-phone one on the radio side. Speed limits on a prepaid plan come from the subscriber’s record, not from the cell’s own settings.

Mobile-originated, mobile-terminated, and paging

A mobile-originated (MO) action starts at the phone: you open a page, dial, send a text. A mobile-terminated (MT) action starts elsewhere and ends at the phone: someone calls you, a text arrives, a server sends data to your address.

MO is easy. The phone is awake, it knows it wants something, and if it is idle it sends a Service request to get a signalling connection back. The morning trace has one: the cell releases the idle phone at 31.039 s, and the phone’s Service request at 36.027 s is answered by a Service accept at 36.052 s, 25 ms later. The phone started that, because the script asked it to fetch a page.

MT is the hard case. A phone in CM-IDLE has no radio connection. The network has no way to send it anything. It knows only the phone’s registration area: a list of tracking areas, each a group of cells. So the AMF sends a paging message to every cell in that area: phone with this temporary identity, answer. The idle phone wakes at fixed moments to listen for pages, hears its own, and sends a Service request. Only then does the network have a connection to push the call, the text or the data down.

Paging is why a phone’s position is known only to an area. A smaller area means fewer cells paged but more reports when the phone moves; a larger one the opposite. Operators tune it. It is also why “the phone was on” and “the network can reach it right now” are different. None of the reference traces contains a Paging message, because the lab’s phone only ever starts things itself.

A text

An SMS is not an IP packet. It is a message of at most 140 bytes (160 characters in the default 7-bit alphabet, 70 in the 16-bit one used for many scripts), defined in 3GPP TS 23.040. It does not go from phone to phone. It goes through a server, the SMSC (short message service centre), which keeps the message until it can be delivered. This is store and forward.

On a modern network the text rides NAS or IMS instead of its own radio channel. In a 5G core that carries texts over NAS, a function called the SMSF (SMS function) sits beside the AMF. The 5G flow for a text to a phone, drawn from the standards:

SMSCstore and forwardUDMsubscriber dataSMSFSMS functionAMFwhere the phone isPhoneUE1 where is this number served?2 the serving SMSF3 deliver the message (SMS-DELIVER)4 hand over as NAS5 page, if the phone is idle6 service request7 message in a NAS transport8 delivery report back to the SMSC

Follow it. The SMSC does not know where the phone is, so it asks the subscriber database (steps 1 and 2). It then hands the message to the serving SMSF (step 3), which passes it to the AMF as NAS (step 4). If the phone is idle, the AMF pages it and waits for the Service request (steps 5 and 6) before pushing the message down (step 7). The phone answers with a delivery report that travels back to the SMSC (step 8).

Now see where it goes wrong. If the phone is out of coverage or off, step 5 gets no answer. The SMSC does not discard the message. It stores it with an expiry time (the validity period, which the sender’s phone sets) and tries again later, and it asks the subscriber database to tell it when the phone next registers. A text that arrives three hours late usually did not travel for three hours: it waited in a queue for the phone, or for a retry. Retry timers are an operator’s choice, and a long first gap is a configuration fault, not a radio one. The Messaging course covers the SMSC, SMPP and delivery reports in depth. Here you need the shape: texts are stored, not streamed, and the SMSC owns the wait.

A call

A call is the opposite of a text: it is real time, and a half-second of delay is audible. On 2G and 3G a call used a circuit-switched network that reserved a path for the call’s length. On 4G and 5G there is no such network. A call is a SIP (session initiation protocol) conversation with an IMS (IP multimedia subsystem), a set of servers that sit outside the 5G core and use the data network to reach it. The voice itself is a stream of small packets carrying coded speech. On 4G this is VoLTE (voice over LTE); on 5G standalone it is VoNR (voice over new radio).

That has three consequences that explain Tonye’s evening.

The phone needs a second session. Alongside the internet session it opens one to an IMS data network (commonly named ims) and registers there with SIP. The SIP signalling and the voice get their own quality settings: in 5G, a 5QI (5G QoS identifier) of 5 for the signalling, an ordinary flow with priority, and 1 for conversational voice, which the network treats as a guaranteed bit rate flow. The subscriber’s record must allow that session and the IMS profile.

A mobile-terminated call needs the same paging as a text. The SIP invitation reaches the IMS entry point the phone registered with. If the phone is idle, the data arriving for it makes the core page it through the AMF, the phone answers with a Service request, and the network sets up the voice flow.

Without IMS, there must be a fallback, or the call fails. If the phone or the cell does not support voice on 5G, the network can move the phone to 4G for the call (EPS fallback), and on 4G to 2G or 3G (circuit-switched fallback) if voice over LTE is not available either. Each fallback adds time to the call set-up and has to be provisioned in both the network and the phone. A SIM provisioned for data but not voice, on a phone with no circuit-switched fallback, produces exactly Tonye’s symptom: perfect data, instant “call failed”.

GSMA IR.92 is the document that states what a VoLTE phone and network must support. The Voice and Real-Time Communications course takes SIP and call quality from here.

The three side by side

Data session Text Call
Runs on PDU session, DNN internet NAS (5G) or IMS; a stored message IMS, SIP, second PDU session
Core functions AMF, SMF, UPF AMF, SMSF, UDM, SMSC AMF, SMF, UPF, plus IMS servers
Real time? Best effort No: store and forward Yes: guaranteed bit rate (5QI 1)
If the phone is idle Phone sends Service request, or the network pages it for downlink data Paged by the AMF Paged by the AMF
Fails as Page never loads; session missing Late or no delivery; the SMSC holds it “Call failed”; one-way or no audio
In the lab Yes No No

When someone reports “my phone is not working”, the first question is which of the three, and the second is whether registration succeeded. The registration state tells you whether the problem is before or after the front door.

LAB Follow one data session, packet by packet ~40 MIN
YOU NEEDDocker with Compose v2about 2 GB of disk and 2 GB of free memorya Linux kernel with SCTP for steps 1 to 3 and the break (Linux, or Docker Desktop; most cloud sandboxes lack it)the labs/telecoms folder

You will register a phone, open a data session, send traffic through it and read every message the network exchanged. Steps 4 to 7 need only the reference trace, so a machine without SCTP can follow them. Steps 1 to 3 and the break need the live core. Run everything from the labs/telecoms folder.

1. Start the core and give the phone a subscriber (live core).

cd labs/telecoms
docker compose up -d
docker compose ps
scripts/subscriber.sh add 999700000000001 465B5CE8B199B49FAA5F0A2EE238A6BC E8ED289DEBA952E4283B54E88E6183CA 2340000000001
docker compose logs gnb | grep "NG Setup"
docker compose ps lists 14 services, all Up: amf, ausf, bsf, gnb, internet, mongo, nrf, nssf, pcf, scp, smf, udm, udr, upf. The add command prints provisioned: 999700000000001. The cell’s log shows NG Setup procedure is successful, which means the cell and the AMF have introduced themselves. Wait 20 to 30 seconds after up before the next step: the functions need that long to register with the directory.

2. Record, switch the phone on and look at its state (live core).

scripts/capture.sh start a-day
docker compose --profile phone up -d ue
sleep 12
docker compose logs ue | grep -E "Registration is successful|TUN interface"
docker compose exec ue nr-cli imsi-999700000000001 --exec "status"
docker compose exec ue nr-cli imsi-999700000000001 --exec "ps-list"
The phone’s log shows Initial Registration is successful and PDU Session establishment is successful PSI[1], then Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 10.45.0.2] is up. status includes rm-state: RM-REGISTERED and cm-state: CM-CONNECTED, and a tmsi that changes from run to run. ps-list shows state: PS-ACTIVE, apn: internet, address: 10.45.0.2, s-nssai: sst: 0x01, and ambr: up[50000Kb/s] down[100000Kb/s]. Timestamps and the TMSI differ in your run. The address is the first of the pool, so it should match.

3. Send traffic, switch off, stop recording (live core).

docker compose exec ue curl --interface uesimtun0 http://10.34.0.80/
docker compose exec ue ping -I uesimtun0 -c 3 10.34.0.80
docker compose exec ue nr-cli imsi-999700000000001 --exec "deregister switch-off"
sleep 4
scripts/capture.sh stop
curl prints Hello from the data network. Your packets came through the UPF. The ping prints three replies, 64 bytes from 10.34.0.80 with times of about 9 to 10 ms in the recorded run, 8.9 to 10.3 ms (yours will differ with your machine) and 0% packet loss. After stop the file captures/a-day.pcapng exists. In the steps below, use it instead of traces/attach-and-browse.pcapng. Every number you read will differ slightly, but the order of messages will not.

4. Read the signalling (everyone).

scripts/ladder.sh traces/attach-and-browse.pcapng
One line per message, with function names in place of addresses; the exact wording of the Info column is Wireshark’s, so yours may differ slightly. The order, with times from the reference trace, is: the Registration request from the cell to the AMF (8.058 s), the AMF asking the AUSF, the AUSF asking the UDM and the UDM reading the UDR, then Authentication request (8.245 s), Authentication response (8.263 s), Security mode command (8.370 s), Security mode complete (8.386 s), then InitialContextSetup carrying Registration accept (8.659 s). After Registration complete (8.873 s) comes the PDU session establishment request in an uplink NAS transport, the SMF’s lookups at the UDM, PCF and BSF, then PFCP Session Establishment Request (9.127 s) and Response (9.151 s), PDUSessionResourceSetup (9.186 s) and PFCP Session Modification (9.228 s). Late in the trace you see the Deregistration request (28.428 s) and PFCP Session Deletion. The NAS messages are readable because the lab turns off ciphering; a live network does not.

5. See one packet twice (everyone).

scripts/ladder.sh traces/attach-and-browse.pcapng --filter 'icmp || http'
Every ping and every web request appears twice, about 2 ms apart. For the first ping in the reference trace, gNB -> UPF at 24.337 s is the packet inside the tunnel, on the core network. phone 10.45.0.2 -> internet at 24.339 s is the same packet after the UPF has removed the tunnel, on the data network. The replies come back as internet -> phone 10.45.0.2 (24.340 s) and UPF -> gNB (24.340 s). The web request shows the same pair: a GET / HTTP/1.1 at 22.146 s on the core network and 22.147 s on the data network. The phone’s address and the destination do not change; only the wrapper does.

6. Open one tunnel packet (everyone).

docker run --rm -v "$PWD/traces:/t:ro" nicolaka/netshoot:v0.13 \
  tshark -r /t/attach-and-browse.pcapng -o nas-5gs.null_decipher:TRUE \
  -Y 'gtp && icmp.type == 8 && icmp.seq == 1' -V
Several protocol layers in one frame: Ethernet, an outer Internet Protocol layer from 10.33.0.50 (the cell) to 10.33.0.7 (the UPF), UDP with destination port 2152, a GPRS Tunneling Protocol layer, then a second Internet Protocol layer from 10.45.0.2 to 10.34.0.80 and an ICMP echo request. Find the TEID in the GTP layer: 0x00009f8a in the reference trace, different in yours. The filter picks the first ping (frame 742 in the reference trace). The outer IP total length is 128 bytes and the inner one 84, so the tunnel header is 44 bytes. To see the TEID and both address pairs for every ping, repeat with -Y 'gtp && icmp' and -T fields -e ip.src -e ip.dst -e gtp.teid instead of -V; the address columns hold two comma-separated values, outer first. Replies carry TEID 0x00000001, the cell’s end of the tunnel.

7. Find the SMF programming the UPF (everyone).

scripts/ladder.sh traces/attach-and-browse.pcapng --filter 'pfcp.msg_type >= 50'
Six lines: PFCP Session Establishment Request and Response (9.127 s and 9.151 s), Session Modification Request and Response (9.228 s and 9.232 s) and, at the end, Session Deletion Request and Response (28.491 s and 28.494 s). Heartbeats and association setup have lower message numbers and are hidden by the filter. The session is created before the first packet moves (22.126 s) and removed after the last. If a phone has a session and no tunnel traffic, look here first.

The break (live core): stop the UPF while the phone is on. Switch the phone on again if you switched it off in step 3, then:

docker compose stop upf
docker compose exec ue nr-cli imsi-999700000000001 --exec "status" | grep -E "rm-state|cm-state"
docker compose exec ue curl --max-time 5 --interface uesimtun0 http://10.34.0.80/; echo "exit $?"

The phone still reports RM-REGISTERED (and CM-CONNECTED), and ps-list still shows its session as PS-ACTIVE, because the AMF, the cell and the phone never needed the UPF to stay registered. The page does not load: curl gives up after its timeout with exit code 28. Signalling is healthy and the user plane is gone, which is the data version of Tonye’s evening: one service down, the front door open. Run docker compose logs --no-log-prefix smf --tail 20 and look for what the SMF reports. After a few seconds of missed heartbeats it says:

[smf] WARNING: No Heartbeat from UPF [10.33.0.7]:8805
[smf] ERROR: No UPF available
[smf] INFO: PFCP de-associated [10.33.0.7]:8805

Start the UPF again with docker compose start upf. The SMF logs PFCP associated and PFCP restoration: it re-sends the forwarding rules for the sessions it still holds, so the old session works again and curl prints the page without restarting the phone. Finish with docker compose --profile phone down.

DECIDE

Alaba, in Lumora Mobile's network operations centre, has 400 care tickets in a day from customers on new SIMs: data and chat apps work, every call fails immediately, and texts arrive. The radio dashboards are green and the data session success rate is 99.7%. The SIMs came from one batch, loaded into the subscriber database last week. What does Alaba do first?

READING
  1. DOC
    3GPP TS 23.502: Procedures for the 5G System (Stage 2) 3GPP

    The call flows behind every ladder in this chapter. Registration, PDU session establishment, service request and the SMS over NAS procedures are each drawn message by message. Read the flow diagrams first; the prose around them is dense. Read: 4.2.2.2 (registration), 4.2.3 (service request), 4.3.2 (PDU session establishment), 4.13.3 (SMS over NAS).

  2. DOC
    3GPP TS 24.501: Non-access-stratum protocol for 5G 3GPP

    The definition of every NAS message name you saw in the ladder, with its fields and error causes. Use it as a dictionary when a trace shows a message you do not know; do not read it through.

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

    The source for the 140-byte limit, the SMSC's store-and-forward role, validity periods and delivery reports. The architecture and the short message transfer clauses are the useful ones; skip the concatenation detail on a first read.

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

    How a call is set up through IMS servers over the data network. Read the architecture overview to see where the servers sit relative to the core; the registration and session flows are for the Voice course.

  5. CODE
    Open5GS

    The open-source core the lab runs: the AMF, SMF, UPF and the other functions as small C programs with a configuration file each. Read the configs directory beside the lab's own core folder to see what each function listens on.

  6. DOC
    UERANSIM wiki

    How the simulated cell and phone are configured and driven. The Usage page explains the nr-cli commands the lab uses, such as status and the switch-off; skip the development pages.

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: 2G to 5G: what each generation changed →