[sr-dev] [kamailio/kamailio] avpops: avp_subst() support pvar as subst parameter (#2158)

Daniel-Constantin Mierla notifications at github.com
Mon Dec 2 13:25:01 CET 2019


Looking further at this patch, it requires to have the second parameter as a single variable to be considered with "pvar" support, because I see you search for `/` in the second parameter. It makes it support like:

```
$var(se) = "/abc/xyz/";
avp_subst("$avp(x)", "$var(se)");
```

Right now it support PV in the replacement part of the subst expression, not allowing the match/regexp part.

Maybe is better to just add a new function that will always evaluate the subst parameter with variables, allowing more flexible format for subst parameter. At the end, you just need to have your added code in a dedicated function that evaluates first the parameter and then compiles the subst expression.

So we can have:

```
avp_susbtx("$avp(x)", "/$fU/$rU/g");
```
Allowing also:

```
$var(se) = "/" + $fU + "/" + $rU + "/";
avp_substx("$avp(x)", "$var(se)");
```
The new function can have a different name than avp_substx(), I used to exemplify here.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2158#issuecomment-560374420
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20191202/94ab31ad/attachment.html>


More information about the sr-dev mailing list