diff --git a/res/res_monitor.c b/res/res_monitor.c
index 83bd0a5a70..5f25d8dcea 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -45,6 +45,200 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/config.h"
#include "asterisk/options.h"
+/*** DOCUMENTATION
+
+
+ Monitor a channel.
+
+
+
+
+ optional, if not set, defaults to wav
+
+
+
+
+ if set, changes the filename used to the one specified.
+
+
+
+
+
+
+
+
+
+
+
+ Used to start monitoring a channel. The channel's input and output
+ voice packets are logged to files until the channel hangs up or
+ monitoring is stopped by the StopMonitor application.
+ By default, files are stored to /var/spool/asterisk/monitor/.
+ Returns -1 if monitor files can't be opened or if the channel is
+ already monitored, otherwise 0.
+
+
+ StopMonitor
+
+
+
+
+ Stop monitoring a channel.
+
+
+
+ Stops monitoring a channel. Has no effect if the channel is not monitored.
+
+
+
+
+ Change monitoring filename of a channel.
+
+
+
+ The new filename base to use for monitoring this channel.
+
+
+
+ Changes monitoring filename of a channel. Has no effect if the
+ channel is not monitored.
+
+
+
+
+ Pause monitoring of a channel.
+
+
+
+ Pauses monitoring of a channel until it is re-enabled by a call to UnpauseMonitor.
+
+
+ UnpauseMonitor
+
+
+
+
+ Unpause monitoring of a channel.
+
+
+
+ Unpauses monitoring of a channel on which monitoring had
+ previously been paused with PauseMonitor.
+
+
+ PauseMonitor
+
+
+
+
+ Monitor a channel.
+
+
+
+
+ Used to specify the channel to record.
+
+
+ Is the name of the file created in the monitor spool directory.
+ Defaults to the same name as the channel (with slashes replaced with dashes).
+
+
+ Is the audio recording format. Defaults to wav.
+
+
+ Boolean parameter as to whether to mix the input and output channels
+ together after the recording is finished.
+
+
+
+ This action may be used to record the audio on a
+ specified channel.
+
+
+
+
+ Stop monitoring a channel.
+
+
+
+
+ The name of the channel monitored.
+
+
+
+ This action may be used to end a previously started 'Monitor' action.
+
+
+
+
+ Change monitoring filename of a channel.
+
+
+
+
+ Used to specify the channel to record.
+
+
+ Is the new name of the file created in the
+ monitor spool directory.
+
+
+
+ This action may be used to change the file
+ started by a previous 'Monitor' action.
+
+
+
+
+ Pause monitoring of a channel.
+
+
+
+
+ Used to specify the channel to record.
+
+
+
+ This action may be used to temporarily stop the
+ recording of a channel.
+
+
+
+
+ Unpause monitoring of a channel.
+
+
+
+
+ Used to specify the channel to record.
+
+
+
+ This action may be used to re-enable recording
+ of a channel after calling PauseMonitor.
+
+
+
+ ***/
+
AST_MUTEX_DEFINE_STATIC(monitorlock);
#define LOCK_IF_NEEDED(lock, needed) do { \
@@ -59,62 +253,6 @@ AST_MUTEX_DEFINE_STATIC(monitorlock);
static unsigned long seq = 0;
-static char *monitor_synopsis = "Monitor a channel";
-
-static char *monitor_descrip = " Monitor([file_format[:urlbase],[fname_base],[options]]):\n"
-"Used to start monitoring a channel. The channel's input and output\n"
-"voice packets are logged to files until the channel hangs up or\n"
-"monitoring is stopped by the StopMonitor application.\n"
-" file_format optional, if not set, defaults to \"wav\"\n"
-" fname_base if set, changes the filename used to the one specified.\n"
-" options:\n"
-" m - when the recording ends mix the two leg files into one and\n"
-" delete the two leg files. If the variable MONITOR_EXEC is set, the\n"
-" application referenced in it will be executed instead of\n"
-#ifdef HAVE_SOXMIX
-" soxmix and the raw leg files will NOT be deleted automatically.\n"
-" soxmix or MONITOR_EXEC is handed 3 arguments, the two leg files\n"
-#else
-" sox and the raw leg files will NOT be deleted automatically.\n"
-" sox or MONITOR_EXEC is handed 3 arguments, the two leg files\n"
-#endif
-" and a target mixed file name which is the same as the leg file names\n"
-" only without the in/out designator.\n"
-" If MONITOR_EXEC_ARGS is set, the contents will be passed on as\n"
-" additional arguments to MONITOR_EXEC\n"
-" Both MONITOR_EXEC and the Mix flag can be set from the\n"
-" administrator interface\n"
-"\n"
-" b - Don't begin recording unless a call is bridged to another channel\n"
-" i - Skip recording of input stream (disables m option)\n"
-" o - Skip recording of output stream (disables m option)\n"
-"\nBy default, files are stored to /var/spool/asterisk/monitor/.\n"
-"\nReturns -1 if monitor files can't be opened or if the channel is already\n"
-"monitored, otherwise 0.\n"
-;
-
-static char *stopmonitor_synopsis = "Stop monitoring a channel";
-
-static char *stopmonitor_descrip = " StopMonitor():\n"
- "Stops monitoring a channel. Has no effect if the channel is not monitored\n";
-
-static char *changemonitor_synopsis = "Change monitoring filename of a channel";
-
-static char *changemonitor_descrip = " ChangeMonitor(filename_base):\n"
- "Changes monitoring filename of a channel. Has no effect if the channel is not monitored.\n"
- "The argument is the new filename base to use for monitoring this channel.\n";
-
-static char *pausemonitor_synopsis = "Pause monitoring of a channel";
-
-static char *pausemonitor_descrip = " PauseMonitor():\n"
- "Pauses monitoring of a channel until it is re-enabled by a call to UnpauseMonitor.\n";
-
-static char *unpausemonitor_synopsis = "Unpause monitoring of a channel";
-
-static char *unpausemonitor_descrip = " UnpauseMonitor():\n"
- "Unpauses monitoring of a channel on which monitoring had\n"
- "previously been paused with PauseMonitor.\n";
-
/*!
* \brief Change state of monitored channel
* \param chan
@@ -552,20 +690,6 @@ static int change_monitor_exec(struct ast_channel *chan, const char *data)
return ast_monitor_change_fname(chan, data, 1);
}
-static const char start_monitor_action_help[] =
-"Description: The 'Monitor' action may be used to record the audio on a\n"
-" specified channel. The following parameters may be used to control\n"
-" this:\n"
-" Channel - Required. Used to specify the channel to record.\n"
-" File - Optional. Is the name of the file created in the\n"
-" monitor spool directory. Defaults to the same name\n"
-" as the channel (with slashes replaced with dashes).\n"
-" Format - Optional. Is the audio recording format. Defaults\n"
-" to \"wav\".\n"
-" Mix - Optional. Boolean parameter as to whether to mix\n"
-" the input and output channels together after the\n"
-" recording is finished.\n";
-
/*! \brief Start monitoring a channel by manager connection */
static int start_monitor_action(struct mansession *s, const struct message *m)
{
@@ -618,11 +742,6 @@ static int start_monitor_action(struct mansession *s, const struct message *m)
return 0;
}
-static const char stop_monitor_action_help[] =
-"Description: The 'StopMonitor' action may be used to end a previously\n"
-" started 'Monitor' action. The only parameter is 'Channel', the name\n"
-" of the channel monitored.\n";
-
/*! \brief Stop monitoring a channel by manager connection */
static int stop_monitor_action(struct mansession *s, const struct message *m)
{
@@ -654,14 +773,6 @@ static int stop_monitor_action(struct mansession *s, const struct message *m)
return 0;
}
-static const char change_monitor_action_help[] =
-"Description: The 'ChangeMonitor' action may be used to change the file\n"
-" started by a previous 'Monitor' action. The following parameters may\n"
-" be used to control this:\n"
-" Channel - Required. Used to specify the channel to record.\n"
-" File - Required. Is the new name of the file created in the\n"
-" monitor spool directory.\n";
-
/*! \brief Change filename of a monitored channel by manager connection */
static int change_monitor_action(struct mansession *s, const struct message *m)
{
@@ -737,23 +848,11 @@ static int do_pause_or_unpause(struct mansession *s, const struct message *m, in
return 0;
}
-static const char pause_monitor_action_help[] =
- "Description: The 'PauseMonitor' action may be used to temporarily stop the\n"
- " recording of a channel. The following parameters may\n"
- " be used to control this:\n"
- " Channel - Required. Used to specify the channel to record.\n";
-
static int pause_monitor_action(struct mansession *s, const struct message *m)
{
return do_pause_or_unpause(s, m, MONITOR_ACTION_PAUSE);
}
-static const char unpause_monitor_action_help[] =
- "Description: The 'UnpauseMonitor' action may be used to re-enable recording\n"
- " of a channel after calling PauseMonitor. The following parameters may\n"
- " be used to control this:\n"
- " Channel - Required. Used to specify the channel to record.\n";
-
static int unpause_monitor_action(struct mansession *s, const struct message *m)
{
return do_pause_or_unpause(s, m, MONITOR_ACTION_UNPAUSE);
@@ -762,16 +861,16 @@ static int unpause_monitor_action(struct mansession *s, const struct message *m)
static int load_module(void)
{
- ast_register_application("Monitor", start_monitor_exec, monitor_synopsis, monitor_descrip);
- ast_register_application("StopMonitor", stop_monitor_exec, stopmonitor_synopsis, stopmonitor_descrip);
- ast_register_application("ChangeMonitor", change_monitor_exec, changemonitor_synopsis, changemonitor_descrip);
- ast_register_application("PauseMonitor", pause_monitor_exec, pausemonitor_synopsis, pausemonitor_descrip);
- ast_register_application("UnpauseMonitor", unpause_monitor_exec, unpausemonitor_synopsis, unpausemonitor_descrip);
- ast_manager_register2("Monitor", EVENT_FLAG_CALL, start_monitor_action, monitor_synopsis, start_monitor_action_help);
- ast_manager_register2("StopMonitor", EVENT_FLAG_CALL, stop_monitor_action, stopmonitor_synopsis, stop_monitor_action_help);
- ast_manager_register2("ChangeMonitor", EVENT_FLAG_CALL, change_monitor_action, changemonitor_synopsis, change_monitor_action_help);
- ast_manager_register2("PauseMonitor", EVENT_FLAG_CALL, pause_monitor_action, pausemonitor_synopsis, pause_monitor_action_help);
- ast_manager_register2("UnpauseMonitor", EVENT_FLAG_CALL, unpause_monitor_action, unpausemonitor_synopsis, unpause_monitor_action_help);
+ ast_register_application_xml("Monitor", start_monitor_exec);
+ ast_register_application_xml("StopMonitor", stop_monitor_exec);
+ ast_register_application_xml("ChangeMonitor", change_monitor_exec);
+ ast_register_application_xml("PauseMonitor", pause_monitor_exec);
+ ast_register_application_xml("UnpauseMonitor", unpause_monitor_exec);
+ ast_manager_register_xml("Monitor", EVENT_FLAG_CALL, start_monitor_action);
+ ast_manager_register_xml("StopMonitor", EVENT_FLAG_CALL, stop_monitor_action);
+ ast_manager_register_xml("ChangeMonitor", EVENT_FLAG_CALL, change_monitor_action);
+ ast_manager_register_xml("PauseMonitor", EVENT_FLAG_CALL, pause_monitor_action);
+ ast_manager_register_xml("UnpauseMonitor", EVENT_FLAG_CALL, unpause_monitor_action);
return AST_MODULE_LOAD_SUCCESS;
}