Asterisk Question regarding to username and bracket username

hi guys .
guys I’m confused a little bit about the username in sip.conf

================
if i have a peer in sip.conf as :
[tammari]
type=friend
callerid=“Tuomas Tammisalo” <1000>
username=tam

i want to ask when asterisk consider the name in brackets as username ==>[tammari]
and when to consider username as ==> tam

I’m little bit confused and also will that differ for types of peer , friend & user ?

cheers

username is obsolete, use defaultuser instead. I’m a little confused by it as well, but the renaming is to indicate that it is only used when the peer hasn’t specified a contact address. You don’t normally need it. You almost certainly don’t need it if you need to specify a caller ID.

If you don’t understand peer, friend and user, use peer. Most uses of friend are wrong.

peer - match by IP address
user - match by from header user part
friend, try user then peer.

REGISTER will still be matched by name, even on a peer.

1 Like

thanks
still not clear 100 % to me

i was reading about asterisk (user) part in book
they said it must match the user as it in brackets
and I’m here thats why I’m wondering about (fromuser) or leave it as username in brackets

thats my confusion

If you have a static address for the peer, the none of this really matters, and you should use type=peer.

If they are registering with you, place their address of record name in the square brackets, and still use peer.

Do not use defaultuser, unless you really need to and you register with them.

Do not use fromuser, unless you are dealing with an ITSP or gateway that uses an Asterisk type=user type match.

For a register, Asterisk will use the To header user name to match the square brackets.

For an invite, if you make the mistake of user friend or user, Asterisk will use the From header user name to match the square brackets, but normally you should use peer.

defaultuser is only used on outgoing calls and is normally not needed.

username means you are reading obsolete documentation.

1 Like

thank you
so as far as i understood .
the fromuser and defaultuser is for outside header SIP that will handle the username when it try to authenticated it with other peer .

and from the other peer side when he send me his SIP header that include the username …it should matching the name in brackets as username in his incoming SIP header .

can you confirm me above ?

also i have other Q .

when i use type=user and host as dynamic
will an extension be able to register ?

i set it as that and it successfully worked …im wondering why becuase i read that i must set the host = x.x.x.x which is the ip of the ex ip host

can u confirm .

cheers

hello david I’m still awaiting your reply
thanks