Jeff-Lewis / telephone

Automatically exported from code.google.com/p/telephone
Other
0 stars 0 forks source link

The 'Contact' field is getting an internal IP address on Snow Leopard #267

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start VMWare on OSX
2. Start Telephone
3. Try to register with a voip.ms

What is the expected output? What do you see instead?
I expected that my 'outside' (PPP) address would be used in the 'Contact'
header, however an internal IP address (172.16.107.1) was used instead.

What version of the product are you using? On what operating system?
SVN rev 984, snow leopard 10.6.2.

Please provide any additional information below.
The REGISTER request to VOIP.MS has a bad 'contact' address, apparently
voip.ms cares about this. In this case I was using a PPP (Sprint) wireless
adapter as my internet connection and I had VMWare running an unrelated
application. Vmware creates several internal network interfaces and one of
these was getting chosen as my 'Contact' IP address. The end result is no
response whatsoever from voip.ms (I'm guessing it was trying to talk back
to the 172.xxx internal address).

Here's the REGISTER packet as seen by tcpdump:

No.     Time        Source                Destination           Protocol Info
      1 0.000000    99.203.219.182        209.62.1.2            SIP     
Request: REGISTER sip:209.62.1.2

Frame 1 (523 bytes on wire, 523 bytes captured)
    Arrival Time: Dec 20, 2009 12:18:24.230386000
    [Time delta from previous captured frame: 0.000000000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
    [Time since reference or first frame: 0.000000000 seconds]
    Frame Number: 1
    Frame Length: 523 bytes
    Capture Length: 523 bytes
    [Frame is marked: False]
    [Protocols in frame: ppp:ip:udp:sip]
    [Coloring Rule Name: UDP]
    [Coloring Rule String: udp]
Point-to-Point Protocol
    Address: 0xff
    Control: 0x03
    Protocol: IP (0x0021)
Internet Protocol, Src: 99.203.219.182 (99.203.219.182), Dst: 209.62.1.2
(209.62.1.2)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 519
    Identification: 0x0085 (133)
    Flags: 0x00
        0.. = Reserved bit: Not set
        .0. = Don't fragment: Not set
        ..0 = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: UDP (0x11)
    Header checksum: 0x669f [correct]
        [Good: True]
        [Bad: False]
    Source: 99.203.219.182 (99.203.219.182)
    Destination: 209.62.1.2 (209.62.1.2)
User Datagram Protocol, Src Port: 60244 (60244), Dst Port: sip (5060)
    Source port: 60244 (60244)
    Destination port: sip (5060)
    Length: 499
    Checksum: 0x1470 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
Session Initiation Protocol
    Request-Line: REGISTER sip:209.62.1.2 SIP/2.0
        Method: REGISTER
        Request-URI: sip:209.62.1.2
            Request-URI Host Part: 209.62.1.2
        [Resent Packet: False]
    Message Header
        Via: SIP/2.0/UDP
172.16.107.1:60244;rport;branch=z9hG4bKPjO489IxHcDr8qOSWcJ.fs2jqaerKWBxHd
            Transport: UDP
            Sent-by Address: 172.16.107.1
            Sent-by port: 60244
            RPort: rport
            Branch: z9hG4bKPjO489IxHcDr8qOSWcJ.fs2jqaerKWBxHd
        Route: <sip:209.62.1.2;lr>
        Max-Forwards: 70
        From: "Voip.ms"
<sip:XXXXXX_hotdog@209.62.1.2>;tag=z8ZBG814UCZN3MTuAoXcX8mK5N33RgCL
            SIP Display info: "Voip.ms" 
            SIP from address: sip:XXXXXX_hotdog@209.62.1.2
                SIP from address User Part: XXXXXX_hotdog
                SIP from address Host Part: 209.62.1.2
            SIP tag: z8ZBG814UCZN3MTuAoXcX8mK5N33RgCL
        To: "Voip.ms" <sip:XXXXXX_hotdog@209.62.1.2>
            SIP Display info: "Voip.ms" 
            SIP to address: sip:XXXXXX_hotdog@209.62.1.2
                SIP to address User Part: XXXXXX_hotdog
                SIP to address Host Part: 209.62.1.2
        Call-ID: 8dUi1OGVv.akYoaDtQKj3yha55o0oL5v
        CSeq: 3151 REGISTER
            Sequence Number: 3151
            Method: REGISTER
        User-Agent: Telephone 0.14.3
        Contact: "Voip.ms" <sip:XXXXXX_hotdog@172.16.107.1:60244>
            Contact Binding: "Voip.ms" <sip:XXXXXX_hotdog@172.16.107.1:60244>
                URI: "Voip.ms" <sip:XXXXXX_hotdog@172.16.107.1:60244>
                    SIP Display info: "Voip.ms"
                    SIP contact address: sip:XXXXXX_hotdog@172.16.107.1:60244
        Expires: 300
        Content-Length:  0

Original issue reported on code.google.com by evarsa...@gmail.com on 3 Jan 2010 at 10:58

GoogleCodeExporter commented 9 years ago
FWIW everything works fine if I shut down vmware and use the airport (en1) as my
primary connection.

Original comment by evarsa...@gmail.com on 4 Jan 2010 at 2:58

GoogleCodeExporter commented 9 years ago
While the next release of Telephone should use better IP detection algorithm 
(from pjsip), it’s usually not a 
problem. If your provider’s doing NAT traversal at the server side, it should 
work with any proper internal IP 
address (192..., 172..., 10...). If it doesn’t, you’d better use STUN. In 
your case I would try to change VMware’s IP 
range to exclude the possible conflict with the provider’s internal address 
space, or try to configure Telephone 
with a STUN server.

Does your provider tell anything about STUN (NAT traversal from the client 
side)?

Original comment by eofs...@gmail.com on 4 Jan 2010 at 10:06

GoogleCodeExporter commented 9 years ago
I was trying with and without NAT traversal at the provider side (voip.ms) just 
in
case, but that didn't make a difference.

There's no NAT in this configuration, the Mac has several interfaces and PPP0 
(the
default route) is going out to the internet unnatted. The problem is the Contact
field in the SIP header pjsip creates and sends to the voip provider is from 
another
interface (which is not the default route -- the vmware interface which is 
internal
only). The private address on the vmware internal NAT setup should have no 
bearing on
the call, Telephone is running on the outer operating system and the default 
route is
via a direct unnatted path.

I looked at the code in pjsip for a while but couldn't find where it determines 
'the
local IP' to fill in the contact field immediately. Presumably it gets a list 
of the
interfaces with the usual ioctl then goes through them and tries to figure out 
which
one serves the default route or the route to the end we're trying to call if its
fancy. I suspect that algorithm is flawed or too simplistic to work correctly 
on a
multi-homed host.

Original comment by evarsa...@gmail.com on 11 Jan 2010 at 4:58

GoogleCodeExporter commented 9 years ago
I understand what you’re saying, but in real life, almost always when using 
softphones, it doesn’t matter what 
address is announced in the Contact field. In the beginning, of course, that 
was exactly the place for the address 
where user agents were expecting packets. But nowadays SIP providers pay 
attention to the real address your 
requests came from, not the address from the Contact field. They send replies 
to that real IP address, which 
allows them to solve a NAT problem, and, coincidentally, our problem.

pjsip selects the IP address at it’s initialization, which often occurs when 
application launches. At that time PPP 
interfaces may be down and not configured yet. STUN and NAT fix at provider’s 
side—these are two ways to solve 
that.

I’ve noticed that voip.ms has an option ‘Device type’ with the default 
value ‘IP PBX Server, Asterisk or Softswitch’. 
Could you please try setting it to ‘ATA device, IP Phone or Softphone’ if 
you haven’t done that already.

Original comment by eofs...@gmail.com on 11 Jan 2010 at 8:02

GoogleCodeExporter commented 9 years ago
And please make sure you have ‘NAT’ set to ‘yes’.

Original comment by eofs...@gmail.com on 11 Jan 2010 at 8:41

GoogleCodeExporter commented 9 years ago
I am using a sub account on voip.ms with it set to IP phone. I tried
it with NAT turned on and off and tcpdump shows responses coming
back when the Contact field is correct and nothing coming back (for
the register request) when the contact field has the bogus internal
address on it. I tried several of their pops as well (Dallas, LA,
and one other).

I captured working and non-working register requests when I ran
into this in late December and compared the packets and I *thought*
the only difference was the Contact field (when I saw it was one
of my vmware interfaces I shut down vmware and everything worked
fine). I might have missed some other difference, I'll set up another
test and try to reproduce it all again with NAT on and off.

Thanks,
-Eric

Description     Hotdog
Secret          xxxxxxxx
Protocol        SIP
Authentication type Register
Allowed Codecs      ulaw;g729
Device Type     ATA, IP Phone or Soft phone
CallerID Number     xxxxxxxxxx
NAT         no (tried yes too)
DTMF Mode       auto
International Route Value
Internal Extension  none
Internal Extension Voicemail none
Internal Dial Time n/a
External SIP URI none
Edit this Sub Account - Delete this Sub Account

Original comment by evarsa...@gmail.com on 20 Jan 2010 at 5:20