Discussion:
[asterisk-dev] Dual contact entries in "pjsip show contacts"
Floimair Florian
2018-03-22 10:22:37 UTC
Permalink
Hi!

I am currently using an Asterisk setup with a realtime-db as backend.
We create endpoints/aors/auths using ARI Push configuration and when that happens we see 2 contact entries when executing "pjsip show contacts" in the CLI.
This also sporadically leads to calls being refused by Asterisk even though the called endpoint registered successfully and is idle.



As soon as I restart Asterisk the dual entries are gone and everything is working normal.

This leads me to believe, that this must be a bug in Asterisk for the "Push Configuration + Realtime-DB" scenario.
Can you give me any hints on what to check and where to look at in the code to verify this situation?
I am willing to fix it myself but would need a little guidance.

Thanks

P.S.: Here is a condensed config that I am using

ARI Push Configuration settings as defined in the WIKI
aor objects are created using remove_existing=yes and max_contacts=1

extconfig.conf:
[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

sorcery.conf:
[res_pjsip]
endpoint=realtime,ps_endpoints
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


With best regards

Florian Floimair
Innovation - Software-Development

COMMEND INTERNATIONAL GMBH
A-5020 Salzburg, Saalachstraße 51
Tel: +43-662-85 62 25 568
Fax: +43-662-85 62 26
http://www.commend.com

Security and Communication by Commend

FN 178618z | LG Salzburg
Joshua Colp
2018-03-22 10:26:08 UTC
Permalink
Post by Floimair Florian
Hi!
I am currently using an Asterisk setup with a realtime-db as backend.
We create endpoints/aors/auths using ARI Push configuration and when
that happens we see 2 contact entries when executing "pjsip show
contacts" in the CLI.
This also sporadically leads to calls being refused by Asterisk even
though the called endpoint registered successfully and is idle.
If you are referring to inbound calls from the endpoint then that would be unrelated to your Contact issue. Inbound registration isn't consulted or used for incoming calls. Are you actually referring to outgoing calls to the endpoint? As well - is there anything different between the contacts?
Post by Floimair Florian
As soon as I restart Asterisk the dual entries are gone and everything is working normal.
This leads me to believe, that this must be a bug in Asterisk for the
"Push Configuration + Realtime-DB" scenario.
Can you give me any hints on what to check and where to look at in the
code to verify this situation?
I am willing to fix it myself but would need a little guidance.
I don't know if anyone has tested the use of ARI push configuration with a database backed realtime, albeit there is nothing to say it shouldn't work. What do you see in the actual database?
--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
Floimair Florian
2018-03-22 11:43:24 UTC
Permalink
Thanks Joshua for your quick answer.

I am indeed referring to outgoing calls.

The contacts are created as a result of an inbound registration.
Before the first registration I only have dual entries for the endpoints.
After the first registration I see the 2 contacts, which are in fact identical.
The database itself only contains a single entry for all entities, which would explain why it
works after a restart.

The workflow is as follows.

1 - Create endpoint/auth/aor for Alice using ARI push configuration
2 - Create endpoint/auth/aor for Bob using ARI push configuration
I see two entries for each of them when issuing "pjsip show endpoints"

3 - A registers and a contact is created
2 (identical) contacts are shown as "Available", since there are also two endpoints shown

4 - B registers and a contact is created
2 (identical) contacts are shown as "Available", since there are also two endpoints shown

5 - Alice tries to call Bob
Asterisk refuses with
res_pjsip.c: Endpoint 'Bob': Could not create dialog to invalid URI 'Bob'. Is endpoint registered and reachable?
chan_pjsip.c: Failed to create outgoing session to endpoint 'Bob'
app_dial.c: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)
app_dial.c: Everyone is busy/congested at this time (1:0/0/1)
pbx.c: Auto fallthrough, channel 'PJSIP/Bob-00000814' status is 'CHANUNAVAIL'
 
