[Devel] formatted printing - unifying specifiers
Daniel-Constantin Mierla
daniel at voice-system.ro
Tue Jun 21 18:54:01 CEST 2005
Hello,
I send this mail to users@ mailing list, maybe someone gets a good
feedback how easy to use and intuitive is this proposal, since it is not
a technical issue.
We want to unify the format used by some modules to print specific items
-- mainly was xlog and now acc (to print extra information) and tm
(tw_append parameter -- to add extra info with t_write_fifo()).
We want to add support in avpops to be able to compose a string from
such specifiers and store it in an avp and to textops to be able to
search/replace dynamic strings.
Now, there are several ways to specify an item to be replaced by a value.
- xlog - the first that introduced specifiers, started from "printf"
model and uses "%" to mark the beginning of a specifier (%xx different
items, %{hdr_name} headers and %{:avp_name} avps).
- acc - started from avpops approach and uses avp/avp_name and hdr/hdr_name
- tm - uses avp[avp_name] and hdr[hdr_name]
It is time to bring them to same format to be easier and intuitive to
use. Our proposal is to use the "array" model:
- $avp[name] - to specify an avp via name or alias
- $hdr[name] - to specify a header
- $msg[name] - to specify specific parts of a SIP message (e.g., method,
request uri, status, body ...)
- $sys[name] - for anything that is not related to a sip message (e.g.,
time, pid ...)
Since there are important changes, the migration will be made in two steps.
1) move headers and avps to this format and keep the other dedicated
specifiers from xlog as they are ($ followed by two letters)
2) move the dedicated specifiers to the array the belong to
The big advantage is that once a new specifier is added it will be
visible in all modules, avoiding duplicated code and maintenance overhead.
Any feedback will be appreciated.
Daniel
More information about the Devel
mailing list