Skip to content
VoIP and SIP: Complete Beginner's Guide

VoIP and SIP: Complete Beginner's Guide

DodaTech Updated Jun 19, 2026 6 min read

VoIP (Voice over IP) is the technology that transmits voice calls over IP networks instead of traditional phone lines, while SIP (Session Initiation Protocol) is the signaling protocol that sets up, manages, and tears down those voice sessions.

What You’ll Learn

  • How VoIP works and why it replaced traditional telephony
  • SIP messages: INVITE, ACK, BYE, REGISTER, and the SIP call flow
  • SDP (Session Description Protocol) for codec negotiation
  • Understanding codecs: G.711, G.729, and bandwidth requirements
  • PBX architecture and security considerations

Why VoIP and SIP Matter

Traditional telephone networks (PSTN) are being retired worldwide. AT&T shut down its legacy network in 2022. BT’s switch-off is underway. All voice communication is moving to IP. SIP is the protocol that makes this work — used by every major VoIP provider, PBX system, and unified communications platform.

Doda Browser uses SIP-based WebRTC for its built-in audio/video calling features.

Learning Path

    flowchart LR
  A[Network Basics] --> B[VoIP Concepts]
  B --> C[SIP Protocol<br/>You are here]
  C --> D[SDP & Codecs]
  C --> E[Security & NAT]
  D --> F[PBX Deployment]
  style C fill:#f90,color:#fff
  

How VoIP Works

VoIP converts analog voice into digital packets, transmits them over IP networks, and converts them back at the destination.

Analog voice → Codec (PCM) → IP packets → Network → Codec → Analog voice

Key components:

  • Codec: Encodes/decodes analog voice to digital (PCM, G.711, G.729)
  • Signaling: Sets up and controls calls (SIP, H.323)
  • Transport: Carries voice packets (RTP — Real-time Transport Protocol)

SIP Messages

SIP is text-based (like HTTP) with request/response messages:

Core SIP Methods

MethodPurpose
INVITEInitiate a call or renegotiate parameters
ACKConfirm final response to INVITE
BYEEnd a session
REGISTERRegister a SIP URI with a server
CANCELCancel a pending INVITE
OPTIONSQuery server capabilities

SIP Call Flow

    sequenceDiagram
  Alice->>Proxy: INVITE sip:bob@example.com
  Proxy->>Bob: INVITE
  Bob->>Proxy: 180 Ringing
  Proxy->>Alice: 180 Ringing
  Bob->>Proxy: 200 OK
  Proxy->>Alice: 200 OK
  Alice->>Bob: ACK
  Note over Alice,Bob: RTP media session
  Alice->>Bob: BYE
  Bob->>Alice: 200 OK
  

Example SIP Messages

INVITE (Alice calls Bob):

INVITE sip:bob@example.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.10:5060;branch=z9hG4bK74b43
Max-Forwards: 70
From: "Alice" <sip:alice@example.com>;tag=12345
To: "Bob" <sip:bob@example.com>
Call-ID: abcdef-12345@192.168.1.10
CSeq: 1 INVITE
Contact: <sip:alice@192.168.1.10:5060>
Content-Type: application/sdp
Content-Length: 142

v=0
o=alice 2890844526 2890844526 IN IP4 192.168.1.10
s=-
c=IN IP4 192.168.1.10
t=0 0
m=audio 49170 RTP/AVP 0 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000

200 OK (Bob accepts):

SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.10:5060;branch=z9hG4bK74b43
From: "Alice" <sip:alice@example.com>;tag=12345
To: "Bob" <sip:bob@example.com>;tag=67890
Call-ID: abcdef-12345@192.168.1.10
CSeq: 1 INVITE
Contact: <sip:bob@192.168.1.20:5060>
Content-Type: application/sdp
Content-Length: 142

v=0
o=bob 2890844730 2890844730 IN IP4 192.168.1.20
s=-
c=IN IP4 192.168.1.20
t=0 0
m=audio 49172 RTP/AVP 0
a=rtpmap:0 PCMU/8000

BYE (someone hangs up):

BYE sip:bob@192.168.1.20:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.10:5060;branch=z9hG4bK74b44
From: "Alice" <sip:alice@example.com>;tag=12345
To: "Bob" <sip:bob@example.com>;tag=67890
Call-ID: abcdef-12345@192.168.1.10
CSeq: 2 BYE
Max-Forwards: 70
Content-Length: 0

SDP and Codecs

SDP (Session Description Protocol) is embedded in SIP messages to negotiate media parameters:

v=0                    -- Protocol version
o=alice 2890844526 2890844526 IN IP4 192.168.1.10  -- Origin
s=-                    -- Session name
c=IN IP4 192.168.1.10  -- Connection data
t=0 0                  -- Time active
m=audio 49170 RTP/AVP 0 8 101  -- Media description
a=rtpmap:0 PCMU/8000          -- Codec: G.711 μ-law
a=rtpmap:8 PCMA/8000          -- Codec: G.711 A-law
a=rtpmap:101 telephone-event/8000  -- DTMF events

Common Codecs

