summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-31 14:17:58 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-31 14:17:58 +0200
commit275571ff20090030c2bc8b9fca81dc1c89424c8b (patch)
tree8f1c1c0939c68f415d885d62b1de5abb6366f13d /src
parent4bfaf60ed251b12cf90917bdb33c99657dbfc640 (diff)
mncc: Introduce direction and start to handle it separetely
For releasing a MT-Call we will need to send a release request and then wait for the release confirmation. Add if/else to it. If this turns out to be too ugly we will be able to create one MO and one MT leg.
Diffstat (limited to 'src')
-rw-r--r--src/call.h7
-rw-r--r--src/mncc.c14
2 files changed, 18 insertions, 3 deletions
diff --git a/src/call.h b/src/call.h
index 297b198..b6cb8bf 100644
--- a/src/call.h
+++ b/src/call.h
@@ -101,10 +101,17 @@ enum mncc_cc_state {
MNCC_CC_CONNECTED,
};
+enum mncc_dir {
+ MNCC_DIR_MO,
+ MNCC_DIR_MT,
+};
+
struct mncc_call_leg {
struct call_leg base;
enum mncc_cc_state state;
+ enum mncc_dir dir;
+
uint32_t callref;
struct gsm_mncc_number called;
struct gsm_mncc_number calling;
diff --git a/src/mncc.c b/src/mncc.c
index 4bb117b..1895254 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -195,9 +195,15 @@ static void mncc_call_leg_release(struct call_leg *_leg)
case MNCC_CC_INITIAL:
LOGP(DMNCC, LOGL_DEBUG,
"Releasing call in initial-state leg(%u)\n", leg->callref);
- mncc_send(leg->conn, MNCC_REJ_REQ, leg->callref);
- osmo_timer_del(&leg->cmd_timeout);
- call_leg_release(_leg);
+ if (leg->dir == MNCC_DIR_MO) {
+ mncc_send(leg->conn, MNCC_REJ_REQ, leg->callref);
+ osmo_timer_del(&leg->cmd_timeout);
+ call_leg_release(_leg);
+ } else {
+ leg->base.in_release = true;
+ start_cmd_timer(leg, MNCC_REL_CNF);
+ mncc_send(leg->conn, MNCC_REL_REQ, leg->callref);
+ }
break;
case MNCC_CC_PROCEEDING:
case MNCC_CC_CONNECTED:
@@ -369,6 +375,7 @@ static void check_setup(struct mncc_connection *conn, char *buf, int rc)
leg->callref = data->callref;
leg->conn = conn;
leg->state = MNCC_CC_INITIAL;
+ leg->dir = MNCC_DIR_MO;
memcpy(&leg->called, &data->called, sizeof(leg->called));
memcpy(&leg->calling, &data->calling, sizeof(leg->calling));
memcpy(&leg->imsi, data->imsi, sizeof(leg->imsi));
@@ -536,6 +543,7 @@ int mncc_create_remote_leg(struct mncc_connection *conn, struct call *call,
leg->conn = conn;
leg->state = MNCC_CC_INITIAL;
+ leg->dir = MNCC_DIR_MT;
mncc.msg_type = MNCC_SETUP_REQ;
mncc.callref = leg->callref;