[sr-dev] git:5.5:11642e96: rtpengine: extract call-id/from-tag/to-tag only from sip messages

Daniel-Constantin Mierla miconda at gmail.com
Mon May 3 10:05:54 CEST 2021


Module: kamailio
Branch: 5.5
Commit: 11642e96f9a645ad7ec5a37f82c1fff1c8321f89
URL: https://github.com/kamailio/kamailio/commit/11642e96f9a645ad7ec5a37f82c1fff1c8321f89

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-05-03T09:43:49+02:00

rtpengine: extract call-id/from-tag/to-tag only from sip messages

- they can be provided via flags in function parameters
- fix using functions in non-sip routing blocks (e.g., xhttp processing)

(cherry picked from commit 0a2450e62d77020243530e18d93c9aa8181a5701)

---

Modified: src/modules/rtpengine/rtpengine.c

---

Diff:  https://github.com/kamailio/kamailio/commit/11642e96f9a645ad7ec5a37f82c1fff1c8321f89.diff
Patch: https://github.com/kamailio/kamailio/commit/11642e96f9a645ad7ec5a37f82c1fff1c8321f89.patch

---

diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c
index a60de52a35..6f91c222b2 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -2477,17 +2477,19 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf, struct sip_
 
 	memset(&ng_flags, 0, sizeof(ng_flags));
 
-	if (get_callid(msg, &ng_flags.call_id) == -1 || ng_flags.call_id.len == 0) {
-		LM_ERR("can't get Call-Id field\n");
-		return NULL;
-	}
-	if (get_to_tag(msg, &ng_flags.to_tag) == -1) {
-		LM_ERR("can't get To tag\n");
-		return NULL;
-	}
-	if (get_from_tag(msg, &ng_flags.from_tag) == -1 || ng_flags.from_tag.len == 0) {
-		LM_ERR("can't get From tag\n");
-		return NULL;
+	if(IS_SIP(msg) || IS_SIP_REPLY(msg)) {
+		if (get_callid(msg, &ng_flags.call_id) == -1 || ng_flags.call_id.len == 0) {
+			LM_ERR("can't get Call-Id field\n");
+			return NULL;
+		}
+		if (get_to_tag(msg, &ng_flags.to_tag) == -1) {
+			LM_ERR("can't get To tag\n");
+			return NULL;
+		}
+		if (get_from_tag(msg, &ng_flags.from_tag) == -1 || ng_flags.from_tag.len == 0) {
+			LM_ERR("can't get From tag\n");
+			return NULL;
+		}
 	}
 	if (bencode_buffer_init(bencbuf)) {
 		LM_ERR("could not initialize bencode_buffer_t\n");
@@ -2535,6 +2537,18 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf, struct sip_
 	if (parse_flags(&ng_flags, msg, &op, flags_str))
 		goto error;
 
+	if(!IS_SIP(msg) && !IS_SIP_REPLY(msg)) {
+		/* check required values */
+		if (ng_flags.call_id.len == 0) {
+			LM_ERR("can't get Call-Id field\n");
+			return NULL;
+		}
+		if (ng_flags.from_tag.len == 0) {
+			LM_ERR("can't get From tag\n");
+			return NULL;
+		}
+	}
+
 	/* trickle ice sdp fragment? */
 	if (cont_type == 3)
 		bencode_list_add_string(ng_flags.flags, "fragment");




More information about the sr-dev mailing list