Merged revisions 277625 via svnmerge from
authorTim Ringenbach <tim.ringenbach@gmail.com>
Fri, 16 Jul 2010 23:23:15 +0000 (23:23 +0000)
committerTim Ringenbach <tim.ringenbach@gmail.com>
Fri, 16 Jul 2010 23:23:15 +0000 (23:23 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r277625 | tringenbach | 2010-07-16 17:43:39 -0500 (Fri, 16 Jul 2010) | 9 lines

  Save and restore AST_FLAG_BRIDGE_HANGUP_DONT on attended transfer.

  ast_bridge_call() clears AST_FLAG_BRIDGE_HANGUP_DONT. But during an attended
  transfer, ast_bridge_call() is called for a second bridge on the same channel,
  and it clears that flag, which still needs to get set for when the original
  ast_bridge_call() gets control back and checks it.

  Review: https://reviewboard.asterisk.org/r/741
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@277657 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/features.c

index d5fc289..eaef42b 100644 (file)
@@ -1839,6 +1839,8 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
 
        ast_party_connected_line_init(&connected_line);
        if (!ast_check_hangup(transferer)) {
+               int hangup_dont = 0;
+
                /* Transferer is up - old behaviour */
                ast_indicate(transferer, -1);
                if (!newchan) {
@@ -1871,7 +1873,18 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
                ast_channel_lock(transferer);
                ast_party_connected_line_copy(&connected_line, &transferer->connected);
                ast_channel_unlock(transferer);
+
+               /* ast_bridge_call clears AST_FLAG_BRIDGE_HANGUP_DONT, but we don't
+                  want that to happen here because we're also in another bridge already
+                */
+               if (ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT)) {
+                       hangup_dont = 1;
+               }
                res = ast_bridge_call(transferer, newchan, &bconfig);
+               if (hangup_dont) {
+                       ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT);
+               }
+
                if (ast_check_hangup(newchan) || !ast_check_hangup(transferer)) {
                        ast_hangup(newchan);
                        if (ast_stream_and_wait(transferer, xfersound, ""))