<div dir="ltr">Hi Joel,<div>to the extract the username part of the last Diversion header you could modify your last example like this:</div><div><br></div><div><span style="font-size:16px">$(hdr(Diversion)[-1]{nameaddr.uri}{uri.user})</span><br></div><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px">Regards,</span></div><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px">Federico</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 25, 2016 at 3:23 AM, Joel Serrano | VOZELIA <span dir="ltr"><<a href="mailto:joel@vozelia.com" target="_blank">joel@vozelia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
If you receive an INVITE with 2 diversion headers such as (in this order):<br>
<br>
Diversion: <sip:9975@X.X.X.X:5060>;privacy=off;screen=no; reason=user-busy; counter=1<br>
Diversion: <sip:1234567890@Z.Z.Z.Z:5060>;privacy=off;screen=no; reason=unknown; counter=1<br>
<br>
How is a nice way of extracting the user part from the URI of the last one? (in this case: 1234567890)<br>
<br>
Problems I have found:<br>
<br>
$(di{uri.user}) ---> Give mes the user part of the URI of the first header, in this case: 9975<br>
<br>
Is there a way to tell $di to get its value from the last header instead of the first one?<br>
<br>
<br>
This example works:<br>
<br>
$(hdr(Diversion)[-1]{<a href="http://param.name" rel="noreferrer" target="_blank">param.name</a>,0}{s.strip,1}{s.striptail,1}{uri.user})<br>
<br>
But I think it is very hacky...<br>
<br>
Any better approach anyone can suggest me?<br>
<br>
<br>
Thanks in advance.<br>
<br>
Best regards,<br>
Joel.<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div><br></div>