This page looks best with JavaScript enabled

Asterisk on Gentoo

 ·  🎃 kr0m

This article explains how to install Asterisk from sources on Gentoo. First, we will compile the kernel to avoid problems with DAHDI. Additionally, we will generate a testing dialplan to check that the PBX works correctly.

We compile the kernel so that DAHDI does not complain that we do not have the sources of the running-kernel:

emerge gentoo-sources

We install dependencies. Asterisk in this version uses SQLite for the internal database:

emerge -av dev-db/sqlite

We download the Asterisk sources and compile:

We configure Asterisk according to our needs:

cd certified…
./configure
make clean
make menuselect
x
make
make install
make samples –> BE CAREFUL, IT DELETES PREVIOUS CONFIG!!!!!!!
make progdocs
make config

NOTE: The make samples step is harmless if it is the first time we install Asterisk, but if it is an update, be very careful because it deletes the config we have.

We start and enter to check that at least the Asterisk process is up:

/etc/init.d/asterisk start
rc-update add asterisk default
rasterisk

We start the configuration:

vi /etc/asterisk/extensions.conf

[general]

static=yes
writeprotect=yes
priorityjumping=no

[globals]
RANGO_LOCAL=1XX

;--------------------------
[default]
exten => s,1,Hangup()

;--------------------------
[from_sip]
exten => _${RANGO_LOCAL},1,NoOp(## LLAMADA RANGO LOCAL: ${EXTEN} ##)
exten => _${RANGO_LOCAL},n,Dial(SIP/${EXTEN},30,Ttr)
exten => _${RANGO_LOCAL},n,Hangup()
vi /etc/asterisk/sip.conf
[general]
language=es
context=default

pedantic=yes
callevents=yes
allowsubscribe=yes
notifyringing=yes
notifyhold=yes
useclientcode=yes
limitonpeers=yes

sendrpid = yes
trustrpid = no

srvlookup=yes
bindaddr=0.0.0.0
bindport=5060
localnet=192.168.0.0/255.255.255.0
t38pt_udptl = yes

nat=force_rport

disallow=all
;allow=g729
allow=alaw
allow=ulaw
allow=g729
allow=gsm
allow=ilbc
videosupport=yes
checkmwi=5
allow=h263

defaultexpirey=300

[local](!)

type=friend
secret=sdeww223wss
host=dynamic
dtmfmode=rfc2833
callgroup=1
pickupgroup=1
qualify=yes
nat=no

subscribecontext=from_sip
call-limit=4

context=from_sip
disallow=all
;allow=g729
allow=alaw
allow=ulaw
allow=gsm
allow=h263
allow=h264

#include sip.local.conf
vi /etc/asterisk/sip.local.conf
[100](local)
username=100
secret=secret_100

[101](local)
username=101
secret=secret_101

Configure the softphones or hardphones with the indicated credentials.
Enter the Asterisk CLI to verify that they are registered correctly. If we want to debug, we can set the verbose level to 50:

rasterisk
sip reload
sip show peers
core set verbose 50

Now the two extensions can call each other ;)

If you liked the article, you can treat me to a RedBull here