FCSDK / FreeSwitch interop guide


This document is intended as a guide for interop between the CafeX FCSDK and the FreeSwitch (FS) open source PBX platforms.


Enabling FCSDK to call into FS

  • Add the IP or the FQDN of the FCSDK WG to FS ACL () e.g.

cat /usr/local/freeswitch/conf/autoload_configs/acl.cong.xml
<node type="allow" cidr=""/>

  • Add the IP or FQDN of FCSDK as a defined gateway, e.g. 

cat /usr/local/freeswitch/conf/sip_profiles/external/cs-fcsdk21.cafex.com.xml
<gateway name="cs-fcsdk21.cafex.com">
<param name="auth-calls" value="false"/>
<param name="proxy" value="cs-fcsdk21.cafex.com"/>
<param name="register" value="false"/>
<param name="caller-id-in-from" value="true"/> <!--Most gateways seem to want this-->

  • FS requires a restart for these changes to be accepted.

That should be enough to allow you to set the WG to use FS as an outbound proxy. Once that is configured you can sign into the Fusion sample app and call FS by dialling sip:<ext>@<IP of FS>.

Enabling Video Calling.

By default FS inserts itself into the media path and it does not support Video. To be able to make video calls from CafeX to FS registered users you will need to enable media bypass for the target users.

To enable media bypass for the default users on freeswitch edit /usr/local/freeswitch/conf/dialplan/default.xml & add <action application="set" data="bypass_media=true"/> before the bridge as below: 

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

Using FS as an external proxy (optional).

You may want to have the WG forward registrations to FS and allow that to handle them. 

The csdk sample app currently cannot cope with 401 challenges to registrations so you need to add the FCSDK GW IP as a trusted source in Freeswitch (FS):

1. Enable apply-register-acl:

vi /usr/local/freeswitch/conf/sip_profiles/internal.xml

<param name="local-network-acl" value="localnet.auto"/>
<param name="apply-register-acl" value="domains"/>  **Un-comment this value**

2. Add the IP of the FCSDK GW to the acl.conf.xml under domains:


<list name="domains" default="deny">
<!-- domain= is special it scans the domain from the directory to build the ACL --><node type="allow" domain="$${domain}"/>
<node type="allow" cidr=""/>  **This is the IP of the GW**

3. Now restart freeswitch.

Now we can tell the GW to forward register requests to FS: 

To do so on the WG admin go to registrar configuration and click enable external registrar, then enter the IP of FS & click save:

Next you will want to create some FS users in the Fusion sample web app. To do so edit fusionwebapp-db.xml and add some users which have FS as their domain.

The users below (1003 & 1004) are using the default 10xx users that come by default on FS (defined as 








 Comments are disabled on these articles if you require help contact support@cafex.com.

Have more questions? Submit a request