summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/mgcpgw_client.h1
-rw-r--r--openbsc/src/libmgcp/mgcpgw_client.c2
-rw-r--r--openbsc/src/libmgcp/mgcpgw_client_vty.c21
-rw-r--r--openbsc/src/libmsc/msc_ifaces.c12
4 files changed, 33 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/mgcpgw_client.h b/openbsc/include/openbsc/mgcpgw_client.h
index de3fe6a..24b1fd6 100644
--- a/openbsc/include/openbsc/mgcpgw_client.h
+++ b/openbsc/include/openbsc/mgcpgw_client.h
@@ -26,6 +26,7 @@ struct mgcpgw_client_conf {
int remote_port;
uint16_t first_endpoint;
uint16_t last_endpoint;
+ uint16_t bts_base;
};
struct mgcp_response_head {
diff --git a/openbsc/src/libmgcp/mgcpgw_client.c b/openbsc/src/libmgcp/mgcpgw_client.c
index 0c5b5ca..12880dd 100644
--- a/openbsc/src/libmgcp/mgcpgw_client.c
+++ b/openbsc/src/libmgcp/mgcpgw_client.c
@@ -45,6 +45,7 @@ void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf)
.remote_port = -1,
.first_endpoint = 0,
.last_endpoint = 0,
+ .bts_base = 0,
};
}
@@ -342,6 +343,7 @@ struct mgcpgw_client *mgcpgw_client_init(void *ctx,
mgcp->actual.first_endpoint = conf->first_endpoint > 0 ? (uint16_t)conf->first_endpoint : 0;
mgcp->actual.last_endpoint = conf->last_endpoint > 0 ? (uint16_t)conf->last_endpoint : 0;
+ mgcp->actual.bts_base = conf->bts_base > 0 ? (uint16_t)conf->bts_base : 4000;
return mgcp;
}
diff --git a/openbsc/src/libmgcp/mgcpgw_client_vty.c b/openbsc/src/libmgcp/mgcpgw_client_vty.c
index 8670192..8068000 100644
--- a/openbsc/src/libmgcp/mgcpgw_client_vty.c
+++ b/openbsc/src/libmgcp/mgcpgw_client_vty.c
@@ -99,12 +99,26 @@ DEFUN(cfg_mgcpgw_endpoint_range, cfg_mgcpgw_endpoint_range_cmd,
return CMD_SUCCESS;
}
+#define BTS_START_STR "First UDP port allocated for the BTS side\n"
+#define UDP_PORT_STR "UDP Port number\n"
+DEFUN(cfg_mgcp_rtp_bts_base_port,
+ cfg_mgcp_rtp_bts_base_port_cmd,
+ "mgcpgw bts-base <0-65534>",
+ MGCPGW_STR
+ BTS_START_STR
+ UDP_PORT_STR)
+{
+ global_mgcpgw_client_conf->bts_base = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
int mgcpgw_client_config_write(struct vty *vty, const char *indent)
{
const char *addr;
int port;
uint16_t first_endpoint;
uint16_t last_endpoint;
+ uint16_t bts_base;
addr = global_mgcpgw_client_conf->local_addr;
if (addr)
@@ -131,6 +145,12 @@ int mgcpgw_client_config_write(struct vty *vty, const char *indent)
first_endpoint, last_endpoint, VTY_NEWLINE);
}
+ bts_base = global_mgcpgw_client_conf->bts_base;
+ if (bts_base) {
+ vty_out(vty, "%smgcpgw bts-base %u%s", indent,
+ bts_base, VTY_NEWLINE);
+ }
+
return CMD_SUCCESS;
}
@@ -143,4 +163,5 @@ void mgcpgw_client_vty_init(int node, struct mgcpgw_client_conf *conf)
install_element(node, &cfg_mgcpgw_remote_ip_cmd);
install_element(node, &cfg_mgcpgw_remote_port_cmd);
install_element(node, &cfg_mgcpgw_endpoint_range_cmd);
+ install_element(node, &cfg_mgcp_rtp_bts_base_port_cmd);
}
diff --git a/openbsc/src/libmsc/msc_ifaces.c b/openbsc/src/libmsc/msc_ifaces.c
index 3dbe7c3..e54f1e9 100644
--- a/openbsc/src/libmsc/msc_ifaces.c
+++ b/openbsc/src/libmsc/msc_ifaces.c
@@ -195,6 +195,7 @@ static int conn_iu_rab_act_cs(struct gsm_trans *trans)
struct mgcpgw_client *mgcp = conn->network->mgcpgw.client;
struct msgb *msg;
struct msgb *msg_dlcx;
+ uint16_t bts_base;
/* HACK. where to scope the RAB Id? At the conn / subscriber /
* ue_conn_ctx? */
@@ -203,9 +204,14 @@ static int conn_iu_rab_act_cs(struct gsm_trans *trans)
conn->iu.mgcp_rtp_endpoint =
mgcpgw_client_next_endpoint(conn->network->mgcpgw.client);
- /* HACK: the addresses should be known from CRCX response
- * and config. */
- conn->iu.mgcp_rtp_port_ue = 4000 + 2 * conn->iu.mgcp_rtp_endpoint;
+
+ /* This will calculate the port we assign to the BTS via AoIP
+ * assignment command (or rab-assignment on 3G) The BTS will send
+ * its RTP traffic to that port on the MGCPGW side. The MGCPGW only
+ * gets the endpoint ID via the CRCX. It will do the same calculation
+ * on his side too to get knowledge of the rtp port. */
+ bts_base = mgcp->actual.bts_base;
+ conn->iu.mgcp_rtp_port_ue = bts_base + 2 * conn->iu.mgcp_rtp_endpoint;
/* Since we know now the endpoint number, we enforce a DLCX on tha
* endpoint in order to ensure that this endpoint is not occupied