<div>I'm not sure what has changed. In the past I was able to implement the localcache feature and had verified it worked. Recently I realized that it wasn't working. I am using a trunk version that is pretty new</div>
<div> </div>
<div> </div>
<div>Here is the config</div>
<div>loadmodule "cachedb_local.so"</div>
<div> </div>
<div> </div>
<div>modparam("auth_db", "calculate_ha1", 0)</div>
<div>modparam("auth_db", "load_credentials", "$avp(55)=ha1")</div>
<div>modparam("auth_db", "password_column", "ha1")</div>
<div>modparam("auth_db", "db_url", "mysql://<a href="http://x:x@127.0.0.1/opensips">x:x@127.0.0.1/opensips</a>")</div>
<div> </div>
<div>modparam("auth","username_spec","$avp(54)")<br>modparam("auth","password_spec","$avp(55)")</div>
<div> </div>
<div> </div>
<div>route[2] {</div>
<div> #<br> # -- Register request handler --<br> # -- Handles all REGISTER SIP requests<br> if (is_uri_host_local()) {</div>
<div> xlog("L_INFO", "------ ROute 2: 1 tu[$tu]\n");<br> # do we have the password cached ?<br> if(cache_fetch("local","passwd_$tu",$avp(55))) {<br>
xlog("L_INFO", "------ ROute 2: 2\n");<br> $avp(54) = $tU;<br> xlog("Route 2: 2.2 storing password <$avp(i:55)>\n");<br> # perform auth from variables<br>
# $avp(54) contains the username<br> # $avp(55) contains the password</div>
<div> </div>
<div> #xlog("SCRIPT: stored password is $avp(i:55)\n");<br> # perform auth from variables<br> # $avp(i:54) contains the username<br> # $avp(i:55) contains the password<br>
if (!pv_www_authorize("")) {<br> # authentication failed -> do challenge<br> www_challenge("", "1");<br> exit;<br>
};<br> }<br> else {<br>xlog("L_INFO", "------ ROute 2: 9\n");<br> # perform DB authentication -><br> # password will be loaded from DB automatically<br>
if (!www_authorize("", "subscriber")) {<br>xlog("L_INFO", "------ ROute 2: 10 tu[$tu]\n");<br> # authentication failed -> do challenge<br>
www_challenge("", "1");<br> exit;<br> };<br> # after DB authentication, the password is available<br>
# in $avp(55) because of the "load_credentials"<br> # module parameter.<br> xlog("SCRIPT: storing password for the first time <$avp(55)>\n");</div>
<div> # use a 20 minutes lifetime for the password;<br> # after that, it will erased from cache and we do<br> # db authentication again (refresh the passwd from DB)<br>
cache_store("local","passwd_$tu","$avp(55)",1200);</div>
<div> };</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div>When a user tries to REGISTER they get a 401 error. And in my syslog I see the following with xlog</div>
<div> </div>
<div>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: INFO:core:buf_init: initializing...<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ MAIN ROUTE: Call [REGISTER] rU[<null>] fU[9012XX2XX9]<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ MAIN ROUTE: IS REGISTER<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ ROute 2: 1 tu[<a href="mailto:sip%3A9012XX2XX9@irock.com">sip:9012XX2XX9@irock.com</a>]<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ ROute 2: 9<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ ROute 2: 10 tu[<a href="mailto:sip%3A9012XX2XX9@irock.com">sip:9012XX2XX9@irock.com</a>]<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: INFO:core:buf_init: initializing...<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ MAIN ROUTE: Call [REGISTER] rU[<null>] fU[9012XX2XX9]<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ MAIN ROUTE: IS REGISTER<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ ROute 2: 1 tu[<a href="mailto:sip%3A9012XX2XX9@irock.com">sip:9012XX2XX9@irock.com</a>]<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ ROute 2: 9<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: INFO:db_mysql:re_init_statement: query is <select ha1,rpid from subscriber where username=?>, ptr=(nil)<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: SCRIPT: storing password for the first time <<null>><br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ ROute 2: 12<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: INFO:db_mysql:re_init_statement: query is <insert into location (username,contact,expires,q,callid,cseq,flags,cflags,user_agent,received,p<br>
ath,socket,methods,last_modified,sip_instance,domain ) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)>, ptr=(nil)<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: INFO:core:buf_init: initializing...<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: ------ MAIN ROUTE: Call [REGISTER] rU[<null>] fU[9012XX2XX9]<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: ------ MAIN ROUTE: IS REGISTER<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: ------ ROute 2: 1 tu[<a href="mailto:sip%3A9012XX2XX9@irock.com">sip:9012XX2XX9@irock.com</a>]<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: ------ ROute 2: 2<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: Route 2: 2.2 storing password <<null>><br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: ------ MAIN ROUTE: Call [REGISTER] rU[<null>] fU[9012XX2XX9]<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: ------ MAIN ROUTE: IS REGISTER<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: ------ ROute 2: 1 tu[<a href="mailto:sip%3A9012XX2XX9@irock.com">sip:9012XX2XX9@irock.com</a>]<br>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: ------ ROute 2: 2<br>Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: Route 2: 2.2 storing password <<null>></div>
<div> </div>
<div> </div>
<div> </div>
<div>Why is the password showing up as <null>?????</div>