isdnlog-3.45

- removed about 1 Mb of (now unused) data files
 - replaced areacodes and "vorwahl.dat" support by zone databases
 - fixed "Sonderrufnummern"
 - rate-de.dat :: V:1.10-Germany [20-Aug-1999 21:23:27]
This commit is contained in:
akool 1999-08-20 19:27:15 +00:00
parent d368a3b127
commit bd6b4cb0d5
12 changed files with 618 additions and 2518 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
## $Id: Makefile.in,v 1.97 1999/08/04 23:11:15 akool Exp $
## $Id: Makefile.in,v 1.98 1999/08/20 19:27:18 akool Exp $
##
## ISDN accounting for isdn4linux.
##
@ -19,6 +19,13 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Log: Makefile.in,v $
## Revision 1.98 1999/08/20 19:27:18 akool
## isdnlog-3.45
## - removed about 1 Mb of (now unused) data files
## - replaced areacodes and "vorwahl.dat" support by zone databases
## - fixed "Sonderrufnummern"
## - rate-de.dat :: V:1.10-Germany [20-Aug-1999 21:23:27]
##
## Revision 1.97 1999/08/04 23:11:15 akool
## isdnlog-3.44
##
@ -670,7 +677,6 @@ CONFFILE := @CONFFILE@
CALLERIDFILE := @CALLERIDFILE@
OLDCONFDIR := @OLDCONFDIR@
OLDCONFFILE := @OLDCONFFILE@
LIBAREA := @LIBAREA@
RUNDIR := @RUNDIR@
DBMLIB := @DBMLIB@
POSTGRES := @POSTGRES@
@ -687,9 +693,7 @@ NATION := @NATION@
export LOGFILE := @LOGFILE@
export COUNTRYCODE := @COUNTRYCODE@
export COUNTRYPREFIX := @COUNTRYPREFIX@
export AREACODE := @AREACODE@
export AREAPREFIX := @AREAPREFIX@
export AREADIFF := @DATADIR@/vorwahl.dat
export ILABEL := %b %e %T %ICall to tei %t from %N2 on %n2
export OLABEL := %b %e %T %Itei %t calling %N2 with %n2
@ -731,7 +735,7 @@ SERVICEFILE = /etc/services
# DON'T EDIT BELOW THIS LINE
######################################################################
VERSION = 3.44
VERSION = 3.45
MANPAGES = isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 \
isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 \
@ -767,7 +771,7 @@ ISDNLOG_OBJS = isdnlog/isdnlog.o isdnlog/processor.o isdnlog/functions.o \
isdnlog/server.o isdnlog/start_prog.o isdnlog/messages.o \
connect/connect.o connect/socket.o tools/tools.o \
connect/conv_address.o isdnlog/user_access.o \
tools/isdnconf.o \
tools/isdnconf.o tools/telnum.o \
tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
isdnlog/asn1.o isdnlog/asn1_generic.o isdnlog/asn1_aoc.o \
isdnlog/asn1_address.o isdnlog/asn1_diversion.o \
@ -790,10 +794,12 @@ endif
ISDNREP_OBJS = isdnrep/rep_main.o tools/tools.o tools/isdnconf.o \
isdnlog/messages.o isdnrep/isdnrep.o \
tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
tools/telnum.o \
$(LIBISDNDIR)/libisdn.a
ISDNCONF_OBJS= isdnconf/isdnconf.o tools/tools.o tools/isdnconf.o \
tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
tools/telnum.o \
$(LIBISDNDIR)/libisdn.a
ISDNRATE_OBJS= tools/isdnrate.o tools/isdnconf.o tools/tools.o \
@ -875,8 +881,8 @@ install: all rootperm installdirs
else \
$(GENCONF) $(DESTDIR)$(I4LCONFDIR)/$(CONFFILE) $(DESTDIR)$(I4LCONFDIR)/$(CALLERIDFILE) ; \
fi
@echo "Generate config files. Wait a moment..."
-@$(ISDNCONF) -c 040 1>/dev/null 2>&1 || echo "Can not read areacode/avon lib."
@echo "Generating config files. Wait a moment..."
-@$(ISDNCONF) -c 040 1>/dev/null 2>&1 || echo "** failed! **"
$(INSTALL_BIN) $(ISDNLOG) $(DESTDIR)$(SBINDIR)
$(INSTALL_BIN) $(ISDNREP) $(DESTDIR)$(BINDIR)
$(INSTALL_BIN) $(ISDNCONF) $(DESTDIR)$(BINDIR)

View File

