'username ’ and ‘secret’ fields are being used to register my asterisk to provider, but what is the function of ‘fromuser’ and ‘frondomain’ fields?
Thank you for help
They set the user and domain parts of the From:. Some ITSPs, particularly, I think, ones who are really providing a single user service, insist that these have particular values, rather than using the registered IP address to recognize traffic from the registered user. This is what Asterisk does if you configure a type=user entry (and type=friend will also match this way).
Third party SIP PABXes will often also match extensions this way.
The username you refer to only applies to registration, whereas fromuser applies to normal outbound traffic.