Установка FreeSwitch, SkypOpen, FreeTDM DAHDI mode, FusionPBX.
Настоятельно рекомедуется устанавливать FS на Debian 8 Jessie менеджером пакетов или из исходников.
Это сильно облегчит вам жизнь и съэкономит время.
Для Centos тоже есть официальный репозиторий, но некоторые важные модули в нем отсутствуют
https://freeswitch.org/confluence/display/FREESWITCH/Debian+8+Jessie
Установка FreeSWITCH FusionPBX Skypopen FreeTDM DAHDI mode на Centos 6
Подготовим Centos 6.X
Обновим систему
yum update -y
Как всегда, отключаем SELinux
/bin/sed -i -e s,'SELINUX=enforcing','SELINUX=disabled', /etc/selinux/config
reboot
Установим зависимости
yum -y install autoconf automake gcc-c++ git-core libjpeg-devel libtool \ make ncurses-devel unixODBC-devel openssl-devel gnutls-devel libogg-devel \ libvorbis-devel curl-devel libtiff-devel libjpeg-devel subversion autoconf \ automake libtool gcc-c++ ncurses-devel make libX11-devel Xvfb alsa-utils \ libXv libXScrnSaver xorg-x11-fonts* alsa-lib libXScrnSaver libtiff-devel \ libjpeg-devel kernel kernel-devel git xz xz-devel mesa-dri-drivers \ alsa-lib fontconfig freetype glibc libgcc \ libICE libSM libstdc++ libX11 libXau libxcb \ libXcursor libXext libXfixes libXi libXinerama \ libXrandr libXrender libXScrnSaver libXv \ sqlite sqlite-devel pcre pcre-devel speex-devel libedit-devel bison patch \ php php-pdo php-mysql
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
установите ldns и ldns-devel
yum install ldns ldns-devel -y
Установим Apache веб-сервер.
yum install http*
Установим и включим MySQL
yum install mysql*
chkconfig mysqld on
service mysqld start
Задайте пароль MySQL
/usr/bin/mysqladmin -u root password "yourpassword"
Установим и настроим ODBC
yum install unixODBC-devel mysql-connector-odbc
Установим символическую ссылку от libmyodbc5.so на libmyodbc.so. [64] - для 64-битной ОС.
ln /usr/lib64/libmyodbc5.so /usr/lib64/libmyodbc.so
Запустим odbcinst -j. Отобразится список конфигурационных файлов.
# odbcinst -j unixODBC 2.2.14 DRIVERS............: /etc/odbcinst.ini SYSTEM DATA SOURCES: /etc/odbc.ini FILE DATA SOURCES..: /etc/ODBCDataSources USER DATA SOURCES..: /root/.odbc.ini SQLULEN Size.......: 4 SQLLEN Size........: 4 SQLSETPOSIROW Size.: 2
Раскомментируйте настройки драйвера MySQL в /etc/odbcinst.ini
Добавьте следующую информацию в файл odbc.ini находящийся в /etc/odbc.ini
[DEFAULT] Driver = MySQL [freeswitch] Driver = MySQL SERVER = localhost PORT = 3306 DATABASE = fusionpbx OPTION = 67108864 Socket = /var/lib/mysql/mysql.sock
Установим FreeSwitch c mod_skypopen.
cd /usr/src git clone https://freeswitch.org/stash/scm/fs/freeswitch.git cd freeswitch ./bootstrap.sh
https://freeswitch.org/issues-with-git-lately-a-few-changes-have-been-made/
October 30 2014
Are you having problems getting the FreeSWITCH sources from GIT since the recent updates?
you might have an older git client that is not following the 302 redirects correctly.
To fix this issue update your GIT origin remote to https://freeswitch.org/stash/scm/fs/freeswitch.git
If you have an existing checkout the following command will fix it.
git remote set-url origin https://freeswitch.org/stash/scm/fs/freeswitch.git
Раскомментируйте дополнительные модули в файле modules.conf
mod_rtmp mod_directory mod_callcenter mod_tts_commandline mod_dingaling mod_flite mod_shout mod_pocketsphinx mod_cidlookup mod_skypopen mod_curl mod_xml_curl
Продолжим установку FreeSWITCH
cd /usr/src/freeswitch
./configure
make
make install
<hidden WTF? не имеет значения, говорит Brian West>
Checking module integrity in target [/usr/local/freeswitch/mod] WARNING: installed module: ftmod_analog_em.so was not installed by this build. It is not present in modules.conf. WARNING: installed module: ftmod_analog.so was not installed by this build. It is not present in modules.conf. WARNING: installed module: ftmod_libpri.so was not installed by this build. It is not present in modules.conf. WARNING: installed module: ftmod_skel.so was not installed by this build. It is not present in modules.conf. WARNING: installed module: ftmod_zt.so was not installed by this build. It is not present in modules.conf.
</hiden>
Установим аудио файлы
8 kHz Standard Audio
make sounds-install make moh-install
16 kHz High Definition Audio
make hd-moh-install make hd-sounds-install
32 kHz Ultra High Definition Audio
make uhd-moh-install make uhd-sounds-install
48 kHz CD Quality Audio
make cd-sounds-install make cd-moh-install
Установим русские звуковые файлы
make sounds-ru-install
опция
make cd-sounds-ru-install
make uhd-sounds-ru-install
make hd-sounds-ru-install
Звуковые файлы инсталлируются по иерархической системе, т.е. если запустить установку файлов cd качества, все голосовые пакеты более низкого качества установятся автоматически.
Установка с FreeTDM DAHDI Mode
(Опция, пропустите если не требуется) <spoiler|FreeTDM>
cd /usr/src wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-2.9.2+2.9.2.tar.gz tar zvfx dahdi-linux-complete-2.9.2+2.9.2.tar.gz cd dahdi-linux-complete-2.9.2+2.9.2 make make install make config
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4.15.tar.gz tar zxvf libpri-1.4.15.tar.gz cd libpri-1.4.15 make make install
nano /etc/modprobe.d/dahdi.conf
options wcte43x default_linemode=e1
cd /etc/dahdi dahdi_cfg -s
dahdi_genconf
service dahdi restart
cat /etc/dahdi/system.conf
# Autogenerated by /usr/sbin/dahdi_genconf on Wed Oct 15 00:41:27 2014 # If you edit this file and execute /usr/sbin/dahdi_genconf again, # your manual changes will be LOST. # Dahdi Configuration File # # This file is parsed by the Dahdi Configurator, dahdi_cfg # # Span 1: WCTE2/0/1 "WCTE23X (PCI) Card 0 Span 1" (MASTER) span=1,1,0,ccs,hdb3,crc4 # termtype: te bchan=1-15,17-31 dchan=16 #echocanceller=mg2,1-15,17-31 # Span 2: WCTE2/0/2 "WCTE23X (PCI) Card 0 Span 2" span=2,2,0,ccs,hdb3,crc4 # termtype: te bchan=32-46,48-62 dchan=47 #echocanceller=mg2,32-46,48-62 # Global data loadzone = ru defaultzone = ru
Изменим права на DAHDI c «asterisk» на «freeswitch»
nano /etc/udev/rules.d/dahdi.rules
ACTION!="add", GOTO="dahdi_add_end" # DAHDI devices with ownership/permissions for running as non-root SUBSYSTEM=="dahdi", OWNER="freeswitch", GROUP="freeswitch", MODE="0660" # Backward compat names: /dev/dahdi/<channo> SUBSYSTEM=="dahdi_channels", SYMLINK+="dahdi/%m" # Add persistant names as well SUBSYSTEM=="dahdi_channels", ATTRS{hardware_id}!="", SYMLINK+="dahdi/devices/%s{hardware_id}/%s{local_spanno}/%n" SUBSYSTEM=="dahdi_channels", ATTRS{location}!="", SYMLINK+="dahdi/devices/@%s{location}/%s{local_spanno}/%n" LABEL="dahdi_add_end" # hotplug scripts SUBSYSTEM=="dahdi_devices", RUN+="%E{DAHDI_TOOLS_ROOTDIR}/usr/share/dahdi/dahdi_handle_device" SUBSYSTEM=="dahdi_spans", RUN+="%E{DAHDI_TOOLS_ROOTDIR}/usr/share/dahdi/dahdi_span_config"
nano /usr/src/freeswitch/modules.conf
раскомментировать удалив #
../../libs/freetdm/mod_freetdm
cd /usr/src/libs/freetdm
./configure --with-libpri --prefix=/usr/local/freeswitch
make make install
nano /usr/local/freeswitch/freetdm.conf
[span zt pri1] name => pri1 trunk_type => E1 group => g1 b-channel => 1-15 d-channel => 16 b-channel => 17-31 [span zt pri2] name => pri2 trunk_type => E1 group => g2 b-channel => 32-46 d-channel => 47 b-channel => 48-62
nano /usr/local/freeswitch/conf/autoload_configs/freetdm.conf.xml
<configuration name="freetdm.conf" description="Freetdm Configuration"> <settings> <param name="debug" value="7"/> </settings> <libpri_spans> <span id="1" name="pri1"> <param name="node" value="network"/> <param name="switch" value="euroisdn"/> <param name="l1" value="alaw"/> <param name="dp" value="unknown"/> <param name="debug" value="all"/> <param name="dialplan" value="XML"/> <param name="context" value="public"/> </span> <span id="2" name="pri2"> <param name="node" value="cpe"/> <param name="switch" value="euroisdn"/> <param name="l1" value="alaw"/> <param name="dp" value="unknown"/> <param name="debug" value="all"/> <param name="dialplan" value="XML"/> <param name="context" value="public"/> </span> </libpri_spans> </configuration>
</spoiler> ссылки по freetdm
https://wiki.freeswitch.org/wiki/FreeTDM
https://wiki.freeswitch.org/wiki/Freetdm.conf_Examples
http://habrahabr.ru/post/141843/
Установим Skypopen
Как настроить skypopen.ko OSS звуковой драйвер (очень важно)
Убедитесь, что никакие звуковые драйверы не загружены, иначе ничего не получится.
После ввода:
lsmod | grep snd
не должно ничего отображаться. Если, все же, драйвера грузятся, попробуйте отключить звуковую карту в bios.
Установим зависимости Skype
yum install libqtxdg libqtxdg-devel qtwebkit qtwebkit-devel
Когда все в порядке, установим аудио драйвер для Skypopen.
cd /usr/src/freeswitch/src/mod/endpoints/mod_skypopen/oss make clean make insmod ./skypopen.ko mknod /dev/dsp c 14 3
Интерактивный установщик и конфигуратор mod_skypopen.
cd /usr/src/freeswitch/src/mod/endpoints/mod_skypopen/install ./install.pl
<spoiler|интерактивный конфигуратор Skype >
This is the interactive installation helper for Skypopen (http://wiki.freeswitch.org/wiki/Mod_skypopen_Skype_Endpoint_and_Trunk) Especially designed for FreeSWITCH by Giovanni Maruzzelli Please direct all questions or issues to the FreeSWITCH mailing list or Jira (http://lists.freeswitch.org/mailman/listinfo or http://jira.freeswitch.org) I'll ask you questions, giving default answers in square brackets [] if any To accept the default, just press Enter You'll be prompted to confirm your answer at each step At the end of questions, before I do anything, I'll let you review it all To abort, press Ctrl-C Let's start asking your name, so you see how the question/answer works To accept the default, just press Enter Enter your name [Giovanni]: test You gave: 'test' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y OK test, GREAT! Let's start real questions! (At any time, Ctrl-C to abort) At the end of questions, before I do anything, I'll let you review all your answers, don't worry! :) I'm about to download the Skype client for Linux version 2.0.0.72 for OSS nicely repackaged by Arch Linux with official Skype permission. I need to create a directory to download and unpack the Skype client To accept the default, just press Enter Enter the full path of the Skype download directory [/tmp/skype_download]: You gave: '/tmp/skype_download' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y I'm about to install the Skype client I would put the binary in /usr/local/freeswitch/skypopen/skype-clients-symlinks-dir and the associated files in /usr/share/skype Location of associated files is mandatory (/usr/share/skype) Location of binary is recommended (/usr/local/freeswitch/skypopen/skype-clients-symlinks-dir) To accept the default, just press Enter Enter the directory full path for Skype client binary [/usr/local/freeswitch/skypopen/skype-clients-symlinks-dir]: You gave: '/usr/local/freeswitch/skypopen/skype-clients-symlinks-dir' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y I'm about to create the FreeSWITCH configuration file for mod_skypopen (skypopen.conf.xml) I need to know where to put it, eg: where is the FreeSWITCH modules' config dir To accept the default, just press Enter Enter the directory full path for FreeSWITCH modules' config files [/usr/local/freeswitch/conf/autoload_configs]: You gave: '/usr/local/freeswitch/conf/autoload_configs' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y I'm about to create the directory where to put our fake sound driver Location of fake sound driver directory is where you like it more :) To accept the default, just press Enter Enter the directory full path for fake sound driver [/usr/local/freeswitch/skypopen/skypopen-sound-driver-dir]: You gave: '/usr/local/freeswitch/skypopen/skypopen-sound-driver-dir' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y I'm about to create the configuration directory needed by the Skype clients Location of Skype clients configuration directory is where you like it more :) To accept the default, just press Enter Enter the directory full path for Skype clients config [/usr/local/freeswitch/skypopen/skype-clients-configuration-dir]: You gave: '/usr/local/freeswitch/skypopen/skype-clients-configuration-dir' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y I'm about to create a directory where I'll put the Skype clients startup script Location of Skype clients startup script directory is where you like it more :) To accept the default, just press Enter Enter the directory full path for Skype clients startup script [/usr/local/freeswitch/skypopen/skype-clients-startup-dir]: You gave: '/usr/local/freeswitch/skypopen/skype-clients-startup-dir' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y I'm about to create the directory for symlinks needed by the Skype clients startup script Location of symlinks directory is where you like it more :) To accept the default, just press Enter Enter the directory full path for Skype clients symlinks [/usr/local/freeswitch/skypopen/skype-clients-symlinks-dir]: You gave: '/usr/local/freeswitch/skypopen/skype-clients-symlinks-dir' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y How many Skype clients (channels) do you want to launch? Each Skype client will be one channel to FreeSWITCH and use approx 70MB of ram A quad core CPU can very easily support 20 or more Skype clients Each Skype client allows one concurrent call Eg: if you plan to have a max of 10 concurrent (outbound and/or inbound) Skype calls then enter 10 To accept the default, just press Enter Enter how many Skype clients will be launched [5]: 1 You gave: '1' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y You want all of the Skype clients to use the same Skype login (skypeusername)? eg: you want all of your skypopen channels to be Bob on the Skype network, or you want channel skype01 to be Bob, channel skype02 to be Alice, etc? Please answer 'one' for all channels using the same Skype login (you'll be asked just one time for Skype login and password) or 'multi' for being asked for each channel Enter 'one' or 'multi' [one]: one You gave: 'one' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y I need the Skype username which will be used by ALL the Skype clients to be launched (That's the one-word you registered as login to the Skype network) This installer will create the needed files to launch concurrently many (or one) instances of it NB: DON'T ACCEPT the DEFAULT, write YOUR OWN Enter the Skype clients username [your_own_skype_username]: skype_user You gave: 'skype_user' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y I need the Skype password which will be used by ALL the Skype clients to be launched (That's the one-word you registered as password to the Skype network) NB: DON'T ACCEPT the DEFAULT, write YOUR OWN Enter the Skype clients password [your_own_skype_password]: skype_password You gave: 'skype_password' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y Please check the following values: directory for downloading and unpacking Skype client: '/tmp/skype_download' directory for Skype client binary: '/usr/local/freeswitch/skypopen/skype-clients-symlinks-dir' directory for FreeSWITCH modules' configs: '/usr/local/freeswitch/conf/autoload_configs' directory for fake sound driver: '/usr/local/freeswitch/skypopen/skypopen-sound-driver-dir' directory for Skype clients configs: '/usr/local/freeswitch/skypopen/skype-clients-configuration-dir' directory for Skype clients startup script: '/usr/local/freeswitch/skypopen/skype-clients-startup-dir' directory for Skype clients symlinks: '/usr/local/freeswitch/skypopen/skype-clients-symlinks-dir' how many Skype clients to launch: '1' Skype login: 'skype_user' Skype password: 'skype_password' Are you sure you like the values? Write 'sure' for yes [nope]: sure You gave: 'sure' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y GREAT! Please stand back, I'm working... --2014-10-15 03:25:04-- http://download.skype.com/linux/skype-4.3.0.37.tar.bz2 Resolving download.skype.com... 184.85.223.40, 184.85.223.58 Connecting to download.skype.com|184.85.223.40|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 19310701 (18M) [application/octet-stream] Saving to: “skype-4.3.0.37.tar.bz2” 100%[=====================================================================================>] 19,310,701 2.39M/s in 7.8s 2014-10-15 03:25:12 (2.35 MB/s) - “skype-4.3.0.37.tar.bz2” saved [19310701/19310701] SUCCESS!!!
</spoiler> Добавим скрипт запуска клиента Skype в rc.local
echo "sh /usr/local/freeswitch/skypopen/skype-clients-startup-dir/start_skype_clients.sh" >> /etc/rc.d/rc.local
ссылки по теме skypopen:
http://ad-host.ru/skypopen-asterisk/
http://wiki.freeswitch.org/wiki/Mod_skypopen_Skype_Endpoint_and_Trunk
Продолжим установку FreeSwitch
Добавим пользователя Freeswitch
useradd freeswitch
Установим права и владельцев на файлы FreeSwitch. Скопируем init скрипт.
cd /usr/local/ chown -R freeswitch:freeswitch freeswitch chmod -R g+w freeswitch cd /usr/src/freeswitch/build cp freeswitch.init.redhat /etc/init.d/freeswitch chmod +x /etc/init.d/freeswitch cp freeswitch.sysconfig /etc/sysconfig/freeswitch
Добавим установки в freeswitch sysconfig
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
Изменим права на запуск скрипта инициализации и добавим FreeSwitch в автозапуск при загрузке системы.
chmod 765 /etc/init.d/freeswitch /sbin/chkconfig --add freeswitch /sbin/chkconfig --level 5 freeswitch on /sbin/chkconfig --list freeswitch
Уберем дефолтные конфиги FreeSwitch из загрузки по умолчанию.
cd /usr/local/freeswitch/conf/dialplan/default mv 00_ladspa.xml 00_ladspa.noload mv 00_pizza_demo.xml 00_pizza_demo.noload mv 01_Talking_Clock.xml 01_Talking_Clock.noload
Установим ссылку на CLI
cd /usr/local/bin/ ln -s /usr/local/freeswitch/bin/fs_cli fs_cli
Установим FusionPBX
cd /var/www/html mkdir fusionpbx svn co http://fusionpbx.googlecode.com/svn/trunk/fusionpbx fusionpbx
Исправим FusionPBX права доступа.
cd /var/www/html chown -R apache:apache fusionpbx
cd /usr/local/freeswitch/conf/ chmod 770 `find . -type d` chmod 660 `find . -type f`
Добавим пользователя apache в группу freeswitch.
usermod -a -G freeswitch apache
Стартуем наши сервисы и установим их в автозагрузку.
service freeswitch start service httpd restart chkconfig freeswitch on chkconfig httpd on yum install monit service monit start chkconfig monit on
Окончательная настройка FusionPBX должна быть выполнена через веб-интерфейс:
http://youraddress/fusionpbx