[sr-dev] git:master:73dbed5c: dialog: proper refresh of cseq for requests withing dialog after an increment

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 30 17:32:21 CEST 2016


Module: kamailio
Branch: master
Commit: 73dbed5c33b757476e01098b957694b2344bb0a0
URL: https://github.com/kamailio/kamailio/commit/73dbed5c33b757476e01098b957694b2344bb0a0

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-08-30T17:31:17+02:00

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

- reported by GH #752

---

Modified: modules/dialog/dlg_cseq.c

---

Diff:  https://github.com/kamailio/kamailio/commit/73dbed5c33b757476e01098b957694b2344bb0a0.diff
Patch: https://github.com/kamailio/kamailio/commit/73dbed5c33b757476e01098b957694b2344bb0a0.patch

---

diff --git a/modules/dialog/dlg_cseq.c b/modules/dialog/dlg_cseq.c
index b74cb4e..7c95ce0 100644
--- a/modules/dialog/dlg_cseq.c
+++ b/modules/dialog/dlg_cseq.c
@@ -193,6 +193,8 @@ int dlg_cseq_update(sip_msg_t *msg)
 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);




More information about the sr-dev mailing list