Asterisk

From Braindump
Jump to navigation Jump to search

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/net/netfilter/nf_nat_sip.c?h=v6.1.44

Asterisk is a pain to setup, because the configurations and software are quiet messy with lots of example files and options.

Check other SIP servers

lsof -i:5060
ps auxwww | grep asterisk

configurations

asterisk.conf

[directories](!)
astetcdir => /etc/asterisk

pjsip.conf

[global]
type = global
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
[endpoint-basic](!)
type=endpoint
context=internal
disallow=all
allow=ulaw
allow=alaw
[auth-userpass](!)
type=auth
auth_type=userpass
[aor-single-reg](!)
type=aor
max_contacts=3

[1004](endpoint-basic)
auth=1004
aors=1004
callerid=Name
[1004](auth-userpass)
username=1004
password=secret
[1004](aor-single-reg)

extensions.conf

[internal]
exten=> _1XXX,1,Dial(PJSIP/${EXTEN})

Compile from Source

cd /usr/src/asterisk-old/
make uninstall-all
cd /usr/src
svn checkout http://svn.digium.com/svn/asterisk/trunk asterisk
cd asterisk
./configure --prefix=/usr
make
make install
make samples
svn checkout 
http://svn.digium.com/svn/asterisk-gui/branches/2.0/ asterisk-gui
make
make install
chown -R asterisk:asterisk /etc/asterisk
chown -R asterisk:asterisk /var/lib/asterisk

Configure

manager.conf

[general]
enabled = yes
webenabled = yes

[username]
secret = secret
read all
write all

http.conf

[general]
enabled = yes
bindaddr = 127.0.0.1
bindport = 8088
prefix = asterisk
enablestatic = yes

Commandline Interface

asterisk -c
exit
/etc/init.d/asterisk start
asterisk -r

Web Interface

http://localhost:8088/asterisk/static/config/index.html

GUI Settings

"options" "general" "extension preferences" "user extensions"

"trunks" > "voip trunks" > "add trunk"

"outgoing dial rules"

International	_00Z.
National	_0Z. (strip one digit, prepend 0031)

"dial plans"

(tick the outgoing dial rules)

"Users"

add a user
assign a dialplan
set prefered codecs
untick IAX
set password

Incoming Calling Rules

'_X.' (CatchAll)	Goto User 200

the insecure = no means that authentication needs to be done for each request, so an invite from the sip-provider would fail because it needs to be authenticated. insecure = port,invite would be better than very, but that requires a file edit.

voicemail

extensions for checking messages: 600

IMPORTANT

after changing configurations click "APPLY CHANGES" or execute a "core reload" on the CLI