- processor.c, takt_at.c : Patch from Michael Reinelt <reinelt@eunet.at>

try to guess the zone of the calling/called party

 - isdnrep.c : cosmetics (i hope, you like it, Stefan!)
This commit is contained in:
akool 1998-10-03 18:05:48 +00:00
parent 188ea67e6e
commit 26eb0de911
7 changed files with 77 additions and 36 deletions

View File

@ -1,4 +1,4 @@
## $Id: Makefile.in,v 1.42 1998/09/27 11:47:21 akool Exp $ ## $Id: Makefile.in,v 1.43 1998/10/03 18:05:48 akool Exp $
## ##
## ISDN accounting for isdn4linux. ## ISDN accounting for isdn4linux.
## ##
@ -19,6 +19,12 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
## ##
## $Log: Makefile.in,v $ ## $Log: Makefile.in,v $
## Revision 1.43 1998/10/03 18:05:48 akool
## - processor.c, takt_at.c : Patch from Michael Reinelt <reinelt@eunet.at>
## try to guess the zone of the calling/called party
##
## - isdnrep.c : cosmetics (i hope, you like it, Stefan!)
##
## Revision 1.42 1998/09/27 11:47:21 akool ## Revision 1.42 1998/09/27 11:47:21 akool
## fix segfault of isdnlog after each RELASE ## fix segfault of isdnlog after each RELASE
## ##
@ -339,7 +345,7 @@ SERVICEFILE = /etc/services
# DON'T EDIT BELOW THIS LINE # DON'T EDIT BELOW THIS LINE
###################################################################### ######################################################################
VERSION = 2.99.32 VERSION = 2.99.33
ifeq ($(POSTGRES),1) ifeq ($(POSTGRES),1)
DEFS += -DPOSTGRES DEFS += -DPOSTGRES

View File

