First step to let isdnlog generate his own AOCD messages

This commit is contained in:
Andreas Kool 1998-06-21 11:53:27 +00:00
parent 832d3a79a0
commit 69474abf73
7 changed files with 328 additions and 18 deletions

View File

@ -19,6 +19,12 @@
* along with this program; if not, write to the Free Software
*
* $Log$
* Revision 1.12 1998/06/14 15:33:48 akool
* AVM B1 support (Layer 3)
* Telekom's new currency DEM 0,121 supported
* Disable holiday rates #ifdef ISDN_NL
* memory leak in "isdnrep" repaired
*
* Revision 1.11 1998/06/07 21:08:26 akool
* - Accounting for the following new providers implemented:
* o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
@ -199,6 +205,7 @@ void set_time_str(void)
day = tm_time->tm_mday;
month = tm_time->tm_mon + 1;
hour = tm_time->tm_hour;
} /* set_time_str */
/*****************************************************************************/
@ -530,7 +537,7 @@ int is_sondernummer(char *num)
if (*num)
for (i = 0; i < nSN; i++)
if (!strcmp(num, SN[i].msn))
if (!strncmp(num, SN[i].msn, strlen(SN[i].msn)))
return(i);
return(-1);

View File

@ -19,6 +19,41 @@
* along with this program; if not, write to the Free Software
*
* $Log$
* Revision 1.20 1998/06/07 21:08:31 akool
* - Accounting for the following new providers implemented:
* o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
* TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
* tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
* WESTCom, WorldCom, Viag Interkom
*
* Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
* program http://www.insider.org/tarif/gebuehr.c
*
* - Telekom's 10plus implemented
*
* - Berechnung der Gebuehrenzone implementiert
* (CityCall, RegioCall, GermanCall, GlobalCall)
* The entry "ZONE" is not needed anymore in the config-files
*
* you need the file
* http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
* and the new entry
* [GLOBAL]
* AREADIFF = /usr/lib/isdn/vorwahl.dat
* for that feature.
*
* Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
* Data-File and Harald Milz for his first Perl-Implementation!
*
* - Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
*
* You must install the file
* "isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
* as "/usr/lib/isdn/sonderrufnummern.dat"
* for that feature.
*
* ATTENTION: This is *NO* production-code! Please test it carefully!
*
* Revision 1.19 1998/05/19 15:55:51 paul
* Moved config stuff for City Weekend from isdnlog.c to tools/isdnconf.c, so
* that isdnrep also understands a "cityweekend=y" line in isdn.conf.
@ -224,6 +259,8 @@ static void loop(void)
now();
processcint();
for (Cnt = first_descr; Cnt < socket_size(sockets); Cnt++) {
if (X_FD_ISSET(sockets[Cnt].descriptor, &exceptmask)) {
if (sockets[Cnt].fp == NULL) {

View File

@ -20,6 +20,41 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.8 1998/06/07 21:08:34 akool
* - Accounting for the following new providers implemented:
* o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
* TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
* tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
* WESTCom, WorldCom, Viag Interkom
*
* Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
* program http://www.insider.org/tarif/gebuehr.c
*
* - Telekom's 10plus implemented
*
* - Berechnung der Gebuehrenzone implementiert
* (CityCall, RegioCall, GermanCall, GlobalCall)
* The entry "ZONE" is not needed anymore in the config-files
*
* you need the file
* http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
* and the new entry
* [GLOBAL]
* AREADIFF = /usr/lib/isdn/vorwahl.dat
* for that feature.
*
* Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
* Data-File and Harald Milz for his first Perl-Implementation!
*
* - Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
*
* You must install the file
* "isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
* as "/usr/lib/isdn/sonderrufnummern.dat"
* for that feature.
*
* ATTENTION: This is *NO* production-code! Please test it carefully!
*
* Revision 1.7 1997/05/25 19:41:02 luethje
* isdnlog: close all files and open again after kill -HUP
* isdnrep: support vbox version 2.0
@ -262,6 +297,7 @@ _EXTERN IO io[ISDN_MAX_CHANNELS];
_EXTERN void dotrace(void);
_EXTERN int morectrl(int card);
_EXTERN void moreinfo(void);
_EXTERN void processcint(void);
_EXTERN void processrate(void);
_EXTERN void clearchan(int chan, int total);

View File

@ -19,6 +19,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.21 1998/06/16 15:05:31 paul
* isdnlog crashed with 1TR6 and "Unknown Codeset 7 attribute 3 size 5",
* i.e. IE 03 which is not Date/Time
*
* Revision 1.20 1998/06/14 15:33:51 akool
* AVM B1 support (Layer 3)
* Telekom's new currency DEM 0,121 supported
@ -1936,7 +1940,7 @@ static void decode(int chan, register char *p, int type, int version)
if (message & PRT_SHOWTICKS)
sprintf(s, "%d.EH %s %s (%s %d) C=%s",
call[chan].aoce,
abs(call[chan].aoce),
currency,
double2str(call[chan].pay, 6, 2, DEB),
tx ? double2clock(tx) : "", (int)err,
@ -1944,13 +1948,13 @@ static void decode(int chan, register char *p, int type, int version)
else {
if (tx)
sprintf(s, "%d.EH %s %s (%s)",
call[chan].aoce,
abs(call[chan].aoce),
currency,
double2str(call[chan].pay, 6, 2, DEB),
double2clock(tx));
else
sprintf(s, "%d.EH %s %s",
call[chan].aoce,
abs(call[chan].aoce),
currency,
double2str(call[chan].pay, 6, 2, DEB));
} /* else */
@ -2028,7 +2032,7 @@ static void decode(int chan, register char *p, int type, int version)
if (message & PRT_SHOWTICKS)
sprintf(s, "%d.EH %s %s (%s %d %s?) C=%s",
call[chan].aoce,
abs(call[chan].aoce),
currency,
double2str(call[chan].pay, 6, 2, DEB),
tx ? double2clock(tx) : "", (int)err, px,
@ -2036,20 +2040,20 @@ static void decode(int chan, register char *p, int type, int version)
else {
if (tx)
sprintf(s, "%d.EH %s %s (%s)",
call[chan].aoce,
abs(call[chan].aoce),
currency,
double2str(call[chan].pay, 6, 2, DEB),
double2clock(tx));
else
sprintf(s, "%d.EH %s %s",
call[chan].aoce,
abs(call[chan].aoce),
currency,
double2str(call[chan].pay, 6, 2, DEB));
} /* else */
}
else {
sprintf(s, "%d.EH %s %s",
call[chan].aoce,
abs(call[chan].aoce),
currency,
double2str(call[chan].pay, 6, 2, DEB));
} /* else */
@ -3690,7 +3694,7 @@ static void how_expensive(int chan)
sprintf(sx, "WARNING: Wrong ZONE (%d), assuming %d", zone, zone2);
zone = zone2;
if (call[chan].sondernummer != -1)
if (call[chan].sondernummer == -1)
info(chan, PRT_SHOWHANGUP, STATE_HANGUP, sx);
} /* if */
} /* if */
@ -4242,15 +4246,19 @@ static void processctrl(int card, char *s)
} /* else */
if (!call[chan].dialin) {
auto int l;
auto char s[BUFSIZ], sx[BUFSIZ];
extern int taktlaenge(int provider, time_t connect, int zone, char *description);
extern float taktlaenge(int chan, char *description);
l = taktlaenge(call[chan].provider, call[chan].connect, area_diff(NULL, call[chan].num[1]), s);
sprintf(sx, "NEXT CHARGEINT %d s (%s)", l, s);
if ((call[chan].cint = taktlaenge(chan, s)) > 1) {
call[chan].cinth = hour;
call[chan].nextcint = call[chan].connect + (int)call[chan].cint;
call[chan].ctakt = 1;
sprintf(sx, "NEXT CHARGEINT IN %s (%s)", double2clock(call[chan].cint), s);
info(chan, PRT_SHOWCONNECT, STATE_CONNECT, sx);
} /* if */
} /* if */
if (sound)
ringer(chan, RING_CONNECT);
@ -4660,3 +4668,63 @@ void moreinfo()
ps = s;
} /* if */
} /* moreinfo */
/*****************************************************************************/
void processcint()
{
register int chan;
auto char s[BUFSIZ], sx[BUFSIZ];
auto float newcint;
auto double exp;
auto int dur;
extern float taktlaenge(int chan, char *description);
extern double pay(time_t ts, int dauer, int tarifz, int pro);
for (chan = 0; chan < 2; chan++) {
if (!call[chan].dialin && (call[chan].cint > 1)) {
if (call[chan].nextcint == cur_time) {
dur = cur_time - call[chan].connect;
if ((call[chan].cinth != hour) && ((hour == 5) ||
(hour == 9) ||
(hour == 12) ||
(hour == 18) ||
(hour == 21) ||
(hour == 2))) { /* Moeglicherweise Taktwechsel */
newcint = taktlaenge(chan, s);
call[chan].cint = newcint;
sprintf(sx, "NEXT CHARGEINT %sIN %s (%s)", (newcint == call[chan].cint) ? "STILL " : "", double2clock((double)call[chan].cint), s);
info(chan, PRT_SHOWCONNECT, STATE_CONNECT, sx);
} /* if */
call[chan].cinth = hour;
call[chan].ctakt++;
if (1 /* message & PRT_SHOWTICKS */) {
if ((call[chan].provider == -1) || (call[chan].provider == 33))
exp = call[chan].ctakt * currency_factor;
else
/* call pay() with duration + 1 to get the charge for the _next_ chargeint! */
exp = pay(call[chan].connect, dur + 1, call[chan].zone, call[chan].provider);
sprintf(sx, "START %d.CHARGEINT %s %s (%s)",
call[chan].ctakt,
currency,
double2str(exp, 6, 2, DEB),
double2clock((double)dur));
info(chan, PRT_SHOWCONNECT, STATE_CONNECT, sx);
} /* if */
call[chan].nextcint += (int)call[chan].cint;
} /* if */
} /* if */
} /* for */
} /* processcint */

