summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-08-30 15:59:16 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-08-30 15:59:16 +0200
commit1650d5d50b0282af51b6e6929cc955cf99852c96 (patch)
treefdc6d369af1bfeedfeb41b0cd474e5e001a67e30
parentde51b57c9111f195b342c63121c6471863f89772 (diff)
mgcp: Configure the direction the compression should work
It needs to be configured correctly on the NAT.
-rw-r--r--openbsc/include/openbsc/mgcp_internal.h1
-rw-r--r--openbsc/src/libmgcp/mgcp_protocol.c14
-rw-r--r--openbsc/src/libmgcp/mgcp_vty.c43
3 files changed, 58 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h
index edf08d3..830f80e 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -182,6 +182,7 @@ int rtp_decompress(struct mgcp_rtp_compr_state *state, struct llist_head *list,
struct msgb *msg);
+const char *mgcp_compr_name(int);
void mgcp_msgb_clear_queue(struct llist_head *list);
struct msgb *mgcp_msgb_alloc(void);
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 335d1dd..4867f4f 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -1159,3 +1159,17 @@ int mgcp_reset_transcoder(struct mgcp_config *cfg)
return send_trans(cfg, mgcp_reset, sizeof mgcp_reset -1);
}
+
+const char *mgcp_compr_name(int name)
+{
+ switch (name) {
+ case COMPR_NONE:
+ return "none";
+ case COMPR_NET:
+ return "net";
+ case COMPR_BTS:
+ return "bts";
+ default:
+ return "bug";
+ }
+}
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 0b7a97e..71c249c 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -102,6 +102,11 @@ static int config_write_mgcp(struct vty *vty)
g_cfg->transcoder_ports.range_start, g_cfg->transcoder_ports.range_end, VTY_NEWLINE);
vty_out(vty, " transcoder-remote-base %u%s", g_cfg->transcoder_remote_base, VTY_NEWLINE);
+ /* Compression */
+ vty_out(vty, " allow-compression %s%s",
+ mgcp_compr_name(g_cfg->trunk.compress_dir), VTY_NEWLINE);
+
+
return CMD_SUCCESS;
}
@@ -376,6 +381,30 @@ DEFUN(cfg_mgcp_transcoder_remote_base,
return CMD_SUCCESS;
}
+#define COMPR_STR \
+ "Allow Compression\n" \
+ "No Compression\n" "Compress data to the network\n" \
+ "Compress data to the BTS/BSC\n"
+
+static void parse_compression(struct mgcp_trunk_config *trunk, const char *da)
+{
+ if (strcmp(da, "none") == 0)
+ trunk->compress_dir = COMPR_NONE;
+ else if (strcmp(da, "net") == 0)
+ trunk->compress_dir = COMPR_NET;
+ else if (strcmp(da, "bts") == 0)
+ trunk->compress_dir = COMPR_BTS;
+}
+
+DEFUN(cfg_mgcp_compr,
+ cfg_mgcp_compr_cmd,
+ "allow-compression (none|net|bts)",
+ COMPR_STR)
+{
+ parse_compression(&g_cfg->trunk, argv[0]);
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_mgcp_trunk, cfg_mgcp_trunk_cmd,
"trunk <1-64>",
"Configure a SS7 trunk\n" "Trunk Nr\n")
@@ -410,6 +439,8 @@ static int config_write_trunk(struct vty *vty)
trunk->audio_name, VTY_NEWLINE);
vty_out(vty, " loop %d%s",
trunk->audio_loop, VTY_NEWLINE);
+ vty_out(vty, " allow-compression %s%s",
+ mgcp_compr_name(g_cfg->trunk.compress_dir), VTY_NEWLINE);
}
return CMD_SUCCESS;
@@ -449,6 +480,16 @@ DEFUN(cfg_trunk_loop,
return CMD_SUCCESS;
}
+DEFUN(cfg_trunk_compr,
+ cfg_trunk_compr_cmd,
+ "allow-compression (none|net|bts)",
+ COMPR_STR)
+{
+ struct mgcp_trunk_config *trunk = vty->index;
+ parse_compression(trunk, argv[0]);
+ return CMD_SUCCESS;
+}
+
DEFUN(loop_endp,
loop_endp_cmd,
"loop-endpoint <0-64> NAME (0|1)",
@@ -618,6 +659,7 @@ int mgcp_vty_init(void)
install_element(MGCP_NODE, &cfg_mgcp_sdp_payload_name_cmd);
install_element(MGCP_NODE, &cfg_mgcp_loop_cmd);
install_element(MGCP_NODE, &cfg_mgcp_number_endp_cmd);
+ install_element(MGCP_NODE, &cfg_mgcp_compr_cmd);
install_element(MGCP_NODE, &cfg_mgcp_trunk_cmd);
install_node(&trunk_node, config_write_trunk);
@@ -627,6 +669,7 @@ int mgcp_vty_init(void)
install_element(TRUNK_NODE, &cfg_trunk_payload_number_cmd);
install_element(TRUNK_NODE, &cfg_trunk_payload_name_cmd);
install_element(TRUNK_NODE, &cfg_trunk_loop_cmd);
+ install_element(TRUNK_NODE, &cfg_trunk_compr_cmd);
return 0;
}