Guide · Wholesale VoIP

Class 4 softswitch: what it is, what it must do and how to choose one

A Class 4 softswitch is the piece that turns voice traffic into a business: it decides where each call goes out, what it costs to buy and what it sells for. This guide covers what it does, how it differs from the pieces it gets confused with, and how to compare two platforms without stopping at the spec sheet.

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:

  1. 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.
  2. 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.
  3. Rating. Find the longest prefix matching the destination number and get the sell price and buy cost for every possible route.
  4. LCR routing. Sort the available suppliers — usually by cost, ideally by margin — and build the attempt list.
  5. 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.
  6. 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 softswitchClass 5 softswitchSBC
Its customer isAnother carrierThe end userEither of the two
What it is forWholesale transit and terminationPhone service: extensions, voicemail, IVR, DIDsNetwork edge: security, NAT, transcoding
Rates callsYes, it is the whole pointYes, by plan or subscriptionNo
Picks supplier by cost (LCR)YesSometimes, basicNo
Handles balance and creditYes, in real timeSubscriber prepaidNo
Typical useSelling A-Z terminationOffering telephony to SMBsProtecting 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 it really costs

The licence price is the easy part to estimate. The real cost of a switch has three terms:

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.

Frequently asked questions

What is the difference between a Class 4 and a Class 5 softswitch?
A Class 4 routes and rates calls between carriers: its customer is another carrier sending SIP traffic and paying per minute. A Class 5 provides phone service to end users: extensions, voicemail, IVR, DID numbers. They are told apart by who the customer is, not by the technology.
Does a Class 4 softswitch replace an SBC?
Partly. A modern Class 4 builds in the edge functions it needs to sit on the internet — authentication, rate limits, topology hiding — and for most wholesale operations that is enough. A dedicated SBC still makes sense when you need heavy transcoding or interconnection with networks that require a separate border element.
Can you build a Class 4 softswitch with Asterisk or FreeSWITCH alone?
You can carry traffic, yes; you cannot yet run a business. Asterisk and FreeSWITCH are excellent media and call engines, but they do not ship prefix rating, real-time balance control, margin-based LCR or anti-fraud: that is exactly the layer a Class 4 adds on top of them.
How many concurrent channels does one server handle?
It depends far more on the engine's architecture than on the hardware. A design that forks a process per call runs out of memory long before one with a compiled core and the route table in memory. With the latter, a mid-range VPS carries several hundred channels; the real ceiling usually shows up in the media engine, not in routing logic.
How much does a Class 4 softswitch cost?
The market runs from open platforms with a zero licence — where the cost is a dedicated VoIP engineer — to enterprise licences of thousands per month with unlisted pricing. NEXIA Switch publishes its own: free and permanent up to 100 concurrent channels, then monthly licences from 200 to 1,000 channels.

Run it on your own server

Free up to 100 concurrent calls, forever, no card. Installed in an afternoon, with public pricing for when you grow.