0% found this document useful (0 votes)
475 views20 pages

Freeswitch R14: SIP Trunk Provisioning Guide

FreeSWITCH is an open source softswitch that can be configured as an IP PBX. This document provides configuration instructions for FreeSWITCH version 1.2 to interoperate with MegaPath R14 SIP trunks deployed behind a firewall or Edgemarc SIP ALG. It includes details on installation, dial plans, SIP profiles, access control lists, and directory configuration.

Uploaded by

muzeia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
475 views20 pages

Freeswitch R14: SIP Trunk Provisioning Guide

FreeSWITCH is an open source softswitch that can be configured as an IP PBX. This document provides configuration instructions for FreeSWITCH version 1.2 to interoperate with MegaPath R14 SIP trunks deployed behind a firewall or Edgemarc SIP ALG. It includes details on installation, dial plans, SIP profiles, access control lists, and directory configuration.

Uploaded by

muzeia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

FreeSWITCH

R14

SIP Trunk Provisioning Guide

Last Update: 09/25/2012

FreeSWITCH R14 SIP Trunk Provisioning Guide

ABSTRACT
FreeSWITCH is a freely distributed soft switch that can be configured as an IP PBX; it is
supported by a wide variety of operating systems to include MS Windows, FreeBSD, Solaris,
and all Linux distributions. This document covers FreeSWITCH 1.2 interoperation with
MegaPath R14 SIP trunks. For the purpose of instruction, a brief explanation of the
installation process is provided for the Debian 6.0 Linux distribution. This document covers
FreeSWITCH deployed downstream of a third-party firewall and of an Edgemarc SIP ALG.

INTRODUCTION......................................................... 1
1. INSTALLATION ....................................................... 1
2. STANDARD FIREWALL ................................................ 3
2.1 DIAL PLAN .........................................................
2.1.1 OUTBOUND DIAL PLAN.............................................
2.1.2 INBOUND DIAL PLAN .............................................
2.2 SIP PROFILE .......................................................
2.3 ACCESS CONTROL .....................................................
2.4 DIRECTORY (USER EXTENSIONS) ..........................................
2.5 CHECKING THE SIP TRUNK REGISTRATION....................................

3
3
4
5
6
7
8

3. EDGEMARC SIP APPLICATION-LAYER GATEWAY ........................ 9


3.1 DIALPLAN .......................................................... 9
3.1.1 OUTBOUND DIALPLAN ................................................. 9
3.1.2 INBOUND DIAL PLAN............................................. 10
3.2 EXTERNAL SIP PROFILE ............................................... 10
3.3 ACCESS CONTROL .................................................... 11
3.4 DIRECTORY (USER EXTENSIONS) ......................................... 11
3.5 EDGEMARC SIP ALG SIP TRUNKING ...................................... 14
3.6 CHECKING THE SIP TRUNK REGISTRATION................................... 16

INTRODUCTION
FreeSWITCH is a freely distributed softswitch that can be configured as IP PBX. FreeSWITCH
has grown in popularity among the open source community and has become the prevalent
SIP telephony engine in many SIP server open source projects. FreeSWITCH runs a wide
variety of operating systems to include MS Windows, FreeBSD, Solaris, and all Linux
distributions.
For the purpose of instruction, a brief explanation of the installation process is provided for
the Debian 6.0 Linux distribution.
This documents provides the basic configuration parameters for MegaPath R14 SIP trunks
FreeSWITCH 1.2 deployed downstream of a third-party firewall and downstream of an
Edgemarc SIP application-layer gateway.
It should be noted that all FreeSWITCH configurations files are XML files.
For additional information regarding FreeSWITCH, see http://www.freeswitch.org/.
1. INSTALLATION
This installation guide assumes a fresh install of Debian 6.0 (squeeze).
1. From the command line with root privileges, install the following Debian packages:
autoconf
automake
g++
git-core
libjpeg62-dev
libncurses5-dev
libtool
make
python-dev
gawk
pkg-config
dnsutils
psmisc
tcpdump
2. Change to the directory /usr/local/src and issue the following commands to download
and bootstrap the latest 1.2 source:
git clone git://git.freeswitch.org/freeswitch.git
cd freeswitch
./bootstrap.sh
3. Compile the source:
./configure
Make
4. Install FreeSWITCH:
make all install cd-sounds-install cd-moh-install
1

FreeSWITCH R14 SIP Trunk Provisioning Guide


