A game of phones: VoIP at home

August 31st, 2015


Our house has three stories, with our bedroom on the top floor. It’s not really possible to achieve a direct shout from there to the ground floor, and since my beloved likes to wander the house in his pyjamas without his mobile, using mobiles is not really an option. So, like a proper engineer, I developed a massively overkill solution: install an internal phone system!


I’ve chosen to use Mitel phones because they are readily available secondhand in good condition on eBay, and we have them at work so I’m already familiar with them. The newer models support SIP, the open VoIP protocol, and they can be powered over Ethernet, meaning you don’t need a power supply to each handset. Our current inventory consists of:

  • a 5304 – newest and smallest of the phones. Despite appearances, it doesn’t support handsfree or on-hook dialling. This one has had “hotel” firmware put onto it so that the bright blue backlight turns off when the phone’s not been used for a few minutes – so we can have it on the bedside table without disturbing our sleep. Mitel firmware is available rather haphazardly on the internet, and I found that once I’d upgraded this phone to have the backlight control,  I could only find a French-language UI for it.
  • a 5212 – this is a cut-down version of the 5220: it’s a bit smaller and the user interface is a bit more limited. It has a more subtle blue backlight.
  • a pair of Dual Mode 5220s. These (and the closely-related 5215s) are the oldest Mitel phones to support SIP, but there are two versions: if the phone does not say “Dual Mode” on the sticker on the back, it does not support SIP, only Mitel’s proprietary Minet protocol.

All the phones take 100Mbit/s Ethernet, and I supply power to them via a cheap TP-Link POE switch. They have a downstream port to provide 100Mbit/s Ethernet to another device too. Note that they don’t support gigabit: Mitel sold a “Gigabit Stand” which was effectively a PoE-extracting three-port gigabit switch that fitted onto the back of the phone, but these are relatively rarely found second-hand, and can be expensive.

There are a few gotchas with Mitel phones. The SIP firmware is a bit finicky to set up, though Voip-Info has lots of details on how to configure them. You need to switch them from Minet to SIP, and then configure the SIP settings so that the phone knows its extension number, password and the IP address of the server. The web interface is relatively straightforward though it sometimes appears to fail to update silently when run from modern browsers: I’m using an old Windows XP virtual machine to access it via IE6 (joy!). Don’t worry too much about updating the phones to the latest Mitel firmware: if the version they come with works, don’t fiddle with it! I’ve wasted several evenings upgrading mine to very little benefit.


After several false starts, I’ve had success with MiniSipServer, which is available for Windows or Linux. I’m running their Raspberry Pi edition on a spare RPi that happened to already be on the network. MSS is a relatively easy system to set up, certainly when compared with Asterisk, but is not open-source. They give away a free trial, but you can claim a free licence for personal use if you review it in a blogpost. A commercial licence is $200 for 20 users, and there are free licences available for nonprofits and OSS projects.

Because my RPi is “headless”, I’m using the web-based configuration for MSS, which seems relatively well laid out. I did have to guess the default password, which turns out to be “minisipserver”. I’ve created three local users (i.e. three extensions) one for each phone, and put them all into the same Ring Group so that they ring together when the external line rings (more on setting up the external line later).

I wanted to set up a dial plan to avoid the traditional “dial 9 for an outside line” scenario, as most people don’t expect a household phone to need a prefix to dial out. The MSS FAQ gives some hints and shows that you can disable the dial-out prefix and instead look for certain numbers as externals. I’ve gone for a very simple approach. Here in the UK, all “full” phone numbers begin with a leading 0, so it’s easy to set up a dialplan rule to route all numbers beginning with 0 to the external line. In MSS you go to Dial Plan-> Analyse Called Number and define the prefix as 0, and then set the route type to External Line. I then created similar dialplan rules for 1 and 9 (since there are lots of service-related numbers beginning with 1, and 999 is our code for the emergency services) and indeed for every number except 4. I looked at Cambridge local phone numbers and none appear to start with a 4, so I’ve set my local extensions to start with a 4.

Unfortunately, there appears to be a bug in MSS: once I’d added more than a few dialplan rules they all disappear from the web interface – but they do appear to still work…

External line interface

Our household router is an AVM Fritz!Box 7390, which is a very all-singing-all-dancing unit that includes its own VoIP server and can interface to the voice line. We used its internal VoIP server in a previous setup, but it has a few key limitations, one of which is that it can’t transfer a call from one extension to another, which quickly became irritating. However, it does work just fine as an external line interface to MSS: I just created an extension on the FritzBox and put the relevant details into the External Line settings in MSS.

