FreeSwitch

Summary

FreeSWITCH is "The World's First Cross-Platform Scalable FREE Multi-Protocol Soft Switch". It is the reference backend application for OSTN. It has a wild amount of features and can do much more than operate according to our spec. Because of that it can be quite intimidating to configure as merely a SIP user directory and passive SRTP proxy.

Installation

The two above resources are attempts to give focus to implementation details on specific platforms. They give little context about why this configuration is important.

Configuration

Bellow are a list of freeswitch configuration steps needed for OSTN implementations. The following steps assume you are in your freeswitch installation root.

===Build TLS Certs===
please see the freeswitch wiki for a detailed look at TLS configuration.

<pre>
bin/gentls_cert
</pre>

===Enabling TLS===
The bottom of your conf/vars.xml should look something like(note internal_ssl_dir is now set to true):
<pre>
<!--
SIP and TLS settings. http://wiki.freeswitch.org/wiki/Tls
-->
<X-PRE-PROCESS cmd="set" data="sip_tls_version=tlsv1"/>

&lt;!-- Internal SIP Profile -->
&lt;X-PRE-PROCESS cmd="set" data="internal_auth_calls=true"/>
&lt;X-PRE-PROCESS cmd="set" data="internal_sip_port=5060"/>
&lt;X-PRE-PROCESS cmd="set" data="internal_tls_port=5061"/>
&lt;X-PRE-PROCESS cmd="set" data="internal_ssl_enable=true"/>
&lt;X-PRE-PROCESS cmd="set" data="internal_ssl_dir=$${base_dir}/conf/ssl"/>
&lt;!-- External SIP Profile -->
&lt;X-PRE-PROCESS cmd="set" data="external_auth_calls=false"/>
&lt;X-PRE-PROCESS cmd="set" data="external_sip_port=5080"/>
&lt;X-PRE-PROCESS cmd="set" data="external_tls_port=5081"/>
&lt;X-PRE-PROCESS cmd="set" data="external_ssl_enable=false"/>
&lt;X-PRE-PROCESS cmd="set" data="external_ssl_dir=$${base_dir}/conf/ssl"/>
&lt;/include>
&lt;/pre>

===Enabling Proxy Media===
the freeswitch wiki has detailed information about proxy media.

find and edit the following line in conf/sip_profiles/internal.xml
<pre>
<param name="inbound-proxy-media" value="true"/>
</pre>

===Dialplan entries===
the following is an example that can be added conf/dialplan/default.xml. It enables 5 digit numbers to be called, and enables proxy media.

<pre>

&lt;extension name="Local_Extension">
&lt;condition field="destination_number" expression="^(\d{5})$">
&lt;action application="set" data="dialed_extension=$1"/>
&lt;action application="export" data="dialed_extension=$1"/>
&lt;!-- bind_meta_app can have these args &lt;key> [a|b|ab] [a|b|o|s] &lt;app> -->
&lt;action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
&lt;action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
&lt;action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
&lt;action application="set" data="ringback=${us-ring}"/>
&lt;action application="set" data="transfer_ringback=$${hold_music}"/>
&lt;action application="set" data="call_timeout=30"/>
&lt;!-- &lt;action application="set" data="sip_exclude_contact=${network_addr}"/> -->
&lt;action application="set" data="hangup_after_bridge=true"/>
&lt;!--&lt;action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
&lt;action application="set" data="continue_on_fail=true"/>
&lt;action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
&lt;action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
&lt;action application="set" data="called_party_callgroup=${user_data(${dialed_extension}${domain_name} var callgroup)}"/>
<!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}
${domain_name} var sip_secure_media)}"/>-->
&lt;action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
&lt;action application="set" data="proxy_media=true"/>
&lt;action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
&lt;action application="answer"/>
&lt;action application="sleep" data="1000"/>
&lt;action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
&lt;/condition>
&lt;/extension>
&lt;/pre>

Also available in: PDF HTML TXT