5. Start FreeSWITCH:
/usr/local/freeswitch/bin/freeswitch-nc
6. Once FreeSWITCH is running in the background, issue the following command to
access the FreeSWITCH CLI:
/usr/local/freeswitch/bin/fs_cli

FreeSWITCH R14 SIP Trunk Provisioning Guide


2. STANDARD FIREWALL
For this deployment, ensure that the third-party firewall is configured for static NAT and to
port-forward SIP 5080/UDP and the RTP/UDP range 16384:32768 to the downstream
FreeSWITCH IP PBX server.

Figure 2.1 FreeSWITCH IP PBX behind a third-party firewall.


IMPORTANT: Static NAT is required to mitigate one-way audio.

2.1 Dial Plan


2.1.1 Outbound Dial Plan

The following section describes a dial plan for local, toll-free, and long-distance outbound
calls, using regular expression for dial-pattern matching.
NOTES:

The gateway all calls are routed to is the gateway named speakeasy and this
gateway name is configured later on in the SIP profile XML file used to configure
the R14 SIP trunk.
The authentication username associated with the R14 trunk is demotrunk02.
The authentication password associated with the R14 trunk is h3g3m0nyn0w.
The DID associated with the R14 SIP trunk in this example is 312-533-4875.

/usr/local/freeswitch/conf/dialplan/default/00_dialplan.xml
<include>
<extension name="local">
<condition field="destination_number" expression="^([0-9]{7})$">
<action application="set"
data="effective_caller_id_number=${effective_caller_id_number}"/>
<action application="set"
data="effective_caller_id_name=${effective_caller_id_name}"/>
<action application="set" data="no_media=true"/>
<action application="bridge" data="sofia/gateway/speakeasy/312$1"/>
</condition>
</extension>
<extension name="tollfree">

FreeSWITCH R14 SIP Trunk Provisioning Guide


<condition field="destination_number"
expression="^(1(8(0{2}|8{2}|7{2}|6{2})\d{7}))$">
<action application="set"
data="effective_caller_id_number=${effective_caller_id_number}"/>
<action application="set"
data="effective_caller_id_name=${effective_caller_id_name}"/>
<action application="set" data="no_media=true"/>
<action application="bridge" data="sofia/gateway/speakeasy/$2"/>
</condition>
</extension>
<extension name="longdistance">
<condition field="destination_number" expression="^(1{0,1}\d{10})$">
<action application="set"
data="effective_caller_id_number=${effective_caller_id_number}"/>
<action application="set"
data="effective_caller_id_name=${effective_caller_id_name}"/>
<action application="set" data="no_media=true"/>
<action application="bridge" data="sofia/gateway/speakeasy/$1"/>
</condition>
</extension>
</include>

2.1.2 Inbound Dial plan


The inbound dial plan is located in the /usr/local/freeswitch/conf/dialplan/public directory. In
this example, the inbound dial plan is configured in the 00_inbound_did.xml XML file
under that directory.
</include>
<extension name="public_did_0">
<condition field="destination_number" expression="^(3125334875)$">
<action application="set" data="domain_name=$${domain}"/>
<action application="transfer" data="9664 XML default"/>
</condition>
</extension>
</include>
When the number 312-533-4875 is called from an outside source, FreeSWITCH transfers
the incoming extension indicated by data value in the transfer action, which in this
instance is the extension 9664.

FreeSWITCH R14 SIP Trunk Provisioning Guide


2.2 SIP Profile
IMPORTANT: The Broadsoft Identity/Device Profile used for the R14 SIP trunk is Generic
SIP trunk single SIP registration.
In the following example, the R14 SIP trunk is configured in the XML file
00_speakeasy.xml located in the /usr/local/freeswitch/conf/sip_profiles/external directory.
<include>
<gateway name="speakeasy">
<param name="username" value="demotrunk02"/>
<param name="realm" value="speakeasy.net"/>
<param name=from-domain value=speakeasy.net/>
<param name="password" value="h3g3m0nyn0w"/>
<param name="proxy" value="lab-1-siptrunk-a.voice.speakeasy.net"/>
<param name="expire-seconds" value="3600"/>
<param name="register" value="true"/>
<param name="register-transport" value="udp"/>
<param name="retry-seconds" value="10"/>
</gateway>
</include>

FreeSWITCH R14 SIP Trunk Provisioning Guide


