Username is not working in sip.conf

[internal]
type=friend
host=dynamic
qualify=yes  
nat=yes        
call-limit=1    
busylevel=1     
rtpkeepalive=5 

[1001](internal)
username=alex
secret=super

[1002](internal)
secret=super2!
regexten=1004

Please help me. I try to connect by username alex and no result. Screenshot by Lightshot Asnwer is “Password is incorrect”.
When I user 1001 as username - it is good. Screenshot by Lightshot
How to set username alex?

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.

I’m wondering if you really want:

;match_auth_username=yes ; if available, match user entry using the
; ‘username’ field from the authentication line
; instead of the From: field.

However this is also rarely used, and may reflect a failure to appreciate this:

; Don’t mix extensions with the names of the devices. Devices need a unique
; name. The device name is not used as phone numbers. Phone numbers are
; anything you declare as an extension in the dialplan (extensions.conf).

Now i understand a little.

  1. Extension numbers like 1001 and etc writing in extensions.conf. This is correct way. I can write [1001], but this is usual for phisics telephone devices. Correct?

  2. nat=yes is deprecated, use nat=force_rport,comedia instead

  3. Correct sip.conf is:

[general]
bindport=9060 ;helps a little, better to use fail2ban with iptables

[internal]
type=friend
host=dynamic
qualify=yes
call-limit=1 busylevel=1
rtpkeepalive=5

alex
;This is softphone
secret=super
1002
;This is device
secret=super2!

Now is good?

Use what you actually need. The deprecation of “yes” was, I believe, done to encourage people to think about which if any of the settings was actually needed. The default is auto_comedia,auto_force_rport, which works most of the time. You haven’t told us of a situation that actually require comedia or forcing rport.

Whilst often done, it is not best practice and it is important to realise that it is done as a convenience, not as something that is essential.

I don’t know enough about your requirement to know whether your sip.conf now reflects that.

Dear, David, Thx! I done. I call inside and outside. I like it.