- first try to add the 1999 tarif of the German Telekom

- fix the areacode 2.0 support
This commit is contained in:
akool 1998-12-16 20:57:24 +00:00
parent 3ebff5d8d4
commit 7fddd627e4
2 changed files with 77 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $Id: takt_de.c,v 1.4 1998/11/24 20:52:16 akool Exp $
/* $Id: takt_de.c,v 1.5 1998/12/16 20:57:24 akool Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -328,17 +328,51 @@ float taktlaenge(int chan, char *description)
{
register int c, cwe, tz, z;
auto struct tm *tm;
auto char why[BUFSIZ];
auto char why[BUFSIZ], zt[BUFSIZ];
auto int provider = call[chan].provider;
auto time_t connect = call[chan].connect;
auto int zone = -1, zone2 = -1;
auto float takt;
if (description) *description = 0;
if (description)
*description = 0;
if (!call[chan].dialin && *call[chan].num[CALLED]) {
tm = localtime(&connect);
if ((provider == 33) && (tm->tm_year + 1900 > 1998)) { /* neue 1999 Tarife Dt. Telekom */
cwe = CityWeekend;
tz = tarifzeit(tm, why, cwe);
if (tz == WT) {
z = zeit[tm->tm_hour];
if (z == 5) {
strcpy(zt, "Nacht");
takt = 120;
}
else if ((z == 0) || (z == 3) || (z == 4)) {
strcpy(zt, "Freizeit");
takt = 60;
}
else if ((z == 1) || (z == 2)) {
strcpy(zt, "Tag");
takt = 30;
} /* else */
}
else {
strcpy(zt, "");
takt = 60;
} /* else */
if (description)
sprintf(description, "%s, %s", zt, why);
return(takt);
} /* if */
if ((provider == 11) || /* o.tel.o */
(provider == 13) || /* Tele2 */
(provider == 14) || /* EWE TEL */
@ -370,8 +404,6 @@ float taktlaenge(int chan, char *description)
if (provider == 9) /* ECONOphone - mindestens jedoch 30 Sekunden! */
return(6);
tm = localtime(&connect);
if (call[chan].sondernummer[CALLED] != -1) {
switch (SN[call[chan].sondernummer[CALLED]].tarif) {
case 0 : if (description) sprintf(description, "FreeCall"); /* Free of charge */
@ -430,7 +462,9 @@ float taktlaenge(int chan, char *description)
takt = gebuehr[(provider == 33) ? DTAG : MOBILCOM][z][tz][zone];
if (description) sprintf(description, "%s, %s, %s", zeiten[zeit[tm->tm_hour]], why, zonen[zone]);
if (description)
sprintf(description, "%s, %s, %s", zeiten[zeit[tm->tm_hour]], why, zonen[zone]);
return(takt);
}
else
@ -446,14 +480,26 @@ float taktlaenge(int chan, char *description)
float preis(int chan)
{
auto int duration;
auto float pay, minpr;
auto int duration, takte;
auto float pay, minpr, takt;
auto char why[BUFSIZ];
auto int tz;
auto struct tm *tm;
auto time_t connect = call[chan].connect;
if (call[chan].provider == 13) { /* Tele 2 */
tm = localtime(&connect);
if ((call[chan].provider == 33) && (tm->tm_year + 1900 > 1998)) { /* neue 1999 Tarife Dt. Telekom */
takt = taktlaenge(chan, NULL);
duration = call[chan].disconnect - call[chan].connect;
takte = (int)(duration + (takt - 1) / takt);
pay = takt * 0.12;
return(pay);
}
else if (call[chan].provider == 13) { /* Tele 2 */
if (call[chan].zone == CITYCALL) /* not possible with Tele 2 */
return(-1.0);

View File

@ -1,4 +1,4 @@
/* $Id: isdntools.c,v 1.23 1998/10/13 21:53:26 luethje Exp $
/* $Id: isdntools.c,v 1.24 1998/12/16 20:57:30 akool Exp $
*
* ISDN accounting for isdn4linux. (Utilities)
*
@ -19,6 +19,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdntools.c,v $
* Revision 1.24 1998/12/16 20:57:30 akool
* - first try to add the 1999 tarif of the German Telekom
* - fix the areacode 2.0 support
*
* Revision 1.23 1998/10/13 21:53:26 luethje
* isdnrep and lib: bugfixes
*
@ -872,18 +876,19 @@ static char *_get_areacode(char *code, int *Len, int flag)
static int warned = 0;
int prefix = strlen(countryprefix);
if (!warned && (cc = GetAreaCodeInfo(&ac, code + prefix)) == acOk)
{
if (ac.AreaCodeLen > 0)
{
if (warned)
return(NULL);
if ((cc = GetAreaCodeInfo(&ac, code + prefix)) == acOk) {
if (ac.AreaCodeLen > 0) {
if (Len != NULL)
*Len = ac.AreaCodeLen + prefix;
return ac.Info;
}
}
else
{
else {
switch (cc) {
case acFileError : err = "Cannot open/read file";
break;
@ -891,15 +896,23 @@ static char *_get_areacode(char *code, int *Len, int flag)
break;
case acWrongVersion : err = "Wrong version of data file";
break;
case acInvalidInput : err = "Input string is not a number or empty";
break;
default : err = "Unknown AreaCode error";
break;
} /* switch */
if (!(flag & C_NO_ERROR))
print_msg("!!! Problem with AreaCode: %s - disabling AreaCode support!\n", err);
if (!(flag & C_NO_ERROR)) {
print_msg("!!! Problem with AreaCode: %s", err);
if (cc != acInvalidInput) {
print_msg(" - disabling AreaCode support!\n");
warned = 1;
}
else
print_msg("\n");
} /* if */
} /* else */
return NULL;
}