mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
Grab lock in hangup earlier
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4626 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -914,8 +914,9 @@ static int mgcp_hangup(struct ast_channel *ast)
|
|||||||
struct mgcp_subchannel *sub = ast->pvt->pvt;
|
struct mgcp_subchannel *sub = ast->pvt->pvt;
|
||||||
struct mgcp_endpoint *p = sub->parent;
|
struct mgcp_endpoint *p = sub->parent;
|
||||||
|
|
||||||
if (option_debug)
|
if (option_debug) {
|
||||||
ast_log(LOG_DEBUG, "mgcp_hangup(%s)\n", ast->name);
|
ast_log(LOG_DEBUG, "mgcp_hangup(%s)\n", ast->name);
|
||||||
|
}
|
||||||
if (!ast->pvt->pvt) {
|
if (!ast->pvt->pvt) {
|
||||||
ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n");
|
ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -924,14 +925,14 @@ static int mgcp_hangup(struct ast_channel *ast)
|
|||||||
ast_log(LOG_DEBUG, "Invalid magic. MGCP subchannel freed up already.\n");
|
ast_log(LOG_DEBUG, "Invalid magic. MGCP subchannel freed up already.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
ast_mutex_lock(&sub->lock);
|
||||||
if (mgcpdebug) {
|
if (mgcpdebug) {
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_hangup(%s) on %s@%s\n", ast->name, p->name, p->parent->name);
|
ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_hangup(%s) on %s@%s\n", ast->name, p->name, p->parent->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p->dtmfmode & MGCP_DTMF_INBAND) && (p->dsp != NULL)){
|
if ((p->dtmfmode & MGCP_DTMF_INBAND) && p->dsp) {
|
||||||
/* SC: check whether other channel is active. */
|
/* SC: check whether other channel is active. */
|
||||||
if (!sub->next->owner)
|
if (!sub->next->owner) {
|
||||||
{
|
|
||||||
if (mgcpdebug) {
|
if (mgcpdebug) {
|
||||||
ast_verbose(VERBOSE_PREFIX_2 "MGCP free dsp on %s@%s\n", p->name, p->parent->name);
|
ast_verbose(VERBOSE_PREFIX_2 "MGCP free dsp on %s@%s\n", p->name, p->parent->name);
|
||||||
}
|
}
|
||||||
@@ -939,7 +940,6 @@ static int mgcp_hangup(struct ast_channel *ast)
|
|||||||
p->dsp = NULL;
|
p->dsp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast_mutex_lock(&sub->lock);
|
|
||||||
|
|
||||||
sub->owner = NULL;
|
sub->owner = NULL;
|
||||||
if (strlen(sub->cxident)) {
|
if (strlen(sub->cxident)) {
|
||||||
|
Reference in New Issue
Block a user