[OpenSIPS-Users] opensips Accting problem
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Tue Nov 11 11:20:14 CET 2008
Hi,
I think your problem is because you are using the same flag (1) for the
radius_flag and for log_missed_flag - use something different for
log_missed_flag.... because this flag is getting reset in cases of failure.
Regards,
Bogdan
Dilip wrote:
> Hello,
>
> We have successfully configured opensips + freeradius.
> We are using the opensip's accounting module for accounting. we can make
> a call.
> But after each call, there should be a accounting entry in radius's
> radacct table.
>
> Actually, after INVITE pkt acoounting is not starting, but in the BYE
> pkt it gives the acct Pkt.
>
> On freeradius server side,we are getting only Acct-Status-Type =Stop
> only, not the Acct-Status-Type =start .So that in the database we are
> getting the start and stop time same.
>
> Here, is our opensips.cfg file
> --------------------------------------------------------
> #################################################################################
>
> #modparam("acc", "failed_transaction_flag", 1)
> #modparam("acc", "report_cancels", 0)
> #modparam("acc", "report_ack", 0)
> #modparam("acc", "early_media", 0)
>
> #modparam("acc", "log_level", 1)
> modparam("acc", "log_flag", 1)
> modparam("acc", "log_missed_flag", 1)
>
> modparam("acc", "service_type", 15)
> modparam("acc|auth_radius",
> "radius_config","/etc/radiusclient-ng/radiusclient.conf")
> modparam("acc", "radius_flag", 1)
> modparam("acc", "radius_missed_flag", 2)
>
> modparam("acc", "radius_extra", "
> Called-Station-Id=$tu;
> Calling-Station-Id=$fu;
> Canonical-URI=$tu;
> User-Name=$au;
> Sip-User-Realm=$ar;
> Source-IP=$si;
> Source-Port=$sp;
> From-Header=$hdr(from);
> User-Agent=$hdr(user-agent);
> Contact=$hdr(contact);
> Event=$hdr(event)")
>
>
>
>
>
> route{
> xdbg("\n\n---- Start -----\n\n");
> if (!mf_process_maxfwd_header("10")) {
> sl_send_reply("483","Too Many Hops");
> exit;
> };
>
> if (msg:len >= 2048 ) {
> sl_send_reply("513", "Message too big");
> exit;
> };
>
> if (!method=="REGISTER"){
> record_route();
> };
>
> xdbg("\n\n---- Before Loose route ----\n\n");
> if (loose_route()){
> xdbg("\n\n---- Loose route ----\n\n");
> xdbg("\n\n-------- Stop Accounting --------\n\n");
> setflag(1); #Stop accounting
> #setflag(2); #Stop accounting
> route(1);
> exit;
> };
>
> if ((src_ip==X.X.X.X) ) {
> xdbg("\n\n---- From sip proxy -----\n\n");
> setflag(1);
> route(2);
> exit;
> };
>
>
> if (method=="REGISTER"){
> route(3);
> exit;
> };
> if (method=="INVITE")
> {
> xdbg("\n\n-------- Start Accounting --------\n\n");
>
> setflag(1); #Start accounting
>
> if (nat_uac_test("19"))
> {
> fix_nated_contact();
> force_rport();
> };
>
> xdbg("\n\n---- Invite............----\n\n");
>
>
> if (!radius_www_authorize(""))
> {
> xdbg("\n\n---- RADIUS ----\n\n");
> www_challenge("", "0");
> exit;
> };
>
> }else if(method=="INFO"){
> setflag(1); #Start accounting
> exit;
>
> }else if(method=="SUBSCRIBE"){
> exit;
>
> };
>
> ds_select_dst("1", "0");
> setflag(1);
> forward();
> exit;
> }
>
> # generic forward
> route[1]
> {
> if (!t_relay()) {
> sl_reply_error();
> };
> }
>
> route[2]
> {
> setflag(1); #Start accounting
> if (lookup("location"))
> {
> setflag(1); #Start accounting
> route(1);
> }else{
> sl_send_reply("404", "Not Found");
> xdbg("\n\n-------- To Asterisk --- --------\n\n");
> ds_select_dst("3", "0");
> forward();
>
> };
> }
>
> route[3]
> {
> setflag(1); #Start accounting
> if (nat_uac_test("18"))
> {
> xdbg("\n\n-------- Nated --------\n\n");
> fix_nated_register();
> force_rport();
> };
>
>
> if (!radius_www_authorize(""))
> {
> www_challenge("", "0");
> exit;
> };
>
> save("location");
> }
>
>
>
> freeradius O/p :-
>
>
> -- Walking the entire request list ---
> Cleaning up request 1 ID 175 with timestamp 4917c6d4
> Waking up in 1 seconds...
> --- Walking the entire request list ---
> Cleaning up request 2 ID 176 with timestamp 4917c6d5
> Waking up in 2 seconds...
> rad_recv: Access-Request packet from host 67.205.85.119:54665, id=180,
> length=237
> User-Name = "10009 at 67.205.85.119"
> Digest-Attributes = 0x0a073130303039
> Digest-Attributes = 0x010f36372e3230352e38352e313139
> Digest-Attributes =
> 0x0232343931376338303830303030303030376330616338616134643133636563393930613239376536343033623566623639
> Digest-Attributes =
> 0x042f7369703a31333033333337323530304036372e3230352e38352e3131393a333330303b757365723d70686f6e65
> Digest-Attributes = 0x0308494e56495445
> Digest-Response = "b62af9c297fc6385ed301c207c887136"
> Service-Type = Sip-Session
> Sip-Uri-User = "10009"
> NAS-IP-Address = 67.205.85.119
> NAS-Port = 5060
> Processing the authorize section of radiusd.conf
> modcall: entering group authorize for request 5
> modcall[authorize]: module "preprocess" returns ok for request 5
> modcall[authorize]: module "chap" returns noop for request 5
> modcall[authorize]: module "mschap" returns noop for request 5
> rlm_digest: Adding Auth-Type = DIGEST
> modcall[authorize]: module "digest" returns ok for request 5
> rlm_realm: Looking up realm "67.205.85.119" for User-Name =
> "10009 at 67.205.85.119"
> rlm_realm: Found realm "67.205.85.119"
> rlm_realm: Adding Stripped-User-Name = "10009"
> rlm_realm: Proxying request from user 10009 to realm 67.205.85.119
> rlm_realm: Adding Realm = "67.205.85.119"
> rlm_realm: Authentication realm is LOCAL.
> modcall[authorize]: module "suffix" returns noop for request 5
> rlm_eap: No EAP-Message, not doing EAP
> modcall[authorize]: module "eap" returns noop for request 5
> users: Matched entry DEFAULT at line 152
> modcall[authorize]: module "files" returns ok for request 5
> radius_xlat: '10009'
> rlm_sql (sql): sql_set_user escaped user --> '10009'
> radius_xlat: 'SELECT id, UserName, Attribute, Value, op FROM
> radcheck WHERE Username = '10009' ORDER BY id'
> rlm_sql (sql): Reserving sql socket id: 4
>
> rlm_sql (sql): Released sql socket id: 4
> modcall[authorize]: module "sql" returns ok for request 5
> modcall: leaving group authorize (returns ok) for request 5
> rad_check_password: Found Auth-Type DIGEST
> auth: type "digest"
> Processing the authenticate section of radiusd.conf
> modcall: entering group authenticate for request 5
> rlm_digest: Converting Digest-Attributes to something sane...
> Digest-User-Name = "10009"
> Digest-Realm = "67.205.85.119"
> Digest-Nonce = "4917c80800000007c0ac8aa4d13cec990a297e6403b5fb69"
> Digest-URI = "sip:13033372500 at 67.205.85.119:3300;user=phone"
> Digest-Method = "INVITE"
> A1 = 10009:67.205.85.119:1234
> A2 = INVITE:sip:13033372500 at 67.205.85.119:3300;user=phone
> H(A1) = 51f61b367b1abaf100db924c8247fada
> H(A2) = c59454d1e9496206734e22f792d7f57f
> KD =
> 51f61b367b1abaf100db924c8247fada:4917c80800000007c0ac8aa4d13cec990a297e6403b5fb69:c59454d1e9496206734e22f792d7f57f
>
> EXPECTED b62af9c297fc6385ed301c207c887136
> RECEIVED b62af9c297fc6385ed301c207c887136
> modcall[authenticate]: module "digest" returns ok for request 5
> modcall: leaving group authenticate (returns ok) for request 5
> Sending Access-Accept of id 180 to 67.205.85.119 port 54665
> Finished request 5
> Going to the next request
> --- Walking the entire request list ---
> Cleaning up request 3 ID 177 with timestamp 4917c6d7
> Waking up in 1 seconds...
> --- Walking the entire request list ---
> Cleaning up request 4 ID 179 with timestamp 4917c6d8
> Waking up in 5 seconds...
> --- Walking the entire request list ---
> Cleaning up request 5 ID 180 with timestamp 4917c6dd
> Nothing to do. Sleeping until we see a request.
> rad_recv: Accounting-Request packet from host 67.205.85.119:54665,
> id=181, length=422
> Acct-Status-Type = Stop
> Service-Type = Sip-Session
> Sip-Response-Code = 200
> Sip-Method = Bye
> Event-Timestamp = "Nov 10 2008 00:30:22 EST"
> Sip-From-Tag = "387fe440d7625640"
> Sip-To-Tag = "10115608104462043735910073"
> Acct-Session-Id = "a36469cc9c312e09 at 192.168.1.218"
> Called-Station-Id = "sip:13033372500 at 67.205.85.119:3300;user=phone"
> Calling-Station-Id = "sip:10009 at 67.205.85.119:3300;user=phone"
> Canonical-URI = "sip:13033372500 at 67.205.85.119:3300;user=phone"
> User-Name = "10009"
> Attr-111 = 0x36372e3230352e38352e313139
> Source-IP = "58.68.123.51"
> Source-Port = "64525"
> From-Header = ""urmi"
> <sip:10009 at 67.205.85.119:3300;user=phone>;tag=387fe440d7625640"
> User-Agent = "Grandstream BT120 1.1.0.2"
> NAS-IP-Address = 67.205.85.119
> NAS-Port = 5060
> Acct-Delay-Time = 0
>
>
>
>
> we are not getting the start pkt.
> Please help me.
>
>
> --------------------------------------------------------
>
>
> Thanks,
>
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
More information about the Users
mailing list