--- main/channel.c- 2015-09-25 16:23:34.000000000 +0200 +++ main/channel.c 2015-09-25 18:30:41.000000000 +0200 @@ -7868,6 +7868,7 @@ long time_left_ms=0; char caller_warning = 0; char callee_warning = 0; + char bridgeeventnotsent=1; *fo = NULL; @@ -7945,7 +7946,6 @@ ast_set_flag(ast_channel_flags(c1), AST_FLAG_END_DTMF_ONLY); if (!ast_channel_tech(c1)->send_digit_begin) ast_set_flag(ast_channel_flags(c0), AST_FLAG_END_DTMF_ONLY); - manager_bridge_event(1, 1, c0, c1); /* Before we enter in and bridge these two together tell them both the source of audio has changed */ ast_indicate(c0, AST_CONTROL_SRCUPDATE); @@ -8054,8 +8054,9 @@ /* Looks like they share a bridge method and nothing else is in the way */ ast_set_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE); ast_set_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE); + manager_bridge_event(1, 2, c0, c1); if ((res = ast_channel_tech(c0)->bridge(c0, c1, config->flags, fo, rc, timeoutms)) == AST_BRIDGE_COMPLETE) { - manager_bridge_event(0, 1, c0, c1); + manager_bridge_event(0, 2, c0, c1); ast_debug(1, "Returning from native bridge, channels: %s, %s\n", ast_channel_name(c0), ast_channel_name(c1)); ast_clear_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE); @@ -8085,8 +8086,9 @@ continue; default: ast_verb(3, "Native bridging %s and %s ended\n", ast_channel_name(c0), ast_channel_name(c1)); - /* fallthrough */ + break; case AST_BRIDGE_FAILED_NOWARN: + manager_bridge_event(0, 2, c0, c1); /* maybe unneccessary, but included to preserve previous behavior */ break; } } @@ -8098,7 +8100,8 @@ !(ast_channel_generator(c0) || ast_channel_generator(c1))) { if (ast_channel_make_compatible(c0, c1)) { ast_log(LOG_WARNING, "Can't make %s and %s compatible\n", ast_channel_name(c0), ast_channel_name(c1)); - manager_bridge_event(0, 1, c0, c1); + manager_bridge_event(1, 1, c0, c1); /* debatable, but included to preserve previous behavior */ + manager_bridge_event(0, 1, c0, c1); /* we could just remove both events or invent a nev Bridgestate: Failed? */ ast_format_cap_destroy(o0nativeformats); ast_format_cap_destroy(o1nativeformats); return AST_BRIDGE_FAILED; @@ -8110,6 +8113,8 @@ update_bridge_vars(c0, c1); + if (bridgeeventnotsent) manager_bridge_event(1, 1, c0, c1); + bridgeeventnotsent=0; res = ast_generic_bridge(c0, c1, config, fo, rc); if (res != AST_BRIDGE_RETRY) { break;