ASCI: Add transaction type to trans_find_by_callref()

A transaction can be identified by the callref and the type. Because
transactions with different types may share the same callref value,
it is required to include the type in the trans_find_by_callref()
parameters.

E.g. a voice group call may have the same callref as a voice broadcast
call, but they are different calls. They also may not be confused with
other transaction types having eventually equal callref value, like
GSM 04.08 calls, SMS or supplementary services transactions.

By adding the transaction type to trans_find_by_callref(), we
essentially now use the (type, callref) tuple as unique ID for
transactions, instead of just callref.

Change-Id: Ic0b82033a1aa3c3508ad610c690a5f29073006c1
Related: OS#4854, OS#3294
This commit is contained in:
Andreas Eversberg 2023-04-23 11:43:13 +02:00 committed by laforge
parent bcb4d6b26f
commit 7e4b032b88
4 changed files with 12 additions and 11 deletions

View File

@ -156,7 +156,7 @@ struct gsm_trans {
struct gsm_trans *trans_find_by_type(const struct msc_a *msc_a, enum trans_type type);
struct gsm_trans *trans_find_by_id(const struct msc_a *msc_a,
enum trans_type type, uint8_t trans_id);
struct gsm_trans *trans_find_by_callref(const struct gsm_network *net,
struct gsm_trans *trans_find_by_callref(const struct gsm_network *net, enum trans_type type,
uint32_t callref);
struct gsm_trans *trans_find_by_sm_rp_mr(const struct gsm_network *net,
const struct vlr_subscr *vsub,

View File

@ -414,8 +414,8 @@ static void cc_paging_cb(struct msc_a *msc_a, struct gsm_trans *trans)
/* bridge channels of two transactions */
static int tch_bridge(struct gsm_network *net, const struct gsm_mncc_bridge *bridge)
{
struct gsm_trans *trans1 = trans_find_by_callref(net, bridge->callref[0]);
struct gsm_trans *trans2 = trans_find_by_callref(net, bridge->callref[1]);
struct gsm_trans *trans1 = trans_find_by_callref(net, TRANS_CC, bridge->callref[0]);
struct gsm_trans *trans2 = trans_find_by_callref(net, TRANS_CC, bridge->callref[1]);
struct call_leg *cl1;
struct call_leg *cl2;
@ -537,8 +537,8 @@ static void gsm48_cc_timeout(void *arg)
static inline void disconnect_bridge(struct gsm_network *net,
const struct gsm_mncc_bridge *bridge, int err)
{
struct gsm_trans *trans0 = trans_find_by_callref(net, bridge->callref[0]);
struct gsm_trans *trans1 = trans_find_by_callref(net, bridge->callref[1]);
struct gsm_trans *trans0 = trans_find_by_callref(net, TRANS_CC, bridge->callref[0]);
struct gsm_trans *trans1 = trans_find_by_callref(net, TRANS_CC, bridge->callref[1]);
struct gsm_mncc mx_rel;
if (!trans0 || !trans1)
return;
@ -1995,7 +1995,7 @@ static int tch_rtp_create(struct gsm_network *net, const struct gsm_mncc_rtp *rt
struct gsm_trans *trans;
/* Find callref */
trans = trans_find_by_callref(net, rtp->callref);
trans = trans_find_by_callref(net, TRANS_CC, rtp->callref);
if (!trans) {
LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "RTP create for non-existing trans\n");
mncc_recv_rtp_err(net, trans, rtp->callref, MNCC_RTP_CREATE);
@ -2120,7 +2120,7 @@ static int tch_rtp_connect(struct gsm_network *net, const struct gsm_mncc_rtp *r
struct rtp_stream *rtps;
/* Find callref */
trans = trans_find_by_callref(net, rtp->callref);
trans = trans_find_by_callref(net, TRANS_CC, rtp->callref);
if (!trans) {
LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "RTP connect for non-existing trans\n");
mncc_recv_rtp_err(net, trans, rtp->callref, MNCC_RTP_CONNECT);
@ -2257,7 +2257,7 @@ static int mncc_tx_to_gsm_cc(struct gsm_network *net, const union mncc_msg *msg)
data = &msg->signal;
/* Find callref */
trans = trans_find_by_callref(net, data->callref);
trans = trans_find_by_callref(net, TRANS_CC, data->callref);
/* Callref unknown */
if (!trans) {

View File

@ -441,7 +441,7 @@ int gsm0911_gsup_rx(struct gsup_client_mux *gcm, void *data, const struct osmo_g
log_set_context(LOG_CTX_VLR_SUBSCR, vsub);
/* Attempt to find DTAP-transaction */
trans = trans_find_by_callref(net, gsup_msg->session_id);
trans = trans_find_by_callref(net, TRANS_USSD, gsup_msg->session_id);
/* Handle errors */
if (OSMO_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) {

View File

@ -73,16 +73,17 @@ struct gsm_trans *trans_find_by_id(const struct msc_a *msc_a,
/*! Find a transaction by call reference
* \param[in] net Network in which we should search
* \param[in] type Transaction type (e.g. TRANS_CC)
* \param[in] callref Call Reference of transaction
* \returns Matching transaction, if any
*/
struct gsm_trans *trans_find_by_callref(const struct gsm_network *net,
struct gsm_trans *trans_find_by_callref(const struct gsm_network *net, enum trans_type type,
uint32_t callref)
{
struct gsm_trans *trans;
llist_for_each_entry(trans, &net->trans_list, entry) {
if (trans->callref == callref)
if (trans->callref == callref && trans->type == type)
return trans;
}
return NULL;