Commit Graph

67 Commits

Author SHA1 Message Date
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 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 bd4109babc mgcp: Document transcoding semantic and follow it
Transcoding from GSM to PCMA can lead to the MGCP MGW sending
two PCMA packages with the same sequence number and timestamp.
Once with the encoded audio and once completely empty.

This is because "state->dst_packet_duration" is 0 in most cases
(unless a ptime is forced) and we attempt to encode audio even
if there are not enough samples. The encode_audio return will
return 0 in that case which is not trated as an error by the
mgcp network code.

Handle rc == 0 specially and document the semantic.
2014-07-22 14:42:53 +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
Jacob Erlbeck 168ca00b02 mgcp: Add a function to get media info for MGCP responses
This patch adds the get_net_downlink_format_cb() callback to provide
payload_type, subtype_name, and fmtp_extra suitable for use in a MGCP
response sent to the network. Per default, the BTS side values are
returned since these must be honoured by the net peer when sending
audio to the media gateway (unless transcoding is done).

Sponsored-by: On-Waves ehf
2014-06-05 14:00:46 +02:00
Jacob Erlbeck a0d64ce063 mgcp: Add callbacks for payload processing
This patch adds the callbacks rtp_processing_cb and
setup_rtp_processing_cb to mgcp_config to support arbitrary RTP
payload processing.

Sponsored-by: On-Waves ehf
2014-06-05 12:19:46 +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
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 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
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 462b7d7158 nat: We want the remote to respond to our DLCX request
We want to send a TRAP with the MGCP statistics from the NAT and
the connected BSC. The BSC endpoint can be either released because
of a DLCX from the MGCP CallAgent or the SCCP Connection release on
the A-link.

This is why we need to queue the statistics when the deleting the
endpoint on the BSC. The processing is continued once the response
arrives. This code assumes that the response of the DLCX will be sent
by the remote side. The current amount of outstanding responses can be
seen on the VTY. This assumption is based on the fact that the BSC has
already responded to the CRCX and maybe to the MDCX.

The MGCP RFC is bended to prefix the transaction identifier with "nat-"
to easily detect the response and hand it to the handler. This will
then parse the response and generate the TRAP. The current version is
v1. We assume that the transaction space is big enough and we will
not re-assign the transaction identifier too early.
2013-04-16 09:17:21 +02: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 ce55361e93 mgcp: Test and implement re-transmission handling
MGCP is used over UDP and a response might be lost. The MGCP RFC
asks for keeping a list of responses and then using the previous
response to answer a duplicate request. I tried to conserve memory
and just wanted to remember the last transaction identifier and
result-code and re-generate the result from that. This made the
code look bad and this is why the entire response will now be stored.
It sadly increases the memory usage but can not be avoided at this
time.

Remove the msg->l3h pointer for the RQNT callback as strtok has
modified the content of it.
2012-12-10 14:46:00 +01:00
Holger Hans Peter Freyther a769dcb889 mgcp: Methods generating a response now include the endpoint pointer
This is required for remembering the last result in a central place
and is required to properly implement detection of re-transmissions.
2012-12-10 13:36:00 +01:00
Holger Hans Peter Freyther 8d0be259cb mgcp: Begin handling of the RQNT message as needed for DTMF
Introduce a callback for the request and forward the signalrequest
to the callback. This is not a full implementation of MGCP RQNT.
2012-11-29 19:56:22 +01:00
Holger Hans Peter Freyther 0bf15a8187 mgcp: Include statistics at the end of a connection
Follow the MGCP specification and send the collected statistics
at the end of a call. Right now this does not include jitter, packet
loss and delay.
2012-11-12 10:42:05 +01: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 94b499c9bd mgcp: add missing prototypes for send_mgcp_reset_* 2012-01-27 00:46:49 +01:00
Holger Hans Peter Freyther 74db7744ee mgcp: Implement RSIP based on a trunk level
Implement the RSIP spec extension to work on the specified
trunk instead of hardcoding it to the virtual trunk.
2011-07-19 19:56:33 +02:00
Pablo Neira Ayuso e1273b1f3c src: use namespace prefix osmo_wqueue*
Summary of changes:

s/struct write_queue/struct osmo_wqueue/g
s/write_queue_init/osmo_wqueue_init/g
s/write_queue_clear/osmo_wqueue_clear/g
s/write_queue_enqueue/osmo_wqueue_enqueue/g
s/write_queue_bfd_cb/osmo_wqueue_bfd_cb/g
2011-05-06 12:12:49 +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 44016fee14 mgcp: Fix the static allocation of E1 trunks for the BTS/NET side 2011-02-28 19:40:54 +01:00
Holger Hans Peter Freyther 1f0c5b4742 mgcp: Allocate the endpoints for the E1 trunks as well. 2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther 0e939fec42 mgcp: Introduce a trunk config for multiple trunks.
A trunk will always have 32 endpoints to be used and we allow
a sparse allocation of endpoints.
2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther 88ad7723b4 mgcp: Introduce a mgcp_trunk_config enum for endpoint configs
We want to support real trunks in the MGCP code and we need to
have some better book keeping for those. Move the code around.
2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther 6adac17a10 mgcp: Include a MGCP Response String in the response
Switch to a \r\n at the end of the query. Both \n and \r\n
are valid according to the spec but this makes us match
responses of other equipment.
2011-01-06 19:35:10 +01:00
Harald Welte 9af6ddfcec License change: We are now AGPLv3+ instead of GPLv2+
The reason for this is quite simple: We want to make sure anyone
running a customized version of OpenBSC to operate a network will
have to release all custom modifiations to the source code.
2011-01-01 15:39:34 +01:00
Holger Hans Peter Freyther f2eedff052 nat: Send a transcoder reset on start up.
The transcoder RESET is using the same extensions to reset all
endpoints on a remote site. This makes sure that all allocations
can be made in a properly configured network.
2010-09-20 02:51:30 +08:00
Holger Hans Peter Freyther b98ba72e0a mgcp: Make the base port of the transcoder configurable
The code assumes a static mapping from endpoint to RTP port,
be able to configure the start of such a mapping.
2010-09-20 02:51:30 +08:00
Holger Hans Peter Freyther 54aaa0fbed mgcp: Add ports for the transcoder as well 2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther a2a10ebf03 mgcp: Add a transcoder-mgw command to store the address 2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther 6f6801066b mgcp: Keep the gw_fd inside the mgcp_config
Move the bfd from a static var into the mgcp_config.
2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther e3946f458a mgcp: Remove the hack to remap timeslot one...
The timeslot one is blocked and should not be used, replace the
code with a warning and watch out for it. Tis is most likely due
the uncovered in the previous commit due the wrong TLV definition.
2010-09-20 02:47:34 +08:00
Holger Hans Peter Freyther 82049d8141 mgcp: Add method to go back from endpoint to multiplex/timeslot 2010-08-29 16:35:23 +08:00
Holger Hans Peter Freyther cb8c35cd51 mgcp: Speculative mgcp fix...
We really have 32 channels per multiplex... so use the right
number... or at least it seems we do have 32.
2010-08-29 16:35:22 +08:00
Holger Hans Peter Freyther 869e38eced mgcp: Add a callback to inform the client that an endpoint got reallocated 2010-08-06 17:54:27 +08:00
Holger Hans Peter Freyther 4634013cde mgcp: Make the CI uint32_t all the way to avoid mismatch 2010-08-06 08:29:37 +08:00
Holger Hans Peter Freyther 1be9f2fddc mgcp: Allow to have a different port allocation mode 2010-08-05 07:20:09 +08:00
Holger Hans Peter Freyther 15e7389cf0 mgcp: Prepare to have different port allocation strategies. 2010-08-05 07:10:56 +08:00
Holger Hans Peter Freyther 314584ab44 mgcp: Allocate a different port for the networking...
Use the right source port when sending the message.
2010-08-05 06:12:02 +08:00
Holger Hans Peter Freyther 196349dda1 mgcp: Rename the base port to bts_base as it will be used for the bts 2010-08-05 06:10:58 +08:00
Holger Hans Peter Freyther bb89aa1430 mgcp: Make the function internal, only used by the init/config code 2010-08-05 06:10:58 +08:00
Holger Hans Peter Freyther 217d712012 mgcp: Rename the bind method to show it is only binding for the bts port 2010-08-05 06:10:57 +08:00
Holger Hans Peter Freyther f1a168dc20 mgcp: Only use early bind for the BTS socket.
Simplify the code by onlt allowing one way to allocate
a socket.
2010-08-05 06:10:57 +08:00
Holger Hans Peter Freyther 58ff219c85 mgcp: Attempt to separate the RTP/RTCP port for the Network and for the BTS
We plan to have two different ports for the network and for the
BTS to avoid detecting the BTS and to dynamically allocate the
port to have old data not go to a new socket.
2010-08-05 06:10:57 +08:00
Holger Hans Peter Freyther 8b5772ebe4 mgcp: Remove the forwarding mode as it was not used. 2010-08-05 06:10:13 +08:00
Holger Hans Peter Freyther d0c3229590 mgcp: Rename TOS to DSCP
DSCP is the more modern information for TOS and the kernel
will set parts of TOS by itself (e.g. for ECN).
2010-07-27 20:35:03 +08:00