<p>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 <code>/</code> in the second parameter. It makes it support like:</p>
<pre><code>$var(se) = "/abc/xyz/";
avp_subst("$avp(x)", "$var(se)");
</code></pre>
<p>Right now it support PV in the replacement part of the subst expression, not allowing the match/regexp part.</p>
<p>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.</p>
<p>So we can have:</p>
<pre><code>avp_susbtx("$avp(x)", "/$fU/$rU/g");
</code></pre>
<p>Allowing also:</p>
<pre><code>$var(se) = "/" + $fU + "/" + $rU + "/";
avp_substx("$avp(x)", "$var(se)");
</code></pre>
<p>The new function can have a different name than avp_substx(), I used to exemplify here.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2158?email_source=notifications&email_token=ABO7UZKDOJ5X56GII25J3Y3QWT5B3A5CNFSM4JSV6QZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFTKFFA#issuecomment-560374420">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZLNG6H62Z6ELQDZJNLQWT5B3ANCNFSM4JSV6QZQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZJHPTSYXLS7GQSNO7LQWT5B3A5CNFSM4JSV6QZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFTKFFA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2158?email_source=notifications\u0026email_token=ABO7UZKDOJ5X56GII25J3Y3QWT5B3A5CNFSM4JSV6QZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFTKFFA#issuecomment-560374420",
"url": "https://github.com/kamailio/kamailio/pull/2158?email_source=notifications\u0026email_token=ABO7UZKDOJ5X56GII25J3Y3QWT5B3A5CNFSM4JSV6QZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFTKFFA#issuecomment-560374420",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>