๐ How to Read Asterisk Logs (asterisk -rvvv)
1. Introduction
If youโve ever worked with Asterisk, the worldโs most popular open-source PBX, youโll know that it is both powerful and complex. Asterisk powers VoIP servers, call centers, IVR systems, and SIP trunking solutions across the globe.
But with great flexibility comes the challenge of understanding whatโs happening under the hood. Thatโs where logs come in.
Logs are the heartbeat of Asterisk:
They help administrators troubleshoot issues like failed calls, dropped calls, or one-way audio.
They provide visibility into call flows and application execution.
They help in monitoring system health and debugging SIP signaling.
Asterisk generates logs in multiple places:
CLI output (via the
asterisk -rvvvcommand).System log files (e.g.,
/var/log/asterisk/messagesor/var/log/asterisk/full).CDR logs (Call Detail Records).
Custom log channels (configured via
logger.conf).
๐ In this guide, weโll focus specifically on reading live logs using the Asterisk CLI with the asterisk -rvvv command. This is the fastest way to see whatโs happening in real-time.
2. Understanding the Asterisk CLI
To connect to a running Asterisk instance, use:
asterisk -rvvvBreaking it down:
-rโ Remote connect to an already running Asterisk process.-vโ Increase verbosity (the level of detail in output). Add multiplevs for higher verbosity.
Examples:
asterisk -rv # Basic verbosity (level 1)
asterisk -rvv # Verbosity level 2
asterisk -rvvv # Verbosity level 3
asterisk -rvvvvv # Verbosity level 5At higher verbosity, youโll see more granular details: SIP signaling, codec negotiation, RTP streams, etc.
๐ก Tip: Start with -rvvv (moderate detail) and increase if needed.
3. Basic CLI Navigation
Once inside the CLI, here are some essential commands:
core show help # List all available commands
core set verbose 5 # Change verbosity without reconnecting
core set debug 3 # Enable debug output
logger show channels # View active log channelsInteractive adjustments are extremely useful when troubleshooting live systems.
4. Reading Call Flow in Real-Time
Hereโs a typical call flow captured in Asterisk CLI (-rvvv level):
-- Executing [100@from-internal:1] Dial("SIP/101-00000001", "SIP/100") in new stack
-- Called SIP/100
-- SIP/100 is ringing
-- SIP/100 answered SIP/101-00000001
-- Channel SIP/101-00000001 joined 'simple_bridge'
-- Channel SIP/100-00000002 joined 'simple_bridge'๐ Step-by-step breakdown:
Call initiation โ Extension 101 dials 100.
Dial application execution โ
Dial(SIP/100)is triggered.Ringing state โ Extension 100 starts ringing.
Answer state โ Extension 100 picks up the call.
Bridge creation โ Both channels are joined in a bridge; conversation begins.
This real-time logging makes troubleshooting straightforward: you see the call progress unfold.
5. Verbosity Levels in Depth
Verbosity determines how much detail you see.
Level 1 โ Only high-level call progress.
Level 2โ3 โ Application messages (Dial, Playback, etc.).
Level 4โ5 โ SIP signaling details (
INVITE,200 OK,BYE).Beyond 5 โ Debugging (headers, codec negotiation, RTP streams).
Example comparison with the same call:
Level 1:
-- SIP/100 is ringing
-- SIP/100 answered SIP/101-00000001Level 4:
<--- SIP read from UDP:192.168.1.50:5060 --->
INVITE sip:100@pbx.local SIP/2.0
Via: SIP/2.0/UDP 192.168.1.50:5060;branch=z9hG4bK1234
From: "101" <sip:101@pbx.local>;tag=as2d4f1
To: <sip:100@pbx.local>
Call-ID: 8f732d01@192.168.1.50
CSeq: 102 INVITEAt higher verbosity, youโre essentially peeking into SIP packets.
6. Debugging Specific Channels
Sometimes logs are noisy. Focus on one extension or peer:
sip set debug on # Show all SIP messages
sip set debug peer 101 # Show only for peer 101
pjsip set logger on # For PJSIP instead of chan_sip
core set debug channel SIP/101-00000001This precision avoids unnecessary clutter and speeds up troubleshooting.
7. Log Files vs CLI Output
CLI is for live monitoring. Log files are for historical analysis.
Key file:
tail -f /var/log/asterisk/fullWhen to use which:
CLI โ Real-time debugging while making test calls.
File logs โ Post-incident review, long-term monitoring, integration with log systems.
8. Common Scenarios with Examples
โ Call not completing
Look for: Busy, Congestion, No route to destination.
๐ One-way audio
Enable RTP debug:
rtp set debug on๐ Registration issues
Check REGISTER messages with:
sip set debug peer 101๐ Dropped calls
Look for SIP BYE or CANCEL traces.
9. Practical CLI Cheatsheet
Quick reference for daily use:
asterisk -rvvv # Enter CLI with verbosity
core set verbose X # Adjust verbosity
logger reload # Reload logger config
sip set debug on # Enable SIP debug
pjsip set logger on # Enable PJSIP debug
rtp set debug on # Debug RTP streams
core show channels # Show active calls
dialplan show # View loaded dialplan10. Best Practices for Reading Logs
โ Start with
-rvvv, then increase verbosity.โ Use targeted debugging (
sip set debug peer 100).โ Combine CLI with
tail -f /var/log/asterisk/full.โ ๏ธ Avoid high verbosity in production (performance risk).
๐ Always capture log snippets when asking for support.
11. Conclusion
Mastering Asterisk logs is the key to becoming a confident VoIP administrator.
asterisk -rvvvgives you immediate insight into call progress.Adjusting verbosity levels reveals deeper SIP and RTP details.
Combining CLI and log files ensures both real-time and historical visibility.
๐ The more you practice with test calls in a lab PBX, the faster youโll build an intuition for recognizing issues just by looking at logs.
For production setups, donโt forget advanced logging strategies like logger.conf, syslog integration, and log rotation for long-term maintainability.
12. Appendix
Sample SIP INVITE (decoded)
INVITE sip:100@pbx.local SIP/2.0
Via: SIP/2.0/UDP 192.168.1.101:5060;branch=z9hG4bKabc123
From: "101" <sip:101@pbx.local>;tag=12345
To: <sip:100@pbx.local>
Call-ID: abc123@192.168.1.101
CSeq: 1 INVITE
Content-Type: application/sdpExample logger.conf setup
[logfiles]
console => notice,warning,error,debug,verbose
messages => notice,warning,error
full => notice,warning,error,verbose,debugQuick Reference Table
Message Example | Meaning |
|---|---|
| Dialplan or SIP trunk config issue |
| Extension is being alerted |
| Call successfully connected |
| Call terminated normally |
| Possible audio path/network issue |
