Skip to content

Commit

Permalink
rtpengine: add stop recording functions
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Jun 7, 2019
1 parent 14b8f4b commit 1aa3e9b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
30 changes: 29 additions & 1 deletion modules/rtpengine/doc/rtpengine_admin.xml
Expand Up @@ -815,7 +815,7 @@ rtpengine_manage();
</para></listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
This function can be used from any route.
</para>
<example>
<title><function>rtpengine_start_recording</function> usage</title>
Expand All @@ -827,6 +827,34 @@ rtpengine_start_recording();
</example>
</section>

<section id="func_rtpengine_stop_recording" xreflabel="rtpengine_stop_recording()">
<title>
<function moreinfo="none">rtpengine_stop_recording([sock_var])</function>
</title>
<para>
This function will send a signal to the &rtp; proxy to stop
recording the RTP stream on the &rtp; proxy.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<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_stop_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
12 changes: 12 additions & 0 deletions modules/rtpengine/rtpengine.c
Expand Up @@ -138,6 +138,7 @@ enum rtpe_operation {
OP_ANSWER,
OP_DELETE,
OP_START_RECORDING,
OP_STOP_RECORDING,
OP_QUERY,
OP_START_MEDIA,
OP_STOP_MEDIA,
Expand Down Expand Up @@ -206,6 +207,7 @@ static const char *command_strings[] = {
[OP_ANSWER] = "answer",
[OP_DELETE] = "delete",
[OP_START_RECORDING] = "start recording",
[OP_STOP_RECORDING] = "stop recording",
[OP_QUERY] = "query",
[OP_START_MEDIA]= "play media",
[OP_STOP_MEDIA] = "stop media",
Expand Down Expand Up @@ -241,6 +243,7 @@ static const str stat_maps[] = {
static char *gencookie();
static int rtpe_test(struct rtpe_node*, int, int);
static int start_recording_f(struct sip_msg* msg, pv_spec_t *spvar);
static int stop_recording_f(struct sip_msg* msg, 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 @@ -342,6 +345,9 @@ static cmd_export_t cmds[] = {
{"rtpengine_start_recording", (cmd_function)start_recording_f, {
{CMD_PARAM_VAR | CMD_PARAM_OPT, fixup_set_id, fixup_free_set_id}, {0,0,0}},
ANY_ROUTE},
{"rtpengine_stop_recording", (cmd_function)stop_recording_f, {
{CMD_PARAM_VAR | CMD_PARAM_OPT, fixup_set_id, fixup_free_set_id}, {0,0,0}},
ANY_ROUTE},
{"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 @@ -2610,6 +2616,12 @@ start_recording_f(struct sip_msg* msg, pv_spec_t *spvar)
return rtpe_function_call_simple(msg, OP_START_RECORDING, NULL, spvar);
}

static int
stop_recording_f(struct sip_msg* msg, pv_spec_t *spvar)
{
return rtpe_function_call_simple(msg, OP_STOP_RECORDING, 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 1aa3e9b

Please sign in to comment.