gscon: use BSS-common payload types on BSS side
In cases where a codec has no fixed (IANA) payload type number, a dynamically coosen payload type number is used. For the route between BSC and MSC 3GPP as designated certain payload type numbers. However, beond that, those payload type numbers may not necessarly apply. The RTP communication between BTS and BSC still might run on a completely different payload type number. libosmo-netif contains a header file which payload type numbers shall be used. Lets use those in order to signal the same payload type numbers as we actually use in the RTP packets to the MGW. Change-Id: I507a1b1446c8f140b2950d73cf737797604c1ac3 Related: OS#2728 Related: OS#3384
This commit is contained in:
parent
a406b167c1
commit
c80cce67af
|
@ -56,4 +56,4 @@ const char *mgwep_ci_name(const struct mgwep_ci *ci);
|
|||
const char *mgcp_conn_peer_name(const struct mgcp_conn_peer *info);
|
||||
|
||||
enum mgcp_codecs chan_mode_to_mgcp_codec(enum gsm48_chan_mode chan_mode, bool full_rate);
|
||||
void mgcp_pick_codec(struct mgcp_conn_peer *verb_info, const struct gsm_lchan *lchan);
|
||||
void mgcp_pick_codec(struct mgcp_conn_peer *verb_info, const struct gsm_lchan *lchan, bool bss_side);
|
||||
|
|
|
@ -491,7 +491,7 @@ bool gscon_connect_mgw_to_msc(struct gsm_subscriber_connection *conn,
|
|||
.call_id = conn->sccp.conn_id,
|
||||
.ptime = 20,
|
||||
};
|
||||
mgcp_pick_codec(&mgw_info, for_lchan);
|
||||
mgcp_pick_codec(&mgw_info, for_lchan, false);
|
||||
|
||||
rc = osmo_strlcpy(mgw_info.addr, addr, sizeof(mgw_info.addr));
|
||||
if (rc <= 0 || rc >= sizeof(mgw_info.addr)) {
|
||||
|
|
|
@ -157,7 +157,7 @@ static void lchan_rtp_fsm_wait_mgw_endpoint_available_onenter(struct osmo_fsm_in
|
|||
if (lchan->conn)
|
||||
crcx_info.call_id = lchan->conn->sccp.conn_id;
|
||||
crcx_info.ptime = 20;
|
||||
mgcp_pick_codec(&crcx_info, lchan);
|
||||
mgcp_pick_codec(&crcx_info, lchan, true);
|
||||
|
||||
mgw_endpoint_ci_request(lchan->mgw_endpoint_ci_bts, MGCP_VERB_CRCX, &crcx_info,
|
||||
fi, LCHAN_RTP_EV_MGW_ENDPOINT_AVAILABLE, LCHAN_RTP_EV_MGW_ENDPOINT_ERROR,
|
||||
|
@ -406,7 +406,7 @@ static void connect_mgw_endpoint_to_lchan(struct osmo_fsm_inst *fi,
|
|||
.port = to_lchan->abis_ip.bound_port,
|
||||
.ptime = 20,
|
||||
};
|
||||
mgcp_pick_codec(&mdcx_info, to_lchan);
|
||||
mgcp_pick_codec(&mdcx_info, to_lchan, true);
|
||||
|
||||
addr.s_addr = ntohl(to_lchan->abis_ip.bound_ip);
|
||||
addr_str = inet_ntoa(addr);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <osmocom/core/fsm.h>
|
||||
#include <osmocom/core/byteswap.h>
|
||||
#include <osmocom/netif/rtp.h>
|
||||
|
||||
#include <osmocom/bsc/debug.h>
|
||||
#include <osmocom/bsc/gsm_timers.h>
|
||||
|
@ -730,10 +731,31 @@ enum mgcp_codecs chan_mode_to_mgcp_codec(enum gsm48_chan_mode chan_mode, bool fu
|
|||
}
|
||||
}
|
||||
|
||||
void mgcp_pick_codec(struct mgcp_conn_peer *verb_info, const struct gsm_lchan *lchan)
|
||||
int chan_mode_to_mgcp_bss_pt(enum mgcp_codecs codec)
|
||||
{
|
||||
switch (codec) {
|
||||
case CODEC_GSMHR_8000_1:
|
||||
return RTP_PT_GSM_HALF;
|
||||
|
||||
case CODEC_GSMEFR_8000_1:
|
||||
return RTP_PT_GSM_EFR;
|
||||
|
||||
case CODEC_AMR_8000_1:
|
||||
return RTP_PT_AMR;
|
||||
|
||||
default:
|
||||
/* Not an error, we just leave it to libosmo-mgcp-client to
|
||||
* decide over the PT. */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void mgcp_pick_codec(struct mgcp_conn_peer *verb_info, const struct gsm_lchan *lchan, bool bss_side)
|
||||
{
|
||||
enum mgcp_codecs codec = chan_mode_to_mgcp_codec(lchan->tch_mode,
|
||||
lchan->type == GSM_LCHAN_TCH_H? false : true);
|
||||
int custom_pt;
|
||||
|
||||
if (codec < 0) {
|
||||
LOG_LCHAN(lchan, LOGL_ERROR,
|
||||
"Unable to determine MGCP codec type for %s in chan-mode %s\n",
|
||||
|
@ -744,4 +766,12 @@ void mgcp_pick_codec(struct mgcp_conn_peer *verb_info, const struct gsm_lchan *l
|
|||
|
||||
verb_info->codecs[0] = codec;
|
||||
verb_info->codecs_len = 1;
|
||||
|
||||
/* Setup custom payload types (only for BSS side and when required) */
|
||||
custom_pt = chan_mode_to_mgcp_bss_pt(codec);
|
||||
if (bss_side && custom_pt > 0) {
|
||||
verb_info->ptmap[0].codec = codec;
|
||||
verb_info->ptmap[0].pt = custom_pt;
|
||||
verb_info->ptmap_len = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ static void lcls_break_local_switching(struct gsm_subscriber_connection *conn)
|
|||
.port = conn->user_plane.msc_assigned_rtp_port,
|
||||
};
|
||||
osmo_strlcpy(mdcx_info.addr, conn->user_plane.msc_assigned_rtp_addr, sizeof(mdcx_info.addr));
|
||||
mgcp_pick_codec(&mdcx_info, conn->lchan);
|
||||
mgcp_pick_codec(&mdcx_info, conn->lchan, false);
|
||||
|
||||
mgw_endpoint_ci_request(conn->user_plane.mgw_endpoint_ci_msc,
|
||||
MGCP_VERB_MDCX, &mdcx_info,
|
||||
|
@ -573,7 +573,7 @@ static void lcls_locally_switched_onenter(struct osmo_fsm_inst *fi, uint32_t pre
|
|||
mdcx_info = *other_mgw_info;
|
||||
/* Make sure the request doesn't want to use the other side's endpoint string. */
|
||||
mdcx_info.endpoint[0] = 0;
|
||||
mgcp_pick_codec(&mdcx_info, conn->lchan);
|
||||
mgcp_pick_codec(&mdcx_info, conn->lchan, false);
|
||||
mgw_endpoint_ci_request(conn->user_plane.mgw_endpoint_ci_msc,
|
||||
MGCP_VERB_MDCX, &mdcx_info,
|
||||
NULL, 0, 0, NULL);
|
||||
|
|
Loading…
Reference in New Issue