--- /usr/src/asterisk-svn-1.4/apps/app_dial.c 2007-10-31 08:27:19.000000000 +0000 +++ /usr/src/asterisk-ourapps/app_dial.c 2007-10-31 10:59:25.000000000 +0000 @@ -475,6 +475,7 @@ char *stuff; char *tech; int cause; + char origName[256]; ast_copy_string(tmpchan, c->call_forward, sizeof(tmpchan)); if ((stuff = strchr(tmpchan, '/'))) { @@ -490,6 +491,7 @@ o->forwards++; if (o->forwards < AST_MAX_FORWARDS) { if (option_verbose > 2) + strcpy(origName,c->name); ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, c->name); /* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */ if (ast_test_flag(peerflags, OPT_IGNORE_FORWARDING)) { @@ -535,6 +537,10 @@ c->cdrflags = in->cdrflags; } + /* Set CHANNELFORWARD variable */ + + pbx_builtin_setvar_helper(c, "CHANNELFORWARD", origName); + if (in->cid.cid_ani) { if (c->cid.cid_ani) free(c->cid.cid_ani);