aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm_04_08.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-01-09 21:27:43 +0000
committerHarald Welte <laforge@gnumonks.org>2009-01-09 21:27:43 +0000
commit498b0bbd9bd0ccb311692094dac15e0f5b31c88b (patch)
tree029c41e4a4f477be9fc47b15e807c8ff673662e5 /src/gsm_04_08.c
parent626fe9c42ba5177a3f849be4e09c6d537c9e37b3 (diff)
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...
Diffstat (limited to 'src/gsm_04_08.c')
-rw-r--r--src/gsm_04_08.c7
1 files changed, 6 insertions, 1 deletions
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 <laforge@gnumonks.org>
- * (C) 2008 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2008, 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
*
* 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;