#include #define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 1 +posin // llamadas entrantes #define linea 70+posin #define durac 50+posin #define hor 44+posin #define fech 38+posin #define tranf 78+posin #define numero 10+posin #define ccost 27+posin //58+posin #define proye 33+posin #define cuenta 0 //63+posin #define pulsos 0 #define ruta 65+posin //70+posin #define prinum 0 #define ring 0 #define antran 1 +posin //33+posin // anexo transferido (pendiente) #define fofech europeo // formato de fecha #define ladat 82+posin #define l_nume 16 char lgua[lmax+3]; char *cuf,*ruf,*tuf,*buf; int k, mc = 0 ; void resta_horas(char *ruf, char *tel, int pos_fin) { int a, b, dur_val, hora, minu, segu; a= (ruf[pos_fin+0]-'0')*36000; //hora final en segundos a=a+(ruf[pos_fin+1]-'0')*3600; a=a+(ruf[pos_fin+3]-'0')*600; a=a+(ruf[pos_fin+4]-'0')*60; a=a+(ruf[pos_fin+6]-'0')*10; a=a+(ruf[pos_fin+7]-'0'); b= (ruf[pos_fin-6+0]-'0')*36000; //hora inicial en segundos b=b+(ruf[pos_fin-6+1]-'0')*3600; b=b+(ruf[pos_fin-6+2]-'0')*600; b=b+(ruf[pos_fin-6+3]-'0')*60; b=b+0; //no hay detalle de segundos b=b+0; dur_val=b-a; //resta if (dur_val>0) { 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'; } } extern char rgua[]; void in_central() { rgua[0]='\0'; } void fi_central() { } void gua_buf(char *buf) { strcpy(lgua,buf); } 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,j, cont, formato_nuevo; char *cuf,vsacmfr[8]; time_t tiempo; k =0; cont=0; formato_nuevo=1; for(j=0;j<8;j++) vsacmfr[j]=' '; i=strlen(buf); if(i>(vtranf) && isdigit(buf[vdurac+1]) && buf[posin+26]=='|') { gua_buf(buf); return; } cuf = lgua; if (i>(vtranf) && isalnum(buf[posin+31]) && isdigit(buf[vdurac+1])) //excluye los encabezados { time(&tiempo); k = 0; for(j=0;j<8;j++) { if isalnum(cuf[vtranf-9+j]) {vsacmfr[j]=cuf[vtranf-9+j];} } // tel[k++]=buf[vdurac+5]; tel[k++]=buf[vdurac+6]; //encabezado de anexo que identifica el nodo de central if (isdigit(cuf[vestac]) || isdigit(cuf[vestac+2])) { for(j=0;j<4;j++) tel[k++]=cuf[vestac+j]; } else tel[k++]='*'; tel[k++] = ' '; // tel[k++]=buf[vruta-3]; tel[k++]=buf[vruta-2]; //encabezado de trocal que identifica el nodo de central for (j=0;j<5;j++) { if isdigit(buf[vlinea+j]) {tel[k++] = buf[vlinea+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' '; tel[k++] = cuf[vdurac] ; tel[k++] = cuf[vdurac+1] ; tel[k++] = ':' ; tel[k++] = cuf[vdurac+3] ; tel[k++] = cuf[vdurac+4] ; tel[k++] = ':' ; tel[k++] = cuf[vdurac+6] ; tel[k++] = cuf[vdurac+7] ; tel[k++] = ' ' ; // tel[k++] = cuf[vhor];tel[k++] = cuf[vhor+1]; tel[k++] = ':'; // tel[k++] = cuf[vhor+2];tel[k++] = cuf[vhor+3]; resta_horas(cuf, tel, vdurac); tel[k++] = ' ' ; tel[k++] = cuf[vfech+2] ; tel[k++] = cuf[vfech+3] ; tel[k++] = '/'; tel[k++] = cuf[vfech+4] ; tel[k++] = cuf[vfech+5] ; tel[k++] = '/'; tel[k++] = cuf[vfech] ; tel[k++] = cuf[vfech+1] ; tel[k++] = ' ' ; if (buf[vtranf]=='E' || buf[vtranf]=='J' || buf[vtranf]=='K' || buf[vtranf]=='N') tel[k++]='I'; else tel[k++]='O'; tel[k++] = ' ' ; for (j=0;j<16;j++) { if isdigit(buf[vnumero+j]) {tel[k++] = buf[vnumero+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; for (j=0;j<10;j++) //centro de costo { if isdigit(cuf[vccost+j]) {tel[k++] = cuf[vccost+j] ; cont++;} } if(cont==0) {tel[k++]='*'; tel[k++]='*'; tel[k++]='*';} cont=0; tel[k++] = ' ' ; for (j=0;j<12;j++) //codigo de proyecto { if isdigit(buf[vproye+j]) {tel[k++] = buf[vproye+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; tel[k++]='*'; tel[k++]=' '; for (i=0;i<4;i++) tel[k++]='0'; // tarifa o pulsos tel[k++] = ' ' ; if(buf[vestac]=='F') // ruta { for (j=0;j<3;j++) { if isdigit(buf[vestac+j+2]) { buf[vestac+2+j];}} // buf[vestac+2]; buf[vestac+3]; buf[vestac+4]; } else if isdigit(buf[vruta+3]) { for (j=0;j<3;j++) { if isdigit(buf[vruta+1+j]) { tel[k++] = buf[vruta+1+j];}} //tel[k++] = buf[vruta+1]; tel[k++] = buf[vruta+2]; tel[k++] = buf[vruta+3]; } else tel[k++]='*'; tel[k++]=' '; if (vsacmfr[3]=='I') tel[k++]='I'; //primer número tarificación al inicio else if (vsacmfr[3]=='D') tel[k++]='D'; //tarificación durante la llamada else if (vsacmfr[3]=='F') tel[k++]='F'; //tarificación al terminar else tel[k++]='*'; //tiempo estandar tel[k++] = ' ' ; tel[k++] = '0' ;tel[k++] = '0';tel[k++] = ':'; tel[k++] = '0' ;tel[k++] = '0' ; /* tiempo ring */ tel[k++] = ' ' ; for (j=0;j<5;j++) // anexo transferido { if isdigit(buf[vantran+j]) {tel[k++] = buf[vantran+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++]=' '; tel[k++]='*'; /*if (formato_nuevo) { /*if (vsacmfr[0]=='I') tel[k++]='I'; //Red virtual else if (vsacmfr[0]=='V') tel[k++]='V'; else tel[k++]='*'; if (vsacmfr[1]=='S') tel[k++]='S'; //ARS (ruta más corta presente) else tel[k++]='*'; if (vsacmfr[2]=='C') tel[k++]='C'; //discado abreviado else if (vsacmfr[2]=='I') tel[k++]='I'; else tel[k++]='*'; if (vsacmfr[4]=='M') tel[k++]='M'; //mini mensaje else tel[k++]='*'; if (vsacmfr[5]=='O') tel[k++]='O'; //activado on busy else if (vsacmfr[5]=='R') tel[k++]='R'; else if (vsacmfr[5]=='I') tel[k++]='I'; else tel[k++]='*'; if (vsacmfr[6]=='R') tel[k++]='R'; //llamada re-enrutada else tel[k++]='*'; if (buf[vproye-2]=='N') tel[k++]='N'; //Motivo de comunicacion else if (buf[vproye-2]=='P') tel[k++]='P'; else if (buf[vproye-2]=='B') tel[k++]='B'; else if (buf[vproye-2]=='G') tel[k++]='G'; else tel[k++]='*'; if (buf[vtranf-2]=='A') tel[k++]='A'; //tipo de comunicación else if (buf[vtranf-2]=='B') tel[k++]='B'; else if (buf[vtranf-2]=='C') tel[k++]='C'; else tel[k++]='*'; if (buf[vtranf]=='A' || buf[vtranf]=='E') tel[k++]='B'; //tipo de línea o Canal else if (buf[vtranf]=='C' || buf[vtranf]=='K') tel[k++]='P'; else if (buf[vtranf]=='H' || buf[vtranf]=='I') tel[k++]='P'; else if (buf[vtranf]=='D') tel[k++]='R'; else if (buf[vtranf]=='J') tel[k++]='L'; else if (buf[vtranf]=='N') tel[k++]='N'; else tel[k++]='*'; }*/ tel[k++]='\r'; tel[k++]='\n'; tel[k++]='\0'; } }