2.3 Access Control
Access for local area network SIP phones and traffic from external sources by way of the
WAN address of the firewall is configured in the acl.conf.xml file located in the
/usr/local/freeswitch/conf/autoload_configs directory.
In this example, the LAN network address is 172.16.1.0/24 and the WAN IP address of the
firewall is 67.101.126.34 /32 .
<configuration name="acl.conf" description="Network Lists">
<network-lists>
<list name="lan" default="allow">
<node type="allow" cidr="10.0.0.0/8"/>
<node type="allow" cidr="172.16.1.0/24"/>
</list>
<list name="domains" default="deny">
<node type="allow" domain="$${domain}"/>
<node type="allow" cidr="67.101.126.34/32"/>
</list>
</network-lists>
</configuration>

FreeSWITCH R14 SIP Trunk Provisioning Guide


2.4 Directory (User Extensions)
The following is an example of a user extension, extension 1500. All user extensions must
be set up as a pointer in the default.xml file located under
/usr/local/freeswitch/conf/directory.
/usr/local/freeswitch/conf/directory/default.xml
<include>
<!--the domain or ip (the right hand side of the @ in the addr-->
<domain name="$${domain}">
<params>
<param name="dial-string"
value="{sip_invite_domain=${dialed_domain},presence_id=${dialed_user}@${dialed_do
main}}${sofia_contact(${dialed_user}@${dialed_domain})}"/>
</params>
<variables>
<variable name="record_stereo" value="true"/>
<variable name="default_gateway" value="$${default_provider}"/>
<variable name="default_areacode" value="$${default_areacode}"/>
<variable name="transfer_fallback_extension" value="operator"/>
</variables>
<groups>
<group name="default">
<users>
<X-PRE-PROCESS cmd="include" data="default/*.xml"/>
</users>
</group>
<group name="x-labs">
<users>
<user id="1000" type="pointer"/>
<user id="1001" type="pointer"/>
<user id="1002" type="pointer"/>
<user id="1003" type="pointer"/>
<user id="1004" type="pointer"/>
<user id="1005" type="pointer"/>
<user id="1006" type="pointer"/>
<user id="1007" type="pointer"/>
<user id="1008" type="pointer"/>
<user id="1009" type="pointer"/>
<user id="1010" type="pointer"/>
<user id="1011" type="pointer"/>
<user id="1500" type="pointer"/>
<user id="1600" type="pointer"/>
</users>
</group>
7

FreeSWITCH R14 SIP Trunk Provisioning Guide

</groups>
</domain>
</include
Once setup as a pointer, the user extension itself can be configured; all user extensions by
default are under /usr/local/freeswitch/conf/directory/default.
IMPORTANT: Ensure that the caller-ID number is set to a DID associated with the R14 SIP
trunk, as the proper caller-ID number is required by the R14 SIP trunk in order to establish
an outbound call.
/usr/local/freeswitch/conf/directory/default/1500.xml
<include>
<user id="1500">
<params>
<param name="password" value="$${default_password}"/>
<param name="vm-password" value="1500"/>
</params>
<variables>
<variable name="user_context" value="default"/>
<variable name="effective_caller_id_name" value="1500"/>
<variable name="effective_caller_id_number" value="3125334875"/>
<variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
<variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
<variable name="callgroup" value="x-labs"/>
</variables>
</user>
</include>

2.5 Checking the SIP Trunk Registration


1. From the command-line of the FreeSWITCH server, issue the following command to
access the FreeSWITCH CLI:
/usr/local/freeswitch/bin/fs_cli
2. Issue the following command to see the SIP trunk registration status:
sofia status
The following line will appear in the status output, indicating the SIP trunk registration
status:
external:<gateway name>
REGED

gateway sip:<username>@<hostname or host IP address>

FreeSWITCH R14 SIP Trunk Provisioning Guide


3. EDGEMARC SIP APPLICATION-LAYER GATEWAY

Figure 3.1 FreeSWITCH IP PBX behind and Edgemarc SIP ALG.

3.1 Dial Plan


3.1.1 Outbound Dial Plan
The following section describes a dial plan for local, toll-free, and long-distance outbound
calls, using regular expression for dial-pattern matching.
NOTES:

The gateway all calls are routed to is the gateway named speakeasy and this
gateway name is configured later on in the SIP profile XML file used to configure
the R14 SIP trunk.
The authentication username associated with the R14 trunk is demotrunk02.
The authentication password associated with the R14 trunk is h3g3m0nyn0w.
The DID associated with the R14 SIP trunk in this example is 312-533-4875.

/usr/local/freeswitch/conf/dialplan/default/00_dialplan.xml
<include>
<extension name="local">
<condition field="destination_number" expression="^([0-9]{7})$">
<action application="set"
data="effective_caller_id_number=${effective_caller_id_number}"/>
<action application="set"
data="effective_caller_id_name=${effective_caller_id_name}"/>
<action application="set" data="no_media=true"/>
<action application="bridge" data="sofia/gateway/speakeasy/312$1"/>
</condition>
</extension>
<extension name="tollfree">
<condition field="destination_number"
expression="^(1(8(0{2}|8{2}|7{2}|6{2})\d{7}))$">
<action application="set"
data="effective_caller_id_number=${effective_caller_id_number}"/>
<action application="set"
data="effective_caller_id_name=${effective_caller_id_name}"/>
<action application="set" data="no_media=true"/>
<action application="bridge" data="sofia/gateway/speakeasy/$2"/>
</condition>
9

FreeSWITCH R14 SIP Trunk Provisioning Guide


</extension>
<extension name="longdistance">
<condition field="destination_number" expression="^(1{0,1}\d{10})$">
<action application="set"
data="effective_caller_id_number=${effective_caller_id_number}"/>
<action application="set"
data="effective_caller_id_name=${effective_caller_id_name}"/>
<action application="set" data="no_media=true"/>
<action application="bridge" data="sofia/gateway/speakeasy/$1"/>
</condition>
</extension>
</include>

3.1.2 Inbound Dial plan


The inbound dial plan is located in the /usr/local/freeswitch/conf/dialplan/public directory. In
this example, the inbound dial plan is configured in the 00_inbound_did.xml XML file
under that directory.
</include>
<extension name="public_did_0">
<condition field="destination_number" expression="^(3125334875)$">
<action application="set" data="domain_name=$${domain}"/>
<action application="transfer" data="9664 XML default"/>
</condition>
</extension>
</include>
When the number 312-533-4875 is called from an outside source, FreeSWITCH transfers
the incoming extension indicated by data value in the transfer action, which in this
instance is the extension 9664.

3.2 External SIP profile


In this instance, the LAN-side IP address of the Edgemarc SIP ALG is 172.16.1.1. The R14
SIP trunk will be configured as show in the example in the XML file
/usr/local/freeswitch/conf/sip_profiles/external/00_speakeasy.xml
<include>
<gateway name="speakeasy">
<param name="username" value="demotrunk02"/>
<param name="realm" value="speakeasy.net"/>
<param name=from-domain value=speakeasy.net/>
<param name="password" value="h3g3m0nyn0w"/>
10

FreeSWITCH R14 SIP Trunk Provisioning Guide


<param
<param
<param
<param
<param
</gateway>
</include

name="proxy" value="172.16.1.1"/>
name="expire-seconds" value="3600"/>
name="register" value="true"/>
name="register-transport" value="udp"/>
name="retry-seconds" value="10"/>

3.3 Access Control


Access for local area network SIP phones and traffic from external sources by way of the
LAN address of the Edgemarc SIP ALG is configured in the acl.conf.xml file located in the
/usr/local/freeswitch/conf/autoload_configs directory.
In this example, the LAN network address is 172.16.1.0/24 and the LAN IP address of the
Edgemarc SIP ALG is 172.16.1.1 .
<configuration name="acl.conf" description="Network Lists">
<network-lists>
<list name="lan" default="allow">
<node type="allow" cidr="10.0.0.0/8"/>
<node type="allow" cidr="172.16.1.0/24"/>
</list>
<list name="domains" default="deny">
<node type="allow" domain="$${domain}"/>
<node type="allow" cidr="172.16.1.1/32"/>
</list>
</network-lists>
</configuration>

3.4 Directory (User extensions)


The following is an example of a user extension, extension 1500. All user extensions must
be set up as a pointer in the default.xml file located under
/usr/local/freeswitch/conf/directory.
/usr/local/freeswitch/conf/directory/default.xml
<include>
<!--the domain or ip (the right hand side of the @ in the addr-->
<domain name="$${domain}">
<params>
<param name="dial-string"
value="{sip_invite_domain=${dialed_domain},presence_id=${dialed_user}@${dialed_do
main}}${sofia_contact(${dialed_user}@${dialed_domain})}"/>
11

