This HOWTO will show you how to:
- Install FreeSWITCH from scratch
- Configure FreeSWITCH to bare-minimum level
- Integrate your SIP provider to FreeSWITCH
- Configure the bridge to connect to FreeSWITCH
- Make a call from Matrix to the regular phone network
IMPORTANT: This HOWTO will not make any attempt in creating a secure install, only to give you the ability to test the bridge.
- Debian 8 system
- Ability to support incoming UDP on port 5080, relayed to the system
wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
echo "deb http://ftp.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/debian-backports.list
apt-get update && apt-get install -y freeswitch-meta-all freeswitch-mod-verto freeswitch-mod-rtc
IMPORTANT: If you do not do this, FreeSWITCH will delay each call!
Edit /etc/freeswitch/vars.xml
and set another default password password by replacing 1234
on this line:
<X-PRE-PROCESS cmd="set" data="default_password=1234"/>
Create a file /etc/freeswitch/sip_profiles/external/default.xml
with following content, adapting username
, real
and password
as needed:
<include>
<gateway name="default">
<param name="username" value="00123456789"/>
<param name="realm" value="sip.provider.example.com"/>
<param name="password" value="abc@abc"/>
<param name="register" value="true"/>
<param name="register-transport" value="udp"/>
</gateway>
</include>
Edit /etc/freeswitch/directory/default.xml
and replace ${{default_provider}}
by default
(gateway name) in the following line:
<variable name="default_gateway" value="$${default_provider}"/>
For outgoing calls, edit /etc/freeswitch/dialplan/default/01_example.com.xml
and replace the following line:
<condition field="destination_number" expression="^(011\d+)$">
with
<condition field="destination_number" expression="^(\d+)$">
For incoming calls, edit /etc/freeswitch/dialplan/public/00_inbound_did.xml
and replace the following line:
<condition field="destination_number" expression="^(5551212)$">
with
<condition field="destination_number" expression="^(\d+)$">
systemctl restart freeswitch
Given the following example values, adapt as needed:
- LAN IP of the FreeSWITCH system:
10.1.2.3
- New default password in FreeSWITCH:
12345
- Your Matrix User ID is
@user1:domain.tld
In application.yaml
, set:
providers.freeswitch.verto:
url: 'ws://10.1.2.3:8081'
login: '1000'
password: '12345'
bridge.mapping.users:
user1: '1000'
Restart the bridge
If you wanted to call 00123456789
, assuming you've respected default values in README.md:
- Create a new room
- Invite
@_voip_00123456789:domain.tld
- Hit the call button
- The call should go through
If your DID number is 00123456789
:
- Call it from a regular phone
- You will get an invite to a room on the Matrix side, if not in a room already. Accept it
- Your Matrix client should ring
If you see unknown failure: ERROR_CODE
for the following codes:
INVALID_GATEWAY
: The SIP gateway name doesn't match thedefault_gateway
value.INCOMPATIBLE DESTINATION
: Your SIP line/gateway is not connected