Setting up a SIP trunk connects your IP PBX to a provider so it can make and receive calls on the public phone network. It only takes a handful of fields, as long as you have the right details at hand and pick the right connection method. This guide covers what to ask your provider for, how to configure a SIP trunk in 3CX, Yeastar and FreePBX, and what causes the most common faults: calls with no audio, rejected registrations and calls that drop after 30 seconds.
If you're new to the subject, start with our guide to SIP trunking, which explains how a trunk works, what channels are and what it costs.
Before you start: the details to collect

Depending on the connection method, your SIP trunk provider gives you:
| Detail | Registration | IP authentication |
|---|---|---|
| SIP server address (hostname or IP) and port | Yes | Yes |
| Username and password | Yes | No |
| Your IP PBX's public IP address, registered with the provider | No | Yes |
| Transport (UDP, TCP or TLS) | Yes | Yes |
| Supported codecs | Yes | Yes |
| DID numbers assigned to the trunk | Yes | Yes |
On your side, note the public IP address of your site or server, and make sure it is static if you're going with IP authentication.
Registration or IP authentication: which one?

There are two ways for the provider to recognize your IP PBX:
- Registration: the IP PBX checks in with the provider's server at regular intervals using a username and password, much like a phone signing in to an account. It is the simplest option when your IP address changes or the PBX sits behind an ISP router.
- IP authentication: the provider accepts traffic coming from your IP PBX's public IP address, with no username. It suits a PBX hosted in a data center or behind a static IP, and high call volumes.
Either way, use a long, unique password and restrict international calling on the PBX to the destinations you actually need: the first thing a hacked trunk is used for is calling premium-rate numbers abroad.
Configuring the trunk in 3CX

In the 3CX admin console, trunks are created from Admin > Voice & Chat > Add Trunk, where you choose the country and the provider. If your provider has no ready-made template, 3CX offers two generic types:
- Generic VoIP Provider (Registration), for a trunk with a username and password;
- Generic SIP Trunk (IP-Based), for a trunk authenticated by IP address.
Then enter the SIP server address and port, and the authentication mode: "Register/Account based", with the authentication ID and password, or "Do not require - IP Based". Finally, add your DID numbers and your inbound and outbound call rules.
Configuring the trunk in Yeastar (P-Series)

On a Yeastar P-Series PBX, go to Extension and Trunk > Trunk and click Add. Select the General provider template, then the trunk type:
- Register Trunk: a trunk with a username and password. Fill in the transport, hostname or IP address, port, domain, username, password and authentication name. This type requires at least one DID number.
- Peer Trunk: a trunk authenticated by the PBX's IP address and port.
Then assign the DID numbers and create your inbound and outbound routes.
Configuring the trunk in FreePBX or Asterisk

In FreePBX, open the Trunks module and choose Add SIP (chan_pjsip) Trunk. The pjsip Settings > General tab holds the key fields: Username, Secret (the password), Registration, SIP server and port, context (usually from-pstn) and transport.
On a hand-configured Asterisk, a PJSIP trunk is built from several sections: transport, registration, auth, aor, endpoint and identify. Use outbound_auth rather than auth on the endpoint, because it is your PBX that authenticates with the provider, not the other way around, and add an identify section to match all traffic coming from the provider's IP address to the trunk.
Don't build on the old chan_sip driver: it has been deprecated since Asterisk 17 and was removed in Asterisk 21.
Which codecs to enable

Enable the codecs your provider supports on the trunk, in order of preference:
| Codec | What it offers | Bandwidth per call |
|---|---|---|
| G.711 | The reference phone quality, uncompressed | about 87 kbps |
| G.729 | Compressed voice that saves bandwidth | about 31 kbps |
| Opus | Quality that adapts to the available bandwidth | 6 to 510 kbps |
If the caller and the called party share no codec, the call fails or has to be transcoded: keep G.711 enabled as a fallback.
Common faults and their causes

| Symptom | Likely cause | What to do |
|---|---|---|
| Registration is rejected | Wrong username, password or domain | Re-enter the credentials you were given, and check the authentication name and domain |
| Inbound calls rejected with IP authentication | The IP address registered with the provider isn't the PBX's | Check your public IP and have the provider update it |
| The call connects but there's no audio, or audio in one direction only | Network address translation (NAT) handled badly, often by the router's SIP ALG | Disable SIP ALG and open the PBX's RTP ports |
| The call drops after about 30 seconds | Confirmation messages don't reach the PBX, often for the same reason | Disable SIP ALG and check the PBX's NAT settings |
| "Codec not supported" | No codec in common with the provider | Enable G.711 on the trunk |
| Outbound calls fail to some countries | Destinations blocked on the PBX or by the provider | Check your outbound routes and allowed destinations |
SIP ALG, a feature found on many routers, including the ones internet providers supply, is meant to help VoIP by rewriting SIP messages. In practice, it often corrupts them: Yeastar and 3CX both recommend turning it off.
Test before going live

- Check the registration in the PBX's trunk status, if you're using registration.
- Call a mobile from an internal extension, and make sure audio flows both ways.
- Call one of your DID numbers from a mobile, and check the call reaches the right extension.
- Look at the caller ID shown on the mobile you called: it's the number your customers will see.
- Keep a call going for more than a minute to rule out drops at 30 seconds.
- Test failover: if your provider offers backup routing, unplug the PBX and call a DID number.
The OVOKY SIP trunk

The OVOKY SIP trunk is built for businesses keeping their IP PBX and for VoIP operators:
- Connection by IP authentication or by registration (SIP username and password).
- G.711, G.729 and Opus codecs.
- Channels (simultaneous calls) sized to your traffic.
- Calls to destinations worldwide, and numbers in France, Belgium, Switzerland, Spain and Canada.
- Failover routing for inbound calls when the PBX or the link is down.
Pricing is by quote. Number porting isn't offered: your current lines can be forwarded to your new numbers.



