我在Ubuntu 16.04机器上运行Kannel
并使用本地MySQL DLR存储。我想添加sqlbox
以将传入的SMS排入同一数据库。
当我尝试启动sqlbox sqlbox.conf
时,这就是我得到的。
2017-08-03 14:02:21 [55982] [0] INFO: Starting to log to file /var/log/kannel/kannel-sqlbox.log level 0
2017-08-03 14:02:21 [55982] [0] INFO: Added logfile `/var/log/kannel/kannel-sqlbox.log' with level `0'.
2017-08-03 14:02:21 [55982] [0] PANIC: SQLBOX: MSSql: connection settings for id 'sqlbox-db' are not specified!
2017-08-03 14:02:21 [55982] [0] PANIC: sqlbox(gw_backtrace+0xce) [0x42d07e]
2017-08-03 14:02:21 [55982] [0] PANIC: sqlbox(gw_panic+0x16f) [0x42d1ff]
2017-08-03 14:02:21 [55982] [0] PANIC: sqlbox(sqlbox_init_mssql+0x11e) [0x40dffe]
2017-08-03 14:02:21 [55982] [0] PANIC: sqlbox(sqlbox_init_sql+0x9) [0x413239]
2017-08-03 14:02:21 [55982] [0] PANIC: sqlbox(main+0x31d) [0x40c24d]
2017-08-03 14:02:21 [55982] [0] PANIC: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fbb36421830]
2017-08-03 14:02:21 [55982] [0] PANIC: sqlbox(_start+0x29) [0x40c4d9]
以下是两个配置文件sqlbox.conf
:
group = sqlbox
id = sqlbox-db
smsbox-id = sqlbox-db
global-sender = "My Sender"
bearerbox-host = "192.168.1.2"
bearerbox-port = 14001
smsbox-port = 14005
#smsbox-port-ssl = false
sql-log-table = sent_sms
sql-insert-table = send_sms
log-file = "/var/log/kannel/kannel-sqlbox.log"
log-level = 0
group = mysql-connection
id = sqlbox-db
host = localhost
username = "user"
password = "pwd"
database = "kannel"
和kannel.conf
group = core
admin-port = 14000
admin-password = pwd
status-password = pwd
# admin-deny-ip = "*.*.*.*"
admin-allow-ip = 192.168.1.2
access-log = "/var/log/kannel/access/log"
log-file = "/var/log/kannel/kannel.log"
box-allow-ip = 192.168.1.2
log-level = 0
smsbox-port= 14001
dlr-storage = mysql
# SMSBOX SETUP
group = smsbox
smsbox-id = sqlbox-id
bearerbox-host = 192.168.1.2
sendsms-port = 14002
global-sender = My Sender
sendsms-chars = "0123456789 +-"
log-file = "/var/log/kannel/smsbox.log"
# SENDING SMS
group = sendsms-user
username = test
password = test
concatenation = true
max-messages = 1
# SMSC
#The sms part
# SQL BOX CONFIG
group = mysql-connection
id = sqlbox-db
host = localhost
username = user
password = pwd
database = kannel
# DLR SETUP
group = mysql-connection
id = mydlr
host = localhost
username = user
password = pwd
database = kannel
group = dlr-db
id = mydlr
table = dlr
field-smsc=smsc
field-timestamp=ts
field-destination=destination
field-source=source
field-service=service
field-url=url
field-mask=mask
field-status=status
field-boxc-id=boxc
诀窍是什么?谢谢
使用:
kannel 1.4.4-2build1
和kannel-sqlbox 0.7.2-4build1
都通过apt
安装。
答案 0 :(得分:2)
日志中描述的主要问题是:
2017-08-03 14:02:21 [55982] [0] PANIC: SQLBOX: MSSql: connection settings for id 'sqlbox-db' are not specified!
事实上,您使用的版本存在问题( apt-get软件包是您不能在那里使用的旧版本),我在开头时遇到了同样的问题这一年。
以下是我如何使其发挥作用。
如果您已经使用apt-get软件包安装了Kannel,则必须先清理机器。
以下是一些找到您必须删除的项目的线索。 我首先检查了找到“kannel”的每个地方:
sudo find / -name "*kannel*"
sudo find / -name "*Kannel*"
然后我运行了以下命令(其中一些可能对您没用,具体取决于您的设置等):
sudo apt-get autoremove --purge kannel
sudo rm -rf /etc/kannel/
sudo apt-get autoremove --purge kannel-sqlbox
sudo rm /var/cache/apt/archives/kannel-sqlbox_0.7.2-4build1_amd64.deb
sudo rm /var/cache/apt/archives/kannel-extras_1.4.4-2build1_amd64.deb
rm /home/nico/www-dev/kannelStore/kannel.store*
sudo rm -rf /usr/local/include/kannel
sudo rm -rf /usr/local/kannel
sudo rm -rf /usr/local/lib/kannel
rm /var/tmp/kannel.swp
sudo rm /usr/local/share/man/man8/kannel.8
sudo rm /usr/local/share/man/man8/run_kannel_box.8
还有sudo rm -rf /usr/local/sbin/
(但请注意,这取决于你在文件夹中已有的内容!)
注意:您必须使用1.5.0版
首先添加将来命令所需的所有软件包:
sudo apt-get install libxml2-dev
(步骤./configure
需要,或者您将获得“configure:error:您必须安装libxml2(aka gnome-xml)库”)
sudo apt-get install libmysqlclient-dev
(./configure --with-mysql
需要)
sudo apt-get install bison
(make
需要)
sudo apt-get install libssh-dev libssl-dev
(make
需要避免收到此错误:“collect2:error:ld返回1退出状态make:*** [test / test_http]错误1”)< / p>
您必须从svn存储库获取源代码。所以:
sudo apt install subversion
如果您还没有subversion(可以通过运行svn --version
来检查:如果没有回复,请使用命令)然后:
转到将在本地托管源的文件夹。例如,在m方面:cd ~/www-dev/nicopushkannel/Kannel/Kannel-Source
从存储库中获取Kannel源:svn co https://svn.kannel.org/gateway/trunk
从上一步开始,您应该使用Kannel源根目录。 如Kannel文档中所述,运行:
cd trunk
./bootstrap
./configure --with-mysql --with-mysql-dir=/var/lib/mysql
make
这里重要的是添加到./configure的参数:--with-mysql --with-mysql-dir=/var/lib/mysql
然后安装:
sudo make bindir=/usr/local/kannel install
完成此操作后,您可以尝试从命令行运行Kannel:
cd /usr/local/sbin
./bearerbox -v 0 /etc/kannel/kannel.conf
注意:您需要安装Kannel(步骤2)来编译sqlbox。
sqlbox包含在Kannel主干中:导航到文件夹:
cd addons/sqlbox
你可能需要修补bootstrap文件以匹配你的autoconf版本(对我来说是1.15),因为代码不明白1.15是&gt;比1.11 ......
更改以下值以匹配您的机器版autoconf:
if automake-1.11 --version >/dev/null 2>&1; then
amvers="-1.11"
所以对我来说它变成了:
if automake-1.15 --version >/dev/null 2>&1; then
amvers="-1.15"
./bootstrap
./configure
make
sudo make install
我们完成了!
还有一件事:如果你想在Kannel启动时添加Sqlbox启动:
sudo gedit /etc/default/kannel
Add "START_SQLBOX=1" line at the end