Hello,

I think the refer-to can also have header parameters, then tobody transformation should be used, which offers directly {tobody.user}.

The name-addr is subset of to-body, in general using tobody transformation is safer when it is not sure there are header parameters or not.

Cheers,
Daniel

On Mon, Aug 14, 2023 at 2:47 PM Alex Balashov <abalashov@evaristesys.com> wrote:
Hello,

If I'm not mistaken, Refer-To is a name-address pair, so the best way to access the user part of the URI is:

   $(hdr(Refer-To){nameaddr.uri}{uri.user})

i.e.

   if($(hdr(Refer-To){nameaddr.uri}{uri.user}) =~ "^011")

-- Alex

> On Aug 13, 2023, at 8:57 PM, David Cunningham <dcunningham@voisonics.com> wrote:
>
> Hello,
>
> We want to check if the number in a REFER's Refer-To header begins with 011, and if so reject the request as not allowed. What would be the most effective way to do that?
>
> Thanks in advance,
>
> --
> David Cunningham, Voisonics Limited
> http://voisonics.com/
> USA: +1 213 221 1092
> New Zealand: +64 (0)28 2558 3782
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to sr-users-leave@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the sender!
> Edit mailing list options or unsubscribe:

--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com
Tel: +1-706-510-6800

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:


--