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.
This commit is contained in:
parent
4bfaf60ed2
commit
275571ff20
|
@ -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;
|
||||
|
|
14
src/mncc.c
14
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;
|
||||
|
|
Loading…
Reference in New Issue