I have seen this already more than a year ago with 13.x and 14.x as well (currently I'm using the latest 15.3.0).
I was not able to reproduce it since as everything works flawlessly after a restart.
It was only now that I realized that the issue is related to creating the endpoint/auth/aor objects on a running system with no restarts since.

 
 
With best regards

Florian Floimair
Innovation - Software-Development

COMMEND INTERNATIONAL GMBH
A-5020 Salzburg, Saalachstraße 51
Tel: +43-662-85 62 25 568
Fax: +43-662-85 62 26
http://www.commend.com

Security and Communication by Commend

FN 178618z | LG Salzburg

Mit freundlichen Grüßen

Florian Floimair (IMS) 1568
 

-----Ursprüngliche Nachricht-----
Von: asterisk-dev-***@lists.digium.com [mailto:asterisk-dev-***@lists.digium.com] Im Auftrag von Joshua Colp
Gesendet: Donnerstag, 22. März 2018 11:26
An: asterisk-***@lists.digium.com
Betreff: Re: [asterisk-dev] Dual contact entries in "pjsip show contacts"
Post by Floimair Florian
Hi!
I am currently using an Asterisk setup with a realtime-db as backend.
We create endpoints/aors/auths using ARI Push configuration and when
that happens we see 2 contact entries when executing "pjsip show
contacts" in the CLI.
This also sporadically leads to calls being refused by Asterisk even
though the called endpoint registered successfully and is idle.
If you are referring to inbound calls from the endpoint then that would be unrelated to your Contact issue. Inbound registration isn't consulted or used for incoming calls. Are you actually referring to outgoing calls to the endpoint? As well - is there anything different between the contacts?
Post by Floimair Florian
As soon as I restart Asterisk the dual entries are gone and everything is working normal.
This leads me to believe, that this must be a bug in Asterisk for the
"Push Configuration + Realtime-DB" scenario.
Can you give me any hints on what to check and where to look at in the
code to verify this situation?
I am willing to fix it myself but would need a little guidance.
I don't know if anyone has tested the use of ARI push configuration with a database backed realtime, albeit there is nothing to say it shouldn't work. What do you see in the actual database?

--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US Check us out at: https://linkprotect.cudasvc.com/url?a=https://www.digium.com&c=E,1,dzjUo58Yho9K_rDTimX-0B0-o3j_oXxpFn8XrJ7FyQjm_4h8S2NBc3MqEfejVuE4jkXD1dO8mw1ERXpTjFqoyhjjcudyL-VBZxEuLBFz&typo=1 & www.asterisk.org

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by https://linkprotect.cudasvc.com/url?a=http://www.api-digital.com&c=E,1,WtUXkSGP2RZye0KxXcnNqVby0Ag4kQt-ViaPAS04-4-6sPNDZVcd3apxrZssiqYR38Gydx_UiSt-Ik7dGDZAPg91_X2k2NZrUt9PUs4lmGm7GJRYCz4wrg,,&typo=1 --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
https://linkprotect.cudasvc.com/url?a=http://lists.digium.com/mailman/listinfo/asterisk-dev&c=E,1,eq9sNoan0yTYMIoQTN38sNMi_lRNfPy4k7zm5VugGnM2QuPBz_Ed9YWLxcDB2dI-cSlHLKWw_v1gi_dBaVmSiQuMTZO36CoVjqeUQHrUk0wM-SD5zokUjNDt2nFm&typo=1
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
Joshua Colp
2018-03-22 11:50:19 UTC
Permalink
Post by Floimair Florian
Thanks Joshua for your quick answer.
I am indeed referring to outgoing calls.
The contacts are created as a result of an inbound registration.
Before the first registration I only have dual entries for the
endpoints.
After the first registration I see the 2 contacts, which are in fact identical.
The database itself only contains a single entry for all entities, which
would explain why it
works after a restart.
The workflow is as follows.
1 - Create endpoint/auth/aor for Alice using ARI push configuration
2 - Create endpoint/auth/aor for Bob using ARI push configuration
I see two entries for each of them when issuing "pjsip show endpoints"
3 - A registers and a contact is created
2 (identical) contacts are shown as "Available", since there are also two endpoints shown
4 - B registers and a contact is created
2 (identical) contacts are shown as "Available", since there are also two endpoints shown
5 - Alice tries to call Bob
Asterisk refuses with
res_pjsip.c: Endpoint 'Bob': Could not create dialog to invalid URI
'Bob'. Is endpoint registered and reachable?
chan_pjsip.c: Failed to create outgoing session to endpoint 'Bob'
app_dial.c: Unable to create channel of type 'PJSIP' (cause 3 - No
route to destination)
app_dial.c: Everyone is busy/congested at this time (1:0/0/1)
pbx.c: Auto fallthrough, channel 'PJSIP/Bob-00000814' status is 'CHANUNAVAIL'
 
I have seen this already more than a year ago with 13.x and 14.x as well
(currently I'm using the latest 15.3.0).
I was not able to reproduce it since as everything works flawlessly after a restart.
It was only now that I realized that the issue is related to creating
the endpoint/auth/aor objects on a running system with no restarts
since.
It sounds almost as if there are two backends for the objects, one in memory and one database... but your configuration certainly doesn't show that. Have you bumped up core debug (debug to console in logger.conf and core set debug 9) and looked to see if anything stands out?

There is no cache or memory mechanism built into sorcery that is always there, so I'm not sure where it'd have two objects stored or where to look. The "pjsip show endpoints" command just asks the sorcery backends to return the data they have, for example.
--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman
Joshua Colp
2018-03-22 10:27:37 UTC
Permalink
Post by Floimair Florian
Hi!
I am currently using an Asterisk setup with a realtime-db as backend.
We create endpoints/aors/auths using ARI Push configuration and when
that happens we see 2 contact entries when executing "pjsip show
contacts" in the CLI.
This also sporadically leads to calls being refused by Asterisk even
though the called endpoint registered successfully and is idle.
I should also add - are you creating the contacts, or are you referring to contacts as a result of inbound registration?
--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
Loading...