View File

@ -345,31 +345,111 @@ static float gebuehr[2][6][4][3] =
{ -1.0, 60.0, 60.0 }}}};
int taktlaenge(int provider, time_t connect, int zone, char *description)
float taktlaenge(int chan, char *description)
{
register int l;
register int c;
auto struct tm *tm;
auto char why[BUFSIZ];
auto int provider = call[chan].provider;
auto time_t connect = call[chan].connect;
auto int zone = -1, zone2 = -1;
auto float takt;
*description = 0;
if (!call[chan].dialin && *call[chan].num[1]) {
if ((provider == 11) || /* o.tel.o */
(provider == 13) || /* Tele2 */
(provider == 14) || /* EWE TEL */
(provider == 15) || /* */
(provider == 23) || /* Tesion */
(provider == 24) || /* TelePassport */
(provider == 30) || /* TelDaFax */
(provider == 39) || /* tesion */
(provider == 41) || /* HanseNet */
(provider == 46) || /* KomTel */
(provider == 49) || /* ACC */
(provider == 66) || /* Interoute */
(provider == 70) || /* Arcor */
(provider == 79) || /* Viatel */
(provider == 90) || /* Viag Interkom */
(provider == 98)) /* STAR Telecom */
return(1);
if (provider == 18) /* Debitel */
return(30);
if ((provider == 36) || /* Hutchison Telekom */
(provider == 50)) /* Talkline */
return(10);
if (provider == 43) /* Hutchison Telekom */
return(60);
if (provider == 9) /* ECONOphone - mindestens jedoch 30 Sekunden! */
return(6);
tm = localtime(&connect);
if (call[chan].sondernummer != -1) {
switch (SN[call[chan].sondernummer].tarif) {
case 0 : sprintf(description, "FreeCall"); /* Free of charge */
return(60 * 60 * 24); /* one day should be enough ;-) */
case 1 : zone = 1; /* CityCall */
break;
case -1 : if ((tm->tm_wday > 0) && (tm->tm_wday < 6)) {
if ((tm->tm_hour > 8) && (tm->tm_hour < 18))
takt = SN[call[chan].sondernummer].takt1; /* Werktag 9-18 Uhr */
else
takt = SN[call[chan].sondernummer].takt2; /* Restliche Zeit */
}
else
takt = SN[call[chan].sondernummer].takt2;
strcpy(description, SN[call[chan].sondernummer].sinfo);
return(takt);
break;
} /* switch */
} /* if */
if (zone == -1) {
zone2 = area_diff(NULL, call[chan].num[1]);
if ((zone2 == -1) && (c = call[chan].confentry[OTHER]) > -1)
zone = known[c]->zone;
else
zone = zone2;
} /* if */
if (zone != -1) {
if (provider == -1)
provider = 33;
call[chan].zone = zone;
zone--;
if ((zone < 0) || (zone > 3))
return(-1);
if ((provider == 19) || (provider == 33)) {
l = gebuehr[(provider == 33) ? DTAG : MOBILCOM][zeit[tm->tm_hour]][tarifzeit(tm, why)][zone];
takt = gebuehr[(provider == 33) ? DTAG : MOBILCOM][zeit[tm->tm_hour]][tarifzeit(tm, why)][zone];
sprintf(description, "%s, %s, %s", zeiten[zeit[tm->tm_hour]], why, zonen[zone]);
return(takt);
}
else
return(-1);
}
else
return(-1);
}
else
return(-1);
return(l);
} /* taktlaenge */

