<html>Dear all,<br /><br />I don't belive to connect Kamailio to a remote Mariadb will take too much time.<br /><br /><br />STEP 1 : KAMAILIO :<br />--------------------------------<blockquote><p>$ sudo kamailio -v<br />version: kamailio 5.5.4 (x86_64/linux)<br />flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED<br />ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br />poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br />id: unknown<br />compiled with gcc 10.2.1</p></blockquote><br />STEP 2 : Set the kamctlrc config<br />------------------------------------------------<br /><br />KAMAILIO IP : 192.168.1.41<br />MARIADB IP : 192.168.1.39<br /><br />- /etc/kamailio/kamctlrc<blockquote><p>SIP_DOMAIN=example.be<br />DBENGINE=MYSQL<br />DBHOST=192.168.1.39 // where the mariadb is installed<br />DBNAME=kamailio<br />DBRWUSER="kamailio"<br />DBRWPW="XX"<br />DBROUSER="kamailioro"<br />DBROPW="XX"<br />DBACCESSHOST=192.168.1.41 // where kamctl is launched (here kamailio srv)<br />DBROOTUSER="root"<br />DBROOTPW="kamailio"<br />CHARSET="latin1"</p></blockquote><br />STEP 3 : MARIADB : hosted on different srv than kamailio<br />--------------------------------------------------------------------------------------<br /><br />IP : 192.168.1.39<br /><br />- /etc/mysql/mariadb.conf.d/50-server.cnf<blockquote><p># this is only for the mysqld standalone daemon<br />[mysqld]<br /><br /># Instead of skip-networking the default is now to listen only on<br /># localhost which is more compatible and is not less secure.<br />#bind-address            = 127.0.0.1<br />bind-address            = 0.0.0.0</p></blockquote><br /><br />STEP 4 : TEST : Reote connection with the DB<br />----------------------------------------------------------------------<br /><br />REMOTE IP : 192.168.1.41<br />DB IP : 192.168.1.39<br /> <blockquote><p><br />$ sudo mysql -u root -h 192.168.1.39 -p<br />Enter password:<br />Welcome to the MariaDB monitor.  Commands end with ; or \g.<br />Your MariaDB connection id is 298<br />Server version: 10.5.15-MariaDB-1:10.5.15+maria~bullseye mariadb.org binary distribution<br /><br />Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<br /><br />Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.<br /><br />MariaDB [(none)]></p></blockquote>The connection is established with success.<br /><br /><br />STEP 5 : KAMAILIO DB : creation<br />----------------------------------------------------<blockquote><p>$ sudo kamdbctl create<br />-e \E[37;33mINFO: creating database kamailio ...<br />-e \E[37;33mINFO: granting privileges to database kamailio ...<br />-e \E[37;33mINFO: creating standard tables into kamailio ...<br />-e \E[37;33mINFO: Core Kamailio tables successfully created.<br />Create the presence related tables? (y/n): y<br />-e \E[37;33mINFO: creating presence tables into kamailio ...<br />-e \E[37;33mINFO: Presence tables successfully created.<br />Create the tables for imc cpl siptrace domainpolicy carrierroute<br />                drouting userblocklist htable purple uac pipelimit mtree sca mohqueue<br />                rtpproxy rtpengine secfilter? (y/n): y<br />-e \E[37;33mINFO: creating extra tables into kamailio ...<br />-e \E[37;33mINFO: Extra tables successfully created.<br />Create the tables for uid_auth_db uid_avp_db uid_domain uid_gflags<br />                uid_uri_db? (y/n): y<br />-e \E[37;33mINFO: creating uid tables into kamailio ...<br />-e \E[37;33mINFO: UID tables successfully created.</p></blockquote><br />STEP 6 : DB : verify the users creation and rights<br />--------------------------------------------------------------------------<blockquote><p>MariaDB [(none)]> select user, host from mysql.user;<br />+-------------+--------------+<br />| User        | Host         |<br />+-------------+--------------+<br />| kamailio    | 192.168.1.39 |<br />| kamailioro  | 192.168.1.39 |<br />| kamailio    | 192.168.1.41 |<br />| kamailioro  | 192.168.1.41 |<br />| root        | 192.168.1.41 |<br />| kamailio    | localhost    |<br />| kamailioro  | localhost    |<br />| mariadb.sys | localhost    |<br />| mysql       | localhost    |<br />| root        | localhost    |<br />+-------------+--------------+<br />10 rows in set (0.001 sec)<br /><br />MariaDB [(none)]> SHOW GRANTS FOR kamailio@192.168.1.41;<br />+--------------------------------------------------------------------------------------------------------------------+<br />| Grants for kamailio@192.168.1.41                                                                                   |<br />+--------------------------------------------------------------------------------------------------------------------+<br />| GRANT USAGE ON *.* TO `kamailio`@`192.168.1.41` IDENTIFIED BY PASSWORD '*157PASSWORD' |<br />| GRANT ALL PRIVILEGES ON `kamailio`.* TO `kamailio`@`192.168.1.41`                                                  |<br />+--------------------------------------------------------------------------------------------------------------------+<br />2 rows in set (0.000 sec)<br /><br />MariaDB [(none)]> SHOW GRANTS FOR kamailio@192.168.1.39;<br />+--------------------------------------------------------------------------------------------------------------------+<br />| Grants for kamailio@192.168.1.39                                                                                   |<br />+--------------------------------------------------------------------------------------------------------------------+<br />| GRANT USAGE ON *.* TO `kamailio`@`192.168.1.39` IDENTIFIED BY PASSWORD '*157PASSWORD' |<br />| GRANT ALL PRIVILEGES ON `kamailio`.* TO `kamailio`@`192.168.1.39`                                                  |<br />+--------------------------------------------------------------------------------------------------------------------+<br />2 rows in set (0.000 sec)<br /><br />MariaDB [(none)]> SHOW GRANTS FOR kamailio@localhost;<br />+-----------------------------------------------------------------------------------------------------------------+<br />| Grants for kamailio@localhost                                                                                   |<br />+-----------------------------------------------------------------------------------------------------------------+<br />| GRANT USAGE ON *.* TO `kamailio`@`localhost` IDENTIFIED BY PASSWORD '*157PASSWORD' |<br />| GRANT ALL PRIVILEGES ON `kamailio`.* TO `kamailio`@`localhost`                                                  |<br />+-----------------------------------------------------------------------------------------------------------------+<br />2 rows in set (0.000 sec)</p></blockquote>STEP 7 : ADDRESS TABLE : add new ip address<blockquote>$ sudo systemctl restart kamailio<br />sipsecure@kamailio:/etc$ sudo kamctl address add 0 192.168.1.26 32 0 HP<br />-e \E[37;33mINFO: execute '/sbin/kamctl address reload' to synchronize cache and database<p> </p></blockquote><br />STEP 8 : DB : verify if the new ip address is created ? Yes<blockquote><p>MariaDB [(none)]> select * from kamailio.address;<br />+----+-----+--------------+------+------+------+<br />| id | grp | ip_addr      | mask | port | tag  |<br />+----+-----+--------------+------+------+------+<br />|  1 |   0 | 192.168.1.26 |   32 |    0 | HP   |<br />+----+-----+--------------+------+------+------+<br />1 row in set (0.000 sec)</p></blockquote><br />STEP 9 : Reload the content of the DB into kamailio. It failed<br />----------------------------------------------------------------------------------------<br /><br />The host: '192.168.1.41' is kamailio (remote client)<blockquote>$ sudo kamctl address reload<br />{<br />  "jsonrpc":  "2.0",<br />  "error":  {<br />    "code": 500,<br />    "message":  "Reload failed."<br />  },<br />  "id": 12397<br />}<p> </p></blockquote>In /var/log/daemon.log<blockquote><p>Mar 28 17:09:49 db04srv mariadbd[2430]: 2022-03-28 17:09:49 281 [Warning] Aborted connection 281 to db: 'kamailio' user: 'kamailio' host: '192.168.1.41' (Got an error reading communication packets)<br />Mar 28 17:09:49 db04srv mariadbd[2430]: 2022-03-28 17:09:49 273 [Warning] Aborted connection 273 to db: 'kamailio' user: 'kamailio' host: '192.168.1.41' (Got an error reading communication packets)<br />Mar 28 17:09:49 db04srv mariadbd[2430]: 2022-03-28 17:09:49 295 [Warning] Aborted connection 295 to db: 'kamailio' user: 'kamailio' host: '192.168.1.41' (Got an error reading communication packets)<br />Mar 28 17:09:49 db04srv mariadbd[2430]: 2022-03-28 17:09:49 264 [Warning] Aborted connection 264 to db: 'kamailio' user: 'kamailio' host: '192.168.1.41' (Got an error reading communication packets)</p></blockquote><br />Now, if I am trying to restart "kamailio" service, I got an error :<blockquote><p>Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: DEBUG: <core> [core/sr_module.c:940]: init_mod(): permissions<br />Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: DEBUG: permissions [address.c:179]: reload_address_db_table(): Number of rows in address table: 1<br />Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: DEBUG: permissions [address.c:191]: reload_address_db_table(): failure during checks of database value 1 (group) in address table<br />Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: ERROR: permissions [address.c:233]: reload_address_db_table(): database problem - invalid record<br />Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: CRITICAL: permissions [address.c:536]: init_addresses(): reload of address table failed<br />Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: ERROR: permissions [permissions.c:657]: mod_init(): failed to initialize the allow_address function<br />Mar 28 17:36:30 kamailio /usr/sbin/kamailio[14196]: ERROR: <core> [core/sr_module.c:942]: init_mod(): Error while initializing module permissions (/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so)<br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/cfg.y:1860]: yyparse(): loading module permissions.so<br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/sr_module.c:513]: ksr_locate_module(): found module to load </usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so><br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/sr_module.c:563]: load_module(): trying to load </usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so><br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/kemi.c:3090]: sr_kemi_modules_add(): adding module: permissions<br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/cfg.lex:1963]: pp_define(): defining id: MOD_permissions<br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/modparam.c:112]: set_mod_param_regex(): 'permissions' matches module 'permissions'<br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/sr_module.c:811]: find_param_export(): found <db_url> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]<br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/modparam.c:128]: set_mod_param_regex(): found <db_url> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]<br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/modparam.c:112]: set_mod_param_regex(): 'permissions' matches module 'permissions'<br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/sr_module.c:811]: find_param_export(): found <load_backends> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]<br />Mar 28 17:36:30 kamailio kamailio: DEBUG: <core> [core/modparam.c:128]: set_mod_param_regex(): found <load_backends> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]<br />Mar 28 17:36:31 kamailio kamailio: DEBUG: <core> [core/sr_module.c:719]: find_mod_export_record(): found export of <allow_source_address> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so]<br />Mar 28 17:36:31 kamailio kamailio: DEBUG: <core> [core/sr_module.c:719]: find_mod_export_record(): found export of <allow_source_address_group> in module permissions [/usr/lib/x86_64-linux-gnu/kamailio/modules/permissions.so</p></blockquote>If I remove the record from the database manually, I can restart kamailio but no way to add any address.<br /><br />Thanks if someone could highlight my path.<br /><br />Best Regards,<br /><br />--<br /><span style="font-size:11pt"><span style="font-family:Calibri, sans-serif"><b><span style="font-size:10.0pt" lang="EN-US"><span style="font-family:"Verdana",sans-serif"><span style="color:#1f497d">Youssef </span></span></span></b></span></span></html>