summaryrefslogtreecommitdiff
path: root/main
AgeCommit message (Collapse)Author
2016-01-05main/pbx: Move switch routines to pbx_switch.c.Corey Farrell
This is the fifth patch in a series meant to reduce the bulk of pbx.c. This moves ast_switch functions to their own source. Change-Id: Ic2592a18a5c4d8a3c2dcf9786c9a6f650a8c628e
2016-01-05main/pbx: Move timing routines to pbx_timing.c.Corey Farrell
This is the fourth patch in a series meant to reduce the bulk of pbx.c. This moves pbx timing functions to their own source. Change-Id: I05c45186cb11edfc901e95f6be4e6a8abf129cd6
2016-01-04voicemail: Move app_voicemail / res_mwi_external conflict to runtimeGeorge Joseph
The menuselect conflict between app_voicemail and res_mwi_external makes it hard to package 1 version of Asterisk. There no actual build dependencies between the 2 so moving this check to runtime seems like a better solution. The ast_vm_register and ast_vm_greeter_register functions in app.c were modified to return AST_MODULE_LOAD_DECLINE instead of -1 if there is already a voicemail module registered. The modules' load_module functions were then modified to return DECLINE instead of -1 to the loader. Since -1 is interpreted by the loader as AST_MODULE_LOAD_FAILURE, the modules were incorrectly causing Asterisk to stop so this needed to be cleaned up anyway. Now you can build both and use modules.conf to decide which voicemail implementation to load. The default menuselect options still build app_voicemail and not res_mwi_external but if both ARE built, res_mwi_external will load first and become the voicemail provider unless modules.conf rules prevent it. This is noted in CHANGES. Change-Id: I7d98d4e8a3b87b8df9e51c2608f0da6ddfb89247
2016-01-04main/pbx: Move variable routines to pbx_variables.c.Corey Farrell
This is the third patch in a series meant to reduce the bulk of pbx.c. This moves channel and global variable routines to their own source. Change-Id: Ibe8fb4647db11598591d443a99e3f99200a56bc6
2016-01-04Merge "main/cdr: Allow setting properties on a finalized CDR if it is the ↵Matt Jordan
last one" into 13
2016-01-04Merge "main/cdr: Set the end time on a CDR if endbeforehexten is Yes" into 13Matt Jordan
2016-01-02main/cdr: Allow setting properties on a finalized CDR if it is the last oneMatt Jordan
Prior to this patch, we explicitly disallowed setting any properties on a finalized CDR. This seemed like a good idea at the time; in practice, it was more restrictive. There are weird and strange scenarios where setting a property on a finalized CDR is definitely wrong. For example, we may Fork a CDR, finalizing the previous one, then change a property. In said case, the old CDR is supposed to now be 'immutable' (so to speak), and should not be updated. From the perspective of the code, a forked CDR that is finalized is just finalized. Hence why we decided these should not be updated. In practice, it is much more common to want to set a property on a CDR in the h extension or in a hangup handler. Disallowing a common scenario to make an esoteric behaviour work isn't good. This patch fixes this by allowing callers to set a property IF we are the last CDR in the chain. This preserves the finalized CDR if it was forked, while allowing the more common case to function. ASTERISK-25458 #close Change-Id: Icf3553c607b9f561152a41e6d8381d594ccdf4b9
2016-01-02main/cdr: Set the end time on a CDR if endbeforehexten is YesMatt Jordan
Prior to this patch, the CDR engine attempted to set the end time on a CDR that was executing hangup logic and with endbeforehexten set to Yes by calling a function that inspects the properties on the Party A snapshot to determine if we are ready to set the end time. That always failed. This is because a Party A snapshot is not updated for CDRs that are executing hangup logic with endbeforehexten=Yes. Instead of calling a function that looks at the Party A snapshot, we just simply set the end time on the CDR. This is safe to call multiple times, and is safe to call at this point as we know that (a) we are executing hangup logic, and (b) we are supposed to set the end time at this point. ASTERISK-25458 Change-Id: I0c27b493861f9c13c43addbbb21257f79047a3b3
2016-01-01main/pbx: Move custom function routines to pbx_functions.c.Corey Farrell
This is the second patch in a series meant to reduce the bulk of pbx.c. This moves custom function management routines to their own source. Change-Id: I34a6190282f781cdbbd3ce9d3adeac3c3805e177
2015-12-30main/pbx: Move pbx_builtin dialplan applications to pbx_builtins.cGeorge Joseph
We joked about splitting pbx.c into multiple files but this first step was fairly easy. All of the pbx_builtin dialplan applications have been moved into pbx_builtins.c and a new pbx_private.h file was added. load_pbx_builtins() is called by asterisk.c just after load_pbx(). A few functions were renamed and are cross-exposed between the 2 source files. Change-Id: I87066be3dbf7f5822942ac1449d98cc43fc7561a
2015-12-28Merge "test_time: Provide a timeout when waiting." into 13Joshua Colp
2015-12-28test_time: Provide a timeout when waiting.Joshua Colp
The test_timezone_watch unit test is written to expect a condition to be signaled when the inotify daemon thread runs. There exists a small window where the test_timezone_watch thread can signal the inotify daemon thread while it is not reading on the underlying file descriptor. If this occurs the test_timezone_watch thread will wait indefinitely for a signal that will never arrive. This change adds a timeout to the condition so it will return regardless after a period of time. Change-Id: Ifed981879df6de3d93acd3ee0a70f92546517390
2015-12-28endpoint/stasis: Eliminate duplicate events on endpoint status changeGeorge Joseph
When an endpoint is created, its messages are forwarded to both the tech endpoint topic and the all endpoints topic. This is done so that various parties interested in endpoint messages can subscribe to just the tech endpoint and receive all messages associated with that particular technology, as opposed to subscribing to the all endpoints topic. Unfortunately, when the tech endpoint is created, it also forwards all of its messages to the all topic. This results in duplicate messages whenever an endpoint publishes its messages. This patch resolves the duplicate message issue by creating a new function for Stasis caching topics, stasis_cp_sink_create. In most respects, this acts as a normal caching topic, save that it no longer forwards messages it receives to the all endpoints topic. This allows it to act as an aggregation "sink", while preserving the necessary caching behaviour. ASTERISK-25137 #close Reported-by: Vitezslav Novy ASTERISK-25116 #close Reported-by: George Joseph <george.joseph@fairview5.com> Tested-by: George Joseph <george.joseph@fairview5.com> Change-Id: Ie47784adfb973ab0063e59fc18f390d7dd26d17b
2015-12-24bridge_basic.c: Fix GOTO_ON_BLINDXFRRichard Mudgett
Use of GOTO_ON_BLINDXFR would not work at all. The target location would never be executed by the transferring channel. * Made feature_blind_transfer() call ast_bridge_set_after_go_on() with valid context, exten, and priority parameters from the transferring channel. * Renamed some feature_blind_transfer() local variables for clarity. ASTERISK-25641 #close Reported by Dmitry Melekhov Change-Id: I19bead9ffdc4aee8d58c654ca05a198da1e4b7ac
2015-12-18Merge "json: Audit ast_json_* usage for thread safety." into 13Joshua Colp
2015-12-18Merge "res_sorcery_memory_cache: Add support for a full backend cache." into 13Joshua Colp
2015-12-17res_sorcery_memory_cache: Add support for a full backend cache.Joshua Colp
This change introduces the configuration option 'full_backend_cache' which changes the cache to be a full mirror of the backend instead of a per-object cache. This allows all sorcery retrieval operations to be carried out against it and is useful for object types which are used in a "retrieve all" or "retrieve some" pattern. ASTERISK-25625 #close Change-Id: Ie2993487e9c19de563413ad5561c7403b48caab5
2015-12-17rtp_engine: Ignore empty filenames in DTLS configuration.Joshua Colp
When applying an empty DTLS configuration the filenames in the configuration will be empty. This is actually valid to do and each filename should simply be ignored. Change-Id: Ib761dc235638a3fb701df337952f831fc3e69539
2015-12-16json: Audit ast_json_* usage for thread safety.Joshua Colp
The JSON library Asterisk uses, jansson, is not thread safe for us in a few ways. To help with this wrappers for JSON object reference count increasing and decreasing were added which use a global lock to ensure they don't clobber over each other. This does not extend to reference count manipulation within the jansson library itself. This means you can't safely use the object borrowing specifier (O) in ast_json_pack and you can't share JSON instances between objects. This change removes uses of the O specifier and replaces them with the o specifier and an explicit ast_json_ref. Some cases of instance sharing have also been removed. ASTERISK-25601 #close Change-Id: I06550d8b0cc1bfeb56cab580a4e608ae4f1ec7d1
2015-12-15Merge "AMI: Fixed OriginateResponse message" into 13Matt Jordan
2015-12-14Fix sscanf() format string type mismatch.Richard Mudgett
ASTERISK-25615 Reported by: George Joseph Change-Id: Ieff35307254ca193f3d473cff2e396ca57c7ce0b
2015-12-14Merge "main/utils: Don't emit an ERROR message if the read end of a pipe ↵Matt Jordan
closes" into 13
2015-12-13main/utils: Don't emit an ERROR message if the read end of a pipe closesMatt Jordan
An ERROR or WARNING message should generally indicate that something has gone wrong in Asterisk. In the case of writing to a file descriptor, Asterisk is not in control of when the far end closes its reading on a file descriptor. If the far end does close the file descriptor in an unclean fashion, this isn't a bug or error in Asterisk, particularly when the situation can be gracefully handled in Asterisk. Currently, when this happens, a user would see the following somewhat cryptic ERROR message: "utils.c: write() returned error: Broken pipe" There's a few problems with this: (1) It doesn't provide any context, other than 'something broke a pipe' (2) As noted, it isn't actually an error in Asterisk (3) It can get rather spammy if the thing breaking the pipe occurs often, such as a FastAGI server (4) Spammy ERROR messages make Asterisk appear to be having issues, or can even mask legitimate issues This patch changes ast_carefulwrite to only log an ERROR if we actually had one that was reasonably under our control. For debugging purposes, we still emit a debug message if we detect that the far side has stopped reading. Change-Id: Ia503bb1efcec685fa6f3017bedf98061f8e1b566
2015-12-12pjsip/config_transport: Check pjproject version at runtime for async opsGeorge Joseph
pjproject < 2.5.0 will segfault on a tls transport if async_operations is greater than 1. A runtime version check has been added to throw an error if the version is < 2.5.0 and async_operations > 1. To assist in the check, a new api "ast_compare_versions" was added to utils which compares 2 major.minor.patch.extra version strings. ASTERISK-25615 #close Change-Id: I8e88bb49cbcfbca88d9de705496d6f6a8c938a98 Reported-by: George Joseph Tested-by: George Joseph
2015-12-10AMI: Fixed OriginateResponse messagepchero
When the asterisk sending OriginateResponse message, it doesn't set the "Uniqueid". And it didn't support correct response message for Application originate. ASTERISK-25624 #close Change-Id: I26f54f677ccfb0b7cfd4967a844a1657fd69b74d
2015-12-08res_pjsip: Add existence and readablity checks for tls related filesGeorge Joseph
Both transport and endpoint now check for the existence and readability of tls certificate and key files before passing them on to pjproject. This will cause the object to not load rather than waiting for pjproject to discover that there's a problem when a session is attempted. NOTE: chan_sip also uses ast_rtp_dtls_cfg_parse but it's located in build_peer which is gigantic and I didn't want to disturb it. Error messages will emit but it won't interrupt chan_sip loading. ASTERISK-25618 #close Change-Id: Ie43f2c1d653ac1fda6a6f6faecb7c2ebadaf47c9 Reported-by: George Joseph Tested-by: George Joseph
2015-12-08translate: Avoid a warning message when doing FEC within Opus Codec.Alexander Traud
ASTERISK-25616 #close Change-Id: Ibe729aaf2e6e25506cff247cec5149ec1e589319
2015-12-03Fix crash in audiohook translate to slinJonathan Rose
This patch fixes a crash which would occur when an audiohook was applied to a channel using an audio codec that could not be translated to signed linear (such as when using pass-through codecs like OPUS or when the codec translator module for the format in use is not loaded). ASTERISK-25498 #close Reported by: Ben Langfeld Change-Id: Ib6ea7373fcc22e537cad373996136636201f4384
2015-12-03Merge "sched.c: Make not return a sched id of 0." into 13Joshua Colp
2015-12-03Merge topic 'ASTERISK-25476' into 13Joshua Colp
* changes: Audit improper usage of scheduler exposed by 5c713fdf18f. (v13 additions) Audit improper usage of scheduler exposed by 5c713fdf18f.
2015-12-02Unset BRIDGEPEER when leaving a bridgeJonathan Rose
Currently if a channel is transferred out of a bridge, the BRIDGEPEER variable (also BRIDGEPVTCALLID) remain set even once the channel is out of the bridge. This patch removes these variables when leaving the bridge. ASTERISK-25600 #close Reported by: Mark Michelson Change-Id: I753ead2fffbfc65427ed4e9244c7066610e546da
2015-12-01sched.c: Make not return a sched id of 0.Richard Mudgett
According to the API doxygen a sched ID of 0 is valid. Unfortunately, 0 was never returned historically and several users incorrectly coded usage of the returned sched ID assuming that 0 was invalid. ASTERISK-25476 Change-Id: Ib19c7ebb44ec9fd393ef6646dea806d4f34e3a20
2015-12-01Audit improper usage of scheduler exposed by 5c713fdf18f.Richard Mudgett
channels/chan_iax2.c: * Initialize struct chan_iax2_pvt scheduler ids earlier because of iax2_destroy_helper(). channels/chan_sip.c: channels/sip/config_parser.c: * Fix initialization of scheduler id struct members. Some off nominal paths had 0 as a scheduler id to be destroyed when it was never started. chan_skinny.c: * Fix some scheduler id comparisons that excluded the valid 0 id. channel.c: * Fix channel initialization of the video stream scheduler id. pbx_dundi.c: * Fix channel initialization of the packet retransmission scheduler id. ASTERISK-25476 Change-Id: I07a3449f728f671d326a22fcbd071f150ba2e8c8
2015-11-25main: Slight refactor of main. Improve color situation.Walter Doekes
Several issues are addressed here: - main() is large, and half of it is only used if we're not rasterisk; fixed by spliting up the daemon part into a separate function. - Call ast_term_init from rasterisk as well. - Remove duplicate code reading/writing asterisk history file. - Attempt to tackle background color issues and color changes that occur. Tested by starting asterisk -c until the colors stopped changing at odd locations. ASTERISK-25585 #close Change-Id: Ib641a0964c59ef9fe6f59efa8ccb481a9580c52f
2015-11-24Merge "translate: Provide translation modules the result of SDP ↵Joshua Colp
negotiation." into 13
2015-11-20main/cli: Use proper string methods to check existence of context/exten/appMatt Jordan
Because the context, extension, and application are stored in stringfields, checking for them being NULL doesn't work so well. This patch uses the appropriate string library call, ast_strlen_zero, to see if there is a value in the context/exten/app values. Change-Id: Ie09623bfdf35f5a8d3b23dd596647fe3c97b9a23
2015-11-19translate: Provide translation modules the result of SDP negotiation.Alexander Traud
Previously, a trancoding module did not have access to the joint but cached format. Therefore, the module did not have access to the attributes negotiated via SDP (line fmtp). Now, a translation module receives the joint format. ASTERISK-25545 #close Change-Id: Id6878a989b50573298dab115d3371ea369e1a718
2015-11-17Merge "format: Register format-attribute module with cached formats." into 13Matt Jordan
2015-11-14hashtab: Add NULL check when destroying iterator.Joshua Colp
The hashtab API is pretty NULL tolerant which has resulted in remaining callers not doing much checks themselves. Unfortunately the function to destroy an iterator does not do a NULL check and will result in a crash if passed NULL. This change fixes that. ASTERISK-25552 #close Change-Id: Ic1bf8eec3639e5a440f1c941d3ae3893ac6ed619
2015-11-13Taskprocessors: Increase high-water markMark Michelson
In practical tests, we have seen certain taskprocessors, specifically Stasis subscription taskprocessors, cross the recently-added high-water mark and emit a warning. This high-water mark warning is only intended to be emitted when things have tanked on the system and things are heading south quickly. In the practical tests, the Stasis taskprocessors sometimes had a max depth of 180 tasks in them, and Asterisk wasn't in any danger at all. As such, this ups the high-water mark to 500 tasks instead. It also redefines the SIP threadpool request denial number to be a multiple of the taskprocessor high-water mark. Change-Id: Ic8d3e9497452fecd768ac427bb6f58aa616eebce
2015-11-13format: Register format-attribute module with cached formats.Alexander Traud
In Asterisk 13, cached formats are created before their corresponding format- attribute module is registered. Cached formats are involved when a local extension is called. Therefore, ast_format_generate_sdp_fmtp did not work on local extensions. This change affects the Opus Codec, H.263 (Plus), H.264, and format-attribute modules provided externally. ASTERISK-25160 #close Change-Id: I1ea1f0483e5261e2a050112e4ebdfc22057d1354
2015-11-12Merge "res_pjsip: Deny requests when threadpool queue is backed up." into 13Joshua Colp
2015-11-12res_pjsip: Deny requests when threadpool queue is backed up.Mark Michelson
We have observed situations where the SIP threadpool may become deadlocked. However, because incoming traffic is still arriving, the SIP threadpool's queue can continue to grow, eventually running the system out of memory. This change makes it so that incoming traffic gets rejected with a 503 response if the queue is backed up too much. Change-Id: I4e736d48a2ba79fd1f8056c0dcd330e38e6a3816
2015-11-12format_cap: Don't append the 'none' format when appending all.Joshua Colp
When appending all formats of a type all the codecs are iterated and added. This operation was incorrectly adding the ast_format_none format which is special in that it is supposed to be used when no format is present. It shouldn't be appended. ASTERISK-25535 Change-Id: I7b00f3bdf4a5f3022e483d6ece602b1e8b12827c
2015-11-11threadpool: Handle worker thread transitioning to dead when going active.Joshua Colp
This change adds handling of dead worker threads when moving them to be active. When this happens the worker thread is removed from both the active and idle threads container. If no threads are able to be moved to active then the pool grows as configured. A unit test has also been added which thrashes the idle timeout and thread activation to exploit any race conditions between the two. ASTERISK-25546 #close Change-Id: I6c455f9a40de60d9e86458d447b548fb52ba1143
2015-11-11Merge "rtp_engine: Init a format-attribute module to its RFC defaults." into 13Matt Jordan
2015-11-11Merge "ast_format_cap: Avoid format creation on module load, use cache ↵Matt Jordan
instead." into 13
2015-11-11Merge "xmldoc: Improve xmldoc wrapping of 'core show ...' output." into 13Matt Jordan
2015-11-11rtp_engine: Init a format-attribute module to its RFC defaults.Alexander Traud
Previously, format-attribute modules relied on an existing fmtp line in SDP negotiation. However, fmtp is optional for several formats like the Opus Codec. Now, the format-attribute module is called with an empty fmtp, which allows the module to initialise itself to RFC defaults. Furthermore now, Asterisk is able to differentiate between internally and externally created formats. ASTERISK-25537 #close Change-Id: I28f680cef7fdf51c0969ff8da71548edad72ec52
2015-11-11Merge "taskprocessor: Add high water mark warnings" into 13Joshua Colp