[Users] avp_db_load problem

Jayesh Nambiar voip_freak at yahoo.co.in
Wed Apr 12 00:06:08 CEST 2006


Hi all,
  I was trying to do the following:
  Whenever a user presses *86 and then any number, first openser should check
  in the subscriber table, whether the value for features column is 1. (I've added an extra column features in the table subscriber with datatype int).
  If the value is 0, he should be replied with the message Forbidden.
  I tried doing the following:
   
  modparam("avpops","db_scheme",
       "scheme1:username_col=username;value_col=features;table=subscriber")
   
  if(uri=~"sip:\*86[0-9]*@") {
                log(1,"entered condition");
                if(avp_db_load("$fU", "$avp(s:features)/$scheme1")) {
                log(1,"db load succeeded");
                if(!avp_check("$avp(s:features)", "eq/1/g")) {
                        sl_send_reply("403", "Forbidden");
                        exit;
                };
                strip(3);
                log(1,"stripped");
                avp_db_query("insert into usr_preferences values('', '$fU', '', 'callfwd', '', '$ruri', 'CURRENT_TIMESTAMP')");
                sl_send_reply("200", "OK");
                exit;
        };
          };

  But in the logs I only get "condition succeeded" which means it does not do the avp_db_load() properly.
   
  Can someone please help me in what should be the exact syntax to load it from the db and then check the value.
   
  thanks in advance,
  jayesh

				
---------------------------------
 Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/users/attachments/20060411/ba96f772/attachment.htm 


More information about the Users mailing list