- 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.
##
@ -19,6 +19,12 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $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
## fix segfault of isdnlog after each RELASE
##
@ -339,7 +345,7 @@ SERVICEFILE = /etc/services
# DON'T EDIT BELOW THIS LINE
######################################################################
VERSION = 2.99.32
VERSION = 2.99.33
ifeq ($(POSTGRES),1)
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)
*
@ -19,6 +19,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $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
* 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;
case 0x10 : if (version != VERSION_1TR6)
strcpy(result, "00"); /* 001 International */
strcpy(result, countryprefix); /* 001 International */
break;
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;
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;
call[chan].tick += tack;
@ -2046,6 +2053,20 @@ static void decode(int chan, register char *p, int type, int version)
} /* if */
}
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;
err = 0;
px = "";
@ -2071,7 +2092,7 @@ static void decode(int chan, register char *p, int type, int version)
break;
} /* if */
} /* for */
#endif
if (message & PRT_SHOWTICKS)
sprintf(s, "%d.EH %s %s (%s %d %s?) C=%s",
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);
#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);
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)
*
@ -19,6 +19,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $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
* - 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 !!
@ -291,7 +297,6 @@ double taktlaenge(int chan, char *description)
time_t connect;
double takt;
zone = -1;
if (description) description[0] = '\0';
provider = call[chan].provider;
connect = call[chan].connect;
@ -303,16 +308,26 @@ double taktlaenge(int chan, char *description)
if (*call[chan].num[1] == '\0')
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;
if (zone < 1 || zone > 30)
return -1;
zone=-1;
}
call[chan].zone = zone;
}
if (zone < 0)
return -1;
fenster = zeitzone[tarifzeit(tm, why)][tm->tm_hour];
if (faktor[zone-1][fenster] == 0.0)
return -1;
takt = 72.0/faktor[zone-1][fenster];
if (description) sprintf(description, "%s, %s, %s", z2s(zone), why, t2tz(fenster));
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)
*
@ -357,7 +357,7 @@ float taktlaenge(int chan, char *description)
auto float takt;
*description = 0;
if (description) *description = 0;
if (!call[chan].dialin && *call[chan].num[1]) {
@ -396,7 +396,7 @@ float taktlaenge(int chan, char *description)
if (call[chan].sondernummer != -1) {
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 ;-) */
case 1 : zone = 1; /* CityCall */
@ -411,7 +411,7 @@ float taktlaenge(int chan, char *description)
else
takt = SN[call[chan].sondernummer].takt2;
strcpy(description, SN[call[chan].sondernummer].sinfo);
if (description) strcpy(description, SN[call[chan].sondernummer].sinfo);
return(takt);
break;
@ -442,7 +442,7 @@ float taktlaenge(int chan, char *description)
if ((provider == 19) || (provider == 33)) {
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);
}
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)
*
@ -357,7 +357,7 @@ float taktlaenge(int chan, char *description)
auto float takt;
*description = 0;
if (description) *description = 0;
if (!call[chan].dialin && *call[chan].num[1]) {
@ -396,7 +396,7 @@ float taktlaenge(int chan, char *description)
if (call[chan].sondernummer != -1) {
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 ;-) */
case 1 : zone = 1; /* CityCall */
@ -411,7 +411,7 @@ float taktlaenge(int chan, char *description)
else
takt = SN[call[chan].sondernummer].takt2;
strcpy(description, SN[call[chan].sondernummer].sinfo);
if (description) strcpy(description, SN[call[chan].sondernummer].sinfo);
return(takt);
break;
@ -442,7 +442,7 @@ float taktlaenge(int chan, char *description)
if ((provider == 19) || (provider == 33)) {
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);
}
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)
*
@ -357,7 +357,7 @@ float taktlaenge(int chan, char *description)
auto float takt;
*description = 0;
if (description) *description = 0;
if (!call[chan].dialin && *call[chan].num[1]) {
@ -396,7 +396,7 @@ float taktlaenge(int chan, char *description)
if (call[chan].sondernummer != -1) {
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 ;-) */
case 1 : zone = 1; /* CityCall */
@ -411,7 +411,7 @@ float taktlaenge(int chan, char *description)
else
takt = SN[call[chan].sondernummer].takt2;
strcpy(description, SN[call[chan].sondernummer].sinfo);
if (description) strcpy(description, SN[call[chan].sondernummer].sinfo);
return(takt);
break;
@ -442,7 +442,7 @@ float taktlaenge(int chan, char *description)
if ((provider == 19) || (provider == 33)) {
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);
}
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)
*
@ -24,6 +24,12 @@
*
*
* $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
* 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))
{
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));
h_percent = 80.0;