#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 130+posin #define estac 1 +posin // llamadas entrantes #define linea 102+posin #define durac 18+posin #define hor 49+posin #define fech 43+posin #define tranf 0 #define numero 23+posin #define ccost 6+posin #define proye 0 #define cuenta 0 #define pulsos 13+posin #define ruta 108+posin #define prinum 0 #define ring 0 #define antran 97+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 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),it,k,imin,ihora; char smin[4], shora[3]; char aux ; smin[3] = '\0'; aux = 0; if (i>vfech && buf[posin]=='|' && isdigit(buf[vfech]) && buf[vnumero]!=' ') { k = 0 ; for (it=0;it<5;it++) tel[k++] = buf[vestac+it] ; tel[k++] = ' ' ; for (it=0;it<6;it++) { if(isdigit(buf[vlinea+it])) tel[k++] = buf[vlinea+it]; } tel[k++] = buf[vlinea+18]; tel[k++] = ' ' ; smin[0] = buf[vdurac] ; smin[1] = buf[vdurac+1] ; smin[2] = buf[vdurac+2]; imin = atoi(smin)%60; ihora = atoi(smin)/60; itoa(imin,smin,10); itoa(ihora,shora,10); if (ihora<10) { tel[k++]='0' ; tel[k++]=shora[0] ; } else { tel[k++]=shora[0] ; tel[k++]=shora[1] ; } tel[k++] = ':' ; if (imin<10) { tel[k++]='0' ; tel[k++]=smin[0] ; } else { tel[k++]=smin[0] ; tel[k++]=smin[1] ; } tel[k++] = ':' ; if (buf[vdurac+3]!=' ') tel[k++]=buf[vdurac+3] ; else tel[k++]='0' ; if (buf[vdurac+4]!=' ') tel[k++]=buf[vdurac+4] ; else tel[k++]='0' ; 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++] = ' ' ; 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[vccost]=='-' && buf[vccost+1]=='I' && buf[vccost+2]=='D' && buf[vccost+3]=='E') tel[k++] = 'I'; else tel[k++] = 'O' ; tel[k++] = ' ' ; for (it=0; it<20 ; it++) { if isdigit(buf[it+vnumero]) tel[k++] = buf[it+vnumero] ; } 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++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* proyecto */ tel[k++] = ' ' ; tel[k++] = '*' ; // Código de Cuenta tel[k++] = ' ' ; for (it=0 ; it<5 ; it++) tel[k++]=buf[it+vpulsos] ; tel[k++] = ' ' ; tel[k++] = buf[vruta] ; tel[k++] = buf[vruta+1] ; tel[k++] = buf[vruta+2] ; /* 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]!=' ') { 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' ; } }