@ -1,5 +1,5 @@
#!/bin/sh
## $Id: genconf,v 1.8 1999/03/20 14:32:49 akool Exp $
## $Id: genconf,v 1.9 1999/08/20 19:27:54 akool Exp $
##
## installation script for the config file of isdnlog
##
@ -20,6 +20,13 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Log: genconf,v $
## Revision 1.9 1999/08/20 19:27:54 akool
## isdnlog-3.45
## - removed about 1 Mb of (now unused) data files
## - replaced areacodes and "vorwahl.dat" support by zone databases
## - fixed "Sonderrufnummern"
## - rate-de.dat :: V:1.10-Germany [20-Aug-1999 21:23:27]
##
## Revision 1.8 1999/03/20 14:32:49 akool
## - isdnlog Version 3.08
## - more tesion)) Tarife from Michael Graw <Michael.Graw@bartlmae.de>
@ -113,7 +120,6 @@ else
echo -n "Adding some entries to the config file \"$CONFFILE\"..."
fi
setentry "[GLOBAL]" "AREADIFF" "$AREADIFF"
setentry "[GLOBAL]" "AREACODE" "$AREACODE"
setentry "[GLOBAL]" "AREAPREFIX" "$AREAPREFIX"
setentry "[GLOBAL]" "COUNTRYCODE" "$COUNTRYCODE"

View File

