Tcharge

Tcharge is a tool to watch the time a telephone connection is up and the money to pay for it. It works both for `per unit billing' and for `per second billing'.
On Invocation tcharge pops up a window containing an analog clock and an additional text field. The clock indicates the time elapsed since the start of the program, while the text part of the window gives information about the phone units and/or the charge spent so far.
Alternatively, tcharge can work without any visual output at all, quiet writing computed charges to files in the background.

Overview

Supported Countries
Options
Summary Information
Tools
Tcharge and PPP
Tcharge and ISDN
Files
Support
Charge Modules
Bugs
Author

Tcharge may either work in the daemon mode or in a normal mode:

  • Daemon mode: If option -watch-file <watch_file> is choosen the charge counting starts when watch_file is created and stops when watch_file is deleted. For PPP take the name of the PID-file of the pppd daemon. (So you do not have to terminate tcharge while an entire X session.)
    (For ISDN use option `-isdn' instead)
    There is also a non-X-Window mode available by choosing the commandline option -noX. Then the only output goes to a logfile or to syslog.
  • Normal mode: Charge computing starts immediately when tcharge comes up. For that tcharge is preferably started directly after or before starting a modem connection (automatically) and must be killed immediately after disconnect. (See options -file on how to kill -before and -after for correction of delays.)
  • Tcharge can warn you some seconds before a new unit begins with a little alarm like flashing the window or with a bell.
    When compiled with `-DREMINDER' tcharge can warn at regular intervals of having spent a certain amount of money, units or minutes by popping up a message window.

    Tcharge catches signals SIGHUP, SIGINT, SIGQUIT, SIGPIPE and SIGTERM to print a connection statistic to a file or to syslog before exiting (see option `-file') and to remove the tcharge PID-file before exiting.

    When compiled with `-DPRINT_CHARGE_STRUCTURE' an extended help option -help-charge is available which prints a nice table of the charge structure as given in the header file `charge.h' Very useful to check the correct charging, especially when testing new TC definitions!

    Most of the source concerning X is derived from rclock written by Rob Nation. Since Tcharge is a derivate of rclock it also conserves memory by not using the X toolkit or any widget set.

    Supported Countries

    The phone companies of the following countries are supported so far:
    Germany, France, Japan, Portugal, Slovenia, Hungary, Belgium, Swiss, Italy, Netherlands, South Africa, Spain, Danmark and the UK.

    If you want tcharge to take into account e.g. some special discount schemes or your provider charges, this is possible to realize - and very easy for you even without any programming knowledge.

    Options

    The options supported by tcharge are listed below. If you prefer the GNU-style long options, you may two hyphens instead of one.

    Summary Information

    The Format of the summary information you get with the -file option (without option -user) is like this:

    01/24/1997 Connection [Fri, 14:55:27] -> [Fri, 14:56:33]
    01/24/1997   duration: 00:01:07, units: 1, charge: 0.12 DM
    

    (Note: The format of the date is MM/DD/YYYY!). This feature may be used to get an overview over the money you spend for the modem weekly or monthly. (See section Tools for a list of included programs to evaluate files containing call summary files.)

    The format of the syslog message (option -syslog) has a different format:

    Apr  2 00:34:22 moin tcharge[405]: Connection [Thu, 00:32:17]
     -> [Thu, 00:34:22], duration: 00:02:00,
    Apr  2 00:34:22 moin tcharge[405]: units: 1, charge: 0.12 DM 
    

    Tools

    Tcharge and PPP

    As mentioned tcharge knows a "normal mode" and a "daemon mode". You can choose one of the two modes to run tcharge for PPP. I prefer the "normal mode" since the delays are better to handle using "normal mode": Then tcharge will be started automatically when the connection is up - much closer to what the telephone company thinks about your call than in "daemon mode" when watching the pid-file of the pppd. This pid-file will get created in the moment you start pppd, even before dialing! So I recommend:

    Tcharge and ISDN

    If tcharge is compiled with the `-DISDN' flag (see Makefile) you cannot choose the -watch-file option anymore and you have to take the -isdn option instead. This one may call a bug but I thought the `-watch-file' option is not useful for ISDN users (if you don't agree, tell me about). I don't have access to ISDN, so I'm not able to test anything (let's trust on Tillmann and his pppcosts-code!-)

    It's possible to extract much more detailed information from the Linux ISDN driver `isdn4linux'. If you want to use this feature, I recommend you to use the program isdnlog by Andreas Kool akool@Kool.f.EUnet.de (For questions concerning isdnlog use this address: isdnlog@Kool.f.EUnet.de)

    Files

  • @SRCDIR
    All source files, charge module, documentation and various tools for tcharge - especially all you need to accomodate tcharge for your phone company.
  • /var/run/tcharge.pid
    If tcharge is run by someone with superuser privileges this file contains the PID of tcharge.
  • Support

    There is also a mailing list for tcharge. It is open, so everyone can directly post to the list. Yet everyone who wants to susbscribe to the list is welcome. To subscribe to the list send an e-mail with no subject and with the body

    subscribe your@email.address
    to tcharge-request@hix.physik.uni-bremen.de

    To unsubscribe send an e-mail with the body

    unsubscribe your@email.address

    to the same address. If you want to send some mail to the list, send it to

    tcharge@hix.physik.uni-bremen.de

    For more information about this list's listserver send a mail with the body `help' to `majordomo@hix.physik.uni-bremen.de'. The list is intended for discussion of tcharge, bug reports, help requests and announcements of new releases, fixes, etc. (only the mails about new releases will also be send to the newsgroup comp.os.linux.announce).

    Charge Modules

    You are encouraged to test the charge definition files that tcharge provides and to help improving them.
    The charges that a modem produces are of course highly dependent on your telephone company (TC). Though tcharge supports a lot of TCs (thanks to pppcosts!) there is still a lot to do since in most cases there is something missing e.g. a complete list of public holidays, support for more than the local area zone... And of course the charge definitions are not correct forever; check if they need an update! I hope things will still get better: Nearly all TC-dependent information is kept in single `charge files' that are easy to edit (and to create) also for "non-hackers". (Actually you don't have to know anything about programming!).
    Included in the source is a perl script mktc that helps a lot to configure tcharge for another TC (see README.TC).

    Bugs

    All known bugs are eliminated...

    Author

    Volker Börchers boercher@physik.uni-bremen.de

    Most X stuff is taken from rclock (version 1.81) written by: Rob Nation nation@rocket.sanders.lockheed.com

    The idea for the "daemon mode", the ISDN-support as well as the support for most of supported countries is derived from `pppcosts', (pppcosts by Tillmann Steinbrecher tst@bigfoot.com, see
    this link)

    Thanks to Sascha Ziemann (szi@aibon.ping.de), George Antani(pitura@geocities.com), Oliver Gading (o.gading@sbu.ac.uk), Frank Kalberg (skywalker@devnull.owl.de), Michael.Schneider@vitrashop.com; special thanks to Heiko Brey (cthuga@www.netzservice.de) for our correspondence on the -noX option and a special console option (never realized...). Thanks to Michael Renner (renner@sunwan.mpik-tueb.mpg.de) - he found a bad bug in tcharge and was the "major beta tester" of version 1.3. Very much thanks to Markus Gutschke (gutschk@uni-muenster.de), author of `isdnbutton' for his help on the ISDN-support.