VoIP.ms is an excellent SIP provider – they’re one of the 3 SIP providers that we recommend to customers. They have excellent reliability and uptime, and offer a metered SIP service that allows you to pay per minute for your usage – excellent for small businesses.
Setting up VoIP.ms SIP trunking with FreePBX using the pjsip protocol can be a bit confusing however, so in this guide we will show you how it’s done!
Before we get started however, if you have not already signed up with VoIP.ms, please consider using our affiliate code – this doesn’t change your price at all, but gets us a few bucks for the recommendation:
Here’s what you’ll need to get started:
- A VoIP.ms account (https://voip.ms/en/code/CROSSTALK)
- FreePBX running pjsip on port 5060
We’re gonna start off by logging into our VoIP.ms account. Click on the ‘Sub Accounts’ tab and choose ‘Create Sub Account.’
Sub accounts are used in VoIP.ms for different destination endpoints – for instance, if you had one VoIP.ms account, but you used it to provide SIP services to multiple PBX’s at different company locations, you would want each company location to have its own sub account. Most people will just have one sub account.
For your sub account settings, you can mostly take the defaults. Here are the fields you should populate:
- Username (will be account number ‘underscore’ username for the sub account)
- Password (make it strong, but best to avoid special characters)
- Device type: Asterisk, IP PBX, Gateway or VoIP Switch
- CallerID Number: I use a system capable of passing its own CallerID
- Allow International calls (leave NO unless you specifically need International dialing)
Scroll to the bottom and click ‘Create account.’
DID Routing – Existing DID’s
Next we need to route a DID to our sub account. If you already have a DID, you can go to DID Numbers → Manage DID’s. If you do NOT already have a DID, skip down to the next section, and we’ll add one.
Click the yellow ‘edit’ button next to one of your DID’s, or check multiple DID’s and then click the ‘Edit selection – all settings at once’ button.
When editing the DID, choose your new sub account for SIP/IAX.
Scroll down to the next section, and choose a server. I’m going to pick USA Seattle 1. Make note of the FQDN – in my case, the Seattle 1 FQDN is ‘seattle1.voip.ms.’
You can leave all remaining settings default. Click the button at the bottom to apply changes.
DID Routing – New DID’s
If you do not already have a DID phone number associated with your VoIP.ms account, click on DID Numbers → Order DID(s).
For our tutorial, we’re going to choose a United States Local Number.
Select the state where you want your DID, and then click ‘View numbers’ next to the city/area where you would like your DID. In my case, I chose Portland, OR.
Find a DID that you want to purchase, check the box next to the DID(s) that you want, and then click the red ‘Proceed to the next step’ button that pops up at the bottom of the page.
The next step is to select a plan – for businesses, the best plan to use is the Per minute plan. The ‘Flat rate’ plan only allows for 2 channels of calling.
For section 3, choose whether you want to enable or disable CallerID lookups (I would say YES to this), and then pick a server (aka DID POP) close to your location. Take note of the FQDN next to your selection – in my case, I’m picking Seattle 1 which has an FQDN of seattle1.voip.ms.
Finally, in the ‘Routing’ section, select your newly created sub-account next to the SIP/IAX option and click ‘Order DID’ at the bottom of the page.
You should now have your DID routed to the sub account that we created. If you ever want to make any changes to your DID, go to DID Numbers → Manage DID(s).
Now it’s time to add the VoIP.ms trunk to FreePBX. In this tutorial, I am using a version 14 FreePBX, but both the previous version 13 and the subsequent version 15 are very similar in terms of setup.
Also, for the purposes of this tutorial, we are going to assume that A) your pjsip protocol is set to port 5060, and B) all appropriate firewall settings are in place. Or in other words, this tutorial doesn’t take into account any potential firewall blocking that may be happening.
To check your pjsip port, you can go to Settings → Asterisk SIP Settings → pjsip settings tab. Scroll down and you should see ‘Port to Listen On’ in the 0.0.0.0 (udp) section. That field should be set to 5060.
Add VoIP.ms trunk
Click Connectivity → Trunks. Click Add Trunk and choose Add SIP (chan_pjsip) Trunk.
Give your trunk a name – this can be anything you want. I am using the name ‘VoIP.ms_1’ as the name in this example. You should also add one of your 10 digit DID’s as the Outbound CallerID.
Next, click on ‘pjsip Settings’ → ‘General’ tab.
Here, add your VoIP.ms username, secret, SIP Server, and SIP Server Port. Make sure Authentication is set to Outbound, and Registration is set to Send.
Next, click on the ‘Advanced’ tab. In the From Domain field, enter in the WAN IP address for your PBX – this is the IP address that VoIP.ms will see your calls coming ‘from.’
Click ‘Submit’ to submit your changes, and then click the red ‘Apply Changes’ button in the upper left corner.
If you want to check to see if your VoIP.ms trunk has successfully registered, you should now be able to click on Reports → Asterisk Info → Chan_PJSip info.
You should be able to see your VoIP.ms trunk status in two places. First, in the ‘Chan_PJSip Registrations’ section, it should show as ‘Registered.’
Second, if you scroll down a bit further, you can find your VoIP.ms trunk in the ‘Chan_PJSip Endpoints’ section, and if all is well, you should see ‘Avail’ status.
Inbound Route Setup
To route calls inbound, you need to set up an inbound route – this can be a default inbound route that routes all calls to a specific location, or an inbound route specifically for your VoIP.ms DID.
In our case, we’re going to create an inbound route specific to our DID, and we’ll route it to a specific extension.
Click on Connectivity → Inbound Routes and then click the Add Inbound Route button.
On the General tab, first give your inbound route a description. This can be anything you want.
In the DID Number field, add your 10 digit VoIP.ms DID. This will route any calls to this DID to the destination set at the bottom of this tab. If you leave this field blank, you will route calls to ANY DID not specifically routed elsewhere to this inbound route.
At the bottom of the General tab, set your destination – in our case, I’m going to send all calls to this DID directly to my extension x200.
Click ‘Submit’ followed by Apply Changes to create your inbound route. If you call your VoIP.ms DID, it should now ring the extension you set.
For complete details for how to configure inbound routes, see our FreePBX v14 series video on the subject: https://www.youtube.com/watch?v=Z2Toi1THvTU
Outbound Route Setup
Next, we’ll create an outbound route for dialing the rest of the world. Click on Connectivity → Outbound Routes and then click the Add Outbound Route button. On the Route Settings tab, first give your route a name – this can be whatever you like, but I’ll call ours VoIP.ms outbound.
For Route CID, enter in your 10 digit VoIP.ms DID – this is the caller ID that will show up as your caller ID when dialing outbound. Next, head down to Trunk Sequence for Matched Routes and choose the VoIP.ms trunk that we set up earlier.
*** NOTE: If you have the Extension Routing our Class of Service (COS) modules installed in your FreePBX, you may have to also authorize your extensions to use this outbound route.
For complete details for how to configure outbound routes, see our FreePBX v14 series video on the subject: https://www.youtube.com/watch?v=sugd5Ngj0F8
And that’s it! The last step is to test outbound dialing, and congratulations! Your VoIP.ms SIP trunk is up and running.
You can also use the setup wiki that is on callcentric and edit it for voip.ms
I just switched to pjsip. I’m using secure sip with pjsip. You don’t need a static IP on your wan for voip.ms. I am setup with only my trunk going through my router. I don’t have any external voip devices going through my router.
I would also like to thank you for your videos especially the one for displaycameras on the raspberry pi.
Thanks and Regards,
Thanks for the video, I appreciate it very much. Been having issues with trying to set upPJSIP and gave upon it. It works! Thanks. It would be great if you would go a step further and set up sms on this PJSIP trunk, I would really like to know how to send/receive SMS from a Yealink T46S phone. Thanks again!
First, really enjoy your YouTube channel. That’s how I found this.
I have found slight differences with my FreePBX (PBX Version: 126.96.36.199, PBX Distro: 12.7.8-2008-1.sng7, and Asterisk Version: 13.36.0) and the version you have used for your blog entry. I think the differences may be due to my version being different from yours but, not sure.
At “FreePBX Setup”, Settings → Asterisk SIP Settings → pjsip settings tab, I did not find “Port to Listen On” to set to “5060”.
The differences begin at “FreePBX Setup”, first thing (as you are aware) is “Port to Listen On”(5060). I did not have such an entry. Nor did I locate “Domain the transport comes from”.
To be clear, you are not to blame for any differences between versions but, this has always been the challenge of setting chan_pjsip on FreePBX. With every version the “target” (settings locations) change and get re-titled to slightly different wording. I, personally, am hoping that with v16 the developers will settle on how this needs to be setup (as they think they are going to begin depreciating chan_sip.)
If I were you, I am not sure I would want to deal with all the variations across the three versions (13, 14, & 15) it might become too time consuming.
I have been using FreePBX since 2013 however, I still think of myself as a newbie because every time “they” change something, it’s new to me!
Have you tried to get voip.ms to work with UniFi Talk yet? They have it there as part of the drop down, but all I can get is outgoing to work, not incoming calls..
I’m assuming it’s my fault, and just don’t know what settings I need to change in the UDM Pro.. but was hoping you’d know.. Very basic setup, a single sub account setup with voip.ms…
I’ve noticed with voip.ms that if Qualify is enabled (Qualify Frequency is > 0 in FreePBX PJSIP Advanced settings), voip.ms occasionally misses a Qualify response. This causes FreePBX to take down the trunk until the next Qualify attempt (60 seconds by default), even in the middle of an active call. To resolve this, I’ve disabled Qualify by setting it to 0 in FreePBX.
Have you ever encountered this issue with voip.ms?
Hi Nick ,
Could you advise which version of freepbx you are running as well as asterisk version.
I have noticed a bit similar behavior as well but thought that it was probably my internet, but i have lowered the qualify to 50 as recommend on voip.ms chan_sip setup but i think i still have this issue.
Where do you see this setting for Qualify of response ? I am using version 15 and I think I am also having this issue when it comes to FreePBX to take down the trunk .
Running FreePBX 188.8.131.52 and Asterisk 16.13.0. I don’t think it’s an Internet issue, since my Internet is very stable. It seems like voip.ms just drops a Qualify response occasionally.
I’m curious if Chris has encountered this issue, since voip.ms seems to be one of his preferred VoIP providers.
I installed the latest FreePBX as of this comment. I’m running it behind a pfSense firewall. I’m not able to call into my public number or make outbound phone calls most of the time. If I disable the trunk and enable, calls can come in and I can make outbound calls. But only for a short time. What settings can I change to keep a connection with VoiP.ms?