[asterisk-bugs] [JIRA] (ASTERISK-25868) Sorcery "append to category" should allow filters
George Joseph (JIRA)
noreply at issues.asterisk.org
Sat Apr 23 17:44:56 CDT 2016
[ https://issues.asterisk.org/jira/browse/ASTERISK-25868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=230368#comment-230368 ]
George Joseph commented on ASTERISK-25868:
------------------------------------------
Yeah, that was left over from an earlier version of the patch. It's harmless and will be corrected shortly.
> 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/Configuration
> Affects Versions: 13.7.2, 13.8.0-rc1
> Environment: N/A
> Reporter: Nick Repin
> Assignee: Unassigned
> Severity: Minor
>
> 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==
> {noformat}
> ...
> #include pjsip.endpoint.conf
> ...
> [Callcentric]
> type=endpoint
> ...
> ...
> #include pjsip.registration.conf
> [Callcentric]
> type=registration
> ...
> ...
> #include pjsip.registration_custom_post.conf
> [Callcentric](+)
> ;type=registration ; This doesn't help
> forbidden_retry_interval=600
> {noformat}
> ==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 allows duplicate names for categories of different types, it should allow appending to a specific category, otherwise it's a bug. In case of FreePBX, the bug makes it impossible to add custom variables to pjsip.conf for SIP trunks and extensions.
> The simplest fix is to change main/config.c as follows:
> {noformat}
> --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);
> ---
> {noformat}
> The above will allow a custom filter like this:
> {noformat}
> [Callcentric](+type=registration)
> forbidden_retry_interval=600
> {noformat}
> 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:
> {noformat}
> [Category]("+RegexValue1=RegexName1,RegexValue2=RegexName2",!,parent1,parent2)
> AppendedName=AppendedValue
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list