Summary: | ASTERISK-30396: res_pjsip: Retrieval of contacts with + at start is problematic. | ||
Reporter: | erebus (erebus) | Labels: | |
Date Opened: | 2023-01-12 13:23:24.000-0600 | Date Closed: | 2023-02-07 12:00:18.000-0600 |
Priority: | Minor | Regression? | Yes |
Status: | Closed/Complete | Components: | Resources/res_pjsip |
Versions: | 18.16.0 | Frequency of Occurrence | Constant |
Related Issues: | |||
Environment: | Debian x64, IPv6 only. | Attachments: | |
Description: | Greetings programs!
I got the following use case: Asterisk server with 2 SIP Clients registered to the same AOR and same endpoint. AOR identifier and extension number match the E123-formatted E164 number of the participant which is why the AOR and the extension begin with a + sign. My Asterisk is now suffering from contact amnesia. I. e. pjsip show endpoints will sometimes list either of the two phones and rarely even both will show up. But in most cases, either phone or even both are forgotten by the software. This means that my 2 phones aren't ringing reliably. Sometimes only 1 phone rings, sometimes neither rings. I managed to work around this bug by resurrecting an old work-around that I developed for bug ASTERISK-26151: For each AOR I want to have in pjsip.conf, I create a second which has the + sign escaped with a backslash. [aor_dynamic]\(!) type=aor max_contacts=15 qualify_frequency=1 qualify_timeout=1000 [+12345](aor_dynamic) [\+12345](aor_dynamic) ; <==== WORKAROUND This made Asterisk work for me. I think that one of the changes that was made to location.c in the past years introduced this issue and that it is again caused by improper use of ast_sorcery_retrieve_by_regex() in lines 887 and/or 1051. | ||
Comments: | By: Asterisk Team (asteriskteam) 2023-01-12 13:23:24.884-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. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed. 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. Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/]. By: Joshua C. Colp (jcolp) 2023-01-12 13:27:08.039-0600 This is not changing in Asterisk 16. Asterisk 16 is security fix only status. By: George Joseph (gjoseph) 2023-01-13 05:30:12.814-0600 Can you post the pjsip "global" configuration and the full configuration for the endpoint as well? By: erebus (erebus) 2023-01-13 06:37:35.643-0600 Here you go... (Phone number and passwords are changed for information security) [transport-udp-ipv6] type=transport protocol=udp bind=:: [endpoint_internal]\(!) type=endpoint context=from-internal disallow=all allow=ulaw [auth_userpass]\(!) type=auth auth_type=userpass [aor_dynamic]\(!) type=aor max_contacts=15 qualify_frequency=1 qualify_timeout=1000 ; authenticate_qualify=no ; remove_existing=no ; maximum_expiration=7200 ; minimum_expiration=6000 ; Phones [+97912345](endpoint_internal) auth=+97912345 aors=+97912345 [+97912345](auth_userpass) password=Mb2.r5oHf-0t username=+97912345 [+97912345](aor_dynamic) [\+97912345](aor_dynamic) ;[1001](endpoint_internal) ;auth=1001 ;aors=1001 ;[1001](aor_dynamic) ;[1001](auth_userpass) ;password=Mb2.r5oHf-0t ;username=1001 ;[1002](endpoint_internal) ;auth=1002 ;aors=1002 ;[1002](aor_dynamic) ;[1002](auth_userpass) ;password=Mb2.r5oHf-0t ;username=1002 ;[1003](endpoint_internal) ;auth=1003 ;aors=1003 ;[1003](aor_dynamic) ;[1003](auth_userpass) ;password=Mb2.r5oHf-0t ;username=1003 By: George Joseph (gjoseph) 2023-01-13 09:08:15.647-0600 I still need the "global" settings, specifically, endpoint_identifier_order. Also, do the auth usernames also begin with '+'? EDIT: Oops, I now see that the usernames do begin with '+'; By: George Joseph (gjoseph) 2023-01-13 09:35:36.466-0600 Actually, I think I'm going to need logs and pcaps. I tried your config and have no issues with multiple phones. They stay registered and both ring. By: erebus (erebus) 2023-01-13 09:46:02.430-0600 Concerning global config: The config I posted is everything I have in pjsip.conf. Specifically, I don't have a [global] section which is the default on Debian. Concerning reproduction: Did you remember to comment out the extra AOR (the one with the backslash)? It's the workaround that prevents the issue from happening on my machine. By: George Joseph (gjoseph) 2023-01-16 06:05:43.468-0600 Yeah, I'm not using the escaped AOR entry. Is this the way you normally run or just part of troubleshooting? {code} qualify_frequency=1 qualify_timeout=1000 {code} While you're in the bad state, can you run {{pjsip show scheduled_tasks}} and paste the lines beginning with {{pjsip/options}}. I also really need wireshark pcaps and asterisk logs captured with verbose = 3 that span the transition from both phones being registered and working to either or both being off line. By: George Joseph (gjoseph) 2023-01-24 05:13:10.592-0600 [~erebus] Any new info? By: Asterisk Team (asteriskteam) 2023-02-07 12:00:18.069-0600 Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1]. [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines |