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


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.


add the username and the type parameters. Example :


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 :

type=friend ; Friends place calls and receive calls
context=from-sip ; Context for incoming calls from this user
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
; Normally you do NOT need to set this parameter
allow=ulaw ; dtmfmode=inband only works with ulaw or alaw!

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.