How to set up common VOIP provider trunks with FreePBX
Easy Setup of FreePBX.com Trunks
FreePBX.com SIP trunks are easy to setup and 100% supported by FreePBX. You not only get the benefit of using one of the world's best VoIP backbone networks that Bandwidth.com has built up over the last decade, but you will be directly supporting the FreePBX project when using these trunks. Also, you will be using a trunking service that is designed to work with FreePBX and Asterisk, not an after thought.
If you have not already purchased service, you can do so by going to The FreePBX.com Trunk Store and signing up for service. Your account and phone numbers will be activated instantly and then you can quickly configure and enable your account.
If you are running FreePBX, as most of you are, you can download the SIPSTATIONTM Module from the online repository to auto-configure your trunks. It should be available on versions 2.5 and beyond. It should also work on earlier versions. If you are running a recent version of trixbox you will not have access to our module from their repository. You can download the latest version from here, sipstation-2.6.0.4.tgz to your desktop and then upload it through the Module Admin.
Once you have an account, configuration is straight forward. In your portal area you will find your SIP Username and SIP Password needed to configure your trunk. In the example next, the SIP Username is 0137fg92 and the SIP Password is fs%7fRtu8 to be used in our example.
Now we go into FreePBX and Setup a new SIP trunk. In this example we are assuming that one of our DIDs (account phone numbers in the portal) is 212-555-1234 and we want to setup dialing so that 7 digit dialing, if enabled in our routes, will be sent out from this trunk with the 212 area code automatically. The next screen shows how to do this. The other fields can remain blank. You do not need to set the Maximum Channels field in your trunks with FreePBX SIP Trunks. If you use more channels than you have purchased, the network will signal congestion properly allowing other fail over trunks to be engaged if you have configured them in your route.
You will notice that we put the 2125551234 into the Outbound Caller ID field. This will be the default CallerID used when extensions do not have their own Outbound Caller ID configured.
Next we must configure the Outgoing Settings to talk to the service. There are two SIP Trunk Servers available on this service, trunk1.freepbx.com and trunk2.freepbx.com either of which, or both can be used for outbound calling. Although these can both be access by using the SRV DNS entry trunk.freepbx.com, Asterisk doesn't appear to handle SRV records correctly and you should use trunk1.freepbx.com for FreePBX. Notice that we will ONLY configure the Outgoing Settings box and leave the Incoming Settings box blank. Using the credentials we showed above, the following settings will properly configure your Outgoing Settings with a trunk called freepbx-rocks:
IMPORTANT: The above assumes you have default codecs configured which include ulaw. The service will work with ulaw and g729 if you have g729 licenses. If you have changed this in your global settings you should add:
disallow=all allow=ulaw
and to include g729 as well:
disallow=all allow=ulaw&g729
The setting of qualify=yes is technically not needed but allows you to monitor the health of the internet connection in Asterisk, and if not doing any port forwarding, keeps the NAT pinhole open. For those of you on the extremely techie side, the setting of insecure=very is correct inside FreePBX. FreePBX will automatically convert this to: insecure=port,invite on Asterisk 1.4 and higher versions. (But if you happen to be setting this up in a raw Asterisk install, then you will want the latter).
Some Asterisk versions have been reported to require the Inbound Settings if you find that incoming calls are not being routed properly, possibly receiving the infamous ss-noservice message. If this happens, then try this for the Inbound Settings:
The last bit we need to configure is the registration string so that the FreePBX.com servers know where to send your inbound calls. This is simply derived from you SIP Username and SIP Password. You should be registering to trunk1.freepbx.com as currently registrations to trunk2.freepbx.com will not function:
Now you should be able to hit submit and your trunk should be able to connect and start making and receiving phone calls.
Asterisk: registerattempts
Asterisk has a configuration parameter of registerattempts which determines how many times it will retry a registration if it is not successful. The default value of 10 is typically inadequate. If you have a short network outage, this can result in your registration going away which will stop inbound calls from reaching your system.
We recommend this be set to 0 by editing you sip_general_custom.conf file and adding:
registerattempts=0
A value of 0 tells Asterisk to try forever until successful. You can also use the Asterisk SIP Settings module to configure this, currently available in FreePBX 2.6, and will be backported to 2.5 shortly (and works now if you want to grab the tarball and install it).
Inbound Route
Don't forget to configure an Inbound Route so your PBX knows where to send incoming calls! The most common cause of support calls that start with "I'm not receiving inbound calls" is either a missing or improperly formatted Registration String or NO Inbound Route. Assuming you have purchased DIDs, your calls will be transmitted as a 10 Digit DID and should be entered as such in your Inbound Route section (or using the shortcut "Add Inbound DID" on the Extension tab for each user. You can also create an Any/Any route which will terminate any DIDs you have not specifically assigned.
NAT Configuration
If your PBX is behind NAT and does not have a public IP address, you are going to have to do some additional configuration. This is required for any type of SIP Trunking service that you may have, or to connect remote SIP phones to your PBX. Although you may find that you are able to register without the subsequent instructions, you should always set these up to get proper and optimal service and not rely on features such as NAT Troubleshooting Mode which may get your service going but may result in non-optimal service and voice quality.
The setup is essentially identical as the first two sections of How to Setup a Remote SIP Extension. The information is summarized here:
Internal/External Network Information
You must edit or create the file sip_nat.conf typically found in your /etc/asterisk directory and make sure it is owned by asterisk. We will assume that you have an internal network of 192.168.1.0/255.255.255.0 and that you have a static IP address of 24.72.182.16. If you have a dynamic IP, see the notes that follow. In this situation, you need to create or edit the following entries in your sip_nat.conf file:
externip=24.72.182.16 localnet=192.168.1.0/255.255.255.0
This tells Asterisk what IP address range is internal vs. external so that it can rewrite the SIP headers appropriately. If you have a dynamic address instead of a static address then you need to modify the above. You will need to have a domain name for the host, let's assume you are using dyndns.com's free service and have chosen the name mydomain.dyndns.org. Then your sip_nat.conf file would look like the following:
externhost=mydomain.dyndns.org externrefresh=120 localnet=192.168.1.0/255.255.255.0
Where externrefresh tells Asterisk to recheck the IP address every 120 seconds in this case. You should adjust this higher or lower based on the frequency that this changes.
Firewall/Router Configuration
The default installation of FreePBX is configured to use UDP port 5060 as the SIP signaling port and UDP ports 10001-20000 as the RTP Media ports. All these ports must be forwarded to your FreePBX System. How to do this varies widely depending on the firewall or equipment that you are using. It is commonly referred to as Port Forwarding or maybe Destination NAT (DNAT). However it is referred, if we assume in this example that your FreePBX system has an internal IP address of 192.168.1.100 then you will want:
UDP/5060 -> Forward to 192.168.1.100 UDP/10001-20000 -> Forward to 192.168.1.100
That is all the setup that is required, you can now start making and receiving calls!
REDUNDANT SERVERS
For added redundancy, there is a secondary server that can be used, trunk2.freepbx.com in addition to the primary server trunk1.freepbx.com. It is recommended that you repeat all of the above settings for a second trunk and registration to trunk2.freepbx.com with your same credentials. You MUST have trunk1.freepbx.com registered to receive calls. The secondary server trunk2.freepbx.com will only signal inbound calls if trunk1.freepbx.com were not available.
Peer Details
Trunk Name: bbpglobal
disallow=all
allow=g723&gsm
authuser=<user number>
fromdomain=sip2.bbpglobal.com
fromuser=<user number>
host= sip2.bbpglobal.com
insecure=very
qualify=yes
secret=<password>
type=peer
username=<user number>
User Details
User Context: <user number>
context=from-trunk
fromuser=<user number>
insecure=very
secret=<password>
type=user
username=<user number>
Register String:
<user number>:<password>sip2.bbpglobal.com/<user number>
After long days and nights of probing the web this is what has worked for me.
Outbound Caller ID:
Maximum Channels: <2>
Dial rules : <1|NXXNXXXXXX>
Trunk Name:
Peer Details:
authname=
canreinvite=no
context=from-pstn
dtmf=inband
dtmfmode=inband
fromdomain=sip.broadvoice.com
fromuser=
host=sip.broadvoice.com
insecure=very
qualify=yes
secret=
type=peer
user=phone
username=
INCOMING SETTINGS
User Context:
User Details:
authname=
canreinvite=no
context=from-pstn
dtmf=inband
dtmfmode=inband
fromdomain=sip.broadvoice.com
fromuser=
host=sip.broadvoice.com
insecure=very
secret=
type=user
user=phone
username=
Registation String:
Make sure you omit the <> signs and enter your variables. I have copied this directly from my working broadvoice trunk and removed my variables.
I was helping another user get a Broadvoice trunk working and below is what we finally settled on. The major difference between these and the other Broadvoice settings in this section is that the incoming (USER) settings are not used (as is the case with most consumer VoIP providers, because they treat you as an extension rather than a peer) and therefore the context statement is moved to the peer settings. This should work with FreePBX 2.4 and above and Asterisk 1.4 and above.
OUTGOING SETTINGS
Trunk Name: Broadvoice
PEER Details:
disallow=all
allow=ulaw&alaw
context=from-trunk
dtmf=auto
dtmfmode=inband
fromdomain=sip.broadvoice.com
fromuser=xxxxxxxxxx (your 10 digit broadvoice number)
host=sip.broadvoice.com
insecure=port,invite
qualify=yes
secret=xxxxxxxxxx (this is NOT your login password)
type=peer
user=xxxxxxxxxx (your 10 digit broadvoice number)
username=xxxxxxxxxx (your 10 digit broadvoice number)
INCOMING SETTINGS NOT USED
Registration String: YOUR 10 DIGIT NUMBER:YOUR SIP PASSWORD@sip.broadvoice.com/YOUR 10 DIGIT NUMBER
Peer Details
Trunk Name: engin
allow=ulaw&alaw
disallow=all
auth=md5
canreinvite=yes
dtmfmode=rfc2833
fromdomain=voice.mibroadband.com.au
fromuser=02321XXXX
host=byo.engin.com.au
insecure=very
musiconhold=framed
nat=yes
port=5060
qualify=no
realm=mobileinnovations.com.au
reinvite=yes
secret=<password>
type=friend
username=02321XXXX
Incoming Settings
User Details
User Context: 02321XXXX
context=from-pstn
fromdomain=voice.mibroadband.com.au
host=byo.engin.com.au
secret=<password>
type=user
username=02321XXXX
Register String:
02321XXXX:<password>@byo.engin.com.au/02321XXXX
Note:You may need to include the following in your sip_general_custom.conf
Peer Details
Trunk Name: faktortel
disallow=all
allow=g729&gsm&ulaw&alaw&ilbc
host=iax.faktortel.com.au
qualify=3000
secret=<password>
type=friend
username=xxxxxx
User Details
User Context: xxxxxx
context=from-trunk
host=iax.faktortel.com.au
qualify=3000
type=friend
username=xxxxxx
Register String:
xxxxxx:<password>@iax.faktortel.com.au
Faktortel supports the following codecs:
Peer Details
Trunk Name: fwdsip
disallow=all
allow=ulaw&alaw
canredirect=no
host=fwd.pulver.com
insecure=very
secret=<password>
type=peer
username=xxxx
User Details
User Context: 65xxxx
canreinvite=no
context=from-trunk
fromuser=65xxxx
insecure=very
qualify=no
secret=<password>
type=user
username=xxxx
Register String:
username:<password>@fwd.pulver.com
Peer Details
Trunk Name: Gizmo5
disallow=all
allow=ulaw&alaw&ilbc
canreinvite=no
context=from-trunk
dtmfmode=rfc2833
fromdomain=proxy01.sipphone.com
fromuser=1747xxxxxxx <-- Your Gizmo5 number
host=proxy01.sipphone.com
insecure=very
secret=<password>
type=peer
username=1747xxxxxxx <-- Your Gizmo5 number
User Details
(not used)
Register String:
1747xxxxxxx:<password>@proxy01.sipphone.com
Notes:
If you are using Gizmo5 to get free outgoing calls to U.S. cell phones, etc. via their Backdoor Dialing then you may want to prepend the 0101 code using the dial plan, depending on how you set this up. For example, if you have set up an outbound route that routes calls to certain specific cell phone numbers in the 212 area code to this trunk, then in the trunk dial rules you may want to add something like this:
010+1212XXXXXXX
0101+212XXXXXXX
Or, if you are careful about the traffic you send to this trunk (so that all numbers are pre-validated, or Gizmo5 numbers) then you could use something more generic:
1747XXXXXXX
1+747XXXXXXX
010+1XXXXXXXXXX
0101+XXXXXXXXXX
(747 is the pseudo-area code that Gizmo5 uses, so you don't want to preface that with 0101, therefore put it first so it will match and not fall through to the 0101's).
Note that there is a very short recorded message played at the start of each "free" call, and also note that (at the present time) Caller ID info is not passed through, but instead it will send a Caller ID number in the 262 area code, so you might only want to use this for free calls to friends and family members (in theory this number can be used by the person you called to return your call, but only if they call back from the number you called!). Another "gotcha" is that if your call out credit balance ever goes to zero or negative, "Backdoor Dialing" appears to stop working properly (even though those are "free" calls) - it will ring the called party's phone, but the moment they answer it will disconnect (hopefully this will be fixed someday).
It appears that wherever the 1747xxxxxxx number is given in the above configuration, it is acceptable to substitute the account username (but be consistent, use either the number or the username, but not both).
Some users have reported that when sent from Asterisk, passwords are case sensitive. If you have problems, go to the Gizmo5 login and say you have lost your password an get them to e-mail it to you, then copy and paste from the e-mail into your configuration. Note that passwords are NOT case-sensitive when used with the softphone, Gizmo5 web site, etc.
If you always get an "all circuits busy" when trying to place an 0101 prefix call, check your fromuser and fromdomain lines to make sure they are present and correctly formatted.
The following are the various iinet sip proxies for the different states (at the time of writing).
You may use the sip proxy designation or the dot format IP address when configuring your iinet setting in TrixBox.
| State | SIP Server | IP |
| act | sip.act.iinet.net.au | 203.55.231.193 |
| nsw | sip.nsw.iinet.net.au | 203.55.231.199 |
| nt | sip.nt.iinet.net.au | 203.55.229.193 |
| qld | sip.qld.iinet.net.au | 203.55.228.194 |
| sa | sip.sa.iinet.net.au | 203.55.229.193 |
| tas | sip.tas.iinet.net.au | 203.55.229.193 |
| vic | sip.vic.iinet.net.au | 203.55.229.193 |
| wa | sip.wa.iinet.net.au | 203.59.49.5 |
Peer Details
Trunk Name: iinetout
disallow=all
allow=alaw&ulaw
canreinvite=no
context=ex-did
fromdomain=iinetphone.iinet.net.au
fromuser=073XXXXXXX
host=203.55.228.193
insecure=very
nat=no
pedantic=no
secret=<password>
type=peer
username=073XXXXXXX
User Details
User Context: iinet-inbound
canreinvite=no
context=from-trunk
fromuser=073XXXXXXX
host=203.55.228.193
insecure=very
qualify=no
secret=<password>
type=friend
username=073XXXXXXX
Register String:
073XXXXXXX@iinetphone.iinet.net.au:Password:073XXXXXXX@iinetout/073XXXXXXX
(Source Ref: Graham Foote)
Peer Details
Trunk Name: italk
disallow=all
allow=ulaw&g729
canreinvite=no
context=from-trunk
dtmfmode=rfc2833
fromuser=64997xxxxx
host=akl.italk.co.nz
insecure=very
secret=<your password>
type=friend
username=64997xxxxx
Note: Incoming setting is not required with newer versions of AAH.
You may prefix outgoing calls with 0197 to disable outgoing CID.
Inbound route 64997xxxxx required to be forwarded to a destination ext/menu
Register String:
64997xxxxx:<your password>@akl.italk.co.nz/64997xxxxx
(Source Ref: Steve Biddle)
Peer Details
Trunk Name: KoalaSip
disallow=all
allow=g729&gsm&alaw&ulaw
fromuser=<User-Sip Id>
host=203.122.248.173
nat=yes
port=5060
qualify=no
secret=<password>
type=friend
User Details
User Context: <User-Sip Id>
context=from-pstn
fromdomain=203.122.248.173
host=203.122.248.173
secret=<password>
type=user
username=<User-Sip Id>
Register String:
<User-Sip Id>:<password>@koalavoip.com.au
(Source Ref: Curtis of Koala) also refer here https://www.koalavoip.com.au/billing/node/75
Trunk Name: MyFonesip
disallow=all
allow=alaw&ulaw
authname=091xxxxx
canreinvite=no
dtmfmode=rfc2833
fromuser=091xxxxx
host=sip.myfone.com.au
insecure=very
nat=yes
pedantic=no
qualify=yes
secret=<password>
type=friend
username=091xxxxx
User Details
User Context: 091XXXXX
canreinvite=no
context=from-trunk
fromuser=091xxxxx
insecure=very
qualify=no
secret=<password>
type=friend
username=091xxxxx
Register String:
091xxxxx@sip.myfone.com.au:<password>:091xxxxx@sip.myfone.com.au/091xxxxx
Peer Details
Trunk Name: Nehos
disallow=all
allow=g729
host=iax.ifone.com.au
qualify=yes
secret=<password>
type=peer
username=661xxxx
User Details
User Context: 661XXXX
context=from-trunk
host=iax.ifone.com.au
secret=<password>
type=user
username=661xxxx
Register String:
661xxxx:<password>@iax.ifone.com.au
Peer Details
Trunk Name: Nodephone
disallow=all
allow=g729
canreinvite=no
dtmfmode=rfc2833
fromdomain=sip.internode.on.net
fromuser=<usernumber>
host=sip.internode.on.net
insecure=very
secret=<password>
type=peer
User Details
User Context: <usernumber>
context=from-trunk
host= sip.internode.on.net
secret=<password>
type=user
username=<usernumber>
Register String:
<usernumber>:<password>@sip.internode.on.net
Peer Details
Trunk Name: sipbroker-out
disallow=all
allow=g729&ulaw&alaw
canreinvite=no
dtmfmode=rfc2833
fromdomain=<your existing sip provider>
fromuser=<your user ID of existing provider>
host=sipbroker.com
insecure=very
nat=yes
port=5060
secret=<password for existing provider>
type=peer
You will not require user details since you will not be receiving
incoming calls from this trunk.You do not need to register either.
If you are using SipBroker, you must ensure that your sip_nat.conf is modified to the following;
nat=yes
externip=<Fix Ip address> ; if you have fix IP or
externhost=<your DNS hostname> ; if you are using Dynamic IP
localnet=192.168.1.0/255.255.255.0
This is copied verbatim from this blog post at sysadminman.net, except that I have changed the context statement to context=from-trunk, as required by FreePBX. The USER Context and USER Details in the trunk configuration are left blank. Be sure to substitute your user information and password in place of all instances of "1234567" and "XXXXXXXX".
Sipgatge trunk with Asterisk/FreePBX
9th November 2008, 01:00 pm
I’ve used Sipgate for the past few years with my Asterisk box and have been pretty impressed.
For anyone else looking to use Sipgate with Asterisk/FreePBX here is my trunk setup
Trunk Name: Sipgate
PEER Details:
username=1234567 type=peer secret=XXXXXXXX qualify=yes nat=never insecure=very host=sipgate.co.uk fromuser=1234567 fromdomain=mydomain.com dtmfmode=rfc2833 disallow=all context=from-trunk canreinvite=yes authuser=1234567 allow=ulaw
Register String:
1234567:XXXXXXXX@sipgate.co.uk/1234567
If you are using NAT between your Asterisk box and Sipgate you will need “canreinvite=no” and “nat=yes” or you will probably get one way audio only on your calls.
Peer Details
Trunk Name: sipphone
fromdomain=proxy01.sipphone.com host=proxy01.sipphone.com insecure=very secret=password type=peer username=1747xxxxxxx
User Details
User Context: 1747xxxxxxx canreinvite=no context=from-trunk fromuser=1747xxxxxxx insecure=very qualify=no secret=password type=user username=1747xxxxxxx
Register String:
1747xxxxxxx:password@proxy01.sipphone.com/1747xxxxxxx
Peer Details
Trunk Name: Teleglobal
disallow=all
allow=g729
canreinvite=no
host=210.80.182.142
insecure=very
secret=<password>
type=peer
username=2222xxxxxxxxx
User Details
User Context: 2222xxxxxxxxx
context=from-pstn
fromuser=2222xxxxxxxxx
secret=<password>
type=user
Register String:
2222xxxxxxxxxxx:<password>@210.80.182.142/2222xxxxxxxxxxx
OUTGOING SETTINGS
Trunk Name: viatalk
PEER Details:
disallow=all
allow=ulaw
authuser=xxxxxxxxxxx (your 11 digit viatalk number)
context=from-trunk
dtmf=auto
dtmfmode=inband
fromdomain=chicago-1.vtnoc.net
fromuser=xxxxxxxxxxx (your 11 digit viatalk number)
host=chicago-1.vtnoc.net
insecure=port,invite (or insecure=very only in Asterisk 1.2 & earlier)
qualify=yes
secret=xxxxxxxxxx
type=peer
username=xxxxxxxxxxx (your 11 digit viatalk number)
NOTE: Use your nearest ViaTalk server as selected in the ViaTalk control panel for fromdomain and host settings (Chicago is shown in this example).
NOTE: If you have problems with touch tones not being able to control your IVR on incoming ViaTalk calls, or you find you can't create an inbound route that works, or ViaTalk is sending Caller ID with a + prefix and you'd like to get rid of that, try this: instead of setting the context= to from-trunk, set it to custom-from-viatalk and then add the following lines to the end of /etc/asterisk/extensions_custom.conf (do NOT include the parenthetical line numbers at the start of each line, they are there solely for reference in this documentation):
(1) [custom-from-viatalk]
(2) exten => _X!,1,Noop(Incoming ViaTalk call)
(3) exten => _X!,n,SIPDtmfMode(inband)
(4) exten => _X!,n,GotoIf($["${CALLERID(num):0:2}" != "+1"]?noplusatstart)
(5) exten => _X!,n,NoOp(Changing Caller ID number from ${CALLERID(num)} to ${CALLERID(num):1})
(6) exten => _X!,n,Set(CALLERID(num)=${CALLERID(num):1})
(7a) exten => _X!,n(noplusatstart),Goto(from-trunk,${EXTEN},1)
(7b) exten => _X!,n(noplusatstart),Goto(from-trunk,your-viatalk-number,1)
Always include lines (1) and (2). Use line (3) if you find that callers can't use touch tones to control your IVR, or otherwise get around in your system (if in doubt, we recommend including it). Lines (4) through (6) can be used if ViaTalk is sending the Caller ID number with a + prefix and it is causing problems (with callbacks, etc.) As shown, the code will only strip the + if the number starts with +1, so the + would (hopefully) still be present on any international calls. If you want to remove the + unconditionally (even on international calls) then change Line (4) in two places, so that the :0:2 becomes :0:1 and the "+1" becomes "+". Finally, if your inbound route is working without any issues (as usually seems to be the case now) then use line (7a) rather than line (7b). But if, for some reason, you are still having problems with ViaTalk calls not coming into your inbound route, then try using line (7b) instead of (7a) and where you see your-viatalk-number, replace that with your 11 digit ViaTalk number (you might also have to replace all instances of _X! with s in all lines of the context). Note that using line (7b) should no longer be necessary if you construct the registration string properly (see below), so please try line (7a) first. Whichever variation of line (7) you use, if (and only if) you did not use lines (4) through (6) then remove the (noplusatstart) label on line (7).
INCOMING SETTINGS NOT USED
Registration String: YOUR 11 DIGIT NUMBER:YOUR SIP PASSWORD@YOUR VT PROXY/YOUR 11 DIGIT NUMBER
Source: http://aussievoip.com.au/wiki/Tested+and+working+SIP+provider+configurat...
Peer Details
Trunk Name: VoipBuster
disallow=all
allow=alaw&ulaw&gsm
context=from=pstn
dtmfmode=inband
fromdomain=sip1.voipbuster.com
fromuser=<your username or user number>
host=sip1.voipbuster.com
insecure=very
nat=yes
qualify=yes
secret=<your password>
srvlookup=yes
type=friend
username=<your username or user number>
Register String:
<Username or User Number>:<password>@sip1.voipbuster.com/<Username or User Number>
Note: Incoming setting is not required with newer versions of TrixBox.
If you have an inbound number, an Inbound route is required to
forwarded your incoming call to a destination extension or IVR menu:
Inbound Route:DID: <User inbound Number>
No Fax
(Source Ref: Florent Chandelier)
NOTE: The following is adapted from the page at https://www.voip.com/byod_install_asterisk.asp (with certain changes to work with FreePBX) but has not been tested. If you find any additional changes are necessary, please leave a comment stating what you had to change to make it work. Do not include comments in parenthesis when adding lines to the trunk configuration!
OUTGOING SETTINGS
Trunk Name: voipcom
PEER Details:
disallow=all
allow=ulaw
type=peer
user=username (your authentication User Name provided by voip.com)
host=domain (your domain provided by voip.com)
fromdomain=domain (your domain provided by voip.com)
fromuser=username (your authentication User Name provided by voip.com)
secret=password (your authentication Password provided by voip.com)
username=username (your authentication User Name provided by voip.com)
insecure=port,invite (or insecure=very only in Asterisk 1.2 & earlier)
context=from-trunk (DON'T change this unless you know what you are doing!!!)
authname=username (your authentication User Name provided by voip.com)
dtmfmode=inband
dtmf=inband (or try auto if you have touch-tone issues)
qualify=yes
(Also add the following line to PEER details if your system is behind a NAT firewall):
canreinvite=no
INCOMING SETTINGS NOT USED
Registration String: your authentication User Name:your authentication Password@your voip.com domain/your 11 digit number
Additional note: Voip.com tells you to add pedantic=no to sip.conf. This should NOT be necessary in FreePBX and in any case, you should not add it to sip.conf (because that file is "owned" by FreePBX), but rather to a custom file such as sip_custom.conf or sip_general_custom.conf (in the etc/asterisk directory). We advise trying to make the trunk work without this modification first, then only if it does not work you can try adding that line to one of the above-mentioned "custom" files.
Source: https://www.voip.com/byod_install_asterisk.asp (with required changes to work with FreePBX). Note that if you choose to use the dial plan settings shown on that page, the patterns you wish to allow should be placed in your outbound route, NOT added manually to extensions.conf. Use only the portion of the pattern(s) between "exten => _" and the first comma in the line (do NOT include the leading underscore).