[SR-Users] Migrating from OpenSER config file question.

Brian McCrary bmccrary at lwav.net
Thu Oct 6 00:56:32 CEST 2016


Hello,

Thanks so much for the help in pointing me in the right direction.  I 
finally had some time today to work with Kamailio a little.  I should 
have pointed out I had commented the avp_write line out in the config 
file and had attempted to convert it to the new format as you had 
suggested.  I had $avp(s:callfwd) = $ruri; instead of $avp(callfwd) = 
$ruri; but it seems both give the same error.

With that being said, thanks for pointing out the sqlops module.  It 
looks like I should be able to make it do everything I need, and then 
some.  There are some things I have been wanting to improve upon and it 
looks like this will certainly help.  There has been a lot of really 
nice things added to these new releases!  I'm going to give that a go 
and see if I can fix the error by eliminating the problem altogether. :)

Thanks,

Brian

On Mon, Oct 03, 2016 at 09:00:24PM +0200, Daniel-Constantin Mierla wrote:
> Hello,
> 
> hmm, the format $avp(s:callfwd) should still work fine. I will look
> deeper at it when I get a chance after returning to the office in few
> days. Anyhow, try to use $avp(callfwd), it is the same as $avp(callfwd)
> if you haven't defined an overlapping avp-alias.
> 
> On the other hand, I think avp_write(...) is no longer available. Now
> you can use direct assignment, like:
> 
> $avp(callfwd) = $ruri;
> 
> One very useful additions (in newer versions than 1.0, otherwise being
> quite old by now) is the sqlops module that allows to do all kind of sql
> operations from configuration file, in many cases saving from the
> complexity of using avpops db functions. See:
> 
> https://www.kamailio.org/docs/modules/stable/modules/sqlops.html#idp44901364
> 
> So you can do INSERT/UPDATE/REPLACE/... as you need from config file,
> building the sql query with the variables you want.
> 
> Cheers,
> Daniel
> 
> On 30/09/16 18:29, Brian McCrary wrote:
> > Hello group,
> >
> > I know this may be hard to believe but I'm in the process of upgrading 
> > an old, but stable, OpenSER 1.0 group of servers to Kamilio.  I'm 
> > basically going to sort of start from scratch with the database and 
> > export my old MySQL database and write some scripts to reimport the data 
> > using kamctl scripts since the database structure has changed 
> > substantially since then it looks like.
> >
> > I've mostly migrated the config file over fairly easily, except for 
> > AVPops.  I've got a section of config file that writes into the 
> > usr_preferences database for call forwarding, but I seem to get the same 
> > error anywhere I try to write to the database using AVPops.  Here's the 
> > output I get when checking the config:
> >
> >  0(1378) DEBUG: <core> [pvapi.c:268]: pv_cache_add(): PV cache not initialized, doing it now
> >  0(1378) ERROR: <core> [pvapi.c:828]: pv_parse_spec2(): error searching pvar "avp"
> >  0(1378) ERROR: <core> [pvapi.c:1032]: pv_parse_spec2(): wrong char [s/115] in [$avp(s:callfwd)] at [5 (5)]
> >  0(1378) : <core> [cfg.y:3368]: yyerror_at(): parse error in config file 
> > /usr/local/etc/kamailio/kamailio.cfg, line 145, column 4-18: Can't get from cache: $avp(s:callfwd)
> > ERROR: bad config file (1 errors)
> >
> > Here's what I think are the revelant portions of the config file:
> >
> > modparam("avpops", "db_url", "mysql://user:pass@localhost/kamailio")
> > modparam("avpops", "avp_table", "usr_preferences")
> > modparam("avpops", "uuid_column", "uuid")
> > modparam("avpops", "username_column", "username")
> > modparam("avpops", "domain_column", "domain")
> > modparam("avpops", "attribute_column", "attribute")
> > modparam("avpops", "value_column", "value")
> > modparam("avpops", "type_column", "type")
> > <snip>
> >                         if (avp_db_load("$from/username", "$avp(s:callfwd)"))
> >                         {
> >                                 if(!avp_db_delete("$from/username", "$avp(s:callfwd)/usr_preferences"))
> >                                 {
> >                                         sl_send_reply("500", "Server DB error");                                }
> >                                 }
> >
> > #                       avp_write("$ruri","$avp(s:callfwd)"); # Old OpenSER 1.0 syntax...
> >                         $avp(s:callfwd) = $ruri; # New Kamailio syntax ??
> >                         avp_db_store("$from/username","$avp(s:callfwd)/usr_preferences");
> >                         t_relay();
> >                         return;
> >
> > Basically I just want to write the ruri into the usr_preferences 
> > database with an attribute of callfwd but not sure what I'm missing.  I 
> > see the error "Can't get from cache" but not sure how that pertains to 
> > what I'm trying to do.  Anyone have any ideas?
> >
> > Thanks,
> >
> > Brian
> >
> > _______________________________________________
> > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> > sr-users at lists.sip-router.org
> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> 
> -- 
> Daniel-Constantin Mierla
> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
> Kamailio Advanced Training, Berlin, Oct 24-26, 2016 - http://www.asipto.com




More information about the sr-users mailing list