[Home]

Summary:ASTERISK-27357: PJSip endpoints lose AoRs when enabling ODBC
Reporter:Guilherme Bizzani (GuilhermeBiz)Labels:
Date Opened:2017-10-18 07:40:59Date Closed:
Priority:MajorRegression?
Status:Open/NewComponents:pjproject/pjsip Resources/res_odbc
Versions:13.11.2 15.0.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Debian GNU/Linux 8.9 (jessie). Firstly got the error on a Asterisk version 13.11.2.Attachments:( 0) info.txt
Description:This issue was basically found by following the tutorial on https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime using PostgreSQL for the database. My first approach to the error was on version 13.11.2 of Asterisk, then I tried with version 15 and get the same error.

After all the installation, configuration and population, when starting asterisk the "pjsip show endpoints" objects don't contain AoR, and "pjsip show aors" return "No objects found."
The only error i'm receiving back after these two commands is:
ERROR 3875: config_options.c:883 aco_set_defaults: Unable to set default for 101, qualify_timeout=3.0

Note: When I disable "res_odbc.conf" and configure any endpoint statically on "pjsip.conf" it does get the informations, register and make calls.

More info and config files used can be seen in my thread on Asterisk's forum: https://community.asterisk.org/t/possible-incompatibility-between-odbc-and-pjsip/72340
Comments:By: Asterisk Team (asteriskteam) 2017-10-18 07:41:00.423-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Guilherme Bizzani (GuilhermeBiz) 2017-10-19 12:19:42.014-0500

Had to change asterisk's source code, files res/res_pjsip/location.c lines 1145 and 1160 value of "qualify_timeout" was changed to "3" and type to OPT_UINT_T
and file res/res_pjsip.c lines 1154 and 1320 changed "qualify_timeout" default value to "3"
Also changed "qualify_timeout" column type in table ps_aors in my database to type integer.
(made this changes on a Asterisk 13.11.2, don't know if line numbers changed in other versions)

With these changes it's working, I don't know if the variable qualify_timeout is working as intended thou, but the endpoint get aors, can be registered and make calls just fine.

By: George Joseph (gjoseph) 2017-10-23 08:21:42.170-0500

Guilherme, Are you running on a 32 bit or 64 bit architecture?
Which compiler and version are you using?


By: Guilherme Bizzani (GuilhermeBiz) 2017-10-23 08:33:47.696-0500

64 bits Debian 8 - Jessie

root@debian8:~# dpkg -l | grep gcc
ii  gcc                                4:4.9.2-2                          amd64        GNU C compiler
ii  gcc-4.8                            4.8.4-1                            amd64        GNU C compiler
ii  gcc-4.8-base:amd64                 4.8.4-1                            amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-4.9                            4.9.2-10                           amd64        GNU C compiler
ii  gcc-4.9-base:amd64                 4.9.2-10                           amd64        GCC, the GNU Compiler Collection (base package)
ii  libgcc-4.8-dev:amd64               4.8.4-1                            amd64        GCC support library (development files)
ii  libgcc-4.9-dev:amd64               4.9.2-10                           amd64        GCC support library (development files)
ii  libgcc1:amd64                      1:4.9.2-10                         amd64        GCC support library
ii  linux-compiler-gcc-4.8-x86         3.16.43-2+deb8u2                   amd64        Compiler for Linux on x86 (meta-package)

Asterisk version: 13.11.2, but same error detected in 13.17 and 15.0.0

Alembic was installed via Python pip:
ii  python-pip                         1.5.6-5                            all          alternative Python package installer

root@debian8:~# pip list
[...]
alembic (0.9.6)
psycopg2 (2.7.3.1)
SQLAlchemy (1.1.14)

By: Kevin Harwell (kharwell) 2017-10-24 15:09:53.508-0500

Please attach all relevant configuration files (with .txt extension please) to the issue (I realize a lot of that information is contained in the provided link, but if for some reason that link is unreachable that data is lost).

What version of the database are you using? Also what are the exact sql statements you used to insert data into the database?

What's the table definition look like within your database? For instance here is mine:
{noformat}
asterisk=> \dS ps_aors;
                 Table "public.ps_aors"
       Column        |          Type          | Modifiers
----------------------+------------------------+-----------
id                   | character varying(40)  | not null
contact              | character varying(255) |
default_expiration   | integer                |
mailboxes            | character varying(80)  |
max_contacts         | integer                |
minimum_expiration   | integer                |
remove_existing      | yesno_values           |
qualify_frequency    | integer                |
authenticate_qualify | yesno_values           |
maximum_expiration   | integer                |
outbound_proxy       | character varying(40)  |
support_path         | yesno_values           |
qualify_timeout      | double precision       |
voicemail_extension  | character varying(40)  |
Indexes:
   "ps_aors_id_key" UNIQUE CONSTRAINT, btree (id)
   "ps_aors_id" btree (id)
   "ps_aors_qualifyfreq_contact" btree (qualify_frequency, contact)
{noformat}

I have used what I believe is setup similar to yours, but am unable to duplicate. I'm testing on Ubuntu 16.04 with postgresql server 9.5. My odbc libraries though are slightly newer than yours:
{noformat}
dpkg -l | grep odbc
ii  libodbc1:amd64                       2.3.1-4.1                                  amd64        ODBC library for Unix
ii  odbc-postgresql:amd64                1:09.03.0300-1                             amd64        ODBC driver for PostgreSQL
ii  odbcinst                             2.3.1-4.1                                  amd64        Helper program for accessing odbc ini files
ii  odbcinst1debian2:amd64               2.3.1-4.1                                  amd64        Support library for accessing odbc ini files
ii  unixodbc                             2.3.1-4.1                                  amd64        Basic ODBC tools
ii  unixodbc-dev                         2.3.1-4.1                                  amd64        ODBC libraries for UNIX (development files)
{noformat}
If it's possible you might try upgrading the relevant libraries to see if that helps?

By: Guilherme Bizzani (GuilhermeBiz) 2017-10-25 05:19:41.495-0500

Config files relevant to this issue.

By: Guilherme Bizzani (GuilhermeBiz) 2017-10-25 05:30:56.777-0500

I forgot to include the inserts I used in the example, here they are:

insert into ps_aors (id, max_contacts) values (101, 1);
insert into ps_aors (id, max_contacts) values (102, 1);

insert into ps_auths (id, auth_type, password, username) values (101, 'userpass', 101, 101);
insert into ps_auths (id, auth_type, password, username) values (102, 'userpass', 102, 102);

insert into ps_endpoints (id, transport, aors, auth, context, disallow, allow, direct_media) values (101, 'transport-udp', '101', '101', 'testing', 'all', 'g722', 'no');
insert into ps_endpoints (id, transport, aors, auth, context, disallow, allow, direct_media) values (102, 'transport-udp', '102', '102', 'testing', 'all', 'g722', 'no');