添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
爱玩的黑框眼镜  ·  External website ...·  1 月前    · 
激动的熊猫  ·  Frequent MQTT ...·  1 月前    · 
重情义的青椒  ·  Synergy Netx duo MQTT ...·  1 月前    · 
近视的金鱼  ·  [Solved] [MQTT] ...·  1 月前    · 
乐观的火锅  ·  VS 2012 TCP server ...·  1 月前    · 
强悍的创口贴  ·  使用 Java 管理 Blob ...·  1 月前    · 
直爽的风衣  ·  Koolshare ...·  4 月前    · 
重感情的桔子  ·  KeycloakのJWTをVerifyする·  1 年前    · 

Hello my friends,

I would like to ask for help regarding my Asterisk setup.
Any help is highly appreciated.

I installed Asterisk 18.2.2 LTS, everything is okay including the database that I built through the script and even so Asterisk don’t connect to MariaDB database through the mariadb connector odbc.
I tested if the connector is working using

isql -v asterisk-connector mydatabase-user  password

It connected successfully but in asterisk I still can’t connect and I get this error message:

[Mar 13 00:02:17] ERROR[3462]: res_config_odbc.c:200 realtime_odbc: No database handle available with the name of 'asterisk' (check res_odbc.conf)
[Mar 13 00:02:17] WARNING[3462]: res_odbc.c:1067 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=2002 [unixODBC][ma-3.1.11]Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock'

I have reviewed the configurations 100 times and for 2 days I was looking for similar issues but I couldn’t solve it.

from the error it says check res_odbc.conf and here is the content of it:

[asterisk]
enabled => yes
dsn => asterisk
username => xxxxxxxx
password => xxxxxxxx
pre-connect => yes

xxxxxxxx indicating the username and the password I set in the /etc/odbc.ini in [asterisk] block like this

[asterisk]
Description = MySQL connection to 'asterisk' database
Driver = /usr/local/lib64/mariadb/libmaodbc.so
Database = asterisk-database
Username = xxxxxxxx
Password = xxxxxxxx
Server = localhost
Port = 3306
Socket = /run/mysqld/mysqld.sock

The content of /etc/odbcinst.in is the same as /etc/odbc.ini

I set a rule here also for letting asterisk create socket at runtime /etc/tmpfiles.d/asterisk.conf
like that

/var/run/asterisk 0775 asterisk asterisk

Some other information about my environment:
MariaDB 10.3.25 database server
MariaDB Connector ODBC 3.1.11
OS Ubuntu server 20.04 - AWS

I need to mention that I set a profile for asterisk through apparmor as well, it run in complain mode.

Permission of files should be okay since I’ve reviewed them several times, but if you have any concern about that also then let me know.

Also I get hundreds of messages on the CLI even I can’t use it, some of them are a tries to make calls through endpoints from different IPs, Do you think any message here indicates something unusual?:

[Mar 13 00:02:16] NOTICE[3462]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'INVITE' from '<sip:1001@myserver_ip>' failed for 'xxxxxxxxxxxx:60285' (callid: 56578576563-839278996-24337578) - No matching endpoint found
[Mar 13 00:02:16] NOTICE[3462]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'INVITE' from '<sip:1001@myserver_ip>' failed for 'xxxxxxxxxxxx:60285' (callid: 566345643-8392656-244983400) - Failed to authenticate

Any help is highly appreciated.

Regards

UPDATE**

I have solved the issue.

For others who might face the same problem, I have solved it by removing the socket line in /etc/odbc.ini in

Socket = /run/mysqld/mysqld.sock

Also, replaced localhost with the IP address to connect through it. I used localhost IP 127.0.0.1

Server = 127.0.0.1

Don’t forget to reboot your machine,

I would like to mention this post as a reference as well
Reference post

Thanks to erichowey

Everything worked fine for now.

Thanks