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: david.villasmil.work(a)gmail.com
phone: +34669448337
On Thu, Nov 21, 2019 at 6:11 AM Patrick Wakano <pwakano(a)gmail.com> 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
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users