When is a username required?

The docs say username can/should be left out in certain cases but isn’t clear when or why. I’ve tried it with & without. Didn’t seem to make a difference??

[MyTrunk]
type=aor
contact = sip:username@MyProvider.com

[MyTrunk]
type=endpoint
context=inbound_calls
aors=MyTrunk
identify_by=ip  ;[Inbound calls from my voip provider]

[MyTrunk]
type=identify
endpoint=MyTrunk
match=254.9.1.0/24

;***************************************************

[MyPhone]
type=aor
contact=sip:username@192.168.20.29:10000\;transport=udp

[MyPhone]
type=endpoint
aors=MyPhone
context=outbound_calls
identify_by=ip  ;Asterisk & MyPhone are both on the lan w/static IP

[MyPhone]
type=identify
endpoint=MyPhone
match=192.168.20.29

That depends on what is at the other end.

Typically you wouldn’t want it for a provider, because it would normally be replaced by the PSTN number you are calling.

You might need it for a telephone, or ATA, because it might be needed to identify the “line” in use, although a simple phone might only have one line and not need it.

Thank you. I was pretty sure that was the case but am tidying up my code. I think all of mine are the latter case. Not required.