dexter has uploaded this change for review. ( https://gerrit.osmocom.org/13199


Change subject: AMR: Signal usage of octet-aligned or bandwith-efficient mode 
to MSC
......................................................................

AMR: Signal usage of octet-aligned or bandwith-efficient mode to MSC

MGCP/SDP provides fmtp parameters in order to signal which of the two
available AMR framing modes (octet-aligned or bandwith-efficient) should
be used on the link between BSS and core network. osmo-bsc currently
does not set up this mode which means that the RTP packets from the BTS
are forwared without inspection/modification, which may lead to
malfunction when a BTS is using a framing mode that is not supported by
the other end.

- Add VTY option to setup the framing mode
- Generate related fmtp parameters in SDP

Depends: osmo-mgw I622c01874b25f5049d4f59eb8157e0ea3cbe16ba
Change-Id: If6d40b2407b87aad2227ea7f15533ef01a3771b3
Related OS#3807
---
M include/osmocom/bsc/bsc_msc_data.h
M src/osmo-bsc/mgw_endpoint_fsm.c
M src/osmo-bsc/osmo_bsc_vty.c
3 files changed, 43 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/99/13199/1

diff --git a/include/osmocom/bsc/bsc_msc_data.h 
b/include/osmocom/bsc/bsc_msc_data.h
index 0c2094e..65a0dd3 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -91,6 +91,7 @@

        /* audio codecs */
        struct gsm48_multi_rate_conf amr_conf;
+       bool amr_octet_aligned;
        struct gsm_audio_support **audio_support;
        int audio_length;
        enum bsc_lcls_mode lcls_mode;
diff --git a/src/osmo-bsc/mgw_endpoint_fsm.c b/src/osmo-bsc/mgw_endpoint_fsm.c
index fc49886..5462914 100644
--- a/src/osmo-bsc/mgw_endpoint_fsm.c
+++ b/src/osmo-bsc/mgw_endpoint_fsm.c
@@ -34,6 +34,7 @@
 #include <osmocom/bsc/mgw_endpoint_fsm.h>
 #include <osmocom/bsc/lchan_fsm.h>
 #include <osmocom/bsc/gsm_data.h>
+#include <osmocom/bsc/bsc_msc_data.h>

 #define LOG_CI(ci, level, fmt, args...) do { \
        if (!ci || !ci->mgwep) \
@@ -774,4 +775,22 @@
                verb_info->ptmap[0].pt = custom_pt;
                verb_info->ptmap_len = 1;
        }
+
+       /* AMR requires additional parameters to be set up (framing mode) */
+       if (verb_info->codecs[0] == CODEC_AMR_8000_1) {
+               verb_info->param_present = true;
+               verb_info->param.amr_octet_aligned_present = true;
+       }
+
+       if (bss_side && verb_info->codecs[0] == CODEC_AMR_8000_1) {
+               /* FIXME: At the moment all BTSs we support are using the
+                * octet-aligned payload format. However, in the future
+                * we may support BTSs that are using bandwith-efficient
+                * format. In this case we will have to add functionality
+                * that distinguishes by the BTS model which mode to use. */
+               verb_info->param.amr_octet_aligned = true;
+       }
+       else if (!bss_side && verb_info->codecs[0] == CODEC_AMR_8000_1) {
+               verb_info->param.amr_octet_aligned = 
lchan->conn->sccp.msc->amr_octet_aligned;
+       }
 }
diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index 6e3d1c1..78196cf 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -100,6 +100,11 @@
        WRITE_AMR(vty, msc, "5_15k", m5_15);
        WRITE_AMR(vty, msc, "4_75k", m4_75);
 #undef WRITE_AMR
+
+       if (msc->amr_octet_aligned)
+               vty_out(vty, " amr-payload octet-aligned%s", VTY_NEWLINE);
+       else
+               vty_out(vty, " amr-payload bandwith-efficient%s", VTY_NEWLINE);
 }

 static void write_msc(struct vty *vty, struct bsc_msc_data *msc)
@@ -952,6 +957,23 @@
 ALIAS_DEPRECATED(cfg_net_msc_dest, cfg_net_msc_no_dest_cmd,
       "no dest A.B.C.D <1-65000> <0-255>", NO_STR LEGACY_STR "-\n" "-\n" 
"-\n");

+DEFUN(cfg_net_msc_amr_octet_align,
+      cfg_net_msc_amr_octet_align_cmd,
+      "amr-payload (octet-aligned|bandwith-efficient",
+      "Set AMR payload framing mode\n"
+      "payload fields aligned on octet boundaries\n"
+      "payload fields packed (AoIP)\n")
+{
+       struct bsc_msc_data *data = bsc_msc_data(vty);
+
+       if (strcmp(argv[0], "octet-aligned") == 0)
+               data->amr_octet_aligned = true;
+       else if (strcmp(argv[0], "bandwith-efficient") == 0)
+               data->amr_octet_aligned = false;
+
+       return CMD_SUCCESS;
+}
+
 int bsc_vty_init_extra(void)
 {
        struct gsm_network *net = bsc_gsmnet;
@@ -996,6 +1018,7 @@
        install_element(MSC_NODE, &cfg_net_msc_amr_5_90_cmd);
        install_element(MSC_NODE, &cfg_net_msc_amr_5_15_cmd);
        install_element(MSC_NODE, &cfg_net_msc_amr_4_75_cmd);
+       install_element(MSC_NODE, &cfg_net_msc_amr_octet_align_cmd);
        install_element(MSC_NODE, &cfg_net_msc_lcls_mode_cmd);
        install_element(MSC_NODE, &cfg_net_msc_lcls_mismtch_cmd);
        install_element(MSC_NODE, &cfg_msc_acc_lst_name_cmd);

--
To view, visit https://gerrit.osmocom.org/13199
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If6d40b2407b87aad2227ea7f15533ef01a3771b3
Gerrit-Change-Number: 13199
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pma...@sysmocom.de>

Reply via email to