THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#429 - dialplan: allow match/subst rules with variables
User who did this - Daniel-Constantin Mierla (miconda)
----------
I pushed to master branch an alternative implementation. It took a while to analyze the
patch, being quite big -- there are couple of issues that could have been fixed (such as:
module might be used by workers with negative rank, like timer or rpc -- there is a mi/rpc
command for translation; return at first pv detected in a string to mark it as a string
with vars; handling ending $ and allowing $$ in values), but the main issue is that
cloning data in private memory is not really feasible always, because can be tons of
dialplan db records. It would mean to have each process with a lot of pkg memory.
Only parsing of values can be cached (to have the broken down list of static strings and
variables). But given that parsed values have to be searched anyhow in a hash table, I
expected to be no real performance difference than parsing every time. Evaluating the
value at runtime, compiling and freeing PCRE have to be done for each attempt to match in
dialplan rules. Considering the complexity of managing a private cache of parsed values,
my patch is parsing the values at runtime, if they are detected to have variables at load
time.
In summary, the way it was done:
- detection stops at first variable found in a value -- the function has been added in
dialplan to cope properly with $ at the end of values
- each value for match and subst is marked with a flag during load if there is a var
inside it
- when it is a var in a value that ends with a single $, in memory it is stored with $$ at
the end (one more $ is added at the end), so at runtime the evaluation results in a single
$. It avoids keeping other flags and doing more conditions at runtime to cope with single
$ parsing
- parsing of values to tokenize variables is done at runtime, with compile of PCRE and
afferent freeing afterwards
- there is a module parameter 'match_dynamic' that has to be set to 1 in order to
enable this feature
Let me know if anyone has comments on this approach, if not, I will close this item.
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=429#comment1…
You are receiving this message because you have requested it from the Flyspray bugtracking
system. If you did not expect this message or don't want to receive mails in future,
you can change your notification settings at the URL shown above.