Skip to content

Commit

Permalink
rtpengine: add block_dtmf and unblock_dtmf
Browse files Browse the repository at this point in the history
  • Loading branch information
rfuchs committed Sep 6, 2018
1 parent 4625c75 commit e528fce
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/rtpengine/doc/rtpengine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<holder><ulink url='http://www.voipembedded.com'>VoIPEmbedded Inc.</ulink></holder>
</copyright>
<copyright>
<year>2013-2017</year>
<year>2013-2018</year>
<holder>Sipwise GmbH</holder>
</copyright>
</bookinfo>
Expand Down
41 changes: 41 additions & 0 deletions src/modules/rtpengine/doc/rtpengine_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2582,6 +2582,47 @@ stop_recording();
</example>
</section>

<section id="rtpengine.f.block_dtmf">
<title>
<function moreinfo="none">block_dtmf([flags])</function>
</title>
<para>
This function will instruct the &rtp; proxy to start blocking DTMF
event packets (RFC 4733). DTMF events will still be processed by the
&rtp; proxy, but they won't be forwarded to the receiving peer.
</para>
<para>
The call-id flag can be used to stop recording for a different call.
</para>
<para>
This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
</para>
<example>
<title><function>block_dtmf</function> usage</title>
<programlisting format="linespecific">
...
block_dtmf();
...
</programlisting>
</example>
</section>

<section id="rtpengine.f.unblock_dtmf">
<title>
<function moreinfo="none">unblock_dtmf([flags])</function>
</title>
<para>
Reverses the effects of a previously issued <function>block_dtmf</function> call.
<example>
<title><function>unblock_dtmf</function> usage</title>
<programlisting format="linespecific">
...
unblock_dtmf();
...
</programlisting>
</example>
</section>


</section>

Expand Down
31 changes: 31 additions & 0 deletions src/modules/rtpengine/rtpengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ static const char *command_strings[] = {
[OP_QUERY] = "query",
[OP_PING] = "ping",
[OP_STOP_RECORDING] = "stop recording",
[OP_BLOCK_DTMF] = "block DTMF",
[OP_UNBLOCK_DTMF] = "unblock DTMF",
};

struct minmax_mos_stats {
Expand Down Expand Up @@ -169,6 +171,8 @@ static char *gencookie();
static int rtpp_test(struct rtpp_node*, int, int);
static int start_recording_f(struct sip_msg *, char *, char *);
static int stop_recording_f(struct sip_msg *, char *, char *);
static int block_dtmf_f(struct sip_msg *, char *, char *);
static int unblock_dtmf_f(struct sip_msg *, char *, char *);
static int rtpengine_answer1_f(struct sip_msg *, char *, char *);
static int rtpengine_offer1_f(struct sip_msg *, char *, char *);
static int rtpengine_delete1_f(struct sip_msg *, char *, char *);
Expand Down Expand Up @@ -295,6 +299,12 @@ static cmd_export_t cmds[] = {
{"stop_recording", (cmd_function)stop_recording_f, 1,
fixup_spve_null, 0,
ANY_ROUTE},
{"block_dtmf", (cmd_function)block_dtmf_f, 0,
0, 0,
ANY_ROUTE },
{"unblock_dtmf", (cmd_function)unblock_dtmf_f, 0,
0, 0,
ANY_ROUTE},
{"rtpengine_offer", (cmd_function)rtpengine_offer1_f, 0,
0, 0,
ANY_ROUTE},
Expand Down Expand Up @@ -3526,6 +3536,27 @@ stop_recording_f(struct sip_msg* msg, char *str1, char *str2)
return rtpengine_rtpp_set_wrap(msg, rtpengine_stop_recording_wrap, flags.s, 1);
}


static int rtpengine_block_dtmf_wrap(struct sip_msg *msg, void *d, int more) {
return rtpp_function_call_simple(msg, OP_BLOCK_DTMF, d);
}

static int rtpengine_unblock_dtmf_wrap(struct sip_msg *msg, void *d, int more) {
return rtpp_function_call_simple(msg, OP_UNBLOCK_DTMF, d);
}

static int
block_dtmf_f(struct sip_msg* msg, char *str1, char *str2)
{
return rtpengine_rtpp_set_wrap(msg, rtpengine_block_dtmf_wrap, NULL, 1);
}

static int
unblock_dtmf_f(struct sip_msg* msg, char *str1, char *str2)
{
return rtpengine_rtpp_set_wrap(msg, rtpengine_unblock_dtmf_wrap, NULL, 1);
}

static int rtpengine_rtpstat_wrap(struct sip_msg *msg, void *d, int more) {
void **parms;
pv_param_t *param;
Expand Down
2 changes: 2 additions & 0 deletions src/modules/rtpengine/rtpengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ enum rtpe_operation {
OP_STOP_RECORDING,
OP_QUERY,
OP_PING,
OP_BLOCK_DTMF,
OP_UNBLOCK_DTMF,
};

struct rtpp_node {
Expand Down

0 comments on commit e528fce

Please sign in to comment.