<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hello,<br>
    <br>
    You could check for the presence of the Proxy-Authorization header.
    Something like<br>
    &nbsp;&nbsp;&nbsp; if (is_present_hf("Proxy-Authorization"))<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; xlog("L_ERROR","Auth error for $fU@$fd from $si cause -1
    INVITE\n");<br>
    <br>
    Regards,<br>
    <pre class="moz-signature" cols="72">Vlad Paiu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a> </pre>
    <br>
    On 03/13/2012 05:42 PM, Adam Raszynski wrote:
    <blockquote
cite="mid:CAJWEF2bSqz=8VCytwcnz6s_CNSesmLAaw4qUVTm2HhxjT9_CVw@mail.gmail.com"
      type="cite">Hi All,
      <div><br>
      </div>
      <div>I would like to log all INVITE requests sent by users with
        wrong authentication details</div>
      <div><br>
      </div>
      <div>The problem is that I only need really failed auth INVITE
        attempts (with wrong username/password), not all requests sent
        with no credentials (before challenged by OpenSIPS).</div>
      <div><br>
      </div>
      <div>Following script logs also requests with no credentials, it
        would be great if someone will help me to correct it:</div>
      <div><br>
      </div>
      <div>
        <div>if (!check_source_address("0")) {</div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>if
          (!proxy_authorize("", "subscriber")) {</div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>xlog("L_ERROR","Auth
          error for $fU@$fd from $si cause -1 INVITE\n");</div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>proxy_challenge("",
          "0");</div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>exit;</div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>if
          (!db_check_from()) {</div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>sl_send_reply("403","Forbidden,
          use FROM=ID");</div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>exit;</div>
        <div>
          <span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>consume_credentials();<br>
        </div>
        <div><span class="Apple-tab-span" style="white-space: pre;"> </span>#
          caller authenticated</div>
        <div>}</div>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div>Best Regards,</div>
      <div>Adam</div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </body>
</html>