[Home]

Summary:ASTERISK-28040: pbx: "dialplan reload" is removing minus symbol from dynamic hints
Reporter:Daniel Zanutti (danielzt)Labels:patch
Date Opened:2018-09-05 15:55:04Date Closed:2021-11-08 12:27:06.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Core/PBX
Versions:13.22.0 Frequency of
Occurrence
Constant
Related
Issues:
is duplicated byASTERISK-28262 Custom device state losing - (dash)
Environment:Using debian but should happen on any OSAttachments:( 0) 0001-pbx.c-Allow-dashes-in-hint-extensions.patch
( 1) asterisk.tar.gz
Description:Summary: When we do "dialplan reload", asterisk removes the minus symbol "-" from all hints.

We are using the minus symbol "-" to differentiate customers on our PBX. So customerA has extension "customerA-100" and customer B has extension "customerB-100", this way we can have same extension number to different customers. Hints are being used to track presense and inform BLF.

This works fine until we do a "dialplan reload" command. When this is done, all minus symbols are removed from hints.
Sample:
Before command:
{noformat}
pabx*CLI> core show hints

   -= Registered Asterisk Dial Plan Hints =-
customer-112@local-su: SIP/customer-112       State:Idle            Presence:not_set         Watchers  1
customer-116@local-su: SIP/customer-116       State:Idle            Presence:not_set         Watchers  1
customer-100@local-su: SIP/customer-100       State:Idle            Presence:not_set         Watchers  1
customer-102@local-su: SIP/customer-102       State:Idle            Presence:not_set         Watchers  1
customer-103@local-su: SIP/customer-103       State:Idle            Presence:not_set         Watchers  1
customer-105@local-su: SIP/customer-105       State:Idle            Presence:not_set         Watchers  1
{noformat}

After issuing "dialplan reload":
{noformat}
pabx*CLI> core show hints

   -= Registered Asterisk Dial Plan Hints =-
customer116@local-sub: SIP/customer116        State:Idle            Presence:not_set         Watchers  1
customer112@local-sub: SIP/customer112        State:InUse           Presence:not_set         Watchers  1
customer105@local-sub: SIP/customer105        State:Idle            Presence:not_set         Watchers  1
customer100@local-sub: SIP/customer100        State:Idle            Presence:not_set         Watchers  1
customer103@local-sub: SIP/customer103        State:Idle            Presence:not_set         Watchers  1
customer102@local-sub: SIP/customer102        State:Idle            Presence:not_set         Watchers  1
{noformat}

This is only solved after asterisk restart. The problem always happens so it's very easy to reproduce.
Comments:By: Asterisk Team (asteriskteam) 2018-09-05 15:55:06.578-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: Richard Mudgett (rmudgett) 2018-09-05 16:08:30.828-0500

This is not a bug.  Dashes are eye-candy and do not play a part in exten matching.
{noformat}
exten = 1-800-555-1212,1,NoOp()
{noformat}
Is the exact same thing as:
{noformat}
exten = 18005551212,1,NoOp()
{noformat}
You need to use a different character.
A hint is just a special dialplan priority level.

https://wiki.asterisk.org/wiki/display/AST/Contexts%2C+Extensions%2C+and+Priorities
https://wiki.asterisk.org/wiki/display/AST/Pattern+Matching


By: Daniel Zanutti (danielzt) 2018-09-05 16:31:51.419-0500

Thanks for answering.

The main problem is that hints doesn't work anymore after diaplan reload, but works fine before.

I think it's a bug because it works fine before "dialplan reload", this application should not change current behavior.

I'll change the symbol.


By: Michael L. Young (elguero) 2018-09-06 07:20:47.667-0500

Hmm... I think that maybe I see something.

The endpoint identifier is changing as well.

SIP/customer-112 is changing to SIP/customer112.

Maybe that is the issue and not really the hint extension?

Just a quick thought without digging into anything.

By: Daniel Zanutti (danielzt) 2018-09-06 07:56:05.517-0500

Everything else works fine after dialplan or core reload, just HINTS are affected in this case.
So presence and phone status doesn't work anymore.
Checked "sip show peers", all endpoints are fine.


By: Michael L. Young (elguero) 2018-09-06 08:22:32.847-0500

Look at what you posted.

The hint associated with endpont SIP/customer-112 is changing to SIP/customer112.  Therefore, the association with the actual SIP endpoint might be getting lost.  It was just a quick thought.

By: Chris Savinovich (csavinovich) 2018-09-10 13:54:30.503-0500

From Digium:  I can't replicate the issue.  Tried to replicate it using versions 13, 15, and 16 and in all instances the "-" stayed even after "dialplan reload".   Please post further details on how you replicate, and update to the latest release of your branch.
Here are my steps:

ITN3*CLI>
ITN3*CLI> core show hints

199@cyberphone      : SIP/Phone-A           State:Unavailable     Presence:not_set         Watchers  0

7 hints registered
ITN3*CLI>
ITN3*CLI> dialplan reload
Dialplan reloaded.
[Sep 10 14:50:26] DEBUG[30790]: config.c:2199 config_text_file_load: Parsing /etc/asterisk/extensions.conf
    Time to scan old dialplan and merge leftovers back into the new: 0.002245 sec
    Time to restore hints and swap in new dialplan: 0.000018 sec
    Time to delete the old dialplan: 0.000139 sec
    Total time merge_contexts_delete: 0.002402 sec
ITN3*CLI>
ITN3*CLI> core show hints

199@cyberphone      : SIP/Phone-A           State:Unavailable     Presence:not_set         Watchers  0
7 hints registered




By: Chris Savinovich (csavinovich) 2018-09-10 16:15:31.936-0500

Request more detail to make recreation possible.


By: Daniel Zanutti (danielzt) 2018-09-11 08:20:23.943-0500

Here is my phone at sip.conf:

{noformat}
[customer-115]
type=friend
host=dynamic
nat=force_rport,comedia
secret=123456
context=local-context
callerid="Customer"<1122222222>
disallow=all
allow=g722
allow=g729
allow=gsm
allow=alaw
allow=ulaw
namedcallgroup=37
namedpickupgroup=37
callcounter=yes
session-timers=accept
allowsubscribe=yes
subscribecontext=local-subscribe
accountcode=18,customer-115
{noformat}

This is the HINT context at extensions.conf:
{noformat}
[local-subscribe]
exten => _[a-z].,hint,SIP/${EXTEN}
{noformat}

Console:
{noformat}
Connected to Asterisk 13.23.0 currently running on pabx (pid = 1510)
pabx*CLI> core show hints

   -= Registered Asterisk Dial Plan Hints =-
customer-115@local-su: SIP/customer-115       State:Idle            Presence:not_set         Watchers  1
_[a-z].@local-subscr: SIP/${EXTEN}          State:Unavailable     Presence:                Watchers  0
----------------
- 2 hints registered

pabx*CLI> dialplan reload
Dialplan reloaded.

pabx*CLI> core show hints

   -= Registered Asterisk Dial Plan Hints =-
customer115@local-sub: SIP/customer115        State:Idle            Presence:not_set         Watchers  1
_[a-z].@local-subscr: SIP/${EXTEN}          State:Unavailable     Presence:                Watchers  0
----------------
- 2 hints registered
pabx*CLI>
{noformat}

I tested with Grandstream and Yealink to ask for presence, problem affected both.

Do you want me to provide an environment for the problem?


By: Chris Savinovich (csavinovich) 2018-09-11 12:05:25.371-0500

Let me see if this will work


By: Chris Savinovich (csavinovich) 2018-09-13 12:31:14.982-0500

Sorry, but I still couldn't get it to replicate.  This time only tested with 13, using chan_sip.so, using the sip.conf configuration you provided.

Since my test environment is minimal, barely the sip.conf and extensions.conf minimal necessary to run device "customer-115", I suggest you test with a similar minimal configuration and let us know.  It could be something you have in your sip.conf or extensions.conf and let us know.

Also please send us your environment.


By: Asterisk Team (asteriskteam) 2018-09-28 12:00:02.114-0500

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

By: Daniel Zanutti (danielzt) 2018-10-04 09:23:22.858-0500

I tested again, problem persists. I'll attach sample environment.

{noformat}
plat*CLI> sip show subscriptions
Peer             User             Call ID          Extension        Last state     Type            Mailbox    Expiry
177.139.91.172   100              883460539-5062-  cliente-100@loc  Unavailable    dialog-info+xml <none>     003600
177.139.91.172   100              1313622682-5062  cliente-101@loc  Unavailable    dialog-info+xml <none>     003600
3 active SIP subscriptions

plat*CLI> core show hints
   -= Registered Asterisk Dial Plan Hints =-
cliente-10@local-sub: SIP/cliente-10        State:Unavailable     Presence:not_set         Watchers  1
cliente-101@local-su: SIP/cliente-101       State:Unavailable     Presence:not_set         Watchers  1
cliente-100@local-su: SIP/cliente-100       State:Unavailable     Presence:not_set         Watchers  1
_[a-z].@local-subscr: SIP/${EXTEN}          State:Unavailable     Presence:                Watchers  0
----------------
- 4 hints registered
{noformat}

