[bsc] Add a rtp base port to the BSC config too

Stop having a global variable... keep it in the
gsm network or the mgcp
This commit is contained in:
Holger Hans Peter Freyther
2009-11-19 20:29:30 +01:00
parent b92167cf80
commit 7f71d99cc3
5 changed files with 20 additions and 3 deletions

View File

@@ -465,6 +465,7 @@ struct gsm_network {
struct gsm_audio_support **audio_support;
int audio_length;
int rtp_payload;
int rtp_base_port;
/* layer 4 */
int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg);

View File

@@ -21,8 +21,6 @@
*
*/
unsigned int rtp_base_port = 4000;
/**
* Calculate the RTP audio port for the given multiplex
* and the direction. This allows a semi static endpoint

View File

@@ -63,6 +63,7 @@ static const char *audio_name = "GSM-EFR/8000";
static int audio_payload = 97;
static int audio_loop = 0;
static int early_bind = 0;
static int rtp_base_port = 0;
static char *config_file = "mgcp.cfg";

View File

@@ -440,7 +440,8 @@ static int bssmap_handle_assignm_req(struct sccp_connection *conn,
/* the mgcp call agent starts counting at one. a bit of a weird mapping */
if (multiplex == 0)
multiplex = 1;
msc_data->rtp_port = rtp_calculate_port(multiplex, rtp_base_port);
msc_data->rtp_port = rtp_calculate_port(multiplex,
network->rtp_base_port);
DEBUGP(DMSC, "Sending ChanModify for speech on: sccp: %p mode: 0x%x on 0x%x port: %u\n",
conn, chan_mode, multiplex, msc_data->rtp_port);
if (chan_mode == GSM48_CMODE_SPEECH_AMR) {

View File

@@ -895,6 +895,21 @@ DEFUN(cfg_net_ipacc_rtp_payload,
return CMD_SUCCESS;
}
DEFUN(cfg_net_rtp_base_port,
cfg_net_rtp_base_port_cmd,
"rtp base <0-65534>",
"Base port to use for MGCP RTP")
{
unsigned int port = atoi(argv[0]);
if (port > 65534) {
vty_out(vty, "%% wrong base port '%s'%s", argv[0], VTY_NEWLINE);
return CMD_WARNING;
}
gsmnet->rtp_base_port = port;
return CMD_SUCCESS;
}
/* per-BTS configuration */
DEFUN(cfg_bts,
cfg_bts_cmd,
@@ -1337,6 +1352,7 @@ int bsc_vty_init(struct gsm_network *net)
install_element(GSMNET_NODE, &cfg_net_neci_cmd);
install_element(GSMNET_NODE, &cfg_net_supported_codecs_cmd);
install_element(GSMNET_NODE, &cfg_net_ipacc_rtp_payload_cmd);
install_element(GSMNET_NODE, &cfg_net_rtp_base_port_cmd);
install_element(GSMNET_NODE, &cfg_bts_cmd);
install_node(&bts_node, config_write_bts);