aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_mgcp.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-01 00:59:54 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-01 00:59:54 +0000
commitcb5b1bc31d9086ec26285ae60ae783cd2ab7e55d (patch)
tree8ae83813360649d6cc666fc67c1f72d750066d02 /channels/chan_mgcp.c
parentecc276194b632eeb0e20a8e537d82da5d6a214e1 (diff)
Grab lock in hangup earlier
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4626 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_mgcp.c')
-rwxr-xr-xchannels/chan_mgcp.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 4b59dbc8e..2cc84fc83 100755
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -914,38 +914,38 @@ static int mgcp_hangup(struct ast_channel *ast)
struct mgcp_subchannel *sub = ast->pvt->pvt;
struct mgcp_endpoint *p = sub->parent;
- if (option_debug)
+ if (option_debug) {
ast_log(LOG_DEBUG, "mgcp_hangup(%s)\n", ast->name);
+ }
if (!ast->pvt->pvt) {
ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n");
return 0;
}
- if (strcmp(sub->magic, MGCP_SUBCHANNEL_MAGIC)) {
+ if (strcmp(sub->magic, MGCP_SUBCHANNEL_MAGIC)) {
ast_log(LOG_DEBUG, "Invalid magic. MGCP subchannel freed up already.\n");
return 0;
- }
- if (mgcpdebug) {
- ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_hangup(%s) on %s@%s\n", ast->name, p->name, p->parent->name);
- }
+ }
+ ast_mutex_lock(&sub->lock);
+ if (mgcpdebug) {
+ 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. */
- if (!sub->next->owner)
- {
+ if (!sub->next->owner) {
if (mgcpdebug) {
ast_verbose(VERBOSE_PREFIX_2 "MGCP free dsp on %s@%s\n", p->name, p->parent->name);
}
ast_dsp_free(p->dsp);
p->dsp = NULL;
}
- }
- ast_mutex_lock(&sub->lock);
+ }
sub->owner = NULL;
if (strlen(sub->cxident)) {
transmit_connection_del(sub);
- }
- sub->cxident[0] = '\0';
+ }
+ sub->cxident[0] = '\0';
if ((sub == p->sub) && sub->next->owner) {
if (p->hookstate == MGCP_OFFHOOK) {
if (sub->next->owner && ast_bridged_channel(sub->next->owner)) {