I have created a peer between asterisk and a MVTS Pro softswitch, I need to send calls from MVTS Pro to Asterisk, I made the settings but it does not authorize the calls, returning error code SIP 401, this is the configuration of the peer in sip.conf:
The problem is that the service provider is not authorising to you. In practice no service provider will do this.
insecure=invite was the old way round this. insecure=port is irrelevant to this problem and should not be used if not needed for other reasons. The parameter is called insecure for a reason.
insecure=invite has no effect if you don’t have a secret.
The modern way, if you do have a secret, is to use remotesecret.
In this case, the logs will almost certainly show that you either have alwaysauthreject set and the peer doesn’t match a sip.conf entry, or you have used type=friend for local devices, and the From: header user part matches a local device name.
I dont think type peer solve the from header authentication issue at least not with Asterisk, because if you check he had type peer, and I have done also test with 2 Asterisk and issue happen, Asterisk doesnt really use the IP address to authenticate the device