#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 1+posin // llamadas entrantes #define linea 70+posin //#define linea 10+posin #define durac 50+posin //#define hor 38+posin #define hor 44+posin //#define fech 40+posin #define fech 38+posin #define tranf 78+posin #define numero 10+posin #define ccost 59+posin //#define proye 54+posin #define proye 131+posin #define cuenta 63+posin #define pulsos 54+posin //#define ruta 70+posin #define ruta 160+posin #define prinum 0 #define ring 0 #define antran 1+posin // anexo transferido (pendiente) #define fofech europeo // formato de fecha extern void gua_rut(char *buf); char buf[lmax*2] ; /* Rutas Consideradas como Anexos */ int ilinea; BOOL blinea; extern char rgua[]; // Procesos Iniciales (Inicializar Variables, Abrir // Archivos especiales, etc) void in_central() { rgua[0] = '\0'; blinea = FALSE; } // Procesos de Finalización (Cerrar Archivos especiales, etc) void fi_central() { } // Driver Propiamente tal. Las posiciones de los campos se // ingresan como parámetros, lo que permite modificar desde // Aplicación de Tarificación la posición de estos en el // Registro de Llamados. void DatCentral(char *ruf, char *tel, int vestac, int vlinea,int vdurac,int vhor, int vfech, int vtranf, int vnumero, int vccost,int vproye, int vcuenta, int vpulsos, int vruta, int vprinum, int vring, int vantran, int vfofech) { int i=strlen(ruf),it,k,ka; char aux; aux = 0; aux = blinea; aux = ruf[posin]; aux = ruf[vlinea+5]; aux = ruf[vnumero+20]; aux = ruf[posin+79]; if (i>(79+posin) && blinea && ruf[posin]=='|' && ruf[vestac+8]=='|' && ruf[vlinea+5]=='|' && ruf[vnumero+20]=='|' && ruf[posin+79]=='|') { strcat(buf,ruf); blinea = FALSE; vantran += ilinea; vlinea += ilinea; vnumero += ilinea; vpulsos += ilinea; vcuenta += ilinea; vtranf += ilinea; k = 0 ; for (i=0;(buf[vestac+i]!='|')&&(buf[vestac+i]!=' ');i++) tel[k++] = buf[vestac+i] ; tel[k++] = ' ' ; for (i=0;(buf[vlinea+i]!='|');i++) { if isdigit(buf[vlinea+i]) tel[k++] = buf[vlinea+i] ; } tel[k++] = ' ' ; if (buf[vdurac]!=' ') tel[k++] = buf[vdurac] ; else tel[k++] = '0' ; tel[k++] = buf[vdurac+1] ; tel[k++] = ':' ; tel[k++] = buf[vdurac+3] ; tel[k++] = buf[vdurac+4] ; tel[k++] = ':' ; tel[k++] = buf[vdurac+6] ; tel[k++] = buf[vdurac+7] ; tel[k++] = ' ' ; tel[k++] = buf[vhor] ; tel[k++] = buf[vhor+1] ; tel[k++] = ':' ; tel[k++] = buf[vhor+2] ; tel[k++] = buf[vhor+3] ; tel[k++] = ' ' ; if (vfofech == europeo) { tel[k++] = buf[vfech+4] ; tel[k++] = buf[vfech+5] ; tel[k++] = '/'; tel[k++] = buf[vfech+2] ; tel[k++] = buf[vfech+3] ; } else { tel[k++] = buf[vfech+2] ; tel[k++] = buf[vfech+3] ; tel[k++] = '/'; tel[k++] = buf[vfech+4] ; tel[k++] = buf[vfech+5] ; } tel[k++] = '/'; tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; tel[k++] = ' ' ; if ( buf[vtranf]=='A' || buf[vtranf]=='B' || buf[vtranf]=='C' || buf[vtranf]=='D' || buf[vtranf]=='H' || buf[vtranf]=='I' || buf[vtranf]=='L') tel[k++] = 'O' ; else tel[k++] = 'I' ; tel[k++] = ' ' ; ka = k ; for (it=0 ; it<20 && isdigit(buf[it+vnumero]) ; it++) { tel[k++] = buf[it+vnumero] ; } if (k==ka) tel[k++]='*' ; tel[k++] = ' ' ; if (buf[vccost+8]!='0' && buf[vccost+7]!='0') { for (i=0;buf[vccost+i]!=' ' && buf[vccost+i]!='|';i++) tel[k++] = buf[vccost+i]; } else { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ } tel[k++] = ' ' ; if (buf[vproye+11] ==' ') { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; } else for (i=0;buf[vproye+i]!='|';i++) { if (buf[vproye+i]!=' ') tel[k++] = buf[vproye+i]; } tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = ' ' ; tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = ' ' ; tel[k++] = buf[vruta] ; tel[k++] = buf[vruta+1] ; /* ruta */ tel[k++] = ' ' ; tel[k++] = '*' ; /* primer numero */ tel[k++] = ' ' ; tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = ':' ; tel[k++] = '0' ; tel[k++] = '0' ; /* tiempo ring */ tel[k++] = ' ' ; for (it=0;it<8 && isdigit(buf[vantran+it]);it++) tel[k++] = buf[vantran+it]; if (it==0) tel[k++] = '*' ; // anexo transferido tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } else if (i>(79+posin) && !blinea && ruf[posin]=='|' && ruf[vestac+8]=='|' && ruf[vdurac+8]=='|' && ruf[posin+79]=='|') { ilinea = i; blinea = TRUE ; strcpy(buf,ruf) ; } else if (i>(79+posin)) blinea = FALSE; }