@ -1,4 +1,4 @@
/* $Id: processor.c,v 1.26 1998/09/27 11:47:28 akool Exp $ /* $Id: processor.c,v 1.27 1998/10/03 18:05:55 akool Exp $
* *
* ISDN accounting for isdn4linux. (log-module) * ISDN accounting for isdn4linux. (log-module)
* *
@ -19,6 +19,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log: processor.c,v $ * $Log: processor.c,v $
* Revision 1.27 1998/10/03 18:05:55 akool
* - processor.c, takt_at.c : Patch from Michael Reinelt <reinelt@eunet.at>
* try to guess the zone of the calling/called party
*
* - isdnrep.c : cosmetics (i hope, you like it, Stefan!)
*
* Revision 1.26 1998/09/27 11:47:28 akool * Revision 1.26 1998/09/27 11:47:28 akool
* fix segfault of isdnlog after each RELASE * fix segfault of isdnlog after each RELASE
* *
@ -642,7 +648,7 @@ static void buildnumber(char *num, int oc3, int oc3a, char *result, int version,
break; break;
case 0x10 : if (version != VERSION_1TR6) case 0x10 : if (version != VERSION_1TR6)
strcpy(result, "00"); /* 001 International */ strcpy(result, countryprefix); /* 001 International */
break; break;
case 0x20 : if (version != VERSION_1TR6) case 0x20 : if (version != VERSION_1TR6)
@ -1976,7 +1982,8 @@ static void decode(int chan, register char *p, int type, int version)
tx = cur_time - call[chan].connect; tx = cur_time - call[chan].connect;
if ((c = call[chan].confentry[OTHER]) > -1) { if ((c = call[chan].confentry[OTHER]) > -1) {
tack = cheap96(cur_time, known[c]->zone, &zeit); /* tack = cheap96(cur_time, known[c]->zone, &zeit); */
tack = taktlaenge (chan, NULL);
err = call[chan].tick - tx; err = call[chan].tick - tx;
call[chan].tick += tack; call[chan].tick += tack;
@ -2046,6 +2053,20 @@ static void decode(int chan, register char *p, int type, int version)
} /* if */ } /* if */
} }
else if (-n > 1) { /* try to guess Gebuehrenzone */ else if (-n > 1) { /* try to guess Gebuehrenzone */
#ifdef ISDN_AT
px="";
err=60*60*24*365; /* sehr gross */
for (c = 1; c < 31; c++) {
call[chan].zone=c;
tack = (-n-1) * taktlaenge (chan, NULL);
if ((tack > 0) && (abs(tack - tx)<err)) {
call[chan].tick = tack;
err = abs(tack) - tx;
px = z2s(c);
}
}
call[chan].zone=-1;
#else
tack = 0; tack = 0;
err = 0; err = 0;
px = ""; px = "";
@ -2071,7 +2092,7 @@ static void decode(int chan, register char *p, int type, int version)
break; break;
} /* if */ } /* if */
} /* for */ } /* for */
#endif
if (message & PRT_SHOWTICKS) if (message & PRT_SHOWTICKS)
sprintf(s, "%d.EH %s %s (%s %d %s?) C=%s", sprintf(s, "%d.EH %s %s (%s %d %s?) C=%s",
abs(call[chan].aoce), abs(call[chan].aoce),
@ -2347,13 +2368,6 @@ static void decode(int chan, register char *p, int type, int version)
call[chan].screening = (oc3a & 3); call[chan].screening = (oc3a & 3);
#ifdef ISDN_AT
/* in Österreich wird + als 00 signalisiert */
if ((oc3 & 0x10) && s[0]=='0' && s[1]=='0') {
s[0]='+';
memmove (s+1, s+2, strlen(s+1));
}
#endif
strcpy(call[chan].onum[CALLING], s); strcpy(call[chan].onum[CALLING], s);
buildnumber(s, oc3, oc3a, call[chan].num[CALLING], version, &call[chan].provider, &call[chan].sondernummer); buildnumber(s, oc3, oc3a, call[chan].num[CALLING], version, &call[chan].provider, &call[chan].sondernummer);

View File

@ -1,4 +1,4 @@
/* $Id: takt_at.c,v 1.1 1998/09/26 18:29:22 akool Exp $ /* $Id: takt_at.c,v 1.2 1998/10/03 18:06:03 akool Exp $
* *
* ISDN accounting for isdn4linux. (log-module) * ISDN accounting for isdn4linux. (log-module)
* *
@ -19,6 +19,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log: takt_at.c,v $ * $Log: takt_at.c,v $
* Revision 1.2 1998/10/03 18:06:03 akool
* - processor.c, takt_at.c : Patch from Michael Reinelt <reinelt@eunet.at>
* try to guess the zone of the calling/called party
*
* - isdnrep.c : cosmetics (i hope, you like it, Stefan!)
*
* Revision 1.1 1998/09/26 18:29:22 akool * Revision 1.1 1998/09/26 18:29:22 akool
* - quick and dirty Call-History in "-m" Mode (press "h" for more info) added * - quick and dirty Call-History in "-m" Mode (press "h" for more info) added
* - eat's one more socket, Stefan: sockets[3] now is STDIN, FIRST_DESCR=4 !! * - eat's one more socket, Stefan: sockets[3] now is STDIN, FIRST_DESCR=4 !!
@ -291,7 +297,6 @@ double taktlaenge(int chan, char *description)
time_t connect; time_t connect;
double takt; double takt;
zone = -1;
if (description) description[0] = '\0'; if (description) description[0] = '\0';
provider = call[chan].provider; provider = call[chan].provider;
connect = call[chan].connect; connect = call[chan].connect;
@ -303,16 +308,26 @@ double taktlaenge(int chan, char *description)
if (*call[chan].num[1] == '\0') if (*call[chan].num[1] == '\0')
return -1; return -1;
if ((c = call[chan].confentry[OTHER]) > -1) if ((zone = call[chan].zone) == 0) {
zone = -1;
if ((c = call[chan].confentry[OTHER]) > -1) {
zone = known[c]->zone; zone = known[c]->zone;
if (zone < 1 || zone > 30) if (zone < 1 || zone > 30)
return -1; zone=-1;
}
call[chan].zone = zone; call[chan].zone = zone;
}
if (zone < 0)
return -1;
fenster = zeitzone[tarifzeit(tm, why)][tm->tm_hour]; fenster = zeitzone[tarifzeit(tm, why)][tm->tm_hour];
if (faktor[zone-1][fenster] == 0.0)
return -1;
takt = 72.0/faktor[zone-1][fenster]; takt = 72.0/faktor[zone-1][fenster];
if (description) sprintf(description, "%s, %s, %s", z2s(zone), why, t2tz(fenster)); if (description) sprintf(description, "%s, %s, %s", z2s(zone), why, t2tz(fenster));
return (takt); return (takt);

View File

@ -1,4 +1,4 @@
/* $Id: takt_ch.c,v 1.1 1998/09/26 18:29:41 akool Exp $ /* $Id: takt_ch.c,v 1.2 1998/10/03 18:06:23 akool Exp $
* *
* ISDN accounting for isdn4linux. (log-module) * ISDN accounting for isdn4linux. (log-module)
* *
@ -357,7 +357,7 @@ float taktlaenge(int chan, char *description)
auto float takt; auto float takt;
*description = 0; if (description) *description = 0;
if (!call[chan].dialin && *call[chan].num[1]) { if (!call[chan].dialin && *call[chan].num[1]) {
@ -396,7 +396,7 @@ float taktlaenge(int chan, char *description)
if (call[chan].sondernummer != -1) { if (call[chan].sondernummer != -1) {
switch (SN[call[chan].sondernummer].tarif) { switch (SN[call[chan].sondernummer].tarif) {
case 0 : sprintf(description, "FreeCall"); /* Free of charge */ case 0 : if (description) sprintf(description, "FreeCall"); /* Free of charge */
return(60 * 60 * 24); /* one day should be enough ;-) */ return(60 * 60 * 24); /* one day should be enough ;-) */
case 1 : zone = 1; /* CityCall */ case 1 : zone = 1; /* CityCall */
@ -411,7 +411,7 @@ float taktlaenge(int chan, char *description)
else else
takt = SN[call[chan].sondernummer].takt2; takt = SN[call[chan].sondernummer].takt2;
strcpy(description, SN[call[chan].sondernummer].sinfo); if (description) strcpy(description, SN[call[chan].sondernummer].sinfo);
return(takt); return(takt);
break; break;
@ -442,7 +442,7 @@ float taktlaenge(int chan, char *description)
if ((provider == 19) || (provider == 33)) { if ((provider == 19) || (provider == 33)) {
takt = 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]); if (description) sprintf(description, "%s, %s, %s", zeiten[zeit[tm->tm_hour]], why, zonen[zone]);
return(takt); return(takt);
} }
else else

