#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 132+posin #define estac 29+posin #define linea 72+posin #define durac 4 +posin #define hor 0 +posin #define fech 0 #define tranf 9 +posin #define numero 35+posin #define ccost 0 #define proye 59+posin #define cuenta 0 #define pulsos 0 #define ruta 78+posin #define prinum 0 #define ring 0 #define antran 0 #define fofech europeo // formato de fecha /* #define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 83+posin #define estac 29+posin // llamadas entrantes #define linea 72+posin #define durac 4 +posin #define hor 0 +posin #define fech 0 #define tranf 9 +posin #define numero 35+posin #define ccost 0 #define proye 59+posin #define cuenta 0 #define pulsos 0 #define ruta 78+posin #define prinum 0 #define ring 0 #define antran 0 #define fofech europeo // formato de fecha #define americano 0 #define europeo 1 #define lmax 200 // CALL CENTER RIPLEY // DHL COL #define posin 18 #define ladat 132+posin #define estac 28+posin // llamadas entrantes #define linea 71+posin #define durac 4 +posin #define hor 0 +posin #define fech 0 #define tranf 8 +posin #define numero 34+posin #define ccost 0 #define proye 58+posin #define cuenta 0 #define pulsos 0 #define ruta 77+posin #define prinum 0 #define ring 0 #define antran 0 #define fofech europeo // formato de fecha #define americano 0 #define europeo 1 #define lmax 200 // IRARRAZABAL #define posin 18 #define ladat 83+posin #define estac 31+posin // llamadas entrantes #define linea 77+posin #define durac 5 +posin #define hor 0 +posin #define fech 0 #define tranf 10 +posin #define numero 36+posin #define ccost 0 #define proye 59+posin #define cuenta 0 #define pulsos 0 #define ruta 38+posin #define prinum 0 #define ring 0 #define antran 0 #define fofech europeo // formato de fecha */ extern void gua_rut(char *buf); int aux,t,m,j,lb,lr,i,h,cont, encuentra,pos_anexo; char reg[300][ladat]; char ruanex[(lmax+1)*2][7] ; /* Rutas Consideradas como Anexos */ aux=0; t=0; m=0; lb=0; i=0; h=0; cont=0; encuentra=0; pos_anexo=0; 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() { } //compara la línea del registro actual (buf) con los registros anteriores (almacenados en el arreglo bidimencional) void busca_lin(char *buf) { for(m=t;m>=0;m--) { lr=pos_anexo+5; for(j=0; j<36 && reg[m][lr+j]==buf[lr+j]; j++) {} //compara lineas+rutas if (j==36) {encuentra=1; h=strlen(reg[m]); return;} //lineas+rutas iguales } } void add_reg(char *buf, int vtranf, int vestac, int vnumero, int i) { busca_lin(buf); if (!encuentra) {m=t;t++;} for(j=0;j<=i;j++) reg[m][j]=buf[j]; } // 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), j, k, tan, num_disc, num_llam; int dur_val, segu, minu, hora; char tipo, seg[5]; tan=0; tipo=0; num_disc=0; num_llam=0; //if (i>(posin+90) && isdigit(buf[posin]) && isdigit(buf[Vnumero+7]) ) if (i>(posin+80) && isdigit(buf[posin+2]) ) { if (buf[vtranf]!='G') { k = 0 ; for(j=0;j<15;j++) {if isdigit(buf[vestac-10+j]) num_disc++;} //número discado for(j=0;j<14;j++) {if isdigit(buf[vnumero +j]) num_llam++;} //número llamante if (buf[vtranf]=='0' || (num_disc==3 && num_llam==3)) tipo='T'; //interna else if (buf[vtranf]=='0' || (num_disc==4 && num_llam==4)) tipo='T'; //interna else if (buf[vtranf]=='0' || (num_disc==3 && num_llam==4)) tipo='T'; //interna else if (buf[vtranf]=='0' || (num_disc==4 && num_llam==3)) tipo='T'; //interna else if (buf[vtranf]=='9' && (num_disc>4 && num_llam>4)) tipo='R'; //interna else if (buf[vtranf]=='H') tipo='I'; else if (buf[vtranf]=='A') tipo='O'; // salida else if (buf[vtranf]=='9' && buf[estac-2]==' ' ) tipo='I'; //entrante else if (buf[vtranf]=='T' && buf[estac-2]==' ' ) tipo='I'; //entrante else if (buf[vtranf]=='7') tipo='O'; //saliente else if (buf[vtranf]=='1') tipo='O'; //saliente else if (buf[vtranf]=='C' && buf[estac-2]==' ') tipo='I'; else if (buf[vtranf]=='9' && isdigit(buf[estac-2]) ) tipo='O'; else if (isdigit(buf[vlinea+2]) && isdigit(buf[vlinea+5])) tipo='R'; //tandem else if (buf[vtranf]=='C' ) tipo='O'; else tipo='T'; pos_anexo=vestac; if (buf[vtranf]=='H' || buf[vtranf]=='9' && !isdigit(buf[vtranf+4]) ) { add_reg (buf, vtranf, vestac, vnumero, i); } if (tipo=='O' || tipo=='T') { for(j=0;j<5;j++){ if isalnum(buf[vnumero+4+j]) tel[k++]=buf[vnumero+4+j];}// anexo } else if (tipo=='I') { for(j=0;j<5;j++){ if isdigit(buf[vestac+j]) tel[k++]=buf[vestac+j];} // anexo } else if ( tipo=='R' && isdigit(buf[estac-2]) && buf[vtranf]=='9' && encuentra) { for(j=0;j<5;j++){ if isdigit(reg[m][vestac+j]) tel[k++]=reg[m][vestac+j];} } else tel[k++]='*'; tel[k++] = ' '; if (!isdigit(buf[vestac-1]) && !isdigit(buf[vnumero+1])) tel[k++]='*'; else if (tipo=='T') { tel[k++]='*'; // interno } else if (isdigit(buf[vlinea]) && tan==0) //linea { for (j=0;j<3;j++) { if isdigit(buf[vlinea+j]) tel[k++]=buf[vlinea+j]; } } else if (tipo=='I') { for (j=0;j<3;j++) { if isdigit(buf[vlinea-4+j]) tel[k++]=buf[vlinea-4+j]; } } else { for (j=0;j<3;j++) { if isdigit(buf[vlinea+3+j]) tel[k++]=buf[vlinea+3+j]; } } tel[k++] = ' '; for(j=0;j<5;j++) seg[j]=buf[vdurac+j]; dur_val=(atoi(seg)); segu=(dur_val)%60; //segundos minu=((dur_val)%3600)/60; //minutos hora=(dur_val)/3600; //hora tel[k++]=(hora/10)+'0'; tel[k++]=(hora%10)+'0'; tel[k++]=':'; tel[k++]=(minu/10)+'0'; tel[k++]=(minu%10)+'0'; tel[k++]=':'; tel[k++]=(segu/10)+'0'; tel[k++]=(segu%10)+'0'; tel[k++]=' '; tel[k++]=buf[vhor+0]; tel[k++]=buf[vhor+1]; //hora tel[k++]=':'; tel[k++]=buf[vhor+2]; tel[k++]=buf[vhor+3]; tel[k++]=' '; for(j=0;j<8;j++) tel[k++]=buf[vfech+j]; //fecha desde Aqct tel[k++] = ' ' ; if (tipo=='T') tel[k++]='T'; else if (tipo=='R' && isdigit(buf[vtranf+4]) ) tel[k++]='O'; else if (tipo=='I' || (tipo=='R' && tan==0)) tel[k++]='I'; //tipo else if (tipo=='R' && buf[vtranf]=='9') tel[k++]='I'; else tel[k++]='O'; tel[k++] = ' '; if(!isdigit(buf[vtranf+3]) && isdigit(buf[vtranf+5])) //código de acceso { tel[k++]=buf[vtranf+4]; tel[k++]=buf[vtranf+5]; } if( tipo=='T') //interna //numero { for(j=0;j<15;j++){ if isdigit(buf[vestac-11+j]) tel[k++]=buf[vestac-11+j];} } else if(num_disc==3 && num_llam==3) //interna //numero { for(j=0;j<15;j++){ if isdigit(buf[vestac-11+j]) tel[k++]=buf[vestac-11+j];} } else if(tipo=='O' && isdigit(buf[vestac+2])) //(num_disc>4) Salida { for(j=0;j<15;j++){ if isdigit(buf[vestac-11+j]) tel[k++]=buf[vestac-11+j];} } else if(tipo=='I' && isdigit(buf[vnumero+3])) //(num_llam>4) Entrada { for(j=0;j<14;j++){ if isdigit(buf[vnumero+j]) tel[k++]=buf[vnumero+j];} } else if (buf[vestac+5]=='#' || (num_disc<4 && isdigit(buf[vtranf+5]))) { for(j=0;j<15;j++){ if isdigit(buf[vestac-10+j]) tel[k++]=buf[vestac-10+j];} } else if ( tipo='R' && isdigit(buf[estac-2])) { for(j=0;j<15;j++){ if isdigit(buf[vestac-10+j]) tel[k++]=buf[vestac-10+j];} } else tel[k++]='*'; tel[k++] = ' '; tel[k++] = '*'; tel[k++] = '*'; tel[k++] = '*'; //centro_costo tel[k++] = ' '; if isdigit(buf[vproye]) { for(j=0;j<6;j++) { if (isdigit(buf[vproye+j])) {tel[k++]=buf[vproye+j];} } } else tel[k++]='*'; tel[k++] = ' '; tel[k++]='*'; tel[k++] = ' '; for(j=0;j<5;j++) tel[k++]='0'; //pulsos tel[k++] = ' '; if(tipo=='I' || (tipo=='R' && tan==0)) //ruta { tel[k++]=buf[vruta]; tel[k++]=buf[vruta+1]; tel[k++]=buf[vruta+2]; } else if (buf[vtranf]=='A') { for (j=0;j<3;j++) { if isdigit(buf[vtranf+2+j]) {tel[k++]=buf[vtranf+2+j];} } } else if isdigit(buf[vtranf+5]) // ruta { tel[k++]=buf[vtranf+5]; tel[k++]=buf[vtranf+6]; tel[k++]=buf[vtranf+7]; } else if isdigit(buf[vtranf+3]) { tel[k++]=buf[vtranf+2]; tel[k++]=buf[vtranf+3]; tel[k++]=buf[vtranf+4]; } else if isdigit(buf[vtranf+8]) { tel[k++]=buf[tranf+6]; tel[k++]=buf[vtranf+7]; tel[k++]=buf[vtranf+8]; } else tel[k++]='*'; tel[k++] = ' '; tel[k++] = '*'; //1º numero tel[k++] = ' '; tel[k++] = '0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0'; //ring tel[k++] = ' '; if (buf[vtranf]=='9' || buf[vtranf]=='7') busca_lin(buf); if (encuentra && buf[vtranf]!='H' && reg[m][vtranf]=='H' ) { if (tipo=='I') { for (j=0;j<4;j++) if (isdigit(reg[m][vestac+j])) tel[k++]= reg[m][vestac+j]; } //anexo tranferido else { for (j=0;j<4;j++) if (isdigit(reg[m][vnumero+4+j])) tel[k++]= reg[m][vnumero+4+j]; } //anexo tranferido } else tel[k++] = '*'; //anexo tranferido tel[k++] = ' '; if (tipo=='R') tel[k++]='R'; //servicio else if (buf[vtranf]=='C') tel[k++]='C'; else if (buf[vtranf]=='E') tel[k++]='A'; else if (buf[vtranf]=='F') tel[k++]='O'; else tel[k++]='*'; tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } } }