#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 90 +posin #define estac 53 +posin // llamadas entrantes #define linea 104+posin #define durac 12 +posin #define hor 7 +posin #define fech 3 +posin #define tranf 23 +posin #define numero 58 +posin #define ccost 0 #define proye 85 +posin #define cuenta 99 +posin #define pulsos 0 #define ruta 102+posin #define prinum 0 #define ring 0 #define antran 107+posin // anexo cunado la llamada no es contestada por el anexo original #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 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),j,k,cont, cont1, cont2, hora, minu, segu, dur_val; char aux, seg[5]; aux = 0; cont=0, cont1=0, cont2=0; if (i>vcuenta && buf[vfech-1]==' ' && buf[vdurac]!='9' && buf[vnumero-1]==' ' && buf[vcuenta]=='0' && buf[vcuenta+1]=='0') { k = 0 ; for (j=0;j<6;j++) //los tres siguientes if cuentan digitos para detectar donde esta el anexo, linea, ruta { if (isdigit(buf[vruta+j])) cont++; //cuenta dígitos en campo línea+ruta } for(j=0;j<30;j++) { if (isdigit(buf[vtranf+4+j])) cont1++; //cuenta dígitos en campo destino (+ código) } for(j=0;j<16;j++) { if (isdigit(buf[vnumero+j])) cont2++; //cuenta dígitos en campo origen } if (buf[vtranf]=='X' && cont1==4 && cont2==4) return; if(cont2<7) { for(j=0;j<7;j++) { if isdigit(buf[vnumero+j]) tel[k++]=buf[vnumero+j]; } } else if(cont1<7) { for(j=0;j<30;j++) { if isdigit(buf[vtranf+4+j]) tel[k++]=buf[vtranf+4+j]; } } else tel[k++]='*'; tel[k++]=' '; if (isdigit(buf[vlinea]) && cont==6) //línea { for(j=0;j<4;j++) tel[k++]=buf[vlinea+j]; } else tel[k++]='*'; tel[k++]=' '; for(j=0;j<5;j++) { if isdigit(buf[vdurac+j]) seg[j]=buf[vdurac+j]; } // if (buf[vtranf+6]=='0' && buf[vtranf+7]=='9') dur_val=(atoi(seg))*23.771; // else dur_val=atoi(seg)*23.771; // dur_val=atoi(seg)*3.9663; dur_val=(atoi(seg)); segu=(dur_val)%60; //segundos minu=((dur_val)%3600)/60; //minutos if (minu>30) return; 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]; tel[k++]=':'; //hora tel[k++] = buf[vhor+2]; tel[k++]=buf[vhor+3]; tel[k++] = ' '; tel[k++] = buf[vfech+0]; tel[k++]=buf[vfech+1]; tel[k++]='/'; //fecha tel[k++] = buf[vfech+2]; tel[k++]=buf[vfech+3]; tel[k++]='/'; tel[k++] = buf[6]; tel[k++]=buf[7]; tel[k++] = ' ' ; if (cont1<7 && cont2<7) tel[k++]='T'; //tipo else if (cont2<7) tel[k++]='O'; else tel[k++]='I'; tel[k++]=' '; if(cont2>6) { for(j=0;j<16;j++) { if(isdigit(buf[vnumero+j])) tel[k++]=buf[vnumero+j]; //número entrante } } else { for(j=0;j<5;j++) //código { if isdigit(buf[vtranf+4+j]) tel[k++]=buf[vtranf+4+j]; } for(j=0;j<20;j++) //número saliente { if(isdigit(buf[vtranf+14+j])) tel[k++]=buf[vtranf+14+j]; } } tel[k++]=' '; tel[k++]='*'; tel[k++]='*'; tel[k++]='*'; //centro costo tel[k++]=' '; if isdigit(buf[vproye]) /* proyecto */ { for(j=0;buf[vproye+j]!=' ';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'; //pulsos tel[k++]=' '; if(isdigit(buf[vruta]) && cont==6) { tel[k++]=buf[vruta]; tel[k++]=buf[vruta+1]; } else tel[k++]='*'; 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(cont>3 && cont<6) { for(j=0;j<6;j++) { if isdigit(buf[vlinea-1+j]) tel[k++]=buf[vlinea-1+j]; } } else tel[k++] = '*' ; // anexo transferido tel[k++] = ' ' ; if ((buf[vtranf]=='C' && (buf[vtranf+1]=='I' || buf[vtranf+1]=='Z')) || (buf[vtranf]=='N' && buf[vtranf+1]=='C')) //servicio tel[k++]='A'; else if (buf[vtranf]=='T') tel[k++]='T'; else if (buf[vtranf]=='L') tel[k++]='C'; else tel[k++]='*'; tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }