Notices


Reply
Thread Tools
Posts: 75 | Thanked: 78 times | Joined on Jan 2010 @ Germany
#1
Hi Maemo,

I have copied my ~/.rtcom-eventlogger/el.db from my N900 to my desktop-computer and analyzed it using sqliteman.
I realized that – in the "events"-table – the field "end_time" is always zero for calls. However, it is sometimes non-zero for SMS, which is also confusing me…

So my question: why is the end_time (or duration) of individual calls not logged?

The background is the following: The integrated call-timer only sums up the total time of all calls, while most providers will charge you in a different way. I would like to develop a program or widget which calculates your call-time the same way as your provider does.

Now my idea would be to check the database very often (every few seconds), and if a new call has been added, calculate the difference between the current and previous value of the integrated call-timer => this is the time of the last call.
However, this is quite a dirty hack and requires frequent queries to the database (eventlogger-API), while it would be absolutely logical to log end_times for calls (why is this column available, in the first place…)

Any remarks?

hcm
 
Posts: 29 | Thanked: 23 times | Joined on Jan 2009 @ Macedonia
#2
Yeah, I was looking at that and had the same idea. But maybe it would be better to put a trigger on UPDATE of that call duration column. As far as I can see, sqlite3 supports triggers, although I don't know if they work on the N900.
http://www.sqlite.org/lang_createtrigger.html

The trigger would be executed each time the total call time column is updated, calculate how much was added, and update the last call event with that duration.

Actually, I'm going to try that right now.
 

The Following 2 Users Say Thank You to kovach For This Useful Post:
Posts: 29 | Thanked: 23 times | Joined on Jan 2009 @ Macedonia
#3
Success!
Wow, I can't believe it, it was that easy, just tested it and it works...

I've attached a file that will create two triggers (one for outbound, one for inbound calls). You need to transfer it to your phone and execute it using this command:
Code:
sqlite3 -batch /home/user/.rtcom-eventlogger/el.db < triggers.txt
After that, the end_time column will be correctly populated for incoming and outgoing GSM calls.

The only thing I didn't test is what happens when you have call waiting and you get two calls one after the other, but I believe that the worst case scenario is that it will count the total time of the two calls on the last call.
Attached Files
File Type: txt triggers.txt (746 Bytes, 513 views)
 

The Following 6 Users Say Thank You to kovach For This Useful Post:
Posts: 121 | Thanked: 75 times | Joined on Oct 2009
#4
You could also vote for this bug which might prompt them to add it.
 

The Following User Says Thank You to matrim For This Useful Post:
Posts: 29 | Thanked: 23 times | Joined on Jan 2009 @ Macedonia
#5
Here is an updated triggers.txt file with support for VOIP calls.

I've tested it with Skype calls, dialing and receiving GSM calls, call waiting (an inbound call while doing an outbound), and in all situations where I tested it, it worked.

This version will also check if you are clearing the call duration log and will not give you a negative duration if you are.
Attached Files
File Type: txt triggers.txt (1.8 KB, 370 views)
 

The Following 7 Users Say Thank You to kovach For This Useful Post:
Posts: 75 | Thanked: 78 times | Joined on Jan 2010 @ Germany
#6
hi kovach,

thank you very much for your triggers!
I was a bit afraid of modifying the database directly, but since this approach is included directly in the database (not in some scripts), I believe it should be safe…

I don't have that much time at the moment, but I'm very interested in how many of my included minutes I have used already, so I've put together a quick'n'dirty script.

It counts the number of outgoing gsm calls and the number of minutes (minutes rounded up for each call), and shows a total for the last month, and a "highscore" (nr of calls and nr of minutes grouped by callee).
You can configure the day of month at which the counting starts in the script itself (yes, my provider starts at the third day of the month -.-).
But there is nothing more to be configured, and no options/parameters – sorry, I just don't have enough time atm.

This script will only work if the triggers provided by kovach are activated!

Please use this script only if you know what you're doing. I just wrote it and testet it for less than an hour…

Regards
hcm

[EDIT] oh, one remark:what do the triggers do if a outgoing call is not answered? are start_time and end_time the same? or is end_time = 0 because the trigger never triggers? in the first case, my script would still count one minute…
Attached Files
File Type: txt calltimer.sh.txt (1.4 KB, 310 views)

Last edited by hcm; 2010-01-29 at 20:57.
 

The Following 3 Users Say Thank You to hcm For This Useful Post:
Posts: 29 | Thanked: 23 times | Joined on Jan 2009 @ Macedonia
#7
Originally Posted by hcm View Post
oh, one remark:what do the triggers do if a outgoing call is not answered? are start_time and end_time the same? or is end_time = 0 because the trigger never triggers? in the first case, my script would still count one minute…
For calls that were not answered, the call_duration is never updated, so the trigger doesn't fire. That means that those events will have end_time stuck at 0.
Which means that all apps that would use end_time will have to specifically check for that condition, and change to 0 all negative values they get for duration (end_time - start_time).
 
Posts: 75 | Thanked: 78 times | Joined on Jan 2010 @ Germany
#8
I just found a problem about the triggers.
I made a call with 2:55 mins = 175 seconds. But in the database, only 85 seconds were recorded. the other 90 seconds were added to a previous call which was not answered.
so, apparently, the phone updates the call_duration table even DURING the call, when the call itself is not even in the database.

I don't think there is an easy fix for that, will think about it... any ideas?

(edit) oh, the call is in the database right after starting it... but that means, the 85 seconds were added at first, and the 90 seconds were added later, strange... but this could make the fix easier

(edit2) ok, this change should do it… not tested very much yet, because its too late to call people but it shoud do…
Attached Files
File Type: txt triggers.txt (1.9 KB, 355 views)

Last edited by hcm; 2010-02-02 at 23:21.
 

The Following 4 Users Say Thank You to hcm For This Useful Post:
Swimm12984's Avatar
Posts: 80 | Thanked: 37 times | Joined on Feb 2010 @ Long Island, New York
#9
any updates on how the most recent triggers.txt file is working?
 
Posts: 75 | Thanked: 78 times | Joined on Jan 2010 @ Germany
#10
works fine for me… all recent calls have the correct end-time saved in the database.
one call was over 10 minutes, and the problem I described before didn't occur.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 20:17.