[Home]

Summary:ASTERISK-25686: PJSIP: qualify_timeout is a double, database schema is an integer
Reporter:Marcelo Terres (mhterres)Labels:
Date Opened:2016-01-11 12:11:38.000-0600Date Closed:2016-02-02 15:20:53.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip
Versions:13.6.0 Frequency of
Occurrence
Related
Issues:
Environment:Asterisk 13.6.0 - Ubuntu 14.04.3 LTS - Linux rtc 4.1.5-x86_64-linode61 #7 SMP Mon Aug 24 13:46:31 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux PostgresqlAttachments:
Description:Using pjsip realtime, after extension is registered, Asterisk try to add contact record in table (ps_contacts) but operation fails.

Postgres logs:
{noformat}
2016-01-11 18:03:39 UTC LOG:  statement: select pg_client_encoding()
2016-01-11 18:03:39 UTC LOG:  statement: INSERT INTO ps_contacts (id, qualify_timeout, outbound_proxy, expiration_time, path, qualify_frequency, user_agent, uri) VALUES (E'10^3B@4baedafd08a7b062bb5e911f2d75c0c9', E'3.000000', E'', E'1452536319', E'', E'0', E'CSipSimple_titan_udstv-21/r2457', E'sip:10@179.224.243.192:51373^3Bob')
2016-01-11 18:03:39 UTC ERROR:  invalid input syntax for integer: "3.000000" at character 173
2016-01-11 18:03:39 UTC STATEMENT:  INSERT INTO ps_contacts (id, qualify_timeout, outbound_proxy, expiration_time, path, qualify_frequency, user_agent, uri) VALUES (E'10^3B@4baedafd08a7b062bb5e911f2d75c0c9', E'3.000000', E'', E'1452536319', E'', E'0', E'CSipSimple_titan_udstv-21/r2457', E'sip:10@179.224.243.192:51373^3Bob')
{noformat}

Asterisk logs:
{noformat}
*CLI> [Jan 11 16:03:39] WARNING[32014]: res_odbc.c:649 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: HY000: ERROR:  invalid input syntax for integer: "3.000000" at character 173;
Error while executing the query (102)
[Jan 11 16:03:39] WARNING[32014]: res_odbc.c:661 ast_odbc_prepare_and_execute: SQL Execute error -1! Verifying connection to asterisk [asterisk]...
[Jan 11 16:03:39] WARNING[32014]: res_odbc.c:765 ast_odbc_sanity_check: Connection is down attempting to reconnect...
[Jan 11 16:03:39] NOTICE[32014]: res_odbc.c:1528 odbc_obj_connect: Connecting asterisk
[Jan 11 16:03:39] NOTICE[32014]: res_odbc.c:1567 odbc_obj_connect: res_odbc: Connected to asterisk [asterisk]
[Jan 11 16:03:39] WARNING[32014]: res_odbc.c:649 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: HY000: ERROR:  invalid input syntax for integer: "3.000000" at character 173;
Error while executing the query (102)
[Jan 11 16:03:39] WARNING[32014]: res_odbc.c:661 ast_odbc_prepare_and_execute: SQL Execute error -1! Verifying connection to asterisk [asterisk]...
[Jan 11 16:03:39] WARNING[32014]: res_odbc.c:765 ast_odbc_sanity_check: Connection is down attempting to reconnect...
[Jan 11 16:03:39] NOTICE[32014]: res_odbc.c:1528 odbc_obj_connect: Connecting asterisk
[Jan 11 16:03:39] NOTICE[32014]: res_odbc.c:1567 odbc_obj_connect: res_odbc: Connected to asterisk [asterisk]
[Jan 11 16:03:39] ERROR[32014]: res_pjsip_registrar.c:504 rx_task: Unable to bind contact 'sip:10@179.224.243.192:51373;ob' to AOR '10'
[Jan 11 16:03:40] NOTICE[32013]: res_pjsip_mwi.c:717 mwi_new_subscribe: AOR 10 has no configured mailboxes. MWI subscription failed.
{noformat}

If I change qualify_timeout column value from 3.00000 to 3, the record can be manually added in table (using 3.0000 fails).

Comments:By: Asterisk Team (asteriskteam) 2016-01-11 12:11:40.213-0600

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: Marcelo Terres (mhterres) 2016-01-11 12:14:30.440-0600

Another piece of information.

If I set qualify_timeout in AOR (5 for example), Asterisk changes it to 5.00000 when inserting in db.

By: Marcelo Terres (mhterres) 2016-01-11 12:49:53.274-0600

Variable qualify_timeout in Asterisk is double and table column is integer.

I changed the db column to double precision and now it is working.

By: Daniel Journo (journo) 2016-01-13 16:09:07.048-0600

Marcelo Terres, where did you get your database schema from?

By: Marcelo Terres (mhterres) 2016-01-13 16:41:43.985-0600

I used alembic.

In contrib/ast-db-manage/config/versions/461d7d691209_add_pjsip_qualify_timeout.py:

   op.add_column('ps_aors', sa.Column('qualify_timeout', sa.Integer))
   op.add_column('ps_contacts', sa.Column('qualify_timeout', sa.Integer))

Both columns added as integers. I think think is the correct type, cause we are talking about seconds, am I right?


By: Daniel Journo (journo) 2016-01-13 16:46:28.774-0600

I have added a fix to alembic to change it to Decimal. I've checked the Asterisk source and confirmed with the author. The correct type is Decimal for the quality_timeout. You are correct with what you did to resolve the issue.

By: Marcelo Terres (mhterres) 2016-01-13 16:50:33.450-0600

Great. I'm happy that I could help you guys.

Regards,
Marcelo

By: Andreas Krüger (woopstar) 2016-01-19 02:04:36.700-0600

When I run the alembic, I get this error:

{code}
   op.alter_column('ps_aors', 'qualify_timeout', type_=sa.Decimal)
AttributeError: 'module' object has no attribute 'Decimal'
{code}

It's against a MySQL database running on Amazon RDS. Alembic version is 0.6.2

By: Andreas Krüger (woopstar) 2016-02-02 15:13:34.201-0600

Issue seems to be resolved now by the following commit:

https://github.com/asterisk/asterisk/commit/52b29f9b4cd373be7357cd03e01cfeb2d0029140

By: Joshua C. Colp (jcolp) 2016-02-02 15:20:53.397-0600

You would indeed be correct. Closing out!