aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp
AgeCommit message (Collapse)AuthorFilesLines
2017-06-23mgcp: fix line-break problem in logPhilipp Maier1-2/+9
When the mgcp_client prints MGCP strings in the log text, it does not remove the line break before printing. This will mess up the log text. This patch removes the line break characters before printing properly.
2017-06-18mgcp: make bts base port configurablePhilipp Maier2-0/+23
Currently the rtp base port of the BTS is hardcoded (4000) and not configurable. This patch adds VTY configuration options to make it adjustable.
2017-06-18Revert "mgcp: make sure all endpoints are closed on startup"Philipp Maier1-2/+1
Clearing all endpoints by sending a DLCX on startup has ben found to be a bit too offensive. It also will not help against inconsitancies that may occour during runtime (e.g. an overheard DLCX during regular call teardown). This reverts commit b669ea94cb78fd9b56ee8dd9392538151349f8ba.
2017-06-18mgcp: make sure all endpoints are closed on startupPhilipp Maier1-1/+2
If the MSC is crashing and restarting, it may leave some endpoints open. The endpoints can not be re-used until they are deleted (DLCX). This patch sends a DLCX to all possible endpoints (usually this is in a countable range) in order to clear possible open endpoints from a previous run
2017-06-18mgcp: make structs accessible from outsidePhilipp Maier1-14/+0
struct mgcpgw_client and struct mgcp_inuse_endpoint are not accessible from outside, making it difficult to look in the mgcp client properties and status. The commit moves the structs into the header file.
2017-06-18mgcp: improve endpoint managementPhilipp Maier2-5/+97
Currently the assignment of endpoint identifiers works by just incrementing a counter. The mgcpgw only has a limited amount of endpoint identifiers avaliable, this means we will run out of endpoints after only a few calls. This commit adds a mechanism to keep track of used endpoint identifiers so unused endpoint identifiers can be re-used
2017-06-18mgcp: add DLCX command to mgcpgw clientPhilipp Maier1-0/+10
The mgcpgw client currently lacks support for DLCX. This patch adds a generator function to generate a DLCX command as well.
2017-06-18comment: fixme to cleanup MGCP portsNeels Hofmeyr1-0/+1
Related: OS#2279 Change-Id: Iaf4877ad1c6446609715094d785e9be93c9e0429
2017-06-18mgcp: hack RAB success from nano3G: patch first RTP payloadNeels Hofmeyr1-0/+7
The ip.access nano3G needs the first RTP payload's first two bytes to read hex 'e400', or it will reject the RAB assignment. Add flag patched_first_rtp_payload to mgcp_rtp_state to detect the first RTP payload on a stream, and overwrite its first bytes with e400. This should probably be configurable, but seems to not harm other femto cells (as long as we patch only the first RTP payload in each stream). Only do this when sending to the BTS side. Change-Id: I31a4475f42d59fd5704d52ee6e473e270db6d779
2017-06-18Implement IuCS (large refactoring and addition)Neels Hofmeyr6-19/+827
osmo-nitb becomes osmo-msc add DIUCS debug log constant add iucs.[hc] add msc vty, remove nitb vty add libiudummy, to avoid linking Iu deps in tests Use new msc_tx_dtap() instead of gsm0808_submit_dtap() libmgcp: add mgcpgw client API bridge calls via mgcpgw mgcp: hack RAB success from nano3G: patch first RTP payload The ip.access nano3G needs the first RTP payload's first two bytes to read hex 'e400', or it will reject the RAB assignment. Add flag patched_first_rtp_payload to mgcp_rtp_state to detect the first RTP payload on a stream, and overwrite its first bytes with e400. This should probably be configurable, but seems to not harm other femto cells (as long as we patch only the first RTP payload in each stream). Only do this when sending to the BTS side. Change-Id: Ie13ff348117e892d41b8355ab6c24915301eaeaf
2017-06-09don't re-implement osmo_talloc_replace_string()Harald Welte1-12/+12
osmo_talloc_replace_string() was introducd into libosmocore in 2014, see commit f3c7e85d05f7b2b7bf093162b776f71b2bc6420d There's no reason for us to re-implement this as bsc_replace_string here. Change-Id: I6d2fcaabbc74730f6f491a2b2d5c784ccafc6602
2017-05-10src: use osmo_timer_setup()Pablo Neira Ayuso1-2/+1
Use new function available in libosmocore to set up timers. Compile tested only. Change-Id: Ibcfd915688e97d370a888888a83a7c95cbe16819
2016-12-09mgcp_protocol: Ensure we don't call strtok_r with NULL dataHarald Welte1-0/+1
Change-Id: I1dce4df6a49fe95db592b0598194e3a8b8b1b994 Fixes: Coverity CID 135181
2016-09-28COSMETIC: 'if' is not a function, so there is space before '('Harald Welte1-1/+1
Change-Id: Ic22623dffce998d70a3c67aa6e445de98f558ed7
2016-09-15Consistenly format variables in */Makefile.am filesAlexander Huemer1-10/+37
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-07-11osmux: Add negotiation state so race conditions can't disable osmuxDaniel Willmann1-3/+3
Without this commit it is possible that osmux is disabled again on links with high jitter. This happens when an MGCP response without X-Osmux header is received before the NAT receives an Osmux dummy frame from the other side. Ticket: SYS#2628, SYS#2627 Sponsored-by: On-Waves ehf Change-Id: Id624b0279aee5e2412059a10296ce7896e2d4628
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.