View File

@ -1,4 +1,4 @@
/* $Id: takt_de.c,v 1.1 1998/09/26 18:29:42 akool Exp $ /* $Id: takt_de.c,v 1.2 1998/10/03 18:06:25 akool Exp $
* *
* ISDN accounting for isdn4linux. (log-module) * ISDN accounting for isdn4linux. (log-module)
* *
@ -357,7 +357,7 @@ float taktlaenge(int chan, char *description)
auto float takt; auto float takt;
*description = 0; if (description) *description = 0;
if (!call[chan].dialin && *call[chan].num[1]) { if (!call[chan].dialin && *call[chan].num[1]) {
@ -396,7 +396,7 @@ float taktlaenge(int chan, char *description)
if (call[chan].sondernummer != -1) { if (call[chan].sondernummer != -1) {
switch (SN[call[chan].sondernummer].tarif) { switch (SN[call[chan].sondernummer].tarif) {
case 0 : sprintf(description, "FreeCall"); /* Free of charge */ case 0 : if (description) sprintf(description, "FreeCall"); /* Free of charge */
return(60 * 60 * 24); /* one day should be enough ;-) */ return(60 * 60 * 24); /* one day should be enough ;-) */
case 1 : zone = 1; /* CityCall */ case 1 : zone = 1; /* CityCall */
@ -411,7 +411,7 @@ float taktlaenge(int chan, char *description)
else else
takt = SN[call[chan].sondernummer].takt2; takt = SN[call[chan].sondernummer].takt2;
strcpy(description, SN[call[chan].sondernummer].sinfo); if (description) strcpy(description, SN[call[chan].sondernummer].sinfo);
return(takt); return(takt);
break; break;
@ -442,7 +442,7 @@ float taktlaenge(int chan, char *description)
if ((provider == 19) || (provider == 33)) { if ((provider == 19) || (provider == 33)) {
takt = 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]); if (description) sprintf(description, "%s, %s, %s", zeiten[zeit[tm->tm_hour]], why, zonen[zone]);
return(takt); return(takt);
} }
else else

