miconda left a comment (kamailio/kamailio#4328)
I haven't had the time for proper review, but at a quick look, a lot of files seem to be copied from auth module. If it is the case, then isn't it possible to reuse functions via intermodule API in the similar way that auth_db uses auth functions?