summaryrefslogtreecommitdiff
path: root/main/dial.c
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-05-25 11:34:42 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2016-06-04 11:07:22 -0500
commit3e8d523d889351c69b21fdc563cb98d18a7bdb66 (patch)
tree88b04ab5d38f7e4c152163ea94702def95497a60 /main/dial.c
parentf7ce0f1832e9c7f13d1c66289a3d5659b664caaf (diff)
core/dial: New channel variable FORWARDERNAME
Added a new channel variable FORWARDERNAME which indicates which channel was responsible for a forwarding requests received on dial attempt. Fixed a bug in the app_queue: FORWARD_CONTEXT is not used. ASTERISK-26059 #close Change-Id: I34e93e8c1b5e17776a77b319703c48c8ca48e7b2
Diffstat (limited to 'main/dial.c')
-rw-r--r--main/dial.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/main/dial.c b/main/dial.c
index bac191e06..7677c5a7d 100644
--- a/main/dial.c
+++ b/main/dial.c
@@ -454,16 +454,24 @@ int ast_dial_prerun(struct ast_dial *dial, struct ast_channel *chan, struct ast_
}
/*! \brief Helper function that does the beginning dialing per-appended channel */
-static int begin_dial_channel(struct ast_dial_channel *channel, struct ast_channel *chan, int async, const char *predial_string)
+static int begin_dial_channel(struct ast_dial_channel *channel, struct ast_channel *chan, int async, const char *predial_string, struct ast_channel *forwarder_chan)
{
char numsubst[AST_MAX_EXTENSION];
int res = 1;
+ char forwarder[AST_CHANNEL_NAME];
/* If no owner channel exists yet execute pre-run */
if (!channel->owner && begin_dial_prerun(channel, chan, NULL, predial_string)) {
return 0;
}
+ if (forwarder_chan) {
+ ast_copy_string(forwarder, ast_channel_name(forwarder_chan), sizeof(forwarder));
+ ast_channel_lock(channel->owner);
+ pbx_builtin_setvar_helper(channel->owner, "FORWARDERNAME", forwarder);
+ ast_channel_unlock(channel->owner);
+ }
+
/* Copy device string over */
ast_copy_string(numsubst, channel->device, sizeof(numsubst));
@@ -494,7 +502,7 @@ static int begin_dial(struct ast_dial *dial, struct ast_channel *chan, int async
/* Iterate through channel list, requesting and calling each one */
AST_LIST_LOCK(&dial->channels);
AST_LIST_TRAVERSE(&dial->channels, channel, list) {
- success += begin_dial_channel(channel, chan, async, predial_string);
+ success += begin_dial_channel(channel, chan, async, predial_string, NULL);
}
AST_LIST_UNLOCK(&dial->channels);
@@ -550,7 +558,7 @@ static int handle_call_forward(struct ast_dial *dial, struct ast_dial_channel *c
channel->owner = NULL;
/* Finally give it a go... send it out into the world */
- begin_dial_channel(channel, chan, chan ? 0 : 1, predial_string);
+ begin_dial_channel(channel, chan, chan ? 0 : 1, predial_string, original);
ast_channel_publish_dial_forward(chan, original, channel->owner, NULL, "CANCEL",
ast_channel_call_forward(original));