remove code dup: add msc_mgcp_try_call_assignment()
Various places in the code check a flag whether assignment was started and
launch it. To fix incoming-call-during-ongoing-call, I will tweak that logic.
To be able to do that only in one place, remove code dup.
Cosmetic preparation for I1f8746e7babfcd3028a4d2c0ba260c608c686c76 and
I0ba216b737909e92080a722db26e3577726c63cb/
Depends: I11b182a03f5ecb6df7cd8f260757d3626c8e945d (libosmocore: LOGPFSMSL)
Change-Id: I11c0b7dc3f1a747028629b48e522bb3b864884ba
diff --git a/src/libmsc/msc_mgcp.c b/src/libmsc/msc_mgcp.c
index 23e68e7..5a8ee79 100644
--- a/src/libmsc/msc_mgcp.c
+++ b/src/libmsc/msc_mgcp.c
@@ -951,6 +951,22 @@
.event_names = msc_mgcp_fsm_evt_names,
};
+/* Try to invoke call assignment and set trans->assignment_done flag if invoked.
+ * This is relevant for already ongoing calls -- scenario:
+ * - subscriber is in an active voice call,
+ * - another call is coming in.
+ * For the second call coming in, we must wait to establish RTP and assignment until the first call is CC-Disconnected.
+ */
+int msc_mgcp_try_call_assignment(struct gsm_trans *trans)
+{
+ struct ran_conn *conn = trans->conn;
+ if (trans->assignment_done)
+ return 0;
+ LOGPFSMSL(conn->fi, DMGCP, LOGL_INFO, "Starting call assignment\n");
+ trans->assignment_done = true;
+ return msc_mgcp_call_assignment(trans);
+}
+
/* Notify that a new call begins. This will create a connection for the
* RAN and the CN on the MGW.
* Parameter: