Module: kamailio
Branch: master
Commit: 0a2450e62d77020243530e18d93c9aa8181a5701
URL:
https://github.com/kamailio/kamailio/commit/0a2450e62d77020243530e18d93c9aa…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)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/0a2450e62d77020243530e18d93c9aa…
Patch:
https://github.com/kamailio/kamailio/commit/0a2450e62d77020243530e18d93c9aa…
---
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");