daniel,
if i have understood correctly, current mtree implementation does not allow more than one value per node (prefix) in the three. it some cases it might make sense to have more that one value.
for example, if an mtree is used to map telephone numbers to values, one could have:
prefix value
0046 sweden 0046 nordic country 0046 eu member 0046 european country 00375 belarus 00375 european country
and when a telephone number, such as 004692345678 or 0037592345678 is matched, all values that the prefix has, would be assigned to an avp.
is is ok for you as author of mtree module, if i try to extend it so that a prefix could be associated with more than one value?
-- juha
Hi Juha,
for such case, I built a string with the values separated by semicolon (or other delimiter) and based on the needs, either I do search to match something or a break it with transformations or Lua scripts.
A native version would be good to have, but should be in the next devel cycle (3.3.0) -- we are in testing phase for 3.2.0. I prefer to refactor a bit, to cope better with major changes and specific structures -- at least the part with value type to be per tree and use xavps for such composed structures.
If you need it and code it, please push it to a personal branch on GIT for now.
Thanks, Daniel
On 8/25/11 8:55 PM, Juha Heinanen wrote:
daniel,
if i have understood correctly, current mtree implementation does not allow more than one value per node (prefix) in the three. it some cases it might make sense to have more that one value.
for example, if an mtree is used to map telephone numbers to values, one could have:
prefix value
0046 sweden 0046 nordic country 0046 eu member 0046 european country 00375 belarus 00375 european country
and when a telephone number, such as 004692345678 or 0037592345678 is matched, all values that the prefix has, would be assigned to an avp.
is is ok for you as author of mtree module, if i try to extend it so that a prefix could be associated with more than one value?
-- juha
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel-Constantin Mierla writes:
for such case, I built a string with the values separated by semicolon (or other delimiter) and based on the needs, either I do search to match something or a break it with transformations or Lua scripts.
yes, that kind of thing can be done, but is quite complicated in the script (especially when there can be many avps set each of which having delimiter separated values).
A native version would be good to have, but should be in the next devel cycle (3.3.0) -- we are in testing phase for 3.2.0. I prefer to refactor a bit, to cope better with major changes and specific structures -- at least the part with value type to be per tree and use xavps for such composed structures.
i didn't propose this to current master, but to the next one. i also would like to be able to specify if values in a tree are strings or ints. perhaps that is same what you mentioned in above?
If you need it and code it, please push it to a personal branch on GIT for now.
i'll try although i'm not sure if i'm able to handle the xavp implementation. besides, i didn't find in sr pv doc anything about xavps, i.e., how to use them in the script.
-- juha
Hello,
[...]
On 8/26/11 5:38 PM, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
i'll try although i'm not sure if i'm able to handle the xavp implementation. besides, i didn't find in sr pv doc anything about xavps, i.e., how to use them in the script.
there is a wiki page trying to present xavps a bit:
http://sip-router.org/wiki/devel/xavp
Cheers, Daniel
daniel,
i started to add support to mtree for integer values and allowing each node to have more that one value.
this would be much easier, it i would not need to support the currently undocumented MT_TREE_DW value type. can i drop MT_TREE_DW value type from the implementation or do you need it? if support for MT_TREE_DW is needed, it would be easier for me to leave the current module alone and write a new version of the module.
-- juha
Hello,
On 8/28/11 9:43 AM, Juha Heinanen wrote:
daniel,
i started to add support to mtree for integer values and allowing each node to have more that one value.
this would be much easier, it i would not need to support the currently undocumented MT_TREE_DW value type. can i drop MT_TREE_DW value type from the implementation or do you need it? if support for MT_TREE_DW is needed, it would be easier for me to leave the current module alone and write a new version of the module.
keep the MT_TREE_DW. The module should have to the flexibility of being able to deal with different modes, no matter of what kind, to be specified on a per tree basis -- an update for the next devel cycle. The current mode 1 is not only about storing integer values, but some sorting of the values as well. I don't think a new module makes sense, since such modes will be wanted there at some point ...
I was thinking to some generic design, like a profile for tree value type, to have: - a function for parsing before caching and store compiled value in tree (in a container structure) - a function for matching - meaning to add the matched value in a list - a sorting function for the list - a conversion from the internal list to config (e.g., to avp/pv/xavp) - a function to free the cached value (for shutdown cleanup)
... and maybe more as needed.
So adding a new type means implementing a generic interface, without messing with the tree structure and navigation through it.
Cheers, Daniel