[asterisk-commits] branch 1.2 - r7740 in /branches/1.2: ./ apps/
include/asterisk/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Jan 3 11:24:57 CST 2006
Author: kpfleming
Date: Tue Jan 3 11:24:56 2006
New Revision: 7740
URL: http://svn.digium.com/view/asterisk?rev=7740&view=rev
Log:
revert incorrect fix for bug #6048 from revision 7709
put in correct (simpler) fix
add doxygen docs for channel spy 'state' values
Modified:
branches/1.2/apps/app_chanspy.c
branches/1.2/apps/app_mixmonitor.c
branches/1.2/channel.c
branches/1.2/include/asterisk/chanspy.h
Modified: branches/1.2/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_chanspy.c?rev=7740&r1=7739&r2=7740&view=diff
==============================================================================
--- branches/1.2/apps/app_chanspy.c (original)
+++ branches/1.2/apps/app_chanspy.c Tue Jan 3 11:24:56 2006
@@ -208,9 +208,9 @@
static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy)
{
- /* If our status has changed, then the channel we're spying on is gone....
+ /* If our status has changed to DONE, then the channel we're spying on is gone....
DON'T TOUCH IT!!! RUN AWAY!!! */
- if (spy->status != CHANSPY_RUNNING)
+ if (spy->status == CHANSPY_DONE)
return;
if (!chan)
Modified: branches/1.2/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_mixmonitor.c?rev=7740&r1=7739&r2=7740&view=diff
==============================================================================
--- branches/1.2/apps/app_mixmonitor.c (original)
+++ branches/1.2/apps/app_mixmonitor.c Tue Jan 3 11:24:56 2006
@@ -79,7 +79,6 @@
static const char *mixmonitor_spy_type = "MixMonitor";
struct mixmonitor {
- AST_LIST_ENTRY(mixmonitor) list;
struct ast_channel *chan;
char *filename;
char *post_process;
@@ -88,15 +87,12 @@
int writevol;
};
-AST_LIST_HEAD_STATIC(monitors, mixmonitor);
-
enum {
MUXFLAG_APPEND = (1 << 1),
MUXFLAG_BRIDGED = (1 << 2),
MUXFLAG_VOLUME = (1 << 3),
MUXFLAG_READVOLUME = (1 << 4),
MUXFLAG_WRITEVOLUME = (1 << 5),
- FLAG_STOP = (1 << 6),
} mixmonitor_flags;
enum {
@@ -116,9 +112,9 @@
static void stopmon(struct ast_channel *chan, struct ast_channel_spy *spy)
{
- /* If our status has changed, then the channel we're spying on is gone....
+ /* If our status has changed to DONE, then the channel we're spying on is gone....
DON'T TOUCH IT!!! RUN AWAY!!! */
- if (spy->status != CHANSPY_RUNNING)
+ if (spy->status == CHANSPY_DONE)
return;
if (!chan)
@@ -160,10 +156,6 @@
char post_process[1024] = "";
STANDARD_INCREMENT_USECOUNT;
-
- AST_LIST_LOCK(&monitors);
- AST_LIST_INSERT_HEAD(&monitors, mixmonitor, list);
- AST_LIST_UNLOCK(&monitors);
name = ast_strdupa(mixmonitor->chan->name);
@@ -219,7 +211,7 @@
ast_channel_spy_trigger_wait(&spy);
- if (ast_check_hangup(mixmonitor->chan) || spy.status != CHANSPY_RUNNING || ast_test_flag(mixmonitor, FLAG_STOP)) {
+ if (ast_check_hangup(mixmonitor->chan) || spy.status != CHANSPY_RUNNING) {
ast_mutex_unlock(&spy.lock);
break;
}
@@ -245,8 +237,6 @@
ast_mutex_unlock(&spy.lock);
}
- stopmon(mixmonitor->chan, &spy);
-
if (mixmonitor->post_process) {
char *p;
@@ -258,6 +248,8 @@
pbx_substitute_variables_helper(mixmonitor->chan, mixmonitor->post_process, post_process, sizeof(post_process) - 1);
}
+ stopmon(mixmonitor->chan, &spy);
+
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "End MixMonitor Recording %s\n", name);
@@ -274,10 +266,6 @@
ast_closestream(fs);
out:
- AST_LIST_LOCK(&monitors);
- AST_LIST_REMOVE(&monitors, mixmonitor, list);
- AST_LIST_UNLOCK(&monitors);
-
free(mixmonitor);
STANDARD_DECREMENT_USECOUNT;
@@ -408,7 +396,6 @@
static int mixmonitor_cli(int fd, int argc, char **argv)
{
struct ast_channel *chan;
- struct mixmonitor *mon;
if (argc < 3)
return RESULT_SHOWUSAGE;
@@ -420,13 +407,8 @@
if (!strcasecmp(argv[1], "start"))
mixmonitor_exec(chan, argv[3]);
- else if (!strcasecmp(argv[1], "stop")) {
- AST_LIST_TRAVERSE_SAFE_BEGIN(&monitors, mon, list) {
- if (chan == mon->chan)
- ast_set_flag(mon, FLAG_STOP);
- }
- AST_LIST_TRAVERSE_SAFE_END;
- }
+ else if (!strcasecmp(argv[1], "stop"))
+ ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
ast_mutex_unlock(&chan->lock);
Modified: branches/1.2/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channel.c?rev=7740&r1=7739&r2=7740&view=diff
==============================================================================
--- branches/1.2/channel.c (original)
+++ branches/1.2/channel.c Tue Jan 3 11:24:56 2006
@@ -1024,7 +1024,7 @@
AST_LIST_TRAVERSE(&chan->spies->list, spy, list) {
ast_mutex_lock(&spy->lock);
if ((spy->type == type) && (spy->status == CHANSPY_RUNNING)) {
- spy->status = CHANSPY_DONE;
+ spy->status = CHANSPY_STOP;
if (ast_test_flag(spy, CHANSPY_TRIGGER_MODE) != CHANSPY_TRIGGER_NONE)
ast_cond_signal(&spy->trigger);
}
Modified: branches/1.2/include/asterisk/chanspy.h
URL: http://svn.digium.com/view/asterisk/branches/1.2/include/asterisk/chanspy.h?rev=7740&r1=7739&r2=7740&view=diff
==============================================================================
--- branches/1.2/include/asterisk/chanspy.h (original)
+++ branches/1.2/include/asterisk/chanspy.h Tue Jan 3 11:24:56 2006
@@ -30,9 +30,10 @@
#include "asterisk/linkedlists.h"
enum chanspy_states {
- CHANSPY_NEW = 0,
- CHANSPY_RUNNING = 1,
- CHANSPY_DONE = 2,
+ CHANSPY_NEW = 0, /*!< spy not yet operating */
+ CHANSPY_RUNNING = 1, /*!< normal operation, spy is still operating */
+ CHANSPY_DONE = 2, /*!< spy is stopped and already removed from channel */
+ CHANSPY_STOP = 3, /*!< spy requested to stop, still attached to channel */
};
enum chanspy_flags {
More information about the asterisk-commits
mailing list