Don't hold channel resources longer than we need them
authorMark Spencer <markster@digium.com>
Tue, 22 Jul 2003 15:16:55 +0000 (15:16 +0000)
committerMark Spencer <markster@digium.com>
Tue, 22 Jul 2003 15:16:55 +0000 (15:16 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1200 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_dial.c

index 38f70bc..953e799 100755 (executable)
@@ -148,7 +148,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                watchers[0] = in;
                while(o) {
                        /* Keep track of important channels */
-                       if (o->stillgoing) {
+                       if (o->stillgoing && o->chan) {
                                watchers[pos++] = o->chan;
                                found = 1;
                        }
@@ -228,6 +228,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                                case AST_CONTROL_BUSY:
                                                        if (option_verbose > 2)
                                                                ast_verbose( VERBOSE_PREFIX_3 "%s is busy\n", o->chan->name);
+                                                       ast_hangup(o->chan)
+                                                       o->chan = NULL;
                                                        o->stillgoing = 0;
                                                        if (in->cdr)
                                                                ast_cdr_busy(in->cdr);
@@ -236,6 +238,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                                case AST_CONTROL_CONGESTION:
                                                        if (option_verbose > 2)
                                                                ast_verbose( VERBOSE_PREFIX_3 "%s is circuit-busy\n", o->chan->name);
+                                                       ast_hangup(o->chan)
+                                                       o->chan = NULL;
                                                        o->stillgoing = 0;
                                                        if (in->cdr)
                                                                ast_cdr_busy(in->cdr);
@@ -277,6 +281,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                        }
                                        ast_frfree(f);
                                } else {
+                                       ast_hangup(o->chan)
+                                       o->chan = NULL;
                                        o->stillgoing = 0;
                                }
                        }