소스 검색

phonenum: fixed lenght in pv name comparisons

Daniel-Constantin Mierla 7 년 전
부모
커밋
2196c67778
1개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. 10 7
      src/modules/phonenum/phonenum_pv.c

+ 10 - 7
src/modules/phonenum/phonenum_pv.c

@@ -165,19 +165,19 @@ int pv_parse_phonenum_name(pv_spec_p sp, str *in)
 
 
 	switch(pvs.len) {
 	switch(pvs.len) {
 		case 5:
 		case 5:
-			if(strncmp(pvs.s, "ltype", 6) == 0)
+			if(strncmp(pvs.s, "ltype", 5) == 0)
 				gpv->type = 2;
 				gpv->type = 2;
-			else if(strncmp(pvs.s, "ndesc", 6) == 0)
+			else if(strncmp(pvs.s, "ndesc", 5) == 0)
 				gpv->type = 3;
 				gpv->type = 3;
-			else if(strncmp(pvs.s, "error", 6) == 0)
+			else if(strncmp(pvs.s, "error", 5) == 0)
 				gpv->type = 4;
 				gpv->type = 4;
-			else if(strncmp(pvs.s, "cctel", 6) == 0)
+			else if(strncmp(pvs.s, "cctel", 5) == 0)
 				gpv->type = 5;
 				gpv->type = 5;
-			else if(strncmp(pvs.s, "valid", 6) == 0)
+			else if(strncmp(pvs.s, "valid", 5) == 0)
 				gpv->type = 6;
 				gpv->type = 6;
 			else
 			else
 				goto error;
 				goto error;
-			break;		
+			break;
 		case 6:
 		case 6:
 			if(strncmp(pvs.s, "number", 6) == 0)
 			if(strncmp(pvs.s, "number", 6) == 0)
 				gpv->type = 0;
 				gpv->type = 0;
@@ -315,7 +315,10 @@ int phonenum_update_pv(str *tomatch, str *name)
 		LM_DBG("no match for: %s\n", gr->tomatch);
 		LM_DBG("no match for: %s\n", gr->tomatch);
 		return -2;
 		return -2;
 	}
 	}
-	LM_DBG("phonenum PV updated for: %s\n", gr->tomatch);
+	LM_DBG("phonenum PV updated for: %s (%d/%s/%s)\n", gr->tomatch,
+			gr->record->valid,
+			(gr->record->normalized)?gr->record->normalized:"none",
+			(gr->record->error)?gr->record->error:"none");
 
 
 	return 1;
 	return 1;
 }
 }