[Home]

Summary:ASTERISK-06171: [patch] CDR billsec tweak
Reporter:Daniel Mikusa (dmikusa)Labels:
Date Opened:2006-01-23 09:27:39.000-0600Date Closed:2011-06-07 14:10:09
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) cdr_billing-1.1.patch
Description:In the Asterisk CDR, the billsec field is set to be the time from when the call was answered to when the call hung up.  This works well, however I have come across situations where part of the call is free and part of the call should be billed.  To enable this feature, I have added two functions to the Asterisk dial plan which allow you to start and stop the billing seconds.  This patch doesn't change the default behavior of Asterisk, which is to bill from call answer to call hangup.

****** ADDITIONAL INFORMATION ******

 -= Info about application 'StartCDRBilling' =-

[Synopsis]
Starts billsec counter for call

[Description]
Time after a call to this function will be counted into the billsec field
of the call detail record for this channel.  Used in conjunction with
StopCDRBilling.


 -= Info about application 'StopCDRBilling' =-

[Synopsis]
Stops billsec counter for call

[Description]
Time after a call to this function will not be counted into the billsec field
of the call detail record for this channel.  Used in conjunction with
StartCDRBilling.
Comments:By: Tilghman Lesher (tilghman) 2006-01-24 01:01:41.000-0600

If you're going to create new appliations, please do not put them in pbx.c.  Instead, add them to a relevant module in apps/ or create a separate module for them.

By: Tilghman Lesher (tilghman) 2006-01-24 01:06:13.000-0600

Also, this won't work as written.  post_cdr is what sets billsec prior to the CDR being set.  We don't actually track that value.  Have you tested your patch?

By: Olle Johansson (oej) 2006-01-24 04:48:46.000-0600

Can't you use forkcdr or resetcdr in the dial plan to restart cdr in those cases?

By: Daniel Mikusa (dmikusa) 2006-01-24 07:52:27.000-0600

To answer the three questions posted.

1.) I will move the code into it's own application.  It probably does make more sense there.

2.) To account for this I created a second variable called 'flux'.  It is a running counter.  The math has been tweeked to use this in conjunction with 'billsec' to calculate the correct time.  I have it running on my testing machine and it works fine.

3.) I'm running an IVR application where users call in, goes through some menu's, and then based on their choice they get connected to their specific listen-only conference call.  I don't charge them for being in the menu, just for being in the conference call.  The kicker is that they can leave a conference call go back to the menu and select a different one.  The reason I don't use ForkCDR or ResetCDR is because it created new CDR records everytime my users switch from conference call to menus or menus to conference call.  This leaves me with at minimum twice the call detail records I should have.  That's why I created these function which mimic the behavior without creating extra CDR records.

I realize that my case is fairly unique and that most people will not need this added functionality, but I posted it in hopes it might be useful to someone else.

By: Clod Patry (junky) 2006-02-04 06:55:11.000-0600

Just before the conference, just start your time there and when leaving, just stop the timer?
Any update here?

By: Daniel Mikusa (dmikusa) 2006-02-15 15:30:15.000-0600

Added a new patch that creates the the stop and start billing applications in app_cdr, which seemed to be the most relevant module for them, instead of in pbx.c. Enjoy.

By: Andrey S Pankov (casper) 2006-03-30 16:10:26.000-0600

IMO such modifications are not acceptable in the core (cdr.c in your case). Why not to use CDR(xxx) dialplan function to keep track of billable time?

By: Serge Vecher (serge-v) 2006-05-06 14:19:20

dmikusa: did you give casper's suggestion a shot?

By: Daniel Mikusa (dmikusa) 2006-05-06 15:28:09

I like his suggestion, however I haven't had any time to make the changes.  

Would this functionality better fit into a function or an application?

By: Serge Vecher (serge-v) 2006-05-07 14:09:48

I believe a function would be a better fit.

The question still remains, however, whether the functionality you need can be achieved with existing dialplan cmds (NoCDR/ResetCDR). Could you please post a relevant portion of the dialplan you use for this?

Thanks.

By: Daniel Mikusa (dmikusa) 2006-05-08 09:16:59

This issue can probably be closed.  I don't believe that it is really needed anymore.  I've come up with a couple solutions just using dialplan funcs and apps.



By: Serge Vecher (serge-v) 2006-05-25 14:35:49

closing, since a suggested dialplan solution obviated the patch. Thanks.