[sr-dev] git:master:2196c677: phonenum: fixed lenght in pv name comparisons

Daniel-Constantin Mierla miconda at gmail.com
Wed Mar 21 14:59:48 CET 2018


Module: kamailio
Branch: master
Commit: 2196c677785fc4df4f4f1c03831eff679dcd5363
URL: https://github.com/kamailio/kamailio/commit/2196c677785fc4df4f4f1c03831eff679dcd5363

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-03-21T14:59:29+01:00

phonenum: fixed lenght in pv name comparisons

---

Modified: src/modules/phonenum/phonenum_pv.c

---

Diff:  https://github.com/kamailio/kamailio/commit/2196c677785fc4df4f4f1c03831eff679dcd5363.diff
Patch: https://github.com/kamailio/kamailio/commit/2196c677785fc4df4f4f1c03831eff679dcd5363.patch

---

diff --git a/src/modules/phonenum/phonenum_pv.c b/src/modules/phonenum/phonenum_pv.c
index 9fd9ce93f4..f4e2763bf0 100644
--- a/src/modules/phonenum/phonenum_pv.c
+++ b/src/modules/phonenum/phonenum_pv.c
@@ -165,19 +165,19 @@ int pv_parse_phonenum_name(pv_spec_p sp, str *in)
 
 	switch(pvs.len) {
 		case 5:
-			if(strncmp(pvs.s, "ltype", 6) == 0)
+			if(strncmp(pvs.s, "ltype", 5) == 0)
 				gpv->type = 2;
-			else if(strncmp(pvs.s, "ndesc", 6) == 0)
+			else if(strncmp(pvs.s, "ndesc", 5) == 0)
 				gpv->type = 3;
-			else if(strncmp(pvs.s, "error", 6) == 0)
+			else if(strncmp(pvs.s, "error", 5) == 0)
 				gpv->type = 4;
-			else if(strncmp(pvs.s, "cctel", 6) == 0)
+			else if(strncmp(pvs.s, "cctel", 5) == 0)
 				gpv->type = 5;
-			else if(strncmp(pvs.s, "valid", 6) == 0)
+			else if(strncmp(pvs.s, "valid", 5) == 0)
 				gpv->type = 6;
 			else
 				goto error;
-			break;		
+			break;
 		case 6:
 			if(strncmp(pvs.s, "number", 6) == 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);
 		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;
 }




More information about the sr-dev mailing list