#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define orden 0 #define estac 2+posin // llamadas entrantes #define linea 11+posin #define durac 29+posin #define hor 23+posin #define fech 14+posin #define tranf 7+posin #define numero 50+posin #define ccost 0 #define proye 96+posin #define cuenta 0 #define pulsos 38+posin #define ruta 0 #define prinum 0 #define ring 79+posin #define antran 0 // 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 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),it,k,ka; if (i>vring && buf[vfech+2]=='/' && buf[vfech+5]=='/' && buf[vhor+2]==':' && (buf[vtranf]=='<' || buf[vtranf+2]=='>')) { 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++] = ' ' ; 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 == europeo) { tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; tel[k++] = '/'; tel[k++] = buf[vfech] ; tel[k++] = buf[vfech+1] ; } else { tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; tel[k++] = '/'; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; } tel[k++] = '/'; tel[k++] = buf[vfech+6] ; tel[k++] = buf[vfech+7] ; tel[k++] = ' ' ; if ( buf[vtranf+0]=='<' ) { tel[k++] = 'I' ; tel[k++] = ' ' ; tel[k++] = '3' ; } else if ( buf[vtranf+2]=='>' ) { tel[k++] = 'O' ; tel[k++] = ' ' ; ka = k ; for (it=vnumero ; it<(posin+75) && isdigit(buf[it]) ; it++) { tel[k++] = buf[it] ; } if (k==ka) tel[k++]='3' ; } tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ tel[k++] = ' ' ; if (buf[vproye]==' ' && buf[vproye+1]==' ' && buf[vproye+2]==' ' && buf[vproye+3]==' ') { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; } else { tel[k++] = buf[vproye] ; tel[k++] = buf[vproye+1] ; tel[k++] = buf[vproye+2] ; tel[k++] = buf[vproye+3] ; } tel[k++] = ' ' ; tel[k++] = '*' ; // Código de Cuenta tel[k++] = ' ' ; for (it=vpulsos ; it<(vpulsos+4) ; it++) { if (buf[it]==' ') tel[k++]= '0' ; else tel[k++] = buf[it] ; } tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* ruta */ tel[k++] = ' ' ; tel[k++] = '*' ; /* primer numero */ tel[k++] = ' ' ; if (buf[vtranf] == '<') { tel[k++] = buf[vring] ; tel[k++] = buf[vring+1] ; tel[k++] = ':' ; tel[k++] = buf[vring+3] ; tel[k++] = buf[vring+4] ; /* tiempo ring */ } else { tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = ':' ; tel[k++] = '0' ; tel[k++] = '0' ; /* tiempo ring */ } tel[k++] = ' ' ; tel[k++] = '*' ; // anexo transferido tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }