Skip to content

Frequently Used Commands

Quick-reference cheatsheet for the commands UnifiedBX techs reach for most often. All commands run from the FortiGate's UnifiedBX CLI as root (SSH in, or use the system console).

For a more explanatory tour of fwconsole, see Use the UnifiedBX CLI.

Module Repository

Switch to Sangoma Mirror

When the default mirror is unreachable, slow, or you need a fresh re-fetch of framework/core:

fwconsole setting MODULE_REPO https://mirror.freepbx.org
fwconsole ma downloadinstall framework core --force

First line points the system at the Sangoma mirror; second forces a fresh download + install of framework and core from it. Often the fastest way to recover when module updates are misbehaving.

Switch back to default mirror

fwconsole setting MODULE_REPO http://mirror1.freepbx.org/modules/packages/

Reload / Apply Config

Apply pending config changes — equivalent to clicking the red Apply Config bar in the GUI:

fwconsole r
# Long form: fwconsole reload

Force-reload (ignore some sanity checks; use when a normal reload hangs):

fwconsole reload --force

Full restart of Asterisk (drops active calls):

fwconsole restart

Stop / start manually:

fwconsole stop
fwconsole start

Reset Permissions

When config writes have left files with wrong ownership and Asterisk can't read them (symptoms: failed reloads, "permission denied" in logs, modules behaving oddly after a copy/restore):

fwconsole chown

Walks all FreePBX-managed paths and resets ownership to asterisk:asterisk. Always safe to run; should be a first move after any file-system copy/restore.

Module Management (fwconsole ma)

# List installed modules:
fwconsole ma list

# Check what updates are available online:
fwconsole ma listonline

# Upgrade one or all:
fwconsole ma upgrade <modulename>
fwconsole ma upgradeall

# Install a new module:
fwconsole ma install <modulename>
fwconsole ma downloadinstall <modulename>

# Remove:
fwconsole ma uninstall <modulename>
fwconsole ma remove <modulename>

# Enable / disable without uninstalling:
fwconsole ma enable <modulename>
fwconsole ma disable <modulename>

# Force re-download when a module is stuck mid-upgrade:
fwconsole ma downloadinstall <modulename> --force

Admin User Recovery (fwconsole userman)

When you're locked out of the GUI:

# Create a new admin user:
fwconsole userman addUser <username> <password> <email>
fwconsole userman setPermissions <username> all

# Reset an existing user's password:
fwconsole userman setPassword <username> <newpassword>

Backup / Restore

# Run a configured backup template by ID:
fwconsole backup --backup=<backup-id>

# Restore from a tarball:
fwconsole backup --restore=/tmp/backup-file.tar.gz

# List available backup templates:
fwconsole backup --list

Firewall

# Whitelist (trust) an IP — useful when you've locked yourself out:
fwconsole firewall trust <ip>

# Remove from trusted:
fwconsole firewall untrust <ip>

# Show status:
fwconsole firewall status

Certificates

# Renew all managed Let's Encrypt certs:
fwconsole certificates --updateall

Asterisk CLI (asterisk -rx)

For raw Asterisk operations — most useful for diagnosing call/registration issues in real time.

# Interactive console (Ctrl+C to leave):
asterisk -rvvvv

# One-off command:
asterisk -rx "<command>"

Common one-offs:

# Show all PJSIP endpoints + registration state:
asterisk -rx "pjsip show endpoints"

# Show registrations for a specific endpoint:
asterisk -rx "pjsip show endpoint <ext>"
asterisk -rx "pjsip show contacts" | grep <ext>

# Show registered trunks:
asterisk -rx "pjsip show registrations"

# Active calls / channels right now:
asterisk -rx "core show channels"
asterisk -rx "core show channels concise"   # machine-parseable

# Queue state:
asterisk -rx "queue show"
asterisk -rx "queue show <num>"

# Live dialplan inspection:
asterisk -rx "dialplan show <ext>@<context>"
asterisk -rx "dialplan show from-internal"

# Voicemail boxes:
asterisk -rx "voicemail show users"

# Restart / reload from CLI without rebooting the system:
asterisk -rx "core restart now"
asterisk -rx "module reload chan_pjsip.so"
asterisk -rx "dialplan reload"
asterisk -rx "manager reload"

# Conference rooms:
asterisk -rx "confbridge list"

# Music on hold debugging:
asterisk -rx "moh show classes"
asterisk -rx "moh show files"

Database

# Repair tables across all databases:
mysqlcheck -u root --auto-repair --all-databases

# Connect to FreePBX core DB:
mysql -u root asterisk

# Connect to CDR DB:
mysql -u root cdr

# Quick CDR lookup (last 50 calls):
mysql -u root cdr -e "SELECT calldate,src,dst,duration,disposition FROM cdr ORDER BY calldate DESC LIMIT 50"

Cache / Cleanup

# Clear FreePBX caches (helps with stale GUI state):
fwconsole cache clean

# Clean log files (rotate manually):
truncate -s 0 /var/log/asterisk/full
truncate -s 0 /var/log/asterisk/freepbx.log

Log Tails

Watching live for diagnostics:

# Full Asterisk log (everything):
tail -f /var/log/asterisk/full

# FreePBX module events (config writes, reloads, errors):
tail -f /var/log/asterisk/freepbx.log

# Firewall / fail2ban events:
tail -f /var/log/asterisk/firewall.log
tail -f /var/log/fail2ban.log

# Outgoing email (voicemail-to-email, alerts):
tail -f /var/log/maillog

# Filter live log for a specific extension or number:
tail -f /var/log/asterisk/full | grep --line-buffered "1001"

HA Cluster (if installed)

fwconsole ha status
fwconsole ha failover      # swap active/standby

Quick System Info

fwconsole --version
fwconsole sysadmin info
asterisk -V
get system status     # FortiOS / not UnifiedBX