[svn-commits] dhubbard: trunk r84019 - in /trunk: ./ channels/ include/asterisk/ main/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Sep 27 18:18:09 CDT 2007
Author: dhubbard
Date: Thu Sep 27 18:18:09 2007
New Revision: 84019
URL: http://svn.digium.com/view/asterisk?view=rev&rev=84019
Log:
Merged revisions 84018 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r84018 | dhubbard | 2007-09-27 18:12:25 -0500 (Thu, 27 Sep 2007) | 1 line
if an Agent is redirected, the base channel should actually be redirected. This was causing multiple issues, especially issue 7706 and BE-160
........
Modified:
trunk/ (props changed)
trunk/channels/chan_agent.c
trunk/include/asterisk/channel.h
trunk/main/manager.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=84019&r1=84018&r2=84019
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Thu Sep 27 18:18:09 2007
@@ -231,6 +231,8 @@
static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge);
static void set_agentbycallerid(const char *callerid, const char *agent);
static char *complete_agent_logoff_cmd(const char *line, const char *word, int pos, int state);
+static struct ast_channel* agent_get_base_channel(struct ast_channel *chan);
+static int agent_set_base_channel(struct ast_channel *chan, struct ast_channel *base);
/*! \brief Channel interface description for PBX integration */
static const struct ast_channel_tech agent_tech = {
@@ -253,6 +255,8 @@
.indicate = agent_indicate,
.fixup = agent_fixup,
.bridged_channel = agent_bridgedchannel,
+ .get_base_channel = agent_get_base_channel,
+ .set_base_channel = agent_set_base_channel,
};
/*!
@@ -696,6 +700,37 @@
snprintf(buf, sizeof(buf), "%s_%s", GETAGENTBYCALLERID, callerid);
pbx_builtin_setvar_helper(NULL, buf, agent);
+}
+
+struct ast_channel* agent_get_base_channel(struct ast_channel *chan)
+{
+ struct agent_pvt *p = NULL;
+ struct ast_channel *base = NULL;
+
+ if (!chan || !chan->tech_pvt) {
+ ast_log(LOG_ERROR, "whoa, you need a channel (0x%ld) with a tech_pvt (0x%ld) to get a base channel.\n", (long)chan, (chan)?(long)chan->tech_pvt:(long)NULL);
+ } else {
+ p = chan->tech_pvt;
+ base = p->chan;
+ }
+ return base;
+}
+
+int agent_set_base_channel(struct ast_channel *chan, struct ast_channel *base)
+{
+ struct agent_pvt *p = NULL;
+
+ if (!chan || !base) {
+ ast_log(LOG_ERROR, "whoa, you need a channel (0x%ld) and a base channel (0x%ld) for setting.\n", (long)chan, (long)base);
+ return -1;
+ }
+ p = chan->tech_pvt;
+ if (!p) {
+ ast_log(LOG_ERROR, "whoa, channel %s is missing his tech_pvt structure!!.\n", chan->name);
+ return -1;
+ }
+ p->chan = base;
+ return 0;
}
static int agent_hangup(struct ast_channel *ast)
Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=84019&r1=84018&r2=84019
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Thu Sep 27 18:18:09 2007
@@ -314,6 +314,12 @@
/*! \brief Provide additional write items for CHANNEL() dialplan function */
int (* func_channel_write)(struct ast_channel *chan, const char *function, char *data, const char *value);
+
+ /*! \brief Retrieve base channel (agent and local) */
+ struct ast_channel* (* get_base_channel)(struct ast_channel *chan);
+
+ /*! \brief Set base channel (agent and local) */
+ int (* set_base_channel)(struct ast_channel *chan, struct ast_channel *base);
};
struct ast_epoll_data;
Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=84019&r1=84018&r2=84019
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Thu Sep 27 18:18:09 2007
@@ -1787,7 +1787,7 @@
const char *exten = astman_get_header(m, "Exten");
const char *context = astman_get_header(m, "Context");
const char *priority = astman_get_header(m, "Priority");
- struct ast_channel *chan, *chan2 = NULL;
+ struct ast_channel *base, *chan, *chan2 = NULL;
int pi = 0;
int res;
@@ -1809,6 +1809,14 @@
astman_send_error(s, m, buf);
return 0;
}
+ if (chan->tech->get_base_channel) {
+ base = chan->tech->get_base_channel(chan);
+ if (base) {
+ ast_mutex_unlock(&chan->lock);
+ chan = base;
+ ast_mutex_lock(&chan->lock);
+ }
+ }
if (ast_check_hangup(chan)) {
astman_send_error(s, m, "Redirect failed, channel not up.\n");
ast_channel_unlock(chan);
@@ -1821,6 +1829,14 @@
ast_channel_unlock(chan);
ast_channel_unlock(chan2);
return 0;
+ }
+ if (chan2 && chan2->tech->get_base_channel) {
+ base = chan2->tech->get_base_channel(chan2);
+ if (base) {
+ ast_mutex_unlock(&chan2->lock);
+ chan2 = base;
+ ast_mutex_lock(&chan2->lock);
+ }
}
res = ast_async_goto(chan, context, exten, pi);
if (!res) {
More information about the svn-commits
mailing list