[asterisk-bugs] [JIRA] (ASTERISK-25868) Sorcery "append to category" should allow filters

Asterisk Team (JIRA) noreply at issues.asterisk.org
Sun Mar 27 06:10:56 CDT 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-25868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=230034#comment-230034 ] 

Asterisk Team commented on ASTERISK-25868:
------------------------------------------

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].

> Sorcery "append to category" should allow filters
> -------------------------------------------------
>
>                 Key: ASTERISK-25868
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25868
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Sorcery
>    Affects Versions: 13.7.2
>         Environment: N/A
>            Reporter: Nick Repin
>
> Below is a typical FreePBX config with trunk "Callcentric", for which I am trying to add custom variable "forbidden_retry_interval". In other words, there are multiple categories with the same name ("Callcentric") but different types ("endpoint" vs "registration"), and one of the categories ("registration") needs to be appended.
> ==pjsip.conf==
> ...
> #include pjsip.endpoint.conf
>    ...
>    [Callcentric]
>    type=endpoint
>    ...
> ...
> #include pjsip.registration.conf
>    [Callcentric]
>    type=registration
>    ...
> ...
> #include pjsip.registration_custom_post.conf
>    [Trunk](+)
>    ;type=registration  ; This doesn't help
>    forbidden_retry_interval=600
> ==end==
> The problem is, Sorcery searches for the first category named "Callcentric" and tries to append to it. In the above example, the first category is of type "endpoint" which does not accept "forbidden_retry_interval", so Sorcery displays an error. As long as Asterisk allow duplicate names for categories of different types, it should allow appending to a specific category, otherwise it's a bug.
> The simplest fix is to modify main/config.c as follows:
> --original code --
>    } else if (!strcasecmp(cur, "+")) {
>       *cat = ast_category_get(cfg, catname, NULL);
> --new code--
>    } else if (cur[0] == '+') {
>       const char* filter = cur[1] ? (cur+1) : NULL;
>       *cat = ast_category_get(cfg, catname, filter);
> ---
> The above will allow a custom filter like this:
> [Callcentric](+type=registration)
> forbidden_retry_interval=600
> A full-blown fix needs more coding to allow the use of commas in the filter (since parsing is currently done with "strsep"), e.g:
> [Category]("+RegexValue1=RegexName1,RegexValue2=RegexName2",!,parent1,parent2)
> AppendedName=AppendedValue



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list