#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 120+posin #define estac 60+posin // llamadas entrantes #define linea 0 #define durac 15+posin #define hor 6+posin #define fech 1+posin #define tranf 24+posin #define numero 93+posin #define ccost 0 #define proye 0 #define cuenta 0 #define pulsos 0 #define ruta 0 #define prinum 0 #define ring 0 #define antran 0 // 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, tipo; aux = 0; cont=0; if (i>vnumero && buf[vfech+1]=='.' && buf[vdurac+2]==':' && isalpha(buf[vtranf]) && buf[vnumero+21]=='-') { k=0; if (buf[vtranf]=='I') tipo='I'; else if (buf[vtranf]=='S') tipo='T'; else tipo='O'; if(tipo=='I') { for (j=0;j<4;j++) tel[k++]=buf[vnumero+j]; } else if(buf[vestac+1]=='-') { for (j=0;j<4;j++) tel[k++]=buf[vestac+17+j]; } else if(tipo=='O' || tipo=='T') { for (j=0;j<4;j++) tel[k++]=buf[vestac+j]; } else tel[k++]='*'; tel[k++]=' '; tel[k++]='*'; tel[k++]=' '; for (j=0;j<8;j++) tel[k++]=buf[vdurac+j]; tel[k++] = ' ' ; for (j=0;j<5;j++) tel[k++]=buf[vhor+j]; tel[k++]=' '; tel[k++]=buf[0]; tel[k++]=buf[vfech]; tel[k++]='/'; tel[k++]=buf[vfech+2]; tel[k++]=buf[vfech+3]; tel[k++]='/'; tel[k++]=buf[6]; tel[k++]=buf[7]; tel[k++]=' '; tel[k++]=tipo; tel[k++] = ' ' ; if(tipo=='I' && buf[vestac+1]!='-') { for (j=0;j<15 && isdigit(buf[vestac+j]);j++) tel[k++]=buf[vestac+j]; } else if(tipo=='O' || tipo=='T') { for (j=0;j<20 && isdigit(buf[vnumero+j]);j++) tel[k++]=buf[vnumero+j]; } else tel[k++]='*'; tel[k++] = ' ' ; tel[k++] = '*';tel[k++] = '*';tel[k++] = '*'; //centro costo tel[k++] = ' ' ; tel[k++] = '*' ; /* proyecto */ 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++] = ' ' ; tel[k++] = '0'; tel[k++] = '0';tel[k++] = ':'; tel[k++] = '0'; tel[k++] = '0'; tel[k++] = ' ' ; tel[k++] = '*' ; // anexo transferido tel[k++] = ' ' ; tel[k++] = '*' ; // servicio tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }