aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/mgcp.h8
-rw-r--r--openbsc/src/bssap.c4
2 files changed, 9 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h
index a1053be90..53a308152 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -118,5 +118,13 @@ void mgcp_free_endp(struct mgcp_endpoint *endp);
struct msgb *mgcp_handle_message(struct mgcp_config *cfg, struct msgb *msg);
struct msgb *mgcp_create_response_with_data(int code, const char *msg, const char *trans, const char *data);
+/* adc helper */
+static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot)
+{
+ if (timeslot == 0)
+ timeslot = 1;
+ return timeslot + (31 * multiplex);
+}
+
#endif
diff --git a/openbsc/src/bssap.c b/openbsc/src/bssap.c
index fac6c1f57..cdee92bc9 100644
--- a/openbsc/src/bssap.c
+++ b/openbsc/src/bssap.c
@@ -556,9 +556,7 @@ static int bssmap_handle_assignm_req(struct sccp_connection *conn,
bsc_schedule_timer(&msc_data->T10, GSM0808_T10_VALUE);
/* the mgcp call agent starts counting at one. a bit of a weird mapping */
- if (timeslot == 0)
- timeslot = 1;
- port = timeslot + (31 * multiplex);
+ port = mgcp_timeslot_to_endpoint(multiplex, timeslot);
msc_data->rtp_port = rtp_calculate_port(port,
network->rtp_base_port);