Commit Graph

3464 Commits

Author SHA1 Message Date
Andreas Eversberg d074f8f396 Add EFR support to TRAU muxer + test case
Decoding and encoding of FR and EFR TRAU frames are put into seperate
functions. CRC check is done to detect bad EFR TRAU frames.

The test case includes FR and EFR transcoding.

EFR support was tested with Nokia InSite BTS and Siemens BS11.
2013-12-19 10:12:28 +01:00
Andreas Eversberg b6f9516193 Fix: Nokia requires VTY's "oml e1" parameters also
When writing config file, OML configuration must be written for all
E1 based BTS, which includes Nokia *Site BTS.
2013-12-18 16:23:39 +01:00
Jacob Erlbeck eddaa9f19e contrib/rtp: Fix default payload case
There is the wrong record field selection being used to extract the
default value. It returns the tuple offset instead of the value.

This patch fixes this.

Sponsored-by: On-Waves ehf
2013-12-18 16:16:42 +01:00
Jacob Erlbeck 0a1bc56e5a mgcp: Optionally send ptime in SDP
Currently the SDP 'ptime' media attribute is never set in generated
MGCP responses.

This patch optionally includes the 'ptime' attribute if
packet_duration_ms is != 0. This behaviour can be enabled/disabled
by using the VTY command "sdp audio-payload send-ptime" (enabled by
default).

Sponsored-by: On-Waves ehf
2013-12-13 13:51:29 +01:00
Jacob Erlbeck 24754f0490 mgcp: Parse SDP to get rate and packet duration
This patch parses the 'ptime' and 'maxptime' SDP attributes, and the
SDP rate information and sets up packet_duration_ms accordingly. If
the packet duration is unknown or allows for different values (e.g.
because 'ptime' uses a range or 'maxptime' allows for more than one
frame) the duration is set to 0.

Sponsored-by: On-Waves ehf
2013-12-13 13:49:32 +01:00
Jacob Erlbeck 2c2ca4df38 mgcp: Put local connection options into a struct
Currently the local connection options have been stored as a string.

This patch replaces this string by a struct (that still contains a
string) along with the parsed fields (only the packetization period
at the moment).

It also re-adds the calls to set_local_cx_options() to the
handle_create_con() and handle_modify_con() functions. Except for
the test program this has no side effects, since the LCO values
aren't used yet.
2013-12-13 13:48:04 +01:00
Jacob Erlbeck ba477d2ba3 mgcp/test: Output the packet duration after MGCP parsing
This also adds additional MDCX tests (based on MDCX4) to test the
analysis of different combinations of 'p' and 'ptime' fields.

Sponsored-by: On-Waves ehf
2013-12-13 13:45:19 +01:00
Jacob Erlbeck 33f300915a mgcp/rtp: Refactor timestamp offset calculation into own function
Currently the timestamp offset calculation is done in two different
places.

This patch moves and unifies both code parts into a separate function.

Sponsored-by: On-Waves ehf
2013-12-13 13:45:19 +01:00
Jacob Erlbeck e8ae1ac76a contrib/rtp: Add tool to create RTP state files
This tool provides the following features:
  - Output formats: state, C arrays
  - Optionally take RTP payload from existing state files
  - Generate streams with RTP timestamp jumps and/or delays
  - Set/change SSRC or payload type

Requires erlang to be installed.

Example:
  Generate 300 packets, set playout time offset to 1s, set
  RTP timestamp offset to 8000 (1s), generate another 100
  packets, the RTP payload is copied from rtp.state:

  ./gen_rtp_header.erl --type=98 --file=rtp.state  --
      0 300 0 --delay=1.0 100 8000

Sponsored-by: On-Waves ehf
2013-12-13 13:40:11 +01:00
Jacob Erlbeck 8b66649883 contrib/rtp: Enhance RTP replay tool
This patch adds optional parameters to pass the state file, the
destination address (default 127.0.0.1), the destination port
(default 4000), the source port (default 0). So it is called as
follows:

    gst rtp_replay.st -a [FILE [HOST [SOURCEPORT [DESTPORT]]]]

In addition, nonexistant FILEs are no longer created but opened
read-only instead.

