Incoming SIP call router for SIP-Jibri
.
This repository contains scripts, files and documentation to convert
FreeSwitch
into a router for incoming SIP calls for SIP-Jibri
. Assumed that
following services are already installed and configured correctly:
Jitsi
Jitsi-Component-Selector
SIP-Jibri
withJitsi-Component-Sidecar
FreeSwitch
SipRecepta
is a plugin for FreeSwitch
to route incoming SIP calls to
SIP-Jibri
. The following steps are tested in Debian 12 Bookworm
. Assumed
that FreeSwitch
already installed and running on this server.
apt-get update
apt-get install python3 python3-requests
In /etc/freeswitch/autoload_configs/modules.conf.xml:
<load module="mod_python3"/>
cd /usr/local/lib/python3.11/dist-packages
mkdir nordeck
cd nordeck
touch __init__.py
wget https://raw.githubusercontent.com/nordeck/sip-recepta/main/files/siprecepta.py
cd /etc/freeswitch/dialplan/public
wget https://raw.githubusercontent.com/nordeck/sip-recepta/main/files/98_public_siprecepta_dialplan.xml
cd /etc/freeswitch/dialplan/default
wget https://raw.githubusercontent.com/nordeck/sip-recepta/main/files/99_default_siprecepta_dialplan.xml
Put siprecepta
folder into /etc/freeswitch/directory/default.xml
<groups>
<group name="default">
<users>
<X-PRE-PROCESS cmd="include" data="default/*.xml"/>
<X-PRE-PROCESS cmd="include" data="/tmp/siprecepta/*.xml"/>
</users>
</group>
</groups>
Update the variables in 98_public_siprecepta_dialplan.xml
and
99_default_siprecepta_dialplan.xml
:
<action application="set" data="conference_mapper_uri=https://domain/path?pin={pin}"/>
<action application="set" data="component_selector_url=https://domain/path"/>
<action application="set" data="component_selector_verify=false"/>
<action application="set" data="component_selector_token=eyJhbG..."/>
Update conference_mapper_uri
according to your conference mapper URI.
Update component_selector_url
according to your component-selector URL.
component_selector_verify
should be false
if Jitsi-Component-Selector
has
not a trusted certificate.
component_selector_token
is needed if PROTECTED_SIGNAL_API
is enabled for
Jitsi-Component-Selector
. Generate the token by running the following
commands:
PRIVATE_KEY_FILE="/path/to/signal.key"
HEADER=$(echo -n '{"alg":"RS256","typ":"JWT","kid":"jitsi/signal"}' | \
base64 | tr '+/' '-_' | tr -d '=\n')
PAYLOAD=$(echo -n '{"iss":"signal","aud":"jitsi-component-selector"}' | \
base64 | tr '+/' '-_' | tr -d '=\n')
SIGN=$(echo -n "$HEADER.$PAYLOAD" | \
openssl dgst -sha256 -binary -sign $PRIVATE_KEY_FILE | \
openssl enc -base64 | tr '+/' '-_' | tr -d '=\n')
TOKEN="$HEADER.$PAYLOAD.$SIGN"
echo $TOKEN
Restart the service:
systemctl restart freeswitch
Call the external number set in 98_public_siprecepta_dialplan.xml. e.g.:
112233@freeswitch_address:5080
Or call the internal number set in 99_default_siprecepta_dialplan.xml. e.g.:
112233
Type PIN when asked.
If it is possible for this setup to set 5060
as the external SIP port then
callers can use SIP address without setting the port.
This is fine if you have only an IP address for this setup. If you have a domain name, use the following...
If you have a domain name, set SRV
records for SIP service.
-
DNS
A
record forsip.mydomain.com
which points the IP address of this server. -
DNS
SRV
record for_sip._tcp.mydomain.com
which pointssip.mydomain.com
. Select5080
as port if you still use the default external port. -
DNS
SRV
record for_sip._udp.mydomain.com
which pointssip.mydomain.com
. Select5080
as port if you still use the default external port.
In this case, the remote peer can call [email protected]
without setting the
port.
You may check the records in VoIP Toolbox. Write your
domain into the input box. e.g mydomain.com