<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Mike,<br>
      <br>
      depending on your SIP flow, you can use either www_ (if a
      REGISTER) or proxy_ (if a non-REGISTER) functions.<br>
      <br>
      In your script snip, you must populate both auth username and
      password before the calling the auth function. I do not see the
      $avp(usuario) set (probably with $fU ??) . Also, if the password
      is plain/text, be use you properly set the calculate_ha1
      parameter. <br>
      <br>
      Best regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
  OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>

OpenSIPS Bootcamp 2017, Houston, US
  <a class="moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2017.html">http://opensips.org/training/OpenSIPS_Bootcamp_2017.html</a>
</pre>
    <div class="moz-cite-prefix">On 07/24/2017 11:21 PM, Mike Tesliuk
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:12e7b238-9fb3-ba84-c97e-bbb7780b02f0@wsu.com.br">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <p>Hello there, <br>
      </p>
      <p><br>
      </p>
      <p>Im trying to implement a proxy_authorize using cache without
        success.</p>
      <p><br>
      </p>
      <p>is that possible to perform the cache using proxy_authorize ?
        on the example [1] i see the www_challenge() no proxy_challenge,
        is that correct ?</p>
      <p><br>
      </p>
      <p>on my test im doing this (below):</p>
      <p><br>
      </p>
      <p>modparam("auth","username_spec", "$avp(usuario)")<br>
        modparam("auth","password_spec", "$avp(senha)")<br>
        modparam("auth_db", "load_credentials", "$avp(senha)=password")</p>
      <p><br>
      </p>
      <p>$avp(usuario) = $fU;<br>
      </p>
      <pre class="escaped">if(cache_fetch("redis","passwd_$fU",$avp(senha))) {
        if(!pv_proxy_authorize("")){
                proxy_challenge("","0");
                exit;
        }
}else{
        if(!proxy_authorize("")){
                proxy_challenge("","0");
                exit;
        }

        
        cache_store("redis","passwd_$fU","$avp(senha)",3600);

}

But with this rule i do not get the user authenticated.

what im doing wrong ? :)


Thanks in advice 
</pre>
      <p><br>
      </p>
      <p><br>
      </p>
      <p><br>
      </p>
      <p>[1] - <a class="moz-txt-link-freetext"
href="https://www.opensips.org/Documentation/Tutorials-MemoryCaching#toc3"
          moz-do-not-send="true">https://www.opensips.org/Documentation/Tutorials-MemoryCaching#toc3</a><br>
      </p>
      <div class="moz-signature">-- <br>
        <br>
        <br>
        ​Atenciosamente,<br>
        <img alt="WSU TECNOLOGIA"
src="http://www.wsu.com.br/wp-content/uploads/2012/09/logo_wsu_assintarua.jpg"
          title="WSU TECNOLOGIA" moz-do-not-send="true" border="0"><br>
        <span style="font-family:arial,helvetica,sans-serif">Mike
          Tesliuk<br>
          <span style="font-size:8pt">Rua Visconde do Rio Branco
            1630 . Sala 1302 . Curitiba . PR  <br>
            12387 SW 125th ter, Miami, Florida 33186 - USA</span></span><br>
        <span style="font-family:arial,helvetica,sans-serif"><span
            style="font-size:8pt">tel +55 (41) 3941.0650   +1 (786)
            719.6253 </span></span><br>
        <strong><a href="http://www.wsu.com.br/" style="color: rgb(240,
            78, 35); text-decoration: none;" target="_blank"
            moz-do-not-send="true">website</a>  |  <a
href="https://www.google.com.br/maps/place/WSU+Tecnologia/@-25.4354389,-49.2779048,17z/data=%213m1%214b1%214m2%213m1%211s0x94dce473a24cf705:0x369fdf05247b568b?hl=pt-BR"
            style="color: rgb(240, 78, 35); text-decoration: none;"
            target="_blank" moz-do-not-send="true">mapa</a>  |  <a
            href="mailto:contato@wsu.com.br" style="color: rgb(240, 78,
            35); text-decoration: none;" target="_blank"
            moz-do-not-send="true">email</a>    </strong><br>
        .<br>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
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>
    <br>
  </body>
</html>