#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define orden 0 #define estac 1+posin // llamadas entrantes #define linea 11+posin #define durac 51+posin #define hor 45+posin #define fech 14+posin #define tranf 78+posin #define numero 24+posin #define ccost 10+posin #define proye 69+posin #define cuenta 96+posin #define pulsos 38+posin #define ruta 0 #define prinum 0 #define ring 79+posin #define antran 15+posin // anexo transferido (pendiente) #define fofech americano // formato de fecha extern void gua_rut(char *buf); char ruanex[(lmax+1)*2][7] ; /* Rutas Consideradas como Anexos */ int cont; 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,k; char aux; aux = 0; i=strlen(buf); if (i>(79+posin)&& buf[posin]=='|' && buf[vestac+8]=='|' && buf[vnumero+20]=='|' && buf[vhor+2]==':' && buf[vhor+5]=='|' && buf[vdurac+2]==':' && buf[vdurac+5]==':' && buf[vdurac+8]=='|') { k = 0; cont=0; for (i = 0;isdigit(buf[vestac+i]) && i<5;i++) { tel[k++] = buf[vestac+i]; } tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = ' ' ; tel[k++] = buf[vdurac] ; 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 == americano) { tel[k++] = buf[3] ; tel[k++] = buf[4] ; tel[k++] = '/'; tel[k++] = buf[0] ; tel[k++] = buf[1] ; } else { tel[k++] = buf[0] ; tel[k++] = buf[1] ; tel[k++] = '/'; tel[k++] = buf[3] ; tel[k++] = buf[4] ; } tel[k++] = '/'; tel[k++] = buf[6] ; tel[k++] = buf[7] ; tel[k++] = ' ' ; // if ( buf[vtranf]=='E' && buf[vtranf]=='J' && buf[vtranf]=='K' && buf[vtranf]=='N' ) if (!isdigit(buf[vnumero]) ) tel[k++]='I'; else tel[k++] = 'O'; tel[k++] = ' '; for (i=0;i<15 && isdigit(buf[vnumero+i]) ;i++) ///numero { tel[k++] = buf[vnumero+i]; cont++; } if (cont==0) tel[k++]='*'; tel[k++] = ' ' ; if (buf[vccost]!=' ') { for (i=0;buf[vccost+i]!=' '&& buf[vccost+i]!='-' && buf[vccost+i]!='|';i++) tel[k++] = buf[vccost+i]; } else { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ } tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ tel[k++] = ' ' ; cont=0; if (buf[vproye+3]) /// vproye { for (i=0;i<4 ;i++) { if (isdigit(buf[vproye+i])) {tel[k++]=buf[vproye+i]; cont++; }} } if (cont=0) tel[k++]='*'; tel[k++] = ' ' ; for (i=0;i<5; i++) { tel[k++] = '0'; } 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++] = ' ' ; cont=0; if (buf[antran]!=' ') { for ( i=0; i<4 ; i++ ) { tel[k++]= buf[antran+i]; cont++; } } if ( cont=0 ) tel[k++] = '*' ; // anexo transferido tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }