Trunks using 3CX: Part 1

PSTN trunks

A Public Switch Telephone Network (PSTN) trunk is an old fashioned analog Basic Rate Interface (BRI) ISDN or Primary Rate Interface (PRI) phone line. 3CX can use any of these with the correct analog to SIP gateway. Usually these come into your home or business through a pair of copper lines. Depending on where you live, this may be the only means of connecting 3CX and communicating outside of your network.

One of the advantages of a PSTN line is reliability and great call quality. Unless the wires break, you will almost always have phone service. However, what about call quality? After all, many people would like to have a comparison between VoIP and PSTN.

Analog hardware for BRI ISDN and PRI's will be discussed in greater detail in Chapter 9. For using an analog PSTN line, you will need an FXO gateway. There are many external ones available. Until Sangoma introduced a new line at the end of 2008, there had not been any gateway which worked inside a Windows PC with 3CX. There are many manufacturers of analog gateways such as Linksys, Audio-Codes, Patton Electronics, GrandStream, and Sangoma. What these FXO gateways do is convert the analog phone line into IP signaling. Then the IP signaling gets passed over your network to the 3CX server and your phones.

My personal preference is Patton Electronics. They are probably the most expensive FXOs' out there, but in this case, you get what you pay for. I have tried all of them and they all work. Some have issues with echo which can be hard to get rid of without support, or lots of trial and error, whereas some cannot support high demands (40 calls/hour) without needing to be reset every day, so if you are just testing, get a low-end one. For a high demand business, my preference is Patton. Not only do they make great products, but their support is top notch too. We will configure a Patton SmartNode SN4114 later in this article.

SIP trunks

What is a SIP trunk? A SIP trunk is a call that is routed by IP over the Internet through an Internet Telephony Service Provider (ITSP).

For enterprises wanting to make full use of their installed IP PBXs' and communicate over IP not only within the enterprise, but also outside the enterprise—a SIP trunk provided by an ITSP that connects to the traditional PSTN network is the solution. Unlike traditional telephony, where bundles of physical wires were once delivered from the service provider to a business, a SIP trunk allows a company to replace traditional fixed PSTN lines with PSTN connectivity via a SIP trunking service provider on the Internet.

SIP trunks can offer significant cost savings for enterprises, eliminating the need for local PSTN gateways, costly ISDN BRI's or PRI's. The following figure is an example of how our phone system operates:

The 3CX IP PBX Tutorial

You can see that we have a local area network containing our desktops, servers, phones, and our 3CX Phone System. To reach the outside world using a SIP trunk, we have to go through our firewall or router. Depending on your network, you could be using a private IP address (10.x.x.x, 172.16.x.x, or 192.168.x.x) which is not allowed on the public Internet, so it has to get translated to the public IP address. This translation process is called Network Address Translation (NAT).

Once we get outside the local network, we are in the public realm. Our ITSP uses the internet to get our phone call to/from the various carriers PSTN (analog) lines where our phone call is connected/terminated.

There are three components necessary to successfully deploy SIP trunks:

  • A PBX with a SIP-enabled trunk side
  • An enterprise edge device understanding SIP
  • An Internet Telephony or SIP trunking service provider


In most cases, the PBX is an IP-based PBX, communicating with all endpoints over IP. However, it may just as well be a traditional digital or analog PBX. The sole requirement that has to be available is an interface for SIP trunking connectivity.

The enterprise border element

The PBX on the LAN connects to the ITSP via the enterprise border element. The enterprise edge component can either be a firewall with complete support for SIP, or an edge device connected to the firewall handling the traversal of the SIP traffic.


On the Internet, the ITSP provides connectivity to the PSTN for communication with mobile and fixed phones.

Choosing a VoIP carrier—more than just price

I feel two of the most important features to look for when choosing a VoIP carrier is support and call quality. Usually once you setup and everything is working, you won't need support. I always tell clients that there is no "boxed" solution that I can sell, every installation is a little different. Internet connections are all different even with the same provider. If you have a rock-solid T1 or something better, then this shouldn't be a problem. DSL seems different from building to building, even in the same area.

So how do you test support before giving them your credit card? Call them! Try calling support at the worst times such as Monday afternoons when everyone is back to work and online, also try calling after business hours. See how long does it take to connect to a live person and if you can understand them once you speak to them? Find where is their support located? Try talking to them and tell them you are thinking about signing up with their service and ask them for help. If they go out of their way before they have your money, chances are they will be good to work with later on. Some carriers only offer chat or email support in favor of lower prices. While this may work fine for your business, it certainly won't work for the ones who need answers right away.

I know I seem to be stressing a lot on support but it's for good reason. If your business depends on phone service and it goes down then you need answers! I pay more for a product if the support is worth it. Part of this is your Return On Investment (ROI). For example, if you have 3 lawyers billing at $200/hour and they need phones to work, that's $600/hour of lost time. Does the extra $50 or $100 upfront cover that? Now back to the topic at hand.

Once you have connected 3CX to the carrier, how is the call quality? If it sounds like a bad cell phone, you probably don't want it, unless the price is so cheap that you can live with the low quality. Certain carriers even change the way your call gets routed through the Internet, based on the lowest cost for the particular call. They don't care about quality as long as you get that connection and they make money on it.

Concurrent calls with an ITSP are a feature that you may want to look for when choosing an ITSP. Some accounts are a one-to-one ratio of lines per call. If you want to have 5 people on the phone at the same time (inbound or outbound), you would need to pay for 5 lines, this is similar to a PSTN line. You may get some savings here over a PSTN but that depends on what is available in your area.

Some ITSP's have concurrent calls where you can use more than one line per call. Not many carriers have this feature but for a small business, this can be a great cost saving feature to look for. I use a couple of different carriers that have this feature.

One carrier that I use lets you have 3 concurrent calls simultaneously on the same line. If you need more than 3 calls, you're a higher use customer and they want you to buy several lines.

VoIP IP signaling uses special algorithms to compress your voice into IP packets. This compression uses a codec. There are several available, but the most common one is G.711u-law or A-law. This uses about 80kpbs of upload and download bandwidth. Another popular codec is G.729, it uses about 36kpbs. So for the same bandwidth you can have twice the number of calls using G.729 than G.711. You will need to check with your ITSP and see what codec they support.

Another carrier I use is based purely on how much internet bandwidth you have. If you have 1Mbps of upload speed (usually the slowest part of your internet connection), you can support about 10 simultaneous or concurrent calls using G.711. You then pay for the minutes you use. This works very well for a small office as your monthly bill is very low and you don't have to maintain a bunch of lines that don't get used.

Cable internet providers are also offering VoIP service to your home or business. These are usually single-use lines but they terminate at your office with an FXS plug. To integrate this with 3CX, you will need an FXO just like it's a PSTN line, same setup but you get the advantage of a VoIP line.

Another great benefit of a SIP trunk is expandability. You can easily start out with one line which can usually be completed in one day. As you grow you can add more, usually in minutes as you already have the plan setup. Time to consolidate lines? You can even drop them later on without having contracts (most of the time). Try doing that with the local phone company! Call for a new business and it can take 1-2 weeks to get set up, plus contracts to worry about. No wonder they are jumping on the VoIP band wagon.

Disaster recovery

What do you do when your internet goes down? Some of you might be saying, "Ha! It never goes down". In my experience, it will eventually, and at the worst time. So what do you do? Go home for the day or plan for a backup? Most VoIP carriers provide some kind of disaster recovery option. They try to send you a call and when they don't get a connection to your 3CX box; then then re-route the call to another phone number. This could be a PSTN line or even a cell phone. It can be a free feature or there can be a small monthly fee on the account. It's worth having, especially if you rely on phones.

Okay, so that covers inbound disaster recovery. What about outbound? Yes just about everyone has a cell phone these days, if that isn't enough, I'd suggest you invest in a pay-per-use PSTN line. This keeps the monthly cost very low but it's there when you need it. Whether it's an emergency pizza order for that Friday afternoon party or a true emergency when someone panics and dials 911—you want that call to go out.

Speaking of emergency numbers, make sure you have your carrier register that phone number to your local address. Let's say you are in New York and you have a Californian phone number to give you some local presence in that part of the country. Your co-worker grabs his chest and falls down and someone dials 911 from the closest phone they see. Emergency services see your Californian number and contacts California for help for your New York office, that's not what you want when someone is clutching their chest, even though it was just heartburn from that pepperoni pizza.

Mixing VoIP and PSTN

Some of my clients even mix VoIP and PSTN together. Why would you mix? Local calls and inbound calls use the PSTN lines for the best call quality (and do not use any VoIP minutes if they have to pay for those). Long distance calls use the cheaper rate VoIP line. Another scenario is using PSTN lines for all your incoming and outgoing calls and use VoIP to talk to your other offices. Your own office can deal with a lower call quality, and management will appreciate the lower cost. These types of setups can be controlled using a dial plan.

Connecting 3CX to your trunk

Let's cover the setup for connecting 3CX to a PSTN line using an analog gateway (Patton SN4114) and then connecting 3CX to a SIP/ITSP line.

The first thing you need to know is that every line or port in 3CX is assigned its very own number. Just like the Ring Groups, Digital Receptionists, and Call Queues have their own account number assigned. This makes it easier to route calls using a number.

Let's get started with creating an analog trunk:

