1. 安装unixODBC 和 MySQL ODBC Connector
yum install unixODBC-devel mysql-connector-odbc
2. 创建软连接
ln -s libmyodbc5.so libmyodbc.so
3. 在远程MySQL服务器中创建数据库“freeswitch” ,创建有密码用户
4. 添加如下 DSN 到 /etc/odbc.ini和 /root/.odbc.ini
[freeswitch]
DRIVER = MySQL
SERVER = 192.168.0.104
PORT = 3306
DATABASE = freeswitch
USER = fsu
PASSWORD = 123456
OPTION = 3
5.执行如下命令测试连接:
isql freeswitch -v
报错:
[S1000][unixODBC][MySQL][ODBC 5.1 Driver]Host '192.168.0.105' is not allowed to connect to this MySQL server
[ISQL]ERROR: Could not SQLConnect
6.到远程的MySQL 服务器下,进入“mysql”数据库执行如下SQL命令
update user set host = '%' where user = 'root';
再执行如下命令
isql freeswitch 用户名 密码 -v
返回
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
7. 下载最新版freeswitch:http://files.freeswitch.org/
8. 解压,配置,编译 FreeSWITCH
tar -xf freeswitch-1.2.5.3.tar.bz2
./configure --enable-core-odbc-support
make&& make install
9.在/usr/local/freeswitch下执行如下命令
grep -ir dsn .
查出全部希望使用MySQL 替代SQLite 的功能的配置文件
显示如下
...
./autoload_configs/switch.conf.xml: <param name="core-db-dsn" value="freeswitch:fsu:123456" />
./autoload_configs/db.conf.xml.bak: <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
./autoload_configs/cidlookup.conf.xml: <param name="odbc-dsn" value="phone:phone:phone"/>
./autoload_configs/voicemail.conf.xml: <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
./autoload_configs/callcenter.conf.xml: <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
./autoload_configs/nibblebill.conf.xml: <param name="db_dsn" value="bandwidth.com"/>
./autoload_configs/db.conf.xml: <param name="odbc-dsn" value="freeswitch:fsu:123456"/>
...
这些功能都可以改用MySQL,修改这些配置文件中的参数value
如
<param name="core-db-dsn"value="dsn:user:pass"/>
或
<param name="odbc-dsn"value="phone:phone:phone"/>
10.运行FreeSWITCH
启动过程中自动在已建的freeswitch数据库中创建表
--转自