summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2017-11-27Merge "CLI: Remove calls to ast_cli_generator." into 15George Joseph
2017-11-23Merge "Loader: Remove unneeded load_pri declarations." into 15Joshua Colp
2017-11-21CLI: Remove calls to ast_cli_generator.Corey Farrell
The ability to add to localized storage cannot be supported by ast_cli_generator. The only calls to ast_cli_generator should be by functions that need to proxy the CLI generator, for example 'cli check permissions' or 'core show help'. * ast_cli_generatornummatches now retrieves the vector of matches and reports the number of elements (not including 'best' match). * test_substitution retrieves and iterates the vector. Change-Id: I8cd6b93905363cf7a33a2d2b0e2a8f8446d9f248
2017-11-21Merge "menuselect: Remove ineffective weak attribute detection." into 15Joshua Colp
2017-11-20Loader: Remove unneeded load_pri declarations.Corey Farrell
Instead of specifying AST_MODFLAG_LOAD_ORDER with load_pri AST_MODPRI_DEFAULT just use AST_MODFLAG_DEFAULT. Change-Id: I0123258eafce324249433a69df15a85cc16e509f
2017-11-18tests: Fix warnings found on Mac.Corey Farrell
test_pbx used raise without explicitly including signal.h. On Mac for some reason nothing else includes it. test_logger checked if an unsigned int was negative. Switch the variable to 'int' so that error check can be effective. Change-Id: Ie1db5dd1818ac25cc2ae41b644f848b5865b1362
2017-11-17menuselect: Remove ineffective weak attribute detection.Corey Farrell
menuselect detects compiler support for multiple styles of weak functions. This is a remnant from 2013 when OPTIONAL_API required weak functions. It is no longer correct for menuselect to switch dependencies from optional to required based on lack of weak function support. Note an issue remains - dependencies should switch from optional to required based on OPTIONAL_API being enabled or disabled. I don't think this is possible. menuselect needs to know at startup if OPTIONAL_API is enabled or disabled, so the only way to fix this is to remove OPTIONAL_API from menuselect and create a configure option. I've left the code that switches in place but it's preprocessed out. Additionally removed: - WEAKREF variable from Asterisk makeopts.in. - Related disabled code from test_utils. - Pointless AC_REVISION call from menuselect/configure.ac. Change-Id: Ifa702e5f98eb45f338b2f131a93354632a8fb389
2017-11-06test_sorcery_memory_cache_thrash: Handle error from vector append.Corey Farrell
Cleanup resources when we fail to append the vector and report test failure. Change-Id: I6eb41586fd11dee8c0dfe35e91cb465a4cab7298
2017-11-02Add missing menuselect dependencies.Corey Farrell
This adds menuselect dependencies for modules that use symbols of other modules. ASTERISK-27390 Change-Id: Ia2d2849f5b87a72af7324a82edc3f283eafb5385
2017-10-23test_config: Fix failure and segfault when config_hook is run twice.Corey Farrell
On second run the config_hook test was unexpectedly failing to load test_config.conf because it was still unmodified since the last load. This is fixed by not passing CONFIG_FLAG_FILEUNCHANGED for the initial loads, only using it when we are tested that a reload of unmodified files do not initiate the hook. ASTERISK-25960 Change-Id: Ifd679509a23ed163e5cc647490bf7df4ae3cd856
2017-10-06vector: multiple evaluation of elem in AST_VECTOR_ADD_SORTED.Corey Farrell
Use temporary variable to prevent multiple evaluations of elem argument. This resolves a memory leak in res_pjproject startup. ASTERISK-27317 #close Change-Id: Ib960d7f5576f9e1a3c478ecb48995582a574e06d
2017-08-22channel: Fix topology API locking.Richard Mudgett
* ast_channel_request_stream_topology_change() must not be called with any channel locks held. * ast_channel_stream_topology_changed() must be called with only the passed channel lock held. ASTERISK-27212 Change-Id: I843de7956d9f1cc7cc02025aea3463d8fe19c691
2017-08-16manager: hook event is not being raisedKevin Harwell
When the iostream code went in it introduced a conditional that made it so the hook event was not being raised even if a hook is present. This patch adds a check to see if a hook is present in astman_append. If so then call into the send_string function, which in turn raises the even for specified hook. Also updated the ami hooks unit test, so the test could be automated. ASTERISK-27200 #close Change-Id: Iff37f02f9708195d8f23e68f959d6eab720e1e36
2017-08-03Correct some leaks in unit tests.Corey Farrell
* chan_sip: channel in test_sip_rtpqos_1. * test_config: config hook, config info and global config holder. * test_core_format: format in format_attribute_set_without_interface. * test_stream: unneeded frame duplication. * test_taskprocessor: task_data. Change-Id: I94d364d195cf3b3b5de2bf3ad565343275c7ad31
2017-07-13core: Add PARSE_TIMELEN support to ast_parse_arg and ACO.Corey Farrell
This adds support for parsing timelen values from config files. This includes support for all flags which apply to PARSE_INT32. Support for this parser is added to ACO via the OPT_TIMELEN_T option type. Fixes an issue where extra characters provided to ast_app_parse_timelen were ignored, they now cause an error. Testing is included. ASTERISK-27117 #close Change-Id: I6b333feca7e3f83b4ef5bf2636fc0fd613742554
2017-06-16Merge changes from topic 'sdp_api_adjustments'Jenkins2
* changes: SDP: Set the remote c= line in RTP instance. SDP: Add t= line in sdp_create_from_state() stream: Ignore declined streams for some topology calls.
2017-06-16Merge "stream: Add ast_stream_topology_del_stream() and unit test."Jenkins2
2017-06-15stream: Add ast_stream_topology_del_stream() and unit test.Richard Mudgett
Change-Id: If07e3c716a2e3ff85ae905c17572ea6ec3cdc1f9
2017-06-15stream: Ignore declined streams for some topology calls.Richard Mudgett
* Made ast_format_cap_from_stream_topology() not include any formats from declined streams. * Made ast_stream_topology_get_first_stream_by_type() ignore declined streams to return the first active stream of the type. * Updated unit tests to check these changes have the expected effect. Change-Id: Iabbc6a3e8edf263a25fd3056c3c614407c7897df
2017-06-13bridge: Add a deferred queue.Joshua Colp
This change adds a deferred queue to bridging. If a bridge technology determines that a frame can not be written and should be deferred it can indicate back to bridging to do so. Bridging will then requeue any deferred frames upon a new channel joining the bridge. This change has been leveraged for T.38 request negotiate control frames. Without the deferred queue there is a race condition between the bridge receiving the T.38 request negotiate and the second channel joining and being in the bridge. If the channel is not yet in the bridge then the T.38 negotiation fails. A unit test has also been added that confirms that a T.38 request negotiate control frame is deferred when no other channel is in the bridge and that it is requeued when a new channel joins the bridge. ASTERISK-26923 Change-Id: Ie05b08523f399eae579130f4a5f562a344d2e415
2017-05-30test_json: Fix test names with reserved wordsGeorge Joseph
Some of the test names were actually reserved words (true, false, int, null, string, bool). When the jenkins test results analyzer does its thing it tries to create a map using the test names as keys and fails because they're reserved words. Added "type_" to those test names. Change-Id: I90d809f46969c78a1c605b736ff0635196a2cf1b
2017-05-24unittests: Add a unit test that causes a SEGV and...George Joseph
...that can only be run by explicitly calling it with 'test execute category /DO_NOT_RUN/ name RAISE_SEGV' This allows us to more easily test CI and debugging tools that should do certain things when asterisk coredumps. To allow this a new member was added to the ast_test_info structure named 'explicit_only'. If set by a test, the test will be skipped during a 'test execute all' or 'test execute category ...'. Change-Id: Ia3a11856aae4887df9a02b6b081cc777b36eb6ed
2017-05-17core/conversions: Added string to unsigned integer and long conversionsKevin Harwell
Added functions that convert a string to an unsigned integer or unsigned long. A couple of unit test were also created to test the routines. The reasons for adding these conversion utilities (and hopefully eventually more) are as follows: * Conversion routines are functionally contained with consistent and better error checking * The function names offer a better description of what is happening * It encourages code reuse for easier bug fixing at a single source * It's simpler to use * It's unit testable For instance, currently in a lot of places when converting to an integer or similar the "sscanf" function is used. When using "sscanf" it may not be immediately clear what's happening as it lacks semantic naming. Limited error checking is usually done as well. For example, most of the time a check is done to make sure the value converted, but does not check for overflows or negative valued conversions when converting unsigned numbers. Why use/wrap "strtoul" and not "sscanf" then? Primarily, it lacks some of the built in error handling that "strtoul" has. For instance "strtoul" contains overflow checks. Less so, but can still factor as reasons, "sscanf" is slightly more complex in its use. And maybe a bit controversial, but it may be ("big if") potentially slower than "strtoul" in some cases. Change-Id: If7eaca4a48f8c7b89cc8b5a1f4bed2852fca82bb
2017-05-12Merge changes from topic 'sdp_api_adjustments'George Joseph
* changes: SDP: Make process possible multiple fmtp attributes per rtpmap. SDP: Explicitly stop a RTP instance before destoying it. SDP: Rework merge_capabilities(). SDP: Update ast_get_topology_from_sdp() to keep RTP map.
2017-05-09SDP: Make process possible multiple fmtp attributes per rtpmap.Richard Mudgett
Change-Id: Ie7511008d82b59590e0eb520a21b5e1da4bd7349
2017-05-09SDP: Explicitly stop a RTP instance before destoying it.Richard Mudgett
* Made sdp_add_m_from_rtp_stream() and sdp_add_m_from_udptl_stream() handle generating disabled/declined streams. * Added /main/sdp/sdp_merge_asymmetric unit test. It currently does not check the offerer side negotiated SDP because that isn't the purpose of this patch and there is much to be done to handle declined/dummy streams. * Added T.38 image streams to the /main/sdp/sdp_merge_symmetric and /main/sdp/sdp_merge_crisscross unit tests. Change-Id: Ib4dcb3ca4f9a9133b376f4e3302f9a1f963f2b31
2017-05-09SDP: Update ast_get_topology_from_sdp() to keep RTP map.Richard Mudgett
* Add failure exits to ast_get_topology_from_sdp(). Change-Id: I4cc85c1ede8d712766ed20f544dbcef04c8c1049
2017-05-08logger: Added logger_queue_limit to the configuration options.George Joseph
All log messages go to a queue serviced by a single thread which does all the IO. This setting controls how big that queue can get (and therefore how much memory is allocated) before new messages are discarded. The default is 1000. Should something go bezerk and log tons of messages in a tight loop, this will prevent memory escalation. When the limit is reached, a WARNING is logged to that effect and messages are discarded until the queue is empty again. At that time another WARNING will be logged with the count of discarded messages. There's no "low water mark" for this queue because the logger thread empties the entire queue and processes it in 1 batch before going back and waiting on the queue again. Implementing a low water mark would mean additional locking as the thread processes each message and it's not worth it. A "test" was added to test_logger.c but since the outcome is non-deterministic, it's really just a cli command, not a unit test. Change-Id: Ib4520c95e1ca5325dbf584c7989ce391649836d1
2017-05-03bridge_simple: Added support for streamsKevin Harwell
This patch is the first cut at adding stream support to the bridging framework. Changes were made to the framework that allows mapping of stream topologies to a bridge's supported media types. The first channel to enter a bridge initially defines the media types for a bridge (i.e. a one to one mapping is created between the bridge and the first channel). Subsequently added channels merge their media types into the bridge's adding to it when necessary. This allows channels with different sized topologies to map correctly to each other according to media type. The bridge drops any frame that does not have a matching index into a given write stream. For now though, bridge_simple will align its two channels according to size or first to join. Once both channels join the bridge the one with the most streams will indicate to the other channel to update its streams to be the same as that of the other. If both channels have the same number of streams then the first channel to join is chosen as the stream base. A topology change source was also added to a channel when a stream toplogy change request is made. This allows subsystems to know whether or not they initiated a change request. Thus avoiding potential recursive situations. ASTERISK-26966 #close Change-Id: I1eb5987921dd80c3cdcf52accc136393ca2d4163
2017-05-01Merge "SDP API: Add SSRC-level attributes"Jenkins2
2017-04-27Merge "channel: Add ability to request an outgoing channel with stream ↵Jenkins2
topology."
2017-04-27Merge "vector: defaults and indexes"Jenkins2
2017-04-27SDP API: Add SSRC-level attributesMark Michelson
RFC 5576 defines how SSRC-level attributes may be added to SDP media descriptions. In general, this is useful for grouping related SSRCes, indicating SSRC-level format attributes, and resolving collisions in RTP SSRC values. These attributes are used widely by browsers during WebRTC communications, including attributes defined by documents outside of RFC 5576. This commit introduces the addition of SSRC-level attributes into SDPs generated by Asterisk. Since Asterisk does not tend to use multiple SSRCs on a media stream, the initial support is minimal. Asterisk includes an SSRC-level CNAME attribute if configured to do so. This at least gives browsers (and possibly others) the ability to resolve SSRC collisions at offer-answer time. In order to facilitate this, the RTP engine API has been enhanced to be able to retrieve the SSRC and CNAME on a given RTP instance. res_rtp_asterisk currently does not provide meaningful CNAME values in its RTCP SDES items, and therefore it currently will always return an empty string as the CNAME value. A task in the near future will result in res_rtp_asterisk generating more meaningful CNAMEs. Change-Id: I29e7f23e7db77524f82a3b6e8531b1195ff57789
2017-04-27channel: Add ability to request an outgoing channel with stream topology.Joshua Colp
This change extends the ast_request functionality by adding another function and callback to create an outgoing channel with a requested stream topology. Fallback is provided by either converting the requested stream topology into a format capabilities structure if the channel driver does not support streams or by converting the requested format capabilities into a stream topology if the channel driver does support streams. The Dial application has also been updated to request an outgoing channel with the stream topology of the calling channel. ASTERISK-26959 Change-Id: Ifa9037a672ac21d42dd7125aa09816dc879a70e6
2017-04-26vector: defaults and indexesKevin Harwell
Added an pre-defined integer vector declaration. This makes integer vectors easier to declare and pass around. Also, added the ability to default a vector up to a given size with a default value. Lastly, added functionality that returns the "nth" index of a matching value. Also, updated a unit test to test these changes. Change-Id: Iaf4b51b2540eda57cb43f67aa59cf1d96cdbcaa5
2017-04-25sdp: Add support for T.38Joshua Colp
This change adds a T.38 format which can be used in a stream topology to specify that a UDPTL stream needs to be created. The SDP API has been changed to understand T.38 and create the UDPTL session, add the attributes, and parse the attributes. This change does not change the boundary of the T.38 state machine. It is still up to the channel driver to implement and act on it (such as queueing control frames or reacting to them). ASTERISK-26949 Change-Id: If28956762ccb8ead562ac6c03d162d3d6014f2c7
2017-04-25SDP: Ensure SDPs "merge" properly.Mark Michelson
The gist of this work ensures that when a remote SDP is received, it is merged properly with the local capabilities. The remote SDP is converted into a stream topology. That topology is then merged with the current local topology on the SDP state. That new merged topology is then used to create an SDP. Finally, adjustments are made to RTP instances based on knowledge gained from the remote SDP. There are also a battery of tests in this commit that ensure that some basic SDP merges work as expected. While this may not sound like a big change, it has the property that it caused lots of ancillary changes. * The remote SDP is no longer stored on the SDP state. Biggest reason: there's no need for it. The remote SDP is used at the time it is being set and nowhere else. * Some new SDP APIs were added in order to find attributes and convert generic SDP attributes into rtpmap structures. * Writing tests made me realize that retrieving a value from an SDP options structure, the SDP options needs to be made const. * The SDP state machine was essentially gutted by a previous commit. Initially, I attempted to reinstate it, but I found that as it had been defined, it was not all that useful. What was more useful was knowing the role we play in SDP negotiation, so the SDP state machine has been transformed into an indicator of role. * Rather than storing separate local and joint stream state capabilities, it makes more sense to keep track of current stream state and update it as things change. Change-Id: I5938c2be3c6f0a003aa88a39a59e0880f8b2df3d
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINES (14)George Joseph
Change-Id: If99e3b4fc2d7e86fc3e61182aa6c835b407ed49e
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-03-27channel: Remove old epoll support and fixed max number of file descriptors.Joshua Colp
This change removes the old epoll support which has not been used or maintained in quite some time. The fixed number of file descriptors on a channel has also been removed. File descriptors are now contained in a growable vector. This can be used like before by specifying a specific position to store a file descriptor at or using a new API call, ast_channel_fd_add, which adds a file descriptor to the channel and returns its position. Tests have been added which cover the growing behavior of the vector and the new API call. ASTERISK-26885 Change-Id: I1a754b506c009b83dfdeeb08c2d2815db30ef928
2017-03-07core: Add stream topology changing primitives with tests.Joshua Colp
This change adds a few things to facilitate stream topology changing: 1. Control frame types have been added for use by the channel driver to notify the application that the channel wants to change the stream topology or that a stream topology change has been accepted. They are also used by the indicate interface to the channel that the application uses to indicate it wants to do the same. 2. Legacy behavior has been adopted in ast_read() such that if a channel requests a stream topology change it is denied automatically and the current stream topology is preserved if the application is not capable of handling streams. Tests have also been written which confirm the multistream and non-multistream behavior. ASTERISK-26839 Change-Id: Ia68ef22bca8e8457265ca4f0f9de600cbcc10bc9
2017-03-01stream: Unit tests for stream read and tweaks frameworkGeorge Joseph
* Removed the AST_CHAN_TP_MULTISTREAM tech property. We now rely on read_stream being set to indicate a multi stream channel. * Added ast_channel_is_multistream convenience function. * Fixed issue where stream and default_stream weren't being set on a frame retrieved from the queue. * Now testing for NULL being returned from the driver's read or read_stream callback. * Fixed issue where the dropnondefault code was crashing on a NULL f. * Now enforcing that if either read_stream or write_stream are set when ast_channel_tech_set is called that BOTH are set. * Added the unit tests. ASTERISK-26816 Change-Id: If7792b20d782e71e823dabd3124572cf0a4caab2
2017-02-23channel: Add support for writing to a specific stream.Joshua Colp
This change adds an ast_write_stream function which allows writing a frame to a specific media stream. It also moves ast_write() to using this underneath by writing media frames provided to it to the default streams of the channel. Existing functionality (such as audiohooks, framehooks, etc) are limited to being applied to the default stream only. Unit tests have also been added which test the behavior of both non-multistream and multistream channels to confirm that the write() and write_stream() callbacks are invoked appropriately. ASTERISK-26793 Change-Id: I4df20d1b65bd4d787fce0b4b478e19d2dfea245c
2017-02-16stream: Rename creates/destroys to allocs/freesGeorge Joseph
To be consistent with sdp implementation. Change-Id: I714e300939b4188f58ca66ce9d1e84b287009500
2017-02-15stream: Add unit tests for channel stream usage.Joshua Colp
This change adds unit tests cover the following: 1. That retrieving the first media stream of a specific media type from a stream topology retrieves the expected media stream. 2. That setting the native formats of a channel which does not support streams results in the creation of streams on its behalf according to the formats of the channel. 3. That setting a stream topology on a channel which supports streams sets the topology to the provided one. ASTERISK-26790 Change-Id: Ic53176dd3e4532e8c3e97d9e22f8a4b66a2bb755
2017-02-14stream: Add stream topology to channelGeorge Joseph
Adds topology set and get to channel. ASTERISK-26790 Change-Id: Ic379ea82a9486fc79dbd8c4d95c29fa3b46424f4
2017-02-13stream: Add stream topology unit tests and fix uncovered bugs.Joshua Colp
This change adds unit tests for the various API calls relating to stream topologies. This includes creation, destruction, inspection, and manipulation. Through this a few bugs were uncovered in the implementation: 1. Creating a topology using a format capabilities would fail as the code considered a return value of 0 from the append stream function to indicate an error which is incorrect. 2. Not all functions which placed a stream into a topology set the position on the stream itself. 3. Appending a stream would cause a frack if the position provided was the last one. This occurred because the existing stream was queried but the index was outside of what the vector was currently at for size. ASTERISK-26786 Change-Id: Id5590e87c8a605deea1a89e53169a9c011d66fa0
2017-02-10stream: Add media stream definition and API with unit tests.Joshua Colp
This change adds the media stream definition and API for accessing and using it. Unit tests have also been written which exercise aspects of the API. ASTERISK-26773 Change-Id: I3dbe54065b55aaa51f467e1a3bafd67fb48cac87
2017-01-27Merge "tests: use datadir for sound files"zuul
2017-01-26Merge "ari: Implement 'debug all' and request/response logging"George Joseph