Skip to content
Snippets Groups Projects
Commit a08c4b20 authored by Joshua Colp's avatar Joshua Colp
Browse files

A 'b' option has been added which causes chan_local to return the actual...

A 'b' option has been added which causes chan_local to return the actual channel that is behind it when queried. This is useful for transfer scenarios as the actual channel will be transferred, not the Local channel. If you have been using Local channels as queue members and having issues when the agent did a blind transfer this option may solve the issue.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114049 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent d13b4556
No related branches found
No related tags found
No related merge requests found
......@@ -257,6 +257,9 @@ Local channel changes
SIP call to Voicemail by putting a Local channel in the middle. This
feature is enabled by using the 'j' option in the Dial string to the Local
channel in conjunction with the existing 'n' option for local channels.
* A 'b' option has been added which causes chan_local to return the actual channel
that is behind it when queried. This is useful for transfer scenarios as the
actual channel will be transferred, not the Local channel.
Zaptel channel driver (chan_zap) Changes
----------------------------------------
......
......@@ -74,6 +74,7 @@ static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
static int local_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen);
static int local_sendtext(struct ast_channel *ast, const char *text);
static int local_devicestate(void *data);
static struct ast_channel *local_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge);
/* PBX interface structure for channel registration */
static const struct ast_channel_tech local_tech = {
......@@ -95,6 +96,7 @@ static const struct ast_channel_tech local_tech = {
.send_html = local_sendhtml,
.send_text = local_sendtext,
.devicestate = local_devicestate,
.bridged_channel = local_bridgedchannel,
};
struct local_pvt {
......@@ -116,6 +118,7 @@ struct local_pvt {
#define LOCAL_ALREADY_MASQED (1 << 2) /*!< Already masqueraded */
#define LOCAL_LAUNCHED_PBX (1 << 3) /*!< PBX was launched */
#define LOCAL_NO_OPTIMIZATION (1 << 4) /*!< Do not optimize using masquerading */
#define LOCAL_BRIDGE (1 << 5) /*!< Report back the "true" channel as being bridged to */
static AST_LIST_HEAD_STATIC(locals, local_pvt);
......@@ -167,6 +170,28 @@ static struct local_pvt *local_pvt_destroy(struct local_pvt *pvt)
return NULL;
}
/*! \brief Return the bridged channel of a Local channel */
static struct ast_channel *local_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge)
{
struct local_pvt *p = bridge->tech_pvt;
struct ast_channel *bridged = bridge;
ast_mutex_lock(&p->lock);
if (ast_test_flag(p, LOCAL_BRIDGE)) {
/* Find the opposite channel */
bridged = (bridge == p->owner ? p->chan : p->owner);
/* Now see if the opposite channel is bridged to anything */
if (bridged->_bridge)
bridged = bridged->_bridge;
}
ast_mutex_unlock(&p->lock);
return bridged;
}
static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us)
{
struct ast_channel *other = NULL;
......@@ -601,6 +626,9 @@ static struct local_pvt *local_alloc(const char *data, int format)
"to use the 'j' option to enable the jitterbuffer\n");
}
}
if (strchr(opts, 'b')) {
ast_set_flag(tmp, LOCAL_BRIDGE);
}
}
/* Look for a context */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment