Asterisk On Rackspace, My SIP Phone Behind NAT

Home » Asterisk Users » Asterisk On Rackspace, My SIP Phone Behind NAT
Asterisk Users 17 Comments


I’ve successfully setup Asterisk on my local PC and can make call using Twinkle to the server. But, I cannot call to my Asterisk server at Rackspace. I have been trying several things to figure it out, no luck. My PC is behind NAT, so I’ve set that up in sip.conf (nat=yes). I can ping my Rackspace server so it seems to be Public-static IP. Anyway, I tried with setting externip, netmask etc. No luck.

Recently I tried out two things. Sending UDP packets with python scripts, with a client on my PC and a server on Rackspace. I cannot receive any packets. As far as I remember, I can send TCP packets using nc, with client and server at both ends. But when I use UDP switch I don’t get anything.

My question is how can I troubleshoot this scenario? (Is this question within the scope of this mailing list?)

17 thoughts on - Asterisk On Rackspace, My SIP Phone Behind NAT

  • Hi, Asterisk is quite good with resolving the NAT issues specially the kind of issue you are facing ,as I see it, shouldn’t be a problem. A few steps you can troubleshoot this problem.

    1-a:Are your SIP packets from PC/SoftPhone reaching the server !!

  • 1. Can you send UDP packets across your LAN?
    If not, check your client machine.

    2. Can you send UDP packets across the Internet to another host? (This may require the co-operation of another party.)
    If not, check your router.

    If you can send UDP across your LAN and across the Internet but not to your own box in Rackspace, it must be a routing issue at the Rackspace end.

  • Oh, I see – check if your country blocks the SIP port 5060 ? try changing the default poert from 5060 to something else like 7777 and then try this. I think your ISP is blocking the SIP.

  • But still contact your ISP and get them to un-block your port 5060. You paid them for an Internet connection; and an Internet connection means *all* ports, not just *some* ports.

  • under same net. Can you tell me one thing? When I call to to my local Asterisk server it works. When I call to the IP of my ethernet card, it doesn’t work. Should it ought to work?

    2. Can you send UDP packets across the Internet to another host? (This may using python code. And also using nc. So far I remember the default TCP
    packets worked, but when I tried to send UDP using -u, it didn’t work.

  • You rock. Yeah it seems this is the main problem. I tried with 7777 and saw the message at instance. Then I changed to ensure to port 5060 and it never reaches.Strange. I’ll make necessary changes to reconfigure in Asterisk, and let you know if I can register my phone. Thank you very much.

  • There has been lots misuses of VOIP here and government policies are strange. Instead, lots of illegal VOIP businesses run. As I’m not a POWERFUL guy, I can’t simply ask my ISP to unblock it.

    Law and constitution, were a means to protect us. (Now, don’t smile. I know it amuses you too.)

  • Ok Good. It always feel good to add +1 to the list of resolved user-list issues.

    As I’m not a POWERFUL guy, I can’t simply ask my ISP to unblock it.

    It takes a VPN or in near future WebRTC(in other words “Knowledge”) to become one powerful guy. With these technologies you don’t need to care what your ISP or govt. is blocking.

    Where there is will, there are ways.


  • And where there is a ‘government’ involved, bypassing their restrictions may have serious consequences.

  • Unfortunately, I still can’t register my SIP (Twinkle) phone to my server. I can send UDP data if I change port. But can’t register a SIP phone. I
    have been trying several other approaches. Like capturing UDP data at the server at specific port, when I send register request from Twinkle. Amazingly, I get some UDP packet which mentions my external IP in its source. But no output at Asterisk shell, when I turn debug on.

    I’m trying to send a single SIP packet with REGISER message and see what happens at the Asterisk shell. Though it requires a deeper knowledge than that I have and it’ll take more time. I wish there were quicker ways to do this.

  • Yup, true. Since, I’m a single user *experimenting* with PBXs, I’m hopefully out of danger zone. But yes, when there is a government is almost no way. 😀

  • I have been observing that Twinkle send same value in both *from* and
    *to*fields. Like the following:

    from/to: account_name@asterisk_host:port_no

    Shouldn’t it be:

    from : account_name@twinkle_host:port_no to : account_name@asterisk_host:port_no


    Also, I realized there is not need to create a single SIP packet with REGISTER message. Twinkle is already dong that. What probably, I should do is copy-paste the log, save them is a file, feed it to other programs and tinker with them.

    Any hint for a noob?

  • Thanks. sipp was successfully built on my Debian Squeeze. But when I run it, I get errors. The error was originating from a function named
    ‘xp_get_value’. So I thought it might be related to Windows XP and its windows specific. Am I wrong? Any experience with it on Linux? Haven’t tried sipsak yet.

    Luckily, now I’m getting debugging info<>at Asterisk console. The pattern is, every-time I get this info, I have to, at least, restart Twinkle and/or Asterisk. If I don’t, no matter how many times I issue ‘register’ command, it doesn’t work.

  • It’s not necessarily a Government thing. In India, some ISPs — who are also telcos — have unilaterally blocked 5060/UDP traffic to prevent VoIP eating into their PSTN business.

    Of course, India has some retrograde VoIP rules, but blocking 5060/UDP
    isn’t an official requirement.


    — Raj