[Home]

Summary:ASTERISK-28397: ARI Push Configuration - duplicate entries
Reporter:Evgeniy (evgenknis)Labels:pjsip
Date Opened:2019-04-26 02:01:07Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Resources/res_pjsip
Versions:13.21.0 Frequency of
Occurrence
Related
Issues:
is duplicated byASTERISK-30113 ari: Loading PJSIP config wizard causes duplicated Endpoints, AORS, Auths created by push
is related toASTERISK-28228 res_pjsip: pjsip show contacts prints double entries
Environment:NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"Attachments:
Description:I’m working with ARI Push Configuration. Everytime I create new ‘auth’ section using:

curl -X PUT -H "Content-Type: application/json" -u asterisk:secret -d '{"fields": [ { "attribute": "auth_type", "value": "userpass"}, {"attribute": "username", "value": "alice"}, {"attribute": "password", "value": "secret" } ] }' https://localhost:8088/ari/asterisk/config/dynamic/res_pjsip/auth/alice
Asterisk command ‘pjsip show auths’ prints duplicate entry:

 I/OAuth:  <AuthId/UserName.............................................................>
==========================================================================================

    Auth:  alice/alice
    Auth:  alice/alice

Objects found: 2

Same issue occurs with ‘aor’ and ‘endpoint’ sections.
Invoking HTTP GET on /ari/endpoints prints only single entry.

My question is why Asterisk command line always prints duplicate entries and how to fix this issue?

{code:title=sorcery.conf|borderStyle=solid}
[res_pjsip]
endpoint=astdb,ps_endpoints
auth=astdb,ps_auths
aor=astdb,ps_aors
domain_alias=astdb,ps_domain_aliases
contact=astdb,ps_contacts
system=astdb,ps_systems

[res_pjsip_endpoint_identifier_ip]
identify=astdb,ps_endpoint_id_ips

[res_pjsip_outbound_registration]
registration=astdb,ps_registrations
{code}

{code:title=pjsip.conf|borderStyle=solid}
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060

[transport-tcp]
type=transport
protocol=tcp
bind=0.0.0.0:5060
{code}
Comments:By: Asterisk Team (asteriskteam) 2019-04-26 02:01:07.753-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].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Kevin Harwell (kharwell) 2019-04-26 15:24:41.863-0500

Only one entry in the database, so makes me wonder if it's just a CLI printed output issue:
{noformat}
*CLI> pjsip show auths

 I/OAuth:  <AuthId/UserName.............................................................>
==========================================================================================

    Auth:  alice/alice
    Auth:  alice/alice

Objects found: 2

*CLI> database show
/pbx/UUID                                         : 0dd955f9-5f00-baa-8166-f3ac0736fxyz
/ps_auths/auth/alice                              : {"username":"alice","md5_cred":"","realm":"","auth_type":"userpass","password":"secret","nonce_lifetime":"32"}
2 results found.
*CLI>
{noformat}

By: Kevin Harwell (kharwell) 2019-04-26 15:27:56.784-0500

I've linked ASTERISK-28228 as it's probably the same underlying problem. Hopefully fixing one fixes both.

Also this was originally marked ast 13.21, but I tested it against the latest 16 branch (last release was 16.3.0) and it does this there too.

By: Ron Lockard (rlockard) 2022-05-23 16:28:52.921-0500

This issue still exists in 18.12.1.  I'm using realtime with the ODBC connector to MySQL.  Just wanted to add some additional information.

Originally I had an issue related to ASTERISK-29453, so the DB entry was not getting created for the endpoint, but the endpoint would still exist in memory, and function, until Asterisk was restarted.  After a restart, there is only one entry showing from the command line, so I believe it has to be the duplication of the in-memory and the realtime entry once it is created in the database that originally creates this issue.

Anything I create via the ARI push, in either aors or endpoints has a duplicate until I restart Asterisk, which clears all the in-memory configuration.


By: Vitezslav Novy (vnovy) 2022-06-17 04:32:02.342-0500

Module res_pjsip_config_wizard registers sorcery memory wizard for endpoint, aor, auth and maybe other pjsip sorcery object types. With sorcery configuration shown above, we end up with 2 writable sorcery wizards (astdb, memory) for these objects.
When ARI is used to create object, function ast_sorcery_create stores the object using both wizards.

Retrieval functions like ast_sorcery_retrieve_by_regex or ast_sorcery_retrieve_by_prefix fetch objects from all wizards, but there is no deduplication.

Workaround: if not needed do not load module res_pjsip_config_wizard or delete config file pjsip_wizard.conf