View File

@ -19,6 +19,41 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.12 1998/06/07 21:09:57 akool
* - Accounting for the following new providers implemented:
* o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
* TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
* tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
* WESTCom, WorldCom, Viag Interkom
*
* Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
* program http://www.insider.org/tarif/gebuehr.c
*
* - Telekom's 10plus implemented
*
* - Berechnung der Gebuehrenzone implementiert
* (CityCall, RegioCall, GermanCall, GlobalCall)
* The entry "ZONE" is not needed anymore in the config-files
*
* you need the file
* http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
* and the new entry
* [GLOBAL]
* AREADIFF = /usr/lib/isdn/vorwahl.dat
* for that feature.
*
* Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
* Data-File and Harald Milz for his first Perl-Implementation!
*
* - Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
*
* You must install the file
* "isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
* as "/usr/lib/isdn/sonderrufnummern.dat"
* for that feature.
*
* ATTENTION: This is *NO* production-code! Please test it carefully!
*
* Revision 1.11 1998/05/06 14:43:27 paul
* Assumption about country codes always being 2 digits long fixed for the
* USA case (caused strncpy to be called with length -1; ouch).
@ -609,10 +644,12 @@ char *Providername(int number)
case 11 : return("o.tel.o");
case 13 : return("Tele2");
case 14 : return("EWE TEL");
case 15 : return("???");
case 18 : return("Debitel");
case 19 : return("Mobilcom");
case 20 : return("Isis");
case 22 : return("NetCologne");
case 23 : return("Tesion");
case 24 : return("TelePassport");
case 25 : return("Citykom Muenster");
case 30 : return("TelDaFax");
@ -620,15 +657,19 @@ char *Providername(int number)
case 36 : return("Hutchison Telekom");
case 39 : return("tesion))");
case 41 : return("HanseNet");
case 43 : return("???");
case 46 : return("KomTel");
case 49 : return("ACC");
case 50 : return("Talkline");
case 55 : return("Esprit");
case 66 : return("Interoute");
case 70 : return("Arcor");
case 79 : return("Viatel");
case 85 : return("WESTCom");
case 88 : return("WorldCom");
case 90 : return("Viag Interkom");
case 98 : return("STAR Telecom");
case 99 : return("ECONOphone/Telco");
default : return("UNKNOWN Provider");
} /* switch */
} /* Providername */

