Browse code

rtpengine: make start_recording and stop_recording accept flags

Claudiu Boriga authored on 27/09/2017 08:40:50
Showing 2 changed files
... ...
@@ -2472,7 +2472,7 @@ rtpengine_manage();
2472 2472
 
2473 2473
 	<section id="rtpengine.f.start_recording">
2474 2474
 		<title>
2475
-		<function moreinfo="none">start_recording()</function>
2475
+		<function moreinfo="none">start_recording([flags])</function>
2476 2476
 		</title>
2477 2477
 		<para>
2478 2478
 		This function will send a signal to the &rtp; relay to record
... ...
@@ -2482,6 +2482,12 @@ rtpengine_manage();
2482 2482
 		metadata from SDP.
2483 2483
 		</para>
2484 2484
 		<para>
2485
+		It can take the same parameters as <function>rtpengine_manage().</function>
2486
+		The flags parameter to start_recording can be a configuration variable
2487
+		containing the flags as a string.
2488
+		The call-id flag can be used to start recording for a different call.
2489
+		</para>
2490
+		<para>
2485 2491
 		This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
2486 2492
 		</para>
2487 2493
 		<example>
... ...
@@ -2496,14 +2502,19 @@ start_recording();
2496 2502
 
2497 2503
 	<section id="rtpengine.f.stop_recording">
2498 2504
 		<title>
2499
-		<function moreinfo="none">stop_recording()</function>
2505
+		<function moreinfo="none">stop_recording([flags])</function>
2500 2506
 		</title>
2501 2507
 		<para>
2502
-		This function will send a signal to the &rtp; relay to record
2508
+		This function will send a signal to the &rtp; relay to stop recording
2503 2509
 		the &rtp; stream flowing through it. See also the option
2504 2510
 		<quote>record-call=off</quote> for rtpengine_manage()/rtpengine_offer(),
2505
-		which offers an alternative for call recording, saving also call
2506
-		metadata from SDP.
2511
+		which offers an alternative for call recording.
2512
+		</para>
2513
+		<para>
2514
+		It can take the same parameters as <function>rtpengine_manage().</function>
2515
+		The flags parameter to start_recording can be a configuration variable
2516
+		containing the flags as a string.
2517
+		The call-id flag can be used to stop recording for a different call.
2507 2518
 		</para>
2508 2519
 		<para>
2509 2520
 		This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
... ...
@@ -284,9 +284,15 @@ static cmd_export_t cmds[] = {
284 284
 	{"start_recording",	(cmd_function)start_recording_f,	0,
285 285
 		0, 0,
286 286
 		ANY_ROUTE },
287
+	{"start_recording",	(cmd_function)start_recording_f,	1,
288
+		fixup_spve_null, 0,
289
+		ANY_ROUTE},
287 290
 	{"stop_recording",	(cmd_function)stop_recording_f, 	0,
288 291
 		0, 0,
289 292
 		ANY_ROUTE },
293
+	{"stop_recording",	(cmd_function)stop_recording_f, 	1,
294
+		fixup_spve_null, 0,
295
+		ANY_ROUTE},
290 296
 	{"rtpengine_offer",	(cmd_function)rtpengine_offer1_f,	0,
291 297
 		0, 0,
292 298
 		ANY_ROUTE},
... ...
@@ -3375,23 +3381,41 @@ error:
3375 3381
 
3376 3382
 
3377 3383
 static int rtpengine_start_recording_wrap(struct sip_msg *msg, void *d, int more) {
3378
-	return rtpp_function_call_simple(msg, OP_START_RECORDING, NULL);
3384
+	return rtpp_function_call_simple(msg, OP_START_RECORDING, d);
3379 3385
 }
3380 3386
 
3381 3387
 static int rtpengine_stop_recording_wrap(struct sip_msg *msg, void *d, int more) {
3382
-	return rtpp_function_call_simple(msg, OP_STOP_RECORDING, NULL);
3388
+	return rtpp_function_call_simple(msg, OP_STOP_RECORDING, d);
3383 3389
 }
3384 3390
 
3385 3391
 static int
3386
-start_recording_f(struct sip_msg* msg, char *foo, char *bar)
3392
+start_recording_f(struct sip_msg* msg, char *str1, char *str2)
3387 3393
 {
3388
-	return rtpengine_rtpp_set_wrap(msg, rtpengine_start_recording_wrap, NULL, 1);
3394
+	str flags;
3395
+	flags.s = NULL;
3396
+	if (str1) {
3397
+		if (get_str_fparam(&flags, msg, (fparam_t *) str1)) {
3398
+			LM_ERR("Error getting string parameter\n");
3399
+			return -1;
3400
+		}
3401
+	}
3402
+
3403
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_start_recording_wrap, flags.s, 1);
3389 3404
 }
3390 3405
 
3391 3406
 static int
3392
-stop_recording_f(struct sip_msg* msg, char *foo, char *bar)
3407
+stop_recording_f(struct sip_msg* msg, char *str1, char *str2)
3393 3408
 {
3394
-	return rtpengine_rtpp_set_wrap(msg, rtpengine_stop_recording_wrap, NULL, 1);
3409
+	str flags;
3410
+	flags.s = NULL;
3411
+	if (str1) {
3412
+		if (get_str_fparam(&flags, msg, (fparam_t *) str1)) {
3413
+			LM_ERR("Error getting string parameter\n");
3414
+			return -1;
3415
+		}
3416
+	}
3417
+
3418
+	return rtpengine_rtpp_set_wrap(msg, rtpengine_stop_recording_wrap, flags.s, 1);
3395 3419
 }
3396 3420
 
3397 3421
 static int rtpengine_rtpstat_wrap(struct sip_msg *msg, void *d, int more) {