Browse code

rtpengine: added kemi support for block/unblock media/dtmf, and play/stop media functions

Yufei Tao authored on 03/07/2020 17:01:30
Showing 1 changed files
... ...
@@ -4034,6 +4034,55 @@ static int ki_stop_recording(sip_msg_t *msg)
4034 4034
 	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, NULL, 1, OP_STOP_RECORDING);
4035 4035
 }
4036 4036
 
4037
+
4038
+static int ki_block_media0(sip_msg_t *msg)
4039
+{
4040
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, NULL, 1, OP_BLOCK_MEDIA);
4041
+}
4042
+static int ki_block_media(sip_msg_t *msg, str *flags)
4043
+{
4044
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, flags->s, 1, OP_BLOCK_MEDIA);
4045
+}
4046
+static int ki_unblock_media0(sip_msg_t *msg)
4047
+{
4048
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, NULL, 1, OP_UNBLOCK_MEDIA);
4049
+}
4050
+static int ki_unblock_media(sip_msg_t *msg , str *flags)
4051
+{
4052
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, flags->s, 1, OP_UNBLOCK_MEDIA);
4053
+}
4054
+
4055
+static int ki_block_dtmf0(sip_msg_t *msg)
4056
+{
4057
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, NULL, 1, OP_BLOCK_DTMF);
4058
+}
4059
+static int ki_block_dtmf(sip_msg_t *msg, str *flags)
4060
+{
4061
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, flags->s, 1, OP_BLOCK_DTMF);
4062
+}
4063
+static int ki_unblock_dtmf0(sip_msg_t *msg)
4064
+{
4065
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, NULL, 1, OP_UNBLOCK_DTMF);
4066
+}
4067
+static int ki_unblock_dtmf(sip_msg_t *msg, str *flags)
4068
+{
4069
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, flags->s, 1, OP_UNBLOCK_DTMF);
4070
+}
4071
+
4072
+static int ki_play_media(sip_msg_t *msg, str *flags)
4073
+{
4074
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, flags->s, 1, OP_PLAY_MEDIA);
4075
+}
4076
+static int ki_stop_media0(sip_msg_t *msg)
4077
+{
4078
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, NULL, 1, OP_STOP_MEDIA);
4079
+}
4080
+static int ki_stop_media(sip_msg_t *msg, str *flags)
4081
+{
4082
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_simple_wrap, flags->s, 1, OP_STOP_MEDIA);
4083
+}
4084
+
4085
+
4037 4086
 static int ki_set_rtpengine_set(sip_msg_t *msg, int r1)
4038 4087
 {
4039 4088
 	rtpp_set_link_t rtpl1;
... ...
@@ -4149,6 +4198,65 @@ static sr_kemi_t sr_kemi_rtpengine_exports[] = {
4149 4198
         { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
4150 4199
             SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4151 4200
     },
4201
+
4202
+	{ str_init("rtpengine"), str_init("block_media0"),
4203
+        SR_KEMIP_INT, ki_block_media0,
4204
+        { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
4205
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4206
+    },
4207
+    { str_init("rtpengine"), str_init("block_media"),
4208
+        SR_KEMIP_INT, ki_block_media,
4209
+        { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
4210
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4211
+    },
4212
+	{ str_init("rtpengine"), str_init("unblock_media0"),
4213
+        SR_KEMIP_INT, ki_unblock_media0,
4214
+        { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
4215
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4216
+    },
4217
+    { str_init("rtpengine"), str_init("unblock_media"),
4218
+        SR_KEMIP_INT, ki_unblock_media,
4219
+        { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
4220
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4221
+    },
4222
+
4223
+	{ str_init("rtpengine"), str_init("block_dtmf0"),
4224
+        SR_KEMIP_INT, ki_block_dtmf0,
4225
+        { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
4226
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4227
+    },
4228
+    { str_init("rtpengine"), str_init("block_dtmf"),
4229
+        SR_KEMIP_INT, ki_block_dtmf,
4230
+        { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
4231
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4232
+    },
4233
+	{ str_init("rtpengine"), str_init("unblock_dtmf0"),
4234
+        SR_KEMIP_INT, ki_unblock_dtmf0,
4235
+        { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
4236
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4237
+    },
4238
+    { str_init("rtpengine"), str_init("unblock_dtmf"),
4239
+        SR_KEMIP_INT, ki_unblock_dtmf,
4240
+        { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
4241
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4242
+    },
4243
+
4244
+    { str_init("rtpengine"), str_init("play_media"),
4245
+        SR_KEMIP_INT, ki_play_media,
4246
+        { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
4247
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4248
+    },
4249
+		{ str_init("rtpengine"), str_init("stop_media0"),
4250
+        SR_KEMIP_INT, ki_stop_media0,
4251
+        { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
4252
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4253
+    },
4254
+    { str_init("rtpengine"), str_init("stop_media"),
4255
+        SR_KEMIP_INT, ki_stop_media,
4256
+        { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
4257
+            SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
4258
+    },
4259
+
4152 4260
     { str_init("rtpengine"), str_init("set_rtpengine_set"),
4153 4261
         SR_KEMIP_INT, ki_set_rtpengine_set,
4154 4262
         { SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,