@ -1,4 +1,4 @@
/* $Id: isdnconf.c,v 1.36 1999/07/03 10:24:02 akool Exp $
/* $Id: isdnconf.c,v 1.37 1999/08/20 19:28:05 akool Exp $
*
* ISDN accounting for isdn4linux. (Report-module)
*
@ -20,6 +20,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnconf.c,v $
* Revision 1.37 1999/08/20 19:28:05 akool
* isdnlog-3.45
* - removed about 1 Mb of (now unused) data files
* - replaced areacodes and "vorwahl.dat" support by zone databases
* - fixed "Sonderrufnummern"
* - rate-de.dat :: V:1.10-Germany [20-Aug-1999 21:23:27]
*
* Revision 1.36 1999/07/03 10:24:02 akool
* fixed Makefile
*
@ -463,15 +470,21 @@ int find_data(char *_alias, char *_number, section *conf_dat)
print_msg(PRT_NORMAL,"%s:\t\t%s\n",make_word(CONF_ENT_ALIAS),_alias?_alias:S_UNKNOWN);
print_msg(PRT_NORMAL,"%s:\t\t%s\n",make_word(CONF_ENT_NUM),_number?_number:S_UNKNOWN);
#if 0 /* DELETE_ME AK:18-Aug-99 */
if (_number != NULL && (ptr = get_areacode(_number,NULL,C_NO_ERROR)) != NULL)
print_msg(PRT_NORMAL,"Location:\t%s\n",ptr);
#endif
if (!short_out)
{
ptr = (CEPtr = Get_Entry(conf_dat->entries,CONF_ENT_SI))?(CEPtr->value?CEPtr->value:"0"):"0";
print_msg(PRT_NORMAL,"%s:\t\t%s\n",CONF_ENT_SI,ptr);
#if 0 /* DELETE_ME AK:18-Aug-99 */
area = area_diff_string(NULL,_number);
#else
area = "";
#endif
ptr = (char*)(const char*) (area[0] != '\0'?area:(CEPtr = Get_Entry(conf_dat->entries,CONF_ENT_ZONE))?(CEPtr->value?CEPtr->value:""):"");
print_msg(PRT_NORMAL,"%s:\t\t%s\n",make_word(CONF_ENT_ZONE),ptr);

View File

@ -1,4 +1,4 @@
/* $Id: isdnlog.c,v 1.47 1999/06/28 19:16:03 akool Exp $
/* $Id: isdnlog.c,v 1.48 1999/08/20 19:28:12 akool Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -19,6 +19,13 @@
* along with this program; if not, write to the Free Software
*
* $Log: isdnlog.c,v $
* Revision 1.48 1999/08/20 19:28:12 akool
* isdnlog-3.45
* - removed about 1 Mb of (now unused) data files
* - replaced areacodes and "vorwahl.dat" support by zone databases
* - fixed "Sonderrufnummern"
* - rate-de.dat :: V:1.10-Germany [20-Aug-1999 21:23:27]
*
* Revision 1.47 1999/06/28 19:16:03 akool
* isdnlog Version 3.38
* - new utility "isdnrate" started
@ -335,6 +342,7 @@
#include <termios.h>
#include "isdnlog.h"
#include "telnum.h"
#ifdef POSTGRES
#include "postgres.h"
#endif
@ -1365,6 +1373,7 @@ int main(int argc, char *argv[], char *envp[])
if (!Q931dmp && *version)
print_msg(PRT_NORMAL, "%s\n", version);
initTelNum();
loop();
if (sockets[ISDNINFO].descriptor >= 0)

View File

@ -1,4 +1,4 @@
/* $Id: processor.c,v 1.79 1999/07/25 15:57:21 akool Exp $
/* $Id: processor.c,v 1.80 1999/08/20 19:28:18 akool Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -19,6 +19,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: processor.c,v $
* Revision 1.80 1999/08/20 19:28:18 akool
* isdnlog-3.45
* - removed about 1 Mb of (now unused) data files
* - replaced areacodes and "vorwahl.dat" support by zone databases
* - fixed "Sonderrufnummern"
* - rate-de.dat :: V:1.10-Germany [20-Aug-1999 21:23:27]
*
* Revision 1.79 1999/07/25 15:57:21 akool
* isdnlog-3.43
* added "telnum" module
@ -854,7 +861,7 @@ void buildnumber(char *num, int oc3, int oc3a, char *result, int version,
auto int partner = ((dir && (who == CALLING)) || (!dir && (who == CALLED)));
*sondernummer = UNKNOWN;
// *sondernummer = UNKNOWN;
*intern = 0;
*local = 0;
@ -1005,7 +1012,7 @@ void buildnumber(char *num, int oc3, int oc3a, char *result, int version,
if (*provider == UNKNOWN)
*provider = preselect;
if (*num && !dir && (who == CALLED) && getArea(*provider, num))
if (*num && !dir && (who == CALLED) && getArea(*provider, num) && (*sondernummer == UNKNOWN))
*sondernummer = strlen(num);
} /* if */
@ -3515,9 +3522,9 @@ void processRate(int chan)
call[chan].Rate.start = call[chan].connect;
call[chan].Rate.now = call[chan].disconnect = cur_time;
if (getRate(&call[chan].Rate, NULL) == UNKNOWN) {
if (getRate(&call[chan].Rate, NULL) == UNKNOWN)
call[chan].tarifknown = 0;
} else {
else {
call[chan].tarifknown = 1;
call[chan].pay = call[chan].Rate.Charge;
} /* else */
@ -3634,11 +3641,13 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep)
call[chan].Rate.src[0] = "";
call[chan].Rate.src[1] = "";
call[chan].Rate.src[2] = mynum;
} else {
}
else {
call[chan].Rate.src[0] = call[chan].areacode[CALLING];
call[chan].Rate.src[1] = call[chan].vorwahl[CALLING];
call[chan].Rate.src[2] = call[chan].rufnummer[CALLING];
}
} /* else */
call[chan].Rate.dst[0] = call[chan].areacode[CALLED];
call[chan].Rate.dst[1] = call[chan].vorwahl[CALLED];
call[chan].Rate.dst[2] = call[chan].rufnummer[CALLED];
@ -3685,6 +3694,7 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep)
} /* prepareRate */
#if 0
static void LCR(int chan, char *s)
{
auto char *why, *hint;
@ -3727,6 +3737,7 @@ static void LCR(int chan, char *s)
else
print_msg(PRT_NORMAL, ">> LCR: NO ACTION: Internal call\n");
} /* LCR */
#endif
static void processctrl(int card, char *s)

View File

