aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-05-23 11:13:36 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-06-04 13:43:37 +0200
commit4b750fb119310570ba806bcd475b5b1798906a05 (patch)
tree6bed32ca44784db54f1bc8b8dfaf09bdc8bb1295
parent3bb2a91cd86e26ee254ed3d013c27e7689c87ef2 (diff)
dtmf: Make the on/off time and transmit power configurable
Make it possible to configure the transmit power. These settings will be in effect immediately (there is no lock between the two threads but it is a read only).
-rw-r--r--include/mgcp/mgcp.h2
-rw-r--r--src/mgcp/mgcp_protocol.c4
-rw-r--r--src/mgcp_ss7.c5
-rw-r--r--src/mgcp_ss7_vty.c28
4 files changed, 39 insertions, 0 deletions
diff --git a/include/mgcp/mgcp.h b/include/mgcp/mgcp.h
index 6ac3896..71f3745 100644
--- a/include/mgcp/mgcp.h
+++ b/include/mgcp/mgcp.h
@@ -128,6 +128,8 @@ struct mgcp_trunk_config {
char *virtual_domain;
int target_trunk_start;
int vad_enabled;
+ int dtmf_on_off_time;
+ int dtmf_transmit_pwr;
int digital_inp_gain;
int digital_out_gain;
diff --git a/src/mgcp/mgcp_protocol.c b/src/mgcp/mgcp_protocol.c
index 4fc6135..d3561d5 100644
--- a/src/mgcp/mgcp_protocol.c
+++ b/src/mgcp/mgcp_protocol.c
@@ -948,6 +948,10 @@ static void trunk_init(struct mgcp_trunk_config *trunk)
trunk->dwnstr_adp_rate = 100;
trunk->dwnstr_max_gain = 46;
trunk->dwnstr_target_lvl = 20;
+
+ /* dtmf defaults */
+ trunk->dtmf_on_off_time = 70;
+ trunk->dtmf_transmit_pwr = 50;
}
struct mgcp_config *mgcp_config_alloc(void)
diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c
index c4a1d34..6604545 100644
--- a/src/mgcp_ss7.c
+++ b/src/mgcp_ss7.c
@@ -510,6 +510,11 @@ static void allocate_endp(struct mgcp_ss7 *ss7, struct mgcp_endpoint *endp)
ManObj_C_AMR_MODE_REQUEST, 2, 0);
MtnSaSetManObject(mgw_port, ChannelType_PORT,
ManObj_C_VOICE_VAD_CNG, endp->tcfg->vad_enabled, 0);
+ MtnSaSetManObject(mgw_port, ChannelType_PORT,
+ ManObj_G_DTMF_ON_OFF_TIME, endp->tcfg->dtmf_on_off_time, 0);
+ MtnSaSetManObject(mgw_port, ChannelType_PORT,
+ ManObj_G_DTMF_TRANSMIT_POWER, endp->tcfg->dtmf_transmit_pwr, 0);
+
update_mute_status(mgw_port, endp->conn_mode);
diff --git a/src/mgcp_ss7_vty.c b/src/mgcp_ss7_vty.c
index 07e44a5..8ed27ad 100644
--- a/src/mgcp_ss7_vty.c
+++ b/src/mgcp_ss7_vty.c
@@ -246,6 +246,26 @@ DEFUN(cfg_trunk_loop_idle, cfg_trunk_loop_idle_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_trunk_dtmf_on_off_time, cfg_trunk_dtmf_on_off_time_cmd,
+ "dtmf on-off-time <50-255>",
+ "DTMF related commands\n" "On-Off-Time for tones\n"
+ "Time in milliseconds\n")
+{
+ struct mgcp_trunk_config *trunk = vty->index;
+ trunk->dtmf_on_off_time = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_trunk_dtmf_transmit_pwr, cfg_trunk_dtmf_transmit_pwr_cmd,
+ "dtmf transmit-power <1-255>",
+ "DTMF related commands\n" "Transmit power\n"
+ "Power in units\n")
+{
+ struct mgcp_trunk_config *trunk = vty->index;
+ trunk->dtmf_transmit_pwr = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
void mgcp_write_extra(struct vty *vty, struct mgcp_config *cfg)
{
vty_out(vty, " configure-trunks %d%s",
@@ -293,6 +313,10 @@ void write_trunk_extra(struct vty *vty, struct mgcp_trunk_config *trunk)
trunk->dwnstr_target_lvl, VTY_NEWLINE);
vty_out(vty, " loop-on-idle %d%s",
trunk->loop_on_idle, VTY_NEWLINE);
+ vty_out(vty, " dtmf on-off-time %d%s",
+ trunk->dtmf_on_off_time, VTY_NEWLINE);
+ vty_out(vty, " dtmf transmit-power %d%s",
+ trunk->dtmf_transmit_pwr, VTY_NEWLINE);
write_blocked_endpoints(vty, trunk);
}
@@ -335,6 +359,8 @@ void mgcp_mgw_vty_init(void)
install_element(VTRUNK_NODE, &cfg_trunk_endp_offset_cmd);
install_element(VTRUNK_NODE, &cfg_trunk_timeslot_block_cmd);
install_element(VTRUNK_NODE, &cfg_trunk_loop_idle_cmd);
+ install_element(VTRUNK_NODE, &cfg_trunk_dtmf_on_off_time_cmd);
+ install_element(VTRUNK_NODE, &cfg_trunk_dtmf_transmit_pwr_cmd);
install_element(TRUNK_NODE, &cfg_trunk_vad_cmd);
install_element(TRUNK_NODE, &cfg_trunk_realloc_cmd);
@@ -351,6 +377,8 @@ void mgcp_mgw_vty_init(void)
install_element(TRUNK_NODE, &cfg_trunk_endp_offset_cmd);
install_element(TRUNK_NODE, &cfg_trunk_timeslot_block_cmd);
install_element(TRUNK_NODE, &cfg_trunk_loop_idle_cmd);
+ install_element(TRUNK_NODE, &cfg_trunk_dtmf_on_off_time_cmd);
+ install_element(TRUNK_NODE, &cfg_trunk_dtmf_transmit_pwr_cmd);
}