VoIP.ms setup using pjsip on FreePBX

Chris Sherwood 8 min read

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:

https://voip.ms/en/code/CROSSTALK

Here’s what you’ll need to get started:

  1. A VoIP.ms account (https://voip.ms/en/code/CROSSTALK)
  2. FreePBX running pjsip on port 5060

VoIP.ms setup

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.’  

VoIP.ms Create new sub account form with username, password, device type, CallerID and international calls numbered

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.

VoIP.ms portal DID Numbers menu with Manage DID(s) highlighted

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.

VoIP.ms DID list with arrows to the edit icon and the Edit Selection, All Settings at Once button

When editing the DID, choose your new sub account for SIP/IAX.

Edit DID routing with SIP/IAX set to the new siptesting sub account

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.’  

VoIP.ms DID Point of Presence list with Seattle 1, WA (seattle1.voip.ms) selected

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).

VoIP.ms DID Numbers menu with Order DID(s) highlighted

For our tutorial, we’re going to choose a United States Local Number.

VoIP.ms Local Numbers options with United States selected

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.

Order Local DID Numbers page with a Portland, Oregon number checked

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.

VoIP.ms plan selection with Per minute (Inbound) chosen over Flat rate

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. 

VoIP.ms order options with CallerID Name Lookup set to Yes and Seattle 1 picked as the DID POP

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.

VoIP.ms order routing with SIP/IAX set to the sub account and the Order DID button

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).  

FreePBX Setup

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.

FreePBX pjsip settings with Port to Listen On set to 5060 for 0.0.0.0 (udp)

Add VoIP.ms trunk

Click Connectivity → Trunks.  Click Add Trunk and choose Add SIP (chan_pjsip) Trunk.

FreePBX Add Trunk menu with Add SIP (chan_pjsip) Trunk highlighted

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.

FreePBX Edit Trunk General tab with trunk name VoIP.ms_1 and an 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.

FreePBX pjsip General tab with username, secret, SIP server seattle1.voip.ms and port 5060

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.’  

FreePBX pjsip Advanced tab with the PBX WAN IP entered in From Domain

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.’ 

Chan_PJSip Registrations showing VoIP.ms_1 to seattle1.voip.ms:5060 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.

Chan_PJSip Endpoints entry for VoIP.ms_1 with contact status Avail

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.

FreePBX inbound route with description, 10 digit DID and destination extension 200

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.  

FreePBX outbound route VoIP.ms outbound with Route CID and the VoIP.ms_1 trunk sequence

*** 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.

How we can help

FreePBX Support

Get help with the FreePBX system you already have, billed by the hour.

Chris Sherwood

Chris Sherwood

Founder, Crosstalk Solutions

Chris founded Crosstalk Solutions in 2015. Before that, he worked as an IT administrator, a sales engineer and a director at a VoIP company. He has taught networking and VoIP on the Crosstalk Solutions YouTube channel for more than a decade.