diff -urN asterisk-1.6.2.6~rc0_orig/main/features.c asterisk-1.6.2.6~rc0/main/features.c --- asterisk-1.6.2.6~rc0_orig/main/features.c 2010-03-04 18:16:45.000000000 +0100 +++ asterisk-1.6.2.6~rc0/main/features.c 2010-03-04 18:16:51.000000000 +0100 @@ -925,6 +925,39 @@ *callee = peer; *caller = chan; } + + /* Local stuff */ + if (!strcasecmp((*caller)->tech->type, "Local")) { + struct ast_channel *tmpchan, *base_peer; + char other_side[AST_CHANNEL_NAME]; + char *c; + ast_copy_string(other_side, (*caller)->name, sizeof(other_side)); + if ((c = strrchr(other_side, ';'))) { + *++c = '1'; + } + if ((tmpchan = ast_get_channel_by_name_locked(other_side))) { + if ((base_peer = ast_bridged_channel(tmpchan))) { + *caller = base_peer; + } + ast_channel_unlock(tmpchan); + } + } + + if (!strcasecmp((*callee)->tech->type, "Local")) { + struct ast_channel *tmpchan, *base_peer; + char other_side[AST_CHANNEL_NAME]; + char *c; + ast_copy_string(other_side, (*callee)->name, sizeof(other_side)); + if ((c = strrchr(other_side, ';'))) { + *++c = '1'; + } + if ((tmpchan = ast_get_channel_by_name_locked(other_side))) { + if ((base_peer = ast_bridged_channel(tmpchan))) { + *callee = base_peer; + } + ast_channel_unlock(tmpchan); + } + } } /*!