]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge Script <automerge@asterisk.org>
Thu, 5 Jul 2007 14:26:28 +0000 (14:26 +0000)
committerAutomerge Script <automerge@asterisk.org>
Thu, 5 Jul 2007 14:26:28 +0000 (14:26 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@73366 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_chanspy.c
apps/app_queue.c
channel.c
channels/chan_local.c

index 6b30842b838c5a94f33de7d37f4b267318845c8e..7510c68e94ea42ea6a633532538eaf043ade1083 100644 (file)
@@ -329,9 +329,10 @@ static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int
 
        ast_deactivate_generator(chan);
        
+       csth.spy.status = CHANSPY_DONE;
+
        ast_mutex_lock(&csth.spy.lock);
        if (csth.spy.chan) {
-               csth.spy.status = CHANSPY_DONE;
                ast_mutex_lock(&csth.spy.chan->lock);
                ast_channel_spy_remove(csth.spy.chan, &csth.spy);
                ast_mutex_unlock(&csth.spy.chan->lock);
index 730c1153f15ad919d2ffa1544dcd89e4c045d344..cedf9983e3e99c87e627bc7cd47b031c24293eeb 100644 (file)
@@ -3627,8 +3627,7 @@ static int manager_queues_status( struct mansession *s, struct message *m )
 
                /* List queue properties */
                if (ast_strlen_zero(queuefilter) || !strcmp(q->name, queuefilter)) {
-                       if(q->callscompleted > 0)
-                               sl = 100*((float)q->callscompletedinsl/(float)q->callscompleted);
+                       sl = ((q->callscompleted > 0) ? 100*((float)q->callscompletedinsl/(float)q->callscompleted) : 0);
                        ast_cli(s->fd, "Event: QueueParams\r\n"
                                                "Queue: %s\r\n"
                                                "Max: %d\r\n"
index a96d7d2d4cbec85acbde1c47f0cc24d2e355e233..5f8a9f99d73b1bed51173ed087d1afaa247b445c 100644 (file)
--- a/channel.c
+++ b/channel.c
@@ -1047,21 +1047,19 @@ static void spy_cleanup(struct ast_channel *chan)
 /* Detach a spy from it's channel */
 static void spy_detach(struct ast_channel_spy *spy, struct ast_channel *chan)
 {
-       ast_mutex_lock(&spy->lock);
-
        /* We only need to poke them if they aren't already done */
        if (spy->status != CHANSPY_DONE) {
+               ast_mutex_lock(&spy->lock);
                spy->status = CHANSPY_STOP;
                spy->chan = NULL;
                if (ast_test_flag(spy, CHANSPY_TRIGGER_MODE) != CHANSPY_TRIGGER_NONE)
                        ast_cond_signal(&spy->trigger);
+               ast_mutex_unlock(&spy->lock);
        }
        
        /* Print it out while we still have a lock so the structure can't go away (if signalled above) */
        ast_log(LOG_DEBUG, "Spy %s removed from channel %s\n", spy->type, chan->name);
 
-       ast_mutex_unlock(&spy->lock);
-
        return;
 }
 
@@ -1073,13 +1071,10 @@ void ast_channel_spy_stop_by_type(struct ast_channel *chan, const char *type)
                return;
 
        AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->spies->list, spy, list) {
-               ast_mutex_lock(&spy->lock);
                if ((spy->type == type) && (spy->status == CHANSPY_RUNNING)) {
-                       ast_mutex_unlock(&spy->lock);
                        AST_LIST_REMOVE_CURRENT(&chan->spies->list, list);
                        spy_detach(spy, chan);
-               } else
-                       ast_mutex_unlock(&spy->lock);
+               }
        }
        AST_LIST_TRAVERSE_SAFE_END
        spy_cleanup(chan);
@@ -1198,6 +1193,8 @@ static void queue_frame_to_spies(struct ast_channel *chan, struct ast_frame *f,
        trans = (dir == SPY_READ) ? &chan->spies->read_translator : &chan->spies->write_translator;
 
        AST_LIST_TRAVERSE(&chan->spies->list, spy, list) {
+               if (spy->status != CHANSPY_RUNNING)
+                       continue;
                ast_mutex_lock(&spy->lock);
 
                queue = (dir == SPY_READ) ? &spy->read_queue : &spy->write_queue;
index 9dceded67b20312bde3cbf8c58f499d8c873fc58..9a0f8d61bd78a140602643288610a111d3f790ab 100644 (file)
@@ -391,10 +391,10 @@ static int local_call(struct ast_channel *ast, char *dest, int timeout)
                }
        }
 
-       p->launchedpbx = 1;
-
        /* Start switch on sub channel */
-       res = ast_pbx_start(p->chan);
+       if (!(res = ast_pbx_start(p->chan)))
+               p->launchedpbx = 1;
+
        ast_mutex_unlock(&p->lock);
        return res;
 }