El Tuesday 19 February 2008 11:23:47 Adrian Georgescu escribió:
Hi Iñaki,
I checked the code and made test calls that span multiple profiles. The calculus is correct.
The confusion likely arises because StartTime is printed in each span, while it is the StartTime of the call itself and not of the span.
Finally the sum of all spans equals the duration of the call. If you have data that contradicts this I would be happy to look at it again.
Hi again, I've calculated it again and it's completely correct, but maybe a little confusing. Let me explain with a real example:
A call 24 hours long envolving various spans:
This is what CDRTool logs:
CDRTool says: **************
Start time: 2008-02-19 14:00:00 Stop time: 2008-02-20 14:00:00 Duration: 24:00:00 (86400 s) PRICE: 24,00 €
Span: 1 Duration: 28800 s StartTime: 2008-02-19 14:00:00 (Europe/Madrid) ProfileId: 01 Laboral for weekday RateId: Normal for 8-22h Rate: 0.0300 / 60 s Price: 14.4000 -- Span: 2 Duration: 36000 s StartTime: 2008-02-19 14:00:00 (Europe/Madrid) ProfileId: 01 Laboral for weekday RateId: Reducida for 22-24h Rate: 0.0100 / 60 s Price: 6.0000 -- Span: 3 Duration: 21600 s StartTime: 2008-02-19 14:00:00 (Europe/Madrid) ProfileId: 01 Laboral for weekday RateId: Reducida for 0-8h Rate: 0.0100 / 60 s Price: 3.6000
As you see, CDRTool sees 3 spans, while I considere there are 4 spans, but now I understand that it's an interpretation issue: CDRTools groups all the spans for the same rateid in an unique span. This is what I understand calculating manually:
I see: ****************
Start time: 2008-02-19 14:00:00 Stop time: 2008-02-20 14:00:00 Duration: 24:00:00 (86400 s)
span: 1 - From: 2008-02-19 14:00:00 - To: 2008-02-19 22:00:00 - Duration: 28800 s - Rate: (8-22h) 0.03/60s - Price: 14,4
span: 2 - From: 2008-02-19 22:00:00 - To: 2008-02-19 24:00:00 - Duration: 7200 s - Rate: (22-24h) 0.01/60s - Price: 1,2
span: 3 - From: 2008-02-20 0:00:00 - To: 2008-02-20 8:00:00 - Duration: 28800 s - Rate: (0-8h) 0.01/60s - Price: 4,8
span: 4 - From: 2008-02-20 8:00:00 - To: 2008-02-20 14:00:00 - Duration: 21600 s - Rate: (8-22h) 0.03/60s - Price: 3,6
TOTAL: ****** - Duration: 86400 s - PRICE: 24.00 €
So it's ok, thanks a lot for your help. ;)