5G New Calls: SIP Protocol Explained and Hands‑On Implementation
This article introduces the SIP (Session Initiation Protocol) as the flexible signaling backbone for 5G voice and video services, explains its place in the OSI model, details message structure and common methods, outlines real‑world use cases, and provides step‑by‑step setup and code examples using eXosip and pjsip.
Why SIP Matters for 5G
5G delivers higher data rates, lower latency, and broader coverage, enabling IoT, remote health, and autonomous driving. To support these services, a flexible session‑control protocol is required; SIP fulfills this role by creating, modifying, and terminating multimedia sessions over IP networks.
SIP in the OSI Stack
SIP operates at the application layer (layer 7) of the OSI model. The article lists all seven layers to show where SIP fits relative to physical, data link, network, transport, session, presentation, and application layers.
Core Features of SIP
SIP is an open, extensible, text‑based protocol that works with transport protocols such as UDP, TCP, and TLS, and is usually paired with RTP for media transport. Its advantages include vendor‑agnostic interoperability and suitability for VoIP, video conferencing, instant messaging, and IMS‑based services (VoLTE, VoNR).
SIP Message Structure
Messages are UTF‑8 encoded and divided into requests and responses. Each message consists of a start line, a series of header fields, and an optional body, following the RFC 2822 format. Required headers include Via, From, To, Call‑ID, CSeq, and Contact; missing any of these results in a 400 Bad Request.
Common SIP Methods and Use Cases
INVITE – initiates a session
BYE – terminates a session
REGISTER – registers a user agent with a server
Typical deployment scenarios are VoIP (e.g., Skype, Google Voice, carrier VoLTE), video conferencing (Zoom, Cisco Webex), enterprise PBX systems (Asterisk, FreeSWITCH), carrier IMS (5G VoNR, 4G VoLTE), and SIP‑enabled access control or robots.
Development Frameworks: eXosip and pjsip
eXosip is a high‑level wrapper around oSIP, offering session management, RTP/RTCP support, and proxy handling. pjsip is a cross‑platform SIP stack with built‑in RTP, NAT traversal (ICE, STUN), and support for Windows, Linux, and Android.
Environment Setup
Windows
# Clone eXosip source
git clone https://github.com/linphone/exosip.git
# Configure with Visual Studio
cmake -G "Visual Studio 15 2015" .
# Build
msbuild exosip.slnLinux
# Install dependencies
sudo apt-get install build-essential libssl-dev
# Clone pjsip source
git clone https://github.com/pjsip/pjsip.git
# Configure and build
cd pjsip
./configure
makeKey API Examples
eXosip – Initiating an INVITE
#include <stdio.h>
#include <exosip2/exosip.h>
int main() {
eXosip_t *exosip;
eXosip_init(&exosip);
eXosip_set_user_agent(exosip, "eXosip Client");
eXosip_call_build_initial_invite(exosip, "sip:[email protected]", NULL, NULL);
eXosip_exit(exosip);
return 0;
}pjsip – Creating an Account and Handling Calls
#include <pjsua-lib/pjsua.h>
static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata) {
pjsua_call_answer(call_id, 200, NULL, NULL);
}
int main() {
pjsua_config cfg;
pjsua_acc_config acc_cfg;
pjsua_config_default(&cfg);
cfg.cb.on_incoming_call = on_incoming_call;
pjsua_init(&cfg, NULL, NULL);
pjsua_acc_config_default(&acc_cfg);
acc_cfg.id = pj_str("sip:[email protected]");
pjsua_acc_add(&acc_cfg, PJ_TRUE, NULL);
pjsua_start();
return 0;
}Practical Hands‑On Projects
The article provides complete client code using eXosip and a simple server using pjsip, demonstrating registration, INVITE handling, and call answering.
Further Learning
Read RFC 3261 for the SIP specification.
Use Wireshark to capture and analyze SIP traffic.
Experiment with eXosip or pjsip to build your own SIP applications.
As 5G and cloud‑based communications evolve, SIP will continue to be a cornerstone for voice and video services.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Network Intelligence Research Center (NIRC)
NIRC is based on the National Key Laboratory of Network and Switching Technology at Beijing University of Posts and Telecommunications. It has built a technology matrix across four AI domains—intelligent cloud networking, natural language processing, computer vision, and machine learning systems—dedicated to solving real‑world problems, creating top‑tier systems, publishing high‑impact papers, and contributing significantly to the rapid advancement of China's network technology.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
