Harald Welte | 04fe6b5 | 2020-06-20 21:05:31 +0200 | [diff] [blame] | 1 | this is a small utility program illustrating the use of the new (2020) |
| 2 | TRAU related blocks like I.460 mux, TRAU frame synchronizer, TRAU frame |
| 3 | decoder and trau2rtp conversion. |
| 4 | |
| 5 | The only argument to the progrmam is the input file, which can either be |
| 6 | |
| 7 | * a DAHDI device like /dev/dahdi/chan/004/002 to use TS2 on span/line 4 |
| 8 | * a pre-recorded capture file containing raw binary 64k timeslot data |
| 9 | |
| 10 | The tool will automatically determine if a regular file or a DAHDI device |
| 11 | was passed, and behave accordingly. |
| 12 | |
| 13 | |
| 14 | == reading capture files |
| 15 | |
| 16 | There are FR and EFR exampel captures included. |
| 17 | |
| 18 | The input data (*.log.bz2) was generated using strace on an osmo-nitb process |
| 19 | while a MO-to-MT call was running on two sub-slots of TS2. |
| 20 | |
| 21 | The strace log is converted to a binary stream of the raw 64bit E1 slot |
| 22 | using strace-write-parse.py |
| 23 | |
| 24 | You can use the too like this: |
| 25 | |
| 26 | * start osmo-gapk as a RTP to ALSA sink like |
| 27 | osmo-gapk -I 127.0.0.1/9999 -f gsm -g rawpcm-s16le -A default # for FR |
| 28 | osmo-gapk -I 127.0.0.1/9999 -f rtp-efr -g rawpcm-s16le -A default # for EFR |
| 29 | |
| 30 | * run trau2rtp to read the bin file and generate RTP: |
| 31 | ./trau2rtp e1_ts2_fr.bin # for FR |
| 32 | ./trau2rtp e1_ts2_efr.bin # for EFR |
| 33 | |
| 34 | |
| 35 | == Interfacing a DAHDI device |
| 36 | |
| 37 | It can be operated in two modes: |
| 38 | |
| 39 | a) local loop between sub-slots 1+2 (bit-offset 2 + 4), i.e. connecting the first |
| 40 | two calls on a 'typical' TRX0 where the first sub-slot (bit-offset 0) is not |
| 41 | used, |
| 42 | |
| 43 | OR |
| 44 | |
| 45 | b) interface between 64k TRAU slot and RTP. IP addresses + port numbers are |
| 46 | compiled-in, you need to modify them accordingly. |
| 47 | |
| 48 | |
| 49 | In mode "a", you can use it to have voice calls for low-level debugging without a media |
| 50 | gateway. |
| 51 | |
| 52 | In mode "b", you can e.g. play back audio from an exterenal RTP source and listen to it |
| 53 | over the GSM attached mobile phone. |
| 54 | |
| 55 | Command line for playing back EFR via RTP: |
| 56 | ./osmo-gapk -f amr-efr -i ../tests/ref-files/hhgttg_part1_5.s16.amr-efr -g rtp-efr -O 192.168.11.179/8002 -t -l |
| 57 | |
| 58 | Command line for playing back FR via RTP: |
| 59 | ./osmo-gapk -f gsm -i ../tests/ref-files/hhgttg_part1_5.s16.gsm -g gsm -O 192.168.11.179/8002 -t -l |
| 60 | |
| 61 | The '-l' option is experimental and requires gapk patch I2d552695dfb4cc96039838e79e0f5ae25a6737c8. If you want |
| 62 | to use it with EFR, you need to change pq_file.c to skip the AMR file header when rewinding: |
| 63 | |
| 64 | - fseek(state->fh, 0, SEEK_SET); |
| 65 | + fseek(state->fh, 6, SEEK_SET); |
| 66 | |
| 67 | The code has been tested against BS-11 and RBS6000/DUG20 in both modes (loop vs. RTP) and for FR and EFR. |