⬆️ ⬇️

Freeswitch - installation and integration with SIPML5

In this article I will try to describe the installation and configuration process of Freeswitch and SIPML5, and at the same time I will talk about solving the problems that have arisen, I hope that the article will be useful and, at a minimum, will help save time for those who are faced with a similar task. So let's get started!



As an OS, I used CentOS 6.6, but this was not limited and I tried installing on Ubuntu 12.04 and 14.04, I will definitely write about the problems I encountered during the installation.



We update the system, disable SELinux and install the necessary dependencies:

')

yum install git gcc-c++ autoconf automake libtool libogg-devel wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel patch libICE 








Install Freeswitch:



 cd /usr/src git clone https://freeswitch.org/stash/scm/fs/freeswitch.git cd /usr/src/freeswitch ./bootstrap.sh –j 




We connect necessary modules, we edit modules.conf:



 mod_rtmp mod_directory mod_callcenter mod_tts_commandline mod_dingaling mod_flite mod_shout mod_cidlookup mod_curl mod_xml_curl 




We continue the installation process for Freeswitch:



 ./configure -C make make install 




Install sound files, just in case we put everything:



 make sounds-install make moh-install make hd-moh-install make hd-sounds-install make uhd-moh-install make uhd-sounds-install make cd-sounds-install make cd-moh-install 




Install Russian sound files:



 make sounds-ru-install make cd-sounds-ru-install make uhd-sounds-ru-install make hd-sounds-ru-install 




Add the user Freeswitch:



 useradd --system --home-dir /usr/local/freeswitch freeswitch passwd -l freeswitch 




Set the rights and owners of the FreeSwitch files:



 chown -R freeswitch:freeswitch /usr/local/freeswitch/ chmod -R g+w /usr/local/freeswitch/ cp /usr/src/freeswitch/build/freeswitch.init.redhat /etc/init.d/freeswitch && chmod +x /etc/init.d/freeswitch cp /usr/src/freeswitch/build/freeswitch.sysconfig /etc/sysconfig/freeswitch cat >> /etc/sysconfig/freeswitch <<EOT PID_FILE=/var/run/freeswitch/freeswitch.pid FS_USER=freeswitch FS_FILE=/usr/local/freeswitch/bin/freeswitch FS_HOME=/usr/local/freeswitch EOT chkconfig --level 5 freeswitch on 




Remove the default configs FreeSwitch and add a link to the CLI:



 rm -rf /usr/local/freeswitch/conf/dialplan/default/00* /usr/local/freeswitch/conf/dialplan/default/01_Talking_Clock.xml cd /usr/local/bin/ && ln -s /usr/local/freeswitch/bin/fs_cli fs_cli 




Probably the first thing to do is change the default password for all users, and also change the password for voicemail:



 /usr/local/freeswitch/conf/vars.xml <X-PRE-PROCESS cmd="set" data="default_password=__"/> 




Include messages in Russian:



 /usr/local/freeswitch/conf/vars.xml <X-PRE-PROCESS cmd="set" data="sound_prefix=$${sounds_dir}/ru/RU/elena"/> 




Install the necessary codecs, I used only G711:



 <X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA"/> <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA"/> 




If you need to turn on the recording of all internal calls:



 /usr/local/freeswitch/conf/dialplan/default.xml 




Find “Local_Extension” and add the line:



 <action application="record_session" data="$${base_dir}/recordings/${strftime(%Y%m%d_%H%M%S)}_${caller_id_number}_${destination_number}.wav"/> 




Apply changes with the fs_cli -x "reloadxml" command. All recordings of conversations will be saved to the directory: / usr / local / freeswitch / recordings /.



Go to the SIPML5 configuration. Enable the Websocket transport:



 /usr/local/freeswitch/conf/sip_profiles/internal.xml <param name="ws-binding" value=":5066"/> 




We start Freeswitch and check that the web socket is activated:



 fs_cli -x "sofia status profile internal" | grep WS-BIND-URL WS-BIND-URL sip:mod_sofia@XXXX:5066;transport=ws 




The setup is complete, but it turned out that there are some problems in the work of the Freeswitch and SIPML5 bundles that I am going to talk about:



Problem number 1:



When calling from SIPML5 to a SIP phone or to a SIPML5 client, the call is reset after n-seconds (usually after 60 seconds). The reason for this strange behavior was in the problem of packet exchange between the web client and the server "Session-Expires: 120; refresher = uas", the problem can be solved by disabling the RFC 4028 SIP Session Timers timer:



 /usr/local/freeswitch/conf/sip_profiles/internal.xml <param name="enable-timer" value="false"/> 




Problem number 2:



Unexpectedly, there were problems with DTMF for SIPML5 clients, who decided to enable dual-mode DTMF (accept RFC2833 and INFO, and offer RFC2833):



 /usr/local/freeswitch/conf/sip_profiles/internal.xml <param name="liberal-dtmf" value="true"/> 




Problem number 3:



As it turned out, this bundle does not want to work on Ubuntu 12.04 OS due to a bug in openssl, which is described here: freeswitch.org/jira/browse/FS-6431 , it is solved by updating the openssl package.

Source: https://habr.com/ru/post/249701/



All Articles