Why making things is hard, part 2: stock and suppliers

August 18th, 2015

Second in a series about why running a successful manufacturing business is more tricky than running a successful software business. Part one is here.


Holding stock is a problem that affects both manufacturers and retailers: you could be holding stock of raw materials, or stock of finished or part-finished products. That stuff represents money in limbo: you have paid out for it, and you hope to sell it eventually, but right now it’s taking up space and running all sorts of risks: pilferage, accidental or deliberate damage (these three are collectively known as “stock shrinkage”), the risk that it’ll just gather dust and eventually get sold off at a loss or be thrown away. The longer your stock is on the shelf, the more money you’re losing because the money is tied up in the physical stock and not available to do other things with. The elite ninjas of manufacturing – Toyota – have gone to great lengths to avoid holding stock, setting up whole supply chains that are designed to ensure that all their suppliers deliver exactly the right parts at exactly the right time.

Of course, there are business for whom holding stock is their whole business: this is what distributors (and to some extent retailers) do – they buy goods wholesale, hold the stock and sell it out in smaller quantities for immediate delivery. They accept the risks associated with stockholdings in order to buy in high volume at low prices, and sell in smaller quantities at higher ones.

Accountants, and particularly auditors, really, really hate stock, because it often forma a large part of a business’s assets and there’s always some uncertainty over how much the stock is really worth. It’s only really “worth” what a customer will pay for it, and that may turn out to be less than you had hoped!

So: try not to hold too much stock, and look carefully at the price breaks on your materials to decide how much to order. You can outsource, too: some contract manufacturers (Newbury Electronics, for example) will supply common components for you from their stock so that you don’t have to – in Newbury’s case, passive components they have in stock are free, included in the price of the board manufacture. If you’re making small volumes and don’t have the storage space, this may sway you to a more expensive manufacturer offering a full kitting service rather than using someone cheap and having to manage it all yourself.


Suppliers can be astonishingly difficult to deal with. Compared with the world of retail, where you take a product off the shelf, or choose it from a real or virtual catalogue, the world of business-to-business (B2B) suppliers can be excruciatingly opaque and inconvenient. You will rarely find that manufacturers give pricing on the web, preferring instead that you get a quote from a salesperson. Even some distributors can be astonishingly reluctant to give you a price unless you hand over a huge amount of detail about your business and all the details of your new product idea. Generally, if a company gives you prices upfront after a short conversation with a salesperson, it means they’re keen to deal with you and will probably be quite good to deal with generally. In electronics, semiconductor vendors can be astonishingly fussy about who they deal with – particularly if the IC you want is a new one, the chances are that their production process may not actually be producing all that many good ones to start off with (i.e. a low yield) and they may be “rationing” the ICs for their biggest customers. Apparently when Intel first made microprocessors, the yield was 1% – the other 99% went back in the furnace to be recycled!

The other reason for IC vendors to be awkward is “application support” – the time and effort spent by their engineering team in helping you to incorporate their product into yours. This is effectively free consulting you get bundled into the price of the chips, and so companies are often keen to restrict supply to “serious” customers only. One chip vendor I dealt with (when working for a big multinational) actually refused to deal with me in a rather brusque automated email – I’d filled in a web form asking for prices on a particular IC and giving some details of my product design programme, and they came back and said pretty much “no, we’re not interested in selling you our chip”. I was astonished at how rude that was!

So beware. You can waste weeks just getting prices for the parts you may or may not end up using in your product. It’s vital to know your “volume”, and a good rule of thumb (for electronic products) is that if you are intending to make fewer than 10,000 units a year, you are probably going to be buying everything from a distributor, as manufacturers won’t be all that interested in orders of that size. 50k or 100k volumes start to make people take notice, and buying more than a million of anything generally gets you the best prices and attentive salespeople. A keen salesperson will often offer you free samples of the product for your prototype, or free evaluation kits, and will generally make an effort to support you. There is an encouraging trend for the more customer-focussed electronics firms to sell sensibly-priced (<£100) evaluation kits via the major distributors (RS, Farnell and Digikey are the three I use most often) so that you can try out their product right away, whereas in days of yore you were often charged several hundred pounds or more for an eval kit to make sure that you were a “serious” buyer…

One final useful rule of thumb: if you are pricing a prototype, it’s fair to assume that the wholesale price for 100k/year is roughly half the distributor’s price for a one-off. Never make the schoolboy error of trying to write a business case based on the cost of making your one-off prototype, as your product will appear to be much too expensive!