[sr-dev] git:master:0a2450e6: rtpengine: extract call-id/from-tag/to-tag only from sip messages

Daniel-Constantin Mierla miconda at gmail.com
Fri Apr 30 08:34:37 CEST 2021


Module: kamailio
Branch: master
Commit: 0a2450e62d77020243530e18d93c9aa8181a5701
URL: https://github.com/kamailio/kamailio/commit/0a2450e62d77020243530e18d93c9aa8181a5701

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-04-30T08:31:34+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)

---

Modified: src/modules/rtpengine/rtpengine.c

---

Diff:  https://github.com/kamailio/kamailio/commit/0a2450e62d77020243530e18d93c9aa8181a5701.diff
Patch: https://github.com/kamailio/kamailio/commit/0a2450e62d77020243530e18d93c9aa8181a5701.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