[OpenSIPS-Users] Parse P-Asserted-Identity

Ben Newlin Ben.Newlin at genesys.com
Mon Nov 29 14:39:48 EST 2021


Mickael,

The PAI header is not just a parameter list, so you can’t use that transformation directly. The PAI header follows the name-addr spec and the params are part of the URI. So it would be something like one of the following.

$(ai{uri.param,privacy}) [1]
$(ai{nameaddr.param, privacy}) [2]

You may even have to combine the two if the parameters are associated with the uri in the name-addr:

$(ai{nameaddr.uri}{uri.param,privacy})

You should try printing out things like $(ai{nameaddr.uri}) or $(ai{uri.params}) to see what you get and help narrow down where the parameters are located. I always get confused by uri params vs host params vs name-addr params.

I will point out that the P-Asserted-Identity spec doesn’t actually define a privacy parameter like this. Privacy for PAI is indicated by the Privacy header, which is a separate header. For indicating privacy of the PAI header contents, the Privacy header should have a value of “id”. In fact, these parameters all seem to be ones typically used with the Remote-Party-ID (RPID) header, not the PAI header. [3] [4] [5]

You can check the presence and value of the Privacy header with something like this:

if (is_present_hf("Privacy") && ($hdr(Privacy) =~ "id|user")) {
  // do stuff
}

[1] https://www.opensips.org/Documentation/Script-Tran-3-2#toc38
[2] https://www.opensips.org/Documentation/Script-Tran-3-2#toc70
[3] https://datatracker.ietf.org/doc/html/rfc3325
[4] https://datatracker.ietf.org/doc/html/rfc3323
[5] https://datatracker.ietf.org/doc/html/draft-ietf-sip-privacy-04

Ben Newlin

From: Users <users-bounces at lists.opensips.org> on behalf of Mickael MONSIEUR <mickael.monsieur at gmail.com>
Date: Monday, November 29, 2021 at 9:32 AM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Parse P-Asserted-Identity
No more result with:
xlog("L_NOTICE","P-Asserted-Identity param =
$(hdr(P-Asserted-Identity){param.value,privacy})\n");

Nov 29 14:17:13 [16103] P-Asserted-Identity param = <null>

Le lun. 29 nov. 2021 à 13:44, Mickael MONSIEUR
<mickael.monsieur at gmail.com> a écrit :
>
> Hello,
>
> xlog("L_NOTICE","P-Asserted-Identity params = $(ai{param.value,privacy})\n");
>
> Nov 29 13:43:34 [15988] P-Asserted-Identity params = <null>
>
> Le lun. 29 nov. 2021 à 13:32, David Villasmil
> <david.villasmil.work at gmail.com> a écrit :
> >
> > https://www.opensips.org/Documentation/Script-Tran-2-4#toc60
> >
> > Regards,
> >
> > David Villasmil
> > email: david.villasmil.work at gmail.com
> > phone: +34669448337
> >
> >
> > On Mon, Nov 29, 2021 at 12:22 PM Mickael MONSIEUR <mickael.monsieur at gmail.com> wrote:
> >>
> >> Hello,
> >>
> >> My provider add to my INVITE's :
> >>
> >> P-Asserted-Identity: "Anonymous"
> >> <sip:+xxxxxxx at sbc.provider.com>;party=calling;privacy=yes;screen=no
> >>
> >> Whether the call should be Anonymized to end-users.
> >>
> >> How to get the value of "privacy" ?
> >>
> >> I try:
> >>
> >> if( $(ai{privacy}) == "yes" )
> >>
> >> But it does not work. (error when starting opensips)
> >>
> >> Thanks
> >>
> >> _______________________________________________
> >> Users mailing list
> >> Users at lists.opensips.org
> >> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20211129/ef46182b/attachment.html>


More information about the Users mailing list