Asterisk 13.13 with PJSIP on Realtime

Hi,

When I using static my configuration is working perfectly but when I am changing it to realtime with mysql db somehow it is not showing >pjsip show endpoints

Below is my configuration:

sorcery file:
[res_pjsip]
endpoint=realtime,ps_endpoints
;endpoint=config,pjsip.conf,criteria=type=endpoint
auth=realtime,ps_auths
aor=realtime,ps_aors
domain_alias=realtime,ps_domain_aliases
contact=realtime,ps_contacts

[res_pjsip_endpoint_identifier_ip]
identify=realtime,ps_endpoint_id_ips

extconfig file
[settings]
ps_endpoints => odbc,asterisk
ps_auths => odbc,asterisk
ps_aors => odbc,asterisk
ps_domain_aliases => odbc,asterisk
ps_endpoint_id_ips => odbc,asterisk
ps_contacts => odbc,asterisk

For tables I have used alembic and tables created succesfully

When I am trying to register it is not registering and giving me the error

[Sep 13 06:13:06] NOTICE[61437]: res_pjsip/pjsip_distributor.c:508 log_failed_request: Request ‘REGISTER’ from ‘sip:101@192.168.2.116’ failed for ‘192.168.2.214:61945’ (callid: 4d133de913a845d7a86dfda1b7d9b007) - No matching endpoint found

What else I have missed the point ? Please suggest

Have you checked the console output to see if there’s anything of note? Is ODBC also configured on the system? How does your setup compare to the wiki[1]?

[1] https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime

ODBC showing

localhost*CLI> odbc show all

ODBC DSN Settings

Name: asterisk
DSN: asterisk
Last connection attempt: 2017-09-13 06:04:34
Number of active connections: 0 (out of 1)

==================

And yes I have only followed the wiki[1]
[1] Home - Asterisk Documentation

=================

Console shows the above error on my first post while registering and when I run a command
localhost*CLI> pjsip show endpoints
No object specified.

Anything else I can check for?

Your ODBC does not appear to be connecting. This is usually because it is not configured properly. I don’t have much experience in that area, but that’s where you should focus your efforts.

Thank you so much as I was using centos 6.9 and my ODBC was 5.3 so I downgraded to 5.1 and now it shows

ODBC DSN Settings

Name: asterisk
DSN: asterisk
Last connection attempt: 1969-12-31 16:00:00
Number of active connections: 1 (out of 1)

Thanks once again

But the sad part is still it is not registering and showing no objects
localhost*CLI> pjsip show endpoints
No object specified.

But the sad part is still it is not registering and showing no objects
localhost*CLI> pjsip show endpoints
No object specified.

@jcolp can you please suggest anything else as I have checked everything but still no luck

I don’t use ODBC so I’d suggest trying to narrow things down further. Compare again your configuration between the wiki (which is known to work) and yours. Turn on debug in logger.conf and use core set debug 9 to see if ODBC is being queried for things.

Hi @jcolp
Thanks…after correcting ODBC issue what you suggested I ran module unload and load chan pjsip and it is working fine now and showing

localhost*CLI> pjsip show endpoints
Endpoint: 101 Unavailable 0 of inf
InAuth: 101/101
Aor: 101 1
Transport: transport-udp udp 0 0 0.0.0.0:5060

Once again thanks… :slight_smile:

Hi,
Kindly share the troubleshooting steps to help poor souls like us.

I don’t have troubleshooting steps. The log messages in debug generally tell what is happening in a bit of detail, based on what is there you can determine what is going on.

Hi,
Kindly share the troubleshooting steps,i have done everything possible i can and even recompiled asterisk 2 times but all in vain. I am still getting the error as:

[Oct 17 06:11:26] WARNING[3620]: res_odbc.c:946 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified

In addition:
odbc show

ODBC DSN Settings

Name: asterisk
DSN: asterisk
Last fail connection attempt: 2019-10-17 06:23:56
Number of active connections: 0 (out of 200)

Despite having everything fine to my limited knowledge like /etc/odbcinst.ini, /etc/odbc.ini, /etc/asterisk/res_odbc.conf

Can you please put the file content too?

/etc/asterisk/res_odbc.conf

[ENV]
;INFORMIXSERVER => my_special_database
;INFORMIXDIR => /opt/informix
;ORACLE_HOME => /home/oracle
ODBCSYSINI => /usr/local/etc
ODBCINI => /usr/local/etc/odbc.ini
[asterisk]
enabled => yes
dsn => asterisk
username => root
password => Pelsoft@123
pre-connect => yes
sanitysql => select 1
max_connections => 200

“/etc/odbcinst.ini”

[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbc.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbc.so
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1

[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc5.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1

[MySQL ODBC 5.3 Unicode Driver]
Driver = /usr/lib64/libmyodbc5w.so
UsageCount = 1

[MySQL ODBC 5.3 ANSI Driver]
Driver = /usr/lib64/libmyodbc5a.so
UsageCount = 1

~
“/etc/odbc.ini”

[asterisk-connector]
Description = MySQL connection to ‘asterisk’ database
Driver = MySQL
Database = asterisk
Server = localhost
Port = 3306
Socket = /var/lib/mysql/mysql.sock

Take a look at the following wiki pages if you have not already:

https://wiki.asterisk.org/wiki/display/AST/Getting+Asterisk+Connected+to+MySQL+via+ODBC
https://wiki.asterisk.org/wiki/display/AST/Configuring+res_odbc

If you follow those it should result in a working setup.You’ll want to test to make sure you have a working connection outside of Asterisk. The wiki will tell you how to do that, as well as other debugging steps.

Looking at your configuration though a couple things might be causing your problem. First it looks like you have a couple of environment variables set telling where to find the odbc configuration. Those appear to point to another location for the files than the one you showed:

/usr/local/etc/ vs /etc

Second in your res_odbc.conf file you have the following:

dsn => asterisk

But based on your odbc.ini configuration I believe it should be (the odbc section name):

dsn => asterisk-connector

Hi ,
Thanks for the response,the files /usr/local/etc/ vs /etc are different as in my system ODBCDataSources got stored in /usr/local/etc and i got it fixed by pointing to this location. I got the pointer from your reply,let me see. Thanks anyway.

Hi ,
Your pointer did help me to pull the correct DSN,that was an error. Also,a minor name change in .so file replaced with 64 bit was libmyodbc5a.so.It now picks up the correct DSN.
Now ODBC DSN Settings

Name: asterisk
DSN: asterisk
Number of active connections: 1 (out of 200)