فهرست منبع

dialog: proper refresh of cseq for requests withing dialog after an increment

- reported by GH #752
Daniel-Constantin Mierla 9 سال پیش
والد
کامیت
73dbed5c33
1فایلهای تغییر یافته به همراه15 افزوده شده و 1 حذف شده
  1. 15 1
      modules/dialog/dlg_cseq.c

+ 15 - 1
modules/dialog/dlg_cseq.c

@@ -193,6 +193,8 @@ error:
 int dlg_cseq_refresh(sip_msg_t *msg, dlg_cell_t *dlg,
 		unsigned int direction)
 {
+	unsigned int ninc = 0;
+	unsigned int vinc = 0;
 	str nval;
 	str *pval;
 
@@ -225,7 +227,19 @@ int dlg_cseq_refresh(sip_msg_t *msg, dlg_cell_t *dlg,
 		goto done;
 	}
 
-	nval = *pval;
+	if(str2int(pval, &vinc)<0) {
+		LM_ERR("invalid dlg cseq diff var value: %.*s\n",
+					pval->len, pval->s);
+		goto done;
+	}
+	if(vinc==0) {
+		LM_DBG("nothing to increment\n");
+		goto done;
+	}
+
+	str2int(&get_cseq(msg)->number, &ninc);
+	vinc += ninc;
+	nval.s = int2str(vinc, &nval.len);
 	trim(&nval);
 
 	LM_DBG("adding cseq refresh header value: %.*s\n", nval.len, nval.s);