Author Topic: Localhost as public...  (Read 4428 times)

snapple42

  • Newbie
  • *
  • Posts: 2
    • View Profile
Localhost as public...
« on: January 23, 2018, 11:54:46 AM »
Hi all.. we're having a real fun time with a small issue..

We're using Dialogic behind a firewall that won't send the external address to our proivder.

So, we're using Yate 5.5 as a proxy to send out and change the external address to something that will work.

So we have yate listening on port 5060, and Dialogic on port 5080 on the same machine (Windows machine, not my choice).

Problem is... Yate thinks 127.0.0.1 is a public address:

2018-01-23_11:38:16.171335 <INFO> Choosing offered 'audio' format 'alaw' [01DDE888]
2018-01-23_11:38:16.171335 <sip/4:ALL> Set media: audio=alaw [06358F98]
2018-01-23_11:38:16.171335 <sip/4:INFO> RTP NAT detected: private '10.172.70.20' public '127.0.0.1'
2018-01-23_11:38:16.171335 <yrtp:ALL> RTP/AVP message received
2018-01-23_11:38:16.171335 <yrtp:ALL> Wrapper 01D78100 found by CallEndpoint 06358F98

So yate is thinking it's going outside, and keeps sending the PUBLIC IP (instead of localhost or the machine's IP) Does anyone know why 127.0.0.1 is being considered a public address?

Any thoughts how to get around this?

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Localhost as public...
« Reply #1 on: January 25, 2018, 03:09:30 AM »
You may take a look at http://docs.yate.ro/wiki/Ysipchan

Check the 'rtp_localip' and 'nat_address' parameters

snapple42

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Localhost as public...
« Reply #2 on: January 25, 2018, 07:40:11 AM »
That was all set....

Think we found it in the code at the right spot, just didn't have time to fix it:

Code: [Select]
static bool isPrivateAddr(const String& host)
{
    if (host.startsWith("192.168.") || host.startsWith("169.254.") || host.startsWith("10."))
return true;
    String s(host);
    if (!s.startSkip("172.",false))
return false;
    int i = 0;
    s >> i;
    return (i >= 16) && (i <= 31) && s.startsWith(".");
}

MAY need (since 127.0.0.0 is reserved):

Code: [Select]
    if (host.startsWith("192.168.") || host.startsWith("169.254.") || host.startsWith("10.") || host.startsWith("127.0.0."))
return true;

But we haven't tested as the windows guy couldn't compile yate in time
« Last Edit: January 25, 2018, 02:50:11 PM by snapple42 »