support odd-length calling MSISDN in MSC tests

MSC tests were unable to match odd-length digit strings in
a CallingPartyBCD_Number template created by tr_Calling().
This happens because the raw encoder for CallingPartyBCD_Number
pads odd-length digits with 1-bits ('F'H). Do the same when
constructing such a template in our own code to ensure that
we'll match the actual data received.

Change-Id: I34439c8750f588802a5403375e2a3d6e74dae70c
Related: OS#2930
This commit is contained in:
Stefan Sperling 2018-11-12 17:03:26 +01:00 committed by Harald Welte
parent 2eeb511f43
commit 26d57be102
2 changed files with 12 additions and 5 deletions

View File

@ -838,11 +838,20 @@ template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
digits := digits
}
private function f_pad_digits(hexstring digits) return hexstring {
if (lengthof(digits) mod 2 != 0) {
/* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
* Otherwise our template won't match the data received (see OS#2930). */
return digits & 'F'H;
}
return digits;
}
template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
elementIdentifier := '5C'O,
lengthIndicator := ?,
oct3 := ?,
digits := digits
digits := f_pad_digits(valueof(digits))
}
type integer SpeechVer;

View File

@ -1722,8 +1722,7 @@ testcase TC_lu_imsi_auth_tmsi_encr_013_2() runs on MTC_CT {
/* LU followed by MT call (including paging) */
private function f_tc_lu_and_mt_call(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
f_init_handler(pars);
//FIXME: odd digits var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
var CallParameters cpars := valueof(t_CallParams('123456'H, 0));
var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
cpars.bss_rtp_port := 1110;
cpars.mgcp_connection_id_bss := '10004'H;
cpars.mgcp_connection_id_mss := '10005'H;
@ -1845,8 +1844,7 @@ testcase TC_mo_release_timeout() runs on MTC_CT {
/* LU followed by MT call (including paging) */
private function f_tc_lu_and_mt_call_no_dlcx_resp(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
f_init_handler(pars);
//FIXME: odd digits var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
var CallParameters cpars := valueof(t_CallParams('123456'H, 0));
var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
cpars.bss_rtp_port := 1110;
cpars.mgcp_connection_id_bss := '10004'H;
cpars.mgcp_connection_id_mss := '10005'H;