Database Connection Problems

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Install devel packages)
(Install devel packages)
 
Line 111: Line 111:
 
* [[PostgreSQL|Using PostgreSQL database in Yate]]
 
* [[PostgreSQL|Using PostgreSQL database in Yate]]
 
* [[MySQL|Using MySQL database in Yate]]
 
* [[MySQL|Using MySQL database in Yate]]
 +
 +
[[Category:Database]] [[Category:Debug]]

Latest revision as of 10:36, 4 November 2013

Follow this article to find what you should do if you suspect that yate's database connection is not opened.
The examples in this article are for Postgresql, but the steps are the same when debugging Mysql issue.

Contents

[edit] Check your setup

[edit] register.conf

Your register.conf should include a reference to the database connection you are going to use (account=yateadmin).

[default]
; This section holds default settings for each of the following message handlers
; All these settings can be overriden in individual handler sections

; priority: int: Priority in Yate's handlers chain
priority=10

; account: string: Name of the database connection to use
account=yateadmin

[edit] pgsqldb.conf

Your pgsqldb.conf should provide the actual login data for this account (using the accountname as title).

[yateadmin]
host=localhost
database=yateadmin
user=postgres
password=secret
port=5432

[edit] yate.conf

Also, in your yate.conf these modules should be enabled by hand, if you set modload=disable

 [modules]
; This section should hold one line for each module whose loading behaviour
;  is to be changed from the default specified by modload= in section [general]
; Each line has to be of the form:
;   modulename.yate=boolean
; Note that modules can be located only in the module directory so no path
;  information should be specified

pgsqldb.yate=true
register.yate=true

[edit] Using message sniffer

If you've come so far and still have no database connection, it's time to turn on the message sniffer.

[edit] Using message sniffer from rmanager

Type in console: telnet localhost 5038 and enter status. If

name=pgsqldb,type=database;conns=1

is not listed, you might as well assume, that the DB module is not working properly. If you're sure about the setup, you probably did not compile in DB support, see below.

Of course, I'm assuming you're restarting YATE from scratch each time you're testing!

[edit] Enable message sniffer in yate.conf

In yate.conf:

; msgsniff: bool: Activate message sniffer module (if loaded) at engine init time
msgsniff=enable
 
[modules]
msgsniff.yate=true
  • start YATE in very verbose mode (I actually don't know how many v's yate will take so I give it lots :-)
yate -vvvvvvvvvvv

[edit] Verify messages

  • copy the output to a text editor of your choice and look for messages similar to the one below:
Sniffed 'database' time=1198763820.022221
  thread=0x80a1940 'EnginePrivate'
  data=(nil)
  retval='(null)'
  param['account'] = 'yateadmin'
  param['query'] = 'UPDATE cdr SET ended=true WHERE ended IS NULL OR NOT ended'
  param['results'] = 'false'
Returned false 'database' delay=0.003901

The last line may indicate, that you do not have database support compiled in!

[edit] Install devel packages

Solution:

  • on Debian, install the development packages for the appropriate database (for other Linuxes ask your local Guru)
apt-get install postgresql-dev

If you are not using a Debian based system use the command appropriate for you operating system to install development packages for postgresql/mysql.

  • After that, recompile YATE. It won't overwrite your config files, but it's a good idea to back them up just in case.
./configure
make
make install

Now you should get the following with message sniffer on:

Sniffed 'database' time=1198764342.030883
  thread=0x80acae0 'EnginePrivate'
  data=(nil)
  retval='(null)'
  param['account'] = 'yateadmin'
  param['query'] = 'UPDATE lines SET inuse=0'
  param['results'] = 'false'
<pgsqldb:ALL> Performing query "UPDATE lines SET inuse=0" for 'yateadmin'
<pgsqldb:ALL> Query for 'yateadmin' returned 0 rows, 2 affected
Returned true 'database' delay=0.014249

Good luck. If you find other solutions, please include them here for others.

See also

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers