Commit Graph

38 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther cac2438b0c mgcp: Move the "codec" params to a struct
We might be offered multiple codecs by the remote and need to
switch between them once we receive data. Do this by moving it
to a struct so we can separate between proposed and current
codec. In SDP we can have multiple codecs but a global ptime.
The current code doesn't separate that clearly instead we write
it to the main codec.
2014-09-02 08:25:49 +02:00
Pablo Neira Ayuso c20a661272 osmux: osmux batch-factor can't be higher than 8
The osmux header uses a counter of 3 bits, so you can put up to
8 message in it.
2014-09-01 20:07:27 +02:00
Pablo Neira Ayuso fcec6d85d0 osmux: save specific osmux configuration options if osmux is enabled
Just like other options do, to avoid polluting the configuration file
with unused options if osmux is disabled.
2014-09-01 20:06:43 +02:00
Pablo Neira Ayuso 08726e2837 osmux: initialize osmux_batch_size in mgcp config
The library allows to indicate zero as batch size if you want to use
the default size, however openbsc saves 'osmux batch-size 0' which is
not good as input.

Use OSMUX_BATCH_DEFAULT_MAX to explicitly initialize the batch size
from mgcp_parse_config().
2014-08-30 07:59:41 +02:00
Pablo Neira Ayuso 03ab79abac osmux: add 'osmux batch-size NUM' option to mgcp vty
This allows you to specify the osmux batch frame size. If zero, the
library uses the default value.
2014-08-29 12:30:38 +02:00
Pablo Neira Ayuso 308d5f8912 osmux: set default port from mgcp_parse_config() 2014-08-29 12:21:58 +02:00
Pablo Neira Ayuso eb7aeb19a2 osmux: print out 'osmux port' when saving configuration 2014-08-28 16:48:55 +02:00
Pablo Neira Ayuso 0fe78d39bd osmux: allow to specify the Osmux port
via mgcp section from the configuration file.
2014-08-28 16:43:38 +02:00
Holger Hans Peter Freyther cb6ad70994 mgcp: Change API to remove memory management from the name
Jacob pointed out that "free_endp" refers to the memory of
the endpoint being freed. What we want is actually a way to
release an endpoint (and the resource it allocated) or in
the case of the testcase/testapp initialize the data structure
correctly. Introduce two names for that.
2014-07-22 15:00:52 +02:00
Holger Hans Peter Freyther 3d93d35a93 mgcp: Provide more information about configured endpoints 2014-07-22 12:41:25 +02:00
Holger Hans Peter Freyther 8d998a713e mgcp: Verify that the force-ptime is written back to the file
When the command was added it was not verified that. Add a very
basic MGCP VTY test and test that the string appears in the config.
2014-07-07 19:24:34 +02:00
Holger Hans Peter Freyther 2947411383 mgcp: Fix documentation issue in the force-ptime command
<command id='rtp force-ptime (10|20|40)'>
        <param name='10' doc='(null)' />
        <param name='20' doc='(null)' />
        <param name='40' doc='(null)' />
2014-07-07 19:24:28 +02:00
Holger Hans Peter Freyther 421365eeaa mgcp: Allow to batch more than four messages 2014-06-16 14:12:02 +02:00
Jacob Erlbeck 42a833e89f mgcp: Add packet size (ptime) conversion
The current transcoder implemenation always does a 1:1 recoding
concerning the duration of a packet. So RTP timestamps and sequence
numbers are not modified.

This is not sufficient in some cases, e.g. when the BTS does only
allow for a single fixed ptime.

This patch decouples encoding from decoding and moves the decoded
samples to the state structure so that samples can be combined or
drain according to the packaging of incoming and outgoing packets.

This patch incorporates parts of Holger's experimental fixes in
0e669e05^..9eba68f9.

Ticket: OW#1111
Sponsored-by: On-Waves ehf
2014-06-05 14:08:45 +02:00
Holger Hans Peter Freyther cc84c9535c osmux: Fix the VTY online help in the osmux command
This should fix most of:

Documentation error (missing docs):
<command id='osmux (on|off)'>
        <param name='off' doc='(null)' />

Documentation error (missing docs):
<command id='osmux batch-factor &lt;1-4&gt;'>
        <param name='&lt;1-4&gt;' doc='(null)' />

Documentation error (missing docs):
<command id='osmux (on|off)'>
        <param name='off' doc='(null)' />

