Before we try to solve this on a deprecated channel driver, is this a new installation? If so, please try with chan_pjsip, instead.
Also, you would need to provide the sip set debug on output to prove that username wasn’t being sent.
You might also want to review the following from sample file that documents sip.conf:
; Note: The parameter “username” is not the username and in most cases is
; not needed at all. Check below. In later releases, it’s renamed
; to “defaultuser” which is a better name, since it is used in
; combination with the “defaultip” setting.
Also, what is 1001? It looks like a local device, and it is unusual for a local device to even try to authenticate the PABX.
regexten makes no sense on a peer that has host=dynamic, as you can’t have host=dynamic at both ends, and regexten only makes sense for outgoing registrations.
Why do you feel you need nat=yes, and why do you feel that you need type=friend. Both may be valid, but both are unusual requirements, and are typically included as a result of misunderstanding them.