#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 90+posin #define estac 8 +posin // llamadas entrantes #define linea 18 + posin #define durac 36+posin #define hor 30+posin #define fech 21+posin #define tranf 15+posin #define numero 58+posin #define ccost 95+posin #define proye 106+posin #define cuenta 0 #define pulsos 27+posin #define ruta 68+posin #define prinum 0 +posin #define ring 89+posin #define antran 73+posin // 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 */ 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; char aux; aux = 0; cont=0; if (i>(vccost-3) /*&& isalnum(buf[vestac-1]) && buf[vfech+2]=='/' && buf[vhor+2]==':'*/) { k = 0 ; for (j=0;j<4;j++) { if (isdigit(buf[vestac+j])) {tel[k++] = buf[vestac+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; for (j=0;j<3;j++) { if (isdigit(buf[vlinea+j])) {tel[k++] = buf[vlinea+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; for (j=0;j<8;j++) { if (isdigit(buf[vdurac+j]) || buf[vdurac+j]==':') { tel[k++]=buf[vdurac+j]; cont++; } } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; for (j=0;j<5;j++) { if (isdigit(buf[vhor+j])|| buf[vdurac+j]==':') { tel[k++] = buf[vhor+j] ; cont++; } } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; if (vfofech==europeo) { tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; tel[k++] = '/'; tel[k++] = buf[vfech] ; tel[k++] = buf[vfech+1] ; } else { tel[k++] = buf[vfech] ; tel[k++] = buf[vfech+1] ; tel[k++] = '/'; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; } tel[k++] = '/'; tel[k++] = buf[vfech+6] ; tel[k++] = buf[vfech+7] ; tel[k++] = ' ' ; // tel[k++]='O'; if(buf[vtranf]=='>') tel[k++]='O'; else tel[k++]='I'; tel[k++] = ' ' ; for (j=0;j<26;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<4;j++) { if (isdigit(buf[vccost+j]) || buf[vccost+j]=='.') { tel[k++]=buf[vccost+j]; cont++; } } if(cont==0) { tel[k++] = '*';tel[k++] = '*';tel[k++] = '*'; } cont=0; tel[k++] = ' ' ; if isdigit(buf[vproye]) /* proyecto */ { tel[k++]=buf[vproye]; tel[k++]=buf[vproye+1]; tel[k++]=buf[vproye+2]; tel[k++]=buf[vproye+3]; } else tel[k++] = '*'; tel[k++] = ' ' ; tel[k++] = '*' ; // Código de Cuenta tel[k++] = ' ' ; for (j=0 ; j<5 ; j++) tel[k++]='0'; tel[k++] = ' ' ; tel[k++] = '*';tel[k++] = '*';tel[k++] = '*'; tel[k++] = ' ' ; tel[k++] = '*'; /* central */ tel[k++] = ' ' ; for (j=0;j<5;j++) { if (isdigit(buf[vring+j]) || buf[vring+j]==':') /* tiempo ring */ { tel[k++]=buf[vring+j]; cont++; } } if(cont==0) { tel[k++] = '0';tel[k++] = '0';tel[k++] = ':';tel[k++] = '0';tel[k++] = '0'; cont=0; } tel[k++] = ' ' ; if (buf[vnumero-5]=='X') tel[k++] = 'T'; // anexo transferido else tel[k++] = '*'; tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }