codecs: match all AMR rates and modes
In msc_a_up_call_assignment_complete(), iterate all the new AMR modes and rates recently added to codec_mapping, and enlist all possible matches. Change-Id: I6163a51765efff998e05c9ee4e82a0a3759f2043
This commit is contained in:
parent
64475fc6d8
commit
d5c45dc580
|
@ -204,7 +204,7 @@ static const struct codec_mapping codec_map[] = {
|
||||||
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,3,4", S(10)), \
|
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,3,4", S(10)), \
|
||||||
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,3,6", S(12)), \
|
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,3,6", S(12)), \
|
||||||
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,5,7", S(14)), \
|
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,5,7", S(14)), \
|
||||||
/* AMR FR: S1 in compatibility with AMR-HR = without 12k2 */ \
|
/* AMR-FR with a mode-set compatible with AMR-HR on S1 */ \
|
||||||
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,4", S(1)), \
|
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,4", S(1)), \
|
||||||
\
|
\
|
||||||
/* HR rates */ \
|
/* HR rates */ \
|
||||||
|
@ -225,6 +225,7 @@ static const struct codec_mapping codec_map[] = {
|
||||||
/* FR rates */ \
|
/* FR rates */ \
|
||||||
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,4,7", S(1)), \
|
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,4,7", S(1)), \
|
||||||
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=7", S(7)), \
|
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=7", S(7)), \
|
||||||
|
/* AMR-FR with a mode-set compatible with AMR-HR on S1 */ \
|
||||||
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,4", S(1)), \
|
AMR_FR(IS_OA, FMTP_PREFIX "mode-set=0,2,4", S(1)), \
|
||||||
\
|
\
|
||||||
/* HR rates */ \
|
/* HR rates */ \
|
||||||
|
|
|
@ -1463,6 +1463,8 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct
|
||||||
|
|
||||||
if (codec_if_known) {
|
if (codec_if_known) {
|
||||||
const struct codec_mapping *codec_assigned;
|
const struct codec_mapping *codec_assigned;
|
||||||
|
const struct codec_mapping *m;
|
||||||
|
bool use_octet_aligned_on_aoip = true; /* TODO: by VTY config */
|
||||||
|
|
||||||
/* Check for unexpected codec with CSD */
|
/* Check for unexpected codec with CSD */
|
||||||
if (cc_trans->bearer_cap.transfer == GSM48_BCAP_ITCAP_UNR_DIG_INF &&
|
if (cc_trans->bearer_cap.transfer == GSM48_BCAP_ITCAP_UNR_DIG_INF &&
|
||||||
|
@ -1486,15 +1488,28 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct
|
||||||
* - ran_msg_iu.c always returns FR3 (AMR FR) for the assigned codec. Set that at the MGW towards CN.
|
* - ran_msg_iu.c always returns FR3 (AMR FR) for the assigned codec. Set that at the MGW towards CN.
|
||||||
* - So the MGW decapsulates IuUP <-> AMR
|
* - So the MGW decapsulates IuUP <-> AMR
|
||||||
*/
|
*/
|
||||||
codec_assigned = codec_mapping_by_gsm0808_speech_codec_type(codec_if_known->type);
|
|
||||||
/* TODO: use codec_mapping_by_gsm0808_speech_codec() to also match on codec_if_known->cfg */
|
codec_assigned = NULL;
|
||||||
|
codec_mapping_foreach (m) {
|
||||||
|
/* look for a full match, including the S0-S15 bits in codec.cfg that configure AMR rates. */
|
||||||
|
if (!codec_mapping_matches_gsm0808_speech_codec(m, codec_if_known))
|
||||||
|
continue;
|
||||||
|
/* In case of AMR, match OA/BE with what osmo-msc should use on AoIP (configured in VTY) */
|
||||||
|
if (m->amr.is_amr && m->amr.is_octet_aligned != use_octet_aligned_on_aoip)
|
||||||
|
continue;
|
||||||
|
codec_assigned = m;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!codec_assigned) {
|
if (!codec_assigned) {
|
||||||
LOG_TRANS(cc_trans, LOGL_ERROR, "Unknown codec in Assignment Complete: %s\n",
|
LOG_TRANS(cc_trans, LOGL_ERROR, "Unknown codec in Assignment Complete: %s 0x%x\n",
|
||||||
gsm0808_speech_codec_type_name(codec_if_known->type));
|
gsm0808_speech_codec_type_name(codec_if_known->type), codec_if_known->cfg);
|
||||||
call_leg_release(msc_a->cc.call_leg);
|
call_leg_release(msc_a->cc.call_leg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: validate that the codec was indeed allowed */
|
||||||
|
|
||||||
/* Update RAN-side endpoint CI from Assignment result -- unless it is forced by the ran_infra, in which
|
/* Update RAN-side endpoint CI from Assignment result -- unless it is forced by the ran_infra, in which
|
||||||
* case it remains unchanged as passed to the earlier call of call_leg_ensure_ci(). */
|
* case it remains unchanged as passed to the earlier call of call_leg_ensure_ci(). */
|
||||||
if (msc_a->c.ran->force_mgw_codecs_to_ran.count == 0)
|
if (msc_a->c.ran->force_mgw_codecs_to_ran.count == 0)
|
||||||
|
|
|
@ -871,27 +871,32 @@ struct codec_test {
|
||||||
LIST_END \
|
LIST_END \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDP_CODECS_ALL_GSM \
|
|
||||||
{ \
|
/* EXPECTED FAILURE: These entries are currently missing until upcoming patches are merged:
|
||||||
"AMR:octet-align=1;mode-set=0,2,4,7#112", \
|
|
||||||
"AMR:octet-align=1;mode-set=7#114", \
|
"AMR:octet-align=1;mode-set=7#114", \
|
||||||
"AMR:octet-align=1;mode-set=0,2,4#115", \
|
"AMR:octet-align=1;mode-set=0,2,4#115", \
|
||||||
"AMR:mode-set=0,2,4,7#116", \
|
"AMR:mode-set=0,2,4,7#116", \
|
||||||
"AMR:mode-set=7#117", \
|
"AMR:mode-set=7#117", \
|
||||||
"AMR:mode-set=0,2,4#118", \
|
"AMR:mode-set=0,2,4#118", \
|
||||||
|
*/
|
||||||
|
#define SDP_CODECS_ALL_GSM \
|
||||||
|
{ \
|
||||||
|
"AMR:octet-align=1;mode-set=0,2,4,7#112", \
|
||||||
"GSM-EFR#110", \
|
"GSM-EFR#110", \
|
||||||
"GSM#3", \
|
"GSM#3", \
|
||||||
"GSM-HR-08#111", \
|
"GSM-HR-08#111", \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDP_CODECS_ALL_GSM_WITH_ODD_PT_NRS \
|
/* EXPECTED FAILURE: These entries are currently missing until upcoming patches are merged:
|
||||||
{ \
|
|
||||||
"AMR:octet-align=1;mode-set=0,2,4,7#127", \
|
|
||||||
"AMR:octet-align=1;mode-set=7#126", \
|
"AMR:octet-align=1;mode-set=7#126", \
|
||||||
"AMR:octet-align=1;mode-set=0,2,4#125", \
|
"AMR:octet-align=1;mode-set=0,2,4#125", \
|
||||||
"AMR:mode-set=0,2,4,7#124", \
|
"AMR:mode-set=0,2,4,7#124", \
|
||||||
"AMR:mode-set=7#123", \
|
"AMR:mode-set=7#123", \
|
||||||
"AMR:mode-set=0,2,4#122", \
|
"AMR:mode-set=0,2,4#122", \
|
||||||
|
*/
|
||||||
|
#define SDP_CODECS_ALL_GSM_WITH_ODD_PT_NRS \
|
||||||
|
{ \
|
||||||
|
"AMR:octet-align=1;mode-set=0,2,4,7#127", \
|
||||||
"GSM-EFR#110", \
|
"GSM-EFR#110", \
|
||||||
"GSM#3", \
|
"GSM#3", \
|
||||||
"GSM-HR-08#111", \
|
"GSM-HR-08#111", \
|
||||||
|
|
Loading…
Reference in New Issue