The first thing we need to do is start the PSTN Gateway wizard. We can do this in three different ways. It does not matter which method you use as they all start the wizard the same way.

  1. The first way is to click Add and then click PSTN Gateway:
  2. The 3CX IP PBX Tutorial

  3. The second way is to click Add PSTN Gateway on the main 3CX toolbar:
  4. The 3CX IP PBX Tutorial
  5. The third method is to use the navigation pane on the lefthand side; click PSTN devices, then click Add Gateway on the righthand side:
  6. The 3CX IP PBX Tutorial

Now that we have started the PSTN Gateway wizard, we can run through the steps. First come up with a name, I suggest something meaningful. I like to use the model number and something else after it, like an A or a 1. Using this method lets you expand easily and keep the naming conventions the same for all devices. As I'm using a Patton SN4114 gateway, I chose the name PattonSN4114A. If I need to add another gateway then I can use the same name and use a B at the end. Using a label maker, I also label the Patton itself with the name, IP address, and (depending on the environment) maybe even the username and password.

The next step is to pick which supported gateway you have and you can see there are a lot of choices. If you are using a Patton, you need to know which firmware the device has on it. Version 4 and version 5 firmware need slightly different configuration files. 3CX is smart enough to know the difference when it generates the configuration file. This configuration file is going to be saved and uploaded to the Patton to instantly configure the gateway. Pretty cool! Otherwise you have a choice of configuring the gateway using a command line connected to a serial port cable on your computer and the Patton, or use their clunky web interface—neither are user-friendly.

Just to save some space, I have cut out a link of some of the supported gateways in the following screenshot. For a complete list of supported gateways, follow the link.

The 3CX IP PBX Tutorial

There are more gateways that work with 3CX which are listed on their website but they don't work with the gateway wizard. If you ever need support from a vendor or 3CX directly, I'd suggest that you use one that is listed in the wizard.

I know my gateway has version 4 of the firmware because it says so on the box. If you don't have the box it came with, or you just aren't sure, you will have to go into the web interface or the console command line and obtain the firmware version. Here I'm selecting Patton SN-4114 4-port FXO (Firmware R4.x).

After you select your gateway, click Next

The 3CX IP PBX Tutorial

Other supported gateways have been cut for space reasons.

On the next screen as shown in the following screenshot, you will have to select a few options. The first one is Tone Set Selection to select which country this gateway is going to be installed in.

The next section is for Incoming Caller ID info. If you have caller ID, you will want to select Collect CallerID information. This will delay the gateway from picking up the incoming call immediately. It will wait another ring (depending on which country and your phone company information) before picking up the call. Once it waits a second or two it should have all the caller ID information, answer the phone line, and pass it to 3CX for processing (what to do with the call).

Our next section is to Remove Announcements that the phone company passes on. I don't like these so I have them removed.

If we are going to use this gateway for outbound calls, 3CX needs to know how to do it. We can hunt (look for) a free line on the gateway. It's based on port numbers, so if you want it to start looking at port 1000 for a free line, then 1001, choose Hunting (Ascending). If you want it to start at the end (1004) then go to 1003, choose Descending. If you have roll-over lines, you may want choose Descending but it doesn't really matter to the Patton.

Our last setting covers how long you want to wait to collect the caller ID information. Depending on your phone carrier you may have to adjust this setting. If you find that you are not getting all the information, you will have to edit this and adjust accordingly.

Now that this screen is all filled in, we can click Next:

The 3CX IP PBX Tutorial

Our next wizard screen is device specific. We start off by giving it a Gateway Hostname or IP address. Unless you have your own DNS server or are using WINS or host files, you will want to use an IP address. Even if you have a DNS server, I'd still suggest you use an IP address. You certainly don't want to lose your connection to the gateway if your DNS server is down.

Now we need to specify which Gateway Port to use. Unless you have a reason to use something different, stick with the well known default SIP port 5060.

The next setting is how many ports we are going to use for this gateway. The default is the maximum number of ports that the device has available, even if you don't use them all, it will be easy to upgrade if necessary. When you're done with this screen click Next:

The 3CX IP PBX Tutorial

Now we get to create the port numbers, names, passwords, and some rules for call processing. We can see here that we have a Virtual extension number, Authentication ID,and Authentication Password. If you want to change these to something different, now is the time to do it. The best name to use here is the actual line number.

As we are using analog single call lines, we need to leave the Channels section to 1.

The only real thing we may want to change is the Inbound Route Day and Inbound Route Night. This tells 3CX what to do with an incoming call during the day and what to do at night. During the day, I want it to go to the hunt group. At night when no one is around to answer the call, I set it to go directly to the Digital Receptionist.

Go ahead and click Next:

The 3CX IP PBX Tutorial

>> Continue Reading Trunks using 3CX: Part 2


[ 1 | 2 ]

If you have read this article you may be interested to view :

You've been reading an excerpt of:

The 3CX IP PBX Tutorial

Explore Title