From 498b0bbd9bd0ccb311692094dac15e0f5b31c88b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 9 Jan 2009 21:27:43 +0000 Subject: [PATCH] Use use_lchan/put_lchan for call handling to keep the channel up Increase when the refcount of the lchan when we initiate a call, get a SETUP message and put it when we want to release the call... Once we have proper Q.931 support the use/put needs to be improved, e.g. we currently do not allow to hangup from the network, and it will ring until the end of time... --- src/gsm_04_08.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gsm_04_08.c b/src/gsm_04_08.c index 587bd39b4..f8559b8e2 100644 --- a/src/gsm_04_08.c +++ b/src/gsm_04_08.c @@ -2,7 +2,7 @@ * 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0 */ /* (C) 2008 by Harald Welte - * (C) 2008 by Holger Hans Peter Freyther + * (C) 2008, 2009 by Holger Hans Peter Freyther * * All Rights Reserved * @@ -666,6 +666,7 @@ int gsm48_cc_tx_setup(struct gsm_lchan *lchan) call->type = GSM_CT_MT; msg->lchan = lchan; + use_lchan(lchan); gh->proto_discr = GSM48_PDISC_CC; gh->msg_type = GSM48_MT_CC_SETUP; @@ -725,11 +726,15 @@ static int gsm0408_rcv_cc(struct msgb *msg) /* Section 5.4.3.2 */ DEBUGP(DCC, "DISCONNECT (state->RELEASE_REQ)\n"); call->state = GSM_CSTATE_RELEASE_REQ; + if (call->state != GSM_CSTATE_NULL) + put_lchan(msg->lchan); /* FIXME: clear the network connection */ rc = gsm48_tx_simple(msg->lchan, GSM48_PDISC_CC, GSM48_MT_CC_RELEASE); break; case GSM48_MT_CC_SETUP: + if (call->state == GSM_CSTATE_NULL || call->state == GSM_CSTATE_RELEASE_REQ) + use_lchan(msg->lchan); call->type = GSM_CT_MO; call->state = GSM_CSTATE_INITIATED; call->transaction_id = gh->proto_discr & 0xf0;