Unable to register a sip user from outside

i have my asterisk server behind a nat, all is fine in the local network but when i try to register a user from outside, this is what happens

btw i have asterisk running on CentOS 6.4, i just add a sip account to the sip.conf file without any change

[500]
secret=1234
host=dynamic
nat=yes
qualify=yes
context=test
disallow=all
allow=ulaw
allow=alaw
allow=gsm
allow=g729


my router is a motorola sbg901

5060, 10,000 - 10,500 forwarding to my server

if someone could give me a hand with this i will appreciate that.

THE PASSWORD ISNT WRONG*********

add the username and the type parameters. Example :

[500]
username=xxx
secret=xxx
type=friend

Remember according to the Asterisk documentation: The parameter “username” is not the username and in most cases isnot needed at all.In later releases, it’s renamed
to “defaultuser” which is a better name, since it is used in
combination with the “defaultip” setting. Example :

[polycom]
type=friend ; Friends place calls and receive calls
context=from-sip ; Context for incoming calls from this user
secret=blahpoly
host=dynamic ; This peer register with us
dtmfmode=rfc2833 ; Choices are inband, rfc2833, or info
defaultuser=polly ; Username to use in INVITE until peer registers
defaultip=192.168.40.123
; Normally you do NOT need to set this parameter
disallow=all
allow=ulaw ; dtmfmode=inband only works with ulaw or alaw!
progressinband=no

type=friend is OK here, but is a bad habit to learn. type=peer is safer in most cases.

defaultuser is only used for outbound calls. Most phones won’t check the user, anyway.

David , i don’t understand why always in the Asterisk documentation like asteriskdocs.org/ and too in the sip.conf sample file they make reference and encourage to use type=friend in the configuration of the sip devices.

This is what i learned from
ofps.oreilly.com/titles/97805965 … onfig.html

type = Description

peer Match incoming requests to a configuration entry using the source IP address and port number.

user Match incoming requests to a configuration entry using the username in the From header of the SIP request. This name is matched to a section in sip.conf with the same name in square brackets.

friend This enables matching rules for both peer and user. This is the setting most commonly used for SIP phones.

is there something that is beyond the above statement

People tend to copy other people and there is a real difference for IAX.

For SIP, type=peer matches on IP address only, after registration, and type=friend matches on IP address or the SIP username.

If you have type=friend and invite=insecure, an attacker can simulate the ITSP, if they know the sip.conf section name. There are also cases, that have happened in real life, where a call arriving on a trunk has a caller ID that matches a local, type=friend, “extension”, and has matched the extension, rather than the trunk.