Sponsored-by: On-Waves ehf
2013-12-13 13:40:09 +01:00
Holger Hans Peter Freyther e828b661a7 build: db_test does not use dlopen/dlsym.. remove LIBRARY_DL from deps 2013-12-13 10:18:33 +01:00
Holger Hans Peter Freyther a066d38fbf build: channel_test does not use dlopen/dlsym remove LIBRARY_DL dep 2013-12-13 10:18:32 +01:00
Holger Hans Peter Freyther fd465bcdf1 build: osmo-nitb does not use dlopen/dlsym remove LIBRARY_DL
osmo-nitb does not use dlopen/dlsym so we can remove the depedency
to LIBRARY_DL.
2013-12-13 10:18:32 +01:00
Holger Hans Peter Freyther 5b0e8706e8 build: Remove bogus depends from ipaccess-config
The code does not use libmsc and doesn't use dlsym/dlopen etc. So
let us remove LIBRARY_DL as dependency.
2013-12-13 10:18:32 +01:00
Nikola 876b55af33 freebsd: dlopen/dlsym/dlerror is part of libc, use LIBRARY_DL for linking
In FreeBSD there is no spearate library for dlopen, dlsym and dlerror.
Use LIBRARY_DL to check for this condition.
2013-12-13 10:18:19 +01:00
Holger Hans Peter Freyther 27a788ddb9 si: Make sure to not overwrite orig_arfcn_hi in the range encoding
Andreas highlighted that the doubel assignment is not needed and
wrong. Change the code to assign chan_list[0] before writing the
base frequency to the header. Update the testcase to make the highest
bit set and update the test result.
2013-12-12 17:00:57 +01:00
Holger Hans Peter Freyther e18209c975 ipa-proxy: Socket creation can fail, address coverity issue
Fixes: Coverity CID 1040722
2013-12-12 16:20:19 +01:00
Holger Hans Peter Freyther 7f180e83c3 vty: Address coverity issue with subscr->name never being NULL
Coverity points out that subscr->name is an array and never NULL.
Use strlen instead in this check.

Fixes: Coverity CID 1040717
2013-12-12 16:20:12 +01:00
Holger Hans Peter Freyther a5ddf489e1 subscriber: Address coverity warning and truncate the IMSI
The IMSI can only be 15 characters in length, our define gives
us a length of 17. This means we have place for two NULs. Use
strncpy and make sure it is null-terminated.

Fixes: Coverity CID 1040707
2013-12-12 16:20:07 +01:00
Holger Hans Peter Freyther 7672db33bd smpp_mirror: Initialize rc when cmd_id is not DELIVER_SM
Fixes: Coverity CID 1042369
2013-12-12 16:20:01 +01:00
Holger Hans Peter Freyther 109583dacb build: Ignore file generated by automake 2013-12-12 13:08:48 +01:00
Holger Hans Peter Freyther a80100644c mgcp: Address compiler error for sprintf misusage...
The hardening flags of debian have highlighted this sprintf mis-usage
in the testcase. Address it.
2013-12-12 13:08:26 +01:00
Jacob Erlbeck f6ec0e9fc4 mgcp/rtp: Refactored packet_duration computation
Since the packet duration is given in ms with the 'ptime' RTP media
attribute and also with the 'p' MGCP local connection option, the
computation is changed to use this value (if present). The
computation assumes, that there are N complete frames in a packet and
takes into account, that the ptime value possibly had been rounded
towards the next ms value (which is never the case with a frame length
of exact 20ms).

Sponsored-by: On-Waves ehf
2013-12-10 11:17:44 +01:00
Jacob Erlbeck 58340e5b5b mgcp/rtp: Fix RTP timestamps if enabled
This forces the output timing to fulfill
   dTS = dSegNo * fixedPacketDuration
where dSegNo = seqNo - lastSeqNo.

If timestamp patching is enabled, the output timestamp will be set
to lastTimestamp + dTS. This kind of relative updating is used to
handle seqNo- and timestamp-wraparounds properly.

The updating of timestamp and SSRC has been separated and the patch
field of mgcp_rtp_state has been renamed to patch_ssrc to reflect
it's semantics more closely. The offset fields are now used always
and will change the corresponding header field if they are != 0.

Ticket: OW#1065
Sponsored-by: On-Waves ehf
2013-12-10 11:17:44 +01:00
Jacob Erlbeck e2292f3aa1 mgcp/rtp: Only patch SSRC once after MDCX if enabled
Currently the output SSRC is always forced to be the same if SSRC
patching is enabled.

This patch modifies this to optionally restrict the number of SSRC
changes that will be corrected.

Note that the configuration only allows for the 'once' mode and 'off'.

Sponsored-by: On-Waves ehf
2013-12-10 11:17:42 +01:00
Jacob Erlbeck 3da9e4e441 mgcp/rtp: Use SSRC in proper byte ordering
The ssrc has been used without respect to proper byte ordering in
mgcp_patch_and_count(). This only affected log messages.

This patch introduces a new variable 'ssrc' that takes the value of
the SSRC in proper byte order.

