# # old_revision [c98fd50d98138d2ecf4ce68e6a15972a9b5008db] # # patch "apps/app_mixmonitor.c" # from [ffa0d61a23665b254236d1ae5eef6aa047c5387d] # to [82bf35d4d3e29c07e1ae4a788725f6c0215287d8] # ============================================================ --- apps/app_mixmonitor.c ffa0d61a23665b254236d1ae5eef6aa047c5387d +++ apps/app_mixmonitor.c 82bf35d4d3e29c07e1ae4a788725f6c0215287d8 @@ -72,6 +72,16 @@ "The variable MIXMONITOR_FILENAME will contain the filename used to record.\n" ""; +static const char *stop_tdesc = "Stop Mixed Audio Monitoring Application"; +static const char *stop_app = "StopMixMonitor"; +static const char *stop_synopsis = "Stop recording a call through MixMonitor"; +static const char *stop_desc = "" +" StopMixMonitor()\n\n" +"Stops the audio recording that was started with a call to MixMonitor()\n" +"on the current channel.\n" +""; + + STANDARD_LOCAL_USER; LOCAL_USER_DECL; @@ -393,6 +403,21 @@ return 0; } +static int stop_mixmonitor_exec(struct ast_channel *chan, void *data) +{ + if (ast_mutex_lock(&chan->lock) == 0) + { + ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type); + ast_mutex_unlock(&chan->lock); + } + else + { + ast_log(LOG_WARNING, "Could not lock %s to stop MixMonitor\n", + chan->name); + } + return 0; +} + static int mixmonitor_cli(int fd, int argc, char **argv) { struct ast_channel *chan; @@ -429,6 +454,7 @@ int res; res = ast_cli_unregister(&cli_mixmonitor); + res |= ast_unregister_application(stop_app); res |= ast_unregister_application(app); STANDARD_HANGUP_LOCALUSERS; @@ -442,6 +468,7 @@ res = ast_cli_register(&cli_mixmonitor); res |= ast_register_application(app, mixmonitor_exec, synopsis, desc); + res |= ast_register_application(stop_app, stop_mixmonitor_exec, stop_synopsis, stop_desc); return res; }