...
|
...
|
@@ -132,6 +132,8 @@ static const char *command_strings[] = {
|
132
|
132
|
[OP_UNBLOCK_DTMF] = "unblock DTMF",
|
133
|
133
|
[OP_BLOCK_MEDIA] = "block media",
|
134
|
134
|
[OP_UNBLOCK_MEDIA] = "unblock media",
|
|
135
|
+ [OP_START_FORWARDING] = "start forwarding",
|
|
136
|
+ [OP_STOP_FORWARDING] = "stop forwarding",
|
135
|
137
|
};
|
136
|
138
|
|
137
|
139
|
struct minmax_mos_stats {
|
...
|
...
|
@@ -187,6 +189,8 @@ static int block_dtmf_f(struct sip_msg *, char *, char *);
|
187
|
189
|
static int unblock_dtmf_f(struct sip_msg *, char *, char *);
|
188
|
190
|
static int block_media_f(struct sip_msg *, char *, char *);
|
189
|
191
|
static int unblock_media_f(struct sip_msg *, char *, char *);
|
|
192
|
+static int start_forwarding_f(struct sip_msg *, char *, char *);
|
|
193
|
+static int stop_forwarding_f(struct sip_msg *, char *, char *);
|
190
|
194
|
static int rtpengine_answer1_f(struct sip_msg *, char *, char *);
|
191
|
195
|
static int rtpengine_offer1_f(struct sip_msg *, char *, char *);
|
192
|
196
|
static int rtpengine_delete1_f(struct sip_msg *, char *, char *);
|
...
|
...
|
@@ -336,6 +340,18 @@ static cmd_export_t cmds[] = {
|
336
|
340
|
{"unblock_media", (cmd_function)unblock_media_f, 1,
|
337
|
341
|
fixup_spve_null, 0,
|
338
|
342
|
ANY_ROUTE},
|
|
343
|
+ {"start_forwarding", (cmd_function)start_forwarding_f, 0,
|
|
344
|
+ 0, 0,
|
|
345
|
+ ANY_ROUTE },
|
|
346
|
+ {"stop_forwarding", (cmd_function)stop_forwarding_f, 0,
|
|
347
|
+ 0, 0,
|
|
348
|
+ ANY_ROUTE},
|
|
349
|
+ {"start_forwarding", (cmd_function)start_forwarding_f, 1,
|
|
350
|
+ fixup_spve_null, 0,
|
|
351
|
+ ANY_ROUTE },
|
|
352
|
+ {"stop_forwarding", (cmd_function)stop_forwarding_f, 1,
|
|
353
|
+ fixup_spve_null, 0,
|
|
354
|
+ ANY_ROUTE},
|
339
|
355
|
{"rtpengine_offer", (cmd_function)rtpengine_offer1_f, 0,
|
340
|
356
|
0, 0,
|
341
|
357
|
ANY_ROUTE},
|
...
|
...
|
@@ -2339,7 +2355,7 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf, struct sip_
|
2339
|
2355
|
bencode_dictionary_add_str(ng_flags.dict, "sdp", &body);
|
2340
|
2356
|
}
|
2341
|
2357
|
else if (op == OP_BLOCK_DTMF || op == OP_BLOCK_MEDIA || op == OP_UNBLOCK_DTMF
|
2342
|
|
- || op == OP_UNBLOCK_MEDIA)
|
|
2358
|
+ || op == OP_UNBLOCK_MEDIA || op == OP_START_FORWARDING || op == OP_STOP_FORWARDING)
|
2343
|
2359
|
{
|
2344
|
2360
|
ng_flags.flags = bencode_list(bencbuf);
|
2345
|
2361
|
}
|
...
|
...
|
@@ -2393,7 +2409,7 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf, struct sip_
|
2393
|
2409
|
bencode_list_add_string(item, ip_addr2a(&msg->rcv.src_ip));
|
2394
|
2410
|
|
2395
|
2411
|
if (op == OP_BLOCK_DTMF || op == OP_BLOCK_MEDIA || op == OP_UNBLOCK_DTMF
|
2396
|
|
- || op == OP_UNBLOCK_MEDIA)
|
|
2412
|
+ || op == OP_UNBLOCK_MEDIA || op == OP_START_FORWARDING || op == OP_STOP_FORWARDING)
|
2397
|
2413
|
{
|
2398
|
2414
|
if (ng_flags.directional)
|
2399
|
2415
|
bencode_dictionary_add_str(ng_flags.dict, "from-tag", &ng_flags.from_tag);
|
...
|
...
|
@@ -3724,6 +3740,44 @@ unblock_media_f(struct sip_msg* msg, char *str1, char *str2)
|
3724
|
3740
|
return rtpengine_rtpp_set_wrap(msg, rtpengine_unblock_media_wrap, flags.s, 1);
|
3725
|
3741
|
}
|
3726
|
3742
|
|
|
3743
|
+static int rtpengine_start_forwarding_wrap(struct sip_msg *msg, void *d, int more) {
|
|
3744
|
+ return rtpp_function_call_simple(msg, OP_START_FORWARDING, d);
|
|
3745
|
+}
|
|
3746
|
+
|
|
3747
|
+static int rtpengine_stop_forwarding_wrap(struct sip_msg *msg, void *d, int more) {
|
|
3748
|
+ return rtpp_function_call_simple(msg, OP_STOP_FORWARDING, d);
|
|
3749
|
+}
|
|
3750
|
+
|
|
3751
|
+static int
|
|
3752
|
+start_forwarding_f(struct sip_msg* msg, char *str1, char *str2)
|
|
3753
|
+{
|
|
3754
|
+ str flags;
|
|
3755
|
+ flags.s = NULL;
|
|
3756
|
+ if (str1) {
|
|
3757
|
+ if (get_str_fparam(&flags, msg, (fparam_t *) str1)) {
|
|
3758
|
+ LM_ERR("Error getting string parameter\n");
|
|
3759
|
+ return -1;
|
|
3760
|
+ }
|
|
3761
|
+ }
|
|
3762
|
+
|
|
3763
|
+ return rtpengine_rtpp_set_wrap(msg, rtpengine_start_forwarding_wrap, flags.s, 1);
|
|
3764
|
+}
|
|
3765
|
+
|
|
3766
|
+static int
|
|
3767
|
+stop_forwarding_f(struct sip_msg* msg, char *str1, char *str2)
|
|
3768
|
+{
|
|
3769
|
+ str flags;
|
|
3770
|
+ flags.s = NULL;
|
|
3771
|
+ if (str1) {
|
|
3772
|
+ if (get_str_fparam(&flags, msg, (fparam_t *) str1)) {
|
|
3773
|
+ LM_ERR("Error getting string parameter\n");
|
|
3774
|
+ return -1;
|
|
3775
|
+ }
|
|
3776
|
+ }
|
|
3777
|
+
|
|
3778
|
+ return rtpengine_rtpp_set_wrap(msg, rtpengine_stop_forwarding_wrap, flags.s, 1);
|
|
3779
|
+}
|
|
3780
|
+
|
3727
|
3781
|
static int rtpengine_rtpstat_wrap(struct sip_msg *msg, void *d, int more) {
|
3728
|
3782
|
void **parms;
|
3729
|
3783
|
pv_param_t *param;
|