问题:我正在使用在VirtualBox中运行星号2.0服务器的AsteriskNow。我想使用ODBC模块连接Asterisk和MySQL数据库。但它失败了。当我开始使用星号* CLI> odbc show命令提示符显示“没有这样的命令ODBC SHOW”ODBC连接错误:没有这样的命令“odbc show”ODBC连接失败* CLI
我的目标:配置ODBC asterisk以直接和动态地从Asterisk的dialplan访问MySQL。
我做了什么:我在VirtualBox中安装了我的AsteriskNow。星号的版本是2.0,CentOS 5.8版本的最终版本。我首先由
yum -y install unixODBC-devel
yum -y install libdbi-dbd-mysql
yum -y install mysql-connector-odbc
我的详细配置文件安装相关的Linux RPM如下:
/etc/odbc.ini
[asterisk-connector]
Description = MySQL connection to 'asterisk' database
Driver = MySQL
Database = asterisk
Server = localhost
UserName = root
Password = mypassword
Port = 3306
Socket = /var/lib/mysql/mysql.sock
/etc/odbcinst.ini
# Driver from the mysql-connector-odbc package
# Setup from the unixODBC-libs package
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc3_r.so
Setup = /usr/lib/libodbcmyS.so
;Driver64 = /usr/lib64/libmyodbc3_r.so
;Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1
/etc/asterisk/res_odbc.conf
[asterisk]
enabled=>yes
dsn=>asterisk-connector
;dsn=>asterisk
username=>root
password=>mypassword
pooling=>no
limit=>0
pre-connect=>yes
当我用 “ISQL” 命令连接MySQL数据库,它工作正常
但是,当我开始在CLI控制台,输入命令ODBC显示。它显示没有这样的命令“ODBC秀”
,我很困惑在这里,不知道如何解决它。我搜索了它,发现有人建议通过加载res_odbc.so模块来解决它。因此,我通过文件的modules.conf去和添加这些修改后的文件
autoload=yes
preload => res_odbc.so
preload => res_config_odbc.so
被修改后,完整的文件是遵循” 的/ etc /星号/模块
这样做;
; Asterisk Module Loader configuration file
;
;
[modules]
autoload=yes
;
; Any modules that need to be loaded before the Asterisk core has been
; initialized (just after the logger has been initialized) can be loaded
; using 'preload'. This will frequently be needed if you wish to map all
; module configuration files into Realtime storage, since the Realtime
; driver will need to be loaded before the modules using those configuration
; files are initialized.
;
; An example of loading ODBC support would be:
preload => res_odbc.so
preload => res_config_odbc.so
;
; As FreePBX is using Local as the channel for queue members we need to make sure
; that pbx_config.so and chan_local.so are preloaded. If not, queue members
; will be marked as invalid until app_queue is reloaded.
preload => pbx_config.so
preload => chan_local.so
;
; Uncomment the following if you wish to use the Speech Recognition API
;preload => res_speech.so
;
; If you want, load the GTK console right away.
; KDE console is obsolete and was removed from Asterisk 2008-01-10
;
noload => pbx_gtkconsole.so
;load => pbx_gtkconsole.so
noload => pbx_kdeconsole.so
;
; Intercom application is obsoleted by
; chan_oss. Don't load it.
;
noload => app_intercom.so
;
; DON'T load the chan_modem.so, as they are obsolete in * 1.2
noload => chan_modem.so
noload => chan_modem_aopen.so
noload => chan_modem_bestdata.so
noload => chan_modem_i4l.so
; Trunkisavail is a broken module supplied by Trixbox
noload => app_trunkisavail.so
; Ensure that format_* modules are loaded before res_musiconhold
;load => format_ogg_vorbis.so
load => format_wav.so
load => format_pcm.so
; format_au.so is removed from Asterisk 1.4 and later, remove ; to enable
;load => format_au.so
; This isn't part of 'Asterisk' iteslf, it's part of asterisk-addons. If this isn't
; installed, asterisk will fail to start. But it does need to go here for native MOH
; to work using mp3's.
; Note that on a system with a high number of calls, using a compressed audio format for
; musiconhold takes CPU resources. Converting these files to ulaw/alaw makes the job
; much easier for your CPU.
load => format_mp3.so
load => res_musiconhold.so
;
; Load either OSS or ALSA, not both
; By default, load no console driver
;
noload => chan_alsa.so
noload => chan_oss.so
;
noload => app_directory_odbcstorage.so
noload => app_voicemail_odbcstorage.so
后,我回到命令行控制台重新加载res_odbc.so,但它未能找到res_odbc.so
我需要有人给我暗示上解决ODBC连接问题。
嗨,zigg。我无法表达对你的感谢,因为你的善意和有用的提示!在“sudo yum安装asterisk-odbc”之后,我想我可以“模块加载res_odbc.so”并且它可以在asterisk * CLI中执行“odbc show”。如果你不介意,可否请你留下你的电子邮件。我可能想问一下关于Mysql的星号。我的电子邮件是:[email protected]反正,非常感谢。我已经在这个问题上超过3周... –
感谢您的信任,接受和投票;但我认为你可能想在其他地方寻求帮助,以便实际获得ODBC或MySQL的工作。我自己实际上并没有这样做;我只是熟悉AsteriskNOW的结构。 – zigg