falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39621?usp=email )
Change subject: tests: add unit tests for osmo_rtp2trau()
......................................................................
tests: add unit tests for osmo_rtp2trau()
The suite of unit tests added in this patch exercises osmo_rtp2trau()
followed by osmo_trau_frame_encode() for the following combinations
of speech codec and TRAU frame type:
* FR and EFR codecs, TRAU-16k frames, both DL and UL
* HRv1 codec, TRAU-8k format, DL only
(RTP->TRAU conversion for HRv1 does not currenty support TRAU-UL
output.)
All output TRAU frames contained in rtp2trau_*.ok files (expected
output for unit tests) have been manually checked with Themyscira
decoding utilities trau-parse-hex (16k) and trau-hr-dump-hex (8k);
these utilities in turn were developed to analyze TRAU frame streams
captured from historical BTS and TRAU equipment, hence the chain of
truth reference comparison is traceable to pre-existing historical
hardware implementations of GSM 08.60 and 08.61 specs.
Change-Id: Ia5ca8af6bd3a899253bbcc718b70e43f2265b495
---
M .gitignore
M tests/Makefile.am
M tests/testsuite.at
A tests/trau_conv/efr_speech_basic.hex
A tests/trau_conv/efr_speech_twts001_good.hex
A tests/trau_conv/efr_speech_twts001_mix.hex
A tests/trau_conv/fr_speech_basic.hex
A tests/trau_conv/fr_speech_twts001_good.hex
A tests/trau_conv/fr_speech_twts001_mix.hex
A tests/trau_conv/hr_speech_rfc5993.hex
A tests/trau_conv/hr_speech_ts101318.hex
A tests/trau_conv/rtp2trau_efr_dl1.ok
A tests/trau_conv/rtp2trau_efr_dl2.ok
A tests/trau_conv/rtp2trau_efr_ul1.ok
A tests/trau_conv/rtp2trau_efr_ul2.ok
A tests/trau_conv/rtp2trau_efr_ul3.ok
A tests/trau_conv/rtp2trau_fr_dl1.ok
A tests/trau_conv/rtp2trau_fr_dl2.ok
A tests/trau_conv/rtp2trau_fr_ul1.ok
A tests/trau_conv/rtp2trau_fr_ul2.ok
A tests/trau_conv/rtp2trau_fr_ul3.ok
A tests/trau_conv/rtp2trau_gen.c
A tests/trau_conv/rtp2trau_hr_dl.ok
A tests/trau_conv/tw5reader.c
A tests/trau_conv/tw5reader.h
25 files changed, 735 insertions(+), 0 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
falconia: Looks good to me, approved
diff --git a/.gitignore b/.gitignore
index dbe50db..80e6834 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@
tests/raa_prime/test_dec
tests/raa_prime/test_enc
tests/trau_pcu_ericsson/trau_pcu_ericsson_test
+tests/trau_conv/rtp2trau_gen
tests/trau_conv/trau16_to_rtp
tests/trau_conv/trau2rtp_gen
tests/trau_sync/trau_sync_test
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4abfc4a..4645b7e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,6 +8,7 @@
ipa_recv/ipa_recv_test \
raa_prime/test_dec \
raa_prime/test_enc \
+ trau_conv/rtp2trau_gen \
trau_conv/trau16_to_rtp \
trau_conv/trau2rtp_gen \
trau_sync/trau_sync_test \
@@ -52,6 +53,9 @@
rtp_test_rtp_test_SOURCES = rtp_test/rtp_test.c
rtp_test_rtp_test_LDADD = $(TRAU_LA_LIBS)
+trau_conv_rtp2trau_gen_SOURCES = trau_conv/rtp2trau_gen.c trau_conv/tw5reader.c
+trau_conv_rtp2trau_gen_LDADD = $(TRAU_LA_LIBS)
+
trau_conv_trau16_to_rtp_SOURCES = trau_conv/trau16_to_rtp.c
trau_conv_trau16_to_rtp_LDADD = $(TRAU_LA_LIBS)
@@ -64,6 +68,8 @@
trau_pcu_ericsson_trau_pcu_ericsson_test_SOURCES = trau_pcu_ericsson/trau_pcu_ericsson_test.c
trau_pcu_ericsson_trau_pcu_ericsson_test_LDADD = $(TRAU_LA_LIBS)
+noinst_HEADERS = trau_conv/tw5reader.h
+
# boilerplate for the tests
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
@@ -88,6 +94,18 @@
ipa_recv/ipa_recv_test.ok \
raa_prime/d144-ul-input.asc raa_prime/nokia-tcsm2-atrau.hex \
rtp_test/rtp_test.ok \
+ trau_conv/efr_speech_basic.hex trau_conv/efr_speech_twts001_good.hex \
+ trau_conv/efr_speech_twts001_mix.hex \
+ trau_conv/fr_speech_basic.hex trau_conv/fr_speech_twts001_good.hex \
+ trau_conv/fr_speech_twts001_mix.hex \
+ trau_conv/hr_speech_rfc5993.hex trau_conv/hr_speech_ts101318.hex \
+ trau_conv/rtp2trau_efr_dl1.ok trau_conv/rtp2trau_efr_dl2.ok \
+ trau_conv/rtp2trau_efr_ul1.ok trau_conv/rtp2trau_efr_ul2.ok \
+ trau_conv/rtp2trau_efr_ul3.ok \
+ trau_conv/rtp2trau_fr_dl1.ok trau_conv/rtp2trau_fr_dl2.ok \
+ trau_conv/rtp2trau_fr_ul1.ok trau_conv/rtp2trau_fr_ul2.ok \
+ trau_conv/rtp2trau_fr_ul3.ok \
+ trau_conv/rtp2trau_hr_dl.ok \
trau_conv/trau16_efr.in trau_conv/trau16_efr_std.ok \
trau_conv/trau16_efr_twts001.ok \
trau_conv/trau16_fr.in trau_conv/trau16_fr_std.ok \
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 291d47d..a5cf070 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -90,3 +90,75 @@
cat $abs_srcdir/trau_conv/trau2rtp_hr_twts002.ok > expout
AT_CHECK([$abs_top_builddir/tests/trau_conv/trau2rtp_gen -8 -x $abs_srcdir/trau_conv/trau2rtp_hr.in], [0], [expout], [ignore])
AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_dl1])
+AT_KEYWORDS([rtp2trau_fr_dl1])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_dl1.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_basic.hex fr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_dl2])
+AT_KEYWORDS([rtp2trau_fr_dl2])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_dl2.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_twts001_good.hex fr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_ul1])
+AT_KEYWORDS([rtp2trau_fr_ul1])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_ul1.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_basic.hex fr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_ul2])
+AT_KEYWORDS([rtp2trau_fr_ul2])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_ul2.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_twts001_good.hex fr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_ul3])
+AT_KEYWORDS([rtp2trau_fr_ul3])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_ul3.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_twts001_mix.hex fr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_dl1])
+AT_KEYWORDS([rtp2trau_efr_dl1])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_dl1.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_basic.hex efr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_dl2])
+AT_KEYWORDS([rtp2trau_efr_dl2])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_dl2.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_twts001_good.hex efr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_ul1])
+AT_KEYWORDS([rtp2trau_efr_ul1])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_ul1.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_basic.hex efr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_ul2])
+AT_KEYWORDS([rtp2trau_efr_ul2])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_ul2.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_twts001_good.hex efr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_ul3])
+AT_KEYWORDS([rtp2trau_efr_ul3])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_ul3.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_twts001_mix.hex efr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_hr_dl1])
+AT_KEYWORDS([rtp2trau_hr_dl1])
+cat $abs_srcdir/trau_conv/rtp2trau_hr_dl.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/hr_speech_ts101318.hex hr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_hr_dl2])
+AT_KEYWORDS([rtp2trau_hr_dl2])
+cat $abs_srcdir/trau_conv/rtp2trau_hr_dl.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/hr_speech_rfc5993.hex hr dl], [0], [expout], [ignore])
+AT_CLEANUP
diff --git a/tests/trau_conv/efr_speech_basic.hex b/tests/trau_conv/efr_speech_basic.hex
new file mode 100644
index 0000000..b1dc98a
--- /dev/null
+++ b/tests/trau_conv/efr_speech_basic.hex
@@ -0,0 +1,15 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-EFR codec, using the basic RTP payload format of RFC 3551. The only
+# semantics allowed by this basic RTP payload format are good speech and
+# valid SID frames; the present test sequence exercises both.
+
+# first 5 frames from GSM 06.54 test0.cod: good speech frames,
+# two DHFs followed by 3 regular speech frames
+C085EB490FAAD603E3A18607B0C42C080480558000000000036B0000000000
+C085EB490FAAD603E3A18607B0C42C080480558000000000036B0000000000
+C7D32592D041B69F4C5775FE5FFFB94A89B6823DF4BB5374AC6FD35A26A92D
+C46F83F969C09E106324A86026E8F1B2002A0136F4FF12FDC45A3561608D70
+C6CF4F49D64E98BEE99B42DF0ECF48E02C1801EC92322FE4C07CD56A97C0D0
+
+# frame #71 (0-based numbering) from GSM 06.54 dtx01.cod: valid SID frame
+C286DD29B5806FFFFF80001E3BFFFFE0000800FFFFFF000040FFFCFFC00010
diff --git a/tests/trau_conv/efr_speech_twts001_good.hex b/tests/trau_conv/efr_speech_twts001_good.hex
new file mode 100644
index 0000000..9146be3
--- /dev/null
+++ b/tests/trau_conv/efr_speech_twts001_good.hex
@@ -0,0 +1,34 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-EFR codec, using the extended RTP payload format of TW-TS-001,
+# semantically corresponding to the uplink direction of a GSM call leg.
+#
+# The present example has been synthetically constructed from GSM 06.54
+# test sequence test0.cod (first 24 frames, enough to exercise TAF),
+# exhibiting the scenario of how GSM TCH/EFS UL would look with this
+# sequence in it under conditions of 100% error-free transmission,
+# i.e., no bad, corrupted or FACCH-stolen frames.
+
+E0C085EB490FAAD603E3A18607B0C42C080480558000000000036B0000000000
+E0C085EB490FAAD603E3A18607B0C42C080480558000000000036B0000000000
+E0C7D32592D041B69F4C5775FE5FFFB94A89B6823DF4BB5374AC6FD35A26A92D
+E0C46F83F969C09E106324A86026E8F1B2002A0136F4FF12FDC45A3561608D70
+E0C6CF4F49D64E98BEE99B42DF0ECF48E02C1801EC92322FE4C07CD56A97C0D0
+E0C46F43F93781183456EB245E4D074736045882A8A9FEC728C0ACB4090E3B6D
+E0C6AF4E83A50175B45688815E5D38E258B5F9206D64CEEDE4B62B9D0E6A6D8E
+E0C56ECF6364C1B564A43648227571484D0CE603ECDA8E996034FBB4E64B5CB3
+E0C6AECBB36382156125752CD88D59CDC26E97A32ECDAD5B243A1B75DD6AD88F
+E0C56F510999C278B23386B76AA713CFD60D070530DE0152A4C55CC93032854F
+E0C6AF4F63A502B7560FFB36A2B5D10BFE8C3785EC5026496FC17C1E4C8D248F
+E0C56F4F69375336549EF23661157859F7D6D806B28BDCCE43BDAA9697FCC04C
+E0C6AECF63550376301D108824DD2B1E1C9267072E6CA14017ADDB84A09202AC
+E0C56FC4F935D4963DA918A5250D0C0243B69887F2278593343A0B97F30BB094
+E0C6AF5069E8041AFE322B00E10E4C24538A1788720271A9E24A2C16F52ED90F
+E0C56F4F69464476DE1F957C5D1DB657F45118AC6D32464375422A8F71E2C28E
+E0C6AF4F697584B9316DF2EDA30659669A023809F360299E422E1B9FA699B6D0
+E0C48ECF63850517CA1634951F1DB71144A2672EECF09024ABC21BF3645EDF2F
+E0C6AF4E83850574103F7B4C9CFD1418E16A480B2CFC63CAE0361AA38E02916D
+E0C56F83F90685D665DBCDEDED15F9D9D601088BF302165EAFBA3C5939E5FB72
+E0C56F4F6A37D938405A8056E115FA97AAE0188CAE24EF5B1B420B091B56B90D
+E0C56F4F69458677D6764D8DA30D6F1EC260588D2D0A05C06B363C91F5C64110
+E0C56ECF63A65A7749EEDFAC990D0E91C1678A0DEAC6B0630931FB0C805B6D30
+E1C56FC4F404C7152210F2655D0D98C8C2E5F80E6F19BA804BBE2B1B5D7B7F93
diff --git a/tests/trau_conv/efr_speech_twts001_mix.hex b/tests/trau_conv/efr_speech_twts001_mix.hex
new file mode 100644
index 0000000..ff8bcec
--- /dev/null
+++ b/tests/trau_conv/efr_speech_twts001_mix.hex
@@ -0,0 +1,25 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-EFR codec, using the extended RTP payload format of TW-TS-001,
+# semantically corresponding to the uplink direction of a GSM call leg.
+#
+# The present example contains a mix of good and bad frames, the same
+# kind of mix that can be represented in a TRAU-UL frame stream.
+# This example has been constructed by taking a few frames out of
+# efr_speech_twts001_good.hex and corrupting some of them, turning them
+# into BFIs. The setting of DTXd bit is also exercised.
+
+# DTXd=0
+E0C56F510999C278B23386B76AA713CFD60D070530DE0152A4C55CC93032854F
+E0C6AF4F63A502B7560FFB36A2B5D10BFE8C3785EC5026496FC17C1E4C8D248F
+E2C56F4F69375336549EF23661157859F7D6D806B28BDCCE43BDAA9697FFFFFF
+E0C6AECF63550376301D108824DD2B1E1C9267072E6CA14017ADDB84A09202AC
+E2C56FC4F935D4963DA918A5250D0C0243B69887F2278593343A0B97F3000000
+E2C6AF5069E8041AFE322B00E10E4C24538AAAAAA20271A9E24A2C16F52ED90F
+
+# DTXd=1
+E8C56F510999C278B23386B76AA713CFD60D070530DE0152A4C55CC93032854F
+E8C6AF4F63A502B7560FFB36A2B5D10BFE8C3785EC5026496FC17C1E4C8D248F
+EAC56F4F69375336549EF23661157859F7D6D806B28BDCCE43BDAA9697FFFFFF
+E8C6AECF63550376301D108824DD2B1E1C9267072E6CA14017ADDB84A09202AC
+EAC56FC4F935D4963DA918A5250D0C0243B69887F2278593343A0B97F3000000
+EAC6AF5069E8041AFE322B00E10E4C24538AAAAAA20271A9E24A2C16F52ED90F
diff --git a/tests/trau_conv/fr_speech_basic.hex b/tests/trau_conv/fr_speech_basic.hex
new file mode 100644
index 0000000..d6ee569
--- /dev/null
+++ b/tests/trau_conv/fr_speech_basic.hex
@@ -0,0 +1,19 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-FR codec, using the basic RTP payload format of RFC 3551. The only
+# semantics allowed by this basic RTP payload format are good speech and
+# valid SID frames; the present test sequence exercises both.
+
+# first 4 frames from GSM 06.10 Seq01.cod: good speech frames
+D760A2E177503E681BD129615AB83E5C9CB52BB6B706F9CA56D4F037F7837A86BC
+D96292A5577FB8B75C10E8535D19FB4399B73299398CF96AE516D9D8D5258638C6
+D9E39269CF5FF3F318AF44285FF9469AB5C1DF7F78E35770BB30D91850EDA24E1C
+D8638B28E75F392A23B04AE29D365728A74C63BD36C694A9AE5D59FBD7D4315765
+
+# frame #41 (0-based numbering) from GSM 06.32 good_sp.cod: valid SID frame
+DAE6DB659B00010000000000000100000000000001000000000000010000000000
+
+# fixed silence frame of GSM 06.11
+DAA7AAA51A502038E46DB91B502038E46DB91B502038E46DB91B502038E46DB91B
+
+# decoder homing frame introduced in later versions of GSM 06.10
+D2577A1CDA50004924924924500049249249245000492492492450004923924924
diff --git a/tests/trau_conv/fr_speech_twts001_good.hex b/tests/trau_conv/fr_speech_twts001_good.hex
new file mode 100644
index 0000000..8aa5467
--- /dev/null
+++ b/tests/trau_conv/fr_speech_twts001_good.hex
@@ -0,0 +1,34 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-FR codec, using the extended RTP payload format of TW-TS-001,
+# semantically corresponding to the uplink direction of a GSM call leg.
+#
+# The present example has been synthetically constructed from GSM 06.10
+# test sequence Seq01.cod (first 24 frames, enough to exercise TAF),
+# exhibiting the scenario of how GSM TCH/FS UL would look with this
+# sequence in it under conditions of 100% error-free transmission,
+# i.e., no bad, corrupted or FACCH-stolen frames.
+
+E0D760A2E177503E681BD129615AB83E5C9CB52BB6B706F9CA56D4F037F7837A86BC
+E0D96292A5577FB8B75C10E8535D19FB4399B73299398CF96AE516D9D8D5258638C6
+E0D9E39269CF5FF3F318AF44285FF9469AB5C1DF7F78E35770BB30D91850EDA24E1C
+E0D8638B28E75F392A23B04AE29D365728A74C63BD36C694A9AE5D59FBD7D4315765
+E0D7A0A2E16FB9950C6AF5D56661FA37244DC8D8DD5767D738B35E7D39C6E64E4904
+E0D81FA2E19F79D7F7149226757FD98AEB6DB8DB9FF44AD49148E761FD48E492355F
+E0D85F9AE5A7B9178F48EE199BB7F80CEA6DD45C5FB4F4B8A29CDB7F16AD206B4507
+E0DA208AA60F5BD836EAE64945E17B569DA8AEE057FAAB2A3374265F59B12589ACE1
+E0D8E48AE8D79D1943E44F14ECDD56C3DD0E4C29B938DA84B286BD5DFB41A56B38DF
+E0D89F9AE96760BB2A1BB1B5657F5734B1A2CA8FB93B4E9391C90C9956F98A5B18AF
+E0D81EA2E5E761957644764873DF59594C90E5D57DF946DB8DC3A779170C23A93AE9
+E0D99E92E657B9B6259996510F7FB6F30F6637149F78694B9455DDB8F894F6465A5F
+E0D8E292A91F97F828DDC9ACF85F37B7E42F4C267F58D11689BB215B589F3887C4E5
+E0D91E9AE1DFBBB81A8791C54ED7168E94EA063D7D3888EC6F3A207FD34CDD5EE5C6
+E0D8A38AE91FDDFB38DCCA0F32B919669F8D3D22D916AF6136E09F7DB70CDC4D3724
+E0D82292E8E7DB76EC50F1991DB91A0A73CAB8A499958AEB75BAA9D975F7447AA07C
+E0D8A09AE997BD39569775590CBDF66B10F231595B98F0CC7238E399B6495D155538
+E0DA1E8AE6CF619957DC6D58E25F382C9F715746BCF74F20F207F5D75762E451FA20
+E0D8628AE8DFD7F8B8DD7C45257FF93C9C7DC165BF18A65EAD2EA07B37B9589640E5
+E0D92092A997B759E11D4D69119DF6E760AFB32F7F98F31C71A7237FF9B532824A99
+E0D81FA2E5A7B939BAE0AAC8D4D9757495CD0DEA9DB62317516555DDB47C13E2AB54
+E0D8609AE92779191CF98DA9A4B991E9A1A7A6DD5FD5BE618ACAE39FFAB91B8E38FA
+E0D92192A9575D97236551CD045936CFD08B947F9B59976C2E5A18D9DA26DC7531A6
+E1D9DD8AE6979F1706B48CE55D9AB83517505754D6F93B619308BAD7DA48E38D57C5
diff --git a/tests/trau_conv/fr_speech_twts001_mix.hex b/tests/trau_conv/fr_speech_twts001_mix.hex
new file mode 100644
index 0000000..e6360ff
--- /dev/null
+++ b/tests/trau_conv/fr_speech_twts001_mix.hex
@@ -0,0 +1,25 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-FR codec, using the extended RTP payload format of TW-TS-001,
+# semantically corresponding to the uplink direction of a GSM call leg.
+#
+# The present example contains a mix of good and bad frames, the same kind
+# of mix that can be represented in a TRAU-UL frame stream. This example
+# has been constructed by taking a few frames out of fr_speech_twts001_good.hex
+# and corrupting some of them, turning them into BFIs. The setting of DTXd bit
+# is also exercised.
+
+# DTXd=0
+E0D81FA2E19F79D7F7149226757FD98AEB6DB8DB9FF44AD49148E761FD48E492355F
+E0D85F9AE5A7B9178F48EE199BB7F80CEA6DD45C5FB4F4B8A29CDB7F16AD206B4507
+E2DA208AA60F5BD836EFFF0005E17B569DA8AEEAAAAAAB2A3374265F59B12589ACE1
+E0D8E48AE8D79D1943E44F14ECDD56C3DD0E4C29B938DA84B286BD5DFB41A56B38DF
+E2D89F9AE96760BB2A1BB1B5657F5734B1777777793B4E9391C90C9956F98A5B18AF
+E2D81EA2E5E7619576447641111119594C90E5D57DF946DB8DC3A779170C23A93AE9
+
+# DTXd=1
+E8D81FA2E19F79D7F7149226757FD98AEB6DB8DB9FF44AD49148E761FD48E492355F
+E8D85F9AE5A7B9178F48EE199BB7F80CEA6DD45C5FB4F4B8A29CDB7F16AD206B4507
+EADA208AA60F5BD836EFFF0005E17B569DA8AEEAAAAAAB2A3374265F59B12589ACE1
+E8D8E48AE8D79D1943E44F14ECDD56C3DD0E4C29B938DA84B286BD5DFB41A56B38DF
+EAD89F9AE96760BB2A1BB1B5657F5734B1777777793B4E9391C90C9956F98A5B18AF
+EAD81EA2E5E7619576447641111119594C90E5D57DF946DB8DC3A779170C23A93AE9
diff --git a/tests/trau_conv/hr_speech_rfc5993.hex b/tests/trau_conv/hr_speech_rfc5993.hex
new file mode 100644
index 0000000..1aa4549
--- /dev/null
+++ b/tests/trau_conv/hr_speech_rfc5993.hex
@@ -0,0 +1,28 @@
+# This hex file (TW-TS-005 Annex B format) contains some RTP payloads for
+# GSM-HR codec, using the slightly extended RTP payload format of
+# IETF RFC 5993.
+#
+# The only semantics allowed by TS 101 318 and RFC 5993 RTP payload formats
+# are good speech and valid SID frames; the present test sequence exercises
+# both, using fragments from the official test sequences of GSM 06.07.
+
+# first 7 frames of seq01.cod, converted to RFC 5993 format
+000371AF61C8F2802531C000000000
+000371AF61C8F2802531C000000000
+008FE9B77000000000000000000000
+008FE3DD7C85DC3B763F126A72C50E
+007F74FA6D486D57F3545134C533FC
+009FE3DD69BE4EAFAC4344893C9799
+00B77916FC7D902F9372B569F5D17F
+
+# first 10 frames of dtx06.cod, converted to RFC 5993 format
+000371AF61C8F2802531C000000000
+000371AF61C8F2802531C000000000
+0000D9EA65CC9CC0E263680674F1ED
+0000D9EA6588CDE0C26B60066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+2000D9EA65FFFFFFFFFFFFFFFFFFFF
diff --git a/tests/trau_conv/hr_speech_ts101318.hex b/tests/trau_conv/hr_speech_ts101318.hex
new file mode 100644
index 0000000..59c87da
--- /dev/null
+++ b/tests/trau_conv/hr_speech_ts101318.hex
@@ -0,0 +1,28 @@
+# This hex file (TW-TS-005 Annex B format) contains some RTP payloads for
+# GSM-HR codec, using the minimal (no metadata) RTP payload format of
+# ETSI TS 101 318.
+#
+# The only semantics allowed by TS 101 318 and RFC 5993 RTP payload formats
+# are good speech and valid SID frames; the present test sequence exercises
+# both, using fragments from the official test sequences of GSM 06.07.
+
+# first 7 frames of seq01.cod, converted to TS 101 318 format
+0371AF61C8F2802531C000000000
+0371AF61C8F2802531C000000000
+8FE9B77000000000000000000000
+8FE3DD7C85DC3B763F126A72C50E
+7F74FA6D486D57F3545134C533FC
+9FE3DD69BE4EAFAC4344893C9799
+B77916FC7D902F9372B569F5D17F
+
+# first 10 frames of dtx06.cod, converted to TS 101 318 format
+0371AF61C8F2802531C000000000
+0371AF61C8F2802531C000000000
+00D9EA65CC9CC0E263680674F1ED
+00D9EA6588CDE0C26B60066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA65FFFFFFFFFFFFFFFFFFFF
diff --git a/tests/trau_conv/rtp2trau_efr_dl1.ok b/tests/trau_conv/rtp2trau_efr_dl1.ok
new file mode 100644
index 0000000..4cbf398
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_dl1.ok
@@ -0,0 +1,6 @@
+0000e80fc217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008fff
+0000e80fc217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008fff
+0000e80fdf4ccb25d0409b69fa62ddd7ff17fff794a8cdb6811efd2eea6ecaf8efd3ad13aa4bbfff
+0000e80fd1be87f2e9c089e1831992a1c209dd1e9b208153c09bbd3fe25fdc60da35b0b0a35c9fff
+0000e80fdb3d9e93d649e98bf74ced0bbdc3d9e98e02e0c2c0f6a48cc5fccc00fcd5b54bf0348bff
+0000e80fca1bba53b5b086fffffc8000bc0efffffe008042c07fffffe0008411fffcffe0800481ff
diff --git a/tests/trau_conv/rtp2trau_efr_dl2.ok b/tests/trau_conv/rtp2trau_efr_dl2.ok
new file mode 100644
index 0000000..8a77ee1
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_dl2.ok
@@ -0,0 +1,24 @@
+0000e80fc217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008fff
+0000e80fc217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008fff
+0000e80fdf4ccb25d0409b69fa62ddd7ff17fff794a8cdb6811efd2eea6ecaf8efd3ad13aa4bbfff
+0000e80fd1be87f2e9c089e1831992a1c209dd1e9b208153c09bbd3fe25fdc60da35b0b0a35c9fff
+0000e80fdb3d9e93d649e98bf74ced0bbdc3d9e98e02e0c2c0f6a48cc5fccc00fcd5b54bf0348bff
+0000e80fd1bd87f2b7989183a2b7ac91bf93a0e8f360a2c68154aa7fd8e58c19acb484878edbb3ff
+0000e80fdabd9d07a530975ba2b4a205bd97a71ca58bafc8d036d933ddbccb5cab9d87359b63d7ff
+0000e80fd5bb9ec6e4c09b56a521d920c69dae2984d0e732c1f6b6a3d32c8349fbb4f325d72ce3ff
+0000e80fdabb9766e3a0a156892bd4b3b023ab39dc26f4bfd197b36bab64c3849b75eeb5b623e3ff
+0000e80fd5bda21399f8a78b919c9addd4a9e279fd60e83b8298b780aa54cc7adcc99819a153fbff
+0000e80fdabd9ec7a528ab75b07fecdac52dba21bfe8e1bdc2f69409c92dfc1afc1ea646c923efff
+0000e80fd5bd9ed2b74ab365a4f7c8d9c0c5af0b9f7db6c08359a2f799c8bbebaa96cbfeb01383ff
+0000e80fdabb9ec6d518b76380e8c220cab7a563e1c9933883979b28a802faf3db84d04980ab93ff
+0000e80fd5bf89f2b5fac963ed48e294cbc3a180a43bb4c6c3f989e1b266c3948b97f985ec2597ff
+0000e80fdabda0d3e830c1aff191ac03c043c984c538d0bc8439809cb53ca4acac16fa97b643f7ff
+0000e80fd5bd9ed2c648c76df0fcd5f1b8c7b6caff4588c49636cc91c86ed41caa8fb8f1b0a3d7ff
+0000e80fdabd9ed2f590cb938b6fcbb6c7c1cb2ce9a091c2c4f9d80ab3c8a2dc9b9fd34cedb497ff
+0000e80fd23b9ec78520d17cd0b1d254bcc7b6e2944a933ad776bc248495bc349bf3b22fb7cbe3ff
+0000e80fdabd9d078530d74181fbed32babfa2838e16d2428596bf18f95c835c9aa3c701a45ba3ff
+0000e80fd5be87f28698dd66aedeb7b7dbc5bf3b9d60884485f9c085cbd5fbbcbc599cf2fedcc3ff
+0000e80fd5bd9ed4b7d3938482d4815bc2c5bf52faae80c48657893beb63b4148b098dabae43a3ff
+0000e80fd5bd9ed2c588e77db3b2b636c7c3ade3ec2682c6c696c281b80db364bc91fae3904483ff
+0000e80fd5bb9ec7a643a774cf76feb2b343a1d29c16bc52c6f5b1ac8c619303fb0cc02ddb4c93ff
+0000e80fd5bf89e884e8f1529087c995b943b3198c2eafc2c737c66ed009bbfcab1baebddfe4e3ff
diff --git a/tests/trau_conv/rtp2trau_efr_ul1.ok b/tests/trau_conv/rtp2trau_efr_ul1.ok
new file mode 100644
index 0000000..f456ddb
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_ul1.ok
@@ -0,0 +1,6 @@
+0000e800c217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008eff
+0000e800c217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008eff
+0000e800df4ccb25d0409b69fa62ddd7ff17fff794a8cdb6811efd2eea6ecaf8efd3ad13aa4bbeff
+0000e800d1be87f2e9c089e1831992a1c209dd1e9b208153c09bbd3fe25fdc60da35b0b0a35c9eff
+0000e800db3d9e93d649e98bf74ced0bbdc3d9e98e02e0c2c0f6a48cc5fccc00fcd5b54bf0348aff
+0000e804ca1bba53b5b086fffffc8000bc0efffffe008042c07fffffe0008411fffcffe0800482ff
diff --git a/tests/trau_conv/rtp2trau_efr_ul2.ok b/tests/trau_conv/rtp2trau_efr_ul2.ok
new file mode 100644
index 0000000..6430b9c
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_ul2.ok
@@ -0,0 +1,24 @@
+0000e800c217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008eff
+0000e800c217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008eff
+0000e800df4ccb25d0409b69fa62ddd7ff17fff794a8cdb6811efd2eea6ecaf8efd3ad13aa4bbeff
+0000e800d1be87f2e9c089e1831992a1c209dd1e9b208153c09bbd3fe25fdc60da35b0b0a35c9eff
+0000e800db3d9e93d649e98bf74ced0bbdc3d9e98e02e0c2c0f6a48cc5fccc00fcd5b54bf0348aff
+0000e800d1bd87f2b7989183a2b7ac91bf93a0e8f360a2c68154aa7fd8e58c19acb484878edbb2ff
+0000e800dabd9d07a530975ba2b4a205bd97a71ca58bafc8d036d933ddbccb5cab9d87359b63d6ff
+0000e800d5bb9ec6e4c09b56a521d920c69dae2984d0e732c1f6b6a3d32c8349fbb4f325d72ce2ff
+0000e800dabb9766e3a0a156892bd4b3b023ab39dc26f4bfd197b36bab64c3849b75eeb5b623e2ff
+0000e800d5bda21399f8a78b919c9addd4a9e279fd60e83b8298b780aa54cc7adcc99819a153faff
+0000e800dabd9ec7a528ab75b07fecdac52dba21bfe8e1bdc2f69409c92dfc1afc1ea646c923eeff
+0000e800d5bd9ed2b74ab365a4f7c8d9c0c5af0b9f7db6c08359a2f799c8bbebaa96cbfeb01382ff
+0000e800dabb9ec6d518b76380e8c220cab7a563e1c9933883979b28a802faf3db84d04980ab92ff
+0000e800d5bf89f2b5fac963ed48e294cbc3a180a43bb4c6c3f989e1b266c3948b97f985ec2596ff
+0000e800dabda0d3e830c1aff191ac03c043c984c538d0bc8439809cb53ca4acac16fa97b643f6ff
+0000e800d5bd9ed2c648c76df0fcd5f1b8c7b6caff4588c49636cc91c86ed41caa8fb8f1b0a3d6ff
+0000e800dabd9ed2f590cb938b6fcbb6c7c1cb2ce9a091c2c4f9d80ab3c8a2dc9b9fd34cedb496ff
+0000e800d23b9ec78520d17cd0b1d254bcc7b6e2944a933ad776bc248495bc349bf3b22fb7cbe2ff
+0000e800dabd9d078530d74181fbed32babfa2838e16d2428596bf18f95c835c9aa3c701a45ba2ff
+0000e800d5be87f28698dd66aedeb7b7dbc5bf3b9d60884485f9c085cbd5fbbcbc599cf2fedcc2ff
+0000e800d5bd9ed4b7d3938482d4815bc2c5bf52faae80c48657893beb63b4148b098dabae43a2ff
+0000e800d5bd9ed2c588e77db3b2b636c7c3ade3ec2682c6c696c281b80db364bc91fae3904482ff
+0000e800d5bb9ec7a643a774cf76feb2b343a1d29c16bc52c6f5b1ac8c619303fb0cc02ddb4c92ff
+0000e801d5bf89e884e8f1529087c995b943b3198c2eafc2c737c66ed009bbfcab1baebddfe4e2ff
diff --git a/tests/trau_conv/rtp2trau_efr_ul3.ok b/tests/trau_conv/rtp2trau_efr_ul3.ok
new file mode 100644
index 0000000..4495e4a
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_ul3.ok
@@ -0,0 +1,12 @@
+0000e800d5bda21399f8a78b919c9addd4a9e279fd60e83b8298b780aa54cc7adcc99819a153faff
+0000e800dabd9ec7a528ab75b07fecdac52dba21bfe8e1bdc2f69409c92dfc1afc1ea646c923eeff
+0000e808d5bd9ed2b74ab365a4f7c8d9c0c5af0b9f7db6c08359a2f799c8bbebaa96cbfffffffaff
+0000e800dabb9ec6d518b76380e8c220cab7a563e1c9933883979b28a802faf3db84d04980ab92ff
+0000e808d5bf89f2b5fac963ed48e294cbc3a180a43bb4c6c3f989e1b266c3948b97f98080008eff
+0000e808dabda0d3e830c1aff191ac03c043c984c538d556d551809cb53ca484ac16fa97b643f6ff
+0000e800d5bda21399f8a78b919c9addd4a9e279fd60e83b8298b780aa54cc7adcc99819a153fbff
+0000e800dabd9ec7a528ab75b07fecdac52dba21bfe8e1bdc2f69409c92dfc1afc1ea646c923efff
+0000e808d5bd9ed2b74ab365a4f7c8d9c0c5af0b9f7db6c08359a2f799c8bbebaa96cbfffffffbff
+0000e800dabb9ec6d518b76380e8c220cab7a563e1c9933883979b28a802faf3db84d04980ab93ff
+0000e808d5bf89f2b5fac963ed48e294cbc3a180a43bb4c6c3f989e1b266c3948b97f98080008fff
+0000e808dabda0d3e830c1aff191ac03c043c984c538d556d551809cb53ca484ac16fa97b643f7ff
diff --git a/tests/trau_conv/rtp2trau_fr_dl1.ok b/tests/trau_conv/rtp2trau_fr_dl1.ok
new file mode 100644
index 0000000..af8308c
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_dl1.ok
@@ -0,0 +1,7 @@
+0000f00fdc09ba1abe28c7b29b32c8d396a89ef389f391bbb69d8dbcb46ee447cbdfcc6cf465e7ff
+0000f00fd28aaa9aaffbd1edb8838cc5ce939fb4b17bb168e5b387bce55a94cdf63ac4d3871c8fff
+0000f00ff38ab25ecfebfcf8b85ce50a9ebd99cb95b8c7dff9e3b957e335960dd03a9ada84f1c7ff
+0000f00fc38ca65c9fe9c9aa875286e2ce58edc6c58cdc39f5ad9c91d597cd4dbfbbdd18aaeab7ff
+0000f00feacef696ec008800800080008001800080008000801080008000800081008000800081ff
+0000f00fabcdaa92e428c063c4edd89dc2888638cedb89d8a880e389edb19d85880cb89ddb13dbff
+0000f00fc9d7c2ece4288012a492a492a2808124c924c924a8009249924992458002a4e2a492a7ff
diff --git a/tests/trau_conv/rtp2trau_fr_dl2.ok b/tests/trau_conv/rtp2trau_fr_dl2.ok
new file mode 100644
index 0000000..149c1e7
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_dl2.ok
@@ -0,0 +1,24 @@
+0000f00fdc09ba1abe28c7b29b32c8d396a89ef389f391bbb69d8dbcb46ee447cbdfcc6cf465e7ff
+0000f00fd28aaa9aaffbd1edb8838cc5ce939fb4b17bb168e5b387bce55a94cdf63ac4d3871c8fff
+0000f00ff38ab25ecfebfcf8b85ce50a9ebd99cb95b8c7dff9e3b957e335960dd03a9ada84f1c7ff
+0000f00fc38ca65c9fe9c9aa875286e2ce58edc6c58cdc39f5ad9c91d597cd4dbfbbdd18aaeab7ff
+0000f00fbc09ba1ade778a87957bd552e1bcdec4cad8cec1ed5dbdd7c734dcdf9b33d8b5c49287ff
+0000f00f83f1ba16ee7bbefca892ab47bfb798baf6db8edbe7c59b919289e3c3bd72b892a72bdfff
+0000f00fc3f6ba969e759e8fb07cb0bddb7c987ad6dad4c7eba5f4b8d163edbf92d4e48ccca29fff
+0000f00f8a0caa91cf6ba1edd578a4d1a1ddddcbad51be23abebaa6ac2fa82fd973c84d2d93cb3ff
+0000f00fe24cba5caee58999e4acf16aaed6e99fa8c4d8b0f5a3da81d346af5dbdb28cdccf1ddfff
+0000f00fa3f6ba5a9e1acdaa9b53d953bf95ee49e514ea9cf59b9e969389984cd6deae24ee15bfff
+0000f00f82f1ba9e9e1b8afd80eaa4c7ded59d368931d755fbd39db69d8cb3cf91d0e0eacb5db3ff
+0000f00fb2f2ba99ae77c6a4fa1ab419ffbaef86be87b147e5c3b3669a2afd4eee38d9b586d9dfff
+0000f00fe28aaa52efa7e1a3dab5c9ee9e9beedcccccd82ff963d05395b5932d9639e7839cacb7ff
+0000f00f92f6ba1eef77c1cac393c558fad2e8e98f44b0f5f9a383a9ecf5823fb592fb55f5ae8fff
+0000f00fa38cba52eeefede3d8b4a396c7519bcbb9cb9928ed2daf4ccb58addfb9d0fb15cb62a7ff
+0000f00f828aba5c9f6df6b78873d09da750d8b1f3578a24e7358baeebb5ab0ddf5fd41cf509e7ff
+0000f00fa20eba56aef5c9dccbead498af7ceba5872785d2eb23f1a1e271e38cf8d2b751aaa3e3ff
+0000f00f8af4ba9dce1b89ddf8ecd4e2de989a6bbe2af50df6dd9e48f246f775d5d79894bbd0a3ff
+0000f00fc28cba5cefaff1e3daee8513bfbd9e6b8ef8c537f523ad33dc97a22f9bdcb703a48cb7ff
+0000f00f920aaa56afb5b9b0baaccc958e7eebd4c5dfa1bffb23f871e39693bfbf3cc5a284d5d3ff
+0000f00f83f1ba969e75d9ebc455a4e4a6ddaf49abc89fa9e78da857a29ad55df85ee16e955ac7ff
+0000f00fc20eba529e7989c7de1dc8b2a7738b2ce59db6d7eb75ef0c954de3bcfebca763c71debff
+0000f00f930aaa5aaeeb8ea9a6a3c590a69ae9fd815e94fee573cd69cc6d8c0df4b5db1dab06afff
+0000f00ff374ba95afe58e8ccc9d8d5db6689e45ba22f547aed3eb4c92c1aeb5f4b2b8e3caee97ff
diff --git a/tests/trau_conv/rtp2trau_fr_ul1.ok b/tests/trau_conv/rtp2trau_fr_ul1.ok
new file mode 100644
index 0000000..96ef731
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_ul1.ok
@@ -0,0 +1,7 @@
+00008800dc09ba1abe28c7b29b32c8d396a89ef389f391bbb69d8dbcb46ee447cbdfcc6cf465e6ff
+00008800d28aaa9aaffbd1edb8838cc5ce939fb4b17bb168e5b387bce55a94cdf63ac4d3871c8eff
+00008800f38ab25ecfebfcf8b85ce50a9ebd99cb95b8c7dff9e3b957e335960dd03a9ada84f1c6ff
+00008800c38ca65c9fe9c9aa875286e2ce58edc6c58cdc39f5ad9c91d597cd4dbfbbdd18aaeab6ff
+00008804eacef696ec008800800080008001800080008000801080008000800081008000800082ff
+00008800abcdaa92e428c063c4edd89dc2888638cedb89d8a880e389edb19d85880cb89ddb13daff
+00008800c9d7c2ece4288012a492a492a2808124c924c924a8009249924992458002a4e2a492a6ff
diff --git a/tests/trau_conv/rtp2trau_fr_ul2.ok b/tests/trau_conv/rtp2trau_fr_ul2.ok
new file mode 100644
index 0000000..7abb1db
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_ul2.ok
@@ -0,0 +1,24 @@
+00008800dc09ba1abe28c7b29b32c8d396a89ef389f391bbb69d8dbcb46ee447cbdfcc6cf465e6ff
+00008800d28aaa9aaffbd1edb8838cc5ce939fb4b17bb168e5b387bce55a94cdf63ac4d3871c8eff
+00008800f38ab25ecfebfcf8b85ce50a9ebd99cb95b8c7dff9e3b957e335960dd03a9ada84f1c6ff
+00008800c38ca65c9fe9c9aa875286e2ce58edc6c58cdc39f5ad9c91d597cd4dbfbbdd18aaeab6ff
+00008800bc09ba1ade778a87957bd552e1bcdec4cad8cec1ed5dbdd7c734dcdf9b33d8b5c49286ff
+0000880083f1ba16ee7bbefca892ab47bfb798baf6db8edbe7c59b919289e3c3bd72b892a72bdeff
+00008800c3f6ba969e759e8fb07cb0bddb7c987ad6dad4c7eba5f4b8d163edbf92d4e48ccca29eff
+000088008a0caa91cf6ba1edd578a4d1a1ddddcbad51be23abebaa6ac2fa82fd973c84d2d93cb2ff
+00008800e24cba5caee58999e4acf16aaed6e99fa8c4d8b0f5a3da81d346af5dbdb28cdccf1ddeff
+00008800a3f6ba5a9e1acdaa9b53d953bf95ee49e514ea9cf59b9e969389984cd6deae24ee15beff
+0000880082f1ba9e9e1b8afd80eaa4c7ded59d368931d755fbd39db69d8cb3cf91d0e0eacb5db2ff
+00008800b2f2ba99ae77c6a4fa1ab419ffbaef86be87b147e5c3b3669a2afd4eee38d9b586d9deff
+00008800e28aaa52efa7e1a3dab5c9ee9e9beedcccccd82ff963d05395b5932d9639e7839cacb6ff
+0000880092f6ba1eef77c1cac393c558fad2e8e98f44b0f5f9a383a9ecf5823fb592fb55f5ae8eff
+00008800a38cba52eeefede3d8b4a396c7519bcbb9cb9928ed2daf4ccb58addfb9d0fb15cb62a6ff
+00008800828aba5c9f6df6b78873d09da750d8b1f3578a24e7358baeebb5ab0ddf5fd41cf509e6ff
+00008800a20eba56aef5c9dccbead498af7ceba5872785d2eb23f1a1e271e38cf8d2b751aaa3e2ff
+000088008af4ba9dce1b89ddf8ecd4e2de989a6bbe2af50df6dd9e48f246f775d5d79894bbd0a2ff
+00008800c28cba5cefaff1e3daee8513bfbd9e6b8ef8c537f523ad33dc97a22f9bdcb703a48cb6ff
+00008800920aaa56afb5b9b0baaccc958e7eebd4c5dfa1bffb23f871e39693bfbf3cc5a284d5d2ff
+0000880083f1ba969e75d9ebc455a4e4a6ddaf49abc89fa9e78da857a29ad55df85ee16e955ac6ff
+00008800c20eba529e7989c7de1dc8b2a7738b2ce59db6d7eb75ef0c954de3bcfebca763c71deaff
+00008800930aaa5aaeeb8ea9a6a3c590a69ae9fd815e94fee573cd69cc6d8c0df4b5db1dab06aeff
+00008801f374ba95afe58e8ccc9d8d5db6689e45ba22f547aed3eb4c92c1aeb5f4b2b8e3caee96ff
diff --git a/tests/trau_conv/rtp2trau_fr_ul3.ok b/tests/trau_conv/rtp2trau_fr_ul3.ok
new file mode 100644
index 0000000..925c455
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_ul3.ok
@@ -0,0 +1,12 @@
+0000880083f1ba16ee7bbefca892ab47bfb798baf6db8edbe7c59b919289e3c3bd72b892a72bdeff
+00008800c3f6ba969e759e8fb07cb0bddb7c987ad6dad4c7eba5f4b8d163edbf92d4e48ccca29eff
+000088088a0caa91cf6ba1edd7fee001a1ddddcbad51beaad6aaaa6ac2fa82fd973c84d2d93cb2ff
+00008800e24cba5caee58999e4acf16aaed6e99fa8c4d8b0f5a3da81d346af5dbdb28cdccf1ddeff
+00008808a3f6ba5a9e1acdaa9b53d953bf95ee49e6aff57cf99b9e969389984cd6deae24ee15beff
+0000880882f1ba9e9e1b8afd80eaa41582119d368931d755fbd39db69d8cb3cf91d0e0eacb5db2ff
+0000880083f1ba16ee7bbefca892ab47bfb798baf6db8edbe7c59b919289e3c3bd72b892a72bdfff
+00008800c3f6ba969e759e8fb07cb0bddb7c987ad6dad4c7eba5f4b8d163edbf92d4e48ccca29fff
+000088088a0caa91cf6ba1edd7fee001a1ddddcbad51beaad6aaaa6ac2fa82fd973c84d2d93cb3ff
+00008800e24cba5caee58999e4acf16aaed6e99fa8c4d8b0f5a3da81d346af5dbdb28cdccf1ddfff
+00008808a3f6ba5a9e1acdaa9b53d953bf95ee49e6aff57cf99b9e969389984cd6deae24ee15bfff
+0000880882f1ba9e9e1b8afd80eaa41582119d368931d755fbd39db69d8cb3cf91d0e0eacb5db3ff
diff --git a/tests/trau_conv/rtp2trau_gen.c b/tests/trau_conv/rtp2trau_gen.c
new file mode 100644
index 0000000..3a5eb8d
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_gen.c
@@ -0,0 +1,170 @@
+/*
+ * This program reads RTP payloads for FR/HR/EFR speech from a TW-TS-005
+ * hex file and converts them to either TRAU-DL or TRAU-UL frames
+ * as specified on the command line, exercising osmo_rtp2trau() and
+ * osmo_trau_frame_encode() functions in the process.
+ *
+ * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2025 - however,
+ * Mother Mychaela's contributions are NOT subject to copyright.
+ * No rights reserved, all rights relinquished.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <osmocom/core/bits.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/trau/trau_frame.h>
+#include <osmocom/trau/trau_rtp.h>
+
+#include "tw5reader.h"
+
+static enum osmo_trau_frame_direction direction;
+static struct osmo_trau2rtp_state trau2rtp_st;
+static FILE *out_file;
+
+static void emit_hex_frame(const uint8_t *frame, unsigned nbytes)
+{
+ unsigned n;
+
+ for (n = 0; n < nbytes; n++)
+ fprintf(out_file, "%02x", frame[n]);
+ putc('\n', out_file);
+}
+
+static void emit_hex_trau_frame_16k(const ubit_t *tf_bits)
+{
+ uint8_t tf_bytes[40];
+
+ osmo_ubit2pbit(tf_bytes, tf_bits, sizeof(tf_bytes) * 8);
+ emit_hex_frame(tf_bytes, sizeof(tf_bytes));
+}
+
+static void emit_hex_trau_frame_8k(const ubit_t *tf_bits)
+{
+ uint8_t tf_bytes[20];
+
+ osmo_ubit2pbit(tf_bytes, tf_bits, sizeof(tf_bytes) * 8);
+ emit_hex_frame(tf_bytes, sizeof(tf_bytes));
+}
+
+static void process_record(const uint8_t *rtp_pl, unsigned rtp_pl_len,
+ const char *filename, unsigned lineno)
+{
+ struct osmo_trau_frame tf;
+ ubit_t tf_bits[640]; /* 2x space required by osmo_trau_frame_encode() */
+ int rc;
+
+ tf.dir = direction;
+ rc = osmo_rtp2trau(&tf, rtp_pl, rtp_pl_len, &trau2rtp_st);
+ if (rc < 0) {
+ fprintf(stderr, "%s line %u: not valid for osmo_rtp2trau()\n",
+ filename, lineno);
+ exit(1);
+ }
+ tf.dl_ta_usec = 0;
+ rc = osmo_trau_frame_encode(tf_bits, sizeof(tf_bits), &tf);
+ switch (rc) {
+ case 320:
+ emit_hex_trau_frame_16k(tf_bits);
+ break;
+ case 160:
+ emit_hex_trau_frame_8k(tf_bits);
+ break;
+ default:
+ fprintf(stderr,
+ "%s line %u: osmo_trau_frame_encode() returned %d\n",
+ filename, lineno, rc);
+ exit(1);
+ }
+}
+
+static void process_file(const char *infname, const char *outfname)
+{
+ FILE *inf;
+ unsigned lineno;
+ uint8_t frame[TWTS005_MAX_FRAME];
+ unsigned frame_len;
+ int rc;
+
+ inf = fopen(infname, "r");
+ if (!inf) {
+ perror(infname);
+ exit(1);
+ }
+ if (outfname) {
+ out_file = fopen(outfname, "w");
+ if (!out_file) {
+ perror(outfname);
+ exit(1);
+ }
+ } else {
+ out_file = stdout;
+ }
+
+ lineno = 0;
+ for (;;) {
+ rc = twts005_read_frame(inf, &lineno, frame, &frame_len);
+ if (rc < 0) {
+ fprintf(stderr, "%s line %u: not valid TW-TS-005\n",
+ infname, lineno);
+ exit(1);
+ }
+ if (!rc)
+ break;
+ process_record(frame, frame_len, infname, lineno);
+ }
+
+ fclose(inf);
+ if (outfname) {
+ fclose(out_file);
+ out_file = NULL;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ char *infname, *outfname;
+
+ if (argc < 4 || argc > 5)
+ goto usage;
+ infname = argv[1];
+ if (!strcmp(argv[2], "fr"))
+ trau2rtp_st.type = OSMO_TRAU16_FT_FR;
+ else if (!strcmp(argv[2], "hr"))
+ trau2rtp_st.type = OSMO_TRAU8_SPEECH;
+ else if (!strcmp(argv[2], "hr16"))
+ trau2rtp_st.type = OSMO_TRAU16_FT_HR;
+ else if (!strcmp(argv[2], "efr"))
+ trau2rtp_st.type = OSMO_TRAU16_FT_EFR;
+ else
+ goto usage;
+ if (!strcmp(argv[3], "dl"))
+ direction = OSMO_TRAU_DIR_DL;
+ else if (!strcmp(argv[3], "ul"))
+ direction = OSMO_TRAU_DIR_UL;
+ else
+ goto usage;
+ outfname = argv[4];
+
+ process_file(infname, outfname);
+ exit(0);
+
+usage: fprintf(stderr,
+ "usage: %s input-file fr|hr|hr16|efr dl|ul [output-file]\n",
+ argv[0]);
+ exit(1);
+}
diff --git a/tests/trau_conv/rtp2trau_hr_dl.ok b/tests/trau_conv/rtp2trau_hr_dl.ok
new file mode 100644
index 0000000..18e7cf2
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_hr_dl.ok
@@ -0,0 +1,17 @@
+00884486f1d7d8b98ff2c089a69c8080808080bf
+00884486f1d7d8b98ff2c089a69c8080808080bf
+0088469fe9dbdc8080d0808080808080808080bf
+0088469fe3eedf90dd9c9dddc7f193a9e5c587bf
+008845fef4fd9ba986ddabfceac589d38ab3febf
+008846bfe3eedab7e4aed7eb88b4a4a4f997ccff
+008846eef98bbf8fd9a097e4eeababa7ebd1bfff
+00884486f1d7d8b98ff2c089a69c8080808080bf
+00884486f1d7d8b98ff2c089a69c8080808080bf
+00884481d9f599b9c9cce0b8ccb6c099e9f1f6ff
+00884481d9f599b18c9df0b0cdb68099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00885081d9f599bfffffffffffffffffffffffff
diff --git a/tests/trau_conv/tw5reader.c b/tests/trau_conv/tw5reader.c
new file mode 100644
index 0000000..104258b
--- /dev/null
+++ b/tests/trau_conv/tw5reader.c
@@ -0,0 +1,80 @@
+/*
+ * This C module has been adapted from Themyscira Wireless GSM codec libraries
+ * and utilities suite. It implements a function that reads RTP payloads
+ * from hex files in TW-TS-005 format.
+ *
+ * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2025 - however,
+ * Mother Mychaela's contributions are NOT subject to copyright.
+ * No rights reserved, all rights relinquished.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include "tw5reader.h"
+
+static int decode_hex_digit(char c)
+{
+ if (isdigit(c))
+ return c - '0';
+ else if (isupper(c))
+ return c - 'A' + 10;
+ else
+ return c - 'a' + 10;
+}
+
+int twts005_read_frame(FILE *hexf, unsigned *lineno, uint8_t *frame,
+ unsigned *lenp)
+{
+ char linebuf[82];
+ char *cp, *np;
+ uint8_t *dp;
+ unsigned len;
+
+ for (;;) {
+ if (!fgets(linebuf, sizeof(linebuf), hexf))
+ return 0;
+ (*lineno)++;
+ if (!strchr(linebuf, '\n'))
+ return -2;
+ for (cp = linebuf; isspace(*cp); cp++)
+ ;
+ if (*cp != '\0' && *cp != '#')
+ break;
+ }
+ for (np = cp; *cp && !isspace(*cp); cp++)
+ ;
+ if (*cp)
+ *cp++ = '\0';
+ while (isspace(*cp))
+ cp++;
+ if (*cp != '\0' && *cp != '#')
+ return -1;
+ if (!strcasecmp(np, "NULL")) {
+ *lenp = 0;
+ return 1;
+ }
+
+ dp = frame;
+ len = 0;
+ for (cp = np; *cp; cp += 2) {
+ if (!isxdigit(cp[0]) || !isxdigit(cp[1]))
+ return -1;
+ *dp++ = (decode_hex_digit(cp[0]) << 4) |
+ decode_hex_digit(cp[1]);
+ len++;
+ }
+ *lenp = len;
+ return 1;
+}
diff --git a/tests/trau_conv/tw5reader.h b/tests/trau_conv/tw5reader.h
new file mode 100644
index 0000000..dd4d8a4
--- /dev/null
+++ b/tests/trau_conv/tw5reader.h
@@ -0,0 +1,23 @@
+/*
+ * This header file defines the interface to our reader function for
+ * hexadecimal RTP frame sequence files in TW-TS-005 format.
+ *
+ * twts005_read_frame() return values are:
+ * 1 = successfully read valid frame
+ * 0 = normal EOF
+ * -1 = read line with invalid content
+ * -2 = line too long or missing newline
+ *
+ * The reader function skips blank, whitespace-only and comment lines,
+ * returning only actual frames. lineno variable must be initialized to 0
+ * by the application program, but not touched otherwise. In case of an
+ * error, this variable will hold the line number at which the error was
+ * encountered.
+ */
+
+#pragma once
+
+#define TWTS005_MAX_FRAME 40
+
+int twts005_read_frame(FILE *hexf, unsigned *lineno, uint8_t *frame,
+ unsigned *lenp);
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/39621?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Ia5ca8af6bd3a899253bbcc718b70e43f2265b495
Gerrit-Change-Number: 39621
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: pespin.
falconia has posted comments on this change by falconia. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39621?usp=email )
Change subject: tests: add unit tests for osmo_rtp2trau()
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
File tests/trau_conv/tw5reader.c:
https://gerrit.osmocom.org/c/libosmo-abis/+/39621/comment/0de18423_4e2aa500… :
PS1, Line 37: int twts005_read_frame(FILE *hexf, unsigned *lineno, uint8_t *frame,
> I am aware of that libosmocore function and have used it in other similar unit tests. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/39621?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Ia5ca8af6bd3a899253bbcc718b70e43f2265b495
Gerrit-Change-Number: 39621
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 27 Feb 2025 14:42:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: falconia <falcon(a)freecalypso.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: daniel, pespin.
laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39619?usp=email )
Change subject: stp: Fix expectancies of TC_clnt_quirk_snm_inactive
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39619?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I907981c1487b299df852c405bae1fefff4bf5191
Gerrit-Change-Number: 39619
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 27 Feb 2025 14:00:26 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/39636?usp=email )
Change subject: codec: add some constant frames for HR and EFR
......................................................................
codec: add some constant frames for HR and EFR
With all 3 classic GSM codecs (FR, HR and EFR) sometimes a need
arises for a constant fill frame, to be inserted when no good speech
frame is available. For GSM-FR codec the substitution/muting spec
(GSM 06.11) explicitly defines a silence frame for this purpose,
but no such officially defined fill frames exist for HR or EFR.
Those newer codecs do, however, have homing frames that all decoders
are required to implement, and there is an unofficial silence frame
for GSM-HR, observed as the output from the official encoder fed with
all-zeros input.
Add these 3 constant frames (HR silence, HR homing, EFR homing) to
libosmocodec in order to make them easily usable in any application
that may need them, including applications that cannot have ThemWi
codec libraries as dependencies.
Change-Id: I2c510ac62a0786c137115c45eee7a48b9736265f
---
M include/osmocom/codec/codec.h
M src/codec/gsm620.c
M src/codec/gsm660.c
3 files changed, 49 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/include/osmocom/codec/codec.h b/include/osmocom/codec/codec.h
index 7a23e7f..008eab1 100644
--- a/include/osmocom/codec/codec.h
+++ b/include/osmocom/codec/codec.h
@@ -34,6 +34,9 @@
extern const uint16_t gsm690_4_75_bitorder[]; /* AMR 4.75 kbits */
extern const uint8_t osmo_gsm611_silence_frame[GSM_FR_BYTES];
+extern const uint8_t osmo_gsm620_silence_frame[GSM_HR_BYTES];
+extern const uint8_t osmo_gsm620_homing_frame[GSM_HR_BYTES];
+extern const uint8_t osmo_gsm660_homing_frame[GSM_EFR_BYTES];
extern const struct value_string osmo_amr_type_names[];
diff --git a/src/codec/gsm620.c b/src/codec/gsm620.c
index 49ee724..a24d762 100644
--- a/src/codec/gsm620.c
+++ b/src/codec/gsm620.c
@@ -263,6 +263,37 @@
81, /* Code 3:7 */
};
+/*
+ * There is no officially defined silence frame for GSM-HR codec like there is
+ * for GSM-FR. However, if one feeds all-zeros (complete silence) linear PCM
+ * input to the official GSM-HR encoder, the result will be an endless stream
+ * of these frames:
+ *
+ * R0=00 LPC=164,171,cb Int=0 Mode=0
+ * s1=00,00,00 s2=00,00,00 s3=00,00,00 s4=00,00,00
+ *
+ * The following const datum is the above unofficial GSM-HR silence frame in
+ * the packed RTP format of TS 101 318.
+ */
+const uint8_t osmo_gsm620_silence_frame[GSM_HR_BYTES] = {
+ 0x01, 0x64, 0xB8, 0xE5, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/*
+ * GSM 06.20 defines, by reference to GSM 06.06 C code and GSM 06.07 test
+ * sequences, a special frame of codec parameters called the decoder homing
+ * frame (DHF). When a spec-compliant speech decoder processes this frame,
+ * it resets itself to the spec-defined home state.
+ *
+ * The following const datum is GSM-HR DHF in the packed RTP format of
+ * TS 101 318.
+ */
+const uint8_t osmo_gsm620_homing_frame[GSM_HR_BYTES] = {
+ 0x03, 0x71, 0xAF, 0x61, 0xC8, 0xF2, 0x80,
+ 0x25, 0x31, 0xC0, 0x00, 0x00, 0x00, 0x00
+};
+
/*! Check whether RTP frame contains HR SID code word according to
* TS 101 318 §5.2.2
* \param[in] rtp_payload Buffer with RTP payload
diff --git a/src/codec/gsm660.c b/src/codec/gsm660.c
index b15bdf3..fbb69c4 100644
--- a/src/codec/gsm660.c
+++ b/src/codec/gsm660.c
@@ -258,6 +258,21 @@
246, /* 259 -> PULSE 4_10: b0 */
};
+/*
+ * GSM 06.60 defines (in Table 7) a special frame of codec parameters called
+ * the decoder homing frame (DHF). When a spec-compliant speech decoder
+ * processes this frame, it resets itself to the spec-defined home state.
+ *
+ * The following const datum is GSM-EFR DHF in the packed RTP format of
+ * TS 101 318 or RFC 3551.
+ */
+const uint8_t osmo_gsm660_homing_frame[GSM_EFR_BYTES] = {
+ 0xC0, 0x85, 0xEB, 0x49, 0x0F, 0xAA, 0xD6, 0x03,
+ 0xE3, 0xA1, 0x86, 0x07, 0xB0, 0xC4, 0x2C, 0x08,
+ 0x04, 0x80, 0x55, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
static const uint8_t sid_code_word_bits[95] = {
/* bit numbers are relative to "pure" EFR frame beginning,
* not counting the signature bits. */
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39636?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2c510ac62a0786c137115c45eee7a48b9736265f
Gerrit-Change-Number: 39636
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/39637?usp=email )
Change subject: Use default_layer_manager for all ASPs in SCTP-mode=client & m3ua-mode=ASP
......................................................................
Use default_layer_manager for all ASPs in SCTP-mode=client & m3ua-mode=ASP
With previous behavior, only first ASP configured as SCTPmode=client and
m3ua-mode=ASP in osmo_sccp_simple_client_on_ss7_id() would be applied
the default_layer_manager.
AS a result, if a client app (eg. osmo-bsc) would manually configure 1 ASP
with 2 ASPs (and leave it to dynamic RKM to setup everything at osmo-stp),
it would fail, since the default LM FSM (in charge of waiting for NTFY and
then sending REQ_REG) would only be
applied to the first ASP.
So one would see 1st ASP doing ASPUP+REG_REQ+ASPAC correctly, but the
second one would do ASPUP+ASPAC directly, which would be refused by
osmo-stp since it had no routing context configured for that ASP/AS.
Change-Id: I50f9a088c55ad103cc23758192773fc855747e12
---
M src/osmo_ss7_asp.c
M src/osmo_ss7_vty.c
M src/sccp_user.c
M src/ss7_asp.h
M src/xua_default_lm_fsm.c
5 files changed, 37 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/37/39637/1
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index faf4a0a..e3a6843 100644
--- a/src/osmo_ss7_asp.c
+++ b/src/osmo_ss7_asp.c
@@ -1291,3 +1291,22 @@
}
return -1;
}
+
+/* Apply sane configs for unconfigured options and restart the ASP. */
+void ss7_asp_restart_after_reconfigure(struct osmo_ss7_asp *asp)
+{
+ /* Make sure proper defaults values are applied if user didn't provide
+ * specific default values */
+ ss7_asp_set_default_peer_hosts(asp);
+
+ /* Apply default LM FSM for client ASP */
+ if (asp->cfg.proto != OSMO_SS7_ASP_PROT_IPA &&
+ asp->cfg.role == OSMO_SS7_ASP_ROLE_ASP &&
+ !asp->cfg.is_server) {
+ osmo_ss7_asp_use_default_lm(asp, LOGL_DEBUG);
+ } else {
+ osmo_ss7_asp_remove_default_lm(asp);
+ }
+
+ osmo_ss7_asp_restart(asp);
+}
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 576ad7c..8365db2 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -3001,9 +3001,7 @@
switch (vty->node) {
case L_CS7_ASP_NODE:
asp = vty->index;
- /* Make sure proper defaults values are set */
- ss7_asp_set_default_peer_hosts(asp);
- osmo_ss7_asp_restart(asp);
+ ss7_asp_restart_after_reconfigure(asp);
vty->node = L_CS7_NODE;
vty->index = asp->inst;
break;
diff --git a/src/sccp_user.c b/src/sccp_user.c
index d27d4bb..b5b6b4b 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -628,6 +628,7 @@
asp = asp_i;
LOGP(DLSCCP, LOGL_NOTICE, "%s: ASP %s for %s is not associated with any AS, using it\n",
name, asp->cfg.name, osmo_ss7_asp_protocol_name(prot));
+ osmo_ss7_as_add_asp(as, asp->cfg.name);
break;
}
if (!asp) {
@@ -642,6 +643,7 @@
if (!asp)
goto out_rt;
asp_created = true;
+ asp->simple_client_allocated = true;
/* Ensure that the ASP we use is set to operate as a client. */
asp->cfg.is_server = false;
/* Ensure that the ASP we use is set to role ASP. */
@@ -650,12 +652,10 @@
ss7_asp_peer_set_hosts(&asp->cfg.local, asp, &default_local_ip, 1);
if (default_remote_ip)
ss7_asp_peer_set_hosts(&asp->cfg.remote, asp, &default_remote_ip, 1);
- /* Make sure proper defaults are applied if app didn't provide specific default values */
- ss7_asp_set_default_peer_hosts(asp);
- asp->simple_client_allocated = true;
+ /* Make sure proper defaults are applied if app didn't
+ provide specific default values, then restart the ASP: */
+ ss7_asp_restart_after_reconfigure(asp);
}
-
- osmo_ss7_as_add_asp(as, asp->cfg.name);
}
/* Extra sanity checks if the ASP asp-clnt-* was pre-configured over VTY: */
@@ -696,12 +696,9 @@
goto out_asp;
}
}
+ /* ASP was already started here previously by VTY go_parent. */
}
- /* Restart ASP */
- if (prot != OSMO_SS7_ASP_PROT_IPA)
- osmo_ss7_asp_use_default_lm(asp, LOGL_DEBUG);
- osmo_ss7_asp_restart(asp);
LOGP(DLSCCP, LOGL_NOTICE, "%s: Using ASP instance %s\n", name,
asp->cfg.name);
diff --git a/src/ss7_asp.h b/src/ss7_asp.h
index 377274a..a05d870 100644
--- a/src/ss7_asp.h
+++ b/src/ss7_asp.h
@@ -110,5 +110,8 @@
int ss7_asp_apply_new_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx);
int ss7_asp_apply_drop_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx);
+void ss7_asp_restart_after_reconfigure(struct osmo_ss7_asp *asp);
+void osmo_ss7_asp_remove_default_lm(struct osmo_ss7_asp *asp);
+
#define LOGPASP(asp, subsys, level, fmt, args ...) \
_LOGSS7((asp)->inst, subsys, level, "asp-%s: " fmt, (asp)->cfg.name, ## args)
diff --git a/src/xua_default_lm_fsm.c b/src/xua_default_lm_fsm.c
index fc01605..0952c9e 100644
--- a/src/xua_default_lm_fsm.c
+++ b/src/xua_default_lm_fsm.c
@@ -413,6 +413,14 @@
.prim_cb = default_lm_prim_cb,
};
+void osmo_ss7_asp_remove_default_lm(struct osmo_ss7_asp *asp)
+{
+ if (!asp->lm_priv)
+ return;
+ osmo_fsm_inst_term(asp->lm_priv, OSMO_FSM_TERM_ERROR, NULL);
+ asp->lm_priv = NULL;
+}
+
int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level)
{
struct lm_fsm_priv *lmp;
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/39637?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I50f9a088c55ad103cc23758192773fc855747e12
Gerrit-Change-Number: 39637
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>