Hi again,

Well I have read a bit more about the modes and yes, we use brigde mode as
OpenSIPS is behind both sides of the NAT not only on the WAN side,
OpenSIPs is within the firewall,

So basically the engage_rtp_proxy is not a good idea.

route[1] {
if(!cache_fetch("local", "outerip_$var(destinationIp)", $avp(outerIp))) {
get_outer_ip("$var(destinationIp)", "$avp(outerIp)");
cache_store("local", "outerip_$var(destinationIp)", "$avp(outerIp)", 10);
}

$fs = $proto + ":" + $avp(outerIp);

if (is_method("BYE|CANCEL")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
if (has_body("application/sdp")) {
$var(trustconnectionip) = "%TRUSTCONNECTIONIP%";
$var(ciptrusted) = "no";
if ($var(trustconnectionip)=="yes") {
$var(ciptrusted) = "yes";
} else if ($var(trustconnectionip)=="auto") {
$var(sdpc) = $(rb{sdp.line,c}{s.substr,9,0});
if($td == $fd && $td != $var(sdpc)) {
$var(ciptrusted) = "yes";
}
}
if ($var(ciptrusted)=="yes") {
rtpproxy_offer("focnr");
} else {
rtpproxy_offer("focn");
}
}
}

# Prevent $var(destinationPort) from getting default port number 5060 for
TLS if no port specified in R-URI.
if($(ru{uri.port})=="" && $proto=="tls" && $var(destinationPort)=="5060") {
$var(destinationPort) = 5061;
}

# force the transport protocol to the same one the client used
$du =
"sip:"+$var(destinationIp)+":"+$var(destinationPort)+";transport="+$proto;

t_on_reply("1");

# for INVITEs enable some additional helper routes
if (is_method("INVITE")) {
t_on_failure("1");
}

if (!t_relay()) {
xlog("L_INFO", "Relay error");
sl_reply_error();
}
exit;
}

The route[1] is set in the main route under this conditions

if (has_totag()) {
# sequential request within a dialog should
# take the path determined by record-routing
if (loose_route()) {
$var(destinationIp) = $avp(requestIp);
$var(destinationPort) = $rp;

if (is_method("INVITE")) {
# even if in most of the cases is useless, do RR for
# re-INVITEs alos, as some buggy clients do change route set
# during the dialog.
record_route();
}
# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(1);
...
       exit;
}
....

And if there is no REGISTER, PUBLISH, CANCEL

route(1);
}
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to