#define americano 0 #define europeo 1 #define lmax 300 #define posin 18 #define ladat 124 +posin #define estac 144 +posin // llamadas entrantes #define linea 109 +posin #define durac 24 +posin #define hor 14 +posin //denham #define fech 7 +posin #define tranf 65 +posin #define numero 40 +posin #define ccost 0 #define proye 35 +posin #define cuenta 67 +posin #define pulsos 30 +posin #define ring 0 #define ruta 0 #define prinum 0 #define antran 0 // anexo transferido (pendiente) #define fofech americano // formato de fecha #define larnum 19 extern void gua_rut(char *buf); char ruanex[(lmax+1)*2][7] ; /* Rutas Consideradas como Anexos */ extern char rgua[]; // Procesos Inicialiales (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), k, j, lar_anumber, lar_snumber, lar_dnumber; k=0; lar_anumber=0; lar_snumber=0; lar_dnumber=0; if(i>(vlinea-2) && isdigit(buf[posin]) && isalnum(buf[vtranf]) && isalnum(buf[vlinea-2])) { for(j=0; isdigit(buf[vestac+j]); j++) {} lar_anumber=j; //largo campo a-number for(j=0; isdigit(buf[vlinea+10+j]); j++) {} lar_snumber=j; //largo campo sent number for(j=0; isdigit(buf[vnumero+j]); j++) {} lar_dnumber=j; //largo campo dialed number if ( isdigit(buf[vdurac-5]) && buf[vtranf]=='a' ) { for(j=0;j<4;j++) { tel[k++]=buf[vdurac-5+j];} } else if (buf[vtranf]=='Q') //anexo { tel[k++]=buf[vhor+5]; tel[k++]=buf[vhor+6]; tel[k++]=buf[vhor+7];tel[k++]=buf[vhor+8]; } else if (lar_anumber>2 && lar_anumber<5) { tel[k++]=buf[vestac]; tel[k++]=buf[vestac+1]; tel[k++]=buf[vestac+2];tel[k++]=buf[vestac+3]; } else if (lar_snumber>2 && lar_snumber<5) { tel[k++]=buf[vlinea+10]; tel[k++]=buf[vlinea+11]; tel[k++]=buf[vlinea+12];tel[k++]=buf[vlinea+13]; } else if (lar_dnumber>2 && lar_dnumber<5) { tel[k++]=buf[vnumero]; tel[k++]=buf[vnumero+1]; tel[k++]=buf[vnumero+2];tel[k++]=buf[vnumero+3]; } else if (buf[vhor+5]>'4') //anexos 6xx 7xx 8xx ?????????????? { tel[k++]=buf[vhor+5]; tel[k++]=buf[vhor+6]; tel[k++]=buf[vhor+7]; } else tel[k++]='*'; tel[k++]=' '; if(buf[vtranf]!='Q' && isdigit(buf[vlinea])) //líneas { tel[k++]=buf[vlinea]; tel[k++]=buf[vlinea+1]; tel[k++]=buf[vlinea+2]; } // else if (buf[vhor+5]<'5') //lineas 4xx ??????????????? else if (buf[vhor+5]<'9') //lineas 7xx ??????????????? { tel[k++]=buf[vhor+5]; tel[k++]=buf[vhor+6]; tel[k++]=buf[vhor+7]; } else tel[k++]='*'; tel[k++]=' '; if isdigit(buf[vdurac]) //duracion { tel[k++]='0'; tel[k++]=buf[vdurac]; tel[k++]=':'; tel[k++]=buf[vdurac+1]; tel[k++]=buf[vdurac+2]; tel[k++]=':'; tel[k++]=buf[vdurac+3]; tel[k++]=buf[vdurac+4]; } else { tel[k++]='0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0'; } tel[k++]=' '; if isdigit(buf[vhor]) // hora { tel[k++]=buf[vhor]; tel[k++]=buf[vhor+1]; tel[k++]=':'; tel[k++]=buf[vhor+2]; tel[k++]=buf[vhor+3]; } else { tel[k++]='0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0'; } tel[k++]=' '; if isdigit(buf[vfech]) { 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]; } else { for(j=0;j<8;j++) tel[k++]=buf[j]; } tel[k++]=' '; if (buf[vtranf]=='Q') tel[k++]='T'; else if isupper(buf[vtranf]) tel[k++]='I'; else tel[k++]='O'; tel[k++]=' '; if (lar_anumber>4) { for(j=0;j <= lar_anumber-1;j++) tel[k++]=buf[vestac+j]; } else if (lar_snumber>4) { for(j=0;j <= lar_snumber-1;j++) tel[k++]=buf[vlinea+10+j]; } else if (buf[vtranf]=='Q' || lar_dnumber>5) { tel[k++]=buf[vnumero]; tel[k++]=buf[vnumero+1]; tel[k++]=buf[vnumero+2]; tel[k++]=buf[vnumero+3]; } else tel[k++]='*'; tel[k++]=' '; tel[k++]='*'; tel[k++]='*'; tel[k++]='*'; tel[k++]=' '; tel[k++]='*'; tel[k++]=' '; tel[k++]='*'; tel[k++]=' '; for(j=0;j<4;j++) tel[k++]=buf[vpulsos+j]; tel[k++]=' '; tel[k++]='*'; tel[k++]='*'; tel[k++]='*'; tel[k++]=' '; tel[k++]='*'; tel[k++]=' '; tel[k++]='0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0'; tel[k++]=' '; tel[k++]='*'; tel[k++]=' '; tel[k++]='*'; tel[k++]='\r' ; tel[k++]='\n' ; tel[k++]='\0' ; } }