OpenSIPS使用错误的凭据记录INVITE请求

时间:2012-03-13 15:50:16

标签: authentication request logging invite

我想记录用户使用错误的身份验证详细信息发送的所有INVITE请求

问题是我只需要真正失败的auth INVITE尝试(错误的用户名/密码),而不是所有没有凭据的请求(在被OpenSIPS挑战之前)。

以下脚本日志也请求没有凭据,如果有人帮我纠正它会很棒:

if (!check_source_address("0")) {
    if (!proxy_authorize("", "subscriber")) {
        xlog("L_ERROR","Auth error for $fU@$fd from $si cause -1 INVITE\n");
        proxy_challenge("", "0");
        exit;
    }
    if (!db_check_from()) {
        sl_send_reply("403","Forbidden, use FROM=ID");
        exit;
    }
    consume_credentials();
    # caller authenticated
}

1 个答案:

答案 0 :(得分:1)

            Hi This code will h    

elp,这是工作的。

            $var(auth_code) = www_authorize("", "subscriber");
            if ( $var(auth_code) == -1 || $var(auth_code) == -2 ) {
            xlog("Authentication failed for $fU@$fd from $si cause $var(auth_code)");
            exit;
            }
            if ( $var(auth_code) < 0 ) {
            www_challenge("", "0");
            exit;
            }

            if (!db_check_to()) {
                    sl_send_reply("403","Forbidden auth ID");
                    exit;
            }

            if(!save("location")) {
                    xlog("Register: Saving contact failed for User $ru from $si");
                    sl_reply_error();
                    exit;
            }
            xlog( "User $fU Registered/Unregisterd Successfully From IP:$si");
            exit;