Hi,
You can also inspect the SDP and look for private or public IPs and perform
some logic based on that.
sdp_get_line_startswith("$avp(sdp_media_ip)", "c=");
if (is_ip_rfc1918("$(avp(sdp_media_ip){s.select,2, })")) {}
The delimiter for the transformation is an empty space in this case.
Hope this helps.
Regards,
Grant
From: sr-users <[email protected]> On Behalf Of David
Villasmil
Sent: donderdag 21 november 2019 09:38
To: Kamailio (SER) - Users Mailing List <[email protected]>
Subject: Re: [SR-Users] How to retrieve local socket that will be used to send
a message from the branch route
[EXTERNAL EMAIL]
Hello,
I'm not sure this is the best or even the right way, but i do that by figuring
out where the call is coming from.
In my case, an INVITE from an RFC1918 IP address will always be internal to
external and vice versa.
i.e.:
# If the Source IP is an RFC1918 address, it's coming from an internal
endpoint, so the call is going out
if (is_ip_rfc1918("$si")) {
$dlg_var(rtp_direction) = "direction=internal direction=external";
} else {
$dlg_var(rtp_direction) = "direction=external direction=internal";
}
You may even check both origin and destination domain ($du) and configure
rtpengine accordingly.
onsend_route {
xlog("L_ERR", "[onsend_route] Packet going to $du\n" );
if (is_ip_rfc1918("$si") && is_ip_rfc1918("$du") ) {
# call is internal to internal
} else if (is_ip_rfc1918("$si") && !is_ip_rfc1918("$du")) {
# call is internal to external
} else if (!is_ip_rfc1918("$si") && !is_ip_rfc1918("$du")) {
# call is external to external
} else if (!is_ip_rfc1918("$si") && is_ip_rfc1918("$du")) {
# call is external to internal
}
}
Hope that makes sense and help you a little.
Regards,
David Villasmil
email: [email protected]<mailto:[email protected]>
phone: +34669448337
On Thu, Nov 21, 2019 at 6:11 AM Patrick Wakano
<[email protected]<mailto:[email protected]>> wrote:
Hello list,
Hope you are all doing well!
I am trying to figure out a way to retrieve the local socket the t_relay() has
decided to use in a mhomed=1 env. Is there a way to do that? I couldn't find
any variable other than the $snd ones that maybe have this info, but I am not
using onsend_route anyway.....
I am after this value because this is what I can use to figure out if I need to
engage RTPEngine with parameters "external, internal", "external, external",
"internal, external" or "internal, internal". In my case, my server is in
between two networks, and calls can traverse or can be routed back to the same
interface depending on what was decide by the LCR module. Signalling is fine,
but engaging the RTPEngine must be done with the correct parameters to get the
correct IPs in the SDP, other else I get one way audio in the call.....
Any help is much appreciated!
Thank you!
Kind regards,
Patrick Wakano
_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]<mailto:[email protected]>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users