Connect SIP Clients through the Internet

I am running Asterisk v 1.2.14 on Windows XP, SP3 using AsteriskWin32.

I am using Andriod smartphones with CSipSimple as extensions and these connect to Asterisk through wi-fi, through an ADSL router. The extensions work fine within the LAN.

I am trying to connect to Asterisk through the Internet and have configured sip.conf, enabled STUN and ICE, forwarded ports 5060, 10000 - 10100 UDP to Asterisk on the router and Windows firewalls, however I am unable to connect with Asterisk. Canyouseeme.org reports, Error: I could not see your service on [IP] on port (5060).

My sip.conf is:

[general]
context = default  
bindport = 5060               
bindaddr = 192.168.1.110
srvlookup = yes 
nat = route
localnet = 192.168.1.1/255.255.255.0
context = default 
allowoverlap = no
canreinvite = no     ; force relaying
transport = udp
tcpenable = no
tcpbindaddr = 0.0.0.0
videosupport = yes
pedantic = no
jbenable = yes
disallow = all
allow = gsm
allow = ulaw
allow = alaw
allow = speex
allow = g722
allow = g726
allow = g7221
allow = mpeg4
allow = g729
externhost = tld ; Public address of router.
stunaddr = stun.sipgate.net:10000
externrefresh = 180

[authentication]

[3000]
context = default
username = 3000
secret = 7
type = friend
nat = comedia
host = dynamic
port = 48895
mailbox = 3000
dtmfmode = rfc2833
directrtpsetup = yes
insecure = invite,port
canreinvite = no
qualify = yes
jbenable = yes
videosupport = yes
trustrpid = yes
Asterisk sip autodomain = yes
busylevel = 5
disallow = all
allow = gsm
allow = ulaw
allow = alaw
allow = speex
allow = g722
allow = g726
allow = g7221
allow = mpeg4
allow = g729

This is what rpt.conf looks like:


[general]
icesupport=yes
rtpstart=10000
rtpend=10100
; rtpchecksums=no
 UDP=5060

What am I doing wrong?

You are using a deprecated unsupported version of asterisk, but beside that you need to check at tcpdump/wireshark logs when you are trying to connect to your server.

If you don’t see anything that mean that your firewall is blocking all.

Thanks Navaismo.

I’ve tried disabling the router and Windows firewalls, but I was still unable to connect with the service on 5060.

I am a novice, so you’ll need to be patient.

How do I generate a tcpdump ?

Any idea how I can upgrade Asterisk on AsteriskWin32 ?

Download and install wireshark to generate the tcpdump.

There is no chance to upgrade asterisk on windows, better use a Linux version you have alternatives like asterisknow or freepbxdistro if you dont want to use a vanilla asterisk.

Other than that, do you see any errors in the configuration files?

Without a deeply view yes it looks fine(I’m noticed that you are using some features that aren’t available on older version like pedantic=yes, but asterisk should ignore it).

But again you need to look a the ethernet & enable sip debug to see if packets are coming to your pbx.

Thank you for clarifying that, your suggestions have been very helpful.

I have enabled SIP debugging on Wireshark, there don’t appear to be any packets coming to the pbx while a client is accessing from the Internet, even if all firewalls are disabled.

If the config files are configured correctly, what else should I be looking at?

Also, with all firewalls and anti-viruses disabled, canyouseeme.org says:
Error: I could not see your service on [IP Address] on port (5060)
Reason: Connection refused

You can’t see the 5060 port using that kind of services at least using asterisk, even telnet will fail.

If you don’t see any packets coming then the issue is in other location like your router or so, try adding a web server in that machine too and try to connect if you can’t connect to the web server then you have a port forwarding issue or firewall issue.

Right, I can see the service on port 80, but not on port 110.

I am very grateful to you Navaismo. Your advice has been invaluable and given me a much better understanding of the problem, particularly that it is not possible to see the service on port 5060 for Asterisk, even if everything is configured correctly and the .conf are more or less correct.

Although I haven’t been able to solve the problem, based on your input, I now think the problem may lie with the router settings.

I trust you will be available if I need further advice on the matter.

No. I can’t work it out.

I’ve tried disabling both firewalls (router and Windows) and connecting to port 5060 and other rtp/sip ports through through the system’s IP address, as show on canyouseeme.org, but I am unable to do so. I can however, connect to the webserver on the system on port 80, by this method.

Is it possible that having Skype installed in the same system, will interfere with connecting to Asterisk through the Internet?

What else am I missing here? Any advice would be appreciated.

You need to capture a tcpdump/wireshark trace to see what’s happening. Also notice that routers with SIP ALG or SPI options screw the sip messages so check if your router has that options and disable it.

I entered the dynmaic public IP address of my router as the port address of my client in CSipSimple and as the external ip of Asterisk in sip.conf. Two clients are connected at this time, 3000 through the Internet and 3001 through the LAN.

The client’s public IP address shows in CLI> sip show peers, but the extension is Unreachable
With CLI> sip debug peer 3000 the following results were obtained. There does not appear to any option to copy the CLI log in AsteriskWin32,
so I have captured the screen, the screenshot are here, . I apologise for not being able to provide this information is a more easily viewable way.

The IP and port details are:
Client 3000 IP: 49.14.135.178
Client 3001 IP: 192.168.1.101
Asterisk Local IP: 192.168.1.110
Client Port in sip.conf: 53579

The wireshrk tcpdump, with SIP filter at that exact time is:

I can IM you this code as a safety precaution
SIP in my router is disabled. Please let me know what you think the problem might be.