Hi
https://www.kamailio.org/wikidocs/cookbooks/5.7.x/pseudovariables/#selname-s... 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-
Hello Benoit,
$hdr(Via)[i} don't work for you? Combine with the available transformations to get e.g. specific parts of the header.
Cheers,
Henning
Hi Henning
$hdr(Via)[i} don't work for you? Combine with the available transformations to get e.g. specific parts of the header.
Ended up with: $var(viahost) = $(hfl(Via)[$var(i)]{s.select,0,;}{s.select,1, });
Which return host or host:port
Now I would like to test if this contains one of myself ip addresses.
But if_myself() seems to expect an URI. Any hints?
Mit freundlichen Grüssen
-Benoît Panizzon-
Are you trying to do loop detection? If so, how about Max-Forwards?
On Dec 23, 2024, at 8:38 am, Benoit Panizzon via sr-users sr-users@lists.kamailio.org wrote:
Hi
https://www.kamailio.org/wikidocs/cookbooks/5.7.x/pseudovariables/#selname-s... 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!
Hi Alex
Are you trying to do loop detection? If so, how about Max-Forwards?
I attempt to find a way, without using the dialog module, to determine in which loop I am.
The same old issue I am still desperately trying to solve:
Two customer behind the SAME Registrar.
CPE A => Kam Registrar => Kam Core => Kam Registrar => CPE B
I want to be able to find out, if I work on messages/replies in a transaction to CPE A or in a transaction to CPE B.
It looks like this is required to make rtpengine (on the Registrar) work by adding some counter to the callid or fromtag or whatever so rtpengine does not confuse the two different invocations.
If anyone has any idea how to solve this in a simpler way I would really love to know how.
Not routing the call via Core is not an option (core does billing, routing and dialog handling and has interconnections to other telcos, besides the registrar is intentionally 'dumb' and does not know how to route calls).
What could work (I am not sure if it would) looking at for example the first invite is if there would be a way to only keep the 2nd one.
eg:
INVITE CPE A => Registrar => Core
rtpengine processing 'offer' from A to CORE
INVITE CORE => Registrar => CPE B
rtpengine processing 'offer' from CORE to B
if this 2nc offer could 'overwrite' the first one received this may work. It does not work(*1) the way the built-in rtpengine loop detection works by just ignoring subsequent offers after the first one was received.
(*1) Maybe I have to explain what fails...
A CPE might be connected via IPv6. Interconnections with other telcos still run via legacy IPv4 same with most of the registered CPE.
So when CPE A calls with ipv6 I add address-family=IP4 to ensure that the core is getting an IPv4 SDP. But when CPE B has an IPv6 contact registered I need to set address-family=IP6 to ensure it is getting an IPv6 SDP.
If the 2nd invocation of rtpengine is dropped (actual rtpengine loop detection behavior), IPv6 CPE B is getting an IPv4 SDP.
If the 2nd invocation of rtpengine would replace the 1st invocation, then maybe, thinks could work out just fine.
Offering ICE is helping - only there are CPE which do not support ICE and therefore 488 a SDP with an unsupported protocol in the c= line even if ICE would offer a supported one.
Mit freundlichen Grüssen
-Benoît Panizzon-
Am Mon, 23 Dec 2024 16:18:46 +0100 schrieb Benoit Panizzon via sr-users sr-users@lists.kamailio.org:
If the 2nd invocation of rtpengine is dropped (actual rtpengine loop detection behavior), IPv6 CPE B is getting an IPv4 SDP.
If the 2nd invocation of rtpengine would replace the 1st invocation, then maybe, thinks could work out just fine.
Nah, this would never work, the 2nd invocation receives the ip and port set by the 1st invocation, so this has to stay active to pass on RTP.
This needs two separate rtpengine invocations, right?
Mit freundlichen Grüssen
-Benoît Panizzon-