diff --git a/isdnlog/Makefile.in b/isdnlog/Makefile.in index e316d004..4c46ca69 100644 --- a/isdnlog/Makefile.in +++ b/isdnlog/Makefile.in @@ -1,4 +1,4 @@ -## $Id: Makefile.in,v 1.104 1999/09/11 22:28:22 akool Exp $ +## $Id: Makefile.in,v 1.105 1999/09/13 09:09:42 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.105 1999/09/13 09:09:42 akool +## isdnlog-3.51 +## - changed getProvider() to not return NULL on unknown providers +## many thanks to Matthias Eder +## - corrected zone-processing when doing a internal -> world call +## ## Revision 1.104 1999/09/11 22:28:22 akool ## isdnlog-3.50 ## added 3. parameter to "-h" Option: Controls CHARGEHUP for providers like @@ -758,7 +764,7 @@ SERVICEFILE = /etc/services # DON'T EDIT BELOW THIS LINE ###################################################################### -VERSION = 3.50 +VERSION = 3.51 MANPAGES = isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 \ isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 \ diff --git a/isdnlog/isdnlog/functions.c b/isdnlog/isdnlog/functions.c index 6f2b21fb..d2035382 100644 --- a/isdnlog/isdnlog/functions.c +++ b/isdnlog/isdnlog/functions.c @@ -1,4 +1,4 @@ -/* $Id: functions.c,v 1.24 1999/06/15 20:04:01 akool Exp $ +/* $Id: functions.c,v 1.25 1999/09/13 09:09:43 akool Exp $ * * ISDN accounting for isdn4linux. (log-module) * @@ -19,6 +19,12 @@ * along with this program; if not, write to the Free Software * * $Log: functions.c,v $ + * Revision 1.25 1999/09/13 09:09:43 akool + * isdnlog-3.51 + * - changed getProvider() to not return NULL on unknown providers + * many thanks to Matthias Eder + * - corrected zone-processing when doing a internal -> world call + * * Revision 1.24 1999/06/15 20:04:01 akool * isdnlog Version 3.33 * - big step in using the new zone files @@ -423,7 +429,6 @@ void logger(int chan) mysql_db_set.currency_factor = currency_factor; strcpy(mysql_db_set.currency, currency); mysql_db_set.pay = call[chan].pay; - /* Fixme: getProvider() should be changed to call[chan].Rate.Provider */ strcpy(mysql_db_set.provider, getProvider(call[chan].provider)); mysql_dbAdd(&mysql_db_set); #endif diff --git a/isdnlog/isdnlog/processor.c b/isdnlog/isdnlog/processor.c index 1d5bb30f..5b717f85 100644 --- a/isdnlog/isdnlog/processor.c +++ b/isdnlog/isdnlog/processor.c @@ -1,4 +1,4 @@ -/* $Id: processor.c,v 1.82 1999/09/11 22:28:24 akool Exp $ +/* $Id: processor.c,v 1.83 1999/09/13 09:09:43 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.83 1999/09/13 09:09:43 akool + * isdnlog-3.51 + * - changed getProvider() to not return NULL on unknown providers + * many thanks to Matthias Eder + * - corrected zone-processing when doing a internal -> world call + * * Revision 1.82 1999/09/11 22:28:24 akool * isdnlog-3.50 * added 3. parameter to "-h" Option: Controls CHARGEHUP for providers like @@ -3647,9 +3653,9 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep) call[chan].Rate.prefix = call[chan].provider; if (call[chan].intern[CALLING]) { - call[chan].Rate.src[0] = ""; - call[chan].Rate.src[1] = ""; - call[chan].Rate.src[2] = mynum; + call[chan].Rate.src[0] = mycountry; + call[chan].Rate.src[1] = myarea; + call[chan].Rate.src[2] = ""; } else { call[chan].Rate.src[0] = call[chan].areacode[CALLING]; diff --git a/isdnlog/isdnrep/isdnrep.c b/isdnlog/isdnrep/isdnrep.c index cc914150..47e835c1 100644 --- a/isdnlog/isdnrep/isdnrep.c +++ b/isdnlog/isdnrep/isdnrep.c @@ -1,4 +1,4 @@ -/* $Id: isdnrep.c,v 1.78 1999/09/11 22:28:25 akool Exp $ +/* $Id: isdnrep.c,v 1.79 1999/09/13 09:09:43 akool Exp $ * * ISDN accounting for isdn4linux. (Report-module) * @@ -24,6 +24,12 @@ * * * $Log: isdnrep.c,v $ + * Revision 1.79 1999/09/13 09:09:43 akool + * isdnlog-3.51 + * - changed getProvider() to not return NULL on unknown providers + * many thanks to Matthias Eder + * - corrected zone-processing when doing a internal -> world call + * * Revision 1.78 1999/09/11 22:28:25 akool * isdnlog-3.50 * added 3. parameter to "-h" Option: Controls CHARGEHUP for providers like @@ -1287,14 +1293,14 @@ static int print_bottom(double unit, char *start, char *stop) switch (i) { - case 0 : p = "FreeCall"; break; - case 1 : p = "Ortszone"; break; + case 0 : p = "Internal-/FreeCall"; break; + case 1 : p = "Ortszone"; break; case 2 : p = "CityCall (< 20 km)"; break; case 3 : p = "RegioCall (< 50 km)"; break; - case 4 : p = "Fernzone"; break; + case 4 : p = "GermanCall"; break; } /* case */ - sprintf(s, "Zone %1d:%s", i, p); + sprintf(s, "%1d:%s", i, p); print_line3(NULL, s, zones_usage[i], double2clock(zones_dur[i]), @@ -1329,10 +1335,7 @@ static int print_bottom(double unit, char *start, char *stop) else *sx = 0; - if ((p = getProvider(i)) == NULL) - p = "UNKNOWN"; - - print_line3(NULL, "Provider", string, p, + print_line3(NULL, "Provider", string, getProvider(i), usage_provider[i], double2clock(duration_provider[i]), print_currency(pay_provider[i], 0), sx); @@ -1799,22 +1802,10 @@ static int print_line(int status, one_call *cur_call, int computed, char *overla if (!numbers) { register char *p; - auto char s[BUFSIZ]; - if ((cur_call->dir == DIALOUT) && (cur_call->provider > 0)) { + if ((cur_call->dir == DIALOUT) && (cur_call->provider > 0)) p = getProvider(cur_call->provider); - - if (p == NULL) { - if (cur_call->provider < 100) - sprintf(s, "%s%02d", vbn, cur_call->provider); - else - sprintf(s, "%s%03d", vbn, cur_call->provider - 100); - - p = s; - - } /* if */ - } else p = ""; diff --git a/isdnlog/tools/isdnrate.c b/isdnlog/tools/isdnrate.c index 552c09d6..1259fe4f 100644 --- a/isdnlog/tools/isdnrate.c +++ b/isdnlog/tools/isdnrate.c @@ -1,4 +1,4 @@ -/* $Id: isdnrate.c,v 1.17 1999/09/09 11:21:05 akool Exp $ +/* $Id: isdnrate.c,v 1.18 1999/09/13 09:09:44 akool Exp $ * ISDN accounting for isdn4linux. (rate evaluation) * @@ -19,6 +19,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdnrate.c,v $ + * Revision 1.18 1999/09/13 09:09:44 akool + * isdnlog-3.51 + * - changed getProvider() to not return NULL on unknown providers + * many thanks to Matthias Eder + * - corrected zone-processing when doing a internal -> world call + * * Revision 1.17 1999/09/09 11:21:05 akool * isdnlog-3.49 * @@ -202,7 +208,7 @@ static void get_day(char d) tm = localtime(&start); /* now */ switch (d) { - case 'W': /* we need a normal weekday, so we take + case 'W': /* we need a normal weekday, so we take today and inc. day if today is holiday */ @@ -353,7 +359,7 @@ static int opts(int argc, char *argv[]) break; case 'S': sortby = *optarg; - break; + break; case 'T': table++; break; @@ -371,7 +377,7 @@ static int opts(int argc, char *argv[]) explain++; if (optarg && isdigit(*optarg) && (x = atoi(optarg))) explain = x; - else if(optarg) { + else if(optarg) { comment = strdup(optarg); explain = 8; } @@ -507,7 +513,7 @@ static void splittime() static char *Provider(int prefix) { - register char *p; + register char *p, *p1; register int l; static char s[BUFSIZ]; char prov[TN_MAX_PROVIDER_LEN]; @@ -519,7 +525,11 @@ static char *Provider(int prefix) l = max(WIDTH, strlen(p)) - strlen(p); - sprintf(s, "%s:%s%*s", prefix2provider(prefix, prov, &destnum), p, l, ""); + p1 = prefix2provider(prefix, prov, &destnum); + + l += (6 - strlen(p1)); + + sprintf(s, "%s:%s%*s", p1, p, l, ""); return (s); } /* Provider */ @@ -539,7 +549,7 @@ static char *takt_str(RATE * Rate) return s; } -static inline char * P_EMPTY(char *s) +static inline char * P_EMPTY(char *s) { char *p = s; return p ? p : ""; @@ -584,10 +594,12 @@ static int compute(char *num) } for (i = low; i <= high; i++) { int found, p; + char *px; if (ignore[i]) continue; - if (!getProvider(i)) + px = getProvider(i); + if (px[strlen(px) - 1] == '?') /* UNKNOWN Provider */ continue; found = 0; if (n_providers) { @@ -1098,7 +1110,7 @@ static void do_reinit(void) init(); reinit=0; } - + static void setup_daemon() { @@ -1128,7 +1140,7 @@ static void setup_daemon() else if (pid > 0) exit(EXIT_SUCCESS); } - if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) + if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) err("Can't open socket"); sa.sun_family = AF_UNIX; strcpy(sa.sun_path, sock_name); @@ -1216,7 +1228,7 @@ static int connect_2_daemon(int argc, char *argv[]) case 'C': break; case 'D': - if (optarg && atoi(optarg) == 3) ; /* goon, kill a running + if (optarg && atoi(optarg) == 3) ; /* goon, kill a running daemon */ else diff --git a/isdnlog/tools/rate.c b/isdnlog/tools/rate.c index 8ef8216c..0b92d442 100644 --- a/isdnlog/tools/rate.c +++ b/isdnlog/tools/rate.c @@ -1,4 +1,4 @@ -/* $Id: rate.c,v 1.42 1999/09/09 11:21:05 akool Exp $ +/* $Id: rate.c,v 1.43 1999/09/13 09:09:44 akool Exp $ * * Tarifdatenbank * @@ -19,6 +19,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: rate.c,v $ + * Revision 1.43 1999/09/13 09:09:44 akool + * isdnlog-3.51 + * - changed getProvider() to not return NULL on unknown providers + * many thanks to Matthias Eder + * - corrected zone-processing when doing a internal -> world call + * * Revision 1.42 1999/09/09 11:21:05 akool * isdnlog-3.49 * @@ -283,7 +289,7 @@ * initialisiert die Tarifdatenbank * * char* getProvider (int prefix) - * liefert den Namen des Providers oder NULL wenn unbekannt + * liefert den Namen des Providers oder dessen Prefix wenn unbekannt * * char* getComment(int prefix, char *key) * liefert einen C:-Eintrag @@ -1200,8 +1206,16 @@ int initRate(char *conf, char *dat, char *dom, char **msg) char *getProvider (int prefix) { + static char s[BUFSIZ]; + + if (prefix<0 || prefix>=nProvider || !Provider[prefix].used) { - return NULL; + if (prefix < 100) + sprintf(s, "%s%02d ???", vbn, prefix); + else + sprintf(s, "%s%03d ???", vbn, prefix - 100); + + return(s); } return Provider[prefix].Name; } diff --git a/isdnlog/tools/tools.c b/isdnlog/tools/tools.c index bd2363a9..3f80bec9 100644 --- a/isdnlog/tools/tools.c +++ b/isdnlog/tools/tools.c @@ -1,4 +1,4 @@ -/* $Id: tools.c,v 1.34 1999/08/29 10:29:15 akool Exp $ +/* $Id: tools.c,v 1.35 1999/09/13 09:09:44 akool Exp $ * * ISDN accounting for isdn4linux. (Utilities) * @@ -19,6 +19,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: tools.c,v $ + * Revision 1.35 1999/09/13 09:09:44 akool + * isdnlog-3.51 + * - changed getProvider() to not return NULL on unknown providers + * many thanks to Matthias Eder + * - corrected zone-processing when doing a internal -> world call + * * Revision 1.34 1999/08/29 10:29:15 akool * isdnlog-3.48 * cosmetics @@ -1113,7 +1119,7 @@ go: if (!ndigit) break; case 'P' : s = sx; - if (call[chan].provider != -1) + if (call[chan].provider != UNKNOWN) sprintf(sx, " via %s", getProvider(call[chan].provider)); else *sx = 0;