DiPiazza

Where I break stuff, then write about it.

Asterisk Command Reference

Quick reference guide for VoIP troubleshooting and server management

Network Diagnostics

DNS Lookup & Public IP

Resolves domain names to IP addresses and retrieves your public IP address using OpenDNS resolver.

nslookup myip.opendns.com. resolver1.opendns.com
Use case: Quickly determine the public IP address of a client or server without visiting external websites.

Public IP (curl ifconfig.me)

Fetch the public IP address using ifconfig.me.

curl ifconfig.me

Trace Route

Maps the complete network path packets take from source to destination.

tracert destination
Use case: Diagnose where network delays or failures occur in the routing path.

Ping Test

Tests network connectivity and measures round-trip time.

Flag: -t runs a continuous ping until stopped.
ping hostname
ping -t hostname

ARP Table

Displays the Address Resolution Protocol table.

Flag: -a shows all entries in the ARP table.
arp -a

MTR - Network Path Analysis

Combines traceroute and ping functionality.

mtr hostname

Log Analysis (Grep)

Search Current Day Logs

Search today's Asterisk full log for specific keywords.

Flag: -i ignores case while matching.
grep -i searchword /var/log/asterisk/full

Recursive Grep

Recursively search through all files.

Flags: -r searches directories recursively; -i ignores case.
grep -r "searchword" /var/log/asterisk/
grep -ri "searchword" /var/log/asterisk/

Search Historical Logs

Search compressed archived logs.

Flag: -i ignores case while matching.
zgrep -i "searchword" /var/log/asterisk/full*.*

Tail Syslog (Live)

Follow the system log in real time.

Flag: -f follows the log as new lines are added.
tail -f /var/log/syslog

Asterisk Management

Access Asterisk CLI

Open the live Asterisk console for real-time commands.

sudo asterisk -rvv

Hangup Specific Channel

Forcefully terminate a specific channel.

sudo channel request hangup 'channel name'

Check Asterisk Version

Display the current Asterisk version.

Flag: -rx runs an Asterisk CLI command and exits.
sudo asterisk -rx 'core show version'

Show Voicemail Users

Display all configured voicemail boxes.

Flag: -rx runs an Asterisk CLI command and exits.
sudo asterisk -rx 'voicemail show users'

Show Hints/BLF Status

Display all configured hints for BLF monitoring.

Flag: -rx runs an Asterisk CLI command and exits.
sudo asterisk -rx 'core show hints'

Show Dialplan

Display the complete dialplan configuration.

Flag: -rx runs an Asterisk CLI command and exits.
sudo asterisk -rx 'dialplan show'

Show Queue Status

Display the status of a specific call queue.

Flag: -rx runs an Asterisk CLI command and exits.
sudo asterisk -rx 'queue show queue number'

Monitor Channels (Auto-Refresh)

Continuously monitor active channels.

Flags: -n 1 refreshes the output every 1 second; -rx runs an Asterisk CLI command and exits.
watch -n 1 'sudo asterisk -rx "core show channels verbose"'

List All Extensions

Display all configured PJSIP contacts/extensions.

Flag: -rx runs an Asterisk CLI command and exits.
sudo asterisk -rx 'pjsip show contacts'

System Resources & Performance

View CPU Information

Display CPU architecture information.

lscpu
nproc

Check Disk Space

Display available disk space.

Flag: -h shows sizes in human-readable units.
df -h

Check Memory Usage

Display current memory usage.

Flag: -h shows sizes in human-readable units.
free -h

Monitor Running Processes

Real-time view of system processes.

top

System Uptime & Load

Show system uptime and load averages.

uptime

SAR Quick View (Today)

View current day performance stats.

Flag: -p prints output in a more readable format.
sar -p
sar

Check for OOM Killer Events

Search for Out-Of-Memory killer events.

Flag: -i ignores case while matching.
grep -i oom /var/log/syslog

Service Controls (systemctl)

Manage Services

Used to start, restart, stop, or view the status of systemctl services.

Flag: --type=service limits output to service units.
systemctl list-units --type=service
systemctl status asterisk|fail2ban
sudo systemctl start asterisk|fail2ban
sudo systemctl restart asterisk|fail2ban
sudo systemctl stop asterisk|fail2ban
⚠️ Note: Restarting Asterisk terminates all active calls.

Key File Paths & SCP

Spool (Temp & Voicemails)

Asterisk spool directory for temp files and voicemails.

/var/spool/asterisk/tmp

Voicemail Storage

Directory where voicemail recordings are stored (view voicemails here).

/var/spool/asterisk/voicemail/default
ls /var/spool/asterisk/voicemail/default/mailbox/INBOX

TFTP Config Files

TFTP boot config directory.

/tftpboot/config

Music on Hold

Asterisk MOH files directory (VAR > LIB > ASTERISK > MOH).

/var/lib/asterisk/moh

Mail Log

System mail log file.

/var/log/maillog

SCP: Server → Local

Download a file from the VoIP server to your local machine.

Placeholders: user = SSH username, server = host/IP, remote path = file on server, local path = destination folder.
scp user@server:/remote/path/file /local/path/

SCP: Local → Server

Upload a file from your local machine to the VoIP server.

Placeholders: user = SSH username, server = host/IP, local path = file on your machine, remote path = destination folder on server.
scp /local/path/file user@server:/remote/path/

Find Commands

Find File by Name

Search the entire filesystem for a file.

Flags: -name matches by filename; 2>/dev/null hides permission errors.
find / -name filename.ext 2>/dev/null

Find Directory by Name

Search for directories/folders by name.

Flags: -type d limits results to directories; -name matches by name; 2>/dev/null hides permission errors.
find / -type d -name directory_name 2>/dev/null

Get Real Path

Resolve the absolute path of a file or symlink.

Flag: -f resolves all symlinks to the final target.
realpath /path/to/file
readlink -f /path/to/file

Get in Touch

Complete Command