Asterisk for the novice

We switched to VOIP : Our old PBX was lacking features, and the prices for phones went sky-high. I purchased an Asterisk EuroISDN card, and some Aastra phones.

Some lessons I learnt the hard way :

A GUI

If you installed a GUI, deinstall it. If you have the GUI config and installation in  a backup : remove it from the backup also. Then, print the GUI sources, and shred them. Really, do so. If you have a real problem, and a GUI, and no knowledge of Asterisk, you're totally screwed.

The hardware

First, make sure Asterisk knows your hardware. dahdi_hardware should give some output. If it doesn't, reinstall the kernel drivers, and make sure that the driver is loaded. I used the .src.rpm for building those, but the instructions at https://wiki.asterisk.org/wiki/display/AST/Building+and+Installing+DAHDI also work.

Load the kernel drivers : I needed to load wcb4xxp and dahdi.

Asterisk software

I installed Asterisk 10.6, using a homebrew RPM. No special reason for this version : It was the latest available.

Configurating Asterisk

First, I ran dahdi_genconf, that took care of configuring all 4 spans. My chan_dahdi.conf looks like :

[trunkgroups]

[channels]
; Deprecated, don't use it
[lines]

echocancel = yes
echotraining = yes
signalling = bri_cpe
callerid = asreceived
context = bri-incoming
group = 1
channel = 1,2
channel = 4,5
dahdichan => 1,2,4,5

The SIP phones also need config. This is done in /etc/asterisk/sip.conf :

[jdioffice](!)
type=friend
context=sipphones
host=dynamic
nat=no
dtmfmode=auto
disallow=all
allow=ulaw
allow=g722
allow=g729
qualify=yes
language=nl

[00085D3XXXXX](jdioffice)
secret=mysecret

This gives us two asterisk contexts : sipphones, and bri-incoming. You need these to tell Asterisk what to when a call comes in or goes uit on a certain context.

I use a LUA based dialplan : I know how to code, and that gives me an extensions file that is a whole lot better to read then the ‘traditional’ Asterisk dialplan config.

Entrypoints are in a table :

extensions = {
  -- Incoming calls
  ["unauthenticated"] = {
    ["_."] = e_drop_call
  };

  ["sipphones"] = {
    ["_#NXX"] = e_hotdesk_login,
    ["_#000"] = e_hotdesk_logout,
    ["_0X."]  = e_outgoing_sip,
    ["_NXX"]  = e_internal_sip,
    ["112"]   = e_outgoing_emergency,
    ["911"]   = e_outgoing_emergency,
    ["_*."]   = e_dial_custnr,
    ["_**."]  = e_dial_employee
};

  ["bri-incoming"] = {
    ["_X."]   = e_incoming
  };

  ["default"] = {
    include = { "unauthenticated" }
  };
}

You can clearly see the context, and the resulting mapping. All names are actual lua functions, which take a context and extension as a result.

Next post : More on the dialplan, things I've run into, and the solutions, if available.