Skip to content

Codex as sysadmin: PBX

I found a couple of old POTS phones in a cupboard and thought it would be fun for my kids to play with them. The house no longer has a POTS service, so I ordered a Grandstream HT802 adaptor and fell into the PBX rabbit hole. I now have a hybrid POTS/VoIP internal telephone system running from a FreePBX server.

My kids now have Cisco 7942 VoIP phones on their desks. I remember these as swanky corporate wealth signifiers from 20 years ago, proudly displayed on the desks of people sitting on Herman Miller Aeron chairs. Now I bulk-buy them for $10 apiece on eBay.

This is a great case study for Codex. People used to make careers out of understanding the complex intricacies of PBX and VoIP. Now any idiot, including me, can do it with Codex.

PBX

PBX stands for “private branch exchange”: a mini telephone exchange that connects to the main telephone network. When you call a business and dial the extension number of the person you want to talk to, their extension is connected through that company’s PBX.

In the olden days, a PBX was a big bank of telephony kit. Now, in the era of Voice over IP (VoIP), it’s usually just a virtual machine (VM).

There are a few self-install PBX systems that work well as a VM. 3CX makes things quite easy, but it’s not free. FreePBX is open source and very popular, but it is not especially friendly to a complete n00b like me. Many companies open-source their complicated products and then make their money by selling “enterprise support” to do all the hard stuff. I’m not sure how sustainable that business model will be now that tools like Codex can get everything working for you.

Hardware

PoE Ethernet

Most VoIP kit uses Power over Ethernet (PoE) to provide both power and network connectivity. You’ll need a PoE switch and a load of Ethernet cables to connect everything together. If, like many geeks, your house has Ethernet sockets in every room, you can just patch these into your PoE switch and plug your VoIP phones in there.

POTS Phones

My Gen-Z friends call these “Boomer Phones”. If you have a charming old POTS phone, you’ll need to convert it to VoIP with something like the Grandstream HT802. You can then dial your 1920s Bakelite desk phone from your 2000s Cisco VoIP phone via your 2026 PBX VM, which is quite cool.

VoIP Phones

Cisco VoIP phones are widely available, and very cheap, on eBay because nobody uses desk phones any more. I like the Cisco 7942G model. It is easier to get several phones of the same model because you’ll have to provide configurations for them and, potentially, firmware updates from your TFTP server, as described below.

FreePBX

I’ll assume you know how to set up a VM. If not, this will work on a standalone system: a Raspberry Pi 4 should be more than adequate. Install FreePBX from the instructions here. This is where you create your dial plan, associating phones with numbers.

TFTP

Cisco phones pull down their configuration and firmware updates from a TFTP server at boot time. Your FreePBX server can also act as that TFTP server. You will have to add some lines to your DHCP or DNS infrastructure, depending on how you manage your network, to tell the phones where to find it. I use Pi-hole, and my Cisco VoIP phones work fine with just DHCP Option 66, although Cisco also documents Option 150. Codex can tell you how to do this.

You will need to host a configuration file for each Cisco phone on your TFTP server. Codex can create these for you. It is also worth updating all your phones to the latest firmware version, and those files are also pulled from your TFTP server.

Unfortunately, Cisco are utter [redacted], so you can’t find the firmware you need for end-of-life products on their website unless you pay them lots of money. Fortunately, some community-minded people have kept copies of the files you need on GitHub. You can use either SIP or SCCP provisioning; I use SIP because it’s an open standard.

Setting it up

In previous decades this would have been a long section with lots of code blocks for you to copy. Instead, all you need to do is install Codex CLI on your FreePBX server and have a conversation with it until you have working PBX phones. It really is that simple. Start by describing the problem and set some rules, which you can tell it to store in an AGENTS.md file. Also ask it to maintain a README.md file to document what it has done. That then becomes the documentation if you upload it to GitHub.

Incidentally, I also use Codex as the subeditor for these blog posts, and to push them to my GitHub repo, where they are pulled down by Cloudflare Pages and published on my blog. All I have to do now is say “clean up the article” and then “publish it”.