Archive for October, 2012


2012 f 3

Following on from my initial post this is a very short post to describe my network and telephony topology.

I’m in the very privileged class who own their own class-C network from way-back. The assholes at AUNIC keep on trying to steal it back by ever more draconian rules to make it impossible for me to keep my in-addr-arpa domain alive. Luckily I have survived so far but my design plan allows for transition to a NAT model if required.

At present I have an upstream SIP Trunk provider who runs Asterisk (Pthuewee!). I have some PSTN numbers that they rout to my Kamailio instance that I then distribute to my extensions. My extensions are registered to my Kamailio server. I also run rtpproxy so that external extensions can have a proxy IP address for media within the permitted range for my SIP trunk provider..

My internal numbering system has extensions in the 200 range. This works a lot better than 100 series which are continually probed by exploit bots.

I have entries in db_aliases that match PSTN numbers to specific 200 series extensions. In reverse I can translate internal extensions to PSTN numbers in the outgoing headers.

All works fine except when I want to do a call transfer between extensions. My upstream Asterisk provider doesn’t support REFER messages. Even worse it sends fake progress messages as though it does support them but actually does nothing. This is the main reason I have decided to set up a Kamailio/SEMS PBX where I can take control of the trunk system and also provide more functionality within my network and remote extensions.

Ultimately SEMS will (probably) replace rtpproxy and the upstream provider will have zero control of my PBX and DID/DDI numbers.



SEMS and KAMAILIO combo as a PBX – concept

2012 f 3

This is a record of how to make a workable PBX using SEMS and KAMAILIO on CENTOS 6.3. This procedure will be applicable to most OSs that can run CENTOS and KAMAILIO.

This is not a description of how to do it. It’s a log of my attempts to make it happen. The last post will be a recipe to follow.

First, what is a PBX AKA PABX AKA EPABX ?

Using Wikipedia we see that PBXs have the following list of capabilities

  •     Auto attendant
  •     Auto dialing
  •     Automatic call distributor
  •     Automated directory services (where callers can be routed to a given employee)
  •     Automatic ring back
  •     Call accounting
  •     Call blocking
  •     Call forwarding on busy or absence
  •     Call park
  •     Call pick-up
  •     Call transfer
  •     Call waiting
  •     Camp-on (?wtf?)
  •     Conference call
  •     Custom greetings
  •     Customised Abbreviated dialing (Speed Dialing)
  •     Busy Override
  •     Direct Inward Dialing
  •     Direct Inward System Access (DISA) (the ability to access internal features)
  •     Do not disturb (DND)
  •     Follow-me, also known as find-me: Determines the routing of incoming calls.
  •     Interactive voice response
  •     Music on hold
  •     Night service
  •     Public address voice paging
  •     Shared message boxes (where a department can have a shared voicemail box)
  •     Voice mail
  •     Voice message broadcasting
  •     Welcome Message

Strewth! That’s a lot!. Maybe I’ll just try and do a subset for now.

Luckily a lot of them look like standard functions that SEMS can natively implement. Or at least reasonably simple code can make it happen.

By way of background I’ve already written SEMS applications that handle multiple simultaneous calls – this in conjunction with heavily tricked out networks of kamailio servers.

My plan now I guess is to look very closely at the SEMS SBC and see what can be done with it.

The basic model will be a Kamailio proxy handling PSTN upstream trunking (SIP trunking) and local and remote UA registrations.

Incoming trunked calls will be landed on the SEMS instance which will then make a new outgoing call to registered handsets. Local PBX calls will similarly be routed by Kamailio and hosted on the SEMS instance. This is pretty much the same model as described in the freeswitch implementation at

The difference is that SEMS will act as the SBC and media server. In addition I plan to implement MWI natively in SEMS, plus busy-lamp functionality using the kamailio resource list server and publish commands from SEMS.

More to follow when I learn all about SEMS sbc.