Off route server CDR recording

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Off route server CDR recording

Charles Solar
Hey guys, I am trying to setup a cdr storehouse off of my main routing server. 
I send invites and byes to the server but the accounting module just refuses to record anything. 

I am wondering if I need to satisfy some requirement other then setting flags for acc to record messages.

Here is the config on my cdr server:
#set module path
mpath="/usr/lib/opensips/
modules/"

/* uncomment next line for MySQL DB support */
loadmodule "db_mysql.so"
loadmodule "tm.so"
loadmodule "acc.so"
loadmodule "sl.so"
loadmodule "maxfwd.so"
loadmodule "rr.so"
loadmodule "xlog.so"
loadmodule "textops.so"


# ----------------- setting module-specific parameters ---------------



# ----- acc params -----
# -- acc params --
# set the reporting log level
modparam("acc", "log_level", 1)
# number of flag, which will be used for accounting; if a message is
# labeled with this flag, its completion status will be reported
modparam("acc", "log_flag", 1 )


/* what sepcial events should be accounted ? */
/*
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
/* by default ww do not adjust the direct of the sequential requests.
   if you enable this parameter, be sure the enable "append_fromtag"
   in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 2)

modparam("acc", "db_extra", "from_uri=$fu; to_uri=$tu")
modparam("acc", "db_url", "mysql://opensips:opensipsrw@localhost/opensips" )
*/

####### Routing Logic ########


# main request routing logic

route{
    xlog( "Received a message" );

    /* ********* ROUTINE CHECKS  ********************************** */

    # filter too old messages
    if (!mf_process_maxfwd_header("10")) {
        log("LOG: Too many hops\n");
        sl_send_reply("483","Too Many Hops");
        exit;
    };
    if (msg:len >=  2048 ) {
        sl_send_reply("513", "Message too big");
        exit;
    };

    if (is_method("BYE")) {
        xlog( "bye message" );
        setflag(1); # do accounting ...
        setflag(3); # ... even if the transaction fails
    }   

    # account only INVITEs
    if (is_method("INVITE")) {
        xlog( "invite message" );
        setflag(1); # do accounting
    }
   
  
    setflag(2);
   
    xlog( "done" );

    exit;
}

I have tried sending messages by append_branch and send, and from packet captures and xlog I know the flags are being set, but the acc module does not record the message in syslog or the database

Thanks for any pointers

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Off route server CDR recording

Raúl Alexis Betancor Santana
On Monday 01 June 2009 22:37:58 Charles Solar wrote:
> I have tried sending messages by append_branch and send, and from packet
> captures and xlog I know the flags are being set, but the acc module does
> not record the message in syslog or the database
>
> Thanks for any pointers

Maybe I'm mistaken ... but AFAIK, accounting is taking into account when the
positive reply comes, that is .. on an INVITE, the acc record is saved when
the 200 OK comes back from the UAS.


--
Raúl Alexis Betancor Santana
Dimensión Virtual

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Off route server CDR recording

Iñaki Baz Castillo
El Martes, 2 de Junio de 2009, Raúl Alexis Betancor Santana escribió:

> On Monday 01 June 2009 22:37:58 Charles Solar wrote:
> > I have tried sending messages by append_branch and send, and from packet
> > captures and xlog I know the flags are being set, but the acc module does
> > not record the message in syslog or the database
> >
> > Thanks for any pointers
>
> Maybe I'm mistaken ... but AFAIK, accounting is taking into account when
> the positive reply comes, that is .. on an INVITE, the acc record is saved
> when the 200 OK comes back from the UAS.

Not exactly. You choose when and where to do the accounting. In fact, logging
failed calls (busy, cancelled since no answer, some 5XX error...) is more than
useful.



--
Iñaki Baz Castillo <[hidden email]>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Off route server CDR recording

Raúl Alexis Betancor Santana
On Tuesday 02 June 2009 01:11:02 Iñaki Baz Castillo wrote:

> El Martes, 2 de Junio de 2009, Raúl Alexis Betancor Santana escribió:
> > On Monday 01 June 2009 22:37:58 Charles Solar wrote:
> > > I have tried sending messages by append_branch and send, and from
> > > packet captures and xlog I know the flags are being set, but the acc
> > > module does not record the message in syslog or the database
> > >
> > > Thanks for any pointers
> >
> > Maybe I'm mistaken ... but AFAIK, accounting is taking into account when
> > the positive reply comes, that is .. on an INVITE, the acc record is
> > saved when the 200 OK comes back from the UAS.
>
> Not exactly. You choose when and where to do the accounting. In fact,
> logging failed calls (busy, cancelled since no answer, some 5XX error...)
> is more than useful.

Yes, but that cases (BUSY, CANCEL, 5XX ó 6XX) are all "replies" ;-)

--
Raúl Alexis Betancor Santana
Dimensión Virtual

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Off route server CDR recording

Iñaki Baz Castillo
El día 2 de junio de 2009 8:30, Raúl Alexis Betancor Santana
<[hidden email]> escribió:
>> Not exactly. You choose when and where to do the accounting. In fact,
>> logging failed calls (busy, cancelled since no answer, some 5XX error...)
>> is more than useful.
>
> Yes, but that cases (BUSY, CANCEL, 5XX ó 6XX) are all "replies" ;-)

Of course, as 2XX is  :)

PD: I assume that I understood wrongly something in this thread. You
said "on an INVITE, the acc record is saved
> when the 200 OK comes back from the UAS", that's why I told also about negative replies and accounting.

--
Iñaki Baz Castillo
<[hidden email]>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Off route server CDR recording

Raúl Alexis Betancor Santana
On Martes, 2 de Junio de 2009 10:08:33 Iñaki Baz Castillo escribió:

