aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp
AgeCommit message (Collapse)AuthorFilesLines
2016-03-16mgcp: Fix compiler warnings on size_t on AMD64Holger Hans Peter Freyther1-4/+4
mgcp_transcode.c: In function 'decode_audio': mgcp_transcode.c:332:4: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_ERROR, ^ mgcp_transcode.c:332:4: warning: format '%d' expects argument of type 'int', but argument 8 has type 'long unsigned int' [-Wformat=] mgcp_transcode.c: In function 'encode_audio': mgcp_transcode.c:390:4: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_INFO, ^ mgcp_transcode.c:390:4: warning: format '%d' expects argument of type 'int', but argument 8 has type 'size_t' [-Wformat=] mgcp_transcode.c: In function 'mgcp_transcoding_process_rtp': mgcp_transcode.c:542:5: warning: format '%d' expects argument of type 'int', but argument 9 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_NOTICE, ^ mgcp_transcode.c:571:4: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_NOTICE, ^
2015-11-02mgcp_osmux: available circuit IDs from 0 to 255, not from 0 to 128Pablo Neira Ayuso1-1/+1
Holger reports that the bitmap that accounts for available Osmux circuit IDs is limited to 128, when the maximum number of circuit IDs are determined by the uint8_t field in the header (ie. 256 circuits). [hfreyther: Update the testcase now that we have more ids to allocate]
2015-10-12osmux: Allow to listen to a specific addressHolger Hans Peter Freyther3-1/+14
For a setup with multiple network interfaces be able to pick the one that osmux should be used/visible.
2015-10-12osmux: Remember the allocated CID and make sure it is releasedHolger Hans Peter Freyther2-0/+17
There appears to be a leak of CIDs: <000b> mgcp_osmux.c:544 All Osmux circuits are in use! There are paths that a CID had been requested and never released of the NAT. Remember the allocated CID inside the endpoint so it can always be released. It is using a new variable as the behavior for the NAT and MGCP MGW is different. The allocated_cid must be signed so that we can assign outside of the 0-255 range of it. Fixes: OW#1493
2015-10-12osmux: Allow to enforce using Osmux for the clientHolger Hans Peter Freyther2-14/+35
Some systems only want to use Osmux. In case only Osmux should be used fail if it has not be offered/acked. Client: Verified On, Off and Only with X-Osmux: 3 and without this field. <000b> mgcp_protocol.c:823 Osmux only and no osmux offered on 0x14 <000b> mgcp_protocol.c:884 Resource error on 0x14 NAT: Not tested and implemented Fixes: OW#1492
2015-10-12osmux: Add introspection for osmux.Holger Hans Peter Freyther1-0/+3
* Print number of used CIDs for the system * Hopefully this is just the beginning
2015-10-12osmux: Do not divide the number of bytes by eight.Holger Hans Peter Freyther1-2/+2
sizeof(uint8_t) == 1 and there is no need to create an array with 16 bytes and then only use the first two of them. This means the CID range is from 0 to 127 and we should be able to extend this to 256 by changing the array size to 32. Update the testcase now that we can have more than 16 calls with Osmux.
2015-10-12osmux: Test cid allocation and de-allocationHolger Hans Peter Freyther1-0/+14
* Test that one can get an id * That they are assigned predicatble right now * That returning them will make the number of used ones go down * That allocating more will fail
2015-10-08mgcp: Indicate where the sending failedHolger Hans Peter Freyther1-2/+6
The log message does not help and says where the data is being sent to. This is because we have both a RTP and RTCP port. Remember if we failed with RTCP or RTP and improve the log message. I was searching a case where the port was bound to a local address (e.g. 127.0.0.1) and tried to send the data to a public one (e.g. 8.8.8.8).
2015-09-07osmux: fix show online-helpPablo Neira Ayuso1-1/+1
Before: <command id='osmux dummy (on|off)'> <params> <param name='osmux' doc='RTP multiplexing' /> <param name='dummy' doc='Enable dummy padding' /> <param name='on' doc='Disable dummy padding' /> <param name='off' doc='(null)' /> </params> After: <command id='osmux dummy (on|off)'> <params> <param name='osmux' doc='RTP multiplexing' /> <param name='dummy' doc='Dummy padding' /> <param name='on' doc='Enable dummy padding' /> <param name='off' doc='Disable dummy padding' /> </params> </command> Note the 'null' string in 'off'. Reported by Holger.
2015-09-04mgcp: Fix grammar, clean-up return codesHolger Hans Peter Freyther1-7/+6
Mike's patch included clean-ups I want to apply separately and change them a bit. If we return from an else we don't need to put the else. * Try the E1 trunk first * Then try a local virtual trunk * Fail if none of the above returned
2015-09-04mgcp: Remove use of hardwired @mgw from endpoint IDs.Michael McTernan1-1/+1
Remove the host portion of the endpoint Id. This requires less configuration and we are probably fine to trust that MGCP only received messages designated for it.
2015-08-20mgcp: Allow to bind to different ports for net/bts portsHolger Hans Peter Freyther1-0/+46
When using multiple interfaces on a system one can now configure which will be served for the BTS ports and which will be served for the network. The direct usage of source_addr is now only to initialize the MGCP receiving port itself.
2015-08-20mgcp: Begin to separate network and bts endpointsHolger Hans Peter Freyther2-15/+19
Make it possible to bind the call-agent to a specific IP address and the network and bts end to different ip addresses. Begin by clarifying which source ip address we want to have.
2015-08-19mgcp: Add transcoding from PCMU as wellHolger Hans Peter Freyther2-0/+34
Use the existing ulaw encode/decode to support PCMU as well. The MERA VoIP switch has some severe issues with the GSM codec and it appears easier to enable transcoding for it. The mera switch doesn't appear to cope with codec change between a SIP 180 trying and the 200 ok connection result. Inserting the codec is touching too many places. Ideally we should have the transcoding function as pointer in the struct as well but the arguments differ.. so it is not a direct way forward.
2015-08-19osmux: add option to pad the circuit with dummy messagesPablo Neira Ayuso2-0/+23
Iridium is a satellite network which operates a GPRS-like that allows you to get speeds up to 128kbit/s. However, it takes from 5 to 6 secs to get the bandwidth allocated, so the conversation is garbled during the time. This patch uses the new dummy padding support in libosmo-netif that is controlled through the osmux osmux_xfrm_input_open_circuit(). This includes a new VTY option for osmux.
2015-08-17mgcp: Avoid crashing when rtpmap is not completeHolger Hans Peter Freyther1-0/+3
The NAT sends an incomplete SDP file for the purpose of informing the BSC about the remote IP/PORT early. The case of an incomplete SDP file was not considered. Check if there is a codec and if not skip it. TODO: We need to have a better end-point life cycle test.
2015-08-14mgcp: Allow to enforce that the codecs need to matchHolger Hans Peter Freyther2-3/+26
We have a lot of legacy that I am afraid to break. We have everything in place to make a good codec selection (e.g. if we can avoid transcoding, pick the one with best quality or the lowest speed). Right now I have a specific case where from all options I want to pick GSM. Guard the codec compat check behind the disallow transcoding option to make sure to not break legacy application.
2015-08-14mgcp: Turn SDP file parsing in a two stage processHolger Hans Peter Freyther1-28/+108
First collect everything we know and the mapping. E.g. a genuis could remap "3" to "AMR" so we only know the codecs once we are at the end of the SDP file. Once we have collected everything we can select the audio codecs. The current code is compatible in that two codecs will be selected regardless of if they make any sense or not. mgcp_set_audio_info could re-use some of our codec information but then the caller in the MGCP protocol needs to be updated as well as we use the "I: GSM" information to derive the codec from there.
2015-08-14mgcp: Move the SDP handling into a separate file/moduleHolger Hans Peter Freyther3-218/+198
The SDP file handling will get more complicated in terms of codec selection so let's remove it from the protocol handling before we start blowing it up in size.
2015-04-28mgcp: Move assignment of src_codec downwardsJacob Erlbeck1-1/+2
Currently the src_codec const variable is set to &src_end->codec before src_end is checked against NULL. Since the assigment is just an address operation and the memory where it points to is only accessed after the NULL check, this does not harm technically. Nevertheless this is potential source for errors if that code is changed. This commit moves the definition below the NULL check. This does not comply with the coding style, but it cannot be split into definition and a later assignment due to the const qualifier. Sponsored-by: On-Waves ehf
2015-04-24mgcp: Allow to disable transcoding for trunksHolger Hans Peter Freyther2-0/+54
We might have compiled transcoding into the MGW but we don't want to enable it for a given user. Add a new switch that should allow that. I had manually tested the allow-transcoding/no allow VTY interface for the primary interface and a new trunk using show running-config.
2015-04-24mgcp: Ignore the case for finding a codecHolger Hans Peter Freyther1-5/+5
It is unlikely that GSM, gsm and GsM refer to different codecs. The mera mvts does send the audio codecs in lower case even if RFC 3551 has them in upper case (but copy and paste is sometimes too hard).
2015-03-29libmgcp: Fail if transcoding can't be configuredHolger Hans Peter Freyther1-10/+14
We want to fail theallocation of an endpoint in case the transcoding can't be configured. Manually verified with: ./src/osmo-bsc_mgcp/osmo-bsc_mgcp -c doc/examples/osmo-bsc_mgcp/mgcp.cfg $ ./contrib/mgcp_server.py 0000 32 30 30 20 33 30 36 39 200 3069 0008 31 20 4F 4B 0D 0A 1 OK.. ('127.0.0.1', 2427) 0000 34 30 30 20 35 39 30 36 400 5906 0008 39 20 46 41 49 4C 0D 0A 9 FAIL.. ('127.0.0.1', 2427) 0000 34 30 30 20 33 35 34 36 400 3546 0008 33 20 46 41 49 4C 0D 0A 3 FAIL.. ('127.0.0.1', 2427) 0000 34 30 30 20 36 32 31 37 400 6217 0008 30 20 46 41 49 4C 0D 0A 0 FAIL.. ('127.0.0.1', 2427) Verified by not sending L: in the CRCX and then failing on the MDCX.
2015-03-22rtp: Catch up with the removal of the rtp.hHolger Hans Peter Freyther1-1/+1
2015-03-22rtp: Use osmocom/netif/rtp.h for the rtp structure definitionHolger Hans Peter Freyther1-1/+4
We depend on libosmo-netif unconditionally. Let's use this definition of rtp and have one portability issue less.
2015-01-21mgcp: Honor the rtp IP_TOS settings for OsmuxHolger Hans Peter Freyther3-4/+5
Honor the IP_TOS settings for Osmux as well. Re-use the RTP setting as it makes sense to classify the audio packets the same way. Fixes: OW#1369
2015-01-02Partial revert "Fix most compiler warnings with gcc-4.9.2"Holger Hans Peter Freyther1-1/+1
Most of the "fixes" have nothing to do with gcc-4.9.2 but are a question of ABI/Architecture (e.g. x86 vs. AMD64). Revert these for now. This partially reverts commit 7b1d25a11e44bbc1cb0d2acd9f1a3d4a16ec7c90. abis_test.c: In function ‘test_simple_sw_config’: abis_test.c:68:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[0].start - simple_config, descr[0].len); ^ abis_test.c: In function ‘test_dual_sw_config’: abis_test.c:111:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[0].start - dual_config, descr[0].len); ^ abis_test.c:115:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[1].start - dual_config, descr[1].len); ^ abis_test.c: In function ‘test_sw_selection’: abis_test.c:132:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[0].start - load_config, descr[0].len); ^ abis_test.c:136:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[1].start - load_config, descr[1].len);
2015-01-01Fix most compiler warnings with gcc-4.9.2Harald Welte1-1/+1
2014-11-20mgcp/sdp: Session name must not be empty pick an empty oneHolger Hans Peter Freyther1-0/+1
The session name must be present in a SDP file. The RFC proposes to use a space for it but the other equipment is using the dash so I have picked that as well. RFC 4566: The "s=" field is the textual session name. There MUST be one and only one "s=" field per session description. The "s=" field MUST NOT be empty and SHOULD contain ISO 10646 characters (but see also the "a=charset" attribute). If a session has no meaningful name, the alue "s= " SHOULD be used (i.e., a single space as the session name). Fixes: RT#2196
2014-11-19mgcp: Allow to omit sending the audio name at allHolger Hans Peter Freyther2-1/+53
Equipment like AudioCode appears to get upset when we use a builtin type and then assign a name to it. Allow to completely omit the name.
2014-10-09mgcp: Count the incoming data instead of the modified oneHolger Hans Peter Freyther1-2/+2
For jitter, transit and packet loss we should count the data that arrived and not the data we send towards the remote. This is changing the jitter timings to what they were before the re-factoring. For forced timing we might willingly add jumps in the sequence number but for jitter and packet loss we are more interested in the data that traveled through the wire/air.
2014-10-09mgcp: Do not detect the initial package as a wrap aroundHolger Hans Peter Freyther1-20/+21
The Annex A code has a probation period but we don't have it. When starting with seq_no==0 do not assume that the sequence numbers have wrapped. Do it by moving the entire checking code into the else.
2014-10-09mgcp: Move Annex A counting out of patch/count methodHolger Hans Peter Freyther1-41/+63
mgcp_patch_and_count has grown due supporting linearizing timestamps, ssrc and other things for equipment like the ip.access nanoBTS. Fight back and move the Annex A code into a dedicated method. The result is updated as we now count after all the patching and for the Annex A code no change in SSRC can be detected.
2014-10-09mgcp: We only look at the RTP header use that in the commentHolger Hans Peter Freyther1-2/+2
2014-09-17osmux: send osmux stats in MGCP DLCX responsesPablo Neira Ayuso2-6/+32
This allows us to know what number of messages and bytes has been received per active osmux endpoint. Note that an Osmux message is composed of several chunks. Each chunk contains an osmux header plus several voice data frames. P: PS=385, OS=11188, PR=195, OR=5655, PL=0, JI=49 X-Osmo-CP: EC TIS=0, TOS=0, TIR=0, TOR=0 X-Osmux-ST: CR=51, BR=3129 The new 'X-Osmux-ST:' notifies the received chunks and bytes.
2014-09-16osmux: account extracted traffic from the osmux batchPablo Neira Ayuso1-0/+6
Use struct mgcp_rtp_end statistics to account the RTP messages that has been extracted from the osmux batch and transmitted.
2014-09-02mgcp: Deal with receiving another payload typeHolger Hans Peter Freyther1-1/+53
In case we get offered G729 and G711 we might have selected G729 as the audio codec. The first packet we receive might be G711 though. In that case we will need to change. But only if we have a matching alternate codec payload_type. E.g. in the case of comfort noise we will receive the PT=11 and we don't want to change.
2014-09-02mgcp: Store one more codec/payload type if it is presentHolger Hans Peter Freyther1-7/+18
In case of some RTP proxy from time to time we are offered both G729 and G711 but only one of them will work. I intend to adjust the codec at runtime in case we receive the wrong codec.
2014-09-02mgcp: Group codec reset and put it to a separate method.Holger Hans Peter Freyther1-9/+15
2014-09-02mgcp: Move the "codec" params to a structHolger Hans Peter Freyther4-71/+78
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-02mgcp: Use the rtp_hdr structure and extract ts/seq from thereHolger Hans Peter Freyther1-6/+8
Use the rtp_hdr structure. The basic alignment issue remains and I need to merge/cherry-pick Jacob's getters for the ts, sequence number and other attributes.
2014-09-01osmux: osmux batch-factor can't be higher than 8Pablo Neira Ayuso1-1/+1
The osmux header uses a counter of 3 bits, so you can put up to 8 message in it.
2014-09-01osmux: save specific osmux configuration options if osmux is enabledPablo Neira Ayuso1-7/+8
Just like other options do, to avoid polluting the configuration file with unused options if osmux is disabled.
2014-08-30osmux: initialize osmux_batch_size in mgcp configPablo Neira Ayuso1-1/+1
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-29osmux: add 'osmux batch-size NUM' option to mgcp vtyPablo Neira Ayuso2-0/+14
This allows you to specify the osmux batch frame size. If zero, the library uses the default value.
2014-08-29osmux: set default port from mgcp_parse_config()Pablo Neira Ayuso2-5/+1
2014-08-29osmux: fix unchecked return value in mgcp_parse_osmux_cid()Pablo Neira Ayuso1-2/+4
** CID 1232804: Unchecked return value (CHECKED_RETURN) /src/libmgcp/mgcp_protocol.c: 888 in mgcp_parse_osmux_cid()
2014-08-28osmux: fix leak in osmux_deliver()Pablo Neira Ayuso1-0/+1
The callback is responsible for releasing the batch message that libosmo-netif builds.
2014-08-28osmux: fix access to uninitialized memory area in scheduled_tx_*_cbPablo Neira Ayuso1-2/+8
mgcp_send() needs some initialized address when printing a log message. Nothing really serious but let's calm down valgrind.