Sponsored-by: On-Waves ehf
2013-12-10 11:13:22 +01:00
Jacob Erlbeck 30ce42250f mgcp/rtp: Compute default packet duration at state initialisiation
This patch adds a packet_duration field to mgcp_rtp_state which
contains the RTP packet's duration in RTP timestamp units or 0, when
the duration is unknown or not fixed.

Sponsored-by: On-Waves ehf
2013-12-10 11:13:22 +01:00
Jacob Erlbeck b35a77751b mgcp/rtp: Only update RTP header field offsets if enabled
Currently seq_offset and timestamp_offset are updated on each SSRC
change even when SSRC patching is not allowed.

This patch fixes this by changing mgcp_patch_and_count() to only
update these fields when SSRC patching is allowed.

Sponsored-by: On-Waves ehf
2013-12-10 11:13:22 +01:00
Jacob Erlbeck 5e9549e6a9 mgcp/rtp: Change the log message shown when the SSRC changes
Show old and new SSRC. Move logging command upward to show the values
immediately after the change has been detected and before any fixing
attempt is made.

Sponsored-by: On-Waves ehf
2013-12-10 11:13:22 +01:00
Jacob Erlbeck db2d431697 mgcp/rtp: Add RTP header patch mode configuration
This adds datastructures and a VTY frontend to configure the
different type of RTP header patching: SSRC and timestamp.

Note that timestamp patching is not yet implemented.

Sponsored-by: On-Waves ehf
2013-12-10 11:11:42 +01:00
Jacob Erlbeck 55ba140da1 mgcp/rtp: Fix output timing error counter
The tsdelta computation and error detection didn't handle the
intialisation phase properly.

This patches fixes this by skipping the output timing validation
when the SSRCs don't match.

Sponsored-by: On-Waves ehf
2013-12-05 16:55:39 +01:00
Jacob Erlbeck 83c0523739 mgcp/rtp: Add more test cases for RTP header patching
This patch extends the existing RTP error check test by adding a
check for timestamp errors after SSRC changes and a check for a
segno delta of 2 (with a timestamp delta of 320).

To test SSRC patching too, a corresponding line will be written on
each SSRC change that has been detected in the output stream.

In addition there is now support for selectively enabling/disabling
SSRC and timestamp patching. The RTP test sequence is repeated for
all combinations thereof.

Sponsored-by: On-Waves ehf
2013-12-05 16:54:25 +01:00
Jacob Erlbeck 78a9501cfd mgcp: Handle SDP in CRCX received by the MGW
So far the SDP part of the CRCX message has been ignored by the MGW.

This patch adds SDP parsing for this case, eventually updating the
net end's payload type and connection parameters.

Sponsored-by: On-Waves ehf
2013-12-05 10:28:51 +01:00
Jacob Erlbeck 3dff27d38d mgcp/nat: Take payload type from SDP data
So far the payload type used in RTP streams has been taken from the
trunk configuration in NAT mode.

This patch changes the implementation to use the payload type
announced in the SDP part of MGCP messages and responses. SDP
descriptions more than one m=audio line are not yet supported
properly (always the last one is taken).

Ticket: OW#466
Sponsored-by: On-Waves ehf
2013-12-05 10:28:48 +01:00
Jacob Erlbeck 9107e2da13 mgcp: NUL-terminate MGCP message
The MGCP message isn't always NUL-terminated when arriving at
mgcp_handle_message(). This may lead to undefined results.

This patch ensures that the message text is NUL-terminated by
setting *msg->tail to '\0' in mgcp_handle_message().

Addresses:
<000b> mgcp_protocol.c:642 Unhandled option: 'r'/114 on 0x3
<000b> mgcp_protocol.c:593 Unhandled SDP option: '='/61 on 0x3
<000b> mgcp_protocol.c:871 Unhandled option: '.'/46 on 0x2

Sponsored-by: On-Waves ehf
2013-12-05 10:28:23 +01:00
Jacob Erlbeck 1771171e05 mgcp: Refactor MGCP/SDP parsing
This patch separates the SDP parsing from the (message specific) MGCP
parsing.

Sponsored-by: On-Waves ehf
2013-12-05 10:27:33 +01:00
Jacob Erlbeck a52ac66e52 mgcp: Add tests for payload types in MGCP messages
These tests mainly check whether the SDP parsing works properly by
looking at the payload type detected.

Sponsored-by: On-Waves ehf
2013-12-05 10:27:32 +01:00
Jacob Erlbeck 2bee7f96ff mgcp: Add new for_each_line macro that also returns empty lines
This patch add the for_each_line macro based on a strline_r()
function (similar to strtok_r()), that is also part of this patch.
This strline_r() function is tolerant with respect to line endings,
it supports CR-only, CRLF, and LF-only and any combinations thereof
(note that a CRLF is always detected as a single line break).

