I need help: CDRDB to external MySQL on Debian 11

Hello everyone
I need to switch over to a new hardware. The old installation was made by a friend and has Asterisk 1.6 and an external CDR DB (on the same hardware) based on MySQL.
I need to replicate that with Asterisk 18, but I’m having troubles in getting everything working.
The new hardware is a Debian 11 VM. MySQL and MariaDB already installed and configured (they are used by other services too). Every time I try to follow a guide about how to setup everything properly, I find a problem. ODBC modules not avaiable, ODBC config not well explained, etc etc.
Could please someone point me in the right direction to have everything set up properly?
Or could someone tell me if the internal MySQL module is still compilable in Asterisk 18 (to bypass ODBC)?
Thank you

The nice thing with ODBC is that it is self-explaining and self-installing. Just kidding; have a look at this: Installing and Configuring ODBC

The MySQL driver has been without support for many years, since hardly anybody actually used it. There is no alternative to ODBC. If you run into a problem, post the details. Nobody will be able to help you, if you only complain.

Ok thank you
So I can install Asterisk from the official Debian repo and then follow the guide you linked me or should I compile it from source?
Thank you

The problem with the package managers is that you don’t know how the package was assembled and what has actually been tested. I think the worst problem is, that there are are usually some unwanted dependencies on outdated support libraries, i.e. you’d need to know more that would have be required if you had started from the sources in the first place.

Forget the repo.

Ok. Thank you.
Do you have advices about the optional configuration to select when building it from source? Anything about the odbc connection maybe? Or everything is included by default? Thank you.

No, I don’t. Doesn’t make any sense either. Asterisk is basically a workshop that allows to build servers that have something to do with telephony and I don’t know what you are trying to do. Contrary to what the Liverpool F.C. anthem suggests, here you are walking alone.

So odbc is included by default or it has to be selected in the config menu?

Sort of. If you have installed the required libs and their headers, it is selected automatically.

Ok so if i follow the guide and install all the odbc packages and then I build Asterisk, the asterisk ODBC modules should have been selected automatically, if I’ve understood well. Right?

Indeed.

sudo apt-get install libmyodbc
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libmyodbc is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libmyodbc' has no installation candidate

Maybe the package is “libodbc1”? I’m on debian 11 bullseye
Thank you

Your questions are not Asterisk related. You need to get familiar with Linux and with what is required to link against this or some other package. Getting familiar with the Asterisk build system is also not a bad idea. This is simply the wrong place to ask these basic questions. That said, Asterisk has some scripts in the contrib folder that help installing the required packages.

You pointed me to that asterisk guide that is probably outdated as the package required isn’t available anymore in newer distros. That’s why I’m asking there.

Please have a look at the docs before you post. The helper script is correct in this case. libodbc1 will also not solve your problem.

Before you build the asterisk, did you installed the unixodbc, unixodbc-dev and odbcinst by apt? If you did, then run “make menuselect” in your source code folder, check out whether the res_odbc is activated (* symbol before it) . After that, you should install the MySQL official repository:
https://dev.mysql.com/downloads/repo/apt/
After you install it, run apt update. Then you can install libmyodbc by installing mysql-connector-odbc package. ( All of these based on x86_64, if you computer is aarch64 (Apple M1&M2 like me) , then you need download the source code to build the connector by yourself. In this condition i recommanded you use MariaDB rather than MySQL. )