IP PBX Configuration - FreeSWITCH¶
FreeSWITCH is cross-platform scalable free multi-protocol Soft Switch. SIP Trunk configuration instructions below apply to the following Asterisk versions:
- FreeSWITCH 1.6
Documentation is provided for scenario where FreeSWITCH server uses Static IP address on the public Internet and when FreeSWITCH server is on Dynamic IP address.
Static IP address¶
-
Static IP address (
a.b.c.d
in our example above) of your FreeSWITCH server will be added to GoTrunk service IP ACL (Access Control List) and outbound calls coming from that IP address will be accepted without requiring any further authentication (SIP username and password). This is the most efficient way of authenticating SIP calls. -
Inbound calls to one of Telephone Numbers on your GoTrunk account will be sent directly to FreeSWITCH public IP address. Since the calls will be coming from known IP address of SIP Trunking service (
q.x.y.z
in our example above) FreeSWITCH will accept them without requiring any further authentication.
To configure FreeSWITCH server to work with GoTrunk SIP trunk using IP authentication the following changes are required:
1. Add /etc/freeswitch/sip_profiles/external/gotrunk.xml
file:
<include>
<gateway name="gotrunk">
<!-- To send calls to North American POP use: -->
<param name="proxy" value="amn.st.ssl7.net"/>
<!-- To send calls to European POP use: -->
<!-- <param name="proxy" value="eu.st.ssl7.net"/> -->
<!-- Registration is not required for FreeSWITCH on Static IP address -->
<param name="register" value="false" />
<param name="username" value=""/>
<param name="password" value=""/>
</gateway>
</include>
2. Now follow "Dialplan" configuration instructions below.
Dynamic IP address¶
-
For outbound calls from FreeSWITCH to GoTrunk SIP Credentials (SIP username and password) authentication is used.
-
For inbound calls to one of Telephone Numbers on your GoTrunk account to work FreeSWITCH needs to Register with GoTrunk service (and periodically refresh registration in case IP address changes). Calls will be sent to IP address which was sent in the most recent FreeSWITCH Registration. Since the calls will be coming from known IP address of SIP Trunking service (
q.x.y.z
in our example above) FreeSWITCH will accept them without requiring any further authentication.
To configure FreeSWITCH server to work with GoTrunk SIP Trunk using SIP Credentials authentication the following changes are required:
1. Add /etc/freeswitch/sip_profiles/external/gotrunk.xml
file:
<include>
<gateway name="gotrunk">
<!-- To send calls to North American POP use: -->
<param name="proxy" value="amn.st.ssl7.net"/>
<!-- To send calls to European POP use: -->
<!-- <param name="proxy" value="eu.st.ssl7.net"/> -->
<!-- Registration is required for FreeSWITCH on Dynamic IP address -->
<param name="register" value="true" />
<!-- GoTrunk Inbound Registrar SIP Username -->
<param name="username" value="__GOTRUNK_INBOUND_SIP_USERNAME__"/>
<!-- GoTrunk Inbound Registrar SIP Username -->
<param name="password" value="__GOTRUNK_INBOUND_SIP_PASSWORD__"/>
</gateway>
</include>
2. Now follow "Dialplan" configuration instructions below.
Dialplan¶
1. To send outbound calls to GoTrunk SIP Trunk create /etc/freeswitch/dialplan/default/gotrunk.xml
file:
<include>
<extension name="gotrunk_outbound">
<!-- The following line detects outbound calls with a 9 as a dropped prefix -->
<!-- The line after sends the 8-15 digit numbers to the GoTrunk gateway -->
<condition field="destination_number" expression="^9(\d{8,15})$">
<action application="bridge" data="sofia/gateway/gotrunk/$1"/>
</condition>
</extension>
</include>
2. To accept incoming calls from Telephone Numbers assigned to your GoTrunk account create /etc/freeswitch/dialplan/public/gotrunk_inbound_did.xml
file:
<include>
<extension name="gotrunk_did">
<!-- This example maps the DID 442038139810 to ring 1000 in the default context -->
<condition field="destination_number" expression="^(442038139810)$">
<action application="set" data="domain_name=$${domain}"/>
<action application="transfer" data="1000 XML default"/>
</condition>
</extension>
</include>
Note: example above is provided for illustration purposes only. Your actual dialplan will depend on specific FreeSWITCH configuration.