<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("uac_auth", -1) ) {</div><div> /* load the UAC_AUTH API as uac_auth() is invoked from script */</div>
<div> if(load_uac_auth_api(&uac_auth_api)<0){</div><div> LM_ERR("can't load UAC_AUTH API, needed for uac_auth()\n");</div><div> goto error;</div>
<div> }</div><div><br></div><div> LM_DBG("Loaded uac_auth api as found in script");</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'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("401")) {</div>
<div> xlog("L_INFO","[$ci] Got 401 from Proxy\n");</div><div><br></div><div> avp_db_query("select password from registrant where username = '$(avp(authuser){s.escape.common})'","$avp(authpass)");</div>
<div><br></div><div> $avp(authrealm) = "";</div><div><br></div><div> $avp(www) = $(<reply>hdr(WWW-Authenticate));</div><div> avp_subst("$avp(www)", "/Digest\s//");</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) < $var(numkvp)) {</div>
<div><br></div><div> $var(temp) = $(avp(www){s.select,$var(i),,});</div><div><br></div><div> if ($var(temp) =~ "realm.*") {</div><div> $avp(authrealm) = $var(temp);</div>
<div> avp_subst("$avp(authrealm)","/(realm=\")(.*)(\")/\2/");</div><div> #$avp(authrealm) := "asterisk";</div><div> }</div>
<div><br></div><div> $var(i) = $var(i) + 1;</div><div> }</div><div><br></div><div> xlog("L_INFO","[$ci] authrealm is [$avp(authrealm)], authuser is [$avp(authuser)], authpass is [$avp(authpass)]\n");</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("L_INFO","[$ci] Built auth, sending back to Proxy\n");</div>
<div><br></div><div> t_on_failure("ip_auth_fail");</div><div><br></div><div> # the $du should really be uri as specified in Record-Route in 401, but using reply's source IP for now</div>
<div> $du = "sip:" + $(<reply>si) + ":5060";</div><div><br></div><div> xlog("L_INFO", "[$ci] Sending request with Auth header to [$du]\n");</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: +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 Tue, Mar 25, 2014 at 7:28 PM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>></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("uac_auth", -1) ) {<br>
/* load the UAC_AUTH API as uac_auth() is invoked from
script */<br>
if(load_uac_auth_api(&uac_auth_api)<0){<br>
LM_ERR("can't load UAC_AUTH API, needed for
uac_auth()\n");<br>
goto error;<br>
}<br>
}<br>
<br>
<br>
Maybe the is_script_func_used() doesn't trigger properly there -
in what kind of route are you using the uac_auth() function ?
Could you place a LM_DBG() in that 'if' statement to see if it
goes in there ?<br>
<br>
Thank and 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 class="">
On 25.03.2014 14:28, Justin Zondagh wrote:<br>
</div></div>
<blockquote type="cite">
<div dir="ltr">Hi Bogdan,
<div><br>
</div><div class="">
<div>I have found and fixed the bug. The uac_auth_api wasn'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(&uac_auth_api) < 0){</div>
<div> LM_INFO("Error loading uac_auth_api");</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(
&auth->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 class="">
<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"><<a href="mailto:zondagh@gmail.com" target="_blank">zondagh@gmail.com</a>></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>