From: Razvan Crainea <razvan@opensips.org>
Date: Thu, 9 Nov 2017 10:23:54 +0200
Subject: [PATCH] rtpengine: do not use replace bson for delete
Prevent the module for using replace-* attributes for any other
operation than offer or answer. This allows you to use the
rtpengine_manage() function easier.
Reported by Edwin Hoff
(cherry picked from commit d67fbb9809427cc4087563bbbebf556420f1f330)
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c
index 4d2ea81f5..de881e29d 100644
--- a/modules/rtpengine/rtpengine.c
+++ b/modules/rtpengine/rtpengine.c
@@ -1149,9 +1149,12 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
break;
case 14:
- if (str_eq(&key, "replace-origin"))
- bencode_list_add_string(ng_flags->replace, "origin");
- else if (str_eq(&key, "address-family")) {
+ if (str_eq(&key, "replace-origin")) {
+ if (!ng_flags->replace)
+ LM_DBG("%.*s not supported for %d op\n", key.len, key.s, *op);
+ else
+ bencode_list_add_string(ng_flags->replace, "origin");
+ } else if (str_eq(&key, "address-family")) {
err = "missing value";
if (!val.s)
goto error;
@@ -1193,9 +1196,12 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
break;
case 26:
- if (str_eq(&key, "replace-session-connection"))
- bencode_list_add_string(ng_flags->replace, "session-connection");
- else
+ if (str_eq(&key, "replace-session-connection")) {
+ if (!ng_flags->replace)
+ LM_DBG("%.*s not supported for %d op\n", key.len, key.s, *op);
+ else
+ bencode_list_add_string(ng_flags->replace, "session-connection");
+ } else
goto error;
break;