Documentation error (missing docs):
<command id='osmux (on|off)'>
        <param name='off' doc='(null)' />

Documentation error (missing docs):
<command id='osmux batch-factor &lt;1-4&gt;'>
        <param name='&lt;1-4&gt;' doc='(null)' />
2014-06-03 13:36:42 +02:00
Pablo Neira Ayuso cab6e7528c mgcp: add voice muxer support
This patch adds the voice muxer. You can use this to batch RTP
traffic to reduce bandwidth comsuption. Basically, osmux transforms
RTP flows to a compact batch format, that is later on decompacted
to its original form. Port UDP/1984 is used for the muxer traffic
between osmo-bsc_nat and osmo-bsc_mgcp (in the BSC side). This
feature depends on libosmo-netif, which contains the osmux core
support.

Osmux is requested on-demand via the MGCP CRCX/MDCX messages (using
the vendor-specific extension X-Osmux: on) coming from the BSC-NAT,
so you can selectively enable osmux per BSC from one the bsc-nat.cfg
file, so we have a centralized point to enable/disable osmux.

First thing you need to do is to accept requests to use Osmux,
this can be done from VTY interface of osmo-bsc_nat and
osmo-bsc_mgcp by adding the following line:

mgcp
  ...
  osmux on
  osmux batch-factor 4

This just initializes the osmux engine. You still have to specify
what BSC uses osmux from osmo-bsc_nat configuration file:

...
 bsc 1
  osmux on
 bsc 2
  ...
 bsc 3
  osmux on

In this case, bsc 1 and 3 should use osmux if possible, bsc 2 does
not have osmux enabled.

Thus, you can selectively enable osmux depending on the BSC, and
we have a centralized point for configuration from the bsc-nat to
enable osmux on demand, as suggested by Holger.

At this moment, this patch contains heavy debug logging for each
RTP packet that can be removed later to save cycles.

