Asterisk not working on the public Ip

I’m having issue that my asterisk zoiper not registering on the public ip. Its working well in the Lan and I set the externalip of my server but zoiper not registering…

I off the iptables, please help me why its not working on the public ip.

Hope to hear from all soon!!

Because you have misconfigured it!

That’s basically all that one can say based on the information provided.

Configuration file:—
Sip.conf

[general]
context=internal
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
;disallow=all
allow=ulaw
alwaysauthreject=yes
canreinvite=no
nat=yes
session-timers=refuse
localnet=192.168.1.0/255.255.255.0
externip=XXX.XXX.XXX.XXX-----Here i used my server ip.
qualify=yes

[7001]
type=friend
host=dynamic
secret=7001
context=internal
mailbox=7001@vm-demo

[7002]
type=friend
host=dynamic
secret=7002
context=internal
mailbox=7002@vm-demo

[2002]
type=friend
host=dynamic
secret=2002
context=internal
mailbox=2002@vm-demo

Should be OK for Asterisk 1.4. If you are using anything more recent check the documentation for canreinvite, nat, and type. You may have not best practice, obsolete, redefined or deprecated settings.

You will need to turn up the tracing level until the register attempt produces some trace output. If it still doesn’t when you enable sip set debug on, the problem lies outside Asterisk.

No logs on the asterisk CLI when zoiper start to register…

It’s always say registering…

Hope to hear from you soon!!!

This look like a network issue , not an Asterisk issue.

This look like a network issue , not an Asterisk issue.[/quote]

What can be network issue… I’m able to register with same network and LAN but no with different different network.

This look like a network issue , not an Asterisk issue.[/quote]

What can be network issue… I’m able to register with same network and LAN but no with different different network.[/quote]
LAN is different from WAN, and yes your network issue maybe is that you haven’t open the ports for SIP and RTP signaling.

iptables -t nat -A PREROUTING --proto udp --dport 5060:5063 -j DNAT --to MY_PUBLIC_IP
iptables -t nat -A PREROUTING --proto udp --dport 10000:20000 -j DNAT --to MY_PUBLIC_IP
iptables -t nat -A POSTROUTING --proto udp --src MY_PUBLIC_IP -j MASQUERADE

iptables -t filter -L
iptables -t filter -A FORWARD --proto udp --dport 5060:5063 -j ACCEPT
iptables -t filter -A FORWARD --proto udp --dport 10000:20000 -j ACCEPT

I did all these. Please let me know if these are wrong and if i need to do more settings

Hope to hear from you soon!!