[SR-Users] Parsing diversion headers correctly

Federico Cabiddu federico.cabiddu at gmail.com
Sat Jun 25 08:45:50 CEST 2016


Hi Joel,
to the extract the username part of the last Diversion header you could
modify your last example like this:

$(hdr(Diversion)[-1]{nameaddr.uri}{uri.user})

Regards,

Federico

On Sat, Jun 25, 2016 at 3:23 AM, Joel Serrano | VOZELIA <joel at vozelia.com>
wrote:

> Hi,
>
> If you receive an INVITE with 2 diversion headers such as (in this order):
>
> Diversion: <sip:9975 at X.X.X.X:5060>;privacy=off;screen=no;
> reason=user-busy; counter=1
> Diversion: <sip:1234567890 at Z.Z.Z.Z:5060>;privacy=off;screen=no;
> reason=unknown; counter=1
>
> How is a nice way of extracting the user part from the URI of the last
> one? (in this case: 1234567890)
>
> Problems I have found:
>
> $(di{uri.user}) ---> Give mes the user part of the URI of the first
> header, in this case: 9975
>
> Is there a way to tell $di to get its value from the last header instead
> of the first one?
>
>
> This example works:
>
> $(hdr(Diversion)[-1]{param.name,0}{s.strip,1}{s.striptail,1}{uri.user})
>
> But I think it is very hacky...
>
> Any better approach anyone can suggest me?
>
>
> Thanks in advance.
>
> Best regards,
> Joel.
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160625/5d55ea3c/attachment.html>


More information about the sr-users mailing list