> El día 2 de junio de 2009 8:30, Raúl Alexis Betancor Santana
>
> <[hidden email]> escribió:
> >> Not exactly. You choose when and where to do the accounting. In fact,
> >> logging failed calls (busy, cancelled since no answer, some 5XX
> >> error...) is more than useful.
> >
> > Yes, but that cases (BUSY, CANCEL, 5XX ó 6XX) are all "replies" ;-)
>
> Of course, as 2XX is  :)
>
> PD: I assume that I understood wrongly something in this thread. You
> said "on an INVITE, the acc record is saved
>
> > when the 200 OK comes back from the UAS", that's why I told also about
> > negative replies and accounting.

The original poster want to do accounting based only on SIP signaling, just
doing some kind of t_replicate only of the INVITE and BYE request from the
main proxy to an "external" one.
That's imposible to do, not only because it will be a very poorly accurate
accounting but also because the ACC module does not "account" based on the
initial INVITE message but on the reply (positive or negative) or on the
timeout (so no reply).

I mean ...

UAC          <->         Proxy         <->     UAC2
INVITE         >
                        setflag(ACC)
                                                  <     200 OK
                        write(db,acc_record)
200 OK        <

Hope I have explained it ok.

--
Raúl Alexis Betancor Santana
Dimensión Virtual S.L.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Off route server CDR recording

Iñaki Baz Castillo
El Martes, 2 de Junio de 2009, Raúl Alexis Betancor Santana escribió:
> That's imposible to do, not only because it will be a very poorly accurate
> accounting but also because the ACC module does not "account" based on the
> initial INVITE message but on the reply (positive or negative) or on the
> timeout (so no reply).

I understand now what you mean, but it's not totally correct:

ACC module provides script functions to generate accounting (log, db, radius.
diameter) when processing the request:

http://kamailio.org/docs/modules/1.5.x/acc.html#id2507007

Regards.



--
Iñaki Baz Castillo <[hidden email]>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Off route server CDR recording

Charles Solar
Thanks for the info guys i think I have a better idea of how the acc module works and how I need to setup my new route.

Cheers

On Tue, Jun 2, 2009 at 1:51 PM, Iñaki Baz Castillo <[hidden email]> wrote:
El Martes, 2 de Junio de 2009, Raúl Alexis Betancor Santana escribió:
> That's imposible to do, not only because it will be a very poorly accurate
> accounting but also because the ACC module does not "account" based on the
> initial INVITE message but on the reply (positive or negative) or on the
> timeout (so no reply).

I understand now what you mean, but it's not totally correct:

ACC module provides script functions to generate accounting (log, db, radius.
diameter) when processing the request:

http://kamailio.org/docs/modules/1.5.x/acc.html#id2507007

Regards.



--
Iñaki Baz Castillo <[hidden email]>

_______________________________________________


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Off route server CDR recording

Raúl Alexis Betancor Santana
In reply to this post by Iñaki Baz Castillo
On Tuesday 02 June 2009 19:51:09 Iñaki Baz Castillo wrote:

> El Martes, 2 de Junio de 2009, Raúl Alexis Betancor Santana escribió:
> > That's imposible to do, not only because it will be a very poorly
> > accurate accounting but also because the ACC module does not "account"
> > based on the initial INVITE message but on the reply (positive or
> > negative) or on the timeout (so no reply).
>
> I understand now what you mean, but it's not totally correct:
>
> ACC module provides script functions to generate accounting (log, db,
> radius. diameter) when processing the request:
>
> http://kamailio.org/docs/modules/1.5.x/acc.html#id2507007
>
> Regards.

I have not checked the source Iñaki, but I feal that it generates the the ACC
records on reply or when the tm timer fires the sip-timeout, because there
are no other way of getting the sip_code column filled if it is done JUST
when the INVITE arrives.

If ...

UAC1      <->  P1                 <-> UAC2
INV          >  setflag(ACC)    >

And just when the INV arrives at P1 it generates the ACC record, that leave
you on a situation that you will need 2 ACC ops to get the correct ACC
record, one for writting down the INV ACC record, and other one when the
reply (or the timeout) comes back, so you could update the INV ACC record for
filling the sip_reason field.

I repeat .. I have not checked the source code, but for me the ACC record is
better generated when you have the reply or timeout for the INV request, this
is why the original poster does not get any ACC record on his DB, because it
only t_replicate the INVITE and the BYE, so it will never get the replies,
because he is not getting into the SIP-Path.

--
Raúl Alexis Betancor Santana
Dimensión Virtual

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Off route server CDR recording

Iñaki Baz Castillo
El Miércoles, 3 de Junio de 2009, Raúl Alexis Betancor Santana escribió:

> > ACC module provides script functions to generate accounting (log, db,
> > radius. diameter) when processing the request:
> >
> > http://kamailio.org/docs/modules/1.5.x/acc.html#id2507007
> >
> > Regards.
>
> I have not checked the source Iñaki, but I feal that it generates the the
> ACC records on reply or when the tm timer fires the sip-timeout, because
> there are no other way of getting the sip_code column filled if it is done
> JUST when the INVITE arrives.

Yes, I also think the same since the function doesn't offer parameters to set
the "sip_code" and so. However, I remember testing it and it worked.



> I repeat .. I have not checked the source code, but for me the ACC record
> is better generated when you have the reply or timeout for the INV request,
> this is why the original poster does not get any ACC record on his DB,
> because it only t_replicate the INVITE and the BYE, so it will never get
> the replies, because he is not getting into the SIP-Path.

Of course 100% agree.


--
Iñaki Baz Castillo <[hidden email]>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users