#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 0+posin // llamadas entrantes #define linea 5+posin #define durac 50+posin #define hor 41+posin #define fech 35+posin #define tranf 0 #define numero 10+posin #define ccost 0 #define proye 60+posin #define cuenta 0 #define pulsos 0 #define ruta 0 #define prinum 0 #define ring 29+posin #define antran 0 // anexo transferido (pendiente) #define fofech americano // formato de fecha #define num_tra 600 #define anoa 6 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,ka; if (i>vnumero && buf[vfech+2]=='/' && buf[vhor+2]==':' && buf[vhor+5]==':' && buf[vdurac+2]==':' && buf[vdurac+5]==':' ) { 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++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; tel[k++] = buf[vlinea+2] ; tel[k++] = ' ' ; for (i=0;i<8;i++) tel[k++] = buf[vdurac+i] ; 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[vfech] ; tel[k++] = buf[vfech+1] ; tel[k++] = '/'; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; } else { tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; tel[k++] = '/'; tel[k++] = buf[vfech] ; tel[k++] = buf[vfech+1] ; } tel[k++] = '/' ; tel[k++] = buf[anoa] ; tel[k++] = buf[anoa+1] ; tel[k++] = ' ' ; if (isdigit(buf[vnumero])) tel[k++] = 'O' ; else tel[k++] = 'I' ; tel[k++] = ' ' ; ka=k ; for (it=vnumero ; it<(vnumero+18) && isdigit(buf[it]) ; it++) tel[k++] = buf[it] ; if (k==ka) tel[k++] = '3' ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = ' ' ; if (isdigit(buf[vproye])) { for(i=0;i<4;i++) tel[k++] = buf[vproye+i] ; } else { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; } tel[k++] = ' ' ; tel[k++] = '*' ; //código de cuenta tel[k++] = ' ' ; for (it=0 ; it<4 ; it++) tel[k++]='0' ; /* pulsos */ tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* ruta */ tel[k++] = ' ' ; tel[k++] = '*' ; /* primer numero */ tel[k++] = ' ' ; if (isdigit(buf[vnumero])) { //tiempo ring tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = ':' ; tel[k++] = '0' ; tel[k++] = '0' ; /* tiempo ring */ } else for(i=0;i<5;i++) tel[k++] = buf[vring+i] ; tel[k++] = ' ' ; tel[k++] = '*' ; //anexo transferido tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }