Fix agent moh issue (bug #3383)
authorMark Spencer <markster@digium.com>
Tue, 1 Feb 2005 07:09:56 +0000 (07:09 +0000)
committerMark Spencer <markster@digium.com>
Tue, 1 Feb 2005 07:09:56 +0000 (07:09 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4943 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_agent.c
cli.c

index 1762f13..5a67220 100755 (executable)
@@ -552,6 +552,8 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout)
                        if (recordagentcalls)
                                agent_start_monitoring(ast,0);
                        p->acknowledged = 1;
+                       if (p->chan)
+                               p->chan->_bridge = ast;
                }
                res = 0;
        }
@@ -759,13 +761,16 @@ static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct
 {
        struct agent_pvt *p;
        struct ast_channel *ret=NULL;
+       
 
        p = bridge->pvt->pvt;
        if (chan == p->chan)
                ret = bridge->_bridge;
        else if (chan == bridge->_bridge)
                ret = p->chan;
-       return NULL;
+       if (option_debug)
+               ast_log(LOG_DEBUG, "Asked for bridged channel on '%s'/'%s', returning '%s'\n", chan->name, bridge->name, ret ? ret->name : "<none>");
+       return ret;
 }
 
 /*--- agent_new: Create new agent channel ---*/
diff --git a/cli.c b/cli.c
index 70e3809..fdd87a3 100755 (executable)
--- a/cli.c
+++ b/cli.c
@@ -669,6 +669,8 @@ static int handle_showchan(int fd, int argc, char *argv[])
        "     Frames out: %d%s\n"
        " Time to Hangup: %ld\n"
        "   Elapsed Time: %s\n"
+       "  Direct Bridge: %s\n"
+       "Indirect Bridge: %s\n"
        " --   PBX   --\n"
        "        Context: %s\n"
        "      Extension: %s\n"
@@ -684,7 +686,7 @@ static int handle_showchan(int fd, int argc, char *argv[])
        (c->cid.cid_dnid ? c->cid.cid_dnid : "(N/A)" ), ast_state2str(c->_state), c->_state, c->rings, c->nativeformats, c->writeformat, c->readformat,
        c->fds[0], c->fin & 0x7fffffff, (c->fin & 0x80000000) ? " (DEBUGGED)" : "",
        c->fout & 0x7fffffff, (c->fout & 0x80000000) ? " (DEBUGGED)" : "", (long)c->whentohangup,
-       cdrtime,
+       cdrtime, c->_bridge ? c->_bridge->name : "<none>", ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", 
        c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ),
        ( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"),
        (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));