diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-09-13 22:41:48 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-09-18 12:37:07 +0000 |
commit | 3da77d53ba94746083891ba159ca0d4ef44ce996 (patch) | |
tree | 920c9666f0544aa78b9e3ed4cd62b984c4553efc | |
parent | 2cea100a7afd986dd699aea4afcf66632eb42d5a (diff) |
mgcp: Remove the endp_offset that was introduced due coding stupidity
The endpoint offset is needed for two reasons, first the API is 0
based here while we are normally 1 based, second because of the trunks
the first usable endpoint would be '2' (0 is CRC, 1 is signalling), but
this endpoint offset falls apart when we would block timeslots inside
this range.
Remove the endpoint offset, in each endpoint we will store the HW DSP
Port (1 based API) and then subtract one to get to the 0 based API for
the Simple API. Print a warning when someone is using the endpoint offset.
-rw-r--r-- | include/mgcp/mgcp.h | 2 | ||||
-rw-r--r-- | include/mgcp/mgcp_internal.h | 1 | ||||
-rw-r--r-- | src/mgcp/mgcp_protocol.c | 1 | ||||
-rw-r--r-- | src/mgcp_ss7.c | 7 | ||||
-rw-r--r-- | src/mgcp_ss7_vty.c | 18 |
5 files changed, 10 insertions, 19 deletions
diff --git a/include/mgcp/mgcp.h b/include/mgcp/mgcp.h index 2bd6eb5..9fe1ca1 100644 --- a/include/mgcp/mgcp.h +++ b/include/mgcp/mgcp.h @@ -122,8 +122,6 @@ struct mgcp_trunk_config { /* Special MGW handling */ int target_trunk_start; - int voice_base; - int endp_offset; int vad_enabled; int digital_inp_gain; diff --git a/include/mgcp/mgcp_internal.h b/include/mgcp/mgcp_internal.h index 838e84c..31d5fac 100644 --- a/include/mgcp/mgcp_internal.h +++ b/include/mgcp/mgcp_internal.h @@ -125,6 +125,7 @@ struct mgcp_endpoint { /* Special MGW handling */ int blocked; + unsigned int hw_snmp_port; /** This is index 1 based */ unsigned int audio_port; int block_processing; }; diff --git a/src/mgcp/mgcp_protocol.c b/src/mgcp/mgcp_protocol.c index a8b5ddf..fbf9fb7 100644 --- a/src/mgcp/mgcp_protocol.c +++ b/src/mgcp/mgcp_protocol.c @@ -876,7 +876,6 @@ static void trunk_init(struct mgcp_trunk_config *trunk) /* MGW handling */ trunk->target_trunk_start = 1; - trunk->endp_offset = 1; trunk->vad_enabled = 1; trunk->digital_inp_gain = 31; trunk->digital_out_gain = 31; diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c index 1201322..b224e0c 100644 --- a/src/mgcp_ss7.c +++ b/src/mgcp_ss7.c @@ -79,9 +79,7 @@ static int select_voice_port(struct mgcp_endpoint *endp) return -1; } - mgw_port = endp->tcfg->voice_base + 30 * multiplex; - - mgw_port = mgw_port + timeslot - endp->tcfg->endp_offset; + mgw_port = endp->hw_snmp_port - 1; fprintf(stderr, "TEST: Going to use MGW: %d for MUL: %d TS: %d\n", mgw_port, multiplex, timeslot); return mgw_port; @@ -707,6 +705,7 @@ static struct mgcp_ss7 *mgcp_ss7_init(struct mgcp_config *cfg) } dsp_resource += 1; + cfg->trunk.endpoints[i].hw_snmp_port = dsp_resource; if (cfg->configure_trunks) { int res; @@ -724,7 +723,6 @@ static struct mgcp_ss7 *mgcp_ss7_init(struct mgcp_config *cfg) } llist_for_each_entry(trunk, &cfg->trunks, entry) { - trunk->voice_base = dsp_resource; for (i = 1; i < trunk->number_endpoints; ++i) { int multiplex, timeslot; @@ -735,6 +733,7 @@ static struct mgcp_ss7 *mgcp_ss7_init(struct mgcp_config *cfg) } dsp_resource += 1; + trunk->endpoints[i].hw_snmp_port = dsp_resource; if (cfg->configure_trunks) { int res; diff --git a/src/mgcp_ss7_vty.c b/src/mgcp_ss7_vty.c index 2eb4396..d145777 100644 --- a/src/mgcp_ss7_vty.c +++ b/src/mgcp_ss7_vty.c @@ -156,12 +156,12 @@ DEFUN(cfg_mgcp_dwnstr_target, cfg_mgcp_dwnstr_target_cmd, return CMD_SUCCESS; } -DEFUN(cfg_mgcp_endp_offset, cfg_mgcp_endp_offset_cmd, +DEFUN_DEPRECATED(cfg_mgcp_endp_offset, cfg_mgcp_endp_offset_cmd, "endpoint-offset <-60-60>", "Offset to the CIC map\n" "Value to set\n") { - g_cfg->trunk.endp_offset = atoi(argv[0]); - return CMD_SUCCESS; + vty_out(vty, "%%endpoint-offset is not used anymore.%s", VTY_NEWLINE); + return CMD_WARNING; } DEFUN(cfg_mgcp_target_trunk, cfg_mgcp_target_trunk_cmd, @@ -307,14 +307,12 @@ DEFUN(cfg_trunk_dwnstr_target, cfg_trunk_dwnstr_target_cmd, return CMD_SUCCESS; } -DEFUN(cfg_trunk_endp_offset, cfg_trunk_endp_offset_cmd, +DEFUN_DEPRECATED(cfg_trunk_endp_offset, cfg_trunk_endp_offset_cmd, "endpoint-offset <-60-60>", "Offset to the CIC map\n" "Value to set\n") { - struct mgcp_trunk_config *trunk = vty->index; - - trunk->endp_offset = atoi(argv[0]); - return CMD_SUCCESS; + vty_out(vty, "%%endpoint-offset is not used anymore.%s", VTY_NEWLINE); + return CMD_WARNING; } void mgcp_write_extra(struct vty *vty, struct mgcp_config *cfg) @@ -345,8 +343,6 @@ void mgcp_write_extra(struct vty *vty, struct mgcp_config *cfg) cfg->trunk.dwnstr_max_gain, VTY_NEWLINE); vty_out(vty, " downstream-target-level %d%s", cfg->trunk.dwnstr_target_lvl, VTY_NEWLINE); - vty_out(vty, " endpoint-offset %d%s", - cfg->trunk.endp_offset, VTY_NEWLINE); vty_out(vty, " target-trunk-start %d%s", cfg->trunk.target_trunk_start, VTY_NEWLINE); } @@ -377,8 +373,6 @@ void mgcp_write_trunk_extra(struct vty *vty, struct mgcp_trunk_config *trunk) trunk->dwnstr_max_gain, VTY_NEWLINE); vty_out(vty, " downstream-target-level %d%s", trunk->dwnstr_target_lvl, VTY_NEWLINE); - vty_out(vty, " endpoint-offset %d%s", - trunk->endp_offset, VTY_NEWLINE); } |