neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/35437?usp=email )


Change subject: drop cfg 'sdp audio fmtp-extra'
......................................................................

drop cfg 'sdp audio fmtp-extra'

There is considerable code complexity in place for this ancient hack.

It dates back to 5ea1bc77a3947f541d576f95e7ecc7249fc65b9b
"
mgcp: Allow to freely control the a=fmtp line for experiments

In case of AMR one can specify the available codecs out-of-band. Allow
to configure this line statically in the configuration file.
"

Looking in mgcp_test.c output, the fmtp-extra tests do not even make
sense: they result in fmtp for pt=126 being added, even though there is
no payload type 126 listed in the SDP...

Related: OS#6313
Change-Id: Icee0cd1f5a751fa760d5a9deca29089e78e7eb93
---
M include/osmocom/mgcp/mgcp_network.h
M include/osmocom/mgcp/mgcp_trunk.h
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_sdp.c
M src/libosmo-mgcp/mgcp_vty.c
M tests/mgcp/mgcp_test.c
7 files changed, 42 insertions(+), 90 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/37/35437/1

diff --git a/include/osmocom/mgcp/mgcp_network.h 
b/include/osmocom/mgcp/mgcp_network.h
index 7f87224..99c7834 100644
--- a/include/osmocom/mgcp/mgcp_network.h
+++ b/include/osmocom/mgcp/mgcp_network.h
@@ -111,7 +111,6 @@
        int  frames_per_packet;
        uint32_t packet_duration_ms;
        int maximum_packet_time; /* -1: not set */
-       char *fmtp_extra;
        /* are we transmitting packets (true) or dropping (false) outbound 
packets */
        bool output_enabled;
        /* FIXME: This parameter can be set + printed, but is nowhere used! */
diff --git a/include/osmocom/mgcp/mgcp_trunk.h 
b/include/osmocom/mgcp/mgcp_trunk.h
index e608161..1679239 100644
--- a/include/osmocom/mgcp/mgcp_trunk.h
+++ b/include/osmocom/mgcp/mgcp_trunk.h
@@ -27,7 +27,6 @@
        unsigned int trunk_nr;
        enum mgcp_trunk_type trunk_type;

-       char *audio_fmtp_extra;
        int audio_send_ptime;
        int audio_send_name;

diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 283a213..d9bc573 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -110,8 +110,6 @@
        end->rtcp.fd = -1;
        memset(&end->addr, 0, sizeof(end->addr));
        end->rtcp_port = 0;
-       talloc_free(end->fmtp_extra);
-       end->fmtp_extra = NULL;

        /* Set default values */
        end->frames_per_packet = 0;     /* unknown */
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 0146815..22eb12d 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1076,9 +1076,6 @@
                rc = mgcp_conn_iuup_init(conn);
        }

-       conn->end.fmtp_extra = talloc_strdup(trunk->endpoints,
-                                            trunk->audio_fmtp_extra);
-
        if (pdata->cfg->force_ptime) {
                conn->end.packet_duration_ms = pdata->cfg->force_ptime;
                conn->end.force_output_ptime = 1;
diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index a6536f2..764e031 100644
--- a/src/libosmo-mgcp/mgcp_sdp.c
+++ b/src/libosmo-mgcp/mgcp_sdp.c
@@ -459,34 +459,10 @@
 }

 /* Add fmtp strings to sdp payload */
-static int add_fmtp(struct msgb *sdp, struct sdp_fmtp_param *fmtp_params, 
unsigned int fmtp_params_len,
-                   const char *fmtp_extra)
+static int add_fmtp(struct msgb *sdp, struct sdp_fmtp_param *fmtp_params, 
unsigned int fmtp_params_len)
 {
        unsigned int i;
        int rc;
-       int fmtp_extra_pt = -1;
-       char *fmtp_extra_pars = "";
-
-       /* When no fmtp parameters ara available but an fmtp extra string
-        * is configured, just add the fmtp extra string */
-       if (fmtp_params_len == 0 && fmtp_extra) {
-               return msgb_printf(sdp, "%s\r\n", fmtp_extra);
-       }
-
-       /* When there is fmtp extra configured we dissect it in order to drop
-        * in the configured extra parameters at the right place when
-        * generating the fmtp strings. */
-       if (fmtp_extra) {
-               if (sscanf(fmtp_extra, "a=fmtp:%d ", &fmtp_extra_pt) != 1)
-                       fmtp_extra_pt = -1;
-
-               fmtp_extra_pars = strstr(fmtp_extra, " ");
-
-               if (!fmtp_extra_pars)
-                       fmtp_extra_pars = "";
-               else
-                       fmtp_extra_pars++;
-       }

        for (i = 0; i < fmtp_params_len; i++) {
                bool first = true;
@@ -500,16 +476,6 @@
                        first = false;
                }

-               /* Append extra parameters from fmtp extra */
-               if (fmtp_params[i].payload_type == fmtp_extra_pt) {
-                       rc = msgb_printf(sdp, "%s%s",
-                                        first ? " " : ";",
-                                        fmtp_extra_pars);
-                       first = false;
-                       if (rc < 0)
-                               return -EINVAL;
-               }
-
                rc = msgb_printf(sdp, "\r\n");
                if (rc < 0)
                        return -EINVAL;
@@ -529,7 +495,6 @@
                            const char *addr)
 {
        const struct mgcp_rtp_codec *codec;
-       const char *fmtp_extra;
        const char *audio_name;
        int payload_type;
        int rc;
@@ -545,7 +510,6 @@
        OSMO_ASSERT(addr);

        codec = conn->end.codec;
-       fmtp_extra = conn->end.fmtp_extra;

        audio_name = codec->audio_name;
        payload_type = codec->payload_type;
@@ -597,7 +561,7 @@
                        fmtp_params[0].fmtp = 
OSMO_SDP_AMR_SET_OCTET_ALIGN(codec->param.amr_octet_aligned);
                }

