[OpenSIPS-Users] check_source_address()
Liviu Chircu
liviu at opensips.org
Thu Apr 25 09:06:31 EDT 2019
On 24.04.2019 20:10, Mark Farmer wrote:
> Sure, I'll send the pcap off list.
It seems you are performing an interface switching operation when
routing out,
which leads to a double Record-Route header. While this is completely fine,
you should be aware that OpenSIPS handles a double RR'ed mid-dialog
request by
routing the request to itself exactly once, as it consumes the top-level
Route
header field.
So, you definitely don't have to provision and mark OpenSIPS as a trunk,
since
that will likely break some other logic of your script (e.g. I see it
now returns
404 in the pcap). Rather, just extend your possible sources of traffic
and keep
applying loose_route() to those mid-dialog requests, then route them out:
if (check_source_address("1","$avp(trunk_attrs)")) {
# request comes from trunks
xlog ("MF - $rm FROM $avp(trunk_attrs)");
setflag(IS_TRUNK);
} else if (has_totag() && is_myself("$si")) {
setflag(IS_MYSELF);
} else {
send_reply("403", "Forbidden");
exit;
}
if (has_totag()) {
...
if (!loose_route())
send_reply("404", "Not Here");
else
t_relay();
exit;
}
Regards,
--
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
More information about the Users
mailing list