mptc -- Mobile Phone Tariff Calculator
Introduction
I knocked up this program to figure out if I could save money on
mobile (cell) phone bills. Turns out I could -- about 15 UK pounds
every month ... quite handy for a poor student!
To use it, you feed it a copy of one of your itemised phone bills
as a plain text file in a very simple format, together with a tariff
file for the tariff you're currently being charged on, and a tariff
file for each tariff which you're considering switching to. (A tariff
file is another plain text file, again in a very simple format,
describing all the characteristics of a tariff, such as cost per
minute for different categories of call, how much you get in free
calls each month, cost of sending SMS messages, which times of the
week are considered peak or off-peak etc.) It will then recalculate
your entire bill for each of the tariffs you're considering switching
to, so you can see whether you would have saved money by being on that
tariff instead.
Features
- Fairly complete understanding of the monthly line rental systems
of the four major UK mobile phone networks.
- Call classification categories include distinction for calls to
local/national land lines, calls/SMS messages to mobiles on
same/other network, operator calls, and free calls. Classifies
calls using pseudo-code defined in the configuration file.
Also looks at the call cost and compares it with the known
rates for various call categories to determine whether a call
is cross-network or not (calls to mobiles), and whether a call
is local or national (calls to land lines).
- User-defined pricing bands (e.g. 7am to 7pm weekdays classed as
`daytime', other times during the week classed as `evening',
and weekend classed as (gasp) `weekend'.
- Support for initial network connection and monthly line rental
fees.
- Support for a certain number of minutes of free calls per
month for certain calls categories.
- Understands VAT (UK tax).
- Optional minimum call length feature.
- Prints details of each individual call, and detailed totals for
all the various call categories over the whole bill (both
optional).
- Can sort calls by category or by time, or both.
Limitations
As I wrote it mainly for me, it's currently geared towards UK
mobile phone network tariffs with monthly line rentals. It does
not support the `pay as you go' or `pay for a whole year in
one go' schemes, but those schemes tend rip you off anyway unless
you're hardly making any calls, in which case you don't need this
program anyway.
It served the purpose I wrote it for (to advise me which network
and tariff to switch to), and because I have a lot of other things to
do, taking the time to make it useful for other people has taken a
back seat. Hence although the software seems to work fine
for me, it should be considered as alpha software. It is full of
rough edges, so unless you have a small amount of expertise in
computer languages in general, there is no guarantee you'll find it
useful. There's no guarantee even if you're Larry Wall,
but you know what I mean.
However, there should be enough functionality in there that given
someone with sufficient Perl skills and interest, it could easily be
adapted to be suited for use in other countries, and maybe even turned
into a polished product. I haven't the time or motivation to do this
myself, so I'm hoping that other people will chip in.
How do I use it?
Unfortunately I don't have time to produce full documentation, so
here's a brief introduction:
- Download and unpack the tar ball
or the zip file containing all the
bits and pieces.
- Look at the tariff files, and if
the ones you need aren't there, use the ones there as examples
of how to create your own. It should be pretty obvious how
they work.
- Look at two of my bill files which I
included in the distribution as samples. Each line is in one
of four formats:
- A blank line or one which begins with `#' is ignored.
- A line which looks like 7/1999 means that the following
lines contain information about phone calls in August 1999.
- A line which contains a single number means that the following
lines contain information about phone calls on the date
corresponding to that number in the current (as defined by
the previous line format) month.
- A line with four entries in it (separated by whitespace)
denotes that an actual call was made. The four entries
are:
- the time of the call in HHMM format,
- the number called, or at least, enough of the prefix to
be able to figure out what type of call it is,
- the call duration in MM:SS format (the MM and even the
: can be omitted if desired), or
- the cost of the call, or `b' if this call was free
as the result of being part of a "bundle" (free
monthly calls). Append `pb' to the cost if the call
was only part bundle, i.e. if it used up the last
remaining bit of the bundle, so that part of the
call was free and part was charged.
- Write your own bill file, or better yet, persuade your current
network service to make your bills available as computer files.
Let me know if you succeed at the
latter.
- Look at the configuration file
mptc.conf and edit it as necessary.
- Install Date::Calc from CPAN if you haven't
already got it.
- Run the program with no parameters, and it will tell you what
parameters to provide.
Great! Read through the source and get hacking. Here are some of
the things you could do:
- Write some documentation! Boring, but very helpful.
- Redo the configuration file and tariff files for other countries.
- Write a nice front-end to alleviate the hassle of entering
phone bills by hand. A CGI-based front-end would be
particularly nice.
- Add support for pricing systems in other countries. If you're
successfully using the program outside the UK, then fantastic,
let me know!
- See the to do list for other ideas.
It should be fairly clear how everything works, but if something
puzzles you, ask me about it and I'll do
what I can to help. If you've made some changes to the code, please
send them to me in unified diff format for inclusion in the next
release.
Last updated: Sat Nov 1 22:37:39 2003
© 1995-2003
Adam Spiers <adam@spiers.net>