#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 26+posin #define linea 91+posin #define durac 12+posin #define hor 0 +posin /// hanssa bolivia 4 digitos #define fech 6 +posin #define tranf 71+posin #define numero 46+posin #define ccost 0 #define proye 72+posin #define cuenta 0 #define pulsos 0 #define ruta 35+posin #define prinum 0 #define ring 0 #define antran 0 #define fofech europeo // formato de fecha #define num_tra 600 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,cont, k; k = 0 ; tel[0]='\0'; cont= 0; if (i>120 && isdigit(buf[posin]) && isdigit(buf[vestac])) { for (j=0;j<4;j++){ tel[k++]=buf[vestac+j];} tel[k++] = ' '; for (j=0;j<3;j++) { if (isdigit(buf[vlinea+j])) {tel[k++]=buf[vlinea+j]; cont++; } } if (cont==0) tel[k++] = '*'; tel[k++] = ' '; tel[k++] = buf[vdurac+0]; tel[k++] = buf[vdurac+1]; tel[k++]=':'; tel[k++] = buf[vdurac+2]; tel[k++] = buf[vdurac+3]; tel[k++]=':'; tel[k++] = buf[vdurac+4]; tel[k++] = buf[vdurac+5]; tel[k++] = ' '; tel[k++] = buf[vhor+0]; tel[k++] = buf[vhor+1]; tel[k++]=':'; tel[k++] = buf[vhor+2]; tel[k++] = buf[vhor+3]; tel[k++] = ' '; tel[k++] = buf[vfech+2]; tel[k++] = buf[vfech+3]; tel[k++] = '/'; tel[k++] = buf[vfech+0]; tel[k++] = buf[vfech+1]; tel[k++] = '/'; tel[k++] = buf[vfech+4]; tel[k++] = buf[vfech+5]; tel[k++] = ' '; if (!isdigit(buf[vlinea])) tel[k++]='T'; else tel[k++]='O'; tel[k++] = ' ' ; for(j=0;buf[vnumero+j]!=' ';j++) tel[k++]=buf[vnumero+j]; tel[k++] = ' '; tel[k++] = '*'; tel[k++] = '*'; tel[k++] = '*'; // Centro de Costo tel[k++] = ' ' ; if (isdigit(buf[vproye])) // Código de Proyecto { tel[k++]=buf[vproye+0]; tel[k++]=buf[vproye+1]; tel[k++]=buf[vproye+2]; } else tel[k++]='*'; tel[k++] = ' '; tel[k++] = '*' ; // Código de Cuenta tel[k++] = ' '; for(j=0;j<5;j++) tel[k++]='0'; // Tarifa o Pulsos tel[k++] = ' '; if (isdigit(buf[vruta])) { tel[k++]=buf[vruta]; tel[k++]=buf[vruta+1]; // Ruta } else { tel[k++]='*'; tel[k++]='*'; tel[k++]='*'; } tel[k++] = ' '; tel[k++] = '*' ; // Primer Número tel[k++] = ' '; tel[k++] = '0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0'; //ring tel[k++] = ' '; tel[k++] = '*'; // Anexo Transferido tel[k++] = ' '; tel[k++] = '*'; // Servicio tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }