Hi,
My billing system doesn't correlate START/STOP accounting packets and use Cisco-VSA like attributes. I need to do an accounting compatible with my billing system from OpenSER so i've done a dirty method like that: i know it's not really performance but it's the only way i can do that.
The problem is with OpenSER 1.1.x that generate accounting with the attribute filled with the same value of "disconnect_time". example:
h323-setup-time = '1151511700' h323-connect-time = '1151511700' h323-disconnect-time = '1151511700'
the xlog debug output of openser1.1.x i have added is with correct attribute values. with OpenSER 1.0.1 everything works fine.
CONFIGS:
with OpenSER 1.1.x:
modparam("acc", "radius_extra", "h323-setup-time=$avp(setup_time); h323-connect-time=$avp(connect_time); h323-disconnect-time=$avp(disconnect_time)")
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
if (is_method("INVITE")) { avp_write("$Ts","$avp(setup_time)"); avp_db_store("$from","$avp(setup_time)");
} else if (is_method("ACK")) { avp_write("$Ts","$avp(connect_time)"); avp_db_store("$from","$avp(connect_time)");
} else if (is_method("BYE")) { avp_write("$Ts","$avp(disconnect_time)"); avp_db_store("$from","$avp(disconnect_time)"); };
if (is_method("BYE")) {
avp_db_load("$from","$avp(setup_time)"); avp_db_load("$from","$avp(connect_time)"); avp_db_load("$from","$avp(disconnect_time)");
xlog("L_INFO","Before accounting SETUP_TIME[$avp(setup_time)] CONNECT_TIME[$avp(connect_time)] DISCONNECT_TIME[$avp(disconnect_time)]");
setflag(3); setflag(5);
avp_db_delete("$from","$avp(setup_time)"); avp_db_delete("$from","$avp(connect_time)"); avp_db_delete("$from","$avp(disconnect_time)"); };
With OpenSER 1.0.1:
modparam("acc", "radius_extra", "h323-setup-time=$avp($setup_time); h323-connect-time=$avp($connect_time) ; h323-disconnect-time=$avp($disconnect_time)")
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
if (is_method("INVITE")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$setup_time"); avp_db_store("$from","$setup_time"); avp_delete("i:1");
} else if (is_method("ACK")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$connect_time"); avp_db_store("$from","$connect_time"); avp_delete("i:1");
} else if (is_method("BYE")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$disconnect_time"); avp_db_store("$from","$disconnect_time"); avp_delete("i:1");
};
if (is_method("BYE")) {
avp_db_load("$from","$setup_time"); avp_db_load("$from","$connect_time"); avp_db_load("$from","$disconnect_time");
xlog("L_INFO","Before accounting SETUP_TIME[$avp($setup_time)] CONNECT_TIME[$avp($connect_time)] DISCONNECT_TIME[$avp($disconnect_time)]");
setflag(3); setflag(5);
avp_db_delete("$from","$setup_time"); avp_db_delete("$from","$connect_time"); avp_db_delete("$from","$disconnect_time"); };
Just a thought but I am working on similar issue and I have been writing acc to db for start record with extra params and then avp_db_query to select call-id from acc table on BYE/CANCEL in order to populate these fields such as connect time. This allows me to do a single select to get the info I need from one record. Not sure if you get log setup time this what but certainly work for connect-time and disconnect time I write in real time to the h323-disconnect-time as a radius extra.
Either way I would think you would want to be using call-id and not from as your primary key to store and load these things.
-----Original Message----- From: users-bounces@openser.org [mailto:users-bounces@openser.org] On Behalf Of tele Sent: Wednesday, June 28, 2006 12:50 PM To: users@openser.org Subject: [Users] avp problems switching from 1.0.1 to 1.1.x
Hi,
My billing system doesn't correlate START/STOP accounting packets and use Cisco-VSA like attributes. I need to do an accounting compatible with my billing system from OpenSER so i've done a dirty method like that: i know it's not really performance but it's the only way i can do that.
The problem is with OpenSER 1.1.x that generate accounting with the attribute filled with the same value of "disconnect_time". example:
h323-setup-time = '1151511700' h323-connect-time = '1151511700' h323-disconnect-time = '1151511700'
the xlog debug output of openser1.1.x i have added is with correct attribute values. with OpenSER 1.0.1 everything works fine.
CONFIGS:
with OpenSER 1.1.x:
modparam("acc", "radius_extra", "h323-setup-time=$avp(setup_time); h323-connect-time=$avp(connect_time); h323-disconnect-time=$avp(disconnect_time)")
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
if (is_method("INVITE")) { avp_write("$Ts","$avp(setup_time)"); avp_db_store("$from","$avp(setup_time)");
} else if (is_method("ACK")) { avp_write("$Ts","$avp(connect_time)"); avp_db_store("$from","$avp(connect_time)");
} else if (is_method("BYE")) { avp_write("$Ts","$avp(disconnect_time)"); avp_db_store("$from","$avp(disconnect_time)"); };
if (is_method("BYE")) {
avp_db_load("$from","$avp(setup_time)"); avp_db_load("$from","$avp(connect_time)"); avp_db_load("$from","$avp(disconnect_time)");
xlog("L_INFO","Before accounting SETUP_TIME[$avp(setup_time)] CONNECT_TIME[$avp(connect_time)] DISCONNECT_TIME[$avp(disconnect_time)]");
setflag(3); setflag(5);
avp_db_delete("$from","$avp(setup_time)"); avp_db_delete("$from","$avp(connect_time)"); avp_db_delete("$from","$avp(disconnect_time)"); };
With OpenSER 1.0.1:
modparam("acc", "radius_extra", "h323-setup-time=$avp($setup_time); h323-connect-time=$avp($connect_time) ; h323-disconnect-time=$avp($disconnect_time)")
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
if (is_method("INVITE")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$setup_time"); avp_db_store("$from","$setup_time"); avp_delete("i:1");
} else if (is_method("ACK")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$connect_time"); avp_db_store("$from","$connect_time"); avp_delete("i:1");
} else if (is_method("BYE")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$disconnect_time"); avp_db_store("$from","$disconnect_time"); avp_delete("i:1");
};
if (is_method("BYE")) {
avp_db_load("$from","$setup_time"); avp_db_load("$from","$connect_time"); avp_db_load("$from","$disconnect_time");
xlog("L_INFO","Before accounting SETUP_TIME[$avp($setup_time)] CONNECT_TIME[$avp($connect_time)] DISCONNECT_TIME[$avp($disconnect_time)]");
setflag(3); setflag(5);
avp_db_delete("$from","$setup_time"); avp_db_delete("$from","$connect_time"); avp_db_delete("$from","$disconnect_time"); };
_______________________________________________ Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
On Wed, 28 Jun 2006 13:10:30 -0400, "Glenn Dalgliesh" glenn@routerboy.com wrote:
Just a thought but I am working on similar issue and I have been writing acc to db for start record with extra params and then avp_db_query to select call-id from acc table on BYE/CANCEL in order to populate these fields such as connect time. This allows me to do a single select to get the info I need from one record. Not sure if you get log setup time this what but certainly work for connect-time and disconnect time I write in real time to the h323-disconnect-time as a radius extra.
Hmmm but the avps are populated with correct values. i'll try with avp_db_query maybe it works.
Either way I would think you would want to be using call-id and not from as your primary key to store and load these things.
maybe yes. i'll try
-----Original Message----- From: users-bounces@openser.org [mailto:users-bounces@openser.org] On Behalf Of tele Sent: Wednesday, June 28, 2006 12:50 PM To: users@openser.org Subject: [Users] avp problems switching from 1.0.1 to 1.1.x
Hi,
My billing system doesn't correlate START/STOP accounting packets and use Cisco-VSA like attributes. I need to do an accounting compatible with my billing system from OpenSER so i've done a dirty method like that: i know it's not really performance but it's the only way i can do that.
The problem is with OpenSER 1.1.x that generate accounting with the attribute filled with the same value of "disconnect_time". example:
h323-setup-time = '1151511700' h323-connect-time = '1151511700' h323-disconnect-time = '1151511700'
the xlog debug output of openser1.1.x i have added is with correct attribute values. with OpenSER 1.0.1 everything works fine.
CONFIGS:
with OpenSER 1.1.x:
modparam("acc", "radius_extra", "h323-setup-time=$avp(setup_time); h323-connect-time=$avp(connect_time); h323-disconnect-time=$avp(disconnect_time)")
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
if (is_method("INVITE")) { avp_write("$Ts","$avp(setup_time)"); avp_db_store("$from","$avp(setup_time)");
} else if (is_method("ACK")) { avp_write("$Ts","$avp(connect_time)"); avp_db_store("$from","$avp(connect_time)");
} else if (is_method("BYE")) { avp_write("$Ts","$avp(disconnect_time)"); avp_db_store("$from","$avp(disconnect_time)"); };
if (is_method("BYE")) { avp_db_load("$from","$avp(setup_time)"); avp_db_load("$from","$avp(connect_time)"); avp_db_load("$from","$avp(disconnect_time)"); xlog("L_INFO","Before accounting
SETUP_TIME[$avp(setup_time)] CONNECT_TIME[$avp(connect_time)] DISCONNECT_TIME[$avp(disconnect_time)]");
setflag(3); setflag(5); avp_db_delete("$from","$avp(setup_time)"); avp_db_delete("$from","$avp(connect_time)"); avp_db_delete("$from","$avp(disconnect_time)"); };
With OpenSER 1.0.1:
modparam("acc", "radius_extra", "h323-setup-time=$avp($setup_time); h323-connect-time=$avp($connect_time) ; h323-disconnect-time=$avp($disconnect_time)")
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
if (is_method("INVITE")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$setup_time"); avp_db_store("$from","$setup_time"); avp_delete("i:1"); } else if (is_method("ACK")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$connect_time"); avp_db_store("$from","$connect_time"); avp_delete("i:1"); } else if (is_method("BYE")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$disconnect_time"); avp_db_store("$from","$disconnect_time"); avp_delete("i:1"); }; if (is_method("BYE")) { avp_db_load("$from","$setup_time"); avp_db_load("$from","$connect_time"); avp_db_load("$from","$disconnect_time"); xlog("L_INFO","Before accounting
SETUP_TIME[$avp($setup_time)] CONNECT_TIME[$avp($connect_time)] DISCONNECT_TIME[$avp($disconnect_time)]");
setflag(3); setflag(5); avp_db_delete("$from","$setup_time"); avp_db_delete("$from","$connect_time"); avp_db_delete("$from","$disconnect_time"); };
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
tele@plexia.com wrote:
On Wed, 28 Jun 2006 13:10:30 -0400, "Glenn Dalgliesh" glenn@routerboy.com wrote:
Either way I would think you would want to be using call-id and not from as your primary key to store and load these things
thanks! Ok i'm using the call-id and with the avp_db_query it works but with avp_db_load not. this is what i have done:
working:
avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='setup_time'","$avp(setup_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='connect_time'","$avp(connect_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='disconnect_time'","$avp(disconnect_time)");
not working:
avp_db_load("$ci","$avp(setup_time)"); avp_db_load("$ci","$avp(connect_time)"); avp_db_load("$ci","$avp(disconnect_time)");
-----Original Message----- From: users-bounces@openser.org [mailto:users-bounces@openser.org] On Behalf Of tele Sent: Wednesday, June 28, 2006 12:50 PM To: users@openser.org Subject: [Users] avp problems switching from 1.0.1 to 1.1.x
Hi,
My billing system doesn't correlate START/STOP accounting packets and use Cisco-VSA like attributes. I need to do an accounting compatible with my billing system from OpenSER so i've done a dirty method like that: i know it's not really performance but it's the only way i can do that.
The problem is with OpenSER 1.1.x that generate accounting with the attribute filled with the same value of "disconnect_time". example:
h323-setup-time = '1151511700' h323-connect-time = '1151511700' h323-disconnect-time = '1151511700'
the xlog debug output of openser1.1.x i have added is with correct attribute values. with OpenSER 1.0.1 everything works fine.
CONFIGS:
with OpenSER 1.1.x:
modparam("acc", "radius_extra", "h323-setup-time=$avp(setup_time); h323-connect-time=$avp(connect_time); h323-disconnect-time=$avp(disconnect_time)")
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
if (is_method("INVITE")) { avp_write("$Ts","$avp(setup_time)"); avp_db_store("$from","$avp(setup_time)");
} else if (is_method("ACK")) { avp_write("$Ts","$avp(connect_time)"); avp_db_store("$from","$avp(connect_time)");
} else if (is_method("BYE")) { avp_write("$Ts","$avp(disconnect_time)"); avp_db_store("$from","$avp(disconnect_time)"); };
if (is_method("BYE")) { avp_db_load("$from","$avp(setup_time)"); avp_db_load("$from","$avp(connect_time)"); avp_db_load("$from","$avp(disconnect_time)"); xlog("L_INFO","Before accounting
SETUP_TIME[$avp(setup_time)] CONNECT_TIME[$avp(connect_time)] DISCONNECT_TIME[$avp(disconnect_time)]");
setflag(3); setflag(5); avp_db_delete("$from","$avp(setup_time)"); avp_db_delete("$from","$avp(connect_time)"); avp_db_delete("$from","$avp(disconnect_time)"); };
With OpenSER 1.0.1:
modparam("acc", "radius_extra", "h323-setup-time=$avp($setup_time); h323-connect-time=$avp($connect_time) ; h323-disconnect-time=$avp($disconnect_time)")
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
if (is_method("INVITE")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$setup_time"); avp_db_store("$from","$setup_time"); avp_delete("i:1"); } else if (is_method("ACK")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$connect_time"); avp_db_store("$from","$connect_time"); avp_delete("i:1"); } else if (is_method("BYE")) { avp_write("0","i:1"); avp_printf("i:1", "$Ts"); avp_copy("i:1","$disconnect_time"); avp_db_store("$from","$disconnect_time"); avp_delete("i:1"); }; if (is_method("BYE")) { avp_db_load("$from","$setup_time"); avp_db_load("$from","$connect_time"); avp_db_load("$from","$disconnect_time"); xlog("L_INFO","Before accounting
SETUP_TIME[$avp($setup_time)] CONNECT_TIME[$avp($connect_time)] DISCONNECT_TIME[$avp($disconnect_time)]");
setflag(3); setflag(5); avp_db_delete("$from","$setup_time"); avp_db_delete("$from","$connect_time"); avp_db_delete("$from","$disconnect_time"); };
Hi,
avp_db_load() will consider the psseudo variable as uuid, so both calls should do the same. Could you just check on mysql level what are the queries done in the two cases? (check the text log of mysql).
regards, Bogdan
tele wrote:
thanks! Ok i'm using the call-id and with the avp_db_query it works but with avp_db_load not. this is what i have done:
working:
avp_db_query("select value from usr_preferences where uuid='$ci'
and attribute='setup_time'","$avp(setup_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='connect_time'","$avp(connect_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='disconnect_time'","$avp(disconnect_time)");
not working:
avp_db_load("$ci","$avp(setup_time)"); avp_db_load("$ci","$avp(connect_time)"); avp_db_load("$ci","$avp(disconnect_time)");
Bogdan-Andrei Iancu wrote:
Hi,
avp_db_load() will consider the psseudo variable as uuid, so both calls should do the same. Could you just check on mysql level what are the queries done in the two cases? (check the text log of mysql).
we can see that the query are the same, except of avp_db_load that include the fields attribute,type. maybe it aspect an integer value (i use unixtime ex: 1151579428). but i have declared avp as string:
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
with avp_db_query() :
T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] j....select value from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' and attribute='setup_time' # T 127.0.0.1:3306 -> 127.0.0.1:56842 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@.............1151579428.........
# T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] l....select value from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' and attribute='connect_time' # T 127.0.0.1:3306 -> 127.0.0.1:56842 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@.............1151579434.........
# T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] o....select value from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' and attribute='disconnect_time' # T 127.0.0.1:3306 -> 127.0.0.1:56842 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@.............1151579455.........
# T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] d....delete from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' AND attribute='setup_time'
with avp_db_load() :
# T 127.0.0.1:50918 -> 127.0.0.1:3306 [AP] y....select value,attribute,type from usr_preferences where uuid='4c3cd5e6b08ea471@82.215.128.140' AND attribute='setup_time' # T 127.0.0.1:3306 -> 127.0.0.1:50918 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@...M....def.openser.usr_preferences.usr_preferences.attribute.attribute... .....@...C....
def.openser.usr_preferences.usr_preferences.type.type.?.......@.............1151579809.setup_time.1.........
# T 127.0.0.1:50918 -> 127.0.0.1:3306 [AP] {....select value,attribute,type from usr_preferences where uuid='4c3cd5e6b08ea471@82.215.128.140' AND attribute='connect_time' # T 127.0.0.1:3306 -> 127.0.0.1:50918 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@...M....def.openser.usr_preferences.usr_preferences.attribute.attribute... .....@...C....
def.openser.usr_preferences.usr_preferences.type.type.?.......@.............1151579816.connect_time.1.........
# T 127.0.0.1:50918 -> 127.0.0.1:3306 [AP] ~....select value,attribute,type from usr_preferences where uuid='4c3cd5e6b08ea471@82.215.128.140' AND attribute='disconnect_time' # T 127.0.0.1:3306 -> 127.0.0.1:50918 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@...M....def.openser.usr_preferences.usr_preferences.attribute.attribute... .....@...C....
def.openser.usr_preferences.usr_preferences.type.type.?.......@.............1151579823.disconnect_time.1.........
#
tele wrote:
thanks! Ok i'm using the call-id and with the avp_db_query it works but with avp_db_load not. this is what i have done:
working:
avp_db_query("select value from usr_preferences where uuid='$ci'
and attribute='setup_time'","$avp(setup_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='connect_time'","$avp(connect_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='disconnect_time'","$avp(disconnect_time)");
not working:
avp_db_load("$ci","$avp(setup_time)"); avp_db_load("$ci","$avp(connect_time)"); avp_db_load("$ci","$avp(disconnect_time)");
Most probably avp_db_load() discards the record returned by DB because of type. The record has type 1 - AVP with string name and integer value. even so, I do not see an obviously reason for discarding it. could you run with full debug and post the part related to the avp_db_load() ?
regards, bogdan
tele wrote:
Bogdan-Andrei Iancu wrote:
Hi,
avp_db_load() will consider the psseudo variable as uuid, so both calls should do the same. Could you just check on mysql level what are the queries done in the two cases? (check the text log of mysql).
we can see that the query are the same, except of avp_db_load that include the fields attribute,type. maybe it aspect an integer value (i use unixtime ex: 1151579428). but i have declared avp as string:
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
with avp_db_query() :
T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] j....select value from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' and attribute='setup_time' # T 127.0.0.1:3306 -> 127.0.0.1:56842 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@.............1151579428.........
# T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] l....select value from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' and attribute='connect_time' # T 127.0.0.1:3306 -> 127.0.0.1:56842 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@.............1151579434.........
# T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] o....select value from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' and attribute='disconnect_time' # T 127.0.0.1:3306 -> 127.0.0.1:56842 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@.............1151579455.........
# T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] d....delete from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' AND attribute='setup_time'
with avp_db_load() :
# T 127.0.0.1:50918 -> 127.0.0.1:3306 [AP] y....select value,attribute,type from usr_preferences where uuid='4c3cd5e6b08ea471@82.215.128.140' AND attribute='setup_time' # T 127.0.0.1:3306 -> 127.0.0.1:50918 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@...M....def.openser.usr_preferences.usr_preferences.attribute.attribute... .....@...C....
def.openser.usr_preferences.usr_preferences.type.type.?.......@.............1151579809.setup_time.1.........
# T 127.0.0.1:50918 -> 127.0.0.1:3306 [AP] {....select value,attribute,type from usr_preferences where uuid='4c3cd5e6b08ea471@82.215.128.140' AND attribute='connect_time' # T 127.0.0.1:3306 -> 127.0.0.1:50918 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@...M....def.openser.usr_preferences.usr_preferences.attribute.attribute... .....@...C....
def.openser.usr_preferences.usr_preferences.type.type.?.......@.............1151579816.connect_time.1.........
# T 127.0.0.1:50918 -> 127.0.0.1:3306 [AP] ~....select value,attribute,type from usr_preferences where uuid='4c3cd5e6b08ea471@82.215.128.140' AND attribute='disconnect_time' # T 127.0.0.1:3306 -> 127.0.0.1:50918 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@...M....def.openser.usr_preferences.usr_preferences.attribute.attribute... .....@...C....
def.openser.usr_preferences.usr_preferences.type.type.?.......@.............1151579823.disconnect_time.1.........
#
tele wrote:
thanks! Ok i'm using the call-id and with the avp_db_query it works but with avp_db_load not. this is what i have done:
working:
avp_db_query("select value from usr_preferences where uuid='$ci'
and attribute='setup_time'","$avp(setup_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='connect_time'","$avp(connect_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='disconnect_time'","$avp(disconnect_time)");
not working:
avp_db_load("$ci","$avp(setup_time)"); avp_db_load("$ci","$avp(connect_time)"); avp_db_load("$ci","$avp(disconnect_time)");
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
Bogdan-Andrei Iancu wrote:
Most probably avp_db_load() discards the record returned by DB because of type. The record has type 1 - AVP with string name and integer value. even so, I do not see an obviously reason for discarding it.
True is correct i can see val_int and val_str. i understand where was the problem. thank you bogdan!
3(38201) db_flags=1, flags=4 3(38201) DEBUG:avpops:load_avps: loaded avps = 1 3(38201) db_flags=1, flags=4 3(38201) DEBUG:avpops:load_avps: loaded avps = 1 3(38201) db_flags=1, flags=4 3(38201) DEBUG:avpops:load_avps: loaded avps = 1 3(38201) db_flags=3, flags=4 3(38201) DEBUG:avpops:load_avps: loaded avps = 1 3(38201) INFO:avpops:print_avp: p=0x285255a0, flags=0x0083 3(38201) INFO: name=<remote_address> 3(38201) INFO: val_str=<82.215.163.5 / 12> 3(38201) INFO:avpops:print_avp: p=0x28523b78, flags=0x0081 3(38201) INFO: name=<connect_time> 3(38201) INFO: val_int=<1151582690> 3(38201) INFO:avpops:print_avp: p=0x28523b28, flags=0x0081 3(38201) INFO: name=<setup_time> 3(38201) INFO: val_int=<1151582687> 3(38201) INFO:avpops:print_avp: p=0x28523ba0, flags=0x0081 3(38201) INFO: name=<disconnect_time> 3(38201) INFO: val_int=<1151582703>
could you run with full debug and post the part related to the avp_db_load() ?
regards, bogdan
tele wrote:
Bogdan-Andrei Iancu wrote:
Hi,
avp_db_load() will consider the psseudo variable as uuid, so both calls should do the same. Could you just check on mysql level what are the queries done in the two cases? (check the text log of mysql).
we can see that the query are the same, except of avp_db_load that include the fields attribute,type. maybe it aspect an integer value (i use unixtime ex: 1151579428). but i have declared avp as string:
modparam("avpops","avp_aliases","setup_time=s:setup_time") modparam("avpops","avp_aliases","connect_time=s:connect_time") modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
with avp_db_query() :
T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] j....select value from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' and attribute='setup_time' # T 127.0.0.1:3306 -> 127.0.0.1:56842 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@.............1151579428.........
# T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] l....select value from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' and attribute='connect_time' # T 127.0.0.1:3306 -> 127.0.0.1:56842 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@.............1151579434.........
# T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] o....select value from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' and attribute='disconnect_time' # T 127.0.0.1:3306 -> 127.0.0.1:56842 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@.............1151579455.........
# T 127.0.0.1:56842 -> 127.0.0.1:3306 [AP] d....delete from usr_preferences where uuid='cd24f1e60e6eb449@82.215.128.140' AND attribute='setup_time'
with avp_db_load() :
# T 127.0.0.1:50918 -> 127.0.0.1:3306 [AP] y....select value,attribute,type from usr_preferences where uuid='4c3cd5e6b08ea471@82.215.128.140' AND attribute='setup_time' # T 127.0.0.1:3306 -> 127.0.0.1:50918 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@...M....def.openser.usr_preferences.usr_preferences.attribute.attribute... .....@...C....
def.openser.usr_preferences.usr_preferences.type.type.?.......@.............1151579809.setup_time.1.........
# T 127.0.0.1:50918 -> 127.0.0.1:3306 [AP] {....select value,attribute,type from usr_preferences where uuid='4c3cd5e6b08ea471@82.215.128.140' AND attribute='connect_time' # T 127.0.0.1:3306 -> 127.0.0.1:50918 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@...M....def.openser.usr_preferences.usr_preferences.attribute.attribute... .....@...C....
def.openser.usr_preferences.usr_preferences.type.type.?.......@.............1151579816.connect_time.1.........
# T 127.0.0.1:50918 -> 127.0.0.1:3306 [AP] ~....select value,attribute,type from usr_preferences where uuid='4c3cd5e6b08ea471@82.215.128.140' AND attribute='disconnect_time' # T 127.0.0.1:3306 -> 127.0.0.1:50918 [AP]
.....E....def.openser.usr_preferences.usr_preferences.value.value.........@...M....def.openser.usr_preferences.usr_preferences.attribute.attribute... .....@...C....
def.openser.usr_preferences.usr_preferences.type.type.?.......@.............1151579823.disconnect_time.1.........
#
tele wrote:
thanks! Ok i'm using the call-id and with the avp_db_query it works but with avp_db_load not. this is what i have done:
working:
avp_db_query("select value from usr_preferences where
uuid='$ci' and attribute='setup_time'","$avp(setup_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='connect_time'","$avp(connect_time)"); avp_db_query("select value from usr_preferences where uuid='$ci' and attribute='disconnect_time'","$avp(disconnect_time)");
not working:
avp_db_load("$ci","$avp(setup_time)"); avp_db_load("$ci","$avp(connect_time)"); avp_db_load("$ci","$avp(disconnect_time)");
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users