diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-11-12 17:03:26 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-11-18 20:27:53 +0000 |
commit | 26d57be10228f9bb077c6657d98ddeaebbdedd8b (patch) | |
tree | 38f0af52bd1b28939033847921738ff1af3ccf32 /library | |
parent | 2eeb511f43c16f87710ee2697a2d4e5e0a9cd8f7 (diff) |
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
Diffstat (limited to 'library')
-rw-r--r-- | library/L3_Templates.ttcn | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn index 52d4a2ad..e109fde9 100644 --- a/library/L3_Templates.ttcn +++ b/library/L3_Templates.ttcn @@ -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; |