Note to future me: The reason the new server HDD would not sleep is because ext4lazyinit writes inodes slowly on new disks in the background, so the disks were immediately woken even if forced to sleep.
Build a low power server…
It will be easy, says me…
Replace our 10 year old Atom C2750 running FreeNAS/TrueNAS with a 6 disk raid, that uses 65W of power, with an N100 and 2 disks (+nvme boot disk) on plain ubuntu server. I plan to get it to less than 20W when idle, sure seems I can when checking various blog posts. Processing power isn’t a big deal for this server as it only received backups from the other servers and computers we use.
So I bought the hardware, setup the server and noticed the disks were always running when I had it next to me.
I spent days searching the web, trying various sleep commands. Eventually I found the sudo hdparm -Y /dev/sda which forced the disk to sleep… for 1 second before it came back to life.
This is a Raspberry Pi. A small, powerful, low cost computer.
I’m writing this blog post from the pi you see in the photo. It is very slow compared to my laptop but it works and is in front of me now, whereas my laptop is a whole 2 meters away on another desk.
This is the Raspberry Pi Model 3 B+ that used to run the background music for my small business, a shop that sells furniture and appliances for kitchens, bedrooms and bathrooms. I retired this pi from service a few years ago when we moved to a different background music service. Before the new company I used Jamendo which allowed me to licence and download a few hundred tracks every few months. I would copy them to the pi over the wifi network and the pi would play the music. I wrote a small script that meant as the pi powered on it would start playing music tracks randomly from the selection I had uploaded to it. No human interaction, once setup it ran and ran and ran. Perfect.
This year, as many years before, I have volunteered to help Santa travel around Canterbury with the Rotary Club I’m a member of. We had problems this year with the float background music in that the old donated Ipod ran out of power. When connected to a battery the plug frequently dislodged the audio connection and affected the sound quality. I realised I could repurpose my old Pi to make a better sound source for the float.
A fresh installation of Raspbian
Find some example code on the internet for auto-starting applications when the pi is powered.
Find some suitable music tracks (search, find, repeat)
Put them in a directory on the desktop called ‘music’
Write a script to autostart the playing of music.
Remember to select the correct audio output (3.5mm AV Jack, not the HDMIdisplay)
BT Openreach are turning off analog copper phone lines and moving everyone to an all IP (Internet Protocol) system. It’s called SOGeA (Single Order Generic Ethernet Address). This is a good thing, it’s progress. It means as a network they will only provide an internet connection (think broadband adsl vdsl etc) and it is up to your ISP and/or phone service provider to turn that digital service into an analog phone line for your old style phones to plug into. It means no analog phone line rental just so you have VDSL internet.
At home, we haven’t had an analogue phone service for several years. We never plugged a phone in when we bought the house and use our mobile phones for all our calls.
At work we still use the traditional approach of ‘desk phones’, via a ‘PBX’ (Private Branch Exchange), multiple incoming/outgoing phone lines, group answerphone, the ability to transfer calls to a colleague.
The gigaset could handle 3 calls at a time (2 VOIP + 1 analog), up to 6 cordless extensions and it had a built in answerphone. We could easily transfer calls between each other and it cost us a few hundred pounds several years ago. Occasionally I’ve replaced a cordless handset. It was simple and worked well.
Back when I implemented switched to the gigaset VOIP internet calls weren’t as reliable as analog phone lines (and we had to have the analog line for broadband anway) so I kept the analog line but made our outgoing calls prefer to take a VOIP line. For the last few years internet call quality and reliability has been equal to analog lines. Calls via our SIP/VOIP provider were cheaper than our phone service/internet provider too.
This year our business phone line/VDSL internet line provider decided they were not going to offer analog phone service at all and instead they suggested we move to a hosted IP phone system. I understand their reasoning. From their view we could have 1 number with 1 extension for £11/month, the same as the line rental. However from my view if I’m moving away from analog lines I’d rather have more available incoming lines. Their system equates 1 line to 1 extension, so even connecting their line to our PBX I could could only have 1 call at a time with them. To have more outgoing calls I’d have to rent more extensions. If I want up to 4 of us to be able to use the phone at the same time, then that’s £44/month.
Can I get my phone lines for a lower cost?
Yes, and after a learning curve it was actually quite simple.
Firstly, let’s talk about the idea of charge for phones ‘per line’.
When there was a physical line it made sense, but for an SIP/VoIP system adding extensions is almost zero extra cost.
This is like email addresses, as I have my own domain name (steveroot.co.uk) I can have millions of email addresses for no extra cost. Cost is really defined by the server hardware capacity. A thousand user accounts sending 1 email a day uses less resources than 1 user account sending 10,000 emails a day.
Why is an SIP/VoIP phone line any different? In our case as a small business most of the day there are zero phone calls in progress, and occasionally there are 3 calls in progress. So my goal was to find a provider that didn’t charge per line.
Most of the providers seem to equate line with a user extension. Maybe that would make sense if you want to rent your phone handsets from your supplier, but I buy hardware as it’s cheaper in the long term. I knew there would be less expensive ways to do this and I just had to find them.
Secondly I’m comfortable running servers
Since we’ve had fibre broadband from Trooli I’ve been able to host public web servers in my office on IPv6 addresses. This is important as hosting a public server behind an IPv4 NAT is painful.
My first approach failed
I thought I could use Twilio
Twilio is an IT company that provide a “communication platform as a service”. They do many things but their platform is built around enabling developers to write software that connects to their platform to do something useful. For example, you might write a booking system web app and have it send SMS messages to remind your clients of the date and time. You can also use it to set up a phone calls and to do that it uses standard SIP and VoIP protocols. I can make a web app that makes a phone call between my desk phone and your phone. I can also record that phone call, transcribe that phone call, update another piece of software with a record of that call and many, many more things.
They offer a flexible SIP service and that should have been straight forward but I strugged to get our Simens Gigaset to connect to it. I’m sure this was due to errors on my part. I know I have had connections to this before when we had FreePBX (open source phone system software, a traditional PBX) running
I thought part of the issue was my Siemens Gigaset system, so I set up an instance of FreePBX on a local server and tried to connect to Twillio but I still had trouble.
Then I tried IncrediblePBX , a fork of FreePBX and one I now find a lot easier to use that FreePBX. IncrediblePBX is open source and much of the effort and work behind it is by Ward Munday. He has shared regular, excellent tutorials and guides at his site https://nerdvittles.com/ and is also very active in the forums replying to user questions.
FreePBX is nice but it has a lot of proprietary modules you can buy. That would make sense in a larger business perhaps but for me I just need basic phone system functions and those modules were muddying the waters, especially when looking for deployment instructions and guides. IncrediblePBX (and it’s forums and guides) also lead me to learn that FreePBX and IncrediblePBX have poor support for IPv6. Not enough people are using it I guess, so no one has volunteered time to fix all the internal code to make it work reliably. My plans to self host a PBX on IPv6 in my office ended here.
Also I still didn’t get IncrediblePBX to work with Twilio, so I looked for another solution
I had looked at Dial9 before. As well as regular phone system provision I realised they offered SIP trunks too. My problem was their SIP trunks only work with IPv4, but now I was forced to IPv4 that was no longer important.
SIP trunks from Dial9
IPv4 (Internet Protocol Version 4) is the numeric addressing system that networks use to know where to send internet traffic. EG: www.steveroot.co.uk on a server at 220.127.116.11. DNS (Domain Name System) turns steveroot.co.uk into 18.104.22.168 for your computer. If you visit 22.214.171.124 you wont see this web site, you’ll see one of my other sites – probably a holding page. This is because my web server has 1 IPv4 address so all of my web sites on that server share it. When your browser asks for steveroot.co.uk at 126.96.36.199 the web server knows what you want, but if you go [nothing] at 188.8.131.52 the web server has to guess.
The problem is, the world has run out of IPv4 addresses. There have been a number of solutions to this. One of those is NAT (Network Address Translation) and you have that at home so your single IPv4 address is shared between all of your home computers and phones. That’s fine at home but it’s not fine if you want to allow access to a web server. Running out of IPv4 addresses is not a new thing, IPv6 (Internet Protocol Version 6) was created in 1998 but has taken a long time to become available. Now, finally it’s becoming more widespread and our newish Fibre broadband line came with IPv6 and the nerd in me was very excited about the things I could host locally instead on rented web servers. For example, my phone system… oh well, one day.
With Twilio out of the equation I decided to spend the minimum amount on to try a [couple of SIP trunks + phone number + call costs] from Dial9, if I remember correctly is was £20.
To use Dial9** had to set up my IPv4 address for port forwarding. It worked, but one catch was that I could only make it work for 1 of our Internet lines or double up the trunks rented from Dial9 at double the cost (we have two providers in case an internet line goes down). This was related to how they authenticate calls between servers using IP addresses.
The good news was at this point I had it working with IPv4 addresses and Dial9. Progress!
Reading some more on IncrediblePBX forums a lot people are using hosted web servers for their PBX. I’m already a DigitalOcean* customer so it was trivial for me to spin up a new VM just to run a phone system. Phone system requires very few server resources so my VM/droplet has 1GB RAM, 1 CPU core and 25GB of disk. It costs 7.20$/month including automatic backups. At current exchange rates that’s less than £5/month
As a public web server, it comes with it’s own IPv4 address which makes set up much easier. I also used the DigitalOcean firewall to restrict access to the IP to only Dial9 servers and my office IPs
The advantage now is I can have each one of our DECT handset connect to the phone system as an extension. IncrediblePBX now provides the group voicemail and emails any messages left for us (as we notice emails to our shared email account faster than we were noticing message lights on our handsets).
With that working I did the final setup of the Dial9 service.
There is a minimum requirement of 4 trunks (1 trunk = max number of concurrent calls) and each trunk costs £0.75 per month (£3/month)
Phone numbers are £1.50/month. There was no cost to migrate our number to Dial9 but for testing I bought a second phone number
Total cost: £4.50/month
Migrating the phone number to Dial9
Our phone number was still on the BT Openreach network via our previous business landline supplier, so transferring the phone number turned out to be very easy. There were clear instructions on the Dial9 web site and Dial9 tech support responded to every question within hours. In advance I set up the new number on the Dial9 portal and my PBX. Then requested the number to migrate on a Tuesday when I knew I would be in the office in case anything went wrong. Our previous provider gave up the number at 10am and by 11am Dial9 had automatically picked it up and started routing calls to FreePBX. With best laid plans… I got called away from the office at 12:00 and didn’t get to test everything but other than callers getting an international dial tone until the next day when I changed a setting I missed, everything worked perfectly.
I’m just going to repeat this, because phone lines are important and you really want them to work and you really want to know your service provider will respond when there’s a problem. Dial9 (and Adam, who picked up my support request for the migration) respond exceptionally quickly. Here’s the proof, check our the time between my emailing a question and their response, and their follow up responses with new information!
16:33 Me: Email to request migration 16:47 dial9: acknowledged and steps to verify my identity
09:12 dial9: confirming they got my verification confirmation overnight and are creating paperwork to send to the old provider, some questions to answer. 10:33 me: I answered questions 10:40 Dial9: Response with Letter of Authority 11:39 Me: I sent correction to the letter (trading name typo iirc) 11:52 dial9: corrected letter sent 12:11 dial9: confirmed they got my signature on the corrected letter and the migration has been requested from old supplier, asked for date we’d like to migrate 12:41 me: I picked a date 12:50 Dial9:confirmed date, human written email talked through the progress from here 13:26 Dial9: Confirmed old supplier had agreed to release and pointer to the setup I need to do in the Dial9 portal. 13:35 Me: Report a portal bug that on one page my business name is being shortened to “Kitchs” instead of “Kitchens” on a page 13:39 Dial9: explain that this is the Emergency Service Operators system shortening standard words. 14:47 Dial9: Adam spoke to the Dial9 developers and they modified the system to show users like me the full words but still send the short version to the emergency services system.
Migration Day: 10:44 me: I emailed to say we are getting invalid number when dialing from our mobiles and I’m not seeing the incoming call in the Dial9 portal 10:48 dial9: confirm the ports happen at 10am but are not instantaneous, migration time is outside of their control but don’t worry yet, this is normal so far. 10:54 dial9: they’re now watching for the line to arrive too, have tried test calls, will let me know when they see it move to them 11:01 dial9: email to say they can see the line and their test call rang
I upgraded the Gigaset to a Gigaset N510 IP Pro as it can handle 4 simultaneous voip calls whereas the Gigaset Go Box-100 can only handle 2 voip calls at a time. That cost me £25 on ebay for a second hand model but even new they’re only £80-£100.
* This link to Digital Ocean is a referral link to give you $200 credit and me $50 if you say for > 60 days
** This link to Dial9 is a referral link. It gives points… I don’t know what they’re worth, I don’t know if you get a benefit.
Search this site
birthday.sroot.eu – Your birthday or other celebration date based on [years on other planets] / [how many seconds/days] / [how far you’ve travelled around the sun]
stampulator.sroot.eu – Calculates the combination and how many 1st, 2nd, large 1st and large 2nd class Royal Mail stamps you need on large envelopes and packets