mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-msc.git
synced 2025-10-23 08:12:10 +00:00
gsm48_cc_tx_setup: remove extra bearer_cap var
Store the bearer capabilities directly in the transaction, instead of storing them in a separate variable first, then copying it to the transaction, then using both the separate variable and the copy in the transaction later on. The extra variable is not needed and only makes it more compilicated. Add an explicit '.transfer = GSM48_BCAP_ITCAP_SPEECH,' while at it in the speech case. This was already set implicitly because GSM48_BCAP_ITCAP_SPEECH is 0. Change-Id: I247ef10923c2875ca75e73046f4b8ed14190d4d2
This commit is contained in:
@@ -913,18 +913,18 @@ static int gsm48_cc_tx_setup_select_codecs(struct gsm_trans *trans, const struct
|
||||
* Versions) / CSD bearer services remaining after intersecting MS, BSS and
|
||||
* remote call leg restrictions. To store in trans for later use, and to
|
||||
* include in the outgoing CC Setup message. */
|
||||
static int gsm48_cc_tx_setup_set_bearer_cap(struct gsm_trans *trans, struct gsm_mncc_bearer_cap *bearer_cap,
|
||||
const struct gsm_mncc *setup)
|
||||
static int gsm48_cc_tx_setup_set_bearer_cap(struct gsm_trans *trans, const struct gsm_mncc *setup)
|
||||
{
|
||||
int rc;
|
||||
|
||||
switch (trans->bearer_cap.transfer) {
|
||||
case GSM48_BCAP_ITCAP_SPEECH:
|
||||
*bearer_cap = (struct gsm_mncc_bearer_cap){
|
||||
trans->bearer_cap = (struct gsm_mncc_bearer_cap){
|
||||
.transfer = GSM48_BCAP_ITCAP_SPEECH,
|
||||
.speech_ver = { -1 },
|
||||
};
|
||||
sdp_audio_codecs_to_bearer_cap(bearer_cap, &trans->cc.local.audio_codecs);
|
||||
rc = bearer_cap_set_radio(bearer_cap);
|
||||
sdp_audio_codecs_to_bearer_cap(&trans->bearer_cap, &trans->cc.local.audio_codecs);
|
||||
rc = bearer_cap_set_radio(&trans->bearer_cap);
|
||||
if (rc) {
|
||||
LOG_TRANS(trans, LOGL_ERROR, "Error composing Bearer Capability for CC Setup\n");
|
||||
return -1;
|
||||
@@ -934,7 +934,7 @@ static int gsm48_cc_tx_setup_set_bearer_cap(struct gsm_trans *trans, struct gsm_
|
||||
* transcode, we could use non-identical codecs on each conn of
|
||||
* the MGW endpoint, but we are aiming for finding a matching
|
||||
* codec. */
|
||||
if (bearer_cap->speech_ver[0] == -1) {
|
||||
if (trans->bearer_cap.speech_ver[0] == -1) {
|
||||
LOG_TRANS(trans, LOGL_ERROR, "%s: no codec match possible: %s\n",
|
||||
get_mncc_name(setup->msg_type),
|
||||
codec_filter_to_str(&trans->cc.codecs, &trans->cc.local, &trans->cc.remote));
|
||||
@@ -946,7 +946,7 @@ static int gsm48_cc_tx_setup_set_bearer_cap(struct gsm_trans *trans, struct gsm_
|
||||
trans->callref = 0;
|
||||
return -1;
|
||||
}
|
||||
rc = bearer_cap_filter_rev_lev(bearer_cap, trans->vsub->classmark.classmark1.rev_lev);
|
||||
rc = bearer_cap_filter_rev_lev(&trans->bearer_cap, trans->vsub->classmark.classmark1.rev_lev);
|
||||
if (rc) {
|
||||
LOG_TRANS(trans, LOGL_ERROR, "No codec offered is supported by phase 1 mobile.\n");
|
||||
return -1;
|
||||
@@ -955,14 +955,14 @@ static int gsm48_cc_tx_setup_set_bearer_cap(struct gsm_trans *trans, struct gsm_
|
||||
case GSM48_BCAP_ITCAP_3k1_AUDIO:
|
||||
case GSM48_BCAP_ITCAP_FAX_G3:
|
||||
case GSM48_BCAP_ITCAP_UNR_DIG_INF:
|
||||
*bearer_cap = (struct gsm_mncc_bearer_cap){
|
||||
trans->bearer_cap = (struct gsm_mncc_bearer_cap){
|
||||
.transfer = trans->bearer_cap.transfer,
|
||||
.mode = GSM48_BCAP_TMOD_CIRCUIT,
|
||||
.coding = GSM48_BCAP_CODING_GSM_STD,
|
||||
.radio = GSM48_BCAP_RRQ_FR_ONLY,
|
||||
};
|
||||
|
||||
if (csd_bs_list_to_bearer_cap(bearer_cap, &trans->cc.local.bearer_services) == 0) {
|
||||
if (csd_bs_list_to_bearer_cap(&trans->bearer_cap, &trans->cc.local.bearer_services) == 0) {
|
||||
LOG_TRANS(trans, LOGL_ERROR, "Error composing Bearer Capability for CC Setup\n");
|
||||
|
||||
/* incompatible codecs */
|
||||
@@ -975,10 +975,6 @@ static int gsm48_cc_tx_setup_set_bearer_cap(struct gsm_trans *trans, struct gsm_
|
||||
break;
|
||||
}
|
||||
|
||||
/* Create a copy of the bearer capability in the transaction struct, so
|
||||
* we can use this information later */
|
||||
trans->bearer_cap = *bearer_cap;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1028,7 +1024,6 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
|
||||
struct msgb *msg;
|
||||
struct gsm_mncc *setup = arg;
|
||||
int rc;
|
||||
struct gsm_mncc_bearer_cap bearer_cap;
|
||||
|
||||
rc = gsm48_cc_tx_setup_set_transaction_id(trans);
|
||||
if (rc < 0)
|
||||
@@ -1043,11 +1038,11 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
|
||||
if (rc < 0)
|
||||
goto error;
|
||||
|
||||
rc = gsm48_cc_tx_setup_set_bearer_cap(trans, &bearer_cap, setup);
|
||||
rc = gsm48_cc_tx_setup_set_bearer_cap(trans, setup);
|
||||
if (rc < 0)
|
||||
goto error;
|
||||
|
||||
msg = gsm48_cc_tx_setup_encode_msg(&bearer_cap, setup);
|
||||
msg = gsm48_cc_tx_setup_encode_msg(&trans->bearer_cap, setup);
|
||||
|
||||
new_cc_state(trans, GSM_CSTATE_CALL_PRESENT);
|
||||
|
||||
|
Reference in New Issue
Block a user