[OpenSIPS-Users] Localcache not working anymore

Duane Larson duane.larson at gmail.com
Sun Nov 13 00:16:32 CET 2011


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


Here is the config
loadmodule "cachedb_local.so"


modparam("auth_db", "calculate_ha1", 0)
modparam("auth_db", "load_credentials", "$avp(55)=ha1")
modparam("auth_db", "password_column", "ha1")
modparam("auth_db", "db_url", "mysql://x:x@127.0.0.1/opensips")

modparam("auth","username_spec","$avp(54)")
modparam("auth","password_spec","$avp(55)")


route[2] {
        #
        # -- Register request handler --
        # -- Handles all REGISTER SIP requests
        if (is_uri_host_local()) {
  xlog("L_INFO", "------ ROute 2: 1    tu[$tu]\n");
                # do we have the password cached ?
                if(cache_fetch("local","passwd_$tu",$avp(55))) {
   xlog("L_INFO", "------ ROute 2: 2\n");
                        $avp(54) = $tU;
   xlog("Route 2: 2.2 storing password <$avp(i:55)>\n");
                        # perform auth from variables
                        # $avp(54) contains the username
                        # $avp(55) contains the password

                 #xlog("SCRIPT: stored password is $avp(i:55)\n");
                 # perform auth from variables
                 # $avp(i:54) contains the username
                 # $avp(i:55) contains the password
                 if (!pv_www_authorize("")) {
                         # authentication failed -> do challenge
                         www_challenge("", "1");
                         exit;
                 };
  }
         else {
xlog("L_INFO", "------ ROute 2: 9\n");
                        # perform DB authentication ->
                        # password will be loaded from DB automatically
                        if (!www_authorize("", "subscriber")) {
xlog("L_INFO", "------ ROute 2: 10   tu[$tu]\n");
                                # authentication failed -> do challenge
                                www_challenge("", "1");
                                exit;
                        };
                        # after DB authentication, the password is available
                        # in $avp(55) because of the "load_credentials"
                        # module parameter.
                        xlog("SCRIPT: storing password for the first time
<$avp(55)>\n");
                        # use a 20 minutes lifetime for the password;
                        # after that, it will erased from cache and we do
                        # db authentication again (refresh the passwd from
DB)
                        cache_store("local","passwd_$tu","$avp(55)",1200);
                };




When a user tries to REGISTER they get a 401 error.  And in my syslog I see
the following with xlog

Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]:
INFO:core:buf_init: initializing...
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ MAIN ROUTE:
Call [REGISTER] rU[<null>] fU[9012XX2XX9]
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ MAIN ROUTE:
IS REGISTER
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ ROute 2:
1    tu[sip:9012XX2XX9 at irock.com]
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ ROute 2: 9
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22071]: ------ ROute 2:
10   tu[sip:9012XX2XX9 at irock.com]
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]:
INFO:core:buf_init: initializing...
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ MAIN ROUTE:
Call [REGISTER] rU[<null>] fU[9012XX2XX9]
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ MAIN ROUTE:
IS REGISTER
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ ROute 2:
1    tu[sip:9012XX2XX9 at irock.com]
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ ROute 2: 9
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)
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: SCRIPT: storing
password for the first time <<null>>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22069]: ------ ROute 2: 12
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
ath,socket,methods,last_modified,sip_instance,domain ) values
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)>, ptr=(nil)
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]:
INFO:core:buf_init: initializing...
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: ------ MAIN ROUTE:
Call [REGISTER] rU[<null>] fU[9012XX2XX9]
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: ------ MAIN ROUTE:
IS REGISTER
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: ------ ROute 2:
1    tu[sip:9012XX2XX9 at irock.com]
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: ------ ROute 2: 2
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22070]: Route 2: 2.2
storing password <<null>>
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: ------ MAIN ROUTE:
Call [REGISTER] rU[<null>] fU[9012XX2XX9]
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: ------ MAIN ROUTE:
IS REGISTER
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: ------ ROute 2:
1    tu[sip:9012XX2XX9 at irock.com]
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: ------ ROute 2: 2
Nov 12 16:31:41 proxy02 /usr/local/sbin/opensips[22068]: Route 2: 2.2
storing password <<null>>



Why is the password showing up as <null>?????
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20111112/67396e0f/attachment.htm>


More information about the Users mailing list