Register external SIP client in my Asterisk

Hello,

I have installed Asterisk11 in my PC and I managed to register two SIP clients locally. Now, I am facing a big issue because I want to register a remote SIP client in my local Asterisk server, but I failed to make this.

Could anyone help me how to solve this problem?

Here you are my sip.conf and extension.conf configurations:

------------sip.conf-------------

[general]
port = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all ; disallow all codecs
allaw=ulaw
allaw=alaw
allow=gsm

externip=41.230.47.xx ; IP of my router
localnet=192.168.1.0/255.255.255.0
nat=yes
qualify=yes

[local_pc1] ;local PC

type=friend 
username=local_pc1 
secret=1234 
host=dynamic 
context=from-sip
nat=yes 

[local_pc2] ; local PC

type=friend 
username=local_pc2 
secret=4321 
host=dynamic 
context=from-sip 
nat=yes 

[external_pc] ; remote PC

type=friend 
username=external_pc 
secret=12345 
host=dynamic 
context=from-sip 
nat=yes

-------extensions.conf-----------

[general]

static=yes ; These two lines prevent the command-line interface
writeprotect=yes ; from overwriting the config file. Leave them here.

[from-sip]

exten => 1234,1,Dial(SIP/local_pc1,30)
exten => 4567,1,Dial(SIP/local_pc2,30)
exten => 6789,1,Dial(SIP/external_pc,30)

Use a openVPN to manage that is better and secure than Open your ports in your router, ah yes you need to forward/open your SIP ports in your router and in your firewall in order to register external devices.

Google about the vpn there are hundreds of tutorial of how to install and configure openvpn.

If it is just for testing, port forward 5060 and 10000-20000 udp ports. In production just forget it and use openvpn as @navaismo said.

Thank you for your reply.

I have already forwarded the SIP port and I managed to make an external call to my remote SIP client but there are no voice! (I have forwarded RTP ports from 10000 to 100010). Also, I noticed that sometimes it’s written in Asterisk log that my external SIP client is unreachable but I still see it’s external IP in the log trace. It’s a bit strange.

I have no idea about openVPN, but I will make a small research about it.

Use a stun server in the remote extension, you don’t have voice because of nat.