#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 1 +posin // llamadas entrantes #define linea 75+posin #define durac 47+posin #define hor 41+posin #define fech 0 #define tranf 55+posin #define numero 11+posin #define ccost 6+posin #define proye 0 #define cuenta 0 #define pulsos 0 #define ruta 0 #define prinum 0 #define ring 0 #define antran 58+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 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) { char shora[4],shori[3] ; int i=strlen(buf),it,k,ka,ki,hori,resto,resti,j,cont; char aux; aux = 0;cont=0; if (i>vlinea && buf[posin]=='|' && buf[vfech+2]=='/' && buf[vhor+2]=='-') { k = 0 ; for(j=0;j<4;j++) tel[k++]=buf[vestac+j]; tel[k++] = ' ' ; ka=k ; for(j=0;j<4;j++) { if isdigit(buf[vlinea+j]) {tel[k++]=buf[vlinea+j]; cont++;} } if (cont==0) tel[k++]='*'; cont=0; tel[k++] = ' ' ; shora[0] = buf[vdurac+0] ; shora[1] = buf[vdurac+1] ; shora[2] = buf[vdurac+2] ; shora[3] = '\0' ; hori = atoi(shora) ; resto=(hori/60) ; itoa(resto,shori,10) ; if (shori[1]=='\0') { tel[k++]='0' ; tel[k++]=shori[0] ; } else { tel[k++]=shori[0] ; tel[k++]=shori[1] ; } tel[k++]=':' ; resti=(hori%60) ; itoa(resti,shori,10) ; if (shori[1]=='\0') { tel[k++]='0' ; tel[k++]=shori[0] ; } else { tel[k++]=shori[0] ; tel[k++]=shori[1] ; } tel[k++] = ':' ; tel[k++]=buf[vdurac+4] ; tel[k++]=buf[vdurac+5] ; tel[k++] = ' ' ; ka = k ; tel[k++] = buf[vhor] ; tel[k++] = buf[vhor+1] ; if (tel[ka]==' ') tel[ka]='0' ; tel[k++] = ':' ; tel[k++] = buf[vhor+3] ; tel[k++] = buf[vhor+4] ; tel[k++] = ' ' ; for (j=0; j<8; j++) tel[k++]=buf[j]; //fecha desde el PC /* if (vfofech == europeo) { tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; tel[k++] = '/'; tel[k++] = buf[vfech+0] ; 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+1]=='3'||buf[vtranf+1]=='4'||buf[vtranf+1]=='5'||buf[vtranf+1]=='6'||buf[vtranf+1]=='7') && buf[vtranf]==' ' && (isdigit(buf[vnumero]) || buf[vtranf+1]=='3' ) && buf[vtranf+2]!='*') // if isdigit(buf[vnumero]) tel[k++] = 'O' ; // else tel[k++] = 'I' ; if ((buf[vtranf]=='1' && buf[vtranf+1]=='5') || buf[vnumero+2]=='E') tel[k++]='I'; else tel[k++] = 'O'; tel[k++] = ' ' ; if isdigit(buf[vnumero]) { for(j=0;buf[vnumero+j]!=' ';j++) tel[k++]=buf[vnumero+j]; } else tel[k++]='*'; tel[k++] = ' ' ; if isdigit(buf[ccost]) { for(j=0;j<4;j++) tel[k++]=buf[vccost+j]; } else { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ } tel[k++] = ' ' ; tel[k++] = '*' ; /* proyecto */ tel[k++] = ' ' ; tel[k++] = '*' ; // Código de Cuenta tel[k++] = ' ' ; for (it=0 ; it<4 ; it++) tel[k++]='0' ; /* tarifa */ 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++] = ' ' ; if isdigit(buf[vantran+1]) { for(j=0;j<4;j++) tel[k++]=buf[vantran+j]; } else tel[k++] = '*' ; // anexo transferido tel[k++]=' '; if isdigit(buf[vantran+1]) tel[k++]='T'; else tel[k++]='*'; tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }