Invite authentication & local peer


I have the following config: softphone <-> Proxy Kamailio <-> Asterisk 11.21

Softphone registers onto Kamailio, and registration is not forwarded to asterisk.
A trunk is defined in asterisk for Kamailio, host=kamailio.ip, insecure=invite, port, type=peer

I have a user (say 100), defined in Kamailio config. Softphone registers fine. When it sends an invite, kamailio requires authentication, fine.
But when the invite is sent to asterisk, asterisk will or wont require authentication if a local account (100) is defined in sip.conf or not.

Why is that ? the account defined on my proxy may have nothing to do with what’s defined on asterisk !


Because you have defined the local account as type=friend, probably by following one of the many bad cook books. Unless there is a very specific reason to do so, you should only use type=peer.

As well as what you have seen, it also reduces security.

Also, insecure=invite is only useful if you have secret set, and I think remotesecret is a better way of solving the problem it addresses. I can’t think why you would want to disable port checking here.

Many thanks !
Indeed, by changing from friend to peer, the authentication is no longer requested, even when insecure=invite is not there for the trunk