The RTP ssrc/seqnum/timestamp is randomly allocated for each MDCX that
is received to configure an endpoint.
2014-05-22 14:39:16 +02:00
Holger Hans Peter Freyther f50f70452f mgcp: The valid payload types start at 0. Fix the VTY 2014-03-20 22:34:37 +01:00
Jacob Erlbeck 075a9ebdcc mgcp: Send RTP keepalive dummy packets to net
So far, a single dummy packet has been sent immediately after the
reception of a MDCX message. There is no dedicated keep alive
mechanism (it just worked because the audio from the MS has always
been forwarded to the NAT until the 'mgcp: Set output_enabled flags
based on the MGCP mode' patch).

This patch adds explicit, timer based keep alive handling that can be
enable per trunk. A VTY command 'rtp keep-alive' command is added for
configuration which can be used to set the interval in seconds, to
send a single packet after the reception of a CRCX/MDCX when RTP data
from the net is expected ('once'), or to disable the feature
completely ('no rtp keep-alive'). In 'send-recv' connections, only
the initial packet is sent if enabled (even when an interval has been
configured). The default is 'once'.

Note that this removes the mgcp_change_cb() from mgcp_main.c.

Sponsored-by: On-Waves ehf
2014-01-16 13:20:51 +01:00
Jacob Erlbeck 0970bab2a3 mgcp/rtp: Add flag to disable RTP output
This patch make it possible to have a valid endpoint that drops all
outgoing RTP packets. The number of dropped packets is shown by the
VTY 'show mgcp' command. By default, this feature is disabled. To
enable packet dropping, the corresponding output_enabled field must
be set to 0.

Ticket: OW#1044
Sponsored-by: On-Waves ehf
2014-01-16 12:17:24 +01:00
Jacob Erlbeck 4bbddc6de9 mgcp/rtp: Only patch timestamp alignment errors
Currently, all timestamps are force to SeqNo*d + C which is more than
required by the nanoBTS which seems to be sensitive to alignment
errors only (dTS != k*d, d = ptime * rate = 160).

This patch replaces the force_constant_timing feature by a
force_aligned_timing feature. The timestamp offset will only be
changed (and timestamp errors counted) when the alignment does not
match to the raster based on ptime (default 20ms).

The VTY interface does not change.

Sponsored-by: On-Waves ehf
2013-12-19 11:56:11 +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 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 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
Jacob Erlbeck 36722e13da vty: Use vty_install_default() instead of bsc_install_default()
Remove ournode_exit_cmd, ournode_end_cmd, and bsc_install_default()
since this functionality is provided by the current libosmocore.

Replace calls to bsc_install_default() by call to
vty_install_default() with the following semantic patch:

    @rule1@
    expression N;
    @@
    - bsc_install_default(N);
    + vty_install_default(N);

Ticket: OW#952
Sponsored-by: On-Waves ehf
2013-10-30 15:19:00 +01:00
Jacob Erlbeck 0ae92a950a vty: Use generic 'end' and 'exit' commands
Add bsc_install_default() and replace all install_default()

This patch adds bsc_install_default() which calls install_default()
and add 'exit' and 'end'. All other calls to install_default() are
replaced by calls to bsc_install_default().

Since 'exit' and 'end' are now added automatically to each node, the
explicit registrations of these commands are removed by this patch,
too.

The related tests succeed now without work-arounds (except for the
'config' node itself which is part of libosmocore).
2013-09-02 20:25:35 +02:00
Pablo Neira Ayuso 326b5d80b3 libmgcp: add enum mgcp_role
This enum indicates if the mgcp is running on the BSC or the BSC-NAT.
2013-08-27 12:21:43 +02:00
Holger Hans Peter Freyther 63b0e44f65 vty: Document some previously undocumented parameters
Katerina pointed out that some nodes are not fully documented and
proposed some messages. The token/timeout messages were correct, I
have modified the other messages. I removed the full-stop from the
PING/PONG documentation as we are normally not using a full sentence.
2013-03-03 09:48:20 +01:00
Holger Hans Peter Freyther 5ea1bc77a3 mgcp: Allow to freely control the a=fmtp line for experiments
In case of AMR one can specify the available codecs out-of-band. Allow
to configure this line statically in the configuration file.
2012-12-16 13:18:08 +01:00
Holger Hans Peter Freyther 2a60a11c48 mgcp: Remove the lost_no from the mgcp statistics
The RFC 3435 specifies a different formula for calculating the lost
packages. It involves the number of received packages and the delta
of the sequence number.
2012-11-12 10:42:05 +01:00
Harald Welte 570ce24deb VTY: improve VTY prompt and make sure exit/end works everywhere
Some nodes below 'config' didn't have ournode_exit / ournode_end,
and thus were not able to properly perform this function.  exit should
always only go back one level, while end drops us back to ENABLE_NODE.

The prompt now represents the nesting level, and there's one consistent
space after the final prompt character (typically #).
2012-08-17 13:16:10 +02:00
Holger Hans Peter Freyther bc6a54dadc mgcp: Make sure "no rtcp-omit" is fully documented
One command missed the NO_STR in the documentation, share the
main text across all commands.
2012-07-28 15:46:45 +02:00
Holger Hans Peter Freyther a8090d54d6 mgcp: Make it possible to drop RTCP packets coming from the BTS/Net
The ip.access nanoBTS appears to send quite broken NTP timestamps in
the RTCP messages might confuse equipment that uses the sender report
of the BTS. Make it easy to experiment by adding an option to drop RTCP.
2012-05-11 13:09:30 +02:00
Harald Welte 6a85705d51 MGCP: Add VTY commands to reset (RSIP) one or all endpoints 2012-01-27 00:41:39 +01:00
Holger Hans Peter Freyther 3ffcf2045c mgcp: Make sure each command has some kind of online help
In this iteration I just want to make sure that each VTY command has
online help. Replace "a b" with "a-b" if there is no "a c" with b!=c.

This config should gain some more sanity and consistency, this will
happen in another iteration.
2011-11-06 21:41:51 +01:00
Holger Hans Peter Freyther a8a09df6a6 misc: Remove sys/types.h includes from the files
These are not needed any more. We used them for u_int
types but we now use uint which comes from stdint.h
2011-04-18 17:31:39 +02:00
Pablo Neira Ayuso 136f453dd2 src: use new library libosmogsm and new path to headers in libosmocore
libosmogsm is a new library that is distributed in the libosmocore.
Now, openbsc depends on it. This patch gets openbsc with this
change.

This patch also rewrites all include path to the new
osmocom/[gsm|core]

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:17:56 +01:00
Holger Hans Peter Freyther 16b7f5c4ef mgcp: Remove some duplicate header files from the list. 2011-03-08 15:33:52 +01:00
Harald Welte 89579b4317 prefix sub-directories containing libraries with 'lib'
... and make sure tests work again after restructuring
2011-03-04 13:23:09 +01:00