Dear Friends,

With Kamailio 3.1.2, after successfully registering, the caller sends INVITE to the proxy, and is always responded with 403 not relaying.

I found that in the route[AUTH] subroutine, like below. Regarding the red comparing, it failed. I also check the code, and found Kamailio will use the host name in the From header to compare all the socket's IP address, such as host = mysipserver.com, but socket's ip = 127.0.0.1 or 10.1.1.5. As you can see, this comparing will never be equal.
Could anyone show me how to handle this problem? Thanks a lot!

        # authenticate if from local subscriber
        if (from_uri==myself)
        {
            if (!proxy_authorize("$fd", "subscriber")) {
                proxy_challenge("$fd", "0");
                exit;
            }
            if (is_method("PUBLISH"))
            {
                if ($au!=$tU) {
                    sl_send_reply("403","Forbidden auth ID");
                    exit;
                }
            } else {
                if ($au!=$fU) {
                    sl_send_reply("403","Forbidden auth ID");
                    exit;
                }
            }
    
            consume_credentials();
            # caller authenticated
        } else {
            # caller is not local subscriber, then check if it calls
            # a local destination, otherwise deny, not an open relay here
            if (!uri==myself)
            {
                sl_send_reply("403","Not relaying");
                exit;
            }
        }

Best Regards,
Spencer