mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
app_mixmonitor: Add AMI events MixMonitorStart, -Stop and -Mute.
ASTERISK-29244 Change-Id: I1862d58264c2c8b5d8983272cb29734b184d67c5
This commit is contained in:
committed by
Friendly Automation
parent
5e998d8bd3
commit
6e695c867f
@@ -51,6 +51,8 @@
|
||||
#include "asterisk/channel.h"
|
||||
#include "asterisk/autochan.h"
|
||||
#include "asterisk/manager.h"
|
||||
#include "asterisk/stasis.h"
|
||||
#include "asterisk/stasis_channels.h"
|
||||
#include "asterisk/callerid.h"
|
||||
#include "asterisk/mod_format.h"
|
||||
#include "asterisk/linkedlists.h"
|
||||
@@ -295,6 +297,51 @@
|
||||
</parameter>
|
||||
</syntax>
|
||||
</function>
|
||||
<managerEvent language="en_US" name="MixMonitorStart">
|
||||
<managerEventInstance class="EVENT_FLAG_CALL">
|
||||
<synopsis>Raised when monitoring has started on a channel.</synopsis>
|
||||
<syntax>
|
||||
<channel_snapshot/>
|
||||
</syntax>
|
||||
<see-also>
|
||||
<ref type="managerEvent">MixMonitorStop</ref>
|
||||
<ref type="application">MixMonitor</ref>
|
||||
<ref type="manager">MixMonitor</ref>
|
||||
</see-also>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
<managerEvent language="en_US" name="MixMonitorStop">
|
||||
<managerEventInstance class="EVENT_FLAG_CALL">
|
||||
<synopsis>Raised when monitoring has stopped on a channel.</synopsis>
|
||||
<syntax>
|
||||
<channel_snapshot/>
|
||||
</syntax>
|
||||
<see-also>
|
||||
<ref type="managerEvent">MixMonitorStart</ref>
|
||||
<ref type="application">StopMixMonitor</ref>
|
||||
<ref type="manager">StopMixMonitor</ref>
|
||||
</see-also>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
<managerEvent language="en_US" name="MixMonitorMute">
|
||||
<managerEventInstance class="EVENT_FLAG_CALL">
|
||||
<synopsis>Raised when monitoring is muted or unmuted on a channel.</synopsis>
|
||||
<syntax>
|
||||
<channel_snapshot/>
|
||||
<parameter name="Direction">
|
||||
<para>Which part of the recording was muted or unmuted: read, write or both
|
||||
(from channel, to channel or both directions).</para>
|
||||
</parameter>
|
||||
<parameter name="State">
|
||||
<para>If the monitoring was muted or unmuted: 1 when muted, 0 when unmuted.</para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<see-also>
|
||||
<ref type="manager">MixMonitorMute</ref>
|
||||
</see-also>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
|
||||
|
||||
***/
|
||||
|
||||
@@ -1077,6 +1124,7 @@ static int mixmonitor_exec(struct ast_channel *chan, const char *data)
|
||||
struct ast_flags flags = { 0 };
|
||||
char *recipients = NULL;
|
||||
char *parse;
|
||||
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
|
||||
AST_DECLARE_APP_ARGS(args,
|
||||
AST_APP_ARG(filename);
|
||||
AST_APP_ARG(options);
|
||||
@@ -1197,6 +1245,12 @@ static int mixmonitor_exec(struct ast_channel *chan, const char *data)
|
||||
ast_module_unref(ast_module_info->self);
|
||||
}
|
||||
|
||||
message = ast_channel_blob_create_from_cache(ast_channel_uniqueid(chan),
|
||||
ast_channel_mixmonitor_start_type(), NULL);
|
||||
if (message) {
|
||||
stasis_publish(ast_channel_topic(chan), message);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1206,6 +1260,7 @@ static int stop_mixmonitor_full(struct ast_channel *chan, const char *data)
|
||||
char *parse = "";
|
||||
struct mixmonitor_ds *mixmonitor_ds;
|
||||
const char *beep_id = NULL;
|
||||
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
|
||||
|
||||
AST_DECLARE_APP_ARGS(args,
|
||||
AST_APP_ARG(mixmonid);
|
||||
@@ -1263,6 +1318,13 @@ static int stop_mixmonitor_full(struct ast_channel *chan, const char *data)
|
||||
ast_beep_stop(chan, beep_id);
|
||||
}
|
||||
|
||||
message = ast_channel_blob_create_from_cache(ast_channel_uniqueid(chan),
|
||||
ast_channel_mixmonitor_stop_type(),
|
||||
NULL);
|
||||
if (message) {
|
||||
stasis_publish(ast_channel_topic(chan), message);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1350,6 +1412,8 @@ static int manager_mute_mixmonitor(struct mansession *s, const struct message *m
|
||||
const char *direction = astman_get_header(m,"Direction");
|
||||
int clearmute = 1;
|
||||
enum ast_audiohook_flags flag;
|
||||
RAII_VAR(struct stasis_message *, stasis_message, NULL, ao2_cleanup);
|
||||
RAII_VAR(struct ast_json *, stasis_message_blob, NULL, ast_json_unref);
|
||||
|
||||
if (ast_strlen_zero(direction)) {
|
||||
astman_send_error(s, m, "No direction specified. Must be read, write or both");
|
||||
@@ -1391,6 +1455,17 @@ static int manager_mute_mixmonitor(struct mansession *s, const struct message *m
|
||||
return AMI_SUCCESS;
|
||||
}
|
||||
|
||||
stasis_message_blob = ast_json_pack("{s: s, s: b}",
|
||||
"direction", direction,
|
||||
"state", ast_true(state));
|
||||
|
||||
stasis_message = ast_channel_blob_create_from_cache(ast_channel_uniqueid(c),
|
||||
ast_channel_mixmonitor_mute_type(), stasis_message_blob);
|
||||
|
||||
if (stasis_message) {
|
||||
stasis_publish(ast_channel_topic(c), stasis_message);
|
||||
}
|
||||
|
||||
astman_append(s, "Response: Success\r\n");
|
||||
|
||||
if (!ast_strlen_zero(id)) {
|
||||
|
Reference in New Issue
Block a user