[sr-dev] git:master:832fcfd8: dialog: handle . for optional body parameter for rpc dlg.bridge_dlg

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 13 10:55:56 CEST 2018


Module: kamailio
Branch: master
Commit: 832fcfd839a193e5631df6c8ff1d2a84565d3822
URL: https://github.com/kamailio/kamailio/commit/832fcfd839a193e5631df6c8ff1d2a84565d3822

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-07-13T10:39:29+02:00

dialog: handle . for optional body parameter for rpc dlg.bridge_dlg

- consider as parameter not provided and use the default SDP string
- "" or "_" behaves as provided body is empty string and the request has
no body

---

Modified: src/modules/dialog/dialog.c
Modified: src/modules/dialog/dlg_transfer.c

---

Diff:  https://github.com/kamailio/kamailio/commit/832fcfd839a193e5631df6c8ff1d2a84565d3822.diff
Patch: https://github.com/kamailio/kamailio/commit/832fcfd839a193e5631df6c8ff1d2a84565d3822.patch

---

diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 83883a4fac..7f6e692125 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -2348,6 +2348,14 @@ static void rpc_dlg_bridge(rpc_t *rpc, void *c) {
 		if(rpc->scan(c, "*S", &bd)<1) {
 			bd.s = NULL;
 			bd.len = 0;
+		} else {
+			if(bd.len==1 && *bd.s=='.') {
+				bd.s = NULL;
+				bd.len = 0;
+			} else if(bd.len==1 && *bd.s=='_') {
+				bd.s = "";
+				bd.len = 0;
+			}
 		}
 	}
 
diff --git a/src/modules/dialog/dlg_transfer.c b/src/modules/dialog/dlg_transfer.c
index 74d43726ad..f3e594bcbe 100644
--- a/src/modules/dialog/dlg_transfer.c
+++ b/src/modules/dialog/dlg_transfer.c
@@ -357,7 +357,7 @@ int dlg_bridge(str *from, str *to, str *op, str *bd)
 
 	LM_DBG("bridge <%.*s> to <%.*s>\n", dtc->from.len, dtc->from.s,
 			dtc->to.len, dtc->to.s);
-	if(bd!=NULL && bd->s!=NULL && bd->len>0) {
+	if(bd!=NULL && bd->s!=NULL) {
 		s_body.s = bd->s;
 		s_body.len = bd->len;
 	} else {




More information about the sr-dev mailing list