osmith has uploaded this change for review.

View Change

gsm48_cc_tx_setup_select_codecs: split out

Change-Id: Ic502f9ed77ea57de4cf6d362c0e7070d9147d6f3
---
M src/libmsc/gsm_04_08_cc.c
1 file changed, 34 insertions(+), 23 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/39/41039/1
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index 8051dfe..677776f 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -867,35 +867,22 @@
return 0;
}

-
-static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
+/* MT call leg is starting. Gather all codecs information so far known.
+ * (Usually) paging has succeeded, and now we're processing the MNCC Setup from
+ * the remote MO call leg. Initialize the codecs filter with this side's BSS'
+ * codec list, received at Complete Layer 3. We haven't received the MT MS's
+ * Bearer Capabilities yet; the Bearer Capabilities handled here are actually
+ * the remote call leg's Bearer Capabilities. */
+static int gsm48_cc_tx_setup_select_codecs(struct gsm_trans *trans, const struct gsm_mncc *setup)
{
- struct msgb *msg;
- struct gsm48_hdr *gh;
- 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)
- goto error;
-
- gsm48_start_cc_timer(trans, 0x303, GSM48_T303);
-
- /* MT call leg is starting. Gather all codecs information so far known.
- * (Usually) paging has succeeded, and now we're processing the MNCC Setup from the remote MO call leg.
- * Initialize the codecs filter with this side's BSS' codec list, received at Complete Layer 3.
- * We haven't received the MT MS's Bearer Capabilities yet; the Bearer Capabilities handled here are
- * actually the remote call leg's Bearer Capabilities. */
trans_cc_filter_init(trans);
trans_cc_filter_set_ran(trans, trans->msc_a->c.ran->type);
trans_cc_filter_set_bss(trans, trans->msc_a);
- if (setup->fields & MNCC_F_BEARER_CAP)
- trans->bearer_cap.transfer = setup->bearer_cap.transfer;

switch (trans->bearer_cap.transfer) {
case GSM48_BCAP_ITCAP_SPEECH:
- /* if SDP is included in the MNCC, take that as definitive list of remote audio codecs. */
+ /* if SDP is included in the MNCC, take that as definitive list
+ * of remote audio codecs. */
rx_mncc_sdp(trans, setup->msg_type, setup->sdp,
(setup->fields & MNCC_F_BEARER_CAP) ? &setup->bearer_cap : NULL);
/* rx_mncc_sdp() has called trans_cc_filter_run(trans); */
@@ -918,9 +905,33 @@
default:
LOG_TRANS(trans, LOGL_ERROR, "Handling of information transfer capability %d not implemented\n",
trans->bearer_cap.transfer);
- break;
+ return -1;
}

+ return 0;
+}
+
+static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
+{
+ struct msgb *msg;
+ struct gsm48_hdr *gh;
+ 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)
+ goto error;
+
+ gsm48_start_cc_timer(trans, 0x303, GSM48_T303);
+
+ if (setup->fields & MNCC_F_BEARER_CAP)
+ trans->bearer_cap.transfer = setup->bearer_cap.transfer;
+
+ rc = gsm48_cc_tx_setup_select_codecs(trans, setup);
+ if (rc < 0)
+ goto error;
+
/* Compose Bearer Capability information that reflects only the codecs (Speech 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. */

To view, visit change 41039. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ic502f9ed77ea57de4cf6d362c0e7070d9147d6f3
Gerrit-Change-Number: 41039
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>