Then I did "dialplan reload" and hints has changed:

{noformat}
plat*CLI> dialplan reload
Dialplan reloaded.
plat*CLI> core show hints

   -= Registered Asterisk Dial Plan Hints =-
cliente10@local-subs: SIP/cliente10         State:Unavailable     Presence:not_set         Watchers  1
_[a-z].@local-subscr: SIP/${EXTEN}          State:Unavailable     Presence:                Watchers  0
cliente100@local-sub: SIP/cliente100        State:Unavailable     Presence:not_set         Watchers  1
cliente101@local-sub: SIP/cliente101        State:Unavailable     Presence:not_set         Watchers  1
----------------
{noformat}

To reproduce the problem:
1) Register account "cliente-100"
2) Configure BLF to get information of account "cliente-101"
3) Do a core show hints
4) Confirm hint is "cliente-101"
5) Do a "dialplan reload"
6) Do a "core show hints" to confirm hint changed to "cliente101"
7) BLF will not work anymore to account cliente-101 (and probably all other hint related features)

2 accounts
"cliente-100" and "cliente-101", both with password "123".

* Hint "cliente-101" is being created dynamically.


By: Asterisk Team (asteriskteam) 2018-10-04 09:23:23.336-0500

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.

By: Daniel Zanutti (danielzt) 2018-10-04 09:28:18.802-0500

Sample configuration of /etc/asterisk folder, to reproduce the problem.

Changes from default "samples" config.
- Created 2 accounts on sip.conf
- Inserted a new context and extensions.conf

By: Sean Bright (seanbright) 2018-10-04 11:23:56.474-0500

I'm able to reproduce with 13 GIT. What is odd to me is that the hints are added dynamically (read: not by pbx_config), so I am not sure why doing a {{dialplan reload}} would have any affect on them.

By: isrl (isrl) 2020-07-23 12:41:02.765-0500

the same is on asterisk 16 too
setting a custom hint is done in the dialplan
a - is used in the dialplan when enclosed [] as a range
maybe along the way even though the - is not enclosed asterisk still removes it

By: Sean Bright (seanbright) 2020-09-24 16:16:20.625-0500

The [attached patch|^0001-pbx.c-Allow-dashes-in-hint-extensions.patch] is the naive fix that appears to work in my very minimal testing. If someone else wants to test this more extensively and report results, please do.

By: Sean Bright (seanbright) 2020-09-24 16:18:02.590-0500

[~isrl], I am assigning to you because you are the most recent person to comment on the issue. You are not obligated to respond but it would be appreciated if you did.

By: isrl (isrl) 2020-09-24 17:53:37.504-0500

Thanks!!!!!
just tested on two machines and works perfect

By: ben kolodny (benphone) 2020-11-02 04:58:02.607-0600

is there any way to help this get merged ?
we had the system work good with this patch
thank s @Sean

By: Friendly Automation (friendly-automation) 2021-11-08 12:27:07.414-0600

Change 16695 merged by Friendly Automation:
pbx.c: Don't remove dashes from hints on reload.

[https://gerrit.asterisk.org/c/asterisk/+/16695|https://gerrit.asterisk.org/c/asterisk/+/16695]

By: Friendly Automation (friendly-automation) 2021-11-08 13:12:57.550-0600

Change 16662 merged by George Joseph:
pbx.c: Don't remove dashes from hints on reload.

[https://gerrit.asterisk.org/c/asterisk/+/16662|https://gerrit.asterisk.org/c/asterisk/+/16662]

By: Friendly Automation (friendly-automation) 2021-11-08 13:13:10.932-0600

Change 16694 merged by George Joseph:
pbx.c: Don't remove dashes from hints on reload.

[https://gerrit.asterisk.org/c/asterisk/+/16694|https://gerrit.asterisk.org/c/asterisk/+/16694]

By: Friendly Automation (friendly-automation) 2021-11-08 13:13:21.989-0600

Change 16696 merged by George Joseph:
pbx.c: Don't remove dashes from hints on reload.

[https://gerrit.asterisk.org/c/asterisk/+/16696|https://gerrit.asterisk.org/c/asterisk/+/16696]

By: Friendly Automation (friendly-automation) 2021-11-08 13:13:32.731-0600

Change 16697 merged by George Joseph:
pbx.c: Don't remove dashes from hints on reload.

[https://gerrit.asterisk.org/c/asterisk/+/16697|https://gerrit.asterisk.org/c/asterisk/+/16697]