<div dir="ltr">Thanks Bogdan, glad we could fix it.<div><br></div><div>Regards,</div><div>Justin</div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><div><b><br></b></div><b>Justin Zondagh<br></b><a href="mailto:zondagh@gmail.com" target="_blank">zondagh@gmail.com</a><br>

<br>Cape Town | South Africa<div>skype: jrzondagh</div><div>m: +27 72 598 4887 | f: +27 86 546 1405</div><div>uk:<b> </b>+44 20 328 99610</div></div></div>
<br><br><div class="gmail_quote">On Wed, Mar 26, 2014 at 7:57 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div><tt>Hello Justin,<br>
        <br>
        Thanks for all your help - I managed to find and fix the bug -
        please update from GIT and try again.<br>
        <br>
        Best regards,<br>
      </tt><div class="">
      <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre></div><div><div class="h5">
      On 25.03.2014 21:31, Justin Zondagh wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">Hi Bogdan,
        <div><br>
        </div>
        <div>I placed the LM_DBG as follows</div>
        <div><br>
        </div>
        <div>
          <div>        if ( is_script_func_used(&quot;uac_auth&quot;, -1) ) {</div>
          <div>                /* load the UAC_AUTH API as uac_auth() is
            invoked from script */</div>
          <div>               
            if(load_uac_auth_api(&amp;uac_auth_api)&lt;0){</div>
          <div>                        LM_ERR(&quot;can&#39;t load UAC_AUTH API,
            needed for uac_auth()\n&quot;);</div>
          <div>                        goto error;</div>
          <div>                }</div>
          <div><br>
          </div>
          <div>                LM_DBG(&quot;Loaded uac_auth api as found in
            script&quot;);</div>
          <div>        }</div>
        </div>
        <div><br>
        </div>
        <div>But nothing appears in the log on init.</div>
        <div>
          <br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>I&#39;m using the uac_auth() in a failure route</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div>failure_route[ip_auth_fail]</div>
          <div>{</div>
          <div><br>
          </div>
          <div>        if (t_check_status(&quot;401&quot;)) {</div>
          <div>                xlog(&quot;L_INFO&quot;,&quot;[$ci] Got 401 from
            Proxy\n&quot;);</div>
          <div><br>
          </div>
          <div>                avp_db_query(&quot;select password from
            registrant where username =
            &#39;$(avp(authuser){s.escape.common})&#39;&quot;,&quot;$avp(authpass)&quot;);</div>
          <div><br>
          </div>
          <div>                $avp(authrealm) = &quot;&quot;;</div>
          <div><br>
          </div>
          <div>                $avp(www) =
            $(&lt;reply&gt;hdr(WWW-Authenticate));</div>
          <div>                avp_subst(&quot;$avp(www)&quot;, &quot;/Digest\s//&quot;);</div>
          <div><br>
          </div>
          <div>                #Get the realm from the www-auth header</div>
          <div>                $var(numkvp) = $(avp(www){csv.count});</div>
          <div>                $var(i) = 0;</div>
          <div>                while($var(i) &lt; $var(numkvp)) {</div>
          <div><br>
          </div>
          <div>                        $var(temp) =
            $(avp(www){s.select,$var(i),,});</div>
          <div><br>
          </div>
          <div>                        if ($var(temp) =~ &quot;realm.*&quot;) {</div>
          <div>                                $avp(authrealm) =
            $var(temp);</div>
          <div>                               
            avp_subst(&quot;$avp(authrealm)&quot;,&quot;/(realm=\&quot;)(.*)(\&quot;)/\2/&quot;);</div>
          <div>                                #$avp(authrealm) :=
            &quot;asterisk&quot;;</div>
          <div>                        }</div>
          <div><br>
          </div>
          <div>                        $var(i) = $var(i) + 1;</div>
          <div>                }</div>
          <div><br>
          </div>
          <div>                xlog(&quot;L_INFO&quot;,&quot;[$ci] authrealm is
            [$avp(authrealm)], authuser is [$avp(authuser)], authpass is
            [$avp(authpass)]\n&quot;);</div>
          <div><br>
          </div>
          <div>                #No need for loop prevention as Proxy
            sends 183 early media recording saying password is wrong,
            then sends 603</div>
          <div><br>
          </div>
          <div>                if (uac_auth()) {</div>
          <div>                        xlog(&quot;L_INFO&quot;,&quot;[$ci] Built auth,
            sending back to Proxy\n&quot;);</div>
          <div><br>
          </div>
          <div>                        t_on_failure(&quot;ip_auth_fail&quot;);</div>
          <div><br>
          </div>
          <div>                        # the $du should really be uri as
            specified in Record-Route in 401, but using reply&#39;s source
            IP for now</div>
          <div>                        $du = &quot;sip:&quot; + $(&lt;reply&gt;si)
            + &quot;:5060&quot;;</div>
          <div><br>
          </div>
          <div>                        xlog(&quot;L_INFO&quot;, &quot;[$ci] Sending
            request with Auth header to [$du]\n&quot;);</div>
          <div>                        t_relay();</div>
          <div><br>
          </div>
          <div>                }</div>
          <div>        }</div>
          <div><br>
          </div>
          <div>        if (t_was_cancelled()) {</div>
          <div>                exit;</div>
          <div>        }</div>
          <div>
            <br>
          </div>
          <div>}</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div dir="ltr">
            <div><b><br>
              </b></div>
            <b>Justin Zondagh<br>
            </b><a href="mailto:zondagh@gmail.com" target="_blank">zondagh@gmail.com</a><br>
            <br>
            Cape Town | South Africa
            <div>skype: jrzondagh</div>
            <div>m: <a href="tel:%2B27%2072%20598%204887" value="+27725984887" target="_blank">+27 72 598 4887</a> | f: <a href="tel:%2B27%2086%20546%201405" value="+27865461405" target="_blank">+27 86 546 1405</a></div>


            <div>uk:<b> </b><a href="tel:%2B44%2020%20328%2099610" value="+442032899610" target="_blank">+44 20 328 99610</a></div>
          </div>
        </div>
        <br>
        <br>
        <div class="gmail_quote">On Tue, Mar 25, 2014 at 7:28 PM,
          Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div><tt>Hello Justin,<br>
                  <br>
                  In the 1.10 code, in the UAC module, in the mod_init
                  function, the binding to UAC AUTH module is to be
                  done. See line 171 in modules/uac/uac.c<br>
                  <br>
                  <br>
                      if ( is_script_func_used(&quot;uac_auth&quot;, -1) ) {<br>
                          /* load the UAC_AUTH API as uac_auth() is
                  invoked from script */<br>
                          if(load_uac_auth_api(&amp;uac_auth_api)&lt;0){<br>
                              LM_ERR(&quot;can&#39;t load UAC_AUTH API, needed
                  for uac_auth()\n&quot;);<br>
                              goto error;<br>
                          }<br>
                      }<br>
                  <br>
                  <br>
                  Maybe the is_script_func_used() doesn&#39;t trigger
                  properly there - in what kind of route are you using
                  the uac_auth() function ? Could you place a LM_DBG()
                  in that &#39;if&#39; statement to see if it goes in there ?<br>
                  <br>
                  Thank and regards,<br>
                </tt>
                <div>
                  <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
                </div>
                <div> On 25.03.2014 14:28, Justin Zondagh
                  wrote:<br>
                </div>
              </div>
              <blockquote type="cite">
                <div dir="ltr">Hi Bogdan,
                  <div><br>
                  </div>
                  <div>
                    <div>I have found and fixed the bug. The
                      uac_auth_api wasn&#39;t being loaded before being
                      called as you suspected.</div>
                    <div><br>
                    </div>
                    <div>I added this code</div>
                    <div><br>
                    </div>
                    <div>
                      <div>       
                        if(load_uac_auth_api(&amp;uac_auth_api) &lt; 0){</div>
                      <div>                LM_INFO(&quot;Error loading
                        uac_auth_api&quot;);</div>
                      <div>                goto error;</div>
                      <div>        }</div>
                      <div><br>
                      </div>
                      <div> <br>
                      </div>
                      <div>before calling the API on the next line:</div>
                      <div>
                        <div><br>
                        </div>
                        <div>        crd = uac_auth_api._lookup_realm(
                          &amp;auth-&gt;realm );</div>
                      </div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div>Seems to work now...</div>
                      <div> <br>
                      </div>
                      <div>How do we commit this to code base?</div>
                      <div> </div>
                      <div><br>
                      </div>
                    </div>
                    <div>Regards,</div>
                    <div>Justin</div>
                    <div><br>
                    </div>
                  </div>
                </div>
                <div>
                  <div class="gmail_extra"><br clear="all">
                    <div>
                      <div dir="ltr">
                        <div><b><br>
                          </b></div>
                        <b>Justin Zondagh<br>
                        </b><a href="mailto:zondagh@gmail.com" target="_blank">zondagh@gmail.com</a><br>
                        <br>
                        Cape Town | South Africa
                        <div>skype: jrzondagh</div>
                        <div>m: <a href="tel:%2B27%2072%20598%204887" value="+27725984887" target="_blank">+27 72
                            598 4887</a> | f: <a href="tel:%2B27%2086%20546%201405" value="+27865461405" target="_blank">+27 86
                            546 1405</a></div>
                        <div>uk:<b> </b><a href="tel:%2B44%2020%20328%2099610" value="+442032899610" target="_blank">+44 20
                            328 99610</a></div>
                      </div>
                    </div>
                    <br>
                    <br>
                    <div class="gmail_quote">On Tue, Mar 25, 2014 at
                      10:18 AM, Justin Zondagh <span dir="ltr">&lt;<a href="mailto:zondagh@gmail.com" target="_blank">zondagh@gmail.com</a>&gt;</span>
                      wrote:<br>
                      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                        <div dir="ltr">They were the wrong way round,
                          but swapped them and seems to have the same
                          issue:<br>
                        </div>
                      </blockquote>
                    </div>
                  </div>
                </div>
              </blockquote>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

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