Skip to content

Commit

Permalink
Merge pull request #3515 from edman80/feature_rtpe_pause
Browse files Browse the repository at this point in the history
Feature: add pause recording function to module rtpengine
  • Loading branch information
razvancrainea authored Nov 15, 2024
2 parents 03f7854 + 5474d49 commit 75ba5c2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
35 changes: 35 additions & 0 deletions modules/rtpengine/doc/rtpengine_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,41 @@ rtpengine_stop_recording();
</example>
</section>

<section id="func_rtpengine_pause_recording" xreflabel="rtpengine_pause_recording()">
<title>
<function moreinfo="none">rtpengine_pause_recording([flags [, sock_var]])</function>
</title>
<para>
This function will send a signal to the &rtp; proxy to pause
recording the RTP stream on the &rtp; proxy. Identical to stop recording except that it
instructs the recording daemon not to close the recording file, but instead leave it open
so that recording can later be resumed via another start recording message.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem><para>
<emphasis>flags(string, optional)</emphasis> - flags used to change the behavior
of the recorder. An importat value to set is the <emphasis>call-id</emphasis>
value, which can be used to start recording a different call than the requested one.
</para></listitem>
<listitem><para>
<emphasis>sock_var(var, optional)</emphasis> - variable used to store the rtpengine
socket chosen for this call.
</para></listitem>
</itemizedlist>
<para>
This function can be used from any route.
</para>
<example>
<title><function>rtpengine_pause_recording</function> usage</title>
<programlisting format="linespecific">
...
rtpengine_stop_recording();
...
</programlisting>
</example>
</section>

<section id="func_rtpengine_play_media" xreflabel="rtpengine_play_media()">
<title>
<function moreinfo="none">rtpengine_play_media(flags, [duration_spec[, sock_var[, sockvar]]])</function>
Expand Down
14 changes: 14 additions & 0 deletions modules/rtpengine/rtpengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ enum rtpe_operation {
OP_DELETE,
OP_START_RECORDING,
OP_STOP_RECORDING,
OP_PAUSE_RECORDING,
OP_QUERY,
OP_START_MEDIA,
OP_STOP_MEDIA,
Expand Down Expand Up @@ -233,6 +234,7 @@ static const char *command_strings[] = {
[OP_DELETE] = "delete",
[OP_START_RECORDING] = "start recording",
[OP_STOP_RECORDING] = "stop recording",
[OP_PAUSE_RECORDING] = "pause recording",
[OP_QUERY] = "query",
[OP_START_MEDIA]= "play media",
[OP_STOP_MEDIA] = "stop media",
Expand Down Expand Up @@ -275,6 +277,8 @@ static char *gencookie();
static int rtpe_test(struct rtpe_node*, int, int);
static int start_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar);
static int stop_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar);
static int pause_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar);
static int start_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar);
static int rtpengine_offer_f(struct sip_msg *msg, str *flags, pv_spec_t *spvar,
pv_spec_t *bpvar, str *body);
static int rtpengine_answer_f(struct sip_msg *msg, str *flags, pv_spec_t *spvar,
Expand Down Expand Up @@ -445,6 +449,10 @@ static const cmd_export_t cmds[] = {
{CMD_PARAM_STR | CMD_PARAM_OPT, 0, 0},
{CMD_PARAM_VAR | CMD_PARAM_OPT, 0, 0}, {0,0,0}},
ALL_ROUTES},
{"rtpengine_pause_recording", (cmd_function)pause_recording_f, {
{CMD_PARAM_STR | CMD_PARAM_OPT, 0, 0},
{CMD_PARAM_VAR | CMD_PARAM_OPT, 0, 0}, {0,0,0}},
ALL_ROUTES},
{"rtpengine_offer", (cmd_function)rtpengine_offer_f, {
{CMD_PARAM_STR | CMD_PARAM_OPT, 0, 0},
{CMD_PARAM_VAR | CMD_PARAM_OPT, 0, 0},
Expand Down Expand Up @@ -3521,6 +3529,12 @@ stop_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar)
return rtpe_function_call_simple(msg, OP_STOP_RECORDING, flags, NULL, NULL, spvar);
}

static int
pause_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar)
{
return rtpe_function_call_simple(msg, OP_PAUSE_RECORDING, flags, NULL, NULL, spvar);
}

/**
* Gets the rtp stats and tries to store them in a context, if that's possible
* Returns:
Expand Down

0 comments on commit 75ba5c2

Please sign in to comment.