FreeSWITCH R14 SIP Trunk Provisioning Guide


</params>
<variables>
<variable name="record_stereo" value="true"/>
<variable name="default_gateway" value="$${default_provider}"/>
<variable name="default_areacode" value="$${default_areacode}"/>
<variable name="transfer_fallback_extension" value="operator"/>
</variables>
<groups>
<group name="default">
<users>
<X-PRE-PROCESS cmd="include" data="default/*.xml"/>
</users>
</group>
<group name="x-labs">
<users>
<user id="1000" type="pointer"/>
<user id="1001" type="pointer"/>
<user id="1002" type="pointer"/>
<user id="1003" type="pointer"/>
<user id="1004" type="pointer"/>
<user id="1005" type="pointer"/>
<user id="1006" type="pointer"/>
<user id="1007" type="pointer"/>
<user id="1008" type="pointer"/>
<user id="1009" type="pointer"/>
<user id="1010" type="pointer"/>
<user id="1011" type="pointer"/>
<user id="1500" type="pointer"/>
<user id="1600" type="pointer"/>
</users>
</group>
</groups>
</domain>
</include
Once setup as a pointer, the user extension itself can be configured; by default, all user
extensions are under /usr/local/freeswitch/conf/directory/default.
IMPORTANT: Ensure that the caller-ID number is set to a DID associated with the R14 SIP
trunk, as the proper caller-ID number is required by the R14 SIP trunk in order to establish
an outbound call.
/usr/local/freeswitch/conf/directory/default/1500.xml

12

FreeSWITCH R14 SIP Trunk Provisioning Guide


<include>
<user id="1500">
<params>
<param name="password" value="$${default_password}"/>
<param name="vm-password" value="1500"/>
</params>
<variables>
<variable name="user_context" value="default"/>
<variable name="effective_caller_id_name" value="1500"/>
<variable name="effective_caller_id_number" value="3125334875"/>
<variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
<variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
<variable name="callgroup" value="x-labs"/>
</variables>
</user>
</include>

13

FreeSWITCH R14 SIP Trunk Provisioning Guide


3.5 Edgemarc SIP ALG SIP Trunking
1. Log in to the Edgemarc SIP ALG. Under the VoIP ALG menu option.
2. Select the SIP option.
3. Under SIP Settings, in the SIP Server Address: field, input the fully-qualified
domain name or IP address of the SIP gateway or session border controller assigned
to you by your VoIP service provider.
4. Input the SIP server port number in the SIP Server Port: field.
5. Enable Use Custom Domain:.
6. Enter speakeasy.net in the SIP Server Domain: field.

Figure 3.5.1 VoIP ALG, SIP Settings.


7. Submit changes.
8. From the SIP sub-menu, select Trunking.

14

FreeSWITCH R14 SIP Trunk Provisioning Guide


9. In

the Add a trunking device menu box:


Set the Action: field to Add new trunking device.
Input a recognizable name for the trunking device in the Name: field.
Input the IP address of the FreePBX server in the Address: field.
Input the SIP port number of the FreePBX server in the Port: field.
Select the Commit button to create the SIP trunking device.

Figure 3.5.2 SIP Trunking, SIP Trunking devices.


10. Under SIP Trunking, go to the Rules section to add an inbound rule.
NOTE: For a single SIP registration, we will be using a Default Rule to send all
inbound call traffic to the LAN-SIDE FreePBX server.

15

FreeSWITCH R14 SIP Trunk Provisioning Guide


11. In

the Add a rule menu box:


Set the Action: field to Add a new rule.
Set the Type: field to Inbound.
Set the Trunking device: field to the recognizable name you created for the
target trunking device in the last section.
Select Commit to create the Default Rule.

Figure 3.5.3 SIP Trunking, Rules, Add a rule.

3.6 Checking the SIP Trunk Registration


1. From the command-line of the FreeSWITCH server, issue the following command to
access the FreeSWITCH CLI:
/usr/local/freeswitch/bin/fs_cli

16

FreeSWITCH R14 SIP Trunk Provisioning Guide


2. Issue the following command to see the SIP trunk registration status:
sofia status
The following line will appear in the status output, indicating the SIP trunk registration
status:
external:<gateway name>
address>
REGED

gateway sip:<username>@<hostname or host IP

17

You might also like