diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h index 0e45f521d..4adea96b8 100644 --- a/openbsc/include/openbsc/mgcp.h +++ b/openbsc/include/openbsc/mgcp.h @@ -109,14 +109,17 @@ struct mgcp_config { unsigned int number_endpoints; char *bts_ip; char *call_agent_addr; - char *transcoder_ip; struct in_addr bts_in; - struct in_addr transcoder_in; char *audio_name; int audio_payload; int audio_loop; + /* transcoder handling */ + char *transcoder_ip; + struct in_addr transcoder_in; + int transcoder_remote_base; + struct write_queue gw_fd; struct mgcp_port_range bts_ports; diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c index 6ee268c4c..96f35df7e 100644 --- a/openbsc/src/mgcp/mgcp_network.c +++ b/openbsc/src/mgcp/mgcp_network.c @@ -174,7 +174,7 @@ static int send_transcoder(struct mgcp_endpoint *endp, int is_rtp, return -1; } - port = rtp_calculate_port(ENDPOINT_NUMBER(endp), 4000); + port = rtp_calculate_port(ENDPOINT_NUMBER(endp), cfg->transcoder_remote_base); if (!is_rtp) port += 1; diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c index 6d9a6b405..f18431aa9 100644 --- a/openbsc/src/mgcp/mgcp_protocol.c +++ b/openbsc/src/mgcp/mgcp_protocol.c @@ -780,6 +780,7 @@ struct mgcp_config *mgcp_config_alloc(void) cfg->source_addr = talloc_strdup(cfg, "0.0.0.0"); cfg->audio_name = talloc_strdup(cfg, "AMR/8000"); cfg->audio_payload = 126; + cfg->transcoder_remote_base = 4000; cfg->bts_ports.base_port = RTP_PORT_DEFAULT; cfg->net_ports.base_port = RTP_PORT_NET_DEFAULT; @@ -934,7 +935,7 @@ static void create_transcoder(struct mgcp_endpoint *endp) send_msg(endp, out_endp, endp->transcoder_end.local_port, "CRCX", "sendrecv"); send_msg(endp, out_endp, endp->transcoder_end.local_port, "MDCX", "sendrecv"); - port = rtp_calculate_port(out_endp, 4000); + port = rtp_calculate_port(out_endp, endp->cfg->transcoder_remote_base); endp->transcoder_end.rtp_port = htons(port); endp->transcoder_end.rtcp_port = htons(port + 1); } diff --git a/openbsc/src/mgcp/mgcp_vty.c b/openbsc/src/mgcp/mgcp_vty.c index d84c3c1d0..d7c649e5b 100644 --- a/openbsc/src/mgcp/mgcp_vty.c +++ b/openbsc/src/mgcp/mgcp_vty.c @@ -86,6 +86,7 @@ static int config_write_mgcp(struct vty *vty) else vty_out(vty, " rtp transcoder-range %u %u%s", 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); return CMD_SUCCESS; } @@ -329,6 +330,16 @@ DEFUN(cfg_mgcp_transcoder, return CMD_SUCCESS; } +DEFUN(cfg_mgcp_transcoder_remote_base, + cfg_mgcp_transcoder_remote_base_cmd, + "transcoder-remote-base <0-65534>", + "Set the base port for the transcoder\n" "The RTP base port on the transcoder") +{ + g_cfg->transcoder_remote_base = atoi(argv[0]); + return CMD_SUCCESS; +} + + DEFUN(loop_endp, loop_endp_cmd, "loop-endpoint NAME (0|1)", @@ -453,6 +464,7 @@ int mgcp_vty_init(void) install_element(MGCP_NODE, &cfg_mgcp_number_endp_cmd); install_element(MGCP_NODE, &cfg_mgcp_agent_addr_cmd); install_element(MGCP_NODE, &cfg_mgcp_transcoder_cmd); + install_element(MGCP_NODE, &cfg_mgcp_transcoder_remote_base_cmd); return 0; }