[Serusers] Problems with avp_db_load and db_query

Ravin Suri ravinsuri.iptel at doclinx.com
Mon Jul 9 19:51:28 CEST 2007


Hello everyone,

I am facing a problem trying to load data from MySQL in ser.cfg.  I need to
load the subsciber's email address in order to pass it to SEMS.  I've tried
two modules (avpops and db_ops) both with no success.

I am using Ser 2.0.0-rc1 and I added an 'email' column to the uri table.
Here is the DB schema (only 1 row shown without did, flags and scheme
colums):

+--------------+------------------------------+--------------------------+
| username     | uid                          | email                    |
+--------------+------------------------------+--------------------------+
| sb4157762898 | sb4157762898 at sq2.doclinx.com | sb4157762898 at doclinx.com 
| |
+--------------+------------------------------+--------------------------+


A. avpops module.  I have the following module params:

   modparam("avpops", "avp_table", "uri")
   modparam("avpops", "uid_column", "uid");
   modparam("avpops", "avp_aliases", "email=i:47")
   modparam("avpops", "db_scheme",
 
"email_scheme:table=uri;uid_col=uid;value_col=email;value_type=string")

Then when I'm going to forward to SEMS:

   avp_db_load("$to", "$email/$email_scheme");
   xlog("L_INFO", 
        "route INBOUND[%rm]: voicemail, email=%$email, from: [%fu], To:
[%tu]\n");

   append_hf("P-App-Name: voicemail\r\n");
   append_hf("P-App-Param: Email-Address=%$email\r\n");
   rewritehostport("127.0.0.1:5070");
   t_relay_to_udp("127.0.0.1","5070");

Here is the appropriate excerpt from the SER log (from the xlog statement
above):

Jul  9 13:12:39 sq2 /usr/local/sbin/ser[5595]: route INBOUND[INVITE]:
voicemail, email=<null>, from: [sip:sb7037160791 at sq2.doclinx.com], To:
[sip:sb4157762898 at sq2.doclinx.com]



2. db_ops module.  I have the following module params:

modparam("db_ops", "declare_query", "select/uri/email/uid///%$t.uid");

Then when I'm going to forward to SEMS:

   $email = @db_query[0];
   xlog("L_INFO", 
        "route INBOUND[%rm]: voicemail, email=%$email, from: [%fu], To:
[%tu]\n");

   append_hf("P-App-Name: voicemail\r\n");
   append_hf("P-App-Param: Email-Address=%$email\r\n");
   rewritehostport("127.0.0.1:5070");
   t_relay_to_udp("127.0.0.1","5070");

This makes SER fail on startup with this message:

 0(5693) Unable to resolve select 'db_query' at level 0
 0(5693) BUG: route.c:492: Unable to resolve select
ERROR: error -1 while trying to fix configuration

I have followed the README file in db_ops to the letter.  What am I missng?

I'd be be happy to post ser.cfg and the log file.

Thank you very much for your help.  

Best regards,

- Ravin




More information about the sr-users mailing list