Los Angeles Telephone



Local Connections
Asterisk Tutorials
Add C*NET
Add VOIP Phone Service

Long Distance
C*NET
Manufacture Discontinued
Old Telephones as Entertainment
Telephone Collectors International

Information 411

Comment? Question?



Configuring Internet Telephone Service


These instructions will help you configure a FreePBX or Trixbox Asterisk PBX for basic SIP Internet Telephone service.

This page assumes you have a working FreePBX or Trixbox Asterisk PBX system and it is connected to a broadband internet connection, like Cable Internet or DSL.


STEP 1: Create or edit sip_custom.conf file

Add your Internet Telephone Service Provider (henceforth referred to as ITSP) to your Asterisk system by first creating or editing the sip_custom.conf file in the same directory as your Asterisk config files.

Note: These settings could go into the sip.conf file, but it is recommended that all user changes be added in sip_custom.conf instead, as sip.conf could be overwritten at any time by FreePBX.

Tip: On most systems, the Asterisk config files are located in:

/etc/asterisk

Below are examples of sip_custom.conf files:

Notes on example files:

Replace "sip_username" and "sip_password" wherever you see them with the proper values for your internet phone service.

For voip.ms, wherever you see "server" (as in "server.voip.ms") replace that with the voip.ms VOIP server you want to use. (See voip.ms website for a list of available servers.) E.g.: "losangeles.voip.ms"

Once you complete the sip_custom.conf file and restart Asterisk, if you issue this command in the Asterisk CLI:

sip show registry

you should see your ITSP as registered to your system, although you can't use it yet. The display will look something like this:

localhost*CLI> sip show registry 
Host                     Username   Refresh State       Reg.Time                 
losangeles.voip.ms:5060  sip_username   105 Registered  Tue, 25 Nov 2013 17:41:07
callwithus.com:5080      sip_username    60 Registered  Tue, 25 Nov 2013 17:41:46


Tip: To restart Asterisk, in the Asterisk CLI type:

restart now

or at the UNIX command prompt, type (including the single quotes):

asterisk -rx 'restart now'


STEP 2: Create itsp.conf file

Note: These settings could just go at the bottom of the extensions_custom.conf file, but I think keeping these settings in a separate file makes things clearer and easier to maintain, especially on a complex system.

Create a file called itsp.conf in the same directory as your Asterisk config files.

The new contexts in this file add the instructions for your Asterisk system for how make incoming and outgoing calls for the ITSP.

Below are examples of itsp.conf files:

Notes on example files:

Replace telephone numbers in the examples with your telephone numbers for the DIDs on each ITSP service.

Replace extension numbers (2001 and 2002 in the examples) with the extension numbers on your system that incoming calls should be directed to.

Lines with Noop() commands are just examples of how you can add helpful functions to each of these contexts. If you remove these lines, remember the first line in each block of a dialplan must be numbered 1, not n.

Notice the dial commands in the outgoing contexts contain the name of the context for the ITSP in sip_custom.conf, and the incoming contexts are named the same as the setting named "context=" for each ITSP in sip_custom.conf. This is how sip_custom.conf and itsp.conf are tied together.


STEP 3: Integrate itsp.conf into your dialplan

Edit your extensions_custom.conf file.

At THE BOTTOM of the file, add this line:

#include itsp.conf

This instruction must be at the bottom of extensions_custom.conf, as the file adds new contexts to the system, so this code must come after all the existing instructions in extensions_custom.conf which are part of the default context.

Restart your Asterisk system. You should now be able to receive incoming calls from the ITSP DID to your programmed extension.


STEP 4: Create outgoing.conf file

Note: These settings could just be anywhere within the default context in the extensions_custom.conf file, but I think keeping these settings in a separate file makes things clearer and easier to maintain, especially on a complex system.

Create a file called outgoing.conf in the same directory as your Asterisk config files.

The code in this file adds the instructions to your Asterisk system for how to access your ITSP for outgoing calls.

Below are examples of outgoing.conf files:

Notes on example file:

These are just examples on how to add outgoing dialing instructions, you don't have to add them all.

Replace 9 or 81 with access codes which fit into your dial plan. Notice the number of the digits in the access code matches the number after "EXTEN:"

The first line restricts the dialing of 9 and then a 900 number. ("restricted" in the example could be an extension in the system that plays a recording.)

The second line allows you to dial 9 and then seven digits, and dials out the number adding your local area code before the number. Replace 818 with your local area code.

The fourth line allows you to dial 9 and then international calls.

The fifth line allows you to dial 9 and then any number of any digits, including * which may be required by the ITSP for certain special functions.

The sixth line shows an example of a 2 digit access code.

Notice the Goto commands contain the context name created for outgoing for each ITSP in the itsp.conf file. This is how itsp.conf and outgoing.conf are tied together.


STEP 5: Integrate outgoing.conf into your dialplan

Edit your extensions_custom.conf file.

At the top of the file, below the line that says:

[from-internal-custom]

add this line:

#include outgoing.conf

Restart your Asterisk system. You should now be able to make outgoing calls.


That's it! You're done!

If you need help with any of the information presented on this page, call me on the C*NET at 1-383-4820.


Page last updated: March 26, 2014


Back to Home Page


Original Content Copyright © 2010-2017 Adam Forrest