aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
AgeCommit message (Collapse)AuthorFilesLines
2014-07-22mgcp: Document transcoding semantic and follow itHolger Hans Peter Freyther1-0/+6
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-22mgcp: Make the internal state of the transcoder accessibleHolger Hans Peter Freyther1-0/+53
For the unit tests we need to look at the internal state.
2014-07-07rtp: Share the rtp header between the proxy and the mgcp codeHolger Hans Peter Freyther2-1/+39
2014-07-07gprs/test: Remove verbose parameter of gbprox_dump_* functionsJacob Erlbeck1-2/+2
This parameter is not used (the methods are always called with an argument of 1 in the third position). Thus the parameter is removed completely. Sponsored-by: On-Waves ehf
2014-06-05mgcp: Set net_end audio params in recvonly modeJacob Erlbeck1-0/+1
Currently, if there is no SDP data in the MGCP message received from the net, the fields containing audio encoding information are not set in net_end. So in recvonly mode transcoding would not be set up correctly. This patch changes the implementation of the code handling CRCX and MDCX to use the codec signalled in the MGCP local connection options (field 'a:') if there isn't any SDP data. This is only halfway negotiation, because the codec is used blindly and not matched against the supported ones. Sponsored-by: On-Waves ehf
2014-06-05mgcp: Move transcoding to libmgcpJacob Erlbeck2-1/+37
This patch moves the files relevant to transcoding from src/osmo-bsc_mgcp to src/libmgcp and src/include/openbsc. Makefiles and include directives are being updated accordingly. Sponsored-by: On-Waves ehf
2014-06-05mgcp: Add packet size (ptime) conversionJacob Erlbeck2-2/+6
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-05mgcp: Add a function to get media info for MGCP responsesJacob Erlbeck2-0/+13
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-05mgcp: Add audio info fields to struct mgcp_rtp_endJacob Erlbeck1-0/+3
This patch adds the fields channels, subtype_name, and audio_name to the struct. The field audio_name contains the full string that has been used for the last part of a SDP a=rtpmap line. The others contain decoded parts of that string. If no a=rtpmap line has been given (e.g. because dynamic payload types are not used), values are assigned when the payload type matches one of the predefined ones (GSM, G729, PCMA). The patch also moves the audio_name parsing code to a dedicated set_audio_info() function. Sponsored-by: On-Waves ehf
2014-06-05mgcp: Add callbacks for payload processingJacob Erlbeck2-0/+19
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-04gprs: Separate LLC parsing from LLC state handlingJacob Erlbeck1-0/+41
Currently LLC parsing is part of gprs_llc.c which needs large parts of the SGSN code parsing to fulfill its link dependencies. This patch moves the functions that just do plain parsing, dumping, and FCS computation to a different file to avoid these dependencies if LLC stateful processing is not needed. It also exposes struct gprs_llc_hdr_parsed and enum gprs_llc_cmd publically. Sponsored-by: On-Waves ehf
2014-05-26mgcp: Use #pragma once instead of a possible clashing #ifdefHolger Hans Peter Freyther1-3/+1
The filename is mgcp_internal.h but the define refers to MGCP_DATA. Avoid having a potential clash by using the #pragma once option.
2014-05-22mgcp: add voice muxer supportPablo Neira Ayuso5-2/+53
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-15ctrl: Use CTRL_CMD_DEFINE_STRUCT in CTRL_CMD_DEFINE_RANGEHolger Hans Peter Freyther1-6/+1
Jacob pointed out that I didn't convert CTRL_CMD_DEFINE_RANGE. This patch is doing it now.
2014-05-15ctrl: Reduce code duplication and add a define to create the structHolger Hans Peter Freyther1-13/+10
This has been pointed out by Jacob and removes two more duplicates of the struct. For the unused CTRL_CMD_DEFINE_STRING macro there will be no verify command.
2014-05-15ctrl: Remove the param parameter as it was never used/implementedHolger Hans Peter Freyther1-4/+0
2014-05-15ctrl: Introduce a macro for read-only attributes and use itHolger Hans Peter Freyther1-0/+14
Certain attributes are read-only. Add a macro to make it more easy to define those.
2014-05-09bsc: Fix compilation on FreeBSDNikola Kolev1-0/+2
FreeBSD uses POSIX netinet/in.h for representing socket addresses data types. [Holger removed the #ifdef and changed the order of includes to have specific ones first and system includes later]
2014-05-06nat/bsc: Check proto before calling ipaccess_rcvmsg_baseHolger Hans Peter Freyther1-1/+0
The code in the BSC/NAT called ipaccess_rcvmsg_base without checking if the protocol is IPA. This lead the BSC to respond to SCCP messages with an "ID ACK". From a quick look neither the code of ipaccess_rcvmsg_base in OpenBSC nor the copy of libosmo-abis ever checked the protocol header. So this code has been wrong since initially being created in 2010.
2014-04-30sms: Kill the sms->sender and use addr/ton/npi throughout the codeHolger Hans Peter Freyther1-1/+0
This is an incompatible database schema change. Store the type of the address in the database for both the sender and the receiver. Currently it is possible to use SMPP to store a SMS and the NPI and TON will be lost on the delivery of the SMS. The schema is changed to make the delivery always use the right NPI/TON. This patch is not ready for the master branch as there is no upgrade path for the HLR yet.
2014-04-29openbsc/gsm_data_shared.h: Added the attribute reduce_power in TRXÁlvaro Neira Ayuso1-0/+1
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-04-04gprs: Fix compiler warnings in sgsn_main.cHolger Hans Peter Freyther1-0/+4
sgsn_main.c: In function ‘main’: sgsn_main.c:345:2: warning: implicit declaration of function ‘gprs_sndcp_vty_init’ [-Wimplicit-function-declaration] gprs_sndcp_vty_init(); ^ sgsn_main.c:354:2: warning: implicit declaration of function ‘sgsn_gtp_init’ [-Wimplicit-function-declaration] rc = sgsn_gtp_init(&sgsn_inst); ^
2014-04-04gprs: Reduce the number of compiler warnings in gprs_gmm.cHolger Hans Peter Freyther1-0/+6
CC gprs_gmm.o gprs_gmm.c: In function ‘gsm48_tx_gmm_att_ack’: gprs_gmm.c:350:11: warning: unused variable ‘ptsig’ [-Wunused-variable] uint8_t *ptsig, *mid; ^ gprs_gmm.c: In function ‘gsm48_rx_gmm_auth_ciph_resp’: gprs_gmm.c:524:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable] int rc; ^ gprs_gmm.c: In function ‘gsm48_rx_gmm_att_req’: gprs_gmm.c:703:9: warning: implicit declaration of function ‘sgsn_acl_lookup’ [-Wimplicit-function-declaration] !sgsn_acl_lookup(mi_string))) { ^ gprs_gmm.c:632:40: warning: variable ‘old_ra_info’ set but not used [-Wunused-but-set-variable] uint8_t *cur = gh->data, *msnc, *mi, *old_ra_info, *ms_ra_acc_cap; ^ gprs_gmm.c: In function ‘gsm48_rx_gmm_ra_upd_req’: gprs_gmm.c:915:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable] int rc; ^ gprs_gmm.c:910:11: warning: variable ‘ms_ra_acc_cap’ set but not used [-Wunused-but-set-variable] uint8_t *ms_ra_acc_cap; ^ gprs_gmm.c: At top level: gprs_gmm.c:458:12: warning: ‘gsm48_tx_gmm_auth_ciph_req’ defined but not used [-Wunused-function] static int gsm48_tx_gmm_auth_ciph_req(struct sgsn_mm_ctx *mm, uint8_t *rand, ^ gprs_gmm.c:501:12: warning: ‘gsm48_tx_gmm_auth_ciph_rej’ defined but not used [-Wunused-function] static int gsm48_tx_gmm_auth_ciph_rej(struct sgsn_mm_ctx *mm) ^ gprs_gmm.c:1169:13: warning: ‘msgb_put_pdp_addr_ipv4’ defined but not used [-Wunused-function] static void msgb_put_pdp_addr_ipv4(struct msgb *msg, uint32_t ipaddr) ^ gprs_gmm.c:1180:13: warning: ‘msgb_put_pdp_addr_ppp’ defined but not used [-Wunused-function] static void msgb_put_pdp_addr_ppp(struct msgb *msg)
2014-04-01ipa: Use enhanced ipa_msg_recv_buffered() to cope with partioned IPA messagesJacob Erlbeck3-0/+10
The old ipa_msg_recv() implementation didn't support partial receive, so IPA connections got disconnected when this happened. This patch adds the handling of the temporary message buffers and uses ipa_msg_recv_buffered(). It has been successfully tested by jerlbeck with osmo-nitb and osmo-bsc. Ticket: OW#768 Sponsored-by: On-Waves ehf
2014-03-26ctrl/abis: When the max_power_reduction changes, send it to the BTSHolger Hans Peter Freyther1-0/+3
In case the max_power_reduction changes, issue a new Set Radio Carrier Attributes command. OML 12.21 allows to not include the ARFCN list and the semantic I picked/understand is that a partial update is possible. Fixes: SYS#267
2014-03-23sgsn/ctrl: Add ctrl interface, implement listing subscribersHolger Hans Peter Freyther1-0/+10
Add the control interface with no hierachy right now and implement the first command to list IMSI + Context Address of active sessions. sgsn_cmd_handle could share more code with bsc variant. Fixes: SYS#264, SYS#265
2014-03-23ctrl: Move the lookup into a separate file in preparation for GPRSHolger Hans Peter Freyther2-3/+10
For GPRS the look-up via bts/trx does not make any sense and would introduce bad depdencies for the SGSN. Move the look-up code to a new file and introduce new setup methods.
2014-03-23nitb/ctrl: Implement a command to list all active subscribersHolger Hans Peter Freyther1-0/+1
This is only useful for small networks. List the IMSI and MSISDN of all active subscribers. Fixes: SYS#266
2014-03-23nitb/ctrl: Implement creating and deleting subscribersHolger Hans Peter Freyther1-0/+1
Sadly there is no proper foreign key relationship on the tables that related to the Subscriber. This means we can't use a DELETE with Cascade and need to delete everything by hand. To make things worse maybe the SMS/Paging code is still using the subscriber making the operation more dangerous. I had added NULL checks for sender_id/receiver_id at 30C3 so we should not crash in this situation. Fixes: SYS#274
2014-03-23nitb/ctrl: Add command to add/modify a subscriber to the databaseHolger Hans Peter Freyther1-0/+1
The test has been manually verified. Executing the select for the subscribers showed: sqlite> select * from Subscriber; 1|2014-03-23 12:12:46|2014-03-23 12:19:09|2620345||445567|1||0| This created a subscriber with the right IMSI, MSISDN and has it authorized. Fixes: SYS#275
2014-03-20mncc: Use helper function to check if an MNCC frame is data (speech/traffic)Andreas Eversberg1-0/+8
Rename method mncc_rcv_tchf() to mncc_rcv_data(), because the check applies to all types of data frames, not only TCH/F data.
2014-03-20mncc: Complete definitions for all speech traffic frames at MNCC interfaceAndreas Eversberg1-2/+4
The new definitions are: half rate and AMR Change of definition name for bad frame, because it applies to all types of traffic, not only TCH/F. Increase MNCC interface version to 4. Version 3 is skipped, because it was used by older version of Linux-Call-Router which is incompatible with the current version of the MNCC interface.
2014-03-09db,sms: Rename db_sms_mark_sent() to db_sms_mark_delivered()Alexander Chemeris1-1/+1
In MT-SMS the message is being delivered. Make the naming follow that. The schema still refers to "sent" while it should be "delivered" too.
2014-03-04libbsc: Add ctrl command for MNC, MCC, short-name and long-nameHolger Hans Peter Freyther1-0/+3
Add the framework for adding more setting commands.
2014-02-22bsc: Add vty command to send location trap through VTYHolger Hans Peter Freyther1-0/+2
I have manually tested this by entering the VTY command and observing the CTRL interface using wireshark. Ticket: OW#1129
2014-02-20sms: Increment the RP Message Reference for each transactionHolger Hans Peter Freyther2-0/+4
Each RP-DATA should have a unique msg reference. Currently 42 is used for all of these. Remember the last reference we used and increment it on the next SMS. Do not track if the reference is still in use a clash is a lot less likely now. First unless SMPP is used only one SMS is delivered at a time, second the transaction space is a lot smaller than the one for the reference.
2014-02-20trau: Fix compiler warning about decoded_trau_frameHolger Hans Peter Freyther1-0/+2
In file included from bsc_api.c:34:0: ../../include/openbsc/trau_mux.h:62:15: warning: ‘struct decoded_trau_frame’ declared inside parameter list [enabled by default] const struct decoded_trau_frame *tf); ^ ../../include/openbsc/trau_mux.h:62:15: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] ../../include/openbsc/trau_mux.h:64:15: warning: ‘struct decoded_trau_frame’ declared inside parameter list [enabled by default] const struct decoded_trau_frame *tf); ^ ../../include/openbsc/trau_mux.h:66:2: warning: ‘struct decoded_trau_frame’ declared inside parameter list [enabled by default] const unsigned char *data); ^ ../../include/openbsc/trau_mux.h:68:2: warning: ‘struct decoded_trau_frame’ declared inside parameter list [enabled by default] const unsigned char *data);
2014-02-04ctrl: Make it possible to re-use the string get and set routineHolger Hans Peter Freyther1-3/+7
This can be used for the description field that requires some special handling for newlines.
2014-02-04ctrl: Make the int range set, get and verify methods availableHolger Hans Peter Freyther1-4/+12
For the max power reduction we will need to have a different range method. It will need to check if the value is even. Make the set, get and verify methods available through a macro.
2014-01-31mgcp/rtp: Compute delta timestamp based on wallclockJacob Erlbeck1-0/+1
Currently, when the SSRC changes within a stream and SSRC fixing is enabled, the RTP timestamp between the last packet that has been received with the old SSRC and the first packet of the new SSRC is always incremented by one packet duration. This can lead to audio muting (at least with the nanoBTS) when the wallclock interval between these packets is too large (> 1s). This patch changes the implementation to base the RTP timestamp offset on the wallclock interval that has passed between these two packets. Ticket: OW#466 Sponsored-by: On-Waves ehf
2014-01-27Add function to update TRAU muxer after assignment or handoverAndreas Eversberg2-0/+17
E1 based BTS use TRAU muxer to decode TRAU frames. After changing channel from one timeslot to another (due to handover or assignment), the TRAU muxer must be updated. The call reference of the call is disconnected from the old channel and connected to the new channel.
2014-01-26Use 'defines' for length and duration of RTP payloadAndreas Eversberg1-0/+4
2014-01-20nat: Introduce reject cause to bsc_nat_acc_lst_entryHolger Hans Peter Freyther1-0/+4
The filtering architecture already allowed to specify a reject reason but this has not been used for the access-lists. Extend the access-list to include a reject reason and extend the test case to honor it.
2014-01-20mgcp: Synchronize conn mode bits and output enabled flagsJacob Erlbeck1-1/+1
This patch changes implementation and the mgcp_connection_mode enum in a way that net_end.output_enabled (bts_end.output_enabled) flag always matches the MGCP_CONN_SEND_ONLY (MGCP_CONN_RECV_ONLY) bit of conn_mode. Based on this, the conn_mode bits are then used instead of the output_enabled fields within mgcp_protocol.c. Sponsored-by: On-Waves ehf
2014-01-19TSC: Add new gsm_ts_tsc() function to resolve TSC of TSHarald Welte1-0/+7
We don't want every caller to check for ts->tsc == -1 and then using ts->trx->bts->tsc instead. Rather, introduce a new inline function to retrieve the correct value.
2014-01-19Do not expect all BTSs support TSC != BCCHarald Welte1-0/+1
We introduce a new feature indicating if the given BTS model supports a TSC that is different from the BCC (lower 3 bits of BSIC).
2014-01-16mgcp: Send RTP keepalive dummy packets to netJacob Erlbeck1-0/+9
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-16mgcp/rtp: Add flag to disable RTP outputJacob Erlbeck1-0/+2
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-16si: Fix range1024 encodingJacob Erlbeck1-1/+1
f0 is currently set to arfcns[0] in range_enc_determine_range(), while GSM 04.08 requires f0 to be ARFCN 0 in range1024 encoding. This patch modifies range_enc_determine_range() to force f0 to be 0 if this encoding is used. This way the case distinction in range_enc_filter_arfcns() is not longer necessary. Sponsored-by: On-Waves ehf
2014-01-16si: Add a config option to disable SI2ter/SI2bis/SI5ter/SI5bis messagesJacob Erlbeck1-0/+3
The iPhone5 (US) appears to have some issues with the SIs generated, or the nanoBTS is not sending them correctly. Add a configurable hack to put all bands into the SI2/SI5 message. It is enabled by the bts VTY command 'force-combined-si'. This is a quick change without much reflection and watching for side effects. I have verfied that a network with ARFCN 134 and neighbors ARFCN 130 and 512 do not get generate the SI2ter and announce everything inside the SI2. This patch is conceptually based on 'si: Add a hack to disable SI2ter/SI2bis/SI5ter/SI5bis messages' (692daaf2d2). Ticket: OW#1062 Sponsored-by: On-Waves ehf