Kannel Sqlbox not working (trying to connect to SQL Server instead of MySQL)?

落花浮王杯 提交于 2019-12-10 00:08:34

问题


I have a Kannel up and running on an Ubuntu 16.04 box, with local MySQL DLR storage. I want to add sqlbox to queue the incoming SMS in the same database.

When I try to launch the sqlbox sqlbox.conf, here is what I get.

  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]

Here are the two config files 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"

and 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

What is the trick ? Thank you

Using: kannel 1.4.4-2build1 and kannel-sqlbox 0.7.2-4build1 both installed via apt.


回答1:


Problem

The main problem as depicted in the log is there:

2017-08-03 14:02:21 [55982] [0] PANIC: SQLBOX: MSSql: connection settings for id 'sqlbox-db' are not specified!

In fact, there is a problem in the version that you are using (apt-get packages are old versions that you can't use there), I got the same problem at the beginning of the year.

Here is how I made it work.


Solution

Step 1 - Uninstall all your previous Kannel packages, clean everything

If you already installed Kannel with apt-get packages, you have to clean your machine first.

Here are some clues to find the items that you have to remove. I first checked every place where "kannel" was found:

sudo find / -name "*kannel*"
sudo find / -name "*Kannel*"

Then I ran the following commands (some of them may not be useful for you, depending on your settings, etc):

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

And also sudo rm -rf /usr/local/sbin/ (but be careful here, depending on what you already have in the folder!)


Step 2 - Install latest Kannel version from the source

Note: you will have to use version 1.5.0

Get dependencies

First add all the packages that you need for the future commands:

  • sudo apt-get install libxml2-dev (needed for step ./configure, or you will get "configure: error: You MUST have the libxml2 (aka gnome-xml) library installed")

  • sudo apt-get install libmysqlclient-dev (needed for ./configure --with-mysql)

  • sudo apt-get install bison (needed for make)

  • sudo apt-get install libssh-dev libssl-dev (needed for make to avoid getting this error: "collect2: error: ld returned 1 exit status make: *** [test/test_http] Error 1 ")

Get Kannel sources

You will have to get the sources from a svn repository. So:

  • sudo apt install subversion if you don't have subversion yet (you can check by running svn --version: if no reply, use the command)

Then:

  • Go to the folder that will host the sources locally. For example on m side: cd ~/www-dev/nicopushkannel/Kannel/Kannel-Source

  • Get Kannel sources from the repository: svn co https://svn.kannel.org/gateway/trunk

Build and install Kannel

From the previous step you should be on Kannel sources root foolder. As described in Kannel documentation, run:

cd trunk
./bootstrap
./configure --with-mysql --with-mysql-dir=/var/lib/mysql
make

Here the important things are the parameters added to ./configure: --with-mysql --with-mysql-dir=/var/lib/mysql

Then install:

sudo make bindir=/usr/local/kannel install

Run Kannel

Once this has been done, you can try to run Kannel from command line:

cd /usr/local/sbin
./bearerbox -v 0 /etc/kannel/kannel.conf

Step 3 - Install latest Kannel-sqlbox version from the source

Note: You need to have Kannel installed (step 2) to compile sqlbox.

sqlbox is included in Kannel trunk: navigate to the folder:

cd addons/sqlbox

Patch bootstrap file

You may have to patch the bootstrap file to match your autoconf version (was 1.15 for me), as the code don't understand that 1.15 is > than 1.11...

Change the following value to match your machine version of autoconf:

if automake-1.11 --version >/dev/null 2>&1; then
  amvers="-1.11"

So for me it became:

if automake-1.15 --version >/dev/null 2>&1; then
  amvers="-1.15"

Build and install sqlbox

./bootstrap
./configure
make
sudo make install

We are done!

One more thing: if you want to add Sqlbox startup at Kannel startup:

sudo gedit /etc/default/kannel
Add "START_SQLBOX=1" line at the end


来源:https://stackoverflow.com/questions/45486238/kannel-sqlbox-not-working-trying-to-connect-to-sql-server-instead-of-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!