#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 1+posin // llamadas entrantes #define linea 10+posin #define durac 45+posin #define hor 38+posin #define fech 0 #define tranf 78+posin #define numero 17+posin #define ccost 55+posin #define proye 41+posin #define cuenta 63+posin #define pulsos 54+posin #define ruta 14+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; if (i>(79+posin) && blinea && ruf[posin]=='|' && ruf[vestac+8]=='|' && ruf[vlinea+3]=='|' && ruf[vruta+2]=='|' && ruf[vnumero+20]=='|' && ruf[vhor+2]==':' && ruf[vhor+5]=='|' && ruf[vdurac+2]==':' && ruf[vdurac+5]==':' && ruf[vdurac+8]=='|' && ruf[vpulsos+8]=='|' && ruf[vcuenta+3]=='|' && ruf[vcuenta+5]=='|' && ruf[vcuenta+14]=='|' && ruf[posin+79]=='|') { strcat(buf,ruf); blinea = FALSE; vantran += ilinea; vlinea += ilinea; vruta += ilinea; vnumero += ilinea; vhor += ilinea; vdurac += ilinea; vpulsos += ilinea; vcuenta += ilinea; vtranf += ilinea; k = 0 ; for (it=0;it<8;it++) tel[k++] = buf[vestac+it] ; tel[k++] = ' ' ; for(it=0;it<3;it++) { if isdigit(buf[vlinea+it]) tel[k++]=buf[vlinea+it] ; else tel[k++] = '0'; } 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+3] ; tel[k++] = buf[vhor+4] ; tel[k++] = ' ' ; if (vfofech == europeo) { tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; tel[k++] = '/'; tel[k++] = buf[vfech] ; tel[k++] = buf[vfech+1] ; } else { tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; tel[k++] = '/'; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; } tel[k++] = '/'; tel[k++] = buf[vfech+6] ; tel[k++] = buf[vfech+7] ; 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++] = ' ' ; for (it=0;it<4 && isdigit(buf[vccost+it]);it++) tel[k++] = buf[vccost+it]; if (it==0) { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ } tel[k++] = ' ' ; for (it=0;it<8 && isdigit(buf[it+vproye]);it++) tel[k++] = buf[vproye+it]; if (it==0) { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; } tel[k++] = ' ' ; for (it=0 ; it<3 ; it++) tel[k++] = buf[vcuenta+it] ; // Código de Cuenta tel[k++] = ' ' ; for (it=0 ; it<8 ; it++) tel[k++] = buf[vpulsos+it] ; 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[vhor+2]=='|' && ruf[vdurac+8]=='|' && ruf[posin+79]=='|') { ilinea = i; blinea = TRUE ; strcpy(buf,ruf) ; } else if (i>(79+posin)) blinea = FALSE; }