Links:
# Install pre-requisites sudo apt-get install uuid-dev libjansson-dev libxml2-dev libncurses5-dev libsqlite3-dev libssl-dev libjansson-dev uuid-dev # Dowload and untar source package wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-15.1.4.tar.gz tar xvzf asterisk-*.tar.gz
Asterisk will be built in a local filesystem (~/local)
cd asterik-* ./configure --prefix=/home/asterisk/local make menuselect make make install # to generate default configuration: make samples # to start Asterisk automatically by the init process: # sudo make config
First, let's create the dial plan:
cd ~/local/etc/asterisk mv extensions.conf extensions.conf.bak vim.tiny extensions.conf
~/local/etc/asterisk/extensions.conf
[from-internal] exten = 999,1,Answer() same = n,Wait(1) same = n,Playback(hello-world) same = n,Hangup() exten => _600[0-8],1,Dial(PJSIP/${EXTEN},40) exten => _600[0-8],2,Voicemail(${EXTEN}@vm) exten => 888,1,Answer() exten => 888,2,VoiceMailMain(${CALLERID(num)}@vm)
Next, create the users:
Latest Asterisk release default to PJ-SIP stack instead of built in
mv pjsip.conf pjsip.conf.bak vim.tiny pjsip.conf
[transport-udp] type=transport protocol=udp bind=0.0.0.0 ; templates ------------------------------------------------------------- [endpoint-basic](!) type=endpoint context=from-internal disallow=all allow=ulaw [auth-userpass](!) type=auth auth_type=userpass [aor-single-reg](!) type=aor max_contacts=1 ; ext 6001 -------------------------------------------------------------- [6001](endpoint-basic) auth=6001 aors=6001 [6001](auth-userpass) password=unsecurepassword username=6001 [6001](aor-single-reg) ; ext 6002 -------------------------------------------------------------- [6002](endpoint-basic) auth=6002 aors=6002 [6002](auth-userpass) password=unsecurepassword username=6002 [6002](aor-single-reg)
For older builtin SIP:
mv sip.conf sip.conf.bak vim.tiny sip.conf
~/local/etc/asterisk/sip.conf
[general] context=default [6001] type=friend context=from-internal host=dynamic secret=unsecurepassword disallow=all allow=ulaw
Cisco SCCP IP-Phones can be used with Asterisk using Skinny module [Still TBD]
Configuration info | html
mv voicemail.conf voicemail.conf.bak vi voicemail.conf
[general] format=wav49|gsm|wav ;serveremail=nobody@nowhere.com ;attach=yes maxsilence=10 silencethreshold=128 maxlogins=3 ;sendvoicemail=yes [vm] 6001 => 1234,Phone 6001 6002 => 1234,Phone 6002
Since server is not is default system location, path and library will not be found automatically.
# To add Asterisk lib path to system libraries: sudo ldconfig /home/asterisk/local/lib # add asterisk to path (in ~/.bashrc or directly at shell) export PATH=$PATH:/home/asterisk/local/sbin # or asterisk must be run as 'LD_LIBRARY_PATH=/home/asterisk/local/lib ~/local/sbin/asterisk'
To start the server:
# start asterisk server: asterisk & # Connect to Asterisk server's console: asterisk -cvvvvvvvvvvr Asterisk 14.5.0, Copyright (C) 1999 - 2016, Digium, Inc. and others. ========================================================================= Connected to Asterisk 14.5.0 currently running on server (pid = 5082) server*CLI> sip show users Username Secret Accountcode Def.Context ACL Forcerport 1001 secret local No No 1002 secret local No No 1003 secret local No No server*CLI> quit Asterisk cleanly ending (0). Executing last minute cleanups # stop asterisk server: killall asterisk