diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-05-19 23:37:38 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-05-19 23:37:38 +0000 |
commit | 1af98a08127c5e22527d4ab40a79c2a2d4f6296b (patch) | |
tree | 8289681306f864453421698a0cc6d863cc8189e1 /channels/chan_local.c | |
parent | d4e957ca9a92c3b29b8f45e21c7a34a6a49f2ba8 (diff) |
Fix case where local is allocated but not actually called on
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1043 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rwxr-xr-x | channels/chan_local.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c index 56c3c64a2..4c4d4e1de 100755 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -230,12 +230,14 @@ static int local_hangup(struct ast_channel *ast) int isoutbound = IS_OUTBOUND(ast, p); struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP }; struct local_pvt *cur, *prev=NULL; + struct ast_channel *ochan = NULL; ast_pthread_mutex_lock(&p->lock); if (isoutbound) p->chan = NULL; else p->owner = NULL; ast->pvt->pvt = NULL; + if (!p->owner && !p->chan) { /* Okay, done with the private part now, too. */ ast_pthread_mutex_unlock(&p->lock); @@ -258,8 +260,14 @@ static int local_hangup(struct ast_channel *ast) free(p); return 0; } - local_queue_frame(p, isoutbound, &f); + if (p->chan && !p->chan->pbx) + /* Need to actually hangup since there is no PBX */ + ochan = p->chan; + else + local_queue_frame(p, isoutbound, &f); ast_pthread_mutex_unlock(&p->lock); + if (ochan) + ast_hangup(ochan); return 0; } |