#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 28+posin // llamadas entrantes #define linea 47+posin #define durac 12 +posin #define hor 7 +posin #define fech 0 +posin #define tranf 54 +posin #define numero 33+posin #define ccost 0 #define proye 51+posin #define cuenta 0 #define pulsos 0 #define ruta 61+posin #define prinum 0 #define ring 0 #define antran 0 #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) { int i=strlen(buf), j, k, tan, num_disc, num_llam; char tipo; tan=0; pablo: tipo=0; num_disc=0; num_llam=0; if (i>(posin+41) && isdigit(buf[estac+2]) ) { k = 0 ; for(j=0;j<15;j++) {if isdigit(buf[vestac-10+j]) num_disc++;} //número discado for(j=0;j<14;j++) {if isdigit(buf[vnumero +j]) num_llam++;} //número llamante //if (isdigit(buf[vnumero+10]) ) tipo='I'; //entrada //else tipo='O'; //if (buf[vtranf]=='9' ) if (tipo=='O' || tipo=='T') { for(j=0;j<5;j++){ if isdigit(buf[vnumero+4+j]) tel[k++]=buf[vnumero+4+j];}// anexo } else if (tipo=='I') { for(j=0;j<5;j++){ if isdigit(buf[vestac+j]) tel[k++]=buf[vestac+j];} // anexo } else if ( tipo=='R' && isdigit(buf[estac-2]) && buf[vtranf]=='9') { for(j=0;j<5;j++){ if isdigit(buf[vnumero+4+j]) tel[k++]=buf[vnumero+4+j];}// anexo } else tel[k++]='*'; tel[k++] = ' '; if (isdigit(buf[vlinea]) && tan==0) //linea { for (j=0;j<3;j++) { if isdigit(buf[vlinea+j]) tel[k++]=buf[vlinea+j]; } } else { for (j=0;j<3;j++) { if isdigit(buf[vlinea-6+j]) tel[k++]=buf[vlinea-6+j]; } } tel[k++] = ' '; tel[k++]='0'; // duracion tel[k++]=buf[vdurac];// hora tel[k++]=':'; tel[k++]=buf[vdurac+1];// minutos tel[k++]=buf[vdurac+2]; tel[k++]=':'; tel[k++]=buf[vdurac+3];// segundos tel[k++]=buf[vdurac+4]; tel[k++]=' '; tel[k++]=buf[vhor+0]; tel[k++]=buf[vhor+1]; //hora tel[k++]=':'; tel[k++]=buf[vhor+2]; tel[k++]=buf[vhor+3]; tel[k++]=' '; tel[k++]=buf[vfech];tel[k++]=buf[vfech+1]; // mes tel[k++]='/'; tel[k++]=buf[vfech+2];tel[k++]=buf[vfech+3]; // dia tel[k++]='/'; tel[k++]=buf[vfech+4];tel[k++]=buf[vfech+5]; // dia tel[k++]=' '; if (tipo=='I' ) tel[k++]='I'; //tipo else tel[k++]='O'; tel[k++] = ' '; if(!isdigit(buf[vtranf+3]) && isdigit(buf[vtranf+5])) //código de acceso { tel[k++]=buf[vtranf+4]; tel[k++]=buf[vtranf+5]; } if (tipo=='O' && isdigit(buf[vestac+2])) //(num_disc>4) Salida { for(j=0;j<15;j++){ if isdigit(buf[vestac-11+j]) tel[k++]=buf[vestac-11+j];} } else if(tipo=='I' && isdigit(buf[vnumero+6])) //(num_llam>4) Entrada { for(j=0;j<14;j++){ if isdigit(buf[vnumero+j]) tel[k++]=buf[vnumero+j];} } else if (buf[vestac+5]=='#' || (num_disc<4 && isdigit(buf[vtranf+5]))) { for(j=0;j<15;j++){ if isdigit(buf[vestac-10+j]) tel[k++]=buf[vestac-10+j];} } else if ( tipo='R' && isdigit(buf[estac-2])) { for(j=0;j<15;j++){ if isdigit(buf[vestac-10+j]) tel[k++]=buf[vestac-10+j];} } else tel[k++]='*'; tel[k++] = ' '; tel[k++] = '*'; tel[k++] = '*'; tel[k++] = '*'; //centro_costo tel[k++] = ' '; if isdigit(buf[vproye+2]) { for(j=0;j<6 && isdigit(buf[vproye+j]);j++) tel[k++]=buf[vproye+j]; } else tel[k++]='*'; tel[k++] = ' '; tel[k++]='*'; tel[k++] = ' '; for(j=0;j<5;j++) tel[k++]='0'; //pulsos tel[k++] = ' '; if(tipo=='I' || (tipo=='R' && tan==0)) //ruta { tel[k++]=buf[vruta]; tel[k++]=buf[vruta+1]; tel[k++]=buf[vruta+2]; } else if (buf[vtranf]=='A') { for (j=0;j<3;j++) { if isdigit(buf[vtranf+2+j]) {tel[k++]=buf[vtranf+2+j];} } } else if isdigit(buf[vtranf+3]) { tel[k++]=buf[tranf+2]; tel[k++]=buf[vtranf+3]; tel[k++]=buf[vtranf+4]; } else if isdigit(buf[vtranf+8]) { tel[k++]=buf[tranf+6]; tel[k++]=buf[vtranf+7]; tel[k++]=buf[vtranf+8]; } else tel[k++]='*'; tel[k++] = ' '; tel[k++] = '*'; //1º numero tel[k++] = ' '; tel[k++] = '0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0'; //ring tel[k++] = ' '; tel[k++] = '*'; //anexo tranferido tel[k++] = ' '; if (tipo=='R') tel[k++]='R'; //servicio else if (buf[vtranf]=='C') tel[k++]='C'; else if (buf[vtranf]=='E') tel[k++]='A'; else if (buf[vtranf]=='F') tel[k++]='O'; else tel[k++]='*'; tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; if(tipo=='R' && tan==0) { gua_rut(tel); for (j=0;j