Advanced Configuration
Advanced trunk settings control audio quality, network compatibility, and protocol behavior. These settings have significant impact on call quality and reliability. Only modify if you understand the implications or are following provider-specific instructions.
Codec Configuration
Audio Codec Selection:
What is a Codec?
- Compresses audio for transmission
- Balances quality vs bandwidth
- Both sides must support same codec
- Negotiated at call establishment
Available Audio Codecs:
G.711u (PCMU) - Uncompressed Quality
- Bandwidth: ~87 Kbps (64 Kbps + overhead)
- Quality: Excellent (toll quality)
- Latency: Very low
- CPU: Minimal
- Use Case: LAN, high-bandwidth connections, best quality
- Compatibility: Universal support
G.711a (PCMA) - European Standard
- Bandwidth: ~87 Kbps
- Quality: Excellent (identical to G.711u)
- Difference: Companding algorithm (EU standard)
- Use Case: Same as G.711u, especially in Europe
- Compatibility: Universal support
G.729 - Low Bandwidth
- Bandwidth: ~31 Kbps (8 Kbps + overhead)
- Quality: Good (near toll quality)
- Latency: Moderate
- CPU: Moderate
- Use Case: Bandwidth-constrained links, many concurrent calls
- Compatibility: Widely supported
- License: May require licensing fees
Opus - Modern Adaptive
- Bandwidth: 6-510 Kbps (adaptive)
- Quality: Excellent (better than G.711 at high bitrate)
- Latency: Very low
- CPU: Low-moderate
- Use Case: Modern systems, variable bandwidth, best quality/bandwidth ratio
- Compatibility: Newer systems (check provider support)
G.722 - Wideband
- Bandwidth: ~87 Kbps
- Quality: HD voice (7 kHz vs 3.4 kHz)
- Latency: Low
- CPU: Low
- Use Case: HD voice, conference calls
- Compatibility: Moderate (growing)
Recommendation
Use G.711u/a for best quality when bandwidth allows. Use G.729 for bandwidth savings. Use Opus if both sides support it (best of both worlds).
Video Codec Selection:
H.264 - Standard Video
- Bandwidth: 512 Kbps - 2 Mbps
- Quality: Good to excellent
- Resolution: Up to 1080p
- Compatibility: Universal
- Use Case: Standard video calls
VP8 - Open Standard
- Bandwidth: Similar to H.264
- Quality: Comparable to H.264
- Resolution: Up to 1080p
- Compatibility: WebRTC, modern systems
- License: Royalty-free
VP9 - Improved Efficiency
- Bandwidth: 25-50% less than H.264
- Quality: Better than VP8
- Resolution: Up to 4K
- Compatibility: Newer systems
- Use Case: Bandwidth-constrained video
Video Considerations:
- Most trunks don't support video (voice only)
- Check provider capabilities
- Requires significantly more bandwidth
- May need separate video-enabled trunk
Video Support
Most business VoIP trunks are audio-only. Video calling typically uses separate platforms (Zoom, Teams, etc.) or specialized video trunks.
Codec Negotiation & Priority:
How Codec Selection Works:
- Your PBX offers list of codecs (in priority order)
- Provider responds with matching codecs
- First mutually supported codec is used
- No match = call fails
Configuring Priority:
Priority 1: Opus (best quality/bandwidth if supported)
Priority 2: G.711u (best quality, high bandwidth)
Priority 3: G.711a (best quality, EU)
Priority 4: G.729 (low bandwidth fallback)Different Scenarios:
High Bandwidth, Best Quality:
1. G.711u
2. G.711a
3. Opus
(Skip G.729)Low Bandwidth, Cost Savings:
1. G.729
2. Opus (adaptive, might use less)
3. G.711u (fallback)Modern Systems:
1. Opus (adaptive, best choice)
2. G.722 (HD voice)
3. G.711u (fallback)Maximum Compatibility:
1. G.711u (everyone supports)
2. G.711a (almost everyone)
3. G.729 (widely supported)
4. Opus (newer systems)Provider-Specific:
- Some providers only support specific codecs
- Check provider documentation
- Prioritize what they support
- Test all supported codecs
Provider Compatibility
Always verify codec support with your provider. Selecting unsupported codec results in call failure or forced downgrade.
Bandwidth Calculation:
Per Call Bandwidth (one-way):
G.711u/a:
Codec: 64 Kbps
IP/UDP/RTP Overhead: ~23 Kbps
Total: ~87 Kbps per call
Bidirectional: ~174 Kbps per callG.729:
Codec: 8 Kbps
IP/UDP/RTP Overhead: ~23 Kbps
Total: ~31 Kbps per call
Bidirectional: ~62 Kbps per callOpus (adaptive):
Codec: 6-128 Kbps (variable)
Overhead: ~23 Kbps
Total: ~29-151 Kbps per call
Bidirectional: Variable based on conditionsTotal Bandwidth Calculation:
G.711 Example:
10 concurrent calls = 10 × 174 Kbps = 1.74 Mbps
Add 20% buffer = 2.09 Mbps recommended
G.729 Example:
10 concurrent calls = 10 × 62 Kbps = 620 Kbps
Add 20% buffer = 744 Kbps recommendedBandwidth Recommendations:
Small Office (1-5 concurrent calls):
- G.711: 1 Mbps minimum
- G.729: 400 Kbps minimum
Medium Office (5-20 concurrent calls):
- G.711: 5 Mbps minimum
- G.729: 2 Mbps minimum
Large Office (20-100 concurrent calls):
- G.711: 20+ Mbps minimum
- G.729: 8+ Mbps minimum
- Consider QoS and dedicated circuit
Quality vs Bandwidth Trade-off:
High Bandwidth Available:
→ Use G.711 (best quality)
→ ~87 Kbps per call
Limited Bandwidth:
→ Use G.729 (good quality)
→ ~31 Kbps per call
→ 65% bandwidth savings
Variable Bandwidth:
→ Use Opus (adaptive)
→ Adjusts to conditions
→ Best quality for available bandwidthAlways Add Buffer
Calculate for peak concurrent calls + 20% buffer. VoIP quality degrades rapidly when bandwidth is insufficient. Better to over-provision.
DTMF Configuration
DTMF Transmission Methods:
What is DTMF?
- Dual-Tone Multi-Frequency
- Touch-tone keypad tones (0-9, *, #)
- Used for IVR navigation, voicemail PIN, transfers
Three Transmission Methods:
RFC2833 (RTP Event) - Recommended
- Sends DTMF as RTP events
- Separate from audio stream
- Most reliable over IP
- Standard method
- Best compatibility
SIP INFO - Alternative
- Sends DTMF in SIP INFO messages
- Out-of-band signaling
- Less common
- Used by some providers
Inband - Legacy
- DTMF tones in audio stream
- Susceptible to codec issues
- Can be distorted by compression
- Least reliable over IP
- Last resort
Recommendation
Use RFC2833 unless your provider specifically requires SIP INFO or Inband. RFC2833 is most reliable for VoIP.
RFC2833 Configuration:
How It Works:
- User presses key on phone
- Phone detects DTMF tone
- Converted to RTP event
- Sent as separate RTP packets (not audio)
- Receiving end regenerates DTMF tone
Configuration:
DTMF Mode: RFC2833
RTP Payload Type: 101 (standard)
Duration: 100-250msAdvantages:
- Codec-independent (works with G.729)
- Reliable transmission
- Not affected by compression
- Industry standard
- Universal support
Troubleshooting:
- Verify both sides use RFC2833
- Check RTP payload type matches (usually 101)
- Ensure RTP packets not blocked by firewall
- Verify no packet loss on RTP stream
Testing:
- Call automated system (bank IVR, etc.)
- Press keys, verify detected
- Test voicemail PIN entry
- Test call transfers
Best Choice
RFC2833 is the industry standard for DTMF over VoIP. Use unless provider explicitly requires different method.
SIP INFO Method:
How It Works:
- User presses key
- Phone detects DTMF
- Sent as SIP INFO message
- Out-of-band (not in RTP stream)
- Receiving end processes INFO message
Configuration:
DTMF Mode: SIP INFO
INFO Content-Type: application/dtmf-relay
Duration: Per SIP INFO messageWhen to Use:
- Provider requires SIP INFO
- RFC2833 not supported
- Alternative to Inband
- Specific compatibility requirements
Advantages:
- Codec-independent
- Separate from audio
- Can carry additional info
- Works through some firewalls better
Disadvantages:
- Less universal support
- Requires SIP ALG handling
- May fail through some NAT devices
- Not as reliable as RFC2833
Troubleshooting:
- Verify SIP INFO enabled on both sides
- Check firewall allows SIP INFO messages
- Review SIP logs for INFO message delivery
- Test with provider support
Compatibility
SIP INFO is less universally supported than RFC2833. Only use if specifically required by provider.
Inband DTMF:
How It Works:
- User presses key
- Phone generates DTMF tone
- Tone transmitted in audio stream
- Receiving end detects tone in audio
- Decoded back to digit
Configuration:
DTMF Mode: Inband
Codec: G.711 (required for reliability)
Detection: Tone detection algorithmChallenges:
- Compressed codecs (G.729) distort tones
- Packet loss corrupts tones
- Echo cancellation can remove tones
- Jitter affects tone duration
- Least reliable method
When to Use:
- Legacy systems requirement
- RFC2833 and SIP INFO unavailable
- Last resort only
- Testing/troubleshooting
Requirements for Inband:
- Must use G.711 codec (uncompressed)
- Disable echo cancellation during DTMF
- Low packet loss (<1%)
- Low jitter (<20ms)
- Good network quality
Not Recommended:
- Modern VoIP systems
- G.729 or compressed codecs
- Poor network quality
- Long distance connections
Last Resort
Inband DTMF is unreliable over VoIP, especially with compressed codecs. Only use if RFC2833 and SIP INFO are not options.
NAT & Firewall Settings
Network Address Translation (NAT):
What is NAT?
- Translates private IP to public IP
- Allows multiple devices behind router
- Common in business networks
- Requires special handling for VoIP
NAT Issues with VoIP:
- SIP packets contain IP addresses in body
- RTP streams use dynamic ports
- One-way audio (can't hear caller)
- Call setup failures
- Registration issues
NAT Settings:
External IP Address:
Auto-Detect: PBX discovers public IP automatically
Manual: Enter public IP (e.g., 203.0.113.45)
When to Use: Behind NAT/routerLocal Network:
Format: 192.168.1.0/24 or 10.0.0.0/8
Purpose: Defines internal network range
Why: Helps PBX distinguish internal vs externalNAT Mode:
Options: Yes, No, Auto, Force_rport
Recommended: Auto or Yes
Effect: Rewrites SIP headers for NAT traversalConfiguration Example:
NAT: Enabled
External IP: 203.0.113.45 (auto-detect)
Local Network: 192.168.1.0/24
External Media Address: Same as External IP
External SIP Address: Same as External IPOne-Way Audio Fix
90% of one-way audio issues are caused by NAT problems. Enable NAT settings and configure external IP to resolve.
STUN and TURN Servers:
STUN (Session Traversal Utilities for NAT):
- Helps discover public IP address
- Tests NAT type
- Enables NAT traversal
- Free public STUN servers available
STUN Configuration:
STUN Server: stun.l.google.com:19302
Or: stun.thevoco.com:3478
Purpose: Discover external IP
When: Behind NAT, dynamic IPTURN (Traversal Using Relays around NAT):
- Relays media through server
- Used when direct connection fails
- More expensive (bandwidth costs)
- Fallback when STUN insufficient
When to Use STUN/TURN:
Use STUN:
- Behind NAT
- External IP changes (DHCP)
- Symmetric NAT
- Remote workers on home networks
Use TURN:
- STUN fails
- Strict firewalls
- Symmetric NAT (both sides)
- Enterprise security policies
Configuration Priority:
1. Direct Connection (no NAT, best)
2. STUN (discover IP, good)
3. TURN (relay, acceptable)Testing:
- Test with and without STUN
- Compare call quality
- Check if one-way audio resolved
- Monitor for issues
Public STUN Servers
Google and other providers offer free STUN servers. Use only for testing/small deployments. For production, use provider's STUN server or your own.
Firewall Port Configuration:
Required Ports:
SIP Signaling:
Protocol: UDP/TCP
Port: 5060 (unencrypted)
Port: 5061 (TLS encrypted)
Direction: Bidirectional
Requirement: Must be openRTP Media (Audio/Video):
Protocol: UDP
Port Range: 10000-20000 (typical)
Or: 16384-32767 (alternative)
Direction: Bidirectional
Requirement: Must be open for audioPort Forwarding Configuration:
Router/Firewall Rules:
External Port 5060 → Internal PBX IP:5060 (SIP)
External Port 10000-20000 → Internal PBX IP:10000-20000 (RTP)Example Configuration:
PBX Internal IP: 192.168.1.100
External IP: 203.0.113.45
Rule 1 (SIP):
External: 203.0.113.45:5060
Internal: 192.168.1.100:5060
Protocol: UDP/TCP
Rule 2 (RTP):
External: 203.0.113.45:10000-20000
Internal: 192.168.1.100:10000-20000
Protocol: UDPPort Range Sizing:
RTP uses 2 ports per call (send + receive)
10 concurrent calls = 20 ports minimum
Recommendation: 10000-20000 (10,000 ports)
Supports: ~5,000 concurrent callsSecurity Considerations:
- Restrict source IPs if possible (provider IPs only)
- Use TLS (port 5061) for encryption
- Monitor for scanning/attacks
- Implement rate limiting
- Use fail2ban or similar
Security vs Functionality
Opening ports creates security exposure. Balance security (restrict to provider IPs) with functionality (allow necessary traffic).
SIP Application Layer Gateway (ALG):
What is SIP ALG?
- Router/firewall feature
- "Helps" with SIP NAT traversal
- Modifies SIP packets automatically
- Often causes more problems than it solves
Problems with SIP ALG:
- Incorrectly rewrites SIP headers
- Corrupts SIP packets
- Breaks registration
- Causes one-way audio
- Interferes with proper NAT handling
- Inconsistent implementation across vendors
Symptoms of SIP ALG Issues:
- Registration fails intermittently
- One-way audio on some calls
- Calls drop after few minutes
- RTP packets to wrong IP
- SIP responses to wrong port
Recommendation: DISABLE SIP ALG
How to Disable:
Common Routers:
Cisco: No ip nat service sip udp port 5060
Linksys: Advanced Settings > SIP ALG > Disable
Netgear: Advanced > WAN Setup > NAT Filtering > Disable
Asus: WAN > NAT Passthrough > SIP Passthrough > Disable
pfSense: System > Advanced > Disable SIP ALGAlternative if Can't Disable:
- Use non-standard SIP port (5061, 5062)
- Use TCP instead of UDP
- Use VPN tunnel
- Replace router with one that allows disable
After Disabling:
- Configure NAT settings in PBX properly
- Set external IP
- Configure local network range
- Test thoroughly
Disable SIP ALG
SIP ALG causes more problems than it solves. ALWAYS disable it. Configure NAT properly in PBX instead of relying on router's SIP ALG.
Quality of Service (QoS)
Quality of Service Overview:
What is QoS?
- Prioritizes VoIP traffic over other data
- Ensures voice packets delivered first
- Reduces latency, jitter, packet loss
- Essential for good call quality
Why QoS Matters:
- VoIP is real-time (delay-sensitive)
- Packet loss = choppy audio
- Jitter = inconsistent quality
- Latency = delay in conversation
- Competing traffic (downloads, streaming) affects quality
QoS Metrics:
Latency (Delay):
- Good: < 150ms
- Acceptable: 150-300ms
- Poor: > 300ms
- Target: < 100ms for excellent quality
Jitter (Variation):
- Good: < 20ms
- Acceptable: 20-50ms
- Poor: > 50ms
- Target: < 10ms for best quality
Packet Loss:
- Good: < 0.5%
- Acceptable: 0.5-1%
- Poor: > 1%
- Target: < 0.1% for excellent quality
Bandwidth:
- G.711: ~87 Kbps per call
- G.729: ~31 Kbps per call
- Rule: 2x calculated bandwidth for headroom
Critical for Quality
QoS is the single most important factor for consistent VoIP quality. Without QoS, voice competes with bulk data and suffers.
DSCP (Differentiated Services Code Point):
What is DSCP?
- Marks packets for priority
- Value in IP header
- Tells routers how to handle packet
- Industry standard for QoS
DSCP Values for VoIP:
Voice (RTP Audio):
DSCP: EF (Expedited Forwarding)
Value: 46 (decimal) or 0x2E (hex)
Binary: 101110
Priority: Highest
Use: Audio RTP streamsSIP Signaling:
DSCP: CS3 or AF31
Value: 24 or 26 (decimal)
Priority: High
Use: SIP registration, call setupVideo:
DSCP: AF41
Value: 34 (decimal)
Priority: High
Use: Video calls (if supported)Configuration in PBX:
RTP DSCP: 46 (EF)
SIP DSCP: 26 (AF31)
Enable: Yes
Apply to: All VoIP trafficRouter Configuration:
Priority Queue 1 (Highest):
- DSCP EF (46) - Voice
- 30% of bandwidth minimum
- Low latency queue
Priority Queue 2:
- DSCP AF31 (26) - Signaling
- 10% of bandwidth
Normal Queue:
- All other traffic
- Remaining bandwidthStandard Value
DSCP EF (46) is the industry standard for voice. Always use this value for maximum compatibility with routers and carriers.
Traffic Shaping & Prioritization:
Three-Tier Priority:
Tier 1: Voice (Highest)
Traffic: RTP audio packets
DSCP: EF (46)
Bandwidth: Reserved (30% minimum)
Latency: < 10ms
Jitter Buffer: Minimal
Packet Loss: < 0.1%Tier 2: Signaling (High)
Traffic: SIP messages
DSCP: AF31 (26)
Bandwidth: 10% reserved
Latency: < 100ms
Purpose: Call setup/teardownTier 3: Everything Else (Normal)
Traffic: HTTP, email, file transfers
DSCP: Default (0)
Bandwidth: Best effort
Can be delayed: YesBandwidth Allocation:
Example: 10 Mbps Link
Voice (G.711, 10 calls):
Reserved: 3 Mbps (30%)
Calculated need: 1.74 Mbps
Headroom: Yes (plenty)
Signaling:
Reserved: 1 Mbps (10%)
Actual use: < 100 Kbps
Headroom: Yes
Data:
Remaining: 6 Mbps (60%)
Best effort: Yes
Note: Can use more if voice not activeTraffic Shaping Rules:
- Voice always goes first (no exceptions)
- Signaling second (fast call setup)
- Data uses remaining bandwidth
- Voice can burst beyond reserved amount
- Data throttled if voice needs bandwidth
Reservation vs Prioritization
Reserve bandwidth for voice, but allow it to use more if available. Prioritize so voice never waits for data packets.
End-to-End QoS Implementation:
Network Layers:
Layer 1: PBX Configuration
Action: Mark packets with DSCP
Setting: RTP = EF (46), SIP = AF31 (26)
Result: Packets marked for routersLayer 2: Access Switch
Action: Trust DSCP markings
Action: Prioritize EF traffic
Config: Priority queues by DSCP
Result: VoIP prioritized on LANLayer 3: Router/Firewall
Action: Enforce QoS policy
Action: Shape traffic to WAN
Config: Bandwidth allocation, priority queues
Result: VoIP prioritized over WANLayer 4: ISP/Carrier
Action: Honor DSCP markings (if business service)
Action: Prioritize EF traffic
Result: VoIP prioritized across internet
Note: Consumer ISPs may not honor DSCPImplementation Steps:
Step 1: Configure PBX
Enable DSCP marking
Set RTP to EF (46)
Set SIP to AF31 (26)
Test: Capture packets, verify DSCP setStep 2: Configure Switches
Create VoIP VLAN (optional but recommended)
Trust DSCP markings from PBX
Priority queues: EF highest
Test: Monitor queue statisticsStep 3: Configure Router
Create traffic classes (Voice, Signaling, Data)
Assign DSCP to classes
Priority queuing: Voice first
Bandwidth allocation: 30% voice minimum
Test: Monitor during peak usageStep 4: ISP Coordination
Business internet: Request QoS support
Verify: DSCP honored across connection
Alternative: Dedicated voice circuit
Test: End-to-end latency/jitter monitoringVLAN Segregation (Recommended):
VLAN 10: Voice (phones, PBX)
VLAN 20: Data (computers, servers)
VLAN 30: Guest (WiFi, visitors)
Benefits:
- Physical separation
- Guaranteed bandwidth per VLAN
- Enhanced security
- Easier QoS implementationBusiness Internet Required
Consumer internet rarely honors QoS markings. For reliable VoIP, use business internet with QoS support or dedicated voice circuit.
SIP Advanced Settings
SIP Transport Protocol:
UDP (User Datagram Protocol):
Port: 5060
Overhead: Lowest
Latency: Lowest
Reliability: No built-in retransmission
Packet Loss: Can lose packets
Use Case: Standard VoIP (most common)
Best For: Stable networks, low latency requiredTCP (Transmission Control Protocol):
Port: 5060
Overhead: Higher
Latency: Slightly higher
Reliability: Guaranteed delivery
Packet Loss: Automatic retransmission
Use Case: Unreliable networks, NAT issues
Best For: Traversing firewalls, long distanceTLS (Transport Layer Security):
Port: 5061
Overhead: Highest
Latency: Highest
Reliability: Guaranteed delivery
Security: Encrypted
Use Case: Security required, compliance
Best For: Sensitive industries, HIPAA, financialComparison:
Speed: UDP > TCP > TLS
Reliability: TLS = TCP > UDP
Security: TLS > TCP = UDP
NAT Traversal: TCP > TLS > UDP
Resource Usage: UDP < TCP < TLSWhen to Use Each:
Use UDP (Default):
- Stable network
- Low latency required
- Standard configuration
- Most providers default to UDP
Use TCP:
- UDP blocked by firewall
- Traversing strict NAT
- Network packet loss issues
- Provider requires TCP
Use TLS:
- Security/compliance required
- HIPAA, financial services
- Encrypted signaling needed
- Provider offers TLS
Default to UDP
UDP is standard for VoIP. Only use TCP/TLS if you have specific requirements (firewall issues, security compliance, provider requirement).
SIP Session Timers:
What are Session Timers?
- Keep-alive mechanism for calls
- Periodic refresh during call
- Detects and cleans up stale sessions
- Prevents "zombie" calls
Configuration:
Session Expires:
Value: 1800 seconds (30 minutes) typical
Range: 300-3600 seconds
Purpose: How long before refresh needed
Recommendation: 1800 (provider default)Minimum Session Expires:
Value: 90 seconds typical
Purpose: Shortest allowed refresh interval
Recommendation: 90-300 secondsSession Refresher:
Options: UAC (caller), UAS (callee), Auto
Purpose: Who sends refresh
Recommendation: Auto (negotiate)Why Session Timers Matter:
- Detects hung calls
- Frees up trunk resources
- Prevents billing issues
- Cleans up after network failures
Typical Configuration:
Session-Expires: 1800
Min-SE: 90
Refresher: UAC
Enable: YesTroubleshooting:
- Calls drop at exact intervals (e.g., every 30 minutes)
- Likely session timer expiration
- Increase Session-Expires value
- Verify both sides support session timers
Call Duration
If calls disconnect at regular intervals (30 min, 60 min), check session timer configuration. May need adjustment.
SIP Authentication Methods:
Digest Authentication (Standard):
Method: MD5 hash
Fields: Username, password, realm, nonce
Security: Moderate (password not sent in clear)
Use: Standard SIP registrationConfiguration:
Auth Username: sipuser123
Password: SecureP@ss123
Auth ID: sipuser123 (may differ from username)
Realm: sip.provider.comIP Authentication:
Method: IP address whitelist
Fields: Source IP address
Security: Moderate (IP can be spoofed)
Use: Peer trunks, trusted networksConfiguration:
Allowed IPs: 203.0.113.45, 203.0.113.46
No credentials needed
Provider whitelists your IPCertificate Authentication (TLS):
Method: X.509 certificates
Fields: Certificate, private key
Security: High (mutual TLS)
Use: High-security requirementsConfiguration:
Client Certificate: cert.pem
Private Key: key.pem
CA Certificate: ca.pemBest Practices:
- Use strong passwords (16+ characters, random)
- Rotate credentials periodically (annually)
- Store securely (password manager)
- Different passwords per trunk
- Monitor for auth failures (could be attacks)
Security
Use strong, unique passwords for each trunk. Weak passwords lead to toll fraud. Consider IP restrictions in addition to password auth.
Custom SIP Headers:
What are Custom Headers?
- Additional fields in SIP messages
- Provider-specific information
- Call routing hints
- Billing codes
- Custom metadata
Common Use Cases:
Account Code Header:
Header: X-Account-Code
Value: PROJECT-12345
Purpose: Billing/cost allocationCLI Manipulation:
Header: P-Asserted-Identity
Value: <sip:[email protected]>
Purpose: Trusted caller IDRouting Header:
Header: X-Route-Hint
Value: PREMIUM
Purpose: Priority routingProvider-Specific:
Header: X-Provider-API-Key
Value: abc123xyz789
Purpose: Provider authentication/trackingConfiguration:
Custom Header 1:
Name: X-Account-Code
Value: {account_code}
Apply: Outbound calls
Custom Header 2:
Name: X-Department
Value: {department}
Apply: All callsDynamic Variables:
{caller_id}: Caller ID number{called_number}: Destination number{extension}: Extension making call{timestamp}: Current timestamp{call_id}: Unique call identifier
Advanced: Header Manipulation:
Remove Headers:
- Remove: User-Agent (privacy)
- Remove: Server (security)
Modify Headers:
- Rewrite: Contact (NAT traversal)
- Rewrite: Via (proxy handling)Provider Specific
Custom headers are typically provider-specific. Only use if instructed by provider. Incorrect headers can cause call failures.
Troubleshooting Tools
SIP Message Logging:
Enable SIP Debug:
Settings > Trunks > [Trunk] > Debug
Enable: SIP Debug
Level: Full (all messages)
Duration: 30 minutes (auto-disable)What SIP Debug Shows:
- REGISTER messages (registration)
- INVITE messages (call setup)
- 200 OK responses (success)
- BYE messages (hangup)
- Error codes (failures)
- Full SIP headers and body
Reading SIP Messages:
Successful Registration:
REGISTER sip:provider.com SIP/2.0
→ 401 Unauthorized (challenge)
REGISTER with auth
→ 200 OK (success)
Result: RegisteredCall Setup:
INVITE sip:[email protected]
→ 100 Trying
→ 180 Ringing
→ 200 OK (answered)
ACK
→ Call establishedCommon Error Codes:
401 Unauthorized: Bad credentials403 Forbidden: Access denied404 Not Found: Number invalid408 Request Timeout: Network issue480 Temporarily Unavailable: Trunk busy486 Busy Here: Destination busy503 Service Unavailable: Provider issue
Troubleshooting Tool
SIP debug is essential for troubleshooting call failures. Error codes tell you exactly what's wrong (credentials, routing, provider issue, etc.).
Network Testing Tools:
Ping Test (Latency):
Tool: ping sip.provider.com
Measure: Round-trip time (RTT)
Good: < 50ms
Acceptable: 50-150ms
Poor: > 150ms
Action: Check network path, ISP qualityTraceroute (Path):
Tool: traceroute sip.provider.com
Shows: Network hops to destination
Check: Number of hops (fewer better)
Look for: Packet loss, high latency hopsBandwidth Test:
Tool: iperf, speedtest
Measure: Available bandwidth
Calculate: Calls × codec bandwidth
Example: 10 calls × 87 Kbps = 870 Kbps minimumJitter Test:
Tool: VoIP quality test apps
Measure: Packet delay variation
Good: < 10ms
Acceptable: 10-30ms
Poor: > 30msPacket Loss Test:
Tool: Extended ping, mtr
Measure: % of packets lost
Good: < 0.5%
Acceptable: 0.5-1%
Poor: > 1%
Action: Check network equipment, ISPDNS Lookup:
Tool: nslookup sip.provider.com
Check: DNS resolution working
Verify: Resolves to correct IP
Speed: Resolution should be < 100msPort Connectivity:
Tool: telnet sip.provider.com 5060
Or: netcat, nmap
Check: Port 5060/5061 reachable
Verify: No firewall blockingNetwork First
Before troubleshooting PBX, verify network quality. 90% of VoIP issues are network-related (latency, jitter, packet loss, bandwidth).
Call Quality Monitoring:
MOS Score (Mean Opinion Score):
Scale: 1.0 - 5.0
5.0: Perfect (equivalent to landline)
4.0-4.5: Good (most VoIP)
3.5-4.0: Acceptable (minor issues)
< 3.5: Poor (noticeable problems)
< 2.5: Unacceptable (call quality very poor)R-Factor:
Scale: 0 - 100
> 80: Good
70-80: Acceptable
< 70: Poor
Calculation: Based on latency, jitter, packet lossReal-Time Metrics:
During Call:
- Current jitter
- Current packet loss
- Current latency
- Current MOS score
- Codec in use
Post-Call Reports:
Call Quality Report:
Duration: 5:23
Codec: G.711u
Avg Jitter: 8ms
Max Jitter: 23ms
Packet Loss: 0.3%
Latency: 45ms
MOS Score: 4.2 (Good)Threshold Alerts:
Alert if:
- Jitter > 30ms
- Packet Loss > 1%
- Latency > 150ms
- MOS < 3.5
Action: Investigate, fix networkHistorical Trending:
- Track quality over time
- Identify patterns (time of day, specific trunks)
- Proactive problem identification
- Capacity planning
Proactive Monitoring
Monitor call quality metrics continuously. Don't wait for user complaints. Identify and fix issues proactively.
Packet Capture Analysis:
Tools:
- Wireshark: GUI packet analyzer (most popular)
- tcpdump: Command-line capture
- tshark: Wireshark command-line
- sngrep: TUI SIP packet analyzer
Capturing VoIP Traffic:
Wireshark:
Capture Filter: port 5060 or portrange 10000-20000
Display Filter: sip or rtp
Save As: capture.pcaptcpdump:
Command: tcpdump -i eth0 -s 0 -w voip.pcap port 5060 or portrange 10000-20000
Interface: eth0 (network interface)
Output: voip.pcap fileWhat to Look For:
SIP Messages:
- Registration success/failure
- Call setup sequence
- Error responses
- Header information
RTP Streams:
- Audio packets flowing
- DSCP marking (QoS)
- Packet timing (jitter)
- Packet loss
Common Issues Identified:
One-Way Audio:
Symptom: RTP flows one direction only
Cause: NAT/firewall blocking return path
Evidence: No RTP packets in reverse directionHigh Jitter:
Symptom: Irregular packet spacing
Cause: Network congestion, no QoS
Evidence: RTP timestamps show high variancePacket Loss:
Symptom: Missing RTP sequence numbers
Cause: Network congestion, bad equipment
Evidence: Gaps in RTP sequence numbersDSCP Verification:
Check: IP header DSCP field
Expected: 46 (EF) for RTP audio
Actual: Check if marked correctly
Issue: If 0, QoS marking not workingAdvanced Troubleshooting
Packet capture is the ultimate troubleshooting tool. Shows exactly what's happening on the wire. Essential for complex issues.
Best Practices
Advanced Configuration Recommendations
Follow these best practices for optimal trunk performance and reliability.
Codec Selection
- Quality Over Savings: Use G.711 if bandwidth allows (best quality)
- Bandwidth Constraints: Use G.729 for bandwidth savings (good quality)
- Modern Systems: Consider Opus (adaptive, best of both worlds)
- Provider Compatibility: Verify provider supports your chosen codec
- Test Thoroughly: Test audio quality with each codec before deployment
Network Configuration
- QoS Always: Always implement QoS for production VoIP
- DSCP Marking: Mark RTP with EF (46), SIP with AF31 (26)
- Bandwidth Reservation: Reserve 30% for voice minimum
- NAT Configuration: Properly configure NAT settings if behind router
- Disable SIP ALG: Always disable SIP ALG on routers/firewalls
- Open Ports: Ensure SIP (5060/5061) and RTP (10000-20000) open
Monitoring
- Call Quality Metrics: Monitor MOS, jitter, latency, packet loss
- Alert Thresholds: Set up alerts for quality degradation
- Trending: Track metrics over time to identify patterns
- SIP Logs: Enable and review SIP logs for failures
- Network Tests: Regular ping, traceroute, bandwidth tests
- Packet Capture: Capture packets for complex troubleshooting
Security
- Strong Passwords: Use random, 16+ character passwords
- IP Restrictions: Restrict to provider IPs when possible
- TLS Encryption: Use TLS for sensitive industries
- Disable Unused: Disable unused protocols and features
- Rate Limiting: Implement rate limiting to prevent fraud
- Monitor Attacks: Watch for registration attacks, toll fraud
Documentation
- Configuration Records: Document all trunk settings
- Change Log: Track all configuration changes
- Provider Info: Keep provider contact info updated
- Troubleshooting Notes: Document issues and resolutions
- Network Diagram: Maintain current network diagram
- Test Results: Record all test results