Even more changes concerning r187426. Revised where locks are placed yet once again...
authorDavid Vossel <dvossel@digium.com>
Fri, 10 Apr 2009 15:49:16 +0000 (15:49 +0000)
committerDavid Vossel <dvossel@digium.com>
Fri, 10 Apr 2009 15:49:16 +0000 (15:49 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187673 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_dial.c

index a91e512..21ba4b8 100644 (file)
@@ -790,9 +790,10 @@ static void do_forward(struct chanlist *o,
 
                ast_clear_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE);
 
+               ast_channel_unlock(in);
+               ast_channel_unlock(c);
+
                if (ast_call(c, tmpchan, 0)) {
-                       ast_channel_unlock(in);
-                       ast_channel_unlock(c);
                        ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
                        ast_clear_flag64(o, DIAL_STILLGOING);
                        ast_hangup(original);
@@ -800,6 +801,10 @@ static void do_forward(struct chanlist *o,
                        c = o->chan = NULL;
                        num->nochan++;
                } else {
+                       ast_channel_lock(c);
+                       while (ast_channel_trylock(in)) {
+                               CHANNEL_DEADLOCK_AVOIDANCE(c);
+                       }
                        senddialevent(in, c, stuff);
                        if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
                                char cidname[AST_MAX_EXTENSION] = "";