Index: res/res_features.c =================================================================== --- res/res_features.c (revision 147854) +++ res/res_features.c (working copy) @@ -2091,6 +2091,9 @@ int park; struct ast_bridge_config config; + struct ast_datastore *features_datastore; + struct ast_dial_features *dialfeatures = NULL; + struct ast_flags *callerflags, *calleeflags; if (!data) { ast_log(LOG_WARNING, "Parkedcall requires an argument (extension number)\n"); @@ -2187,8 +2190,31 @@ pbx_builtin_setvar_helper(chan, "PARKEDCHANNEL", peer->name); ast_cdr_setdestchan(chan->cdr, peer->name); memset(&config, 0, sizeof(struct ast_bridge_config)); - ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT); - ast_set_flag(&(config.features_caller), AST_FEATURE_REDIRECT); + + ast_channel_lock(peer); + if ((features_datastore = ast_channel_datastore_find(peer, &dial_features_info, NULL))) { + dialfeatures = features_datastore->data; + } + ast_channel_unlock(peer); + + if (dialfeatures) { + if (!dialfeatures->is_caller) { + callerflags = &(dialfeatures->features_caller); + calleeflags = &(dialfeatures->features_callee); + } else { + calleeflags = &(dialfeatures->features_caller); + callerflags = &(dialfeatures->features_callee); + } + + if (ast_test_flag(calleeflags, AST_FEATURE_REDIRECT)) { + ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT); + } + + if (ast_test_flag(callerflags, AST_FEATURE_REDIRECT)) { + ast_set_flag(&(config.features_caller), AST_FEATURE_REDIRECT); + } + } + res = ast_bridge_call(chan, peer, &config); pbx_builtin_setvar_helper(chan, "PARKEDCHANNEL", peer->name);