[Home]

Summary:ASTERISK-25466: pjsip: Endpoints added to pjsip.conf during runtime - reload results in an 'invalid' state for all but the last endpoint loaded
Reporter:Dmitriy Serov (Demon)Labels:
Date Opened:2015-10-14 10:23:17Date Closed:
Priority:MajorRegression?Yes
Status:Open/NewComponents:Resources/res_pjsip
Versions:13.6.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:( 0) debug.log
( 1) pjsip_general.inc
Description:[Edit by Rusty - Reproduction requires adding more than one new endpoint. All of the new endpoints except the last one added will have an invalid state after the new configuration is loaded. Registration does not appear to be blocked for the invalid state endpoints in my own testing.]

steps to repeat:
1. adding new device enpoint in text config pjsip.conf. For example, "test1"
2. module reload res_pjsip.so
3. pjsip show endpoint test1
State of endpoint is "Invalid".

the only way to fix i know: asterisk restart :(
This error appeared not so long ago and very critical, because it blocks the registration of new users
Comments:By: Asterisk Team (asteriskteam) 2015-10-14 10:23:19.534-0500

The severity of this issue has been automatically downgraded from "Blocker" to "Major". The "Blocker" severity is reserved for issues which have been determined to block the next release of Asterisk. This severity can only be set by privileged users. If this issue is deemed to block the next release it will be updated accordingly during the triage process.

By: Asterisk Team (asteriskteam) 2015-10-14 10:23:20.438-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: Rusty Newton (rnewton) 2015-10-15 16:48:26.980-0500

What happens when you use "pjsip reload" the alias included in cli_aliases.conf ?

{noformat}
pjsip reload=module reload res_pjsip.so res_pjsip_authenticator_digest.so res_pjsip_endpoint_identifier_ip.so res_pjsip_mwi.so res_pjsip_notify.so res_pjsip_outbound_publish.so res_pjsip_publish_asterisk.so res_pjsip_outbound_registration.so
{noformat}

By: Rusty Newton (rnewton) 2015-10-15 16:49:07.730-0500

Also, what version did the issue appear in?

By: Dmitriy Serov (Demon) 2015-10-16 01:43:29.396-0500

I have't used res_clialiases.so. Ok, it's loaded.
After "pjsip reload" nothing changed: the state of endpoint is Invalid.

git commit 1c799b1f1ecc37b7fb39dd205a35720e16fe37d7 (2015-10-08)

By: Rusty Newton (rnewton) 2015-10-16 15:56:56.713-0500

I'm unable to reproduce.

I followed your instructions and after "pjsip reload" the new endpoint is loaded and has a state of "Unavailable". The device registers to the endpoint and it now has a state of "Not in use" and everything seems to function fine.

Used Asterisk GIT-13-25ec63a

There is probably something else needed for reproduction..

Can you post the exact pjsip.conf you use before reload, and then the pjsip.conf you use after reload?

By: Dmitriy Serov (Demon) 2015-10-16 16:25:45.730-0500

i processed:
1. set debug
2. script added endpoint, added dialplan extension hint
3. pjsip reload, sip reload, dialplan reload, voicemail reload
4. pjsip show endpoint 18974

Result:
devicestate.c: No provider found, checking channel drivers for PJSIP - 18974
devicestate.c: Changing state for PJSIP/18974 - state 4 (Invalid)

Perhaps it is important to have the hint?

By: Dmitriy Serov (Demon) 2015-10-16 16:29:30.055-0500

Test without hints changed nothing.

By: Dmitriy Serov (Demon) 2015-10-26 02:16:37.381-0500

Can I provide some information or perform some tests?
This situation is very critical for my service. No new user or a user who added a new device, cannot use it.

By: Rusty Newton (rnewton) 2015-10-30 09:57:48.927-0500

Still unable to reproduce when following your additional information and using your configuration.

Can you provide another debug log but include "pjsip set logger on" output alongside verbose, debug and the other standard logger channels.

I'm curious if the endpoint registers and sends Asterisk something that affects a state change.

By: Dmitriy Serov (Demon) 2015-10-30 12:54:52.784-0500

{noformat}
[2015-10-30 20:39:20] DEBUG[18675] config.c: extract int from [30] in [-2147483648, 2147483647] gives [30](0)
[2015-10-30 20:39:20] VERBOSE[18675] res_pjsip/pjsip_configuration.c: Endpoint 18975 is now Unreachable
[2015-10-30 20:39:20] DEBUG[17009] devicestate.c: No provider found, checking channel drivers for PJSIP - 18975
[2015-10-30 20:39:20] DEBUG[17009] devicestate.c: Changing state for PJSIP/18975 - state 4 (Invalid)
[2015-10-30 20:39:20] DEBUG[18675] config.c: extract int from [0] in [-2147483648, 2147483647] gives [0](0)
{noformat}

- no any SIP packets
- no endpoints (devices) configured with this login (18975)
- ALL dialplan Hints was deleted to test
- endpoint mailboxes was deleted to test

{noformat}
[2015-10-30 20:39:20] VERBOSE[18675] res_pjsip/pjsip_configuration.c: Endpoint 18975 is now Unreachable
{noformat}
ok... in debug log the next line:
{noformat}
[2015-10-30 20:39:20] DEBUG[17009] devicestate.c: No provider found, checking channel drivers for PJSIP - 18975
{noformat}
This means that nothing comes externally, can not, should not affect this behavior.

Why ast_device_state returns AST_DEVICE_INVALID? Or this is normal behavior and condition of the Invalid should later change to another, but for some reason does not change?

Maybe I can add some debug code, in the log of important information that was food for thought?

By: Dmitriy Serov (Demon) 2015-11-06 12:22:13.276-0600

I was able to find a way to repeat on a clean server. The next sequence of actions:
1. start asterisk with any pjsip config (i used the attached to this issue).
2. in text config add TWO (more than one) endpoints
3. pjsip reload
4. pjsip show endpoint admin
5. see Invalid status on first endpoint and unavailable on second.

used text of two endpoints:
{noformat}
; admin phone: 9999 type: friend
[admin](device-auth)
username=admin
password=secret1
[admin](device-endpoint)
aors=admin
auth=admin
set_var=CHANNEL(namedcallgroup)=g54,g54-1128
accountcode=9999
set_var=fromDeviceId=683
set_var=fromUserId=54
[admin](device-aor)
;mailboxes=9999@local

; ivmaster phone: 9737 type: friend
[ivmaster](device-auth)
username=ivmaster
password=secret2
[ivmaster](device-endpoint)
aors=ivmaster
auth=ivmaster
set_var=CHANNEL(namedcallgroup)=g84,g84-1142
accountcode=9737
set_var=fromDeviceId=697
set_var=fromUserId=84
[ivmaster](device-aor)
;mailboxes=9737@local
{noformat}

I very much hope that this will help to find and fix the problem. Looking forward to testing the patch.

By: Rusty Newton (rnewton) 2015-11-07 16:51:30.659-0600

Thanks Dmitry. I was able to reproduce the invalid states even without your configuration. As you said, simply adding *more than one* new endpoint results in the issue. However, *I was not able* to reproduce behavior where endpoint registration was blocked.

{noformat}
Endpoint:  ALICE                                                Not in use    0 of inf
    InAuth:  ALICE/ALICE
       Aor:  ALICE                                              1
     Contact:  ALICE/sip:ALICE@192.168.1.245:5060               Unknown               nan

Endpoint:  BOB                                                  Not in use    0 of inf
    InAuth:  BOB/BOB
       Aor:  BOB                                                1
     Contact:  BOB/sip:BOB@192.168.1.19:5060                    Unknown               nan

Endpoint:  CAROL                                                Not in use    0 of inf
    InAuth:  CAROL/CAROL
       Aor:  CAROL                                              1
     Contact:  CAROL/sip:CAROL@192.168.1.245:5061               Unknown               nan

Endpoint:  DAVID                                                Unavailable   0 of inf
    InAuth:  DAVID/DAVID
       Aor:  DAVID                                              1

Endpoint:  EDDY                                                 Invalid       0 of inf
    InAuth:  EDDY/EDDY
       Aor:  EDDY                                               1

Endpoint:  FRAN                                                 Invalid       0 of inf
    InAuth:  FRAN/FRAN
       Aor:  FRAN                                               1

Endpoint:  GEORGE                                               Unavailable   0 of inf
    InAuth:  GEORGE/GEORGE
       Aor:  GEORGE                                             1
{noformat}

Here you can see where the first two of the last three endpoints (all added to pjsip.conf before a reload) show 'Invalid' states.

This appears to be the same issue with exception to what you mentioned about new registrations being blocked. I was able to register the new endpoints without problem.

By: Dmitriy Serov (Demon) 2015-11-08 06:37:16.499-0600

I guess I used the wrong word and checking it.
When adding new trunks as their state has become "Invalid", so more is not changed until restart. My service after a few minutes turns off trunks that were unable to successfully register.
This is the reason for blocking their use.

I mistakenly extended that problem to device endpoints. But tests have shown that the successful registration of the device changes the state to correct.

By: Dmitriy Serov (Demon) 2016-06-22 02:21:58.128-0500

Is there any hope that this bug will be fixed?
Thanks

By: Joshua C. Colp (jcolp) 2016-06-22 05:17:08.585-0500

This issue has been accepted so it is possible, but there is no time frame or guarantee on when.

By: Dmitriy Serov (Demon) 2017-03-07 05:45:08.133-0600

Is there any hope that this bug will be fixed?
Thanks

By: Joshua C. Colp (jcolp) 2017-03-07 06:13:55.838-0600

As I stated previously the issue has been accepted and is in queue. If you need it fixed soon with a time guarantee then you may want to create a bounty[1] and try to elicit interest.

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Bug+Bounties

By: Dmitriy Serov (Demon) 2017-06-14 12:11:26.740-0500

Asterisk 13.16.0

Something has changed.
If the earlier status was Invalid, now it is simply Unavailable. Contact is Available and Endpoint is not. Until asterisk rebooted.

Endpoint:  srv_d33273                                           Unavailable   0 of inf
Contact:  multifon.ru/sip:multifon.ru                e2c481b00e Avail        58.373