osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/41039?usp=email )

Change subject: gsm48_cc_tx_setup_select_codecs: split out
......................................................................

gsm48_cc_tx_setup_select_codecs: split out

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

Approvals:
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index 93b4995..abf604f 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -865,34 +865,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); */
@@ -915,9 +903,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 https://gerrit.osmocom.org/c/osmo-msc/+/41039?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ic502f9ed77ea57de4cf6d362c0e7070d9147d6f3
Gerrit-Change-Number: 41039
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to