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

Brian McCrary bmccrary at lwav.net
Fri Sep 30 18:29:45 CEST 2016


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



More information about the sr-users mailing list