$hdr(Via)[i} don't work for you? Combine with the available transformations to get e.g. specific parts of the header.
--
Henning Westerholt –
https://skalatan.de/blog/
Kamailio services –
https://gilawa.com
> -----Original Message-----
> From: Benoit Panizzon via sr-users
sr-users@lists.kamailio.org
> Sent: Montag, 23. Dezember 2024 14:38
> To: sr-users@lists.kamailio.org
> Cc: Benoit Panizzon
benoit.panizzon@imp.ch
> Subject: [SR-Users] How to use @via[idx] ?
>
> Hi
>
>
https://www.kamailio.org/wikidocs/cookbooks/5.7.x/pseudovariables/#selname
> -selects
>
https://www.kamailio.org/wikidocs/cookbooks/5.7.x/selects/#viaihost
>
> I'm trying to list all via hosts:
>
> $var(dooh) = @via[1].host;
> xlog("L_INFO","******** VIA HOST 1: $var(dooh) \n");
>
> This above works as expected I get the 2nd entry.
>
> $var(i) = 0;
> while ($var(i) < $hflc(Via)) {
> $var(dooh) = @via[$var(i)].host;
> xlog("L_INFO","******** VIA HOST: $var(dooh) \n");
> $var(i) = $var(i) + 1;
> }
>
> This fails with syntax error.
>
> How do I specify the index of the via header I want to extract the host from?
>
> I also attempted $sel(via[$var(i)].host) or via[$var(i)] or $sel(hfl(via[$var(i)])).host
> but I found no variant not throwing an error.
>
> PS: Is there maybe another nice function to figure out if we have already seen
> (and how many times we have) this same message?
>
> Mit freundlichen Grüssen
>
> -Benoît Panizzon-
> --
> I m p r o W a r e A G - Leiter Commerce Kunden
> ______________________________________________________
>
> Zurlindenstrasse 29 Tel +41 61 826 93 00
> CH-4133 Pratteln Fax +41 61 826 93 01
> Schweiz Web
http://www.imp.ch
> ______________________________________________________
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions -- sr-
> users@lists.kamailio.org 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!