CodecBitrateQualityBandwidth (with overhead)
G.711 (PCMU/PCMA)64 kbpsToll quality~90 kbps
G.7298 kbpsGood~34 kbps
G.722 (HD Voice)64 kbpsExcellent~90 kbps
Opus6-510 kbpsAdaptiveVaries

PBX Architecture

A PBX (Private Branch Exchange) is the central switching system for VoIP calls:

    flowchart LR
  A[SIP Phone] --> B[PBX Server]
  C[Softphone] --> B
  B --> D[SIP Trunk → PSTN]
  B --> E[Another PBX]
  B --> F[Voicemail Server]
  

Popular Open-Source PBX: Asterisk

; /etc/asterisk/sip.conf
[general]
context=public
allow=ulaw,alaw,g729
nat=force_rport,comedia

[alice]
type=friend
host=dynamic
secret=secure_password
context=internal
qualify=yes

[bob]
type=friend
host=dynamic
secret=secure_password
context=internal
qualify=yes
; /etc/asterisk/extensions.conf
[internal]
exten => 100,1,Dial(SIP/alice,30)
exten => 100,n,Voicemail(100@default)
exten => 101,1,Dial(SIP/bob,30)

exten => _0X.,1,Dial(SIP/${EXTEN}@trunk)
exten => _0X.,n,Hangup()

Security Considerations

VoIP systems face unique security threats:

Call hijacking: An attacker registers as your extension and makes calls on your account. Prevent with strong passwords and IP-based access control.

Eavesdropping: Voice packets sent unencrypted can be captured. Use TLS for SIP signaling and SRTP for media encryption.

Toll fraud: Compromised PBX making calls to premium numbers. Set call limits, restrict international dialing, and monitor call logs.

DoS attacks: SIP flood attacks overwhelm the PBX. Use rate limiting and fail2ban.

; Secure SIP (SIPS) over TLS
sips:alice@example.com;transport=tls

; In Asterisk SIP config:
[general]
encryption=yes
tlsenable=yes
tlsbindaddr=0.0.0.0:5061
tlscertfile=/etc/asterisk/keys/asterisk.pem
tlscafile=/etc/asterisk/keys/ca.crt

Common Errors

1. One-Way Audio (No Return Path)

RTP packets from one side don’t reach the other. Check NAT settings, firewalls, and ensure RTP ports (typically 10000-20000) are open.

2. NAT Traversal Issues

Phones behind NAT send wrong IP addresses in SIP/SDP. Enable nat=force_rport,comedia in Asterisk or use STUN/TURN servers.

3. Codec Mismatch

Caller offers G.722, callee only supports G.711 — no codec in common. Ensure both sides support overlapping codecs.

4. Register Timeouts

SIP phones fail to register. Check: PBX reachability, port 5060 (UDP) open, authentication credentials correct.

5. Packet Loss and Jitter

Real-time voice is sensitive to network conditions. QoS marking (DSCP EF) prioritizes RTP traffic. Keep jitter under 30ms.

6. SIP ALG (Application Layer Gateway)

Many consumer routers have broken SIP ALG implementations that corrupt SIP packets. Disable SIP ALG on the router.

Practice Questions

  1. What is the difference between SIP and RTP? SIP handles signaling (call setup, teardown). RTP carries the actual audio/video media.

  2. What does an INVITE message do? Initiates a call session. It contains the caller’s SDP with supported codecs.

  3. What codec provides toll-quality audio at 64 kbps? G.711 (PCMU or PCMA). It’s the same codec used by traditional telephone networks.

  4. What is a SIP proxy? An intermediary that routes SIP messages between users. It handles registration, authentication, and call routing.

  5. How do you secure a VoIP deployment? Use TLS for SIP signaling, SRTP for media encryption, strong passwords, rate limiting, and disable SIP ALG on firewalls.

Challenge: Set up a two-extension Asterisk PBX on a local server or VM. Configure: (1) two SIP extensions with authentication, (2) internal dialing between extensions, (3) voicemail, (4) TLS encryption for signaling, (5) a simple IVR menu. Test a call between extensions and capture the SIP signaling with Wireshark.

FAQ

What equipment do I need for VoIP?
A SIP phone (hardware or softphone), a PBX (Asterisk, FreePBX, cloud PBX), and a SIP trunk provider for external calling.
Is VoIP voice quality as good as traditional phones?
Yes — with sufficient bandwidth and low latency, VoIP can exceed traditional phone quality. G.722 provides HD voice that sounds significantly better than PSTN.
What internet speed do I need for VoIP?
G.711 uses ~90 kbps per call. For a small office with 5 concurrent calls, 1 Mbps upload is sufficient. Add 150 kbps per additional call.
Can I make emergency calls with VoIP?
Yes, but you must register your address with your VoIP provider for E911 services. VoIP 911 calls are routed differently than traditional 911.
What is WebRTC?
WebRTC is a browser-based real-time communication API that enables voice/video calls without plugins. It uses SIP-inspired signaling over WebSockets.

What’s Next

TutorialWhat You’ll Learn
VoIP Fundamentals GuideDeeper dive into VoIP technology
5G Networks ArchitectureHow 5G enhances mobile VoIP
WebSocket Protocol GuideWebRTC signaling transport

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Updated 2026-06-19.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro