Problem with incoming calls with ATA device

Discussion in '3CX Phone System - General' started by edossantos, Jun 27, 2007.

  1. edossantos

    edossantos Member
    3CX Staff

    Joined:
    Jun 27, 2007
    Messages:
    255
    Likes Received:
    6
    I have a 3CX in my office behind a router/firewall/NAT. And I'm trying to use an analog phone at my home with a FXS ATA device (Grandstream HandyTone 286).
    The extension I'm using is marked as "Extension is external" in 3CX. When incoming calls arrive (calls from 3CX to the ATA device), the Via header of the INVITE message has the internal IP address instead of the public (STUN resolved) IP address. The ATA device is trying to send responses to the internal IP address, so responses never arrive to 3CX.
    Is there any way to make 3CX use the public IP address in the Via header, when the extension is external?
    Thanks in advance.
     
  2. Anonymous

    Anonymous Guest

    Mate you got me all confused...... (that happens easy on my old age, my kids do it all the time).

    Let me see if I understand this:

    - 3CX is in your office
    - At home you have an ata and want to use that to connect to the 3cx box
    - On you 3cx box you have an extension that talks to your ATA

    Best way to do this is to setup a VPN.


    Wat you want to do you can do with an Line configuration and use the IP in the contact field. (I think, not sure about this actually never tried it), but I do not think you can control the IP in the Invite.

    I could be wrong though, this would be handy actually for a few of us who have a static IP. Perhaps something for 3cx to look into, the ability to bind an extension to an IP address instead of binding it to a number.
     
  3. edossantos

    edossantos Member
    3CX Staff

    Joined:
    Jun 27, 2007
    Messages:
    255
    Likes Received:
    6
    Hi Henk,

    Thanks for your reply. The network arquitecture is just like you said. But I prefer not using a VPN, because I need to connect to 3CX from different remote locations, and I can't configure a VPN in every endpoint.

    My ATA device is registering successfully, and I can make outbound calls. In that way (from ATA to 3CX), messages are flowing well.

    The problem appears when messages come from 3CX to my remote ATA device. Unfortunately I think the problem could be a 3CX bug (I hope to be wrong)... When "Extension is external" and "Bind to Media Server" are checked, I think the "Via" header of the INVITE message generated by 3CX should contain the public IP address (STUN resolved). In fact, the IP address of the Contact field contains the public IP address. But the local LAN IP address is in the "Via" header. That causes the remote ATA device to answer the INVITE message to that invalid IP address (invalid in the remote site). And responses never arrive to 3CX...

    I have some knowledge on SIP, and it seems the ATA device is right in what it's doing. Take a look at RFC3261 (8.1.1.7 Via and 8.1.1.8 Contact). Responses must be sent to the IP address in the Via header. Contact header is there just to know where to contact that User Agent for subsequent requests.

    I don't know if that may be changed by configuration. Any idea?

    Thanks.
    Ernesto.
     
  4. archie

    archie Well-Known Member
    3CX Staff

    Joined:
    Aug 18, 2006
    Messages:
    1,309
    Likes Received:
    0
    It is NOT said, that address in Via MUST be global. It just IDENTFIES the localtion where the response is to be sent. And, in our case, it does identify.
    UAS should not send response to Via address (or point me in RFC where it is said).
    Contact MUST have global IP, and it does. So, I doubt that is our bug.
    Anyway, thank you for pointing out, I will dig deeper into this to make final conclusion on this matter.
     
  5. DaKhalli

    DaKhalli New Member

    Joined:
    Jun 2, 2007
    Messages:
    123
    Likes Received:
    0
    for my external softphone to work, the only thing i did was portforward the sip ports to the corresponding ip of my laptop @ home. (talking bout the router at home) and add a stun server to the softphones config.


    no vpn needed, it registers perfectly and audio works as a charm.

    btw, connecting to the dyndns adress of my server in the office so no ip data needed for a call. as support team said.
     
  6. edossantos

    edossantos Member
    3CX Staff

    Joined:
    Jun 27, 2007
    Messages:
    255
    Likes Received:
    6
    Archie,

    You made a great job with 3CX, I'm just trying to help you make it still better. I was reading deeply the RFC, and section 18.2.2 fully describes the procedure for sending responses from UAS: Responses must be sent to the IP address pointed in the Via header only when the request came from that IP address. That means that the response must always be sent to the IP address of the incoming request packet.

    That means that 3CX is working well, and the bug is in the ATA device I'm using. In fact, using SJPhone instead of the ATA device I can make outgoing calls and receive incoming calls without any problem.

    Anyway, I think that if 3CX completes the Via header with the public IP address resolved by STUN (when the extension is marked as external), it could interoperate with many more equipment. And it would be SIP compliant too. There are lots of guys like me using HandyTone 286, and no one will get it to work in scenarios like this.

    Thanks.
    Ernesto.
     
  7. archie

    archie Well-Known Member
    3CX Staff

    Joined:
    Aug 18, 2006
    Messages:
    1,309
    Likes Received:
    0
    3CX PBX already IS SIP compliant, and this compliance is guaranteed by SIP stack we're using (reSIProcate). Moreover, if I put externally visible STUN resolved IP to Via (I can do it) we will lose compatibility with Cisco router with embedded SIP proxy, because it uses Via to send responses back to UAC. And we don't want to lose such compatibility, because Cisco is not cheap device. Also, it is possible that some software proxies uses this technique to route responses. So, if I'll try to adjust our system to some unusually working devices - I can lose compatibility with widespread and well-known devices.
    I will tell you more. I'm 80% sure that your problem arised not because your ATA sends responses to Via, but because you have some routing or mapping problem. Or, may be this behaviour is configurable in ATA. If you have time and desire you can try some SIP-generating utilities (like SipP) to forge a SIP INVITE with different Via's, and check to where responses are sent. Than you can be sure your device actually uses Via.
    I will think about making this behaviour configurable. I mean (probably) I will add ability to set an option to send local or external address in Via.
     
  8. edossantos

    edossantos Member
    3CX Staff

    Joined:
    Jun 27, 2007
    Messages:
    255
    Likes Received:
    6
    Hi Archie,

    I'm quite sure the problem is the ATA device sending responses to the IP address in the Via header of the INVITE message. I traced it with ethereal, and I'm seeing the packets being sent to the wrong IP address, so there isn't any router/firewall/NAT problem. There is just one place in the incoming INVITE message mentioning the internal IP address, and it's the Via header. Anyway, I will try with simulated traffic and see what happens.

    It would be very useful to have the ability to configure this behavior in 3CX. Many SMBs don't have a Session Border Controller (like the Cisco router you mentioned), and that would help interoperability in those cases.

    Thanks.
    Ernesto.
     

Share This Page