[mgcp] Add a helper function to convert from GSM0808 ts/mux to MGCP endpoint
Move the conversion of GSM0808 timeslot and multiplex from the bssap.c into the mgcp.h so it can be reused by multiple users. The weird math comes from the mapping of the MSC...
This commit is contained in:
parent
790db1e01b
commit
5aaf7c164c
|
@ -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_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);
|
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
|
#endif
|
||||||
|
|
|
@ -556,9 +556,7 @@ static int bssmap_handle_assignm_req(struct sccp_connection *conn,
|
||||||
bsc_schedule_timer(&msc_data->T10, GSM0808_T10_VALUE);
|
bsc_schedule_timer(&msc_data->T10, GSM0808_T10_VALUE);
|
||||||
|
|
||||||
/* the mgcp call agent starts counting at one. a bit of a weird mapping */
|
/* the mgcp call agent starts counting at one. a bit of a weird mapping */
|
||||||
if (timeslot == 0)
|
port = mgcp_timeslot_to_endpoint(multiplex, timeslot);
|
||||||
timeslot = 1;
|
|
||||||
port = timeslot + (31 * multiplex);
|
|
||||||
msc_data->rtp_port = rtp_calculate_port(port,
|
msc_data->rtp_port = rtp_calculate_port(port,
|
||||||
network->rtp_base_port);
|
network->rtp_base_port);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue