Debido a una de las migraciones de servidores de un proxmox a otro, me he encontrado que la vieja debian 8 donde tenía instalado el servidor de telefonía, no arrancaba, así que he instalado asterisk en una debian 10, dentro de un contenedor lxc y con nesting activado.
Lo primero de todo será instalar asterisk
root@asterisk:~# cd /usr/src/ root@asterisk:/usr/src# wget http://downloads.asterisk.org/pub/telephony/certified-asterisk/asterisk-certified-16.8-current.tar.gz root@asterisk:/usr/src# tar xvzf asterisk-certified-16.8-current.tar.gz root@asterisk:/usr/src# cd asterisk-certified-16.8-cert3/contrib/scripts root@asterisk:/usr/src/asterisk-certified-16.8-cert3/contrib/scripts# ./install_prereq root@asterisk:/usr/src/asterisk-certified-16.8-cert3/contrib/scripts# ./get_mp3_source.sh root@asterisk:/usr/src/asterisk-certified-16.8-cert3/contrib/scripts# cd ../../ root@asterisk:/usr/src/asterisk-certified-16.8-cert3# ./configure root@asterisk:/usr/src/asterisk-certified-16.8-cert3# make menuselect root@asterisk:/usr/src/asterisk-certified-16.8-cert3# make root@asterisk:/usr/src/asterisk-certified-16.8-cert3# make install root@asterisk:/usr/src/asterisk-certified-16.8-cert3# make config root@asterisk:/usr/src/asterisk-certified-16.8-cert3# make samples
En el make menuselect activar chan_inunavailable, chan_sip, func_odbc
y con asterisk -vcccccccccccccc vemos como arranca asterisk y los errores
[Jul 21 00:14:03] WARNING[615]: res_odbc.c:1067 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
Para solucionar éste error, ahora configuraremos el odbc
root@asterisk:~# apt -y install unixodbc odbcinst
Ahora nos descargamos las librerías ya compiladas para debian buster
root@asterisk:~# wget https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.1.9/mariadb-connector-odbc-3.1.9-debian-buster-amd64.tar.gz root@asterisk:~# tar xvzf mariadb-connector-odbc-3.1.9-debian-buster-amd64.tar.gz root@asterisk:~# cd mariadb-connector-odbc-3.1.9-debian-buster-amd64 root@asterisk:~# cp lib/mariadb/lib*.so /usr/lib/x86_64-linux-gnu/odbc/
Ahora configuramos los ficheros odbc.ini y odbcinst.ini
root@asterisk:~# vi /etc/odbcinst.ini [MySQL] Description = ODBC para MySQL Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so FileUsage = 1
root@asterisk:~# vi /etc/odbc.ini [asterisk] Description = MySQL Asterisk Driver = MySQL Database = asterisk Server = localhost User = xxxxx Password = xxxxx Port = 3306 Option = 3 Socket=/var/run/mysqld/mysqld.sock [asterisk_users] Description = MySQL Asterisk Driver = MySQL Database = users Server = localhost User = xxxxx Password = xxxxx Port = 3306 Option = 3 Socket=/var/run/mysqld/mysqld.sock
Es importante definir el Socket ya que sino por defecto busca /tmp/mysql.sock
Ahora probamos que podemos conectar
root@asterisk:~# isql asterisk -v +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL> root@asterisk:~# isql asterisk_users -v +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL>
Ahora configuraremos los ficheros de asterisk (en res_config_mysql.conf especificamos la ruta del socket y en res_odbc.conf las bases de datos)
root@asterisk:/etc/asterisk# vi res_config_mysql.conf dbsock = /var/run/mysqld/mysqld.sock root@asterisk:/etc/asterisk# vi res_odbc.conf [ENV] [asterisk] enabled => yes dsn => asterisk username => xxxxx password => xxxxx pre-connect => yes sanitysql => select 1 idlecheck => 3600 [asterisk_users] enabled => yes dsn => asterisk_users username => xxxxx password => xxxxx pre-connect => yes sanitysql => select 1 idlecheck => 3600 ;share_connections => yes ;limit => 5 ;forcecommit => no ;isolation => repeatable_read ;backslash_is_escape => yes connect_timeout => 10 ;negative_connection_cache => 300
Y al iniciar asterisk de nuevo tendría que salir ésto:
[Jul 23 17:06:46] NOTICE[1777]: res_odbc.c:706 load_odbc_config: Registered ODBC class 'asterisk' dsn->[asterisk]
Muchas gracias!
Genial.
Muchas gracias por tu aportación!!!
Me ha servido de mucha ayuda