#include #include #define americano 0 #define europeo 1 /// driver ultima modificacion 28/09/2004 #define lmax 300 #define posin 18 /// cisco call manager concha y toro #define ladat 227+posin #define estac 44 +posin //#define linea 91 +posin //origMediaTransportAddress_IP #define linea 75 +posin #define durac 202 +posin #define hor 23 +posin //dateTimeOrigination #define fech 23 +posin #define tranf 157+posin #define numero 109+posin //finalCalledPartyNumber #define ccost 0 #define proye 0 #define cuenta 0 #define pulsos 0+posin #define ruta 0 #define prinum 43+posin //origNodeId #define ring 171+posin //dateTimeConnect #define antran 129+posin //anexo transferido (pendiente) #define fofech europeo #define largo_anexo 4 char reg[300][ladat],leed[11], lgua[lmax+3]; int j, k,t,m,n,d,lb,lr,i,h,cont,largo1, largo2, encuentra, leed_1,E_Anex, lbconf1,lbconf2,legori,leddes; int Confer,H,ledreg,ledbuf,lbreg,lbbuf; t=0; m=0; lb=0; i=0;j=0; h=0; cont=0; encuentra=0;E_Anex=0;Confer=0;H=0; tercera_OK=0; largo1=0;largo2=0;leed_1=0;ledreg=0;ledbuf=0;lbreg=0;lbbuf=0;ledori=0;leddes=0; extern void gua_rut(char *buf); char vtipo; 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'; } void gua_buf(char *buf) { strcpy(lgua,buf); } // Procesos de Finalizacion (Cerrar Archivos especiales, etc) void fi_central() { } // (almacenados en el arreglo bidimencional) void busca_reg(char *buf,int i,int ledori,int leddes,int lbconf1,int lbconf2 ) { //lr, posicion de ruta+linea en registro m=t;j=0; while (m>-1){ int contconf1,contconf2,contconf3,contconf4, contleg1, contleg2, contleg3 , contleg4 ; contconf1=0 ; contconf2=0; contconf3=0; contconf4=0; contleg1 = 0; contleg2 = 0; contleg3 = 0; contleg4 = 0; for(j=0;j<=10; j++) if ( reg[m][ledori+j] == buf[ledori+j] ) contleg1++; // transferecias for(j=0;j<=10; j++) if ( reg[m][ledori+j] == buf[leddes+j] ) contleg2++; for(j=0;j<=10; j++) if ( reg[m][leddes+j] == buf[ledori+j] ) contleg3++; for(j=0;j<=10; j++) if ( reg[m][leddes+j] == buf[leddes+j] ) contleg4++; //for(j=0;j<=10; j++) if ( reg[m][lbconf1+j] == buf[lbconf1+j] ) contconf1++; // conferencias //for(j=0;j<=10; j++) if ( reg[m][lbconf1+j] == buf[lbconf2+j] ) contconf2++; //for(j=0;j<=10; j++) if ( reg[m][lbconf2+j] == buf[lbconf1+j] ) contconf3++; //for(j=0;j<=10; j++) if ( reg[m][lbconf2+j] == buf[lbconf2+j] ) contconf4++; if ( (contleg1>10 || contleg2>10 || contleg3>10 || contleg4>10 ) ) // tranferencias {encuentra=1; vtipo=reg[m][20]; h=strlen(reg[m]);return;} // else if ( contconf1>9 || contconf2 > 9 || contconf3 >9 || contconf4>9 && ( reg[m][lbconf1]=='b' || reg[m][lbconf2]=='b')) // conf // {encuentra=1; vtipo=reg[m][20]; h=strlen(reg[m]);return;} m--; } } //almacena las llamadas con lineas distintas en un arreglo bidimencional (sobreescribe los registros de líneas iguales) void add_reg(char *buf, int i,int ledori,int leddes,int lbconf1,int lbconf2) { busca_reg(buf,i,ledori,leddes,lbconf1,lbconf2); if (!encuentra) {m=t; if (t>=200) { n=t-2; for(j=0;j<=n;j++) { for(d=0;d<=ladat-1;d++) { reg[j][d]=reg[j+1][d]; } } for(j=0;j<=ladat-1;j++) reg[m-1][j]=buf[j]; } else { t++; for(j=0;j<=i;j++) // agrega { reg[m][j]=buf[j]; reg[m][20]= vtipo; } } } } void borrar_reg (char *buf) { for(j=m;j<=t;j++) for(d=0;d<=ladat-1;d++) reg[j][d]=reg[j+1][d]; t--; } //tranforma segundos dede 01/01/1970 a fecha y hora Aqct setenta_to_time(char *buf, char *tel, int vfech) { char tiempo_ori[10], *tiempo_str; long tiempo_seg; for(j=0;j<10;j++) tiempo_ori[j] = buf[vfech+j]; // tiempo_seg = atoi(tiempo_ori)+10800; //+3horas tiempo_seg = atoi(tiempo_ori); //+3horas tiempo_str = ctime(&tiempo_seg); //Wed Jan 02 02:03:55 1980 tel[k++]=tiempo_str[11]; tel[k++]=tiempo_str[12]; tel[k++]=tiempo_str[13]; tel[k++]=tiempo_str[14]; tel[k++]=tiempo_str[15]; tel[k++]=' '; if (tiempo_str[4]=='J' && tiempo_str[5]=='a') {tel[k++]='0'; tel[k++]='1';} else if (tiempo_str[4]=='F') {tel[k++]='0'; tel[k++]='2';} else if (tiempo_str[4]=='M' && tiempo_str[5]=='a' && tiempo_str[6]=='r') {tel[k++]='0'; tel[k++]='3';} else if (tiempo_str[4]=='A' && tiempo_str[5]=='p') {tel[k++]='0'; tel[k++]='4';} else if (tiempo_str[4]=='M' && tiempo_str[5]=='a' && tiempo_str[6]=='y') {tel[k++]='0'; tel[k++]='5';} else if (tiempo_str[4]=='J' && tiempo_str[5]=='u' && tiempo_str[6]=='n') {tel[k++]='0'; tel[k++]='6';} else if (tiempo_str[4]=='J' && tiempo_str[5]=='u' && tiempo_str[6]=='l') {tel[k++]='0'; tel[k++]='7';} else if (tiempo_str[4]=='A' && tiempo_str[5]=='u') {tel[k++]='0'; tel[k++]='8';} else if (tiempo_str[4]=='S') {tel[k++]='0'; tel[k++]='9';} else if (tiempo_str[4]=='O') {tel[k++]='1'; tel[k++]='0';} else if (tiempo_str[4]=='N') {tel[k++]='1'; tel[k++]='1';} else if (tiempo_str[4]=='D') {tel[k++]='1'; tel[k++]='2';} tel[k++]='/'; tel[k++]=tiempo_str[8]; tel[k++]=tiempo_str[9]; tel[k++]='/'; tel[k++]=tiempo_str[22]; tel[k++]=tiempo_str[23]; } // Driver Propiamente tal. Las posiciones de los campos se // ingresan como parámetros, lo que permite modificar desde // Aplicacion de Tarificacion la posicion 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), cont,cont_anex, num, dn,ant, asterisk,diproy,cont_ast,cont_numero; int dur_val, minu, segu, hora, ringueo, dn_en_dn, dn_en_num, iIp_Destino,caso_espe ; int causa_ori, causa_des,A_tranf,tanden,cont3,confer,pasa,pasa2,pasa3,CCM_Entrante,CCM_Saliente; int origCause_value,Bconf1 ,Bconf2 ,destCause_value, destlegID,origlegID, conforigvalue, confdestvalue; //int result; char aux,servicio, seg[5], origin[10], conect[10], tipo_llamada, cIp_Destino[12], eIp_Destino[12]; long gate1,gate2; aux=0; cont=0; ringueo=0; num=0; dn=0; dn_en_dn=0; dn_en_num=0;ant=0;ledreg=0;ledbuf=0;lbreg=0;lbbuf=0; causa_ori=0; causa_des=0;A_tranf=0;tanden=0;cont3=0;confer=0;pasa=0;pasa2=0;pasa3=0,caso_espe=0; lb=vantran;encuentra= 0 ;cont_anex=0;cont_numero=0;gate1=0;gate2=0;CCM_Entrante=0;CCM_Saliente=0; conforigvalue = 0; confdestvalue=0; origCause_value= 72 + vpulsos; Bconf1= 117+ vpulsos ; Bconf2 = 137+ vpulsos ; destCause_value = 156 + vpulsos ; if (buf[destCause_value]=='1' && buf[destCause_value+1]=='2'&& buf[destCause_value+2]=='6') confdestvalue = 1; if (buf[origCause_value]=='1' && buf[origCause_value+1]=='2'&& buf[origCause_value+2]=='6') conforigvalue = 1; destlegID = 86 + vpulsos ; origlegID = 11 + vpulsos; for (j=0;j<10;j++) {if (isdigit(buf[vfech+j])){pasa++;} } for (j=0;j<11;j++) {if (!isdigit(buf[vfech+j+10])){pasa2++;} } if (!isdigit(buf[vprinum])){pasa3++;} if (!(!isdigit(buf[vring+2])&& !isdigit(buf[vlinea+7])&& !isdigit(buf[vtranf+9])&& buf[vlinea-1]=='1'&& !isdigit(buf[vlinea-2]) && !isdigit(buf[vnumero+19]))) { if (!(buf[vtranf+2]=='1'&& buf[vtranf+1]==' ')) { if (!(buf[vtranf+1]=='4'&& buf[vtranf+2]=='2')) { if (!(buf[vlinea+7]==' '&& buf[vlinea+20]==' ')&& pasa==10 && pasa2==10 && pasa3==0) { for (j=0;j<21;j++) {if isdigit(buf[vantran+j]){cont_numero++;}} tanden=(!isdigit(buf[vnumero+16]) && isdigit(buf[vantran+16])); Salto: if (tanden==2){vestac=vnumero;vnumero=vantran;aux=0; cont=0; ringueo=0; num=0; dn=0; dn_en_dn=0; dn_en_num=0;ant=0; causa_ori=0; causa_des=0;A_tranf=0;cont3=0;} k = 0 ; asterisk=0,diproy=0,cont_ast=0; for (j=0;j<20 ;j++){if(isdigit(buf[vestac+j])) dn++ ;} //cuenta dígitos en el campo anexo for (j=0;j<20;j++){if(isdigit(buf[vnumero+j])) num++;} //cuenta dígitos en el campo número for (j=0;j<20;j++){if(isdigit(buf[vantran+j])) ant++;} if (isdigit(buf[vestac+19]))// cuenta asteriscos { for (j=0;j<20;j++) {if (buf[vestac+j]=='*') { cont_ast++; if (cont_ast==1) {diproy=vestac+j;} } } } if (num<=4 && buf[vantran+15]==' ') { for (j=0;j<4;j++) { if (buf[vnumero+j+17]==buf[vantran+j+17]){A_tranf++;} cont3=1; } } if (buf[Bconf2]=='b' && buf[Bconf1]=='b' && !confdestvalue ) confer=1; if (dn<= largo_anexo && num<=largo_anexo) tipo_llamada='T'; else if (tanden==1 && (cont_numero==8|| cont_numero==9) &&dn==4) tipo_llamada='O'; else if (dn==0 && num==4 && tanden!=2) tipo_llamada='I'; else if (dn<= largo_anexo && num>=largo_anexo) tipo_llamada='O'; else if (dn>= largo_anexo && num<=largo_anexo) tipo_llamada='I'; else if (dn>= largo_anexo && num>=largo_anexo) tipo_llamada='O'; else if (tanden==1 && (cont_numero==8|| cont_numero==9) &&dn==4) tipo_llamada='O'; else if (dn==0 && num==4 && tanden!=2) tipo_llamada='I'; else if (isdigit(buf[148]) && buf[149]==' ' && tanden==2) tipo_llamada='O'; else if ( dn>=8 && tanden==1 && !isdigit(buf[77])) tipo_llamada='I'; else if ( dn==7 && ant==8 && tanden==1) tipo_llamada='O'; else if ( buf[154]==' ' && ant==8 && tanden==2) tipo_llamada='I'; else if (dn>4 && cont_ast) tipo_llamada='O'; else if (dn_en_dn && dn_en_num) tipo_llamada='T'; else if (dn<=4 && confer==1) tipo_llamada='T'; else if (dn>5 && confer==1) tipo_llamada='O'; else if (dn>7) tipo_llamada='I'; else tipo_llamada='O'; caso_espe=0; for (j=0; buf[vestac+j]==' ' && j<20 ;j++) { if (buf[vestac+j+1]=='9' && dn!=8 ) { tipo_llamada='O'; caso_espe=1;} } // servicios servicio = '*'; if (buf[Bconf1]=='b' || buf[Bconf2]=='b') servicio='C'; else if (buf[Bconf1]=='b' || buf[Bconf2]=='b') servicio='C'; else if (confdestvalue && conforigvalue) servicio='T'; else if (tanden==1 || tanden==2) servicio='R'; else if (buf[vtranf+1]=='1' && buf[vtranf+2]=='6' && cont_ast==1) servicio='T'; else if (buf[vtranf+1]=='4' && buf[vtranf+2]=='2' && tipo_llamada=='I') servicio='O'; else if (buf[vtranf+1]=='2' && buf[vtranf+2]=='1' ) servicio='A'; else if (buf[vtranf+1]=='3' && buf[vtranf+2]=='4' && tipo_llamada=='I') servicio='O'; else if (buf[vtranf+1]=='1' && buf[vtranf+2]=='9' && tipo_llamada=='I') servicio='A'; else if (buf[vtranf+1]=='1' && buf[vtranf+2]=='7' ) servicio='O'; else if (buf[vtranf]=='1' && buf[vtranf+1]=='2' && buf[vtranf+2]=='6') servicio='T'; else if (A_tranf!=4 && cont3==1) servicio='T'; else if (buf[vdurac+5]=='0' && buf[vdurac+4]==' ' && tipo_llamada=='I') servicio='A'; else servicio='*'; vtipo = tipo_llamada; // tipò de llamada if (confdestvalue && tipo_llamada!='T') add_reg(buf,i,origlegID,destlegID ,Bconf1, Bconf2) ; // add reg else if (conforigvalue && tipo_llamada!='T') add_reg(buf,i,origlegID,destlegID ,Bconf1, Bconf2) ; // add reg ledreg=destlegID,ledbuf=origlegID;busca_reg(buf,i,origlegID,destlegID ,Bconf1, Bconf2); if ( dn<= largo_anexo && num> largo_anexo ) iIp_Destino = vring-12; else if ( dn> largo_anexo && num<= largo_anexo ) iIp_Destino = vlinea; else if (tipo_llamada == 'I') iIp_Destino = vlinea; else if (tipo_llamada == 'T') iIp_Destino = vring-12; else if (tipo_llamada =='O'&& cont_ast) iIp_Destino = vlinea; else if (tipo_llamada =='O') iIp_Destino = vring-12; else iIp_Destino = vlinea; if ( encuentra && tipo_llamada!='T' ) {if (vtipo!=' ') tipo_llamada = vtipo; } if ( isdigit(buf[Bconf1]) && buf[Bconf2]=='b' && encuentra && confdestvalue && conforigvalue) {tipo_llamada = 'T'; servicio='C' ;} if ( buf[Bconf1]=='b' && buf[Bconf2]=='b' && encuentra && !confdestvalue && !conforigvalue && buf[origCause_value+2]!='0' && servicio=='C') // anexo { if ( dn <= largo_anexo && num >= largo_anexo ) { for (j=0;j<21;j++) {if isdigit(buf[vestac+j]){ tel[k++]=buf[vestac+j];}} } else if ( num <= largo_anexo && dn >= largo_anexo ) { for (j=0;j<21;j++) {if isdigit(buf[vnumero+j]){ tel[k++]=buf[vnumero+j];}} } else if (tipo_llamada == 'I') { for (j=0;j<21;j++) {if isdigit(reg[m][vnumero+j]){ tel[k++]=reg[m][vnumero+j];}} } else { for (j=0;j<21;j++) {if isdigit(reg[m][vestac+j]){ tel[k++]=reg[m][vestac+j];}} } } else if ( buf[Bconf1]=='b' && buf[Bconf2]=='b' && encuentra && !confdestvalue && !conforigvalue ) // anexo { if (reg[m][20]=='I') { for (j=0;j<21;j++) {if isdigit(reg[m][vnumero+j]){ tel[k++]=reg[m][vnumero+j];}} } else { for (j=0;j<21;j++) {if isdigit(reg[m][vestac+j]){ tel[k++]=reg[m][vestac+j];}} } } else if ( !encuentra && dn>largo_anexo && num>largo_anexo ) tel[k++]='*'; else if (buf[Bconf1]=='b' && encuentra && !isdigit(reg[m][vestac+16]) && isdigit(reg[m][vestac+17])) //anexo { confer=1; for (j=0;j<4;j++) {if (isdigit(reg[m][vestac+j+17])){ tel[k++]=reg[m][vestac+j+17];cont_anex++;}}; } else if (dn==0 && num==4 && tanden!=2) { for (j=0;j<21;j++) {if isdigit(buf[vnumero+j]){ tel[k++]=buf[vnumero+j];cont_anex++;}} } else if (tanden) { tel[k++]='*'; } else if (dn==4 || dn==3 || dn==5) { for (j=0;j<21;j++) {if (isdigit(buf[vestac+j])) tel[k++]=buf[vestac+j];cont_anex++;} } else if (dn>6 && num> 6 && encuentra == 1 && buf[Bconf2]!='b' && buf[Bconf1]!='b' ) { if (tipo_llamada == 'I') { for (j=0;j<21;j++) {if isdigit(reg[m][vnumero+j]){ tel[k++]=reg[m][vnumero+j];}} } else { for (j=0;j<21;j++) {if isdigit(reg[m][vestac+j]){ tel[k++]=reg[m][vestac+j];}} } } else if (dn>largo_anexo && buf[vnumero+9]!='b' ) { for (j=0;j<21;j++) {if isdigit(buf[vpulsos+117+j]){ tel[k++]=buf[vpulsos+117+j];cont_anex++;}} } else if (cont_anex<=largo_anexo && cont_anex>=0){tel[k++] = '*';} else tel[k++] = '*';cont_anex=0; tel[k++] = ' ' ; if ( buf[Bconf1]=='b' && buf[Bconf2]=='b' && encuentra && !confdestvalue && !conforigvalue ) // si es conferencia para tomar la linea { for (j=0;j<11;j++) // linea de registro anterior { cIp_Destino[j] = reg[m][iIp_Destino+j]; } cIp_Destino[j] = '\0'; itoa(atoi(cIp_Destino), eIp_Destino,16); for (j=0;j < (int)(strlen(eIp_Destino)); j++) tel[k++] = eIp_Destino[j];//modificar strlen } else { for (j=0;j<11;j++) // linea { cIp_Destino[j] = buf[iIp_Destino+j]; } cIp_Destino[j] = '\0'; itoa(atoi(cIp_Destino), eIp_Destino,16); for (j=0;j < (int)(strlen(eIp_Destino)); j++) tel[k++] = eIp_Destino[j];//modificar strlen } tel[k++] = ' ' ; for(j=0;j<10;j++) seg[j]=buf[vdurac+j]; dur_val=(atoi(seg)); segu=(dur_val)%60; //segundos minu=((dur_val)%3600)/60; //minutos hora=(dur_val)/3600; //hora tel[k++]=(hora/10)+'0'; tel[k++]=(hora%10)+'0'; tel[k++]=':'; tel[k++]=(minu/10)+'0'; tel[k++]=(minu%10)+'0'; tel[k++]=':'; tel[k++]=(segu/10)+'0'; tel[k++]=(segu%10)+'0'; tel[k++] = ' ' ; setenta_to_time(buf, tel, vfech); //tranforma segundos dede 01/01/1970 a fecha y hora Aqct tel[k++] = ' '; tel[k++] = tipo_llamada; tel[k++] = ' '; if (isdigit(buf[vnumero+19]) && cont_ast==0)// cuenta asteriscos { for (j=0;j<21;j++) {if (buf[vnumero+j]=='*') { asterisk++; if (asterisk==1) diproy=vnumero+j; } } } if ( buf[Bconf1]=='b' && buf[Bconf2]=='b' && encuentra && !confdestvalue && !conforigvalue ) // anexo { if (reg[m][20]=='I') { for (j=0;j<21;j++) {if isdigit(reg[m][vestac+j]) { tel[k++]=reg[m][vestac+j];}} } else { for (j=0;j<21;j++) {if isdigit(reg[m][vnumero+j]){ tel[k++]=reg[m][vnumero+j];}} } } else if ( buf[Bconf1]=='b' && buf[Bconf2]=='b' && buf[origCause_value+2]=='0' ) //// NUMERO DISCADO { // if ( dn> largo_anexo && dn> num ) // { for (j=0;j<21;j++) {if isdigit(buf[vestac+j]){ tel[k++]=buf[vestac+j];}} } if (tipo_llamada == 'O') { for (j=0;j<21;j++) {if isdigit(reg[m][vnumero+j]){ tel[k++]=reg[m][vnumero+j];}} } else { for (j=0;j<21;j++) {if isdigit(reg[m][vestac+j]){ tel[k++]=reg[m][vestac+j];}} } } else if ( buf[Bconf1]=='b' && buf[Bconf2]=='b' && encuentra ) { if ( dn> largo_anexo && dn> num ) { for (j=0;j<21;j++) {if isdigit(buf[vestac+j]){ tel[k++]=buf[vestac+j];}} } else if (tipo_llamada == 'O') { for (j=0;j<21;j++) {if isdigit(reg[m][vnumero+j]){ tel[k++]=reg[m][vnumero+j];}} } else { for (j=0;j<21;j++) {if isdigit(reg[m][vestac+j]){ tel[k++]=reg[m][vestac+j];}} } } else if (buf[Bconf1]=='b' && buf[Bconf2]=='b' && !encuentra ) { for (j=0;j<21;j++) {if isdigit(buf[vestac+j]){ tel[k++]=buf[vestac+j];}} } // si es transferido y no encontro llamado else if ( buf[Bconf2]=='b' && !confdestvalue && !conforigvalue ) { if (tipo_llamada == 'O') { for (j=0;j<21;j++) {if isdigit(buf[vnumero+j]){ tel[k++]=buf[vnumero+j];}} } else { for (j=0;j<21;j++) {if isdigit(buf[vestac+j]){ tel[k++]=buf[vestac+j];}} } } else if (buf[Bconf1]=='b' && !confdestvalue && !conforigvalue ) { if(cont_ast!=0 && isdigit(buf[vestac+19])) //si hay disgitos en el campo estac { for (j=0;j<14;j++) {if ( isdigit(buf[diproy+7+j]) || buf[diproy+7+j]=='*' ) tel[k++]=buf[diproy+j+7];} } else{ for (j=0;j<21;j++) {if isdigit(buf[vestac+j]){ tel[k++]=buf[vestac+j];}} } } else if (tanden==1 && (cont_numero==8|| cont_numero==9) &&dn==4) {for (j=0;j<21;j++) { if (buf[vestac+j]!=' ') tel[k++]=buf[vestac+j];}} else if (dn==0 && num==4 && tanden!=2) {tel[k++]= '*'; } else if (asterisk==0 && cont_ast==0 && isdigit(buf[vnumero+19])&& ( dn<5 )) //si hay disgitos en el campo numero { for (j=0;j<21;j++) {if (buf[vnumero+j]!=' ') tel[k++]=buf[vnumero+j];} } else if(cont_ast!=0 && isdigit(buf[vestac+19])) //si hay disgitos en el campo estac { for (j=0;j<14;j++) {if ( isdigit(buf[diproy+7+j]) || buf[diproy+7+j]=='*' ) tel[k++]=buf[diproy+j+7];} } else if (asterisk!=0 && isdigit(buf[vnumero+19])) //si hay disgitos en el campo numero { for (j=0;j<14;j++) {if ( isdigit(buf[diproy+7+j]) || buf[diproy+7+j]=='*' ) tel[k++]=buf[diproy+j+7];} } else if ( dn > num && num <= largo_anexo && dn > largo_anexo ) { for (j=0;j<21;j++) {if isdigit(buf[vestac+j]){ tel[k++]=buf[vestac+j];}} } else if ( dn < num && dn <= largo_anexo && num > largo_anexo ) { for (j=0;j<21;j++) {if isdigit(buf[vnumero+j]){ tel[k++]=buf[vnumero+j];}} } else if (tipo_llamada=='O' && caso_espe==1 && (confdestvalue || conforigvalue )) { for (j=0;j<21;j++) {if isdigit(buf[vestac+j]){ tel[k++]=buf[vestac+j];}} } else if (dn>4 && tipo_llamada=='O' ) //ani { for (j=0;j<21;j++) { if (buf[vnumero+j]!=' ') tel[k++]=buf[vnumero+j];} } else if (dn>4 && tipo_llamada=='I' ) //ani { for (j=0;j<21;j++) { if (buf[vestac+j]!=' ') tel[k++]=buf[vestac+j];} } else if (ant>4)//ani { for (j=0;j<21;j++) { if (buf[vantran+j]!=' ') tel[k++]=buf[vantran+j];} } else if (vtipo='T') { for (j=0;j<21;j++) {if (buf[vnumero+j]!=' ') tel[k++]=buf[vnumero+j];} } else tel[k++]='*'; tel[k++] = ' ' ; tel[k++] = '*';tel[k++] = '*';tel[k++] = '*'; //centro costo tel[k++] = ' ' ; if (asterisk!=0 || cont_ast!=0) {tel[k++]=buf[diproy+1];tel[k++]=buf[diproy+2];tel[k++]=buf[diproy+3];tel[k++]=buf[diproy+4];tel[k++]=buf[diproy+5];tel[k++]=buf[diproy+6];} // proyecto else tel[k++] = '*' ; /* proyecto */ tel[k++] = ' ' ; if (buf[vtranf+1]=='4' && buf[vtranf+2]=='2' && tipo_llamada=='I') {tel[k++]='C';tel[k++]='O';tel[k++]='N';tel[k++]='G';tel[k++]='E';tel[k++]='S';tel[k++]='T';tel[k++]='I';tel[k++]='O';tel[k++]='N';} else if (buf[vtranf+1]=='4' && buf[vtranf+2]=='4' && tipo_llamada=='I') {tel[k++]='C';tel[k++]='O';tel[k++]='N';tel[k++]='G';tel[k++]='E';tel[k++]='S';tel[k++]='T';tel[k++]='I';tel[k++]='O';tel[k++]='N';} // else if (buf[vdurac+5]=='0' && buf[vdurac+4]==' ' && tipo_llamada=='I') // tel[k++]='A'; // else if (buf[vtranf+1]=='2' && buf[vtranf+2]=='1' ) // tel[k++]='A'; else{ tel[k++] = '*' ;} // Codigo 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++] = buf[vprinum]; /* central */ tel[k++] = ' ' ; if (isdigit(buf[vring]) && cont<5 ) { origin[0]='\0'; conect[0]='\0'; for(j=0;j<10;j++) //tiempo_ring { origin[j] = buf[vfech+j]; conect[j] = buf[vring+j]; } ringueo = atoi(conect) - atoi(origin); segu=(ringueo)%60; //segundos minu=((ringueo)%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';} tel[k++] = ' ' ; cont=0; if ( encuentra && !conforigvalue && !confdestvalue) // anexo transferido { if (tipo_llamada == 'O') { if (dn<= largo_anexo) { for (j=0;j<21;j++) if isdigit(reg[m][vestac+j]) tel[k++]=reg[m][vestac+j];cont++; } } else if (tipo_llamada == 'I') { if (num<= largo_anexo) { for (j=0;j<21;j++) if isdigit(reg[m][vnumero+j]) tel[k++]=reg[m][vnumero+j];cont++ ;} } else {tel[k++] = '*'; cont++ ; } } else {tel[k++] = '*' ; cont++ ;} // anexo transferido if (cont==0) tel[k++] = '*' ; tel[k++] = ' ' ; tel[k++] = servicio ; // servicio if (encuentra && !conforigvalue && !confdestvalue ) borrar_reg(buf); tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; if(tanden==1 && buf[Bconf2]!='b' ) { gua_rut(tel);encuentra= 0 ; for (j=0;j