Gosh, those VoIP specs need to be more friendly to NAT!
In short, as RFC standards does not state anything about NAT, the server assumes that the IP included with SDP packets is the true WAN IP of the client, which is not the case in NAT scenarios and leads to problems.
This is a temporary workaround for getting voice packets go through NAT in OpenBSC. It would fix the one way audio that many people are experiencing.
I might try branching out from the main code for proper NAT support. IMO it is pretty riciculous to assume that picocells are connected to the internet directly, haha.
NAT mangling does not work with translated ports, so you need to turn off port translation in some routers.
Edit the following code
abis_rsl.c :
static void ipac_parse_rtp(struct gsm_lchan *lchan, struct tlv_parsed *tv)
{
struct in_addr ip;
uint16_t port, conn_id;
if (TLVP_PRESENT(tv, RSL_IE_IPAC_LOCAL_IP)) {
ip.s_addr = tlvp_val32_unal(tv, RSL_IE_IPAC_LOCAL_IP);
DEBUGPC(DRSL, "LOCAL_IP=%s ", inet_ntoa(ip));
lchan->abis_ip.bound_ip = ntohl(ip.s_addr);
}
Add a section to replace the IP with proper one.
if (TLVP_PRESENT(tv, RSL_IE_IPAC_LOCAL_IP)) {
ip.s_addr = *((uint32_t *) TLVP_VAL(tv, RSL_IE_IPAC_LOCAL_IP));
if (strcmp(inet_ntoa(ip), "/*internal IP*/") == 0)
{
DEBUGP(DRSL, "Overwriting internal IP to a real one\n");
inet_aton("/*external IP*/", &ip);
}
DEBUGPC(DRSL, "LOCAL_IP=%s ", inet_ntoa(ip));
lchan->abis_ip.bound_ip = ntohl(ip.s_addr);
}
You should replace the internal IP with the internal IP of the nanoBTS. And external IP with the router’s IP as seen from the BSC