@ -1,4 +1,4 @@
/* $Id: isdnrep.c,v 1.73 1999/07/24 08:44:44 akool Exp $
/* $Id: isdnrep.c,v 1.74 1999/08/20 19:28:37 akool Exp $
*
* ISDN accounting for isdn4linux. (Report-module)
*
@ -24,6 +24,13 @@
*
*
* $Log: isdnrep.c,v $
* Revision 1.74 1999/08/20 19:28:37 akool
* isdnlog-3.45
* - removed about 1 Mb of (now unused) data files
* - replaced areacodes and "vorwahl.dat" support by zone databases
* - fixed "Sonderrufnummern"
* - rate-de.dat :: V:1.10-Germany [20-Aug-1999 21:23:27]
*
* Revision 1.73 1999/07/24 08:44:44 akool
* isdnlog-3.42
* rate-de.dat 1.02-Germany [18-Jul-1999 10:44:21]
@ -567,6 +574,7 @@
#include "isdnrep.h"
#include "../../vbox/src/libvbox.h"
#include "libisdn.h"
#include "telnum.h"
#define END_TIME 1
@ -937,6 +945,7 @@ int read_logfile(char *myname)
initHoliday(holifile, NULL);
initCountry(countryfile, NULL);
initRate(rateconf, ratefile, zonefile, NULL);
initTelNum();
currency = strdup("DM");
vbn = strdup("010");
interns0 = 3;
@ -1247,6 +1256,7 @@ static int print_bottom(double unit, char *start, char *stop)
if (!incomingonly)
{
#if 0
h_percent = 60.0;
h_table_color = H_TABLE_COLOR3;
get_format("%-21.21s %4d call(s) %10.10s %12s");
@ -1296,6 +1306,7 @@ static int print_bottom(double unit, char *start, char *stop)
#endif
print_line2(F_BODY_BOTTOM2,"");
#endif
h_percent = 60.0;
h_table_color = H_TABLE_COLOR4;
@ -1371,12 +1382,13 @@ static int print_bottom(double unit, char *start, char *stop)
if ((unknown[i].cause != 1) && /* Unallocated (unassigned) number */
(unknown[i].cause != 3) && /* No route to destination */
(unknown[i].cause != 28)) { /* Invalid number format (address incomplete) */
#if 0 /* DELETE_ME AK:18-Aug-99 */
auto char *p;
auto int l;
register int flag = C_NO_WARN | C_NO_EXPAND;
auto int prefix = strlen(countryprefix);
auto char areacode[64], vorwahl[64], rufnummer[64], iam[64];
#endif
print_msg(PRT_NORMAL,"%s ", unknown[i].called ? "Called by" : " Calling");
@ -1385,6 +1397,7 @@ static int print_bottom(double unit, char *start, char *stop)
;
else
#endif
#if 0 /* DELETE_ME AK:18-Aug-99 */
if ((p = get_areacode(unknown[i].num, &l, flag)) != 0) {
if (l > 1) {
/* Sehr gefaehrlich, was ist mit Laendern, die einen dreistelligen Code haben??? */
@ -1408,8 +1421,11 @@ static int print_bottom(double unit, char *start, char *stop)
print_msg(PRT_NORMAL,"??? %s\n\t\t\t ", unknown[i].num);
}
else {
#endif
print_msg(PRT_NORMAL,"??? %s\n\t\t\t ", unknown[i].num);
#if 0 /* DELETE_ME AK:18-Aug-99 */
}
#endif
} /* if */
#endif
for (k = 0; k < unknown[i].connects; k++) {
@ -1537,7 +1553,9 @@ static int print_line2(int status, const char *fmt, ...)
static int print_line(int status, one_call *cur_call, int computed, char *overlap)
{
char *string = NULL;
#if 0 /* DELETE_ME AK:18-Aug-99 */
char *Ptr;
#endif
char help[32];
prt_fmt **fmtstring = get_format(NULL);
int dir;
@ -1668,11 +1686,13 @@ static int print_line(int status, one_call *cur_call, int computed, char *overla
case 'L': if (status == F_BODY_LINE)
{
dir = cur_call->dir?CALLED:CALLING;
#if 0 /* DELETE_ME AK:18-Aug-99 */
if (cur_call->num[dir][0] != C_UNKNOWN &&
cur_call->num[dir][0] != '\0' &&
(Ptr = get_areacode(cur_call->num[dir],NULL,C_NO_WARN | C_NO_ERROR)) != NULL)
colsize[i] = append_string(&string,*fmtstring, Ptr);
else
#endif
colsize[i] = append_string(&string,*fmtstring, "");
}
else
@ -1687,11 +1707,13 @@ static int print_line(int status, one_call *cur_call, int computed, char *overla
case 'l': if (status == F_BODY_LINE)
{
dir = cur_call->dir?CALLING:CALLED;
#if 0 /* DELETE_ME AK:18-Aug-99 */
if (cur_call->num[dir][0] != C_UNKNOWN &&
cur_call->num[dir][0] != '\0' &&
(Ptr = get_areacode(cur_call->num[dir],NULL,C_NO_WARN | C_NO_ERROR)) != NULL)
colsize[i] = append_string(&string,*fmtstring, Ptr);
else
#endif
colsize[i] = append_string(&string,*fmtstring, "");
}
else
@ -1872,80 +1894,11 @@ static int print_line(int status, one_call *cur_call, int computed, char *overla
/*****************************************************************************/
static void numsplit(char *num)
{
register int l1, l3, l4, zone;
auto int l2;
register char *p;
auto char *s;
char country[BUFSIZ], area[BUFSIZ], msn[BUFSIZ];
if (!*num)
return;
if ((l1 = getCountrycode(num, &s)) != UNKNOWN) {
Strncpy(country, num, l1 + 1);
if (strcmp(mycountry, country))
print_msg(PRT_NORMAL, "%s, ", s);
if ((p = get_areacode(num, &l2, C_NO_WARN | C_NO_EXPAND | C_NO_ERROR)) && (l2 > 0)) {
l4 = l2 + 1 - l1;
if (l4 > 0)
Strncpy(area, num + l1, l2 + 1 - l1);
print_msg(PRT_NORMAL, "%s", p);
strcpy(msn, num + l2);
} /* if */
#if 0
p = country;
while (*p && !isdigit(*p))
p++;
l3 = getAreacode(atoi(p), num + l1, &s);
if (1 /* l3 != UNKNOWN */) {
print_msg(PRT_NORMAL, "getAreacode(%d, %s, %s)=%d", atoi(p), num + l1, s, l3);
if (l3 != UNKNOWN)
free(s);
zone = getZone(DTAG, myarea, num + l1);
print_msg(PRT_NORMAL, "getZone(%d,%s,%s)=%d", DTAG, myarea, num + l1, zone);
switch (zone) {
case 1 : print_msg(PRT_NORMAL, "Ortszone\n"); break;
case 2 : print_msg(PRT_NORMAL, "Cityzone\n"); break;
case 3 : print_msg(PRT_NORMAL, "Regionalzone\n"); break;
case 4 : print_msg(PRT_NORMAL, "Fernzone\n"); break;
default : print_msg(PRT_NORMAL, "*** BUG ***\n"); break;
} /* switch */
} /* if */
#endif
}
#if 0
else {
l3 = getAreacode(49, num, &s);
if (l3 != UNKNOWN) {
print_msg(PRT_NORMAL, "getAreacode(%d, %s, %s)=%d\n", atoi(p), num + l1, s, l3);
free(s);
zone = getZone(DTAG, mynum, num);
print_msg(PRT_NORMAL, "getZone=%d\n", zone);
} /* if */
} /* else */
#endif
} /* numsplit */
static void bprint(one_call *call)
{
register char *p = call->num[CALLED];
auto char target[BUFSIZ];
auto char target[BUFSIZ], s[BUFSIZ];
auto TELNUM number;
if (call->duration) {
@ -1970,31 +1923,19 @@ static void bprint(one_call *call)
print_currency(call->pay * 100.0 / 116.0, 0),
getProvider(call->provider));
numsplit(call->num[CALLED]);
print_msg(PRT_NORMAL, "\n");
strcpy(s, call->num[CALLED]);
if (!memcmp(s, "+491", 4)) {
sprintf(s, "0%s", call->num[CALLED] + 3);
print_msg(PRT_NORMAL, "\nREPAIR: %s -> %s\n", call->num[CALLED], s);
} /* if */
normalizeNumber(s, &number, TN_ALL);
print_msg(PRT_NORMAL, "%s\n", formatNumber("%A", &number));
}
else
print_msg(PRT_NORMAL, "%*s** %s\n", 30, "", qmsg(TYPE_CAUSE, VERSION_EDSS1, call->cause));
} /* if */
/*
int eh;
int cause;
time_t t;
int dir;
double duration;
char num[2][NUMSIZE];
char who[2][NUMSIZE];
long ibytes;
long obytes;
char version[10];
int si;
int si1;
double currency_factor;
char currency[32];
double pay;
int provider;
int zone;
*/
} /* bprint */
/*****************************************************************************/
@ -2368,7 +2309,7 @@ static int print_entries(one_call *cur_call, double unit, int *nx, char *myname)
register int i, zone, computed = 0;
if (cur_call->dir == DIALOUT) {
if (1 /* cur_call->dir == DIALOUT */) {
zone = (cur_call->zone >= 0) ? cur_call->zone : UNKNOWNZONE;
@ -2391,9 +2332,9 @@ static int print_entries(one_call *cur_call, double unit, int *nx, char *myname)
if (cur_call->dir) {
if (nx[CALLING] == UNKNOWN) {
known[knowns-1]->usage[DIALIN]++;
known[knowns-1]->ibytes[DIALIN] += cur_call->ibytes;
known[knowns-1]->obytes[DIALIN] += cur_call->obytes;
known[knowns - 1]->usage[DIALIN]++;
known[knowns - 1]->ibytes[DIALIN] += cur_call->ibytes;
known[knowns - 1]->obytes[DIALIN] += cur_call->obytes;
if (cur_call->duration > 0)
known[knowns-1]->dur[DIALIN] += cur_call->duration;
@ -2435,9 +2376,8 @@ static int print_entries(one_call *cur_call, double unit, int *nx, char *myname)
} /* if */
} /* else */
}
else {
else
add_one_call(computed ? &day_com_sum : &day_sum, cur_call, unit);
} /* else */
if (cur_call->dir == DIALOUT) {
int first_found = UNKNOWN;
@ -2468,8 +2408,10 @@ static int print_entries(one_call *cur_call, double unit, int *nx, char *myname)
} /* if */
if (bill)
if (bill) {
if (cur_call->dir == DIALOUT)
bprint(cur_call);
}
else
print_line(F_BODY_LINE,cur_call,computed,NULL);

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $Id: rate.c,v 1.38 1999/07/31 09:25:45 akool Exp $
/* $Id: rate.c,v 1.39 1999/08/20 19:29:02 akool Exp $
*
* Tarifdatenbank
*
@ -19,6 +19,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: rate.c,v $
* Revision 1.39 1999/08/20 19:29:02 akool
* isdnlog-3.45
* - removed about 1 Mb of (now unused) data files
* - replaced areacodes and "vorwahl.dat" support by zone databases
* - fixed "Sonderrufnummern"
* - rate-de.dat :: V:1.10-Germany [20-Aug-1999 21:23:27]
*
* Revision 1.38 1999/07/31 09:25:45 akool
* getRate() speedup
*
@ -816,13 +823,13 @@ int initRate(char *conf, char *dat, char *dom, char **msg)
s+=2;
while(1) {
if (*(c=strip(str2list(&s)))) {
#if 0
if (*c == '0' && (*(c + 1) != '0')) {
sprintf(sx, "%s%s", mycountry, c + 1);
warning(dat, "Replacing %s by %s\n", c, sx);
c = sx;
} /* if */
#endif
if (!isdigit(*c) && (d=getCountry(c, &Country)) != UNKNOWN) {
if (*c=='+') {
Areas += appendArea (prefix, c, Country->Name, zone, &domestic, dat);

View File

@ -1,5 +1,3 @@
#define TESTat
/* telnum.c
* (c) 1999 by Leopold Toetsch <lt@toetsch.at>
*
@ -57,6 +55,7 @@
* %NA .. areaname
* %Nm .. msn
* %f .. full +49 89 12356 (Deutschland, Berlin)
* %F .. full +49 89/12345, Berlin
* %s .. short +48 89 123456
* %n .. number 004889123456
*
@ -89,6 +88,8 @@
#define DEFAULT (UNKNOWN-1)
#undef DEBUG
static TELNUM defnum;
static void _init(void);
@ -145,14 +146,20 @@ static inline int Isspace(c) {
static int split_vbn(char **p, TELNUM *num) {
int l;
#if DEBUG
print_msg(PRT_V, "vbn: p(%d) '%s' ", num->nprovider,*p);
#endif
if ((l = provider2prefix(*p, &num->nprovider, num))) {
Strncpy(num->provider, *p, l+1);
*p += l;
#if DEBUG
print_msg(PRT_V, "Provider \"%s\" %d\n", num->provider, num->nprovider);
#endif
return l;
}
#if DEBUG
print_msg(PRT_V, "No Provider\n");
#endif
return 0;
}
static inline void clearCountry(TELNUM *num, int c) {
@ -177,7 +184,9 @@ static int _getCountrycode(char *country, char ** t) {
while(l>1) {
if ((res = getCountrycode(c, t)) != UNKNOWN)
last=res;
#if DEBUG
print_msg(PRT_V, "_getCountrycode(%s)=%d ", c,res);
#endif
c[--l] = '\0'; /* try shorter */
}
return last;
@ -186,7 +195,9 @@ static int split_country(char **p, TELNUM *num) {
int res=0;
int len=0;
char *country=0;
#if DEBUG
print_msg(PRT_V, "cou: '%s' ", *p);
#endif
if (!memcmp(*p,"00", 2) || !isdigit(**p)) {
res = 0; /* len of country known ? */
@ -209,9 +220,13 @@ static int split_country(char **p, TELNUM *num) {
}
if (res == 0) {
if((res = _getCountrycode(country, 0)) != UNKNOWN) {
#if DEBUG
print_msg(PRT_V, "getCountrycode(%s)= ", country);
#endif
country[res]='\0';
#if DEBUG
print_msg(PRT_V, "\"%s\" ", country);
#endif
*p += res;
}
else {
@ -221,7 +236,9 @@ static int split_country(char **p, TELNUM *num) {
}
}
if (getCountry(country, &num->country) != UNKNOWN) {
#if DEBUG
print_msg(PRT_V, "Country \"%s\"\n", num->country->Code[0]);
#endif
num->ncountry=atoi(num->country->Code[0]+1);
}
else {
@ -233,14 +250,20 @@ static int split_country(char **p, TELNUM *num) {
}
else {
int ga;
#if DEBUG
print_msg(PRT_V, "getArea(%d,%s) => " ,num->nprovider, *p);
#endif
if((ga=getArea(num->nprovider, *p))) /* sondernummer */
clearCountry(num, 0);
else
clearCountry(num, DEFAULT);
#if DEBUG
print_msg(PRT_V, "%d ", ga);
#endif
}
#if DEBUG
print_msg(PRT_V, "Country %d\n", num->ncountry);
#endif
return res+len;
}
@ -254,7 +277,9 @@ static int split_area(char **p, TELNUM *num, int first) {
int res=0;
int len=0;
char *s;
#if DEBUG
print_msg(PRT_V, "are: '%s' ", *p);
#endif
if (num->ncountry == 0) { /* sondernummer */
clearArea(num, 0);
return 0;
@ -269,11 +294,15 @@ static int split_area(char **p, TELNUM *num, int first) {
Strncpy(num->area, *p, min(res+1, TN_MAX_AREA_LEN));
(*p) += res;
num->narea=atoi(num->area);
#if DEBUG
print_msg(PRT_V,"getAreacode(%d, %s)= '%s'\n",num->ncountry,num->area,num->sarea);
#endif
}
else {
clearArea(num, UNKNOWN);
#if DEBUG
print_msg(PRT_V,"getAreacode(%d, %s)= 'UNKNOWN'\n",num->ncountry,*p);
#endif
return -1;
}
}
@ -331,7 +360,9 @@ int provider2prefix(char *p, int *prefix, TELNUM *num) {
l1=strlen(vbns);
if (!memcmp(p, q, l1)) {
Strncpy(num->vbn, q, TN_MAX_VBN_LEN);
#if DEBUG
print_msg(PRT_V, "VBN \"%s\"\n", q);
#endif
if (p[l1] == '0' && VBN_GERMANY) /* dreistellige Verbindungsnetzbetreiberkennzahl? */
l2 = l1 + 3; /* 1002 is provider UTA in AT */
else
@ -458,6 +489,13 @@ again:
SKIP;
break;
case 'f': q=stpcpy(q,formatNumber("%1c %1a %1m (%2C, %A)", num)); break;
case 'F': if (num->ncountry == defnum.ncountry)
q = stpcpy(q, formatNumber("%1c %1a/%1m, %A", num));
else
q = stpcpy(q, formatNumber("%1c %1a/%1m, %2C, %A", num));
break;
case 's': q=stpcpy(q,formatNumber("%1c %1a %m", num)); break;
case 'n':
if(num->ncountry>0 && num->country) {

View File

@ -1,4 +1,4 @@
/* $Id: tools.c,v 1.32 1999/07/24 08:45:26 akool Exp $
/* $Id: tools.c,v 1.33 1999/08/20 19:29:12 akool Exp $
*
* ISDN accounting for isdn4linux. (Utilities)
*
@ -19,6 +19,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: tools.c,v $
* Revision 1.33 1999/08/20 19:29:12 akool
* isdnlog-3.45
* - removed about 1 Mb of (now unused) data files
* - replaced areacodes and "vorwahl.dat" support by zone databases
* - fixed "Sonderrufnummern"
* - rate-de.dat :: V:1.10-Germany [20-Aug-1999 21:23:27]
*
* Revision 1.32 1999/07/24 08:45:26 akool
* isdnlog-3.42
* rate-de.dat 1.02-Germany [18-Jul-1999 10:44:21]
@ -338,6 +345,7 @@
/****************************************************************************/
#include "tools.h"
#include "telnum.h"
/****************************************************************************/
@ -636,12 +644,21 @@ char *double2clock(double n)
char *vnum(int chan, int who)
{
register int l = strlen(call[chan].num[who]), got = 0;
register int l = strlen(call[chan].num[who]);
register char *p1, *p2;
#if 0 /* DELETE_ME AK:18-Aug-99 */
register int got = 0;
#endif
register int flag = C_NO_WARN | C_NO_EXPAND;
#if 0 /* DELETE_ME AK:18-Aug-99 */
auto char *ptr;
auto int ll, lx, l1;
auto int ll;
#endif
auto int lx, l1, mobil = 0;
auto int prefix = strlen(countryprefix);
auto int cc_len = 2; /* country code length defaults to 2 */
auto TELNUM number;
auto char s[BUFSIZ];
if (++retnum == MAXRET)
@ -680,9 +697,14 @@ char *vnum(int chan, int who)
register char *p = call[chan].num[who] + l1;
register char c = *p;
*call[chan].areacode[who] = *call[chan].area[who] = 0;
*p = 0;
sprintf(retstr[retnum], "%s - %c%s", call[chan].num[who], c, p + 1);
strcpy(call[chan].vorwahl[who], call[chan].num[who]);
strcpy(call[chan].rufnummer[who], p + 1);
*p = c;
}
@ -716,11 +738,91 @@ char *vnum(int chan, int who)
} /* if */
} /* if */
#if 0 /* DELETE_ME AK:18-Aug-99 */
if ((ptr = get_areacode(call[chan].num[who], &ll, flag)) != 0) {
strcpy(call[chan].area[who], ptr);
l = ll;
got++;
} /* if */
#else
#if 1
if (!memcmp(call[chan].num[who], "+49170", 6))
mobil = 1;
else if (!memcmp(call[chan].num[who], "+49171", 6))
mobil = 1;
else if (!memcmp(call[chan].num[who], "+49172", 6))
mobil = 2;
else if (!memcmp(call[chan].num[who], "+49173", 6))
mobil = 2;
else if (!memcmp(call[chan].num[who], "+49177", 6))
mobil = 3;
else if (!memcmp(call[chan].num[who], "+49178", 6))
mobil = 3;
else if (!memcmp(call[chan].num[who], "+49176", 6))
mobil = 4;
else if (!memcmp(call[chan].num[who], "+49179", 6))
mobil = 4;
else if (!memcmp(call[chan].num[who], "+491", 4))
mobil = 5;
if (mobil) {
Strncpy(call[chan].areacode[who], call[chan].num[who], 4);
Strncpy(call[chan].vorwahl[who], call[chan].num[who] + 3, 4);
strcpy(call[chan].rufnummer[who], call[chan].num[who] + 6);
switch (mobil) {
case 1 : strcpy(call[chan].area[who], "Mobilfunknetz D1"); break;
case 2 : strcpy(call[chan].area[who], "Mobilfunknetz D2"); break;
case 3 : strcpy(call[chan].area[who], "Mobilfunknetz Eplus"); break;
case 4 : strcpy(call[chan].area[who], "Mobilfunknetz E2"); break;
case 5 : strcpy(call[chan].area[who], "Sonderrufnummer"); break;
} /* switch */
if (cnf > -1)
strcpy(retstr[retnum], call[chan].alias[who]);
else
sprintf(retstr[retnum], "%s %s/%s, %s",
call[chan].areacode[who],
call[chan].vorwahl[who],
call[chan].rufnummer[who],
call[chan].area[who]);
return(retstr[retnum]);
} /* if */
normalizeNumber(call[chan].num[who], &number, TN_ALL);
strcpy(s, formatNumber("%F", &number));
/* +49 6441/443431, Wetzlar */
if ((p1 = strchr(s, ' '))) {
*p1 = 0;
strcpy(call[chan].areacode[who], s);
*p1 = ' ';
if ((p2 = strchr(p1 + 1, '/'))) {
*p2 = 0;
strcpy(call[chan].vorwahl[who], p1 + 1);
*p2 = '/';
if ((p1 = strchr(p2 + 1, ','))) {
*p1 = 0;
strcpy(call[chan].rufnummer[who], p2 + 1);
*p1 = ',';
strcpy(call[chan].area[who], p1 + 2);
} /* if */
} /* if */
} /* if */
if (cnf > -1)
strcpy(retstr[retnum], call[chan].alias[who]);
else
strcpy(retstr[retnum], s);
return(retstr[retnum]);
#endif
#endif
} /* else */
if (l > 1) {
@ -992,6 +1094,7 @@ int iprintf(char *obuf, int chan, register char *fmt, ...)
p = s + strlen(s);
break;
#if 0 /* DELETE_ME AK:18-Aug-99 */
case 'z' : p = itoa(area_diff(NULL, call[chan].num[OTHER]), p, 10, 0);
break;
@ -1002,6 +1105,12 @@ int iprintf(char *obuf, int chan, register char *fmt, ...)
*sx = 0;
p = s + strlen(s);
break;
#else
case 'z' :
case 'Z' : s = "";
p = s + strlen(s);
break;
#endif
case 'n' : who = ME; goto go;
case 'c' : who = CLIP; goto go;

Binary file not shown.