#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 1 +posin // llamadas entrantes #define linea 0 #define durac 47+posin #define hor 41+posin #define fech 32+posin #define tranf 56+posin #define numero 11+posin #define ccost 6+posin #define proye 75+posin #define cuenta 0 #define pulsos 64+posin #define ruta 0 #define prinum 0 #define ring 0 #define antran 58+posin // anexo transferido (pendiente) #define fofech europeo // formato de fecha extern void gua_rut(char *buf); char ruanex[(lmax+1)*2][7] ; /* Rutas Consideradas como Anexos */ extern char rgua[]; // Procesos Iniciales (Inicializar Variables, Abrir // Archivos especiales, etc) void in_central() { rgua[0] = '\0'; } // 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 *buf, 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) { char shora[4],shori[3] ; int i=strlen(buf),it,k,ka,ki,hori,resto,resti; if (i>vproye && buf[vfech+2]=='/' && buf[vfech+5]=='/' && buf[vhor+2]=='-' && buf[vdurac+3]==':' && buf[posin]=='|') { k = 0 ; tel[k++] = buf[vestac] ; tel[k++] = buf[vestac+1] ; tel[k++] = buf[vestac+2] ; tel[k++] = buf[vestac+3] ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; // línea no existe tel[k++] = ' ' ; shora[0] = buf[vdurac+0] ; shora[1] = buf[vdurac+1] ; shora[2] = buf[vdurac+2] ; shora[3] = '\0' ; hori = atoi(shora) ; resto=(hori/60) ; itoa(resto,shori,10) ; if (shori[1]=='\0') { tel[k++]='0' ; tel[k++]=shori[0] ; } else { tel[k++]=shori[0] ; tel[k++]=shori[1] ; } tel[k++]=':' ; resti=(hori%60) ; itoa(resti,shori,10) ; if (shori[1]=='\0') { tel[k++]='0' ; tel[k++]=shori[0] ; } else { tel[k++]=shori[0] ; tel[k++]=shori[1] ; } tel[k++] = ':' ; tel[k++]=buf[vdurac+4] ; tel[k++]=buf[vdurac+5] ; tel[k++] = ' ' ; ka = k ; tel[k++] = buf[vhor] ; tel[k++] = buf[vhor+1] ; if (tel[ka]==' ') tel[ka]='0' ; 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+0] ; 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++] = ' ' ; ka=k ; // if ((buf[vtranf]=='3' || buf[vtranf]=='4' || buf[vtranf]=='5' || buf[vtranf]=='6' || buf[vtranf]=='7') && buf[vtranf]==' ' && (isdigit(buf[vnumero]))) tel[k++] = 'O' ; if ((buf[vtranf]=='3' || buf[vtranf]=='4' || buf[vtranf]=='5' || buf[vtranf]=='6' || buf[vtranf]=='7') && (isdigit(buf[vnumero]))) tel[k++] = 'O' ; else tel[k++] = 'I' ; tel[k++] = ' ' ; if (tel[ka]=='I' && !isdigit(buf[vnumero])) { if (isdigit(buf[vnumero+2])) vnumero = vnumero+2 ; else tel[k++]='E' ; } if (tel[ka]=='O' || (tel[ka]=='I' && isdigit(buf[vnumero]))) { ki=k; // for (it=vnumero; it<(vnumero+17) && buf[it]!=' ' ; it++) tel[k++] = buf[it] ; if (tel[ki]==' ') tel[k++]='*' ; // } tel[k++] = ' ' ; if (buf[vccost+0]==' ' && buf[vccost+1]==' ' && buf[vccost+2]==' ' && buf[vccost+3]==' ') { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; // centro de costo } else { tel[k++] = buf[vccost+0] ; tel[k++] = buf[vccost+1] ; tel[k++] = buf[vccost+2] ; tel[k++] = buf[vccost+3] ; } tel[k++] = ' ' ; if (buf[vproye+0]==' ' && buf[vproye+1]==' ' && buf[vproye+2]==' ' && buf[vproye+3]==' ') { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; // código de proyecto } else { tel[k++] = buf[vproye+0] ; tel[k++] = buf[vproye+1] ; tel[k++] = buf[vproye+2] ; tel[k++] = buf[vproye+3] ; } tel[k++] = ' ' ; tel[k++] = '*' ; // Código de Cuenta tel[k++] = ' ' ; if (tel[ka]=='I' || tel[ka]=='T') for (it=0 ; it<4 ; it++) tel[k++]='0' ; // tarifa else for (it=vpulsos ; it<(vpulsos+10) ; it++) tel[k++]=buf[it] ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; // 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++] = ' ' ; if ((buf[vantran]!=' ' || buf[vantran+1]!=' ' || buf[vantran+2]!=' ' || buf[vantran+3]!=' ') && buf[vtranf]=='4') { tel[k++] = buf[vantran]; tel[k++] = buf[vantran+1]; tel[k++] = buf[vantran+2]; tel[k++] = buf[vantran+3]; } else tel[k++] = '*' ; // anexo transferido tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }