mysql - ODBC连接错误:No such command "odbc show" ODBC connection fail in asterisk*CLI

标签 mysql linux odbc voip asterisk

问题:我正在使用 AsteriskNow,它在 VirtualBox 中运行 asterisk 2.0 服务器。我想使用 ODBC 模块将 Asterisk 与 MySQL 数据库连接。但它失败了。当我使用 asterisk*CLI> odbc show 开始时,命令提示符显示“No such command ODBC SHOW”

我的目标:在asterisk中配置ODBC以从Asterisk的拨号计划直接动态地访问MySQL。

我做了什么:我在 VirtualBox 中安装了 AsteriskNow。 asterisk的版本是2.0,CentOS版本是5.8 Final。我首先通过

安装了相关的Linux RPM
yum -y install unixODBC-devel
yum -y install libdbi-dbd-mysql
yum -y install mysql-connector-odbc

我的详细配置文件如下:

/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数据库时,它工作正常 enter image description here

但是当我在 CLI 中启动控制台时,输入命令 odbc show 。它显示没有这样的命令“odbc show”

enter image description here

我在这里很困惑,不知道如何解决。我用谷歌搜索了一下,发现有人建议通过加载 res_odbc.so 模块来解决这个问题。因此我浏览了文件modules.conf并将这些修改添加到文件中

autoload=yes
preload => res_odbc.so
preload => res_config_odbc.so

修改后完整文件如下" /etc/asterisk/modules

;
; 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 

完成此操作后,我返回 CLI 控制台重新加载 res_odbc.so。但未能找到res_odbc.so enter image description here

我需要有人给我解决 ODBC 连接问题的提示。

最佳答案

尝试执行以下操作:

asterisk -rvvv
module unload res_odbc.so
module load res_odbc.so

并查看输出。

关于mysql - ODBC连接错误:No such command "odbc show" ODBC connection fail in asterisk*CLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12681048/

相关文章:

mysql - 在 Mysql 条目中查找模式

python - 使用migrate命令创建数据库表时出错

r - 在 Debian 服务器 (linux-gnu) 上将 R 版本 2.15.1 升级到 3.3

linux - 如何在Linux/Unix中实现GetThreadContext?

php - exec ('script.ps1' ) 返回错误,cmd> script.ps1 运行成功

c# - 允许通过 C# 访问安装在 Amazon EC2 上的 MySQL 服务器

java - 如何在不返回结果集的spring boot中执行存储过程?

linux - 为什么 Apache 不允许从 index.html 中访问 Web 根目录之外的文件?

带有远程数据库的 Ruby ODBC

C++项目在VS2008中可以运行,但在VS2010中不行