#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 1 +posin // llamadas entrantes #define linea 9+posin #define durac 32+posin #define hor 46+posin #define fech 40+posin #define tranf 13+posin #define numero 13+posin #define ccost 0 #define proye 0 #define cuenta 0 #define pulsos 0 #define ruta 0 #define prinum 0 #define ring 60+posin #define antran 0 // anexo transferido (pendiente) #define fofech europeo // formato de fecha #define larnum 15 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),it,k,ka,siga; siga = i>(vnumero+2) && i>(vestac+3) && i>(vlinea+2) && i>(vdurac+5) && i>(vhor+4) && i>(vfech+4) && i>(vnumero+larnum); if (/*siga && buf[vfech+2]=='.' && buf[vfech+5]=='.' && buf[vhor+2]==':' && buf[vdurac+1]==':' &&*/ buf[vdurac+4]==':') { k = 0 ; tel[k++] = buf[vestac] ; tel[k++] = buf[vestac+1] ; tel[k++] = buf[vestac+2] ; /*tel[k++] = buf[vestac+3] ;*/ if (tel[0]==' ' && tel[1]==' ' && tel[2]==' ' && tel[3]==' ') tel[0]='*' ; tel[k++] = ' ' ; tel[k++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; /*tel[k++] = buf[vlinea+2] ;*/ tel[k++] = ' ' ; tel[k++] = '0'; for (it=0;it<7;it++) tel[k++] = buf[vdurac+it]; tel[k++]= ' ' ; ka = k ; tel[k++] = buf[vhor] ; tel[k++] = buf[vhor+1] ; if (tel[ka]==' ') tel[ka]='0' ; tel[k++] = ':' ; tel[k++] = buf[vhor+3] ; tel[k++] = buf[vhor+4] ; tel[k++] = ' ' ; ka=k ; if (vfofech==europeo) { tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; if (tel[ka]==' ') tel[ka] = '0' ; tel[k++] = '/' ; ka=k ; tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; } else { tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; if (tel[ka]==' ') tel[ka] = '0' ; tel[k++] = '/' ; ka=k ; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; } if (tel[ka]==' ') tel[ka] = '0' ; tel[k++] = '/' ; tel[k++] = buf[6] ; tel[k++] = buf[7] ; tel[k++] = ' ' ; if (isalpha(buf[vtranf])) tel[k++] = 'I' ; else tel[k++] = 'O' ; tel[k++] = ' ' ; ka = k; for (it=vnumero ; it<(vnumero+larnum) && buf[it]==' ' ; it++); for (; it<(vnumero+larnum) && buf[it]!=' ' ; it++) tel[k++] = buf[it] ; if (ka==k) tel[k++] = '*'; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; // proyecto tel[k++] = ' ' ; tel[k++] = '*' ; /* código de cuenta */ tel[k++] = ' ' ; for (it=0 ; it<4 ; it++) tel[k++]= '0' ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* ruta */ tel[k++] = ' ' ; tel[k++] = '*' ; /* primer numero */ tel[k++] = ' ' ; if (isalpha(buf[vtranf]) && i>(vring+5)) { if (buf[vring]!=' ') for (it=0;it<5;it++) tel[k++] = buf[vring+it]; else { tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = ':' ; tel[k++] = '0' ; tel[k++] = '0' ; } } else { tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = ':' ; tel[k++] = '0' ; tel[k++] = '0' ; /* tiempo ring */ } tel[k++] = ' ' ; tel[k++] = '*' ; /* anexo tranferido */ tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }