Skip to content

Commit 75ba5c2

Browse files
Merge pull request #3515 from edman80/feature_rtpe_pause
Feature: add pause recording function to module rtpengine
2 parents 03f7854 + 5474d49 commit 75ba5c2

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

modules/rtpengine/doc/rtpengine_admin.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,41 @@ rtpengine_stop_recording();
10261026
</example>
10271027
</section>
10281028

1029+
<section id="func_rtpengine_pause_recording" xreflabel="rtpengine_pause_recording()">
1030+
<title>
1031+
<function moreinfo="none">rtpengine_pause_recording([flags [, sock_var]])</function>
1032+
</title>
1033+
<para>
1034+
This function will send a signal to the &rtp; proxy to pause
1035+
recording the RTP stream on the &rtp; proxy. Identical to stop recording except that it
1036+
instructs the recording daemon not to close the recording file, but instead leave it open
1037+
so that recording can later be resumed via another start recording message.
1038+
</para>
1039+
<para>Meaning of the parameters is as follows:</para>
1040+
<itemizedlist>
1041+
<listitem><para>
1042+
<emphasis>flags(string, optional)</emphasis> - flags used to change the behavior
1043+
of the recorder. An importat value to set is the <emphasis>call-id</emphasis>
1044+
value, which can be used to start recording a different call than the requested one.
1045+
</para></listitem>
1046+
<listitem><para>
1047+
<emphasis>sock_var(var, optional)</emphasis> - variable used to store the rtpengine
1048+
socket chosen for this call.
1049+
</para></listitem>
1050+
</itemizedlist>
1051+
<para>
1052+
This function can be used from any route.
1053+
</para>
1054+
<example>
1055+
<title><function>rtpengine_pause_recording</function> usage</title>
1056+
<programlisting format="linespecific">
1057+
...
1058+
rtpengine_stop_recording();
1059+
...
1060+
</programlisting>
1061+
</example>
1062+
</section>
1063+
10291064
<section id="func_rtpengine_play_media" xreflabel="rtpengine_play_media()">
10301065
<title>
10311066
<function moreinfo="none">rtpengine_play_media(flags, [duration_spec[, sock_var[, sockvar]]])</function>

modules/rtpengine/rtpengine.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ enum rtpe_operation {
152152
OP_DELETE,
153153
OP_START_RECORDING,
154154
OP_STOP_RECORDING,
155+
OP_PAUSE_RECORDING,
155156
OP_QUERY,
156157
OP_START_MEDIA,
157158
OP_STOP_MEDIA,
@@ -233,6 +234,7 @@ static const char *command_strings[] = {
233234
[OP_DELETE] = "delete",
234235
[OP_START_RECORDING] = "start recording",
235236
[OP_STOP_RECORDING] = "stop recording",
237+
[OP_PAUSE_RECORDING] = "pause recording",
236238
[OP_QUERY] = "query",
237239
[OP_START_MEDIA]= "play media",
238240
[OP_STOP_MEDIA] = "stop media",
@@ -275,6 +277,8 @@ static char *gencookie();
275277
static int rtpe_test(struct rtpe_node*, int, int);
276278
static int start_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar);
277279
static int stop_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar);
280+
static int pause_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar);
281+
static int start_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar);
278282
static int rtpengine_offer_f(struct sip_msg *msg, str *flags, pv_spec_t *spvar,
279283
pv_spec_t *bpvar, str *body);
280284
static int rtpengine_answer_f(struct sip_msg *msg, str *flags, pv_spec_t *spvar,
@@ -445,6 +449,10 @@ static const cmd_export_t cmds[] = {
445449
{CMD_PARAM_STR | CMD_PARAM_OPT, 0, 0},
446450
{CMD_PARAM_VAR | CMD_PARAM_OPT, 0, 0}, {0,0,0}},
447451
ALL_ROUTES},
452+
{"rtpengine_pause_recording", (cmd_function)pause_recording_f, {
453+
{CMD_PARAM_STR | CMD_PARAM_OPT, 0, 0},
454+
{CMD_PARAM_VAR | CMD_PARAM_OPT, 0, 0}, {0,0,0}},
455+
ALL_ROUTES},
448456
{"rtpengine_offer", (cmd_function)rtpengine_offer_f, {
449457
{CMD_PARAM_STR | CMD_PARAM_OPT, 0, 0},
450458
{CMD_PARAM_VAR | CMD_PARAM_OPT, 0, 0},
@@ -3521,6 +3529,12 @@ stop_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar)
35213529
return rtpe_function_call_simple(msg, OP_STOP_RECORDING, flags, NULL, NULL, spvar);
35223530
}
35233531

3532+
static int
3533+
pause_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar)
3534+
{
3535+
return rtpe_function_call_simple(msg, OP_PAUSE_RECORDING, flags, NULL, NULL, spvar);
3536+
}
3537+
35243538
/**
35253539
* Gets the rtp stats and tries to store them in a context, if that's possible
35263540
* Returns:

0 commit comments

Comments
 (0)