mirror of https://github.com/sipwise/kamailio.git
This is just to keep our code tree in sync with upstream Change-Id: I1fe1d89127d7c2df4865ad2c9735dd19d000512echanges/02/27902/2
parent
9d34e9354c
commit
098f5a630c
@ -0,0 +1,113 @@
|
||||
--- a/src/modules/rtpengine/rtpengine.c
|
||||
+++ b/src/modules/rtpengine/rtpengine.c
|
||||
@@ -132,6 +132,8 @@
|
||||
[OP_UNBLOCK_DTMF] = "unblock DTMF",
|
||||
[OP_BLOCK_MEDIA] = "block media",
|
||||
[OP_UNBLOCK_MEDIA] = "unblock media",
|
||||
+ [OP_START_FORWARDING] = "start forwarding",
|
||||
+ [OP_STOP_FORWARDING] = "stop forwarding",
|
||||
};
|
||||
|
||||
struct minmax_mos_stats {
|
||||
@@ -177,6 +179,8 @@
|
||||
static int unblock_dtmf_f(struct sip_msg *, char *, char *);
|
||||
static int block_media_f(struct sip_msg *, char *, char *);
|
||||
static int unblock_media_f(struct sip_msg *, char *, char *);
|
||||
+static int start_forwarding_f(struct sip_msg *, char *, char *);
|
||||
+static int stop_forwarding_f(struct sip_msg *, char *, char *);
|
||||
static int rtpengine_answer1_f(struct sip_msg *, char *, char *);
|
||||
static int rtpengine_offer1_f(struct sip_msg *, char *, char *);
|
||||
static int rtpengine_delete1_f(struct sip_msg *, char *, char *);
|
||||
@@ -327,6 +331,18 @@
|
||||
{"unblock_media", (cmd_function)unblock_media_f, 1,
|
||||
fixup_spve_null, 0,
|
||||
ANY_ROUTE},
|
||||
+ {"start_forwarding", (cmd_function)start_forwarding_f, 0,
|
||||
+ 0, 0,
|
||||
+ ANY_ROUTE },
|
||||
+ {"stop_forwarding", (cmd_function)stop_forwarding_f, 0,
|
||||
+ 0, 0,
|
||||
+ ANY_ROUTE},
|
||||
+ {"start_forwarding", (cmd_function)start_forwarding_f, 1,
|
||||
+ fixup_spve_null, 0,
|
||||
+ ANY_ROUTE },
|
||||
+ {"stop_forwarding", (cmd_function)stop_forwarding_f, 1,
|
||||
+ fixup_spve_null, 0,
|
||||
+ ANY_ROUTE},
|
||||
{"rtpengine_offer", (cmd_function)rtpengine_offer1_f, 0,
|
||||
0, 0,
|
||||
ANY_ROUTE},
|
||||
@@ -2207,7 +2223,7 @@
|
||||
bencode_dictionary_add_str(ng_flags.dict, "sdp", &body);
|
||||
}
|
||||
else if (op == OP_BLOCK_DTMF || op == OP_BLOCK_MEDIA || op == OP_UNBLOCK_DTMF
|
||||
- || op == OP_UNBLOCK_MEDIA)
|
||||
+ || op == OP_UNBLOCK_MEDIA || op == OP_START_FORWARDING || op == OP_STOP_FORWARDING)
|
||||
{
|
||||
ng_flags.flags = bencode_list(bencbuf);
|
||||
}
|
||||
@@ -2279,7 +2295,7 @@
|
||||
bencode_list_add_string(item, ip_addr2a(&msg->rcv.src_ip));
|
||||
|
||||
if (op == OP_BLOCK_DTMF || op == OP_BLOCK_MEDIA || op == OP_UNBLOCK_DTMF
|
||||
- || op == OP_UNBLOCK_MEDIA)
|
||||
+ || op == OP_UNBLOCK_MEDIA || op == OP_START_FORWARDING || op == OP_STOP_FORWARDING)
|
||||
{
|
||||
if (ng_flags.directional)
|
||||
bencode_dictionary_add_str(ng_flags.dict, "from-tag", &ng_flags.from_tag);
|
||||
@@ -3645,6 +3661,44 @@
|
||||
return rtpengine_rtpp_set_wrap(msg, rtpengine_unblock_media_wrap, flags.s, 1);
|
||||
}
|
||||
|
||||
+static int rtpengine_start_forwarding_wrap(struct sip_msg *msg, void *d, int more) {
|
||||
+ return rtpp_function_call_simple(msg, OP_START_FORWARDING, d);
|
||||
+}
|
||||
+
|
||||
+static int rtpengine_stop_forwarding_wrap(struct sip_msg *msg, void *d, int more) {
|
||||
+ return rtpp_function_call_simple(msg, OP_STOP_FORWARDING, d);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+start_forwarding_f(struct sip_msg* msg, char *str1, char *str2)
|
||||
+{
|
||||
+ str flags;
|
||||
+ flags.s = NULL;
|
||||
+ if (str1) {
|
||||
+ if (get_str_fparam(&flags, msg, (fparam_t *) str1)) {
|
||||
+ LM_ERR("Error getting string parameter\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return rtpengine_rtpp_set_wrap(msg, rtpengine_start_forwarding_wrap, flags.s, 1);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+stop_forwarding_f(struct sip_msg* msg, char *str1, char *str2)
|
||||
+{
|
||||
+ str flags;
|
||||
+ flags.s = NULL;
|
||||
+ if (str1) {
|
||||
+ if (get_str_fparam(&flags, msg, (fparam_t *) str1)) {
|
||||
+ LM_ERR("Error getting string parameter\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return rtpengine_rtpp_set_wrap(msg, rtpengine_stop_forwarding_wrap, flags.s, 1);
|
||||
+}
|
||||
+
|
||||
static int rtpengine_rtpstat_wrap(struct sip_msg *msg, void *d, int more) {
|
||||
void **parms;
|
||||
pv_param_t *param;
|
||||
--- a/src/modules/rtpengine/rtpengine.h
|
||||
+++ b/src/modules/rtpengine/rtpengine.h
|
||||
@@ -42,6 +42,8 @@
|
||||
OP_UNBLOCK_DTMF,
|
||||
OP_BLOCK_MEDIA,
|
||||
OP_UNBLOCK_MEDIA,
|
||||
+ OP_START_FORWARDING,
|
||||
+ OP_STOP_FORWARDING,
|
||||
};
|
||||
|
||||
struct rtpp_node {
|
||||
Loading…
Reference in new issue