diff options
author | zuul <zuul@gerrit.asterisk.org> | 2016-06-06 07:27:30 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-06-06 07:27:30 -0500 |
commit | 93237209ebe05a849f8ae7a48d16b6f53676ea97 (patch) | |
tree | e0878bf6f813defbe671b9d0de83e7fecb6cc874 /apps | |
parent | cda33854091eabf243dee228b92da3fcaa5bb5e3 (diff) | |
parent | 2de58c6d01a3ef1d6b31167833731eefcf844f0a (diff) |
Merge "core/dial: New channel variable FORWARDERNAME" into 13
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_dial.c | 3 | ||||
-rw-r--r-- | apps/app_queue.c | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c index bc4f8a574..c05aecaf9 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -834,6 +834,7 @@ static void do_forward(struct chanlist *o, struct cause_args *num, struct ast_party_id *forced_clid, struct ast_party_id *stored_clid) { char tmpchan[256]; + char forwarder[AST_CHANNEL_NAME]; struct ast_channel *original = o->chan; struct ast_channel *c = o->chan; /* the winner */ struct ast_channel *in = num->chan; /* the input channel */ @@ -842,6 +843,7 @@ static void do_forward(struct chanlist *o, struct cause_args *num, int cause; struct ast_party_caller caller; + ast_copy_string(forwarder, ast_channel_name(c), sizeof(forwarder)); ast_copy_string(tmpchan, ast_channel_call_forward(c), sizeof(tmpchan)); if ((stuff = strchr(tmpchan, '/'))) { *stuff++ = '\0'; @@ -893,6 +895,7 @@ static void do_forward(struct chanlist *o, struct cause_args *num, ast_channel_lock_both(in, o->chan); ast_channel_inherit_variables(in, o->chan); ast_channel_datastore_inherit(in, o->chan); + pbx_builtin_setvar_helper(o->chan, "FORWARDERNAME", forwarder); ast_max_forwards_decrement(o->chan); ast_channel_unlock(in); ast_channel_unlock(o->chan); diff --git a/apps/app_queue.c b/apps/app_queue.c index dbd83938d..3d22f9821 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -4827,16 +4827,22 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte continue; } else if (!ast_strlen_zero(ast_channel_call_forward(o->chan))) { struct ast_channel *original = o->chan; + char forwarder[AST_CHANNEL_NAME]; char tmpchan[256]; char *stuff; char *tech; ast_copy_string(tmpchan, ast_channel_call_forward(o->chan), sizeof(tmpchan)); + ast_copy_string(forwarder, ast_channel_name(o->chan), sizeof(forwarder)); if ((stuff = strchr(tmpchan, '/'))) { *stuff++ = '\0'; tech = tmpchan; } else { - snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(o->chan), ast_channel_context(o->chan)); + const char *forward_context; + ast_channel_lock(o->chan); + forward_context = pbx_builtin_getvar_helper(o->chan, "FORWARD_CONTEXT"); + snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(o->chan), forward_context ? forward_context : ast_channel_context(o->chan)); + ast_channel_unlock(o->chan); stuff = tmpchan; tech = "Local"; } @@ -4868,6 +4874,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte ast_channel_lock_both(o->chan, in); ast_channel_inherit_variables(in, o->chan); ast_channel_datastore_inherit(in, o->chan); + pbx_builtin_setvar_helper(o->chan, "FORWARDERNAME", forwarder); ast_max_forwards_decrement(o->chan); if (o->pending_connected_update) { |