#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 132+posin #define estac 9+posin #define linea 21+posin #define durac 40+posin #define hor 31+posin #define fech 25+posin #define tranf 0+posin #define numero 51+posin #define ccost 0 #define proye 52+posin #define cuenta 0 #define pulsos 0 #define ruta 18+posin #define prinum 0 #define ring 2 +posin #define antran 0 // anexo transferido #define fofech americano char reg[300][ladat], *cuf, *duf, aux[3][ladat], lgua[lmax+3]; //aux registro auxiliar que guarda las tres líneas int t,m,j,lb,lr,i,h,cont, encuentra, pos_anexo; //lb posicion de ruta+linea de buf int primera_OK, segunda_OK, tercera_OK; t=0; m=0; lb=0; i=0; h=0; cont=0; encuentra=0; primera_OK=0; segunda_OK=0; tercera_OK=0; extern void gua_rut(char *buf); extern char rgua[]; void in_central() { rgua[0]='\0'; } void gua_buf(char *buf) { strcpy(lgua,buf); } 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) { //lr, posición de ruta+línea en registro for(m=t;m>=0;m--) { for(j=0; j<6 && isdigit(reg[m][pos_anexo+1+j]); j++){} if (j==6) lr=pos_anexo+1; //linea+ruta en origen for(j=0; j<6 && isdigit(reg[m][pos_anexo+9+j]); j++){} if (j==6) lr=pos_anexo+9; //línea+ruta en destino for(j=0; j<6 && reg[m][lr+j]==buf[lb+j]; j++){} //compara lineas+rutas if (j==6) {encuentra=1; h=strlen(reg[m]); return;} //lineas+rutas iguales } } //almacena las llamadas con lineas distintas en un arreglo bidimencional (sobreescribe los registros de líneas iguales) void add_reg(char *buf, int vtranf, int vfech, int vproye) { busca_lin(buf); /*llamadas transferidas con password*/ if(encuentra && buf[vtranf]=='S' && reg[m][vtranf]=='A') {for(j=0; j<6 && (j+vproye)(vdurac+2) && buf[vtranf]!='D' && buf[vtranf]!='T' && buf[vtranf]!='Q' && buf[vfech+2]=='/' && buf[vhor+2]==':') //primera línea válida { for(j=0;j<=i;j++) { aux[0][j]=' '; aux[0][j]=buf[j]; //aux registro auxiliar que guarda las tres líneas } primera_OK=1; return; } else if ((buf[vtranf]=='&' || buf[vtranf+1]=='&') && primera_OK && !segunda_OK) //segunda línea válida { for(j=0;j<=i;j++) { aux[1][j]=' '; aux[1][j]=buf[j]; } segunda_OK=1; return; } else if ((buf[vtranf]=='&' || buf[vtranf+1]=='&') && segunda_OK) //tercera línea válida { for(j=0;j<=i;j++) { aux[2][j]=' '; aux[2][j]=buf[j]; } tercera_OK=1; } if (primera_OK && segunda_OK && tercera_OK) { primera_OK=0; segunda_OK=0; tercera_OK=0; buf=aux[0]; cuf=aux[1]; duf=aux[2]; i=strlen(buf); if(buf[vtranf]==' ' && isdigit(buf[vtranf+1])) { vestac--; vlinea--; vruta--; vfech--; vdurac--; vhor--; vnumero--; //llamadas que no tienen tipo se retrasan en una posición } opera_ori = (buf[vestac] =='A' && buf[vestac+1]=='T'); //operadora en origen opera_des = (buf[vruta-1]=='A' && buf[vruta] =='T'); //operadora en destino anexo_ori = (isdigit(buf[vestac] ) && isdigit(buf[vestac+1])); //anexo en origen anex2_ori = (isdigit(buf[vestac] ) && buf[vestac+1]==' '); //anexo en origen anexo_des = (isdigit(buf[vruta-1]) && isdigit(buf[vruta])); //anexo en destino anex2_des = (isdigit(buf[vruta-1]) && buf[vruta]==' '); //anexo en destino tronc_ori = (isalpha(buf[vestac] ) && isdigit(buf[vestac+1])); //troncal en origen tronc_des = (isalpha(buf[vruta-1]) && isdigit(buf[vruta])); //troncal en destino tandem = (buf[vtranf]!='E' && tronc_ori && tronc_des); //llamadas troncal-troncal pablo: k=0; encuentra=0; //TRANSFERENCIAS if (tronc_ori) lb=vestac+1; //posicion de la línea buscada else lb=vruta; if (buf[vtranf]=='E' || buf[vtranf]=='N') busca_lin(buf); //transferencias: busca por linea el anexo desde donde se transfirió else if (buf[vtranf]=='S' || buf[vtranf]=='A') add_reg (buf, vtranf, vfech, vproye); if(buf[vtranf]=='A') return; trans_in = (buf[vtranf]=='E' && encuentra && isalpha(reg[m][vestac]) && isdigit(reg[m][vestac+1])); //transferencia entrante trans_out = (buf[vtranf]=='E' && encuentra && isalpha(reg[m][vruta-1]) && isdigit(reg[m][vruta])); //transferencia saliente if (tandem>0 && isdigit(cuf[vlinea+3]) && cuf[vlinea+4]=='X') { tel[k++]=cuf[vlinea+3]; } else if (tandem>0 && isdigit(cuf[vlinea+3]) && !isdigit(cuf[vlinea+7])) { for (j=0;j<4;j++) tel[k++]=cuf[vlinea+3+j]; } else if (tandem==1) { tel[k++]='R'; tel[k++]=buf[vruta+0]; tel[k++]=buf[vruta+1]; tel[k++]=buf[vruta+2]; } else if (tandem==2) { tel[k++]='R'; tel[k++]=buf[vestac+1]; tel[k++]=buf[vestac+2]; tel[k++]=buf[vestac+3]; } else if (anexo_ori || anex2_ori) { for (j=0;j<4;j++) tel[k++]=buf[vestac+j]; } else if (opera_ori) { for (j=0;j<4;j++) tel[k++]=buf[vestac+2+j]; } else if (anexo_des || anex2_des) { for (j=0;j<4;j++) tel[k++]=buf[vruta-1+j]; } else if (opera_des) { for (j=0;j<4;j++) tel[k++]=buf[vruta+1+j]; } else tel[k++]='*'; tel[k++]=' '; if (tronc_ori) //línea { for (j=0;j<3;j++) tel[k++]=buf[vestac+4+j]; } else if (tronc_des) { for (j=0;j<3;j++) tel[k++]=buf[vlinea+j]; } else tel[k++]='*'; tel[k++] = ' ' ; if (buf[vdurac+2]==':') { for(j=0;j<8;j++) tel[k++]=buf[vdurac+j] ; } else { tel[k++]='0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0'; } tel[k++] = ' ' ; if isdigit(buf[vhor]) { for(j=0;j<5;j++) tel[k++]=buf[vhor+j] ; } else tel[k++]='*'; tel[k++]=' '; //tel[k++]=buf[vfech+0]; tel[k++]=buf[vfech+1]; tel[k++]=buf[0];tel[k++]=buf[1]; tel[k++]='/'; //tel[k++]=buf[vfech+3]; tel[k++]=buf[vfech+4]; tel[k++]=buf[3];tel[k++]=buf[4]; tel[k++]='/'; tel[k++]=buf[6]; tel[k++] = buf[7]; tel[k++]=' ' ; if (anexo_ori && anexo_des) tel[k++]='T'; else if (buf[vtranf]=='L') tel[k++]='T'; else if (trans_in) tel[k++]='I'; else if (trans_out) tel[k++]='O'; else if (tronc_ori) tel[k++]='I'; else tel[k++]='O'; tel[k++]=' '; if (tronc_ori && isdigit(cuf[vtranf+2]) && cuf[vtranf+16]=='X') //ANI { for(j=0;cuf[vtranf+2+j]!='X';j++) tel[k++]=cuf[vtranf+2+j]; } else if(buf[vtranf]=='E' && encuentra && h>(vdurac+9)) //&& reg[m][vtranf]=='S') //numero transferido { for(j=0;(vdurac+9+j)vdurac+10) { for (j=0;(vdurac+11+j)