Index: apps/app_dial.c =================================================================== --- apps/app_dial.c (revision 219892) +++ apps/app_dial.c (working copy) @@ -710,6 +710,7 @@ char *stuff; char *tech; int cause; + const char *forward_sippeer = pbx_builtin_getvar_helper(c, "FORWARDER_SIPPEER"); ast_copy_string(tmpchan, c->call_forward, sizeof(tmpchan)); if ((stuff = strchr(tmpchan, '/'))) { @@ -742,6 +743,7 @@ ast_channel_make_compatible(o->chan, in); ast_channel_inherit_variables(in, o->chan); ast_channel_datastore_inherit(in, o->chan); + pbx_builtin_setvar_helper(o->chan, "FORWARDER_SIPPEER", forward_sippeer); } else ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause); } Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 219892) +++ channels/chan_sip.c (working copy) @@ -17016,6 +17016,10 @@ ast_debug(2, "Received 302 Redirect to extension '%s' (domain %s)\n", s, domain); if (p->owner) { pbx_builtin_setvar_helper(p->owner, "SIPDOMAIN", domain); + if (!ast_strlen_zero(p->peername)) + pbx_builtin_setvar_helper(p->owner, "FORWARDER_SIPPEER", p->peername); + else + pbx_builtin_setvar_helper(p->owner, "FORWARDER_SIPPEER", p->username); ast_string_field_set(p->owner, call_forward, s); } } @@ -20224,6 +20228,10 @@ /* Attended transfer to remote host, prepare headers for the INVITE */ if (p->refer->referred_by) pbx_builtin_setvar_helper(current.chan2, "_SIPTRANSFER_REFERER", p->refer->referred_by); + if (!ast_strlen_zero(p->peername)) + pbx_builtin_setvar_helper(current.chan2, "TRANSFERER_SIPPEER", p->peername); + else + pbx_builtin_setvar_helper(current.chan2, "TRANSFERER_SIPPEER", p->username); } /* Generate a Replaces string to be used in the INVITE during attended transfer */ if (!ast_strlen_zero(p->refer->replaces_callid)) {