What a Class 4 softswitch is
A Class 4 softswitch is software that routes and rates voice calls between carriers. It does not talk to phones: it talks to other switches. Its job is wholesale transit — take traffic from a carrier customer, pick which of your suppliers it goes out through, and record what it cost and what it sold for.
The name comes from the switching hierarchy of classic telephony, where a Class 4 exchange was a tandem: it served no subscribers, it interconnected exchanges. The software version does the same thing over SIP, and adds what the exchange never had: real-time rating and per-call credit control.
In one line: a Class 5 gives phone service to an end user; a Class 4 buys and sells minutes to another carrier. If your customer is a person with a handset, you need a Class 5. If your customer is a company sending you SIP traffic and paying you per minute, you need a Class 4.
What it does, step by step, on every call
The whole difference between a serious wholesale platform and a script on top of
Asterisk is how many of these decisions it makes before letting the
INVITE through:
- Admission. Identify who the call is from (authorised IP or digest authentication) and drop what it does not recognise. This is the system's only public door, and where scans and CPS bursts get stopped.
- Commercial authorisation. Does the customer have balance? Do they have a free channel inside their cap? Do they have a rate for that destination? Any "no" ends the call here, before any resource is spent.
- Rating. Find the longest prefix matching the destination number and get the sell price and buy cost for every possible route.
- LCR routing. Sort the available suppliers — usually by cost, ideally by margin — and build the attempt list.
- Delivery and retries. Send the call to the first supplier; if it answers with a retryable failure code, fall through to the next without the customer noticing.
- Teardown and CDR. On hangup, apply the billable minimum, increment and connection charge, debit the balance and write the record with cost, sell and margin.
Class 4 vs Class 5 vs SBC
Three different things sold with similar vocabulary. Confusing them is the most common way to buy the wrong platform:
| Class 4 softswitch | Class 5 softswitch | SBC | |
|---|---|---|---|
| Its customer is | Another carrier | The end user | Either of the two |
| What it is for | Wholesale transit and termination | Phone service: extensions, voicemail, IVR, DIDs | Network edge: security, NAT, transcoding |
| Rates calls | Yes, it is the whole point | Yes, by plan or subscription | No |
| Picks supplier by cost (LCR) | Yes | Sometimes, basic | No |
| Handles balance and credit | Yes, in real time | Subscriber prepaid | No |
| Typical use | Selling A-Z termination | Offering telephony to SMBs | Protecting a FreeSWITCH |
In practice a modern Class 4 includes an SBC's edge functions — authentication, rate limits, topology hiding — because it needs that door to survive on the internet. What it does not include, and should not, are Class 5 functions: if you are offered a product that does both, ask which of the two it actually does well.
The functions that cannot be missing
Every platform lists a hundred bullets. These six are the ones you feel three months into operating:
1. Longest-prefix rating, with minimum and increment
Charging "per minute" does not exist: you charge with a billable minimum (typically 30s or 60s) and an increment (1s, 6s, 60s). If the switch does not apply exactly the scheme your supplier applies to you, every short call leaves an invisible loss that only shows up at month end.
2. Least-cost routing with margin protection
Routing by cheapest is not the same as routing by profitable. If the cheap supplier costs 0.0098 and you sell at 0.0100, the call goes through but the margin does not pay for the CDR. An LCR that looks at minimum margin and not only at cost drops that route and takes the next one.
3. Real-time credit and channel control
Balance has to be drawn down during the call, not at teardown. Without that, a customer with $10 of balance can open 200 simultaneous calls to an expensive destination and leave you a debt you will never collect. Same with channel caps: they have to be enforced at admission.
4. Termination anti-fraud active from day zero
Termination fraud — the well-known IRSF — targets high-tariff destinations and arrives at 3 a.m. on a long weekend. The useful defence is not an alert: it is those destinations being blocked by default, with you opening the ones you need.
5. CDRs with cost, sell and margin on the same row
If the CDR only stores what you charged, reconciling against the carrier invoice is an export-to-Excel job. With cost and sell side by side, "is this destination making me money?" is answered with a query.
6. One single exposed surface
The media server should never have a public IP. The healthy architecture is a hardened admission proxy at the edge and everything else on loopback: database, media engine and panel. If the vendor's diagram shows three open ports, you have three problems.
Five questions before you sign
Ask for the answers in writing. The uncomfortable ones are the informative ones:
- What is the price, published? "Talk to sales" means the price depends on how much you look like you can pay.
- Can I try it without talking to anyone? A platform you can only see in a scheduled demo is a platform that needs a salesperson to look good.
- Where do my data and my rates live? Self-hosted means that if you fall out with the vendor, your operation continues.
- How does it update, and who signs the bundles? A switch without signed updates is an open door on a medium horizon.
- Can a balance be altered without leaving a trace? If the answer is "only the database administrator", the balance is not auditable.
What it really costs
The licence price is the easy part to estimate. The real cost of a switch has three terms:
- Licence, usually per concurrent channel or per port.
- Infrastructure: a decent VPS covers hundreds of channels if the engine does not fork a process per call; if it does, you will pay for extra iron.
- Operations: the term nobody quotes. An open platform with no support has a zero licence and a senior VoIP engineer as a fixed cost.
Which is why the honest comparison is not "free versus paid", but how much people-time each option will cost you to carry the same traffic.
How NEXIA Switch handles it
NEXIA Switch is a self-hosted Class 4 softswitch that ships all six functions above: Kamailio admission at the edge, a routing and rating core compiled in Rust with the route table in memory, LCR with a minimum margin, balances on a ledger the database refuses to modify, and risky destinations blocked from install.
It installs with one command on Ubuntu 24.04 and is free and permanent up to 100 concurrent calls, with the complete platform — not a cut-down edition. Pricing to grow is published.