Asterisk FROM field

Hi.
When I want register to provider, I get 401 Unauthorized error. Dump shows that FROM and TO field is same:

From: sip:74xxxxxxxxx@91.224.xxx.xx;tag=22ff5d29-553d-4c51-8f20-1b110a73933d
To: sip:74xxxxxxxxx@91.224.xxx.xx;tag=as60275e9c

How I can corret this error?
Asterisk v16. PJSIP conf file.

Thank you.

401 is not an error. You need to provide a secret in your register string.

The standard exchange is:

REGISTER wtthout authentication
401 with nonce, and authentication method
REGISTER with authentication
200 OK (or x03 if the secret is wrong).

1 Like

But password is set in config.

[74xxxxxxxxx]
type=auth
auth_type=userpass
username=10565028282
password=:mypasswordhere:

Is normal behavior so that the strings “FROM” and “TO” have the same value?

This is not enough information to draw any conclusions. One would either need the complete configuration (reg, auth, ep, aor(s)…), or the lists from within asterisk “pjsip show …”

You may have to check what the service provider wants to see in the From Headers, which is determined by the client_uri field (see https://wiki.asterisk.org/wiki/display/AST/Configuring+Outbound+Registrations for details). Sometimes it is a normalized phone number, sometimes it can be a special username. But these are currently only suggestions where to look at.

Not just normal, but in most cases required:

  From: The From header field contains the address-of-record of the
       person responsible for the registration.  The value is the
       same as the To header field unless the request is a third-
       party registration.

From RFC 3261