[Kamailio-Users] Call duration with RADIUS support
mbsip
mbsip at gazeta.pl
Wed Nov 25 15:36:12 CET 2009
Hi,
I am struggling with kamailio and radius configuration to achieve
proper Call duration notification.
Here is what i have:
- kamailio 1.6
- radiusclient-ng
- freeradius on different server
Kamailio configuration has following radius-extra:
modparam("acc", "radius_extra", "User-Name=$Au; \
Calling-Station-Id=$from; \
Called-Station-Id=$to; \
Sip-Translated-Request-URI=$ruri; \
Sip-RPid=$avp(s:rpid); \
Source-IP=$si; \
Source-Port=$sp; \
Canonical-URI=$avp(s:can_uri); \
Billing-Party=$avp(s:billing_party); \
Divert-Reason=$avp(s:divert_reason); \
X-RTP-Stat=$hdr(X-RTP-Stat); \
Contact=$hdr(contact); \
Event=$hdr(event); \
SIP-Proxy-IP=$avp(s:sip_proxy_ip); \
ENUM-TLD=$avp(s:enum_tld)")
which produce following radius data START and STOP:
Mon Nov 23 16:26:38 2009
Acct-Status-Type = Start
Service-Type = IAPP-Register
Sip-Response-Code = 200
Sip-Method = Invite
Event-Timestamp = 1258990835
Sip-From-Tag = "c3716c01"
Sip-To-Tag = "11544D08-C80"
Acct-Session-Id = "Nzg5MmZlMDNkMGUwODgwN2ZkZWZkMmQ3NzYwYzNkNWY."
User-Name = "Mac at xx.yy.zz.vv"
Calling-Station-Id = "sip:Mac at xx.yy.zz.vv"
Called-Station-Id = "sip:123456789 at xx.yy.zz.vv"
Sip-Translated-Request-URI = "sip:123456789 at aa.bb.cc.dd"
X-Ascend-Send-Secret = 0x3135372e32352e3139322e32
X-Ascend-Receive-Secret = 0x3a7c
X-Ascend-Netware-timeout =
0x3c7369703a4d616369656a403139322e3136382e332e3132353a36323034323e
NAS-Port = 5060
Acct-Delay-Time = 0
NAS-IP-Address = xx.yy.zz.vv
Client-IP-Address = xx.yy.zz.vv
Acct-Unique-Session-Id = "a62f94528d34acfe"
Timestamp = 1258989998
Mon Nov 23 16:26:38 2009
Acct-Status-Type = Stop
Service-Type = IAPP-Register
Sip-Response-Code = 200
Sip-Method = 8
Event-Timestamp = 1258990836
Sip-From-Tag = "c3716c01"
Sip-To-Tag = "11544D08-C80"
Acct-Session-Id = "Nzg5MmZlMDNkMGUwODgwN2ZkZWZkMmQ3NzYwYzNkNWY."
User-Name = "Mac at xx.yy.zz.vv"
Calling-Station-Id = "sip:Mac at xx.yy.zz.vv"
Called-Station-Id = "sip:123456789 at xx.yy.zz.vv"
Sip-Translated-Request-URI = "sip:123456789 at aa.bb.cc.dd:5060"
X-Ascend-Send-Secret = 0x3135372e32352e3139322e32
X-Ascend-Receive-Secret = 0x3a7c
X-Ascend-Netware-timeout =
0x3c7369703a4d616369656a403139322e3136382e332e3132353a36323034323e
NAS-Port = 5060
Acct-Delay-Time = 0
NAS-IP-Address = xx.yy.zz.vv
Client-IP-Address = xx.yy.zz.vv
Acct-Unique-Session-Id = "a62f94528d34acfe"
Timestamp = 1258989998
The task is to upload all stored radius messages into MYSQL with
proper call duration info.
I've ran through many posts and found a few way-outs:
1) to use AVPOPS module:
modparam("acc", "radius_extra", "Acct-Session-Time=$avp(call_length)")
modparam( "avpops", "avp_aliases", "start_timestamp=i:100")
modparam( "avpops", "avp_aliases", "end_timestamp=i:101")
modparam( "avpops", "avp_aliases", "call_length=i:102")
avp_op("$avp(end_timestamp)","sub/$avp(start_timestamp)");
avp_op("$avp(end_timestamp)/$avp(call_length)","sub/$avp(start_timestamp)");
2) to use DIALOG module
modparam("acc", "radius_config",
"/usr/local/etc/radiusclient-ng/radiusclient.conf")
modparam("acc", "radius_flag", 1)
modparam("acc", "radius_extra", "Acct-Session-Time=$avp(i:921)")
if (is_method("BYE")) {
xlog("L_INFO", "dialog_status:$DLG_status
duration=$DLG_lifetime\n");
$avp(i:921) = $DLG_lifetime{s.int};
} else {
$avp(i:921) = 0;
}
setflag(1);
3) to use a script or db triggers(after STOP).
Could you advice which one is better/work properly.
Maybe there are any other configuration i could use.
Thanks in advance,
Maciej
More information about the sr-users
mailing list