A VPS for Asterisk and FreePBX: latency to the carrier, RTP ports and protection from SIP scanners
For an office PBX on Asterisk, CPU and memory are almost secondary: dozens of extensions and several simultaneous calls fit into 1–2 GB of memory. Call quality is decided by the network and the path to the SIP carrier, and security by how quickly you close port 5060 to outsiders. That's why the selection above includes only servers in Russia with KVM virtualisation, with plans sorted by price per core.
Why a server in Russia, and what makes a network good for voice
Most Russian carriers' SIP trunks and the callers themselves are in Russia, and every extra border crossing adds latency and the risk of loss. If your carrier and office are elsewhere, the same logic applies: put the PBX in the country where they are. Three parameters matter for voice:
- Latency. According to ITU-T G.114, one-way delay of up to 150 ms is barely noticeable in conversation; beyond that, people start talking over each other. A server in the same country as the carrier usually gives single-digit or tens of milliseconds.
- Jitter, the variation in delay between packets. Above 30 ms a phone's jitter buffer struggles to smooth it out, and speech starts to sound "bubbly".
- Packet loss. Even 1–2% loss is audible as clipped words.
Before renting for a long term, check the path to the carrier's SIP server from a test VPS with mtr for an hour during working hours. If the office is in the capital, start with the VPS in Moscow selection; how to compare latency across locations is described on the low-ping VPS page.
Resources, codecs and call recording
Asterisk spends CPU mainly on transcoding. If the carrier and the phones use the same codec, a call passes through with almost no load; if the server converts G.711 to G.729 or Opus and back, each such call takes a noticeable share of a core. Bandwidth guidelines for one call in one direction, including IP/UDP/RTP headers:
- G.711 (alaw/ulaw): about 87 kbps, the best quality and zero load when no transcoding is needed;
- G.729: about 31 kbps, saves bandwidth but needs resources for compression;
- Opus: variable bitrate, usually 20–40 kbps for speech, handles loss on mobile networks well.
Plain Asterisk fits into 1 GB of memory. FreePBX adds a PHP web interface, MariaDB and background services, so for it take 2 GB and 2 cores or more. The current FreePBX 17 is installed with the official script on a clean Debian 12. Call recording in WAV takes about 1 MB per minute, so if you record every call, work out the disk space in advance and set up deletion of old files or conversion to MP3.
KVM in the selection is no accident: container virtualisation has no kernel of its own, and modules such as DAHDI for timing and some conferencing features can't be loaded. More about the difference is on the KVM VPS page.
SIP and RTP ports, NAT
- 5060/UDP and TCP: SIP signalling; 5061/TCP: SIP over TLS;
- 10000–20000/UDP: RTP, the voice itself; the range is set in
rtp.conf(rtpstart,rtpend) and can be narrowed to match the real number of simultaneous calls.
If a call connects but one side can't hear the other, NAT or a closed RTP range is almost always to blame. When the VPS has an internal address behind the host's NAT, set external_media_address, external_signaling_address and local_net in the PJSIP transport. Use PJSIP: the old chan_sip driver has been removed from Asterisk since version 21.
SIP scanners and fail2ban
A public address with port 5060 open is found by scanners within a few hours, sometimes minutes, and they start guessing extensions and passwords. The goal is expensive international destinations at your expense: a cracked account can rack up calls overnight costing more than years of server rent. Minimum protection:
- strong SIP passwords of 16 characters or more, and usernames that don't match extension numbers;
- SIP access by IP allowlist: the carrier's and office addresses in the firewall, everyone else denied; for remote staff, an encrypted company tunnel into the office network;
- fail2ban with the asterisk filter, which reads the security log and blocks addresses after several failed registrations; FreePBX has its own Firewall module with similar logic;
- a ban on anonymous inbound calls and a separate context for international destinations, available only to the extensions that need it;
- a balance or spending limit in the carrier's account: the last line of defence.
Moving SIP to a non-standard port cuts the noise in the logs, but doesn't replace any of the above.