系統環境:
vorbis 套件
yum install libvorbis libvorbis-devel vorbis-tools libogg libogg-devel
curl 套件
yum install curl curl-devel libidn-devel
編譯 FreeSwitch 所需的套件
yum install gcc ncurses ncurses-devel make gcc-c++ libtermcap libtermcap-devel zlib zlib-devel libtool bison bison-devel openssl-devel bzip2 bzip2-devel wget newt newt-devel subversion flex gdbm-devel db4-devel
MySQL 套件
註:如果使用 PIAF 可忽略。
yum install mysql mysql-server mysql-devel
ODBC 套件
yum install unixODBC unixODBC-devel mysql-connector-odbc libtool-ltdl
FreeSwitch FAX 模組
註:如果使用 PIAF 可忽略。
yum install libtiff libtiff-devel libxml2 libxml2-devel libjpeg libjpeg-devel
XMPP 函式庫(連接 Google Talk)
yum install gnutls gnutls-devel gnutls-utils
OpenLDAP 套件
yum install compat-openldap openldap-clients openldap-devel openldap-servers openldap
SNMP 函式庫
yum install net-snmp-devel net-snmp-libs net-snmp-utils net-snmp
Mail Server 套件
yum install sendmail sendmail-devel sendmail-cf
X11 及 Alsa 函式庫
yum install libX11-devel Xvfb alsa-utils libXv libXScrnSaver xorg-x11-fonts* alsa-lib-devel libXScrnSaver kernel-devel alsa-lib libXScrnSaver libXv
TCL 套件
yum install tcl tcl-devel
安裝 git
註:這套件是為了要下載 FreeSwitch 安裝檔
yum install git
或者使用編譯方式安裝
cd /usr/src wget http://www.kernel.org/pub/software/scm/git/git-1.7.3.tar.gz tar -xf git-1.7.3.tar.gz cd git-1.7.3 ./configure --prefix=/usr make make install
安裝 FreeSwitch
cd /usr/src git clone git://git.freeswitch.org/freeswitch.git cd freeswitch/ ./bootstrap.sh ./configure make && make install && make hd-sounds-install && make hd-moh-install && make samples
安裝模組 mod_skypopen
編輯 /usr/src/freeswitch/modules.conf
找到這一行並移除註解符號
... endpoints/mod_skypopen ...
執行
make install
安裝 OSS driver for Skype
cd /usr/src/freeswitch/src/mod/endpoints/mod_skypopen/oss make clean make insmod ./skypopen.ko mknod /dev/dsp c 14 3
安裝及設定 Skype Client
cd /usr/src/freeswitch/src/mod/endpoints/mod_skypopen/install ./install.pl
以 skype channel x4 為例
Enter your name [Giovanni]: <whatever name you wanted> 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 Enter the directory full path for Skype client binary [/usr/bin]: You gave: '/usr/bin' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y 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 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 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 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 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 Enter how many Skype clients will be launched [5]: 4 You gave: '4' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y Enter 'one' or 'multi' [one]: one You gave: 'one' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y Enter the Skype clients username [your_own_skype_username]: <your skype username> You gave: '.......' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y Enter the Skype clients password [your_own_skype_password]: <your skype pass> You gave: '....' It's OK? Please answer 'Y' for yes or 'N' for not [N]: y 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
啟動剛剛設定的 Skype channels x4
sh /usr/local/freeswitch/skypopen/skype-clients-startup-dir/start_skype_clients.sh
設定 FreeSwitch 啟動檔
cd /usr/src/freeswitch/build/ cp freeswitch.init.redhat /etc/init.d/freeswitch vi /etc/init.d/freeswitch
找到這幾行
PID_FILE=${PID_FILE-/opt/freeswitch/run/freeswitch.pid} FS_USER=${FS_USER-freeswitch} FS_FILE=${FS_FILE-/opt/freeswitch/bin/freeswitch} FS_HOME=${FS_HOME-/opt/freeswitch} FREESWITCH_ARGS="-nc"
修改成
PID_FILE=${PID_FILE-/usr/local/freeswitch/run/freeswitch.pid} FS_USER=${FS_USER-root} FS_FILE=${FS_FILE-/usr/local/freeswitch/bin/freeswitch} FS_HOME=${FS_HOME-/usr/local/freeswitch} FREESWITCH_ARGS="-nc -nonat"
執行
chmod +x /etc/init.d/freeswitch chkconfig --add freeswitch chkconfig freeswitch on
設定電話從 Asterisk 到 FreeSwitch 的路由
編輯 /usr/local/freeswitch/conf/dialplan/public.xml
找到這幾行
<include> <context name="public">
在下方加上
<extension name="skype_uri"> <condition field="destination_number" expression="^skype/(.*)$"> <action application="set" data="skype_get_inband_dtmf=true"/> <action application="bridge" data="skypopen/RR/$1"/> </condition> </extension>
設定 mod_skypopen
編輯 /usr/local/freeswitch/conf/autoload_configs/skypopen.conf.xml
找到這幾行
<param name="context" value="default"/> <param name="destination" value="5000"/>
改成
<param name="context" value="skype"/> <param name="destination" value="3200"/>
註:將所有 Skype 來電導入 Ext#3200。
新增 context skype
編輯 /usr/local/freeswitch/conf/dialplan/skype.xml
<?xml version="1.0" encoding="utf-8"?> <include> <context name="skype"> <extension name="skype-call"> <condition field="destination_number" expression="^(3[1-5]00)$"> <action application="set" data="skype_get_inband_dtmf=true"/> <action application="bridge" data="sofia/gateway/asterisk/$1"/> </condition> </extension> </context> </include>
註:將分機 3100-3500 的來電送到 Gateway Asterisk。
新增 Gateway Asterisk
編輯 /usr/local/freeswitch/conf/sip_profiles/external/asterisk.xml
<include> <gateway name="asterisk"> <param name="username" value="freeswitch"/> <param name="realm" value="IPServidorAsterisk"/> <param name="from-domain" value="IPServidorAsterisk"/> <param name="password" value="password"/> <param name="extension" value="freeswitch"/> <param name="proxy" value="IPServidorAsterisk"/>--> <param name="expire-seconds" value="3600"/> <param name="register-transport" value="udp"/> <param name="retry-seconds" value="30"/> <param name="extension-in-contact" value="true"/> <param name="ping" value="25"/> </gateway> </include>
註:修改幾個連結 Asterisk 的參數。
關於 Asterisk 設定
啟動 FreeSwitch 及測試
/usr/local/freeswitch/bin/freeswitch -nonat
載入 mod_skypopen 模組
freeswitch@pbx.local>load mod_skypopen ... 2011-06-19 13:41:02.222682 [CONSOLE] switch_loadable_module.c:946 Successfully Loaded [mod_skypopen] 2011-06-19 13:41:02.222682 [NOTICE] switch_loadable_module.c:145 Adding Endpoint 'skypopen' 2011-06-19 13:41:02.222682 [NOTICE] switch_loadable_module.c:274 Adding API Function 'sk' freeswitch@pbx.local> 2011-06-19 13:41:02.222682 [NOTICE] switch_loadable_module.c:274 Adding API Function 'skypopen' 2011-06-19 13:41:02.222682 [NOTICE] switch_loadable_module.c:274 Adding API Function 'skypopen_chat' 2011-06-19 13:41:02.222682 [NOTICE] switch_loadable_module.c:379 Adding Chat interface 'skype'
註:要關閉/離開 freeswitch 只要執行 shutdown。
Q: 錯誤訊息:2011-06-19 13:32:37.931790 [ERR] sofia_reg.c:1861 asterisk Registration Failed with status DNS Error [503]. failure #2
Ans: