Asterisk

How to Read Asterisk Logs (asterisk -rvvv): A Complete Guide for Beginners and Admins

Himanshu Pal

Himanshu Pal

How to Read Asterisk Logs (asterisk -rvvv): A Complete Guide for Beginners and Admins

๐Ÿ“ž 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 -rvvv command).

  • System log files (e.g., /var/log/asterisk/messages or /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 -rvvv

Breaking it down:

  • -r โ†’ Remote connect to an already running Asterisk process.

  • -v โ†’ Increase verbosity (the level of detail in output). Add multiple vs for higher verbosity.

Examples:

asterisk -rv        # Basic verbosity (level 1)
asterisk -rvv       # Verbosity level 2
asterisk -rvvv      # Verbosity level 3
asterisk -rvvvvv    # Verbosity level 5

At 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 channels

Interactive 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:

  1. Call initiation โ€“ Extension 101 dials 100.

  2. Dial application execution โ€“ Dial(SIP/100) is triggered.

  3. Ringing state โ€“ Extension 100 starts ringing.

  4. Answer state โ€“ Extension 100 picks up the call.

  5. 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-00000001

Level 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 INVITE

At 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-00000001

This 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/full

When 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 dialplan

10. 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 -rvvv gives 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/sdp

Example logger.conf setup

[logfiles]
console => notice,warning,error,debug,verbose
messages => notice,warning,error
full => notice,warning,error,verbose,debug

Quick Reference Table

Message Example

Meaning

No route to destination

Dialplan or SIP trunk config issue

SIP/100 is ringing

Extension is being alerted

SIP/100 answered

Call successfully connected

BYE received

Call terminated normally

RTP Read error

Possible audio path/network issue


Community Comments

0 comments