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

那年仲夏 提交于 2019-12-04 18:14:45

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