We have avp_copy on avpops module but we don’t have anything to copy xavps. ``` // copy all the content of an avp to a xavp $xavp(a[0]=>b) = $(avp(x)[*]); // deleting left content $xavp(a[0]=>b[*]) = $(avp(x)[*]); // copy xavp to a xavp with index $xavp(a[0]) = $xavp(b[1]); // all $xavp(a[*]) = $xavp(b[*]); // copy all content of a xavp to a avp $avp(x) = $xavp(a[0]=>b[*]); ```
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/7
dad1f24bee was related to this
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/7#issuecomment-164883851
Quick discussion - this issue is still valid. The many invalid references are from core dump files, which gets (incorrectly) picked up from github because of a lack of quoting.
Just looked at the option to use `xavp_params_implode` followed by `xavp_params_explode` no luck with that because `xavp_params_explode` will fail to parse emtpy params.
Example: `$xavp(x[0]=>y) = "";`
Will fail to parse because `y=;` is not supported.
I am looking at existing solution before considering code modification ...
@jchavanton - open a dedicated issue for the implode/explode with empty value, or a pull request if you want to fix it.
Ok, I will look at a fix and at the same time I could look further into reusing this code to provide an xavp_copy command
Some considerations - support the stack index in the source - clarify how this behaves with nested xavps - optionally look at adding the `/g` to copy the entire xavp stack
For future reference, I ended up making a PR that will let us copy xavps, I personally felt stuck without a clean and concise way to reorder xavp. The solution I am proposing will not copy the entire xavp stack and it will not support nested xavp this could probably be added later automatically from the core since I am using the xavp.c clone function. Will see what we find while reviewing. https://github.com/kamailio/kamailio/pull/2070
Closing, related code was just merged with #2070 .
Closed #7.