From: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri, 22 Nov 2019 09:37:02 -0500
Subject: [PATCH] rtpengine: add play_dtmf() command

---
 src/modules/rtpengine/rtpengine.c | 11 +++++++++++
 src/modules/rtpengine/rtpengine.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c
index 8b72e5b..dba5e62 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -138,6 +138,7 @@ static const char *command_strings[] = {
 	[OP_STOP_FORWARDING]	= "stop forwarding",
 	[OP_PLAY_MEDIA]		= "play media",
 	[OP_STOP_MEDIA]		= "stop media",
+	[OP_PLAY_DTMF]		= "play DTMF",
 };
 
 struct minmax_mos_stats {
@@ -197,6 +198,7 @@ static int start_forwarding_f(struct sip_msg *, char *, char *);
 static int stop_forwarding_f(struct sip_msg *, char *, char *);
 static int play_media_f(struct sip_msg *, char *, char *);
 static int stop_media_f(struct sip_msg *, char *, char *);
+static int play_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 *);
@@ -376,6 +378,9 @@ static cmd_export_t cmds[] = {
 	{"stop_media",		(cmd_function)stop_media_f, 		0,
 		0, 0,
 		ANY_ROUTE},
+	{"play_dtmf",		(cmd_function)play_dtmf_f, 		1,
+		fixup_spve_null, 0,
+		ANY_ROUTE},
 	{"rtpengine_offer",	(cmd_function)rtpengine_offer1_f,	0,
 		0, 0,
 		ANY_ROUTE},
@@ -3845,6 +3850,12 @@ stop_media_f(struct sip_msg* msg, char *str1, char *str2)
 	return rtpengine_generic_f(msg, str1, OP_STOP_MEDIA);
 }
 
+static int
+play_dtmf_f(struct sip_msg* msg, char *str1, char *str2)
+{
+	return rtpengine_generic_f(msg, str1, OP_PLAY_DTMF);
+}
+
 static int
 start_forwarding_f(struct sip_msg* msg, char *str1, char *str2)
 {
diff --git a/src/modules/rtpengine/rtpengine.h b/src/modules/rtpengine/rtpengine.h
index 8a29210..03999bf 100644
--- a/src/modules/rtpengine/rtpengine.h
+++ b/src/modules/rtpengine/rtpengine.h
@@ -46,6 +46,7 @@ enum rtpe_operation {
         OP_STOP_FORWARDING,
         OP_PLAY_MEDIA,
         OP_STOP_MEDIA,
+        OP_PLAY_DTMF,
 
         OP_ANY,
 };
