summaryrefslogtreecommitdiff
path: root/main
AgeCommit message (Collapse)Author
2015-04-28res_rtp_asterisk: Resolve 2 discrete memory leaks in DTLSSteve Davies
ao2 ref leak in res_rtp_asterisk.c when a DTLS policy is created. The resources are linked into a table, but the original alloc refs are never released. ast_strdup leak in rtp_engine.c. If ast_rtp_dtls_cfg_copy() is called twice on the same destination struct, a pointer to an alloc'd string is overwritten before the string is free'd. ASTERISK-25022 Reported by: one47 Change-Id: I62a8ceb8679709f6c3769136dc6aa9a68202ff9b
2015-04-27Astobj2: Allow reference debugging to be enabled/disabled by config.Corey Farrell
* The REF_DEBUG compiler flag no longer has any effect on code that uses Astobj2. It is used to determine if reference debugging is enabled by default. Reference debugging can be enabled or disabled in asterisk.conf. * Caller information is provided in logger errors for ao2 bad magic numbers. * Optimizes AO2 by merging internal functions with the public counterpart. This was possible now that we no longer require a dual ABI. ASTERISK-24974 #close Reported by: Corey Farrell Change-Id: Icf3552721fe999365ba8a8cf00a965aa6b897cc1
2015-04-23Clang: change previous tautological-compare fixes.Diederik de Groot
clang can warn about a so called tautological-compare, when it finds comparisons which are logically always true, and are therefor deemed unnecessary. Exanple: unsigned int x = 4; if (x > 0) // x is always going to be bigger than 0 Enum Case: Each enumeration is its own type. Enums are an integer type but they do not have to be *signed*. C leaves it up to the compiler as an implementation option what to consider the integer type of a particu- lar enumeration is. Gcc treats an enum without negative values as an int while clang treats this enum as an unsigned int. rmudgett & mmichelson: cast the enum to (unsigned int) in assert. The cast does have an effect. For gcc, which seems to treat all enums as int, the cast to unsigned int will eliminate the possibility of negative values being allowed. For clang, which seems to treat enums without any negative members as unsigned int, the cast will have no effect. If for some reason in the future a negative value is ever added to the enum the assert will still catch the negative value. ASTERISK-24917 Change-Id: I0557ae0154a0b7de68883848a609309cdf0aee6a
2015-04-23Merge "Astobj2: Ensure all calls to __adjust_lock pass a valid object."Matt Jordan
2015-04-23Merge "New AMI Command Output Format"Matt Jordan
2015-04-22Astobj2: Ensure all calls to __adjust_lock pass a valid object.Corey Farrell
__adjust_lock doesn't check for invalid objects, and doesn't have an appropriate return value for invalid objects. Most callers of __adjust_lock pass objects that have already been confirmed valid, this change adds checks before the remaining calls. ASTERISK-24997 #close Reported by: Corey Farrell Change-Id: I669100f87937cc3f867cec56a27ae9c01292908f
2015-04-22dns: Make query sets hold on to queries for their lifetime.Joshua Colp
The query set documentation states that upon completion queries can be retrieved for the lifetime of the query set. This is a reasonable expectation but does not currently occur. This was originally done to resolve a circular reference between queries and query sets, but in practice the query can be kept. This change makes it so a query does not have a reference to the query set until it begins resolving. It also makes it so that the reference is given up upon the query being completed. This allows the queries to remain for the lifetime of the query set. As the query set on the query is only useful to the query set functionality and only for the lifetime that the query is resolving this is safe to do. ASTERISK-24994 #close Reported by: Joshua Colp Change-Id: I54e09c0cb45475896654e7835394524e816d1aa0
2015-04-21Check for ao2_alloc failure in __ast_channel_internal_alloc.Corey Farrell
Fix a crash that could occur in __ast_channel_internal_alloc if ao2_alloc fails. ASTERISK-24991 #close Change-Id: I4ca89189eb22f907408cb87d0a1645cfe1314a90
2015-04-20New AMI Command Output FormatGareth Palmer
This change modifies how the the output from a CLI command is sent to a client over AMI. Output from the CLI command is now sent as a series of zero-or-more Output: headers. Additionally, commands that fail to execute (eg: no such command, invalid syntax etc.) now cause an Error response instead of Success. If the command executed successfully, but the manager unable to provide the output the reason will be included in the Message: header. Otherwise it will contain 'Command output follows'. Depends on a new version of starpy (> 1.0.2) that supports the new output format. See pull-request https://github.com/asterisk/starpy/pull/34 ASTERISK-24730 Change-Id: I6718d95490f0a6b3f171c1a5cdad9207f9a44888
2015-04-19main/pbx: Don't attempt to destroy a previously destroyed exten/priority tupleMatt Jordan
When a PBX registrar is unloaded, it will fail to remove its extension from the context root_table if a dialplan application used by that extension is still loaded. This can be the case for AGI, which can be unloaded after several of the standard PBX providers. Often, this is harmless; however, if the extension's priorities are removed during the failed unloading *and* the dialplan application later unregisters, it leaves a ticking timebomb for the next PBX provider that attempts to iterate over the extensions. When that occurs, the peer_table pointer on the extension will already be set to NULL. The current code does not check to see if the pointer is NULL before passing it to a hashtab function this is not NULL tolerant. Since it is possible for the peer_table to be NULL when we normally would not expect that to be the case, the solution in this patch is to simply skip over processing an extension's priorities if peer_table is NULL. Prior to this patch, the tests/pbx/callerid_match test would crash during module unload. With this patch, the test no longer crashes after running. ASTERISK-24774 #close Reported by: Corey Farrell Change-Id: I2bbeecb7e0f77bac303a1b9135e4cdb4db6d4c40
2015-04-17Merge "Detect potential forwarding loops based on count."Matt Jordan
2015-04-17Detect potential forwarding loops based on count.Mark Michelson
A potential problem that can arise is the following: * Bob's phone is programmed to automatically forward to Carol. * Carol's phone is programmed to automatically forward to Bob. * Alice calls Bob. If left unchecked, this results in an endless loops of call forwards that would eventually result in some sort of fiery crash. Asterisk's method of solving this issue was to track which interfaces had been dialed. If a destination were dialed a second time, then the attempt to call that destination would fail since a loop was detected. The problem with this method is that call forwarding has evolved. Some SIP phones allow for a user to manually forward an incoming call to an ad-hoc destination. This can mean that: * There are legitimate use cases where a device may be dialed multiple times, or * There can be human error when forwarding calls. This change removes the old method of detecting forwarding loops in favor of keeping a count of the number of destinations a channel has dialed on a particular branch of a call. If the number exceeds the set number of max forwards, then the call fails. This approach has the following advantages over the old: * It is much simpler. * It can detect loops involving local channels. * It is user configurable. The only disadvantage it has is that in the case where there is a legitimate forwarding loop present, it takes longer to detect it. However, the forwarding loop is still properly detected and the call is cleaned up as it should be. Address review feedback on gerrit. * Correct "mfgium" to "Digium" * Decrement max forwards by one in the case where allocation of the max forwards datastore is required. * Remove irrelevant code change from pjsip_global_headers.c ASTERISK-24958 #close Change-Id: Ia7e4b7cd3bccfbd34d9a859838356931bba56c23
2015-04-17Merge topic 'ASTERISK-24863'Matt Jordan
* changes: res_pjsip: Add global option to limit the maximum time for initial qualifies pjsip_options: Add qualify_timeout processing and eventing res_pjsip: Refactor endpt_send_request to include transaction timeout
2015-04-16bridge.c: NULL app causes crash during attended transferKevin Harwell
Due to a race condition there was a chance that during an attended transfer the channel's application would return NULL. This, of course, would cause a crash when attempting to access the memory. This patch retrieves the channel's app at an earlier time in processing in hopes that the app name is available. However, if it is not then "unknown" is used instead. Since some string value is now always present the crash can no longer occur. ASTERISK-24869 #close Reported by: viniciusfontes Review: https://gerrit.asterisk.org/#/c/133/ Change-Id: I5134b84c4524906d8148817719d76ffb306488ac
2015-04-16pjsip_options: Add qualify_timeout processing and eventingGeorge Joseph
This is the second follow-on to https://reviewboard.asterisk.org/r/4572/ and the discussion at http://lists.digium.com/pipermail/asterisk-dev/2015-March/073921.html The basic issues are that changes in contact status don't cause events to be emitted for the associated endpoint. Only dynamic contact add/delete actions update the endpoint. Also, the qualify timeout is fixed by pjsip at 32 seconds which is a long time. This patch makes use of the new transaction timeout feature in r4585 and provides the following capabilities... 1. A new aor/contact variable 'qualify_timeout' has been added that allows the user to specify the maximum time in milliseconds to wait for a response to an OPTIONS message. The default is 3000ms. When the timer expires, the contact is marked unavailable. 2. Contact status changes are now propagated up to the endpoint as follows... When any contact is 'Available', the endpoint is marked as 'Reachable'. When all contacts are 'Unavailable', the endpoint is marked as 'Unreachable'. The existing endpoint events are generated appropriately. ASTERISK-24863 #close Change-Id: Id0ce0528e58014da1324856ea537e7765466044a Tested-by: Dmitriy Serov Tested-by: George Joseph <george.joseph@fairview5.com>
2015-04-15res_pjsip: Add external PJSIP resolver implementation using core DNS API.Joshua Colp
This change adds the following: 1. A query set implementation. This is an API that allows queries to be executed in parallel and once all have completed a callback is invoked. 2. Unit tests for the query set implementation. 3. An external PJSIP resolver which uses the DNS core API to do NAPTR, SRV, AAAA, and A lookups. For the resolver it will do NAPTR, SRV, and AAAA/A lookups in parallel. If NAPTR or SRV are available it will then do more queries. And so on. Preference is NAPTR > SRV > AAAA/A, with IPv6 preferred over IPv4. For transport it will prefer TLS > TCP > UDP if no explicit transport has been provided. Configured transports on the system are taken into account to eliminate resolved addresses which have no hope of completing. ASTERISK-24947 #close Reported by: Joshua Colp Change-Id: I56cb03ce4f9d3d600776f36928e0b3e379b5d71e
2015-04-14Merge "astobj2: Add support for weakproxy objects."Matt Jordan
2015-04-13AMI: Fix improper handling of lines that are exactly 1025 bytes long.Corey Farrell
When AMI receives a line that is 1025 bytes long, it sends two error messages. Copy the last byte in the buffer to the first postiion, set the length to 1. ASTERISK-20524 #close Reported by: David M. Lee Change-Id: Ifda403e2713b59582c715229814fd64a0733c5ea
2015-04-13astobj2: Add support for weakproxy objects.Corey Farrell
This implements "weak" references. The weakproxy object is a real ao2 with normal reference counting of its own. When a weakproxy is pointed to a normal object they hold references to each other. The normal object is automatically freed when a single reference remains (the weakproxy). The weakproxy also supports subscriptions that will notify callbacks when it does not point to any real object. ASTERISK-24936 #close Reported by: Corey Farrell Change-Id: Ib9f73c02262488d314d9d9d62f58165b9ec43c67
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-12main/editline: Add .gitignore.Corey Farrell
This patch adds a .gitignore for main/editline to ignore all build results. Change-Id: I68c7bf375ea46282689e5a706534b69fca233b5d
2015-04-11Add .gitignore and .gitreview filesGeorge Joseph
Add the .gitignore and .gitreview files to the asterisk repo. NB: You can add local ignores to the .git/info/exclude file without having to do a commit. Common ignore patterns are in the top-level .gitignore file. Subdirectory-specific ignore patterns are in their own .gitignore files. Change-Id: I842a1588ff27d8a0189f12d597f0a7af033d6c69 Tested-by: George Joseph
2015-04-10chan_pjsip/res_pjsip/bridge_softmix/core: Improve translation path choices.Richard Mudgett
With this patch, chan_pjsip/res_pjsip now sets the native formats to the codecs negotiated by a call. * The changes in chan_pjsip.c and res_pjsip_sdp_rtp.c set the native formats to include all the negotiated audio codecs instead of only the initial preferred audio codec and later the currently received audio codec. * The audio frame handling in channel.c:ast_read() is more streamlined and will automatically adjust to changes in received frame formats. The new policy is to remove translation and pass the new frame format to the receiver except if the translation was to a signed linear format. A more long winded version is commented in ast_read() along with some caveats. * The audio frame handling in channel.c:ast_write() is more streamlined and will automatically adjust any needed translation to changes in the frame formats sent. Frame formats sent can change for many reasons such as a recording is being played back or the bridged peer changed the format it sends. Since it is a normal expectation that sent formats can change, the codec mismatch warning message is demoted to a debug message. * Removed the short circuit check in channel.c:ast_channel_make_compatible_helper(). Two party bridges need to make channels compatible with each other. However, transfers and moving channels among bridges can result in otherwise compatible channels having sub-optimal translation paths if the make compatible check is short circuited. A result of forcing the reevaluation of channel compatibility is that the asterisk.conf:transcode_via_slin and codecs.conf:genericplc options take effect consistently now. It is unfortunate that these two options are enabled by default and negate some of the benefits to the changes in channel.c:ast_read() by forcing translation through signed linear on a two party bridge. * Improved the softmix bridge technology to better control the translation of frames to the bridge. All of the incoming translation is now normally handled by ast_read() instead of splitting any translation steps between ast_read() and the slin factory. If any frame comes in with an unexpected format then the translation path in ast_read() is updated for the next frame and the slin factory handles the current frame translation. This is the final patch in a series of patches aimed at improving translation path choices. The other patches are on the following reviews: https://reviewboard.asterisk.org/r/4600/ https://reviewboard.asterisk.org/r/4605/ ASTERISK-24841 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4609/ ........ Merged revisions 434671 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-10res_pjsip: Add an 'auto' option for DTMF ModeMatthew Jordan
This patch adds support for automatically detecting the type of DTMF that a PJSIP endpoint supports. When the 'dtmf_mode' endpoint option is set to 'auto', the channel created for an endpoint will attempt to determine if RFC 4733 DTMF is supported. If so, it will use that DTMF type. If not, the DTMF type for the channel will be set to inband. Review: https://reviewboard.asterisk.org/r/4438 ASTERISK-24706 #close Reported by: yaron nahum patches: yaron_patch_3_Feb.diff submitted by yaron nahum (License 6676) ........ Merged revisions 434637 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-10bridge_softmix.c,channel.c: Minor code simplification and cleanup.Richard Mudgett
* Made code easier to follow in bridge_softmix.c:analyse_softmix_stats() and made some debug messages more helpful. * Made some debug and warning messages more helpful in channel.c:set_format(). Review: https://reviewboard.asterisk.org/r/4607/ ........ Merged revisions 434617 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434618 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-10translate.c: Only select audio codecs to determine the best translation choice.Richard Mudgett
Given a source capability of h264 and ulaw, a destination capability of h264 and g722 then ast_translator_best_choice() would pick h264 as the best choice even though h264 is a video codec and Asterisk only supports translation of audio codecs. When the audio starts flowing, there are warnings about a codec mismatch when the channel tries to write a frame to the peer. * Made ast_translator_best_choice() only select audio codecs. * Restore a check in channel.c:set_format() lost after v1.8 to prevent trying to set a non-audio codec. This is an intermediate patch for a series of patches aimed at improving translation path choices for ASTERISK-24841. This patch is a complete enough fix for ASTERISK-21777 as the v11 version of ast_translator_best_choice() does the same thing. However, chan_sip.c still somehow tries to call ast_codec_choose() which then calls ast_best_codec() with a capability set that doesn't contain any audio formats for the incoming call. The remaining warning message seems to be a benign transient. ASTERISK-21777 #close Reported by: Nick Ruggles ASTERISK-24380 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4605/ ........ Merged revisions 434614 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 434615 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-10dns: Fix build when TEST_FRAMEWORK is not defined.Joshua Colp
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-09loader/main: Don't set ast_fully_booted until deferred reloads are processedGeorge Joseph
Until we have a true module management facility it's sometimes necessary for one module to force a reload on another before its own load is complete. If Asterisk isn't fully booted yet, these reloads are deferred. The problem is that asterisk reports fully booted before processing the deferred reloads which means Asterisk really isn't quite ready when it says it is. This patch moves the report of fully booted after the processing of the deferred reloads is complete. Since the pjsip stack has the most number of related modules, I ran the channels/pjsip testsuite to make sure there aren't any issues. All tests passed. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4604/ ........ Merged revisions 434544 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434546 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-09Reduce duplication of common DNS code.Mark Michelson
The NAPTR and SRV branches were worked on independently and resulted in some code being duplicated in each. Since both have been merged into trunk now, this patch reduces the duplication by factoring out common code into its own source files. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434490 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-09clang compiler warnings: Fix autological comparisonsMatthew Jordan
This fixes autological comparison warnings in the following: * chan_skinny: letohl may return a signed or unsigned value, depending on the macro chosen * func_curl: Provide a specific cast to CURLoption to prevent mismatch * cel: Fix enum comparisons where the enum can never be negative * enum: Fix comparison of return result of dn_expand, which returns a signed int value * event: Fix enum comparisons where the enum can never be negative * indications: tone_data.freq1 and freq2 are unsigned, and hence can never be negative * presencestate: Use the actual enum value for INVALID state * security_events: Fix enum comparisons where the enum can never be negative * udptl: Don't bother to check if the return value from encode_length is less than 0, as it returns an unsigned int * translate: Since the parameters are unsigned int, don't bother checking to see if they are negative. The cast to unsigned int would already blow past the matrix bounds. * res_pjsip_exten_state: Use a temporary value to cache the return of ast_hint_presence_state * res_stasis_playback: Fix enum comparisons where the enum can never be negative * res_stasis_recording: Add an enum value for the case where the recording operation is in error; fix enum comparisons * resource_bridges: Use enum value as opposed to -1 * resource_channels: Use enum value as opposed to -1 Review: https://reviewboard.asterisk.org/r/4533 ASTERISK-24917 Reported by: dkdegroot patches: rb4533.patch submitted by dkdegroot (License 6600) ........ Merged revisions 434469 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 434470 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434471 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-08Bridging: Eliminate the unnecessary make channel compatible with bridge ↵Richard Mudgett
operation. When a channel enters the bridging system it is first made compatible with the bridge and then the bridge technology makes the channel compatible with the technology. For all but the DAHDI native and softmix bridge technologies the make channel compatible with the bridge step is an effective noop because the other technologies allow all audio formats. For the DAHDI native bridge technology it doesn't matter because it is not an initial bridge technology and chan_dahdi allows only one native format per channel. For the softmix bridge technology, it is a noop at best and harmful at worst because the wrong translation path could be setup if the channel's native formats allow more than one audio format. This is an intermediate patch for a series of patches aimed at improving translation path choices. * Removed code dealing with the unnecessary step of making the channel compatible with the bridge. ASTERISK-24841 Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4600/ ........ Merged revisions 434424 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434430 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-08Security/tcptls: MitM Attack potential from certificate with NULL byte in CN.Jonathan Rose
When registering to a SIP server with TLS, Asterisk will accept CA signed certificates with a common name that was signed for a domain other than the one requested if it contains a null character in the common name portion of the cert. This patch fixes that by checking that the common name length matches the the length of the content we actually read from the common name segment. Some certificate authorities automatically sign CA requests when the requesting CN isn't already taken, so an attacker could potentially register a CN with something like www.google.com\x00www.secretlyevil.net and have their certificate signed and Asterisk would accept that certificate as though it had been for www.google.com - this is a security fix and is noted in AST-2015-003. ASTERISK-24847 #close Reported by: Maciej Szmigiero Patches: asterisk-null-in-cn.patch submitted by mhej (license 6085) ........ Merged revisions 434337 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 434338 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 434384 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434385 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-08format_cache.c: Add missing slin12 format to ast_format_cache_is_slinear().Richard Mudgett
........ Merged revisions 434357 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434383 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-07bridge.c: Hangup attended transfer target after it has been swapped outKevin Harwell
After completing an attended transfer the transfer target channel (the one that gets swapped out) was not being hung up after leaving the bridge. This resulted in a channel possibly being left around. Added an explicit softhangup for the channel in question after the transfer is successfully completed in order to make sure the channel is hung up. ASTERISK-24782 #close Reported by: John Bigelow Review: https://reviewboard.asterisk.org/r/4575/ ........ Merged revisions 434240 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-07ARI: Add the ability to intercept hold and raise an eventMatthew Jordan
For some applications - such as SLA - a phone pressing hold should not behave in the fashion that the Asterisk core would like it to. Instead, the hold action has some application specific behaviour associated with it - such as disconnecting the channel that initiated the hold; only playing MoH to channels in the bridge if the channels are of a particular type, etc. One way of accomplishing this is to use a framehook to intercept the hold/unhold frames, raise an event, and eat the frame. Tasty. This patch accomplishes that using a new dialplan function, HOLD_INTERCEPT. In addition, some general cleanup of raising hold/unhold Stasis messages was done, including removing some RAII_VAR usage. Review: https://reviewboard.asterisk.org/r/4549/ ASTERISK-24922 #close ........ Merged revisions 434216 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434217 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-06build: Fixes for gcc 5 compilationGeorge Joseph
These are fixes for compilation under gcc 5.0... chan_sip.c: In parse_request needed to make 'lim' unsigned. inline_api.h: Needed to add a check for '__GNUC_STDC_INLINE__' to detect C99 inline semantics (same as clang). ccss.c: In ast_cc_set_parm, needed to fix weird comparison. dsp.c: Needed to work around a possible compiler bug. It was throwing an array-bounds error but neither sgriepentrog, rmudgett nor I could figure out why. manager.c: In action_atxfer, needed to correct an array allocation. This patch will go to 11, 13, trunk. Review: https://reviewboard.asterisk.org/r/4581/ Reported-by: Jeffrey Ollie Tested-by: George Joseph ASTERISK-24932 #close ........ Merged revisions 434113 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 434114 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434115 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-06clang compiler warnings: Fix format specified in framehookMatthew Jordan
This patch fixes an invalid format specifier used in the formatting of an ERROR message in the framehook code. The format specifier specifies a type of 'unsigned short', but the argument passed to it is of type 'int'. The patch changes the format specifier to 'i'. Review: https://reviewboard.asterisk.org/r/4540 ASTERISK-24917 Reported by: dkdegroot patches: rb4535.patch submitted by dkdegroot (License 6600) ........ Merged revisions 434087 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 434088 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-06Merge NAPTR support into trunk.Mark Michelson
This adds NAPTR record allocation and sorting, as well as unit tests that verify that NAPTR records are parsed and sorted correctly. Review: https://reviewboard.asterisk.org/r/4542 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434068 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-06Ensure that a non-zero sample rate is returned for all formats.Mark Michelson
Versions of Asterisk prior to 12 defaulted to 8000 as a sample rate if one was not provided by a format. In Asterisk 13, this was removed. The result was that some calculations which involve dividing by the sample rate resulted in dividing by 0. The fix being put in place here is to have the same default fallback that was present in previous versions of Asterisk. Asterisk-24914 #close Reported by Marcello Ceschia ........ Merged revisions 434046 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434047 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-01dns: Add support for SRV record parsing and sorting.Joshua Colp
This change adds support for parsing SRV records and consuming their values in an easy fashion. It also adds automatic sorting of SRV records according to RFC 2782. Tests have also been included which cover parsing, sorting, and off-nominal cases where the record is corrupted. ASTERISK-24931 #close Reported by: Joshua Colp Review: https://reviewboard.asterisk.org/r/4528/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433889 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-30Fix an ABI compatibility issue with ast_log_safe for modules.Corey Farrell
Binary modules are sometimes built against the latest release of Asterisk in each branch, and need to be compatible with all releases of that branch. This change ensures that utils.h only uses ast_log_safe from the core. For modules and utilities ast_log is used instead. Review: https://reviewboard.asterisk.org/r/4548/ ........ Merged revisions 433772 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433773 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433774 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-30clang compiler warnings: Fix -Wabsolute-value warningsMatthew Jordan
This patch fixes several warnings caught by clang - in this case, usage of the abs function on non-integer values. This patch uses labs and fabs, as appropriate, in the various affected files. Review: https://reviewboard.asterisk.org/r/4525 ASTERISK-24917 Reported by: dkdegroot patches: rb4525.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433749 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433750 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-30clang compiler warnings: Fix invalid enum conversionMatthew Jordan
This patch fixes some invalid enum conversion warnings caught by clang. In particular: * chan_sip: Several functions mixed usage of the st_refresher_param enum and st_refresher enum. This patch corrects the functions to use the right enum. * chan_pjsip: Fixed mixed usage of ast_sip_session_t38state and ast_t38_state. * strings: Fixed incorrect usage of AO2 flags with strings container. * res_stasis: Change a return enumeration to stasis_app_user_event_res. Review: https://reviewboard.asterisk.org/r/4535 ASTERISK-24917 Reported by: dkdegroot patches: rb4535.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433746 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433747 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433748 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-30main/stdtime/localtime: Fix warning introduced in r433720Matthew Jordan
The patch in r433720 caused a warning to be kicked back by gcc. It occurred due to this check in unistd.h: if (__nbytes > __bos0 (__buf)) return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf)); That is, if __nbytes is greater than the result of GCC's built-in object size for the struct, we'll kick back a warning. As it turns out, this is because there is an error in the code in the patch. We are passing the address of the pointer to the struct, not iev, which is a pointer to the struct. Hence, the number of bytes is probably going to be lot larger than the number of bytes that make up a pointer! This patch changes the code just read from the pointer to the struct - which fixes the warning. ASTERISK-24917 ........ Merged revisions 433743 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433744 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433745 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-30clang compiler warnings: Fix warning for -Wgnu-variable-sized-type-not-at-endMatthew Jordan
This patch fixes a warning caught by clang, wherein a variable sized struct is not located at the end of a struct. While the code in question actually expected this, this is a good warning to watch for. Hence, this patch refactors the code in question to not have two variable length elements in the same struct. Review: https://reviewboard.asterisk.org/r/4530/ ASTERISK-24917 Reported by: dkdegroot patches: rb4530.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433717 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433718 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28clang compiler warnings: Fix a variety of "unused" warningsMatthew Jordan
This patch fixes the -Wunused-value -Wunused-variable -Wunused-const-variable errors caught by clang. Specifically: * apps/app_queue.c: removed unused qpm_cmd_usage[], qum_cmd_usage[], qsmp_cmd_usage[] * cel/cel_sqlite3_custom.c: removed unused name[] = "cel_sqlite3_custom" * channels/chan_pjsip.c: removed unused desc[] = "PJSIP Channel" * codecs/gsm/src/gsm_create.c: removed unused ident[] = "$Header$" * funcs/func_env.c:729: Fixed ast_str_append_substr. * main/editline/np/strlcat.c: removed unused rcsid variable * main/editline/np/strlcpy.c: removed unused rcsid variable * main/security_events.c: removed unused TIMESTAMP_STR_LEN * utils/conf2ael.c: removed unused cfextension_states * utils/extconf.c: removed unused cfextension_states Review: https://reviewboard.asterisk.org/r/4526 ASTERISK-24917 Reported by: dkdegroot patches: rb4526.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433693 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433694 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28clang compiler warnings: Fix -Wparantheses-equality warningsMatthew Jordan
Clang will treat ((a == b)) as a warning, as it reasonably expects that the developer may have intended to write (a == b) or ((a = b)). This patch cleans up all instances where equality, not assignment, was intended between two parantheses. Review: https://reviewboard.asterisk.org/r/4531/ ASTERISK-24917 Repoted by: dkdegroot patches: rb4531.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433687 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433688 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433689 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28clang compiler warnings: Fix -Wunused-function; make inline function staticMatthew Jordan
This patch fixes clang compilers warnings for unused functions. Specifically: * channels/chan_iax2: removed user_ref function * main/dsp.c: removed goertzel_update function * main/config.c: made variable_list_switch static Review: https://reviewboard.asterisk.org/r/4527 ASTERISK-24917 Reported by: dkdegroot patches: rb4527.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433678 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433680 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433681 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27Improved and portable ast_log recursion avoidanceCorey Farrell
This introduces a new logger routine ast_log_safe. This routine should be used for all error messages in code that can be run as a result of ast_log. ast_log_safe does nothing if run recursively. All error logging in astobj2.c, strings.c and utils.h have been switched to ast_log_safe. This required adding support for raw threadstorage. This provides direct access to the void* pointer in threadstorage. In ast_log_safe, NULL is used to signify that this thread is not already running ast_log_safe, (void*)1 when it is already running. This was done since it's critical that ast_log_safe do nothing that could log during recursion checking. ASTERISK-24155 #close Reported by: Timo Teräs Review: https://reviewboard.asterisk.org/r/4502/ ........ Merged revisions 433522 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433523 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26Fix compile errors caused by r4500 / r4501.Corey Farrell
* Add ast_register_cleanup to utils/clicompat.c to deal with any utils that copy sources from main. * Asterisk 13+: remove unused variables from core_local.c. Review: https://reviewboard.asterisk.org/r/4534/ ........ Merged revisions 433499 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433500 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433501 65c4cc65-6c06-0410-ace0-fbb531ad65f3