Similar to for_each_non_empty_line (the former for_each_line) where
the 'save' pointer needed to be initialised by a call to strtok_r(),
the new for_each_line macro expects, that the 'save' pointer has been
initialised by a call to strline_r(). Also note, that
for_each_line/strline_r and for_each_non_empty_line/strtok_r may use
the 'save' pointer differently, so calls to them can not be mixed.

Sponsored-by: On-Waves ehf
2013-12-05 10:27:32 +01:00
Jacob Erlbeck a01bd60851 mgcp: Rename for_each_line to for_each_non_empty_line
The implementation of for_each_line is based on strtok() and skips
any sequence of CR and LF. Thus empty lines are never detected. There
exists code which tests for an empty line to detect the beginning of
the SDP part which is dead code currently (the parser works
nevertheless due to other reasons). So the semantics of this macro
have been misunderstood at least once.

This patch renames the macro to reflect the semantics more precisely.

Sponsored-by: On-Waves ehf
2013-12-05 10:27:32 +01:00
Harald Welte 19d8742820 osmo-nitb: don't print 'bac_hack' in usage/help output 2013-11-27 01:28:21 +01:00
Jacob Erlbeck 72c309021a mgcp/rtp: Fix timestamp offset when patching RTP packets
The current implementation increments the seqno but does not increment
the RTP timestamp, leading to two identical timestamps following one
after the other.

This patch fixes this by adding the computed tsdelta when the offset
is calulated. In the unlikely case, that a tsdelta hasn't been
computed yet when the SSRC changes, a tsdelta is computed based on
the RTP rate and a RTP packet duration of 20ms (one speech frame per
channel and packet). If the RTP rate is not known, a rate of 8000 is
assumed.

Note that this approach presumes, that the per RTP packet duration
(in samples) is the same for the last two packets of the stream being
replaced (the first one).

Sponsored-by: On-Waves ehf
2013-11-25 18:30:50 +01:00
Jacob Erlbeck d62419b574 mgcp/rtp: Add test case for RTP timestamp patching and stats
This patch adds a test case to check, whether RTP timestamps are
generated properly after SSRC changes and whether the error counters
work properly.

Sponsored-by: On-Waves ehf
2013-11-25 18:13:35 +01:00
Jacob Erlbeck 50079a1843 mgcp/rtp: Add counter for invalid RTP timestamp deltas
This patch modifies the patch_and_count() function to check for RTP
timestamp inconsistencies. It basically checks, whether dTS/dSeqNo
remains constant. If this fails, the corresponding counter is
incremented. There are four counter for this: Incoming and outgoing,
each for streams from the BTS and the net.

Note that this approach presumes, that the per RTP packet duration
(in samples) remains the same throughout the entire stream. Changing
the number of speech frames per channel and packet will be detected
as error.

In addition, the VTY command 'show mgcp' is extended by an optional
'stats' to show the counter values, too.

Ticket: OW#964
Sponsored-by: On-Waves ehf
2013-11-25 18:07:21 +01:00
Holger Hans Peter Freyther ec37bb2956 bsc: Add a VTY command to show the paging group for a BSC/IMSI 2013-11-22 16:00:00 +01:00
Jacob Erlbeck d9e4039516 rtp: Fixed size check in padded RTP packets
This patch fixes a corner case (padding 1, payload size incl padding
0) which is not being detected correctly.

Sponsored-by: On-Waves ehf
2013-11-21 20:00:55 +01:00
Holger Hans Peter Freyther 33b9641025 bsc: Use the right string for the notification 2013-11-15 16:47:59 +01:00
Holger Hans Peter Freyther 92ce02e644 rtp: Take the parameter from the arguments
$ gst rtp_replay.st -a FILE
2013-11-14 09:45:51 +01:00
Holger Hans Peter Freyther 558bdb4330 ipa: Explain that one needs to get the IP address of the BTS as argument 2013-11-11 14:30:09 +01:00
Holger Hans Peter Freyther 49976f4c1e shared: Introduce/Add procedure pending to the MO
GSM 12.21 specifies that "No elementary procedure shall be
initiated to an object instance which has not yet replied to
a previously initiated elementary procedure with a response,
an ACK or a NACK within a layer 3 time-out. The layer 3
timeout for ACK, NACK and responses shall have a default value
of 10 seconds."

We are using this flag in the BTS to enforce/safe-guard
this situation.
2013-11-05 16:06:17 +01:00
Holger Hans Peter Freyther 82e644b572 gbproxy: The "[stats]" option was not documented, document it
Documentation error (missing docs):
<command id='show gbproxy [stats]'>
        <param name='[stats]' doc='(null)' />
2013-11-03 17:34:17 +01:00