View File

@ -20,6 +20,41 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.18 1998/06/07 21:10:02 akool
* - Accounting for the following new providers implemented:
* o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
* TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
* tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
* WESTCom, WorldCom, Viag Interkom
*
* Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
* program http://www.insider.org/tarif/gebuehr.c
*
* - Telekom's 10plus implemented
*
* - Berechnung der Gebuehrenzone implementiert
* (CityCall, RegioCall, GermanCall, GlobalCall)
* The entry "ZONE" is not needed anymore in the config-files
*
* you need the file
* http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
* and the new entry
* [GLOBAL]
* AREADIFF = /usr/lib/isdn/vorwahl.dat
* for that feature.
*
* Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
* Data-File and Harald Milz for his first Perl-Implementation!
*
* - Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
*
* You must install the file
* "isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
* as "/usr/lib/isdn/sonderrufnummern.dat"
* for that feature.
*
* ATTENTION: This is *NO* production-code! Please test it carefully!
*
* Revision 1.17 1998/03/08 11:43:18 luethje
* I4L-Meeting Wuerzburg final Edition, golden code - Service Pack number One
*
@ -521,6 +556,11 @@ typedef struct {
int takteChargeInt;
int card;
int knock;
time_t nextcint;
float cint;
int cinth;
int ctakt;
int zone;
} CALL;
/****************************************************************************/
@ -652,6 +692,7 @@ _EXTERN double bytemax;
_EXTERN int connectmaxmode;
_EXTERN int bytemaxmode;
_EXTERN char *currency;
_EXTERN int hour;
_EXTERN int day;
_EXTERN int month;
_EXTERN int retnum;