-               rc = add_fmtp(sdp, fmtp_params, fmtp_params_len, fmtp_extra);
+               rc = add_fmtp(sdp, fmtp_params, fmtp_params_len);
                if (rc < 0)
                        goto buffer_too_small;
        }
diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 784894c..b82f3df 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -111,9 +111,6 @@
                        VTY_NEWLINE);
        } else
                vty_out(vty, " no rtp-patch%s", VTY_NEWLINE);
-       if (trunk->audio_fmtp_extra)
-               vty_out(vty, " sdp audio fmtp-extra %s%s",
-                       trunk->audio_fmtp_extra, VTY_NEWLINE);
        vty_out(vty, " %ssdp audio-payload send-ptime%s",
                trunk->audio_send_ptime ? "" : "no ", VTY_NEWLINE);
        vty_out(vty, " %ssdp audio-payload send-name%s",
@@ -187,7 +184,7 @@
                "   Payload Type: %d Rate: %u Channels: %d %s"
                "   Frame Duration: %u Frame Denominator: %u%s"
                "   FPP: %d Packet Duration: %u%s"
-               "   FMTP-Extra: %s Audio-Name: %s Sub-Type: %s%s"
+               "   Audio-Name: %s Sub-Type: %s%s"
                "   Output-Enabled: %d Force-PTIME: %d%s",
                tx_packets->current, tx_bytes->current, VTY_NEWLINE,
                rx_packets->current, rx_bytes->current, VTY_NEWLINE,
@@ -198,7 +195,7 @@
                codec->payload_type, codec->rate, codec->channels, VTY_NEWLINE,
                codec->frame_duration_num, codec->frame_duration_den,
                VTY_NEWLINE, end->frames_per_packet, end->packet_duration_ms,
-               VTY_NEWLINE, end->fmtp_extra, codec->audio_name,
+               VTY_NEWLINE, codec->audio_name,
                codec->subtype_name, VTY_NEWLINE, end->output_enabled,
                end->force_output_ptime, VTY_NEWLINE);
        if (mgcp_conn_rtp_is_osmux(conn)) {
@@ -681,21 +678,15 @@
        return CMD_SUCCESS;
 }

-DEFUN_USRATTR(cfg_mgcp_sdp_fmtp_extra,
-             cfg_mgcp_sdp_fmtp_extra_cmd,
-             X(MGW_CMD_ATTR_NEWCONN),
-             "sdp audio fmtp-extra .NAME",
-             "Add extra fmtp for the SDP file\n" "Audio\n" "Fmtp-extra\n"
-             "Extra Information\n")
-{
-       struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, 
MGCP_VIRT_TRUNK_ID);
-       OSMO_ASSERT(trunk);
-       char *txt = argv_concat(argv, argc, 0);
-       if (!txt)
-               return CMD_WARNING;
+#define SDP_STR "SDP File related options\n"
+#define AUDIO_STR "Audio payload options\n"

-       osmo_talloc_replace_string(g_cfg, &trunk->audio_fmtp_extra, txt);
-       talloc_free(txt);
+DEFUN_DEPRECATED(cfg_mgcp_sdp_fmtp_extra,
+             cfg_mgcp_sdp_fmtp_extra_cmd,
+             "sdp audio fmtp-extra .NAME",
+             SDP_STR AUDIO_STR "Deprecated, without effect since osmo-mgw 
v1.13\n" "Deprecated, without effect\n")
+{
+       vty_out(vty, "%% deprecated: the config option 'sdp audio fmtp-extra' 
has been removed.%s", VTY_NEWLINE);
        return CMD_SUCCESS;
 }

@@ -715,8 +706,6 @@
        return CMD_SUCCESS;
 }

-#define SDP_STR "SDP File related options\n"
-#define AUDIO_STR "Audio payload options\n"
 DEFUN_DEPRECATED(cfg_mgcp_sdp_payload_number,
       cfg_mgcp_sdp_payload_number_cmd,
       "sdp audio-payload number <0-255>",
@@ -1062,28 +1051,17 @@
                                VTY_NEWLINE);
                } else
                        vty_out(vty, "  no rtp-patch%s", VTY_NEWLINE);
-               if (trunk->audio_fmtp_extra)
-                       vty_out(vty, "   sdp audio fmtp-extra %s%s",
-                               trunk->audio_fmtp_extra, VTY_NEWLINE);
        }

        return CMD_SUCCESS;
 }

-DEFUN_USRATTR(cfg_trunk_sdp_fmtp_extra,
+DEFUN_DEPRECATED(cfg_trunk_sdp_fmtp_extra,
              cfg_trunk_sdp_fmtp_extra_cmd,
-             X(MGW_CMD_ATTR_NEWCONN),
              "sdp audio fmtp-extra .NAME",
-             "Add extra fmtp for the SDP file\n" "Audio\n" "Fmtp-extra\n"
-             "Extra Information\n")
+             SDP_STR AUDIO_STR "Deprecated, without effect since osmo-mgw 
v1.13\n" "Deprecated, without effect\n")
 {
-       struct mgcp_trunk *trunk = vty->index;
-       char *txt = argv_concat(argv, argc, 0);
-       if (!txt)
-               return CMD_WARNING;
-
-       osmo_talloc_replace_string(g_cfg, &trunk->audio_fmtp_extra, txt);
-       talloc_free(txt);
+       vty_out(vty, "%% deprecated: the config option 'sdp audio fmtp-extra' 
has been removed.%s", VTY_NEWLINE);
        return CMD_SUCCESS;
 }

diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index b3c111f..6fa032e 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -127,7 +127,6 @@
        "t=0 0\r\n" \
        "m=audio 16006 RTP/AVP 97\r\n" \
        "a=rtpmap:97 GSM-EFR/8000\r\n" \
-       "a=fmtp:126 0/1/2\r\n" \
        "a=ptime:40\r\n"

 #define MDCX4_ADDR0000 \
@@ -336,7 +335,6 @@
        "t=0 0\r\n" \
        "m=audio 16006 RTP/AVP 97\r\n" \
        "a=rtpmap:97 GSM-EFR/8000\r\n" \
-       "a=fmtp:126 0/1/2\r\n" \
        "a=ptime:40\r\n"

 #define CRCX_ZYN \
@@ -586,7 +584,6 @@
        const char *req;
        const char *exp_resp;
        int ptype;
-       const char *extra_fmtp;
 };

 static const struct mgcp_test tests[] = {
@@ -614,10 +611,9 @@
        {"RQNT1", RQNT, RQNT1_RET},
        {"RQNT2", RQNT2, RQNT2_RET},
        {"DLCX", DLCX, DLCX_RET, PTYPE_IGNORE},
-       {"CRCX", CRCX, CRCX_FMTP_RET, 97,.extra_fmtp = "a=fmtp:126 0/1/2"},
-       {"MDCX3", MDCX3, MDCX3_FMTP_RET, PTYPE_NONE,.extra_fmtp =
-        "a=fmtp:126 0/1/2"},
-       {"DLCX", DLCX, DLCX_RET, PTYPE_IGNORE,.extra_fmtp = "a=fmtp:126 0/1/2"},
+       {"CRCX", CRCX, CRCX_FMTP_RET, 97},
+       {"MDCX3", MDCX3, MDCX3_FMTP_RET, PTYPE_NONE},
+       {"DLCX", DLCX, DLCX_RET, PTYPE_IGNORE},
        {"CRCX", CRCX_NO_LCO_NO_SDP, CRCX_NO_LCO_NO_SDP_RET, 97},
        {"CRCX", CRCX_X_OSMO_IGN, CRCX_X_OSMO_IGN_RET, 97},
        {"MDCX_TOO_LONG_CI", MDCX_TOO_LONG_CI, MDCX_TOO_LONG_CI_RET},
@@ -831,9 +827,6 @@

                dummy_packets = 0;

-               osmo_talloc_replace_string(cfg, &trunk->audio_fmtp_extra,
-                                          t->extra_fmtp);
-
                inp = create_msg(t->req, last_conn_id);
                msg = mgcp_handle_message(cfg, inp);
                msgb_free(inp);

--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35437?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Icee0cd1f5a751fa760d5a9deca29089e78e7eb93
Gerrit-Change-Number: 35437
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to