#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 90+posin #define estac 31+posin // llamadas entrantes #define linea 73+posin #define durac 5+posin #define hor posin #define fech 0 #define tranf 10+posin #define numero 20+posin #define ccost 0 #define proye 58+posin #define cuenta 0 #define pulsos 0 #define ruta 12+posin #define prinum 0 #define ring 0 #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 */ char tipo, aux; int cont; cont=0; void fseg(char min, char *seg) { int imin ; char cseg[3] ; imin=((int)min-0x30)*6 ; itoa(imin,cseg,10) ; if (imin>9) { seg[0]=cseg[0] ; seg[1]=cseg[1] ; } else { seg[0]='0' ; seg[1]=cseg[0] ; } seg[2]='\0' ; } void rllam(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 j, k, num_disc, num_llam; char shora[8]; k=0; num_disc=0; num_llam=0; for(j=0;j<200;j++) tel[j]=' '; for(j=0;j<15;j++) {if isdigit(buf[vnumero+ j]) num_disc++;} for(j=0;j<5 ;j++) {if isdigit(buf[vestac +6+j]) num_llam++;} if(tipo=='I')// || (tipo=='T' && !isdigit(buf[vestac-2]) && cont==1)) { for (j=0;j<4;j++) { if (isdigit(buf[vestac+j])) tel[k++] = buf[vestac+j]; } } else if(tipo=='O' || tipo=='X' || (tipo=='T' && num_disc==4)) //saliente o interna { for (j=0;j<4;j++) { if (isdigit(buf[vestac+6+j])) tel[k++] = buf[vestac+6+j]; } } else tel[k++] = '*'; tel[k++] = ' ' ; if(tipo=='I' || (tipo=='T' && cont==1)) { tel[k++]=buf[vlinea]; tel[k++]=buf[vlinea+1]; } else if(tipo=='O' || (tipo=='T' && cont==0)) { tel[k++]=buf[vlinea+4]; tel[k++]=buf[vlinea+5]; } else tel[k++] = '*'; tel[k++] = ' ' ; tel[k++]='0'; //duración tel[k++]=buf[vdurac]; tel[k++]=':'; tel[k++]=buf[vdurac+1]; tel[k++]=buf[vdurac+2]; tel[k++]=':'; fseg(buf[vdurac+3],shora) ; tel[k++] = shora[0] ; tel[k++] = shora[1] ; tel[k++] = ' ' ; tel[k++] = buf[vhor] ; //hora tel[k++] = buf[vhor+1] ; tel[k++]=':'; tel[k++] = buf[vhor+2] ; tel[k++] = buf[vhor+3] ; tel[k++] = ' ' ; tel[k++] = buf[0] ; //fecha 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 (tipo=='X') tel[k++]='T'; //interna else if (tipo=='O' || (tipo=='T' && cont==0)) tel[k++]='O'; else tel[k++]='I'; tel[k++] = ' ' ; if(tipo=='O' || (tipo=='T' && cont==0) || tipo=='X')// || (tipo=='T' && isdigit(buf[vestac-2]) && cont==0)) { for (j=0;j<15;j++) { if (isdigit(buf[vnumero+j])) tel[k++]=buf[vnumero+j]; } } else tel[k++] = '*' ; tel[k++] = ' ' ; tel[k++] = '*'; tel[k++] = '*';tel[k++] = '*'; //centro costo tel[k++] = ' ' ; if(isdigit(buf[vproye+1])) /* proyecto */ { for (j=0;j<7;j++) { if (isdigit(buf[vproye+j])) tel[k++] = buf[vproye+j]; } } else tel[k++] = '*' ; tel[k++] = ' ' ; tel[k++] = '*' ; // Código de Cuenta tel[k++] = ' ' ; for (j=0 ; j<5 ; j++) tel[k++]='0'; tel[k++] = ' ' ; // if(tipo=='I' || (tipo=='T' && cont==1)) //ruta if (num_llam==3) { tel[k++]=buf[ruta+26]; tel[k++]=buf[ruta+27]; tel[k++]=buf[ruta+28]; } else if (tipo=='O' || (tipo=='T' && cont==0)) { if(isdigit(buf[vruta])) { tel[k++]=buf[ruta]; tel[k++]=buf[ruta+1]; tel[k++]=buf[ruta+2]; } else { tel[k++]=buf[ruta+4]; tel[k++]=buf[ruta+5]; tel[k++]=buf[ruta+6]; } } else { tel[k++] = '*';tel[k++] = '*';tel[k++] = '*'; } tel[k++] = ' ' ; tel[k++] = '*'; /* central */ tel[k++] = ' ' ; tel[k++] = '0';tel[k++] = '0';tel[k++] = ':';tel[k++] = '0';tel[k++] = '0'; /* tiempo ring */ tel[k++] = ' ' ; tel[k++] = '*' ; // anexo transferido tel[k++] = ' ' ; if (buf[vtranf]=='C') tel[k++]='C'; else if (tipo=='T') tel[k++]='R'; else tel[k++]='*'; tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } 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); if (i>(vlinea+4) && isdigit(buf[vhor]) && isdigit(buf[vfech]) && isalnum(buf[vtranf])) { if (!isdigit(buf[linea]) && !isdigit(buf[linea+4])) //interna { tipo ='X'; rllam(buf,tel,vestac,vlinea,vdurac,vhor,vfech,vtranf,vnumero,vccost,vproye,vcuenta,vpulsos,vruta,vprinum,vring,vantran,vfofech); } else if( isdigit(buf[vlinea]) && !isdigit(buf[vlinea+4])) // Entrante { tipo ='I'; rllam(buf,tel,vestac,vlinea,vdurac,vhor,vfech,vtranf,vnumero,vccost,vproye,vcuenta,vpulsos,vruta,vprinum,vring,vantran,vfofech); } else if (!isdigit(buf[vlinea]) && isdigit(buf[vlinea+4])) //saliente; { tipo='O'; rllam(buf,tel,vestac,vlinea,vdurac,vhor,vfech,vtranf,vnumero,vccost,vproye,vcuenta,vpulsos,vruta,vprinum,vring,vantran,vfofech); } else if ( isdigit(buf[vlinea]) && isdigit(buf[vlinea+4])) //tandem; { tipo='T';cont=0; rllam(buf,tel,vestac,vlinea,vdurac,vhor,vfech,vtranf,vnumero,vccost,vproye,vcuenta,vpulsos,vruta,vprinum,vring,vantran,vfofech); gua_rut(tel); tipo='T';cont=1; rllam(buf,tel,vestac,vlinea,vdurac,vhor,vfech,vtranf,vnumero,vccost,vproye,vcuenta,vpulsos,vruta,vprinum,vring,vantran,vfofech); } } }