Skip to content

Asterisk basics

Config

Disable output Remote UNIX connection commands in log

# grep hideconnect /etc/asterisk/asterisk.conf
hideconnect = yes

Commands

Connect to console

asterisk -rx
with debug
asterisk -rvvvx

All peers

sip show peers 
only one
sip show peer [PEERNAME] 

Sip registration

sip show registry 

Channels

sip show channels 

Settings

sip show settings 

Current channels (calls)

core show channels

Hangup call

channel request hangup [TAB]

Hangup all calls

channel request hangup all

Dial plans

# view
$ dialplan show [TAB]
# ...
$ dialplan reload
#
$ ael reload

Call from console

originate SIP/sipprovider/1234567 extension 101@from-internal 

Sounds

Preparation sound files

# for mp3 support
apt-get install libsox-fmt-mp3
#
# ULAW
sox -V hello.wav -r 8000 -c 1 -t ul hello.ulaw
sox hello.mp3 -r 8000 -c 1 -t ul hello.ulaw
# ALAW
sox -V hello.wav -r 8000 -c 1 -t al hello.alaw
# GSM
sox -V hello.wav -r 8000 -c 1 -t gsm hello.gsm

Path for sounds

/usr/local/share/asterisk/sounds/{lang}
/var/lib/asterisk/sounds/{lang}

Tools

sngep - sip connection viewer

apt install sngrep

Debian 9. Restore missing config files

dpkg -i --force-confmiss /var/cache/apt/archives/asterisk-config_1%3a13.14.1~dfsg-2_all.deb