#define americano 0 #define europeo 1 #define lmax 300 #define posin 18 #define ladat #define estac 58 +posin // llamadas entrantes #define linea 27+posin #define durac 17 +posin #define hor 11 +posin #define fech 0 +posin #define tranf 63 +posin #define numero 66 +posin #define ccost 0 #define proye 0 #define cuenta 0 #define pulsos 0 #define ruta 0 #define prinum 0 #define ring 192 +posin #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,cue,cont; int minu, segu, ring_val; char aux, seg[5]; int calling, called, dura_cero; aux = 0; calling=0; called=0; cont=0; dura_cero=0; dura_cero=(!isdigit(buf[vnumero+30]) && buf[vdurac+0]=='0' && buf[vdurac+1]=='0' && buf[vdurac+3]=='0' && buf[vdurac+4]=='0' && buf[vdurac+6]=='0' && buf[vdurac+7]=='0'); if (i>150 && !dura_cero && isdigit(buf[posin]) && buf[vfech+4]=='/' && buf[vdurac+2]==':' && buf[vtranf+1]==',') { k = 0 ; for (j=0;j<31;j++) { if isdigit(buf[vring+5+j]) calling++; //parte llamante } for (j=0;j<30;j++) { if isdigit(buf[vnumero+5+j]) called++; //parte llamada } if (buf[vtranf]=='O' && isdigit(buf[vestac+1])) //anexo { tel[k++]=buf[estac]; tel[k++]=buf[vestac+1]; tel[k++]=buf[vestac+2]; tel[k++]=buf[vestac+3]; } else if (buf[vtranf]=='I' && isdigit(buf[vtranf+32]) ) { tel[k++]= buf[vtranf+30];tel[k++]=buf[vtranf+31]; tel[k++]=buf[vtranf+32]; tel[k++]=buf[vtranf+33]; } else tel[k++]='*'; tel[k++] = ' ' ; tel[k++]=buf[vlinea]; tel[k++]=buf[vlinea+1]; //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[vfech+5] ; tel[k++] = buf[vfech+6] ; tel[k++] = '/'; tel[k++] = buf[vfech+8] ; tel[k++] = buf[vfech+9] ; tel[k++] = '/'; tel[k++] = buf[vfech+2] ; tel[k++] = buf[vfech+3] ; tel[k++] = ' ' ; if (buf[vtranf]=='O')// identfica tipo de llamada tel[k++]='O'; else tel[k++]='I'; tel[k++] = ' ' ; cue=0; if (buf[vtranf]=='I') { for (j=0; j<16 ; j++) { if isdigit(buf[vtranf-17+j]) {tel[k++]=buf[vtranf-17+j];cue++;} } } else if ( buf[vtranf]=='O' ) { for (j=0; j<32 ; j++) { if isdigit(buf[vtranf+2+j]) {tel[k++]=buf[vtranf+2+j];cue++;} } } else tel[k++]='*'; if (cue==0) tel[k++]='*'; else cue=1; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ tel[k++] = ' ' ; tel[k++] = '*' ; /* proyecto */ tel[k++] = ' ' ; if isdigit(buf[vring+3]) {tel[k++]=buf[vring];tel[k++]=buf[vring+1];tel[k++]=buf[vring+2];tel[k++]=buf[vring+3];}// còd cuenta else 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++] = '*' ; /* ruta */ tel[k++] = ' ' ; tel[k++] = '*' ; /* primer numero */ tel[k++] = ' ' ; if isdigit(buf[vring]) { seg[0]=buf[vring+0]; seg[1]=buf[vring+1]; seg[2]=buf[vring+2]; ring_val=(atoi(seg)); segu=(ring_val)%60; //segundos minu=((ring_val)%3600)/60; //minutos tel[k++]=(minu/10)+'0'; tel[k++]=(minu%10)+'0'; tel[k++]=':'; tel[k++]=(segu/10)+'0'; tel[k++]=(segu%10)+'0'; } else { tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = ':' ; tel[k++] = '0' ; tel[k++] = '0' ; /* tiempo ring */ } tel[k++] = ' ' ; tel[k++] = '*' ; //anexo transferido tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }