I'm having a strange problem with getting SER+RTPProxy to work when the
UA is behind NAT
Setup is as follows
UA --> NAT1 --> SER+RTPProxy --> NAT2 --> Asterisk
I've got RTPProxy running in "bridge" mode, gatewaying 'tween Asterisk
and the Public Internet
SIP traffic all routes perfectly. STUN enabled clients work perfectly.
The problem is that if the outbound port on NAT1 for the RTP stream is
*different* from the outbound port from the UA, then RTPProxy persists
in sending the packets to the UA port, *not* the NAT1 port.
e.g.
if the SDP payload from the UA contains
c=IN IP4 192.168.5.100
m=audio 16396 RTP/AVP....
but NAT1 sends the RTP stream out on port 64003, then rtpproxy sends the
media from Asterisk back to port 16393 at NAT1, instead of to port 64003
at NAT1!
Is it supposed to do this? Am I missing something really obvious?
The relevant section from ser.cfg is as follows
if (nat_uac_test("3")) {
if (method == "REGISTER" || ! search("^Record-Route:")) {
fix_nated_contact(); # Rewrite contact with source IP of signalling
if (method == "INVITE") {
fix_nated_sdp("1"); # Add direction=active to SDP
};
setflag(6); # Mark as NATed
};
};
rewritehostport("........");
if (force_rtp_proxy("FEI")) {
t_on_reply("4");
};
.
.
.
onreply_route[4] {
if (!(status=~"183" || status=~"200")) {
break;
};
fix_nated_contact();
force_rtp_proxy("F");
break;
}