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.

Posted in JDI, Server | Leave a comment

A new PBX aka playing with Asterisk

We started out with 1 employee back in 2001. Now, we have 11. We started out with a Siemens PBX, and one ISDN-2 line. That Siemens has 8 digital ports, and 1 expansion slot. That slot has been taken for a second ISDN-2 port, since customers where getting a busy signal.

Now, people share a phone. Not something we want. The Siemens PBX is also as extensible and flexible as solid concrete. We had 2 options :

  • Buy a new PBX from Siemens (Siemens phones only work on a Siemens PBX)
  • Throw everything out, and start from scratch with a VOIP based solution.

After receiving the offer for the Siemens PBX, recovering from falling of my chair, and being resuscitated by one of my collegues, I decided to start from scratch with a VOIP solution. We soon ended up with :

Hardware was quickly ordered. I’ve upgraded our old fileserver with extra memory, a new storage array (which needed replacement anyway), and the Digium card. The OS has been manually upgraded from CentOS5 to CentOS6, since installer totally screwed up the upgrade.

The’re no packages for CentOS 6, only for CentOS 5. I needed a shole bunch of non-standard libs :

  • libss7
  • libopenr2
  • libpri
  • dahdi

Downloaded, and packaged them. Asterisk was next : Version 10 wasn’t an option, since OpenPBX refuses to work with that. I ended up with 1.8.13.0, since that’s an LTS release. Welcome if you don’t want to restart you PBX every day or so.

I’m going to publish the SRPMS and i386 binaries in my RPM repo, no x86_64, sorry. If you want modifications to those RPM’s, contact be, and we’ll work something out.

Posted in CentOS, JDI | 1 Comment

GDB 7.3a and a new elfutils

I just uploaded gdb 7.3a It can be found on my RPM repo. I’ve also added new elfutils packages, since these are required by this version of GDB.

Posted in CentOS | Leave a comment

Binutils 2.21.1a on CentOS 5.6

I just uploaded binutils.2.21.1a. It can be found on my RPM repo. GDB will be uploaded begin next week. Happy compiling !!!

Posted in CentOS, Uncategorized | Leave a comment

GCC 4.6.1 on CentOS 5.6

I’ve just created packages for CentOS 5.6 that replace the default compiler with gcc 4.6.1. That version has some interesting options, so I wanted to use that as my default compiler. It’s also more strict, so it’s a good check for my own code.

Packages can be downloaded from my RPM repo

Later today I’ll upload my binutils and gdb packages.

Posted in CentOS, Personal | Leave a comment

VIM 7.3 with Python 2.6 on CentOS 5.x

I’ve been a OSX user for some time, but my main C development happens on CentOS. OSX has TextMate as editor, which has snippets : A sort of runtime macro’s on steroids. It saves lots of time with common language constructs such as loops.

Vim has a UltiSnips, but that has some preconditions : It need vim 7.3 with Python >= 2.6 compiled in. CentOS has neither of them. You can’t just upgrade Python on a CentOS machine, since lots of things (yum being one of them) depend on a specific version. So if you overwrite the default version, all hell will brake loose.

I’ve created packages for both Python and Vim (x86 and srpms), available at http://www.palsenberg.com/rpmrepo/

Happy VIMming !!!

Posted in CentOS, Personal | 7 Comments

Migrating to JIRA 4.4

Migrating to JIRA 4.4 is now complete. It has’t been without hickups however :

  • JIRA 4.4 en Fisheye 2.6.0-2.6.3 don’t get along when using trusted authentication. You get Seraph errors : Error handling trusted applications authentication attempt:BAD_SIGNATURE
  • Make sure the user that is authenticating the application link (and managing the JIRA project) has read errors to Fisheye projects. Else you can’t link you repo to the JIRA project.

Make sure you have adequate backups before attempting to upgrade. Without them, it’s a one-way ticket of something goes wrong.

Posted in Development, Personal, Server | Leave a comment

Confluence

I’ve installed an milestone of Confluence. I never liked the 3.x editor : Wiki just isn’t my thing. Fortunately, the 4.x release has a brand new editor, and it’s WYSIWYG. No more fancy tagging, no more thinking on what wikimarkup to use.

A nice addition is that it also allows macro’s to be embedded into that page. I’m going to use that to add some information of my own personal projects, like commit history.

Posted in Development, Personal | Leave a comment

Migrating to Atlassian tools

So.. Finally found to spare time : I’ve migrated my old setup to include (most) of the Atlassian tools. I’ve got Crowd, JIRA, Confluence, Bamboo and Fisheye up-and-running, with SSO authentication.
Next step is to figure out how to make Bamboo build my C / C++ projects (which use make, not Ant or Maven which are supported native in Bamboo). I also need to look at the testsuite, for which Bamboo assumes it generated JUnit XML reports. At this moment, it doesn’t. I’ll be opening Confluence spaces for most of my (old) projects soon.

Posted in Development, Personal | Leave a comment

Working with re2c, lessons learned

I’ve completed the parser that parses bind9 style config files. The parser itself is based on  the lemon parser generator,  and the lexer is based on re2c. While testing and developing the parser, I’ve ran into some strange, undocumented issues.

  • Error checking is practically absent. Bad input results in bad runtime behaviour instead of errors.
  • Make sure that all input in conditions is handled; Input encountered in states without a matching rule results in the resulting code jumping to a (semi) random rule. Again, this doesn’t result in errors.
  • RTFM about what regular expressions re2c supports. No error checking what so ever.
  • Rules with wildcard conditions (<*> <regexp>) are first processed, above all other rules. A condition with a matching rules overrides the wildcard condition. This is important if you have a match-all condition [^], since that will precede the wildcard condition rule.

If you live up to the above undocumented things, re2c make writing lexers as easy as it gets.

Posted in Development | Leave a comment