<div dir="ltr">Hi Bogdan,<div>Thanks a lot for your advise, I've also noticed that CallID is the same for these calls and of course, at first there's no 'Proxy-Authorization' header. But that header will be in place only if remote party has a password to authenticate with us. So yes, I will have to use a cache module probably, it's only I though that if CallID is the same that would be treated as same transaction and all message flags would be present. Thanks for your help!</div><div><br></div><div>Regards,</div><div>Yury.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-27 20:06 GMT+11:00 Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Bogdan,<br>
      <br>
      There are 2 transactions - first request without credentials and
      the second one without credentials - and the flags are only
      transaction persistent. <br>
      <br>
      If you really want to perform such a check, you can rely on the
      fact that both requests will have the same Call-ID (or they
      should, according to RFC3261) - so use the local cache
      (cachedb_local module) with cache_store() and cache_fetch()
      function to check.<br>
      <br>
      Best regards,<br>
    </tt>
    <pre class="m_6060983592205965372moz-signature" cols="72">Bogdan-Andrei Iancu
  OpenSIPS Founder and Developer
  <a class="m_6060983592205965372moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a>
</pre><div><div class="h5">
    <div class="m_6060983592205965372moz-cite-prefix">On 10/27/2017 08:19 AM, Yury Kirsanov
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">Hi,
        <div>I've got a question about proxy authentication - is there
          any way to determine if we previously already asked remote
          party to authenticate or not? For some reason it looks like to
          me that flags are not persistent during proxy authentication
          process, so my code doesn't work as flag is never set. Here's
          a code snippet:</div>
        <div><br>
        </div>
        <div>if (!proxy_authorize("","<wbr>subscriber"))</div>
        <div>{</div>
        <div> if (isflagset(7))</div>
        <div> {</div>
        <div>   # We already tried to authenticate, do some code here</div>
        <div> }</div>
        <div> else</div>
        <div> {</div>
        <div>   # We haven't tried to authenticate yet, challenge the
          request</div>
        <div>   setflag(7);</div>
        <div>   proxy_challenge("","1");</div>
        <div>   exit;</div>
        <div> }</div>
        <div>}</div>
        <div>else</div>
        <div>{</div>
        <div>... successful auth done</div>
        <div>}</div>
        <div><br>
        </div>
        <div>I need this as I want to try to authenticate users and if
          remote party can't authenticate - then try to do IP based
          authentication, for example.</div>
        <div><br>
        </div>
        <div>Thanks for help!</div>
      </div>
      <br>
      <fieldset class="m_6060983592205965372mimeAttachmentHeader"></fieldset>
      <br>
      </div></div><pre>______________________________<wbr>_________________
Users mailing list
<a class="m_6060983592205965372moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_6060983592205965372moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br></div>