Asterisk not registering to provider, but softphone does.



  • I've been searching how to make my asterisk server(Asterisk 1.6.2.9-2+squeeze5) work with pfsense(2.0.1-RELEASE  (i386)) using SIP for the past 5 hours and every solution and recommendations from posts in this forum have failed me.

    By following this: http://doc.pfsense.org/index.php/Asterisk_VoIP  and setting the outbound to manual with this added mapping: WAN  192.168.1.0/24 udp/5060 * udp/5060 * * YES
    I managed to make my softphone(Linphone 3.5.2 on a windows xp machine) register directly to my VOIP provider(unlimitel.ca).
    I can send and receive calls(took me a while to get both at the same time) and it show up in the Registered Phones section of siproxd.
    But when I try with my asterisk server, it always timeout, even if I close the softphone so that it becomes the only active SIP connection.

    I tried changing the port to 5080, which seemed to be a popular solution, but it still failed and I tried Changing these: http://doc.pfsense.org/index.php/VoIP_Configuration
    But it still won't register.

    I rebooted both asterisk and the router and reloaded my sip config more times than I can count, still with no success.

    I'm pretty much out of ideas and posting here is pretty much my last resort before trying another router/firewall distro.



  • Have you tried doing a packet capture on your WAN interface to see what SIP requests are being sent to your VoIP provider, and what the response to these requests are, if any?

    Since you're stating "it always timeout" I'm assuming you are not getting any response whatsoever from your provider, but it would be nice to get this confirmed.

    Perhaps it would be worthwhile to get a packet capture from your WAN interface containing both a REGISTER request from your softphone and from Asterisk, and compare the two, since the first one is working and the latter is not?

    I would be happy to take a look if you post the capture here or send me by PM.

    • Andreas


  • Turns out my asterisk server doesn't even reach the wan interface, it doesn't go further than the LAN one:

    11:10:40.747911 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 418
    11:10:41.748023 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 418
    11:10:43.748233 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 418
    11:10:47.748617 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 418
    11:10:51.749001 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 418
    11:10:55.749385 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 418
    11:10:59.800043 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 418
    11:11:00.799187 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 418
    

    And here what the softphone does on the WAN(11.11.11.11 being my WAN IP):

    11:04:56.775563 IP 209.217.98.194.5060 > 11.11.11.11.5060: UDP, length 537
    11:04:57.776354 IP 209.217.98.194.5060 > 11.11.11.11.5060: UDP, length 537
    11:04:58.775918 IP 209.217.98.194.5060 > 11.11.11.11.5060: UDP, length 537
    11:04:59.185321 IP 11.11.11.11.5060 > 209.217.98.194.5060: UDP, length 430
    11:04:59.218913 IP 209.217.98.194.5060 > 11.11.11.11.5060: UDP, length 567
    11:04:59.305823 IP 11.11.11.11.5060 > 209.217.98.194.5060: UDP, length 605
    11:04:59.341830 IP 209.217.98.194.5060 > 11.11.11.11.5060: UDP, length 537
    11:04:59.343091 IP 209.217.98.194.5060 > 11.11.11.11.5060: UDP, length 581
    11:04:59.355200 IP 11.11.11.11.5060 > 209.217.98.194.5060: UDP, length 466
    


  • What happens if you disable siproxd? Does the Asterisk traffic hit the WAN interface then?

    I assume you have a firewall rule on LAN allowing outbound UDP traffic for the Asterisk host?

    Anything useful in the system or firewall log regarding the Asterisk traffic?



  • Wow, I can't believe I never tried that combination before. I guess I always deleted the Port forwarding every time I disabled the proxy.

    Thank you so much, it's finally registering. It took a little while for my phone to actually be able to dial properly(maybe 5 minute), but it always does now(so far at least, but I'm optimistic).

    I just need to wait for someone to call me back to confirm I can receive calls and everything will be perfect.

    Edit: I just received a call so it really is working both ways. Thanks again for your help.



  • Hmm, not as solved as I thought. My internet connection got disconnected 3 times today for a few minutes(this isn't usual behavior so I hope the pfsense isn't causing it) and when it comes back, asterisk can't register anymore. The only way I found so far is to reboot the pfsense and then it works.



  • Is your WAN interface using a dynamic IP? (i.e. getting a different IP via DHCP every time you disconnect?)



  • No, I have a static ip. From the system log, it seems that the disconnection problem might have been my ISP DNS that went down a couple time so I deactivated it and I'm only using the google ones.

    If I make a capture on the wan interface, the source ip is my local ip instead of my WAN one:

    17:40:51.615458 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 593
    17:40:55.615153 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 593
    17:40:59.921605 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 593
    17:41:00.920728 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 593
    17:41:01.920838 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 593
    17:41:03.921049 IP 192.168.1.11.5060 > 209.217.98.194.5060: UDP, length 593
    


  • Can you post a screenshot of your outbound NAT rules?



  • Here's what I have now(in case the picture doesn't show up: http://i.imgur.com/6YCd6.jpg):



  • Can you verify that you haven't accidentally checked the 'Do not nat' checkbox for the bottom NAT rule in your screenshot?

    It is quite strange that the SIP packets from 192.168.1.11 are egressing from the WAN interface un-NATed.



  • It's not checked.

    Once I reboot the pfsense after it getting disconnected, everything goes back to normal and the sip packets are nated again, but it is indeed really odd.



  • This is becoming problematic. I though it would only happen once every few months, but my internet connection isn't very stable these days it seems and it just happened twice today.

    I also noticed that asterisk isn't the only one who seem to never notice the connection was gone for a few seconds. I'm also connected to IRC and it will stay connected, but doesn't actually receive anything anymore until I reconnect it manually. I let it in that state for over 20 minutes and it never disconnected by itself(which is used to and should do).

    What could be causing that in the router?


Locked