If you're hanging up channels, be sure we clean it up...
authorMark Spencer <markster@digium.com>
Tue, 4 Oct 2005 17:41:30 +0000 (17:41 +0000)
committerMark Spencer <markster@digium.com>
Tue, 4 Oct 2005 17:41:30 +0000 (17:41 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6712 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx.c

diff --git a/pbx.c b/pbx.c
index 2b81d35..3466a98 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -4999,12 +4999,16 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
                                                ast_mutex_unlock(&chan->lock);
                                        if (ast_pbx_run(chan)) {
                                                ast_log(LOG_ERROR, "Unable to run PBX on %s\n", chan->name);
+                                               if (channel)
+                                                       *channel = NULL;
                                                ast_hangup(chan);
                                                res = -1;
                                        }
                                } else {
                                        if (ast_pbx_start(chan)) {
                                                ast_log(LOG_ERROR, "Unable to start PBX on %s\n", chan->name);
+                                               if (channel)
+                                                       *channel = NULL;
                                                ast_hangup(chan);
                                                res = -1;
                                        } 
@@ -5020,6 +5024,8 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
                                                ast_cdr_failed(chan->cdr);
                                }
                        
+                               if (channel)
+                                       *channel = NULL;
                                ast_hangup(chan);
                        }
                }
@@ -5079,6 +5085,8 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
                if (ast_pthread_create(&as->p, &attr, async_wait, as)) {
                        ast_log(LOG_WARNING, "Failed to start async wait\n");
                        free(as);
+                       if (channel)
+                               *channel = NULL;
                        ast_hangup(chan);
                        res = -1;
                        goto outgoing_exten_cleanup;