View File

@ -1,4 +1,4 @@
/* $Id: takt_nl.c,v 1.1 1998/09/26 18:29:44 akool Exp $ /* $Id: takt_nl.c,v 1.2 1998/10/03 18:06:27 akool Exp $
* *
* ISDN accounting for isdn4linux. (log-module) * ISDN accounting for isdn4linux. (log-module)
* *
@ -357,7 +357,7 @@ float taktlaenge(int chan, char *description)
auto float takt; auto float takt;
*description = 0; if (description) *description = 0;
if (!call[chan].dialin && *call[chan].num[1]) { if (!call[chan].dialin && *call[chan].num[1]) {
@ -396,7 +396,7 @@ float taktlaenge(int chan, char *description)
if (call[chan].sondernummer != -1) { if (call[chan].sondernummer != -1) {
switch (SN[call[chan].sondernummer].tarif) { switch (SN[call[chan].sondernummer].tarif) {
case 0 : sprintf(description, "FreeCall"); /* Free of charge */ case 0 : if (description) sprintf(description, "FreeCall"); /* Free of charge */
return(60 * 60 * 24); /* one day should be enough ;-) */ return(60 * 60 * 24); /* one day should be enough ;-) */
case 1 : zone = 1; /* CityCall */ case 1 : zone = 1; /* CityCall */
@ -411,7 +411,7 @@ float taktlaenge(int chan, char *description)
else else
takt = SN[call[chan].sondernummer].takt2; takt = SN[call[chan].sondernummer].takt2;
strcpy(description, SN[call[chan].sondernummer].sinfo); if (description) strcpy(description, SN[call[chan].sondernummer].sinfo);
return(takt); return(takt);
break; break;
@ -442,7 +442,7 @@ float taktlaenge(int chan, char *description)
if ((provider == 19) || (provider == 33)) { if ((provider == 19) || (provider == 33)) {
takt = 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]); if (description) sprintf(description, "%s, %s, %s", zeiten[zeit[tm->tm_hour]], why, zonen[zone]);
return(takt); return(takt);
} }
else else

View File

@ -1,4 +1,4 @@
/* $Id: isdnrep.c,v 1.44 1998/10/03 15:21:48 luethje Exp $ /* $Id: isdnrep.c,v 1.45 1998/10/03 18:06:35 akool Exp $
* *
* ISDN accounting for isdn4linux. (Report-module) * ISDN accounting for isdn4linux. (Report-module)
* *
@ -24,6 +24,12 @@
* *
* *
* $Log: isdnrep.c,v $ * $Log: isdnrep.c,v $
* Revision 1.45 1998/10/03 18:06:35 akool
* - processor.c, takt_at.c : Patch from Michael Reinelt <reinelt@eunet.at>
* try to guess the zone of the calling/called party
*
* - isdnrep.c : cosmetics (i hope, you like it, Stefan!)
*
* Revision 1.44 1998/10/03 15:21:48 luethje * Revision 1.44 1998/10/03 15:21:48 luethje
* isdnrep: some bugfixes in output functions * isdnrep: some bugfixes in output functions
* *
@ -983,7 +989,7 @@ static int print_bottom(double unit, char *start, char *stop)
{ {
if ((j == DIALOUT && !incomingonly) || (!outgoingonly && j == DIALIN)) if ((j == DIALOUT && !incomingonly) || (!outgoingonly && j == DIALIN))
{ {
sprintf(string,"%s Summary for %s",j==DIALOUT?"DIALOUT":"DIALIN", sprintf(string, "%s Summary for %s", (j == DIALOUT) ? "Outgoing calls (calling:)" : "Incoming calls (called by:)",
print_diff_date(start,stop)); print_diff_date(start,stop));
h_percent = 80.0; h_percent = 80.0;