summaryrefslogtreecommitdiff
path: root/apps/app_voicemail.c
AgeCommit message (Collapse)Author
2013-12-03Add channel locking for channel snapshot creation.Mark Michelson
This adds channel locks around calls to create channel snapshots as well as other functions which operate on a channel and then end up creating a channel snapshot. Functions that expect the channel to be locked prior to being called have had their documentation updated to indicate such. ........ Merged revisions 403311 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-23app_voicemail: when forwarding a message, play vm-msgforwarded instead of ↵Rusty Newton
vm-msgsaved In the last release of sounds, 1.4.25 we added a vm-msgforwarded prompt for various core languages. Now we use that prompt. (issue ASTERISK-21413) (closes issue ASTERISK-21413) Reported by: netwrkr Tested by: newtonr git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403106 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-24app_voicemail: Memory Leaks against testsJonathan Rose
(issue ASTERISK-22467) Reported by: Corey Farrell Patches: app_voicemail-1.8.patch uploaded by coreyfarrell (license 5909) app_voicemail-11up.patch uploaded by coreyfarrell (license 5909) ........ Merged revisions 401743 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401744 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401745 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-30Multiple revisions 399887,400138,400178,400180-400181David M. Lee
........ r399887 | dlee | 2013-09-26 10:41:47 -0500 (Thu, 26 Sep 2013) | 1 line Minor performance bump by not allocate manager variable struct if we don't need it ........ r400138 | dlee | 2013-09-30 10:24:00 -0500 (Mon, 30 Sep 2013) | 23 lines Stasis performance improvements This patch addresses several performance problems that were found in the initial performance testing of Asterisk 12. The Stasis dispatch object was allocated as an AO2 object, even though it has a very confined lifecycle. This was replaced with a straight ast_malloc(). The Stasis message router was spending an inordinate amount of time searching hash tables. In this case, most of our routers had 6 or fewer routes in them to begin with. This was replaced with an array that's searched linearly for the route. We more heavily rely on AO2 objects in Asterisk 12, and the memset() in ao2_ref() actually became noticeable on the profile. This was #ifdef'ed to only run when AO2_DEBUG was enabled. After being misled by an erroneous comment in taskprocessor.c during profiling, the wrong comment was removed. Review: https://reviewboard.asterisk.org/r/2873/ ........ r400178 | dlee | 2013-09-30 13:26:27 -0500 (Mon, 30 Sep 2013) | 24 lines Taskprocessor optimization; switch Stasis to use taskprocessors This patch optimizes taskprocessor to use a semaphore for signaling, which the OS can do a better job at managing contention and waiting that we can with a mutex and condition. The taskprocessor execution was also slightly optimized to reduce the number of locks taken. The only observable difference in the taskprocessor implementation is that when the final reference to the taskprocessor goes away, it will execute all tasks to completion instead of discarding the unexecuted tasks. For systems where unnamed semaphores are not supported, a really simple semaphore implementation is provided. (Which gives identical performance as the original taskprocessor implementation). The way we ended up implementing Stasis caused the threadpool to be a burden instead of a boost to performance. This was switched to just use taskprocessors directly for subscriptions. Review: https://reviewboard.asterisk.org/r/2881/ ........ r400180 | dlee | 2013-09-30 13:39:34 -0500 (Mon, 30 Sep 2013) | 28 lines Optimize how Stasis forwards are dispatched This patch optimizes how forwards are dispatched in Stasis. Originally, forwards were dispatched as subscriptions that are invoked on the publishing thread. This did not account for the vast number of forwards we would end up having in the system, and the amount of work it would take to walk though the forward subscriptions. This patch modifies Stasis so that rather than walking the tree of forwards on every dispatch, when forwards and subscriptions are changed, the subscriber list for every topic in the tree is changed. This has a couple of benefits. First, this reduces the workload of dispatching messages. It also reduces contention when dispatching to different topics that happen to forward to the same aggregation topic (as happens with all of the channel, bridge and endpoint topics). Since forwards are no longer subscriptions, the bulk of this patch is simply changing stasis_subscription objects to stasis_forward objects (which, admittedly, I should have done in the first place.) Since this required me to yet again put in a growing array, I finally abstracted that out into a set of ast_vector macros in asterisk/vector.h. Review: https://reviewboard.asterisk.org/r/2883/ ........ r400181 | dlee | 2013-09-30 13:48:57 -0500 (Mon, 30 Sep 2013) | 28 lines Remove dispatch object allocation from Stasis publishing While looking for areas for performance improvement, I realized that an unused feature in Stasis was negatively impacting performance. When a message is sent to a subscriber, a dispatch object is allocated for the dispatch, containing the topic the message was published to, the subscriber the message is being sent to, and the message itself. The topic is actually unused by any subscriber in Asterisk today. And the subscriber is associated with the taskprocessor the message is being dispatched to. First, this patch removes the unused topic parameter from Stasis subscription callbacks. Second, this patch introduces the concept of taskprocessor local data, data that may be set on a taskprocessor and provided along with the data pointer when a task is pushed using the ast_taskprocessor_push_local() call. This allows the task to have both data specific to that taskprocessor, in addition to data specific to that invocation. With those two changes, the dispatch object can be removed completely, and the message is simply refcounted and sent directly to the taskprocessor. Review: https://reviewboard.asterisk.org/r/2884/ ........ Merged revisions 399887,400138,400178,400180-400181 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400186 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-04app_voicemail: Fix leaking config objects when msg_id doesn't matchJonathan Rose
(issues ASTERISK-22414) Reported by: Corey Farrell Patch: test_voicemail_api-leaks-11.patch uploaded by coreyfarrell (license 5909) ........ Merged revisions 398281 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 398283 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22Add SayAlphaCase and similar functionality for AGIKinsey Moore
This adds a new dialplan application, SayAlphaCase, that performs much the same function as SayAlpha except that it takes additional options which allow the user to specify whether the case of each letter should be announced for uppercase, lowercase, or all letters. Similar functionality has been added to the SAY ALPHA AGI command via an optional parameter. Original Patch by: Kevin Scott Adams Reported by: Kevin Scott Adams Review: https://reviewboard.asterisk.org/r/2725/ (closes issue ASTERISK-20782) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-17Strip down the old event systemKinsey Moore
This removes unused code, event types, IE pltypes, and event IE types where possible and makes several functions private that were once public. This includes a renumbering of the remaining event and IE types which breaks binary compatibility with previous versions. The last remaining consumers of the old event system (or parts thereof) are main/security_events.c, res/res_security_log.c, tests/test_cel.c, tests/test_event.c, main/cel.c, and the CEL backends. Review: https://reviewboard.asterisk.org/r/2703/ (closes issue ASTERISK-22139) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-06ARI: Add recording controlsDavid M. Lee
This patch implements the controls from ARI recordings. The controls are: * DELETE /recordings/live/{recordingName} - stop recording and discard it * POST /recordings/live/{recordingName}/stop - stop recording * POST /recordings/live/{recordingName}/pause - pause recording * POST /recordings/live/{recordingName}/unpause - resume recording * POST /recordings/live/{recordingName}/mute - mute recording (record silence to the file) * POST /recordings/live/{recordingName}/unmute - unmute recording. Since this underlying functionality did not already exist, is was added to app.c by a set of control frames, similar to how playback control works. The pause/mute control frames are toggles, even though the ARI controls are idempotent, to be consistent with the playback control frames. (closes issue ASTERISK-22181) Review: https://reviewboard.asterisk.org/r/2697/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-01Split caching out from the stasis_caching_topic.David M. Lee
In working with res_stasis, I discovered a significant limitation to the current structure of stasis_caching_topics: you cannot subscribe to cache updates for a single channel/bridge/endpoint/etc. To address this, this patch splits the cache away from the stasis_caching_topic, making it a first class object. The stasis_cache object is shared amongst individual stasis_caching_topics that are created per channel/endpoint/etc. These are still forwarded to global whatever_all_cached topics, so their use from most of the code does not change. In making these changes, I noticed that we frequently used a similar pattern for bridges, endpoints and channels: single_topic ----------------> all_topic ^ | single_topic_cached ----+----> all_topic_cached | +----> cache This pattern was extracted as the 'Stasis Caching Pattern', defined in stasis_caching_pattern.h. This avoids a lot of duplicate code between the different domain objects. Since the cache is now disassociated from its upstream caching topics, this also necessitated a change to how the 'guaranteed' flag worked for retrieving from a cache. The code for handling the caching guarantee was extracted into a 'stasis_topic_wait' function, which works for any stasis_topic. (closes issue ASTERISK-22002) Review: https://reviewboard.asterisk.org/r/2672/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-17Change ast_hangup() to return void and be NULL safe.Richard Mudgett
Since ast_hangup() is effectively a channel destructor, it should be a void function. * Make the few silly callers checking the return value no longer do so. Only the CDR and CEL unit tests checked the return value. * Make all callers take advantage of the NULL safe change and remove the NULL check before the call. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03ARI - channel recording supportDavid M. Lee
This patch is the first step in adding recording support to the Asterisk REST Interface. Recordings are stored in /var/spool/recording. Since recordings may be destructive (overwriting existing files), the API rejects attempts to escape the recording directory (avoiding issues if someone attempts to record to ../../lib/sounds/greeting, for example). (closes issue ASTERISK-21594) (closes issue ASTERISK-21581) Review: https://reviewboard.asterisk.org/r/2612/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-24Migrate a large number of AMI events over to Stasis-CoreMatthew Jordan
This patch moves a number of AMI events over to the Stasis-Core message bus. This includes: * ChanSpyStart/Stop * MonitorStart/Stop * MusicOnHoldStart/Stop * FullyBooted/Reload * All Voicemail/MWI related events In addition, it adds some Stasis-Core and AMI support for generic AMI messages, refactors the message router in AMI to use a single router with topic forwarding for the topics that AMI cares about, and refactors MWI message types and topics to be more name compliant. Review: https://reviewboard.asterisk.org/r/2532 (closes issue ASTERISK-21462) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-17Fix shutdown assertions in stasis-coreDavid M. Lee
In r388005, macros were introduced to consistently define message types. This added an assert if a message type was used either before it was initialized or after it had been cleaned up. It turns out that this assertion fires during shutdown. This actually exposed a hidden shutdown ordering problem. Since unsubscribing is asynchronous, it's possible that the message types used by the subscription could be freed before the final message of the subscription was processed. This patch adds stasis_subscription_join(), which blocks until the last message has been processed by the subscription. Since joining was most commonly done right after an unsubscribe, a stasis_unsubscribe_and_join() convenience function was also added. Similar functions were also added to the stasis_caching_topic and stasis_message_router, since they wrap subscriptions and have similar problems. Other code in trunk was refactored to join() where appropriate, or at least verify that the subscription was complete before being destroyed. Review: https://reviewboard.asterisk.org/r/2540 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-15Fix VM snapshot handling for combined INBOX.Jason Parker
The snapshot API contains an option that allow for combining of new and old messages within a single snapshot. New messages, however, include options beyond just 'INBOX' - it also includes the Urgent folder. A previous patch that combined INBOX and Urgent accidentally impacted snapshots that attempted to gain messages from just the Old folder. This patch fixes the snapshot gathering such that the API returns the appropriate messages for the folder selected, with and without the combine option. This should make it more clear about what's happening. Review: https://reviewboard.asterisk.org/r/2539/ ........ Merged revisions 388816 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-12Fix app_voicemail Segfault And A Few Memory LeaksMichael L. Young
The original report was that app_voicemail would crash. This was caused by ast_config_load() returning CONFIG_STATUS_FILEINVALID but no checks being performed for that return status. After adding the initial patch to fix this issue, Jaco Kroon (jkroon) added some fixes to memory leaks he had discovered. During review, Walter Doekes (wdoekes) suggested adding a helper function in order to determine if we had a valid configuration or not. This patch does the following: * Creates a helper function to check if the configuration is valid * Adds calls to the new helper function where appropiate * Fixes memory leaks where the code returned without running ast_config_destroy() on the configuration that was loaded (closes issue ASTERISK-21302) Reported by: Jaco Kroon Tested by: Jaco Kroon, Michael L. Young Patches: asterisk-11.3.0-app_voicemail-ast_config-fixes.patch Jaco Kroon (license 5671) asterisk-21302-valid_cfg_and_mem_leaks_v3-1.8.diff Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2443/ ........ Merged revisions 385551 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 385557 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-01Remove silly use of strncmp.Joshua Colp
........ Merged revisions 384414 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-30Convert TestEvent AMI events over to Stasis CoreMatthew Jordan
This patch migrates the TestEvent AMI events to first be dispatched over the Stasis-Core message bus. This helps to preserve the ordering of the events with other events in the AMI system, such as the various channel related events. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384389 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-29app_voicemail: Add blank argument to externnotify if no context argumentJonathan Rose
At least one call to run_externnotify provides a NULL context parameter and because the snprintf statement doesn't account for a NULL context parameter, it simply writes '(null)' to the arguments string instead. This patch makes it write two quotes back to back for that argument instead in the event of a NULL context. (closes issue ASTERISK-18207) Reported by: Barry L. Kline Patches: modified from patch-20130306 uploaded by Karsten Wemheuer (License 5930) ........ Merged revisions 384325 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 384326 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384327 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-28Break the world. Stasis message type accessors should now all be named ↵Kinsey Moore
correctly. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-16Transition MWI to Stasis-coreKinsey Moore
Remove MWI's dependency on the event system by moving it to Stasis-core. This also introduces forwarding topic pools in Stasis-core which aggregate many dynamically allocated topics into a single primary topic. Review: https://reviewboard.asterisk.org/r/2368/ (closes issue ASTERISK-21097) Patch-by: Kinsey Moore git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-07Let vm_mailbox_snapshot combine "Urgent" when no folder is specifiedMatthew Jordan
r381835 fixed a bug in vm_mailbox_snapshot where combining INBOX and Old forgot that Urgent also "counts" as new messages. This fixed the problem when any of the three folders was specified and the combine option was used. It missed the case where the folder isn't specified and we build a snapshot of all folders. This patch corrects that. ........ Merged revisions 382617 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-18app_voicemail: Improve msg_id handlingJonathan Rose
app_voicemail will no longer issue error messages when it retrieves an msg_id with a NULL value from realtime and will instead simply populate the msg_id field with a newly generated msg_id. In addition, this patch changes the way msg_ids are generated to eliminate certain causes of duplicate IDs appearing within a single system. In addition, when messages are copied, they will now receive a new msg_id. (closes issue ASTERISK-20717) Reported by: Alec Davis Review: https://reviewboard.asterisk.org/r/2220/ ........ Merged revisions 379460 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-15Patch to play correct sound file when a voicemail's urgent status is removedRusty Newton
We were attempting to play "vm-urgent-removed", which didn't exist. Now we play "vm-marked-nonurgent" which exists and is the correct sound file. Previous behavior was silence and a warning on the CLI. (issue ASTERISK-20280) (closes issue ASTERISK-20280) Reported by: Tomo Takebe Tested by: Rusty Newton Patches: asterisk20280.patch uploaded by Rusty Newton (license 5829) ........ Merged revisions 376262 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 376263 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376264 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-14Doxygen Updates - Title updateAndrew Latham
Update and extend the configuration_file group and enable linking to the application. Update title that was left behind many years ago. (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375004 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-12Avoid a segfault on invalid format namesKinsey Moore
If a format name was not found by ast_getformatbyname, a NULL pointer would be passed into ast_format_rate and immediately dereferenced. This ensures that a valid pointer is used since the structure is already allocated on the stack. (closes issue DPH-523) Reported-by: Steve Pitts ........ Merged revisions 374932 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374933 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01Doxygen CleanupAndrew Latham
Start adding configuration file linking and pages. Add module loading doxygen block. (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-27Add VoicemailRefresh AMI ActionKinsey Moore
Currently, if there are modifications to mailboxes that Asterisk is not aware of, the user needs to add "pollmailboxes" to their mailbox configuration, which repeatedly polls the subscribed mailboxes for changes. This results in a lot of extra work for the CPU. This patch introduces the AMI command VoicemailRefresh which permits external applications to trigger the refresh themselves. The refresh can apply to a specified mailbox only, an entire context, or all configured mailboxes. Even a refresh performed on every mailbox would not consume as much CPU as the pollmailboxes option, given that pollmailboxes runs continuously and this only runs on demand. (closes issue ASTERISK-17206) (closes issue ASTERISK-19908) Reported-by: Jeff Hutchins Reported-by: Tilghman Lesher Patch-by: Tilghman Lesher git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373913 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-25Fix error where improper IMAP greetings would be deleted.Mark Michelson
(closes issue ASTERISK-20435) Reported by: fhackenberger Patches: asterisk-20435-imap-del-greeting.diff uploaded by Michael L. Young (License #5026) (with suggested modification made by me) ........ Merged revisions 373735 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 373737 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 373738 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373740 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-22Doxygen Updates Janitor WorkAndrew Latham
* Whitespace, doc-blocks, spelling, case, missing and incorrect tags. * Add cleanup to Makefile for the Doxygen configuration update * Start updating Doxygen configuration for cleaner output * Enable inclusion of configuration files into documentation * remove mantisworkflow... * update documentation README * Add markup to Tilghman's email and talk with him about updating his email, he knows... * no code changes on this commit other than the mentioned Makefile change (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-07Fix VoicemailUserEntry event headers ServerEmail and MailCommand reported ↵Richard Mudgett
values. The AMI action VoicemailUsersList VoicemailUserEntry event headers ServerEmail and MailCommand did not report the global values if they were not overridden. The VoicemailUserEntry event header ServerEmail was not populated with the global value if the voicemail user did not override it. The VoicemailUserEntry event header MailCommand was never populated with a value. * Removed unused struct ast_vm_user member mailcmd[]. (closes issue AST-973) Reported by: John Bigelow Tested by: rmudgett ........ Merged revisions 372620 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 372621 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 372622 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-05Fix memory leaks in app_voicemail when using IMAP storage or realtime configMatthew Jordan
This patch fixes two memory leaks: 1. When find_user is called with NULL as its first parameter, the voicemail user returned is allocated on the heap. The inboxcount2 function uses find_user in such a fashion when counting new messages, and fails to free the resulting voicemail user object. 2. When populate_defaults is called on a voicemail user, it wipes whatever flags have been set on the object by copying over the global flags object. If the VM_ALLOCED flag was ste on the voicemail user prior to doing so, that flag is removed. This leaks the voicemail user when free_user is later called. (closes issue ASTERISK-19155) Reported by: Filip Jenicek patches: asterisk.patch2 uploaded by Filip Jenicek (license 6277) Patch slightly modified for this commit. Review: https://reviewboard.asterisk.org/r/2096 ........ Merged revisions 372268 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 372288 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 372289 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-31Clean up and ensure proper usage of alloca()Kinsey Moore
This replaces all calls to alloca() with ast_alloca() which calls gcc's __builtin_alloca() to avoid BSD semantics and removes all NULL checks on memory allocated via ast_alloca() and ast_strdupa(). (closes issue ASTERISK-20125) Review: https://reviewboard.asterisk.org/r/2032/ Patch-by: Walter Doekes (wdoekes) ........ Merged revisions 370642 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-05AST-2012-011: Resolve heap corruption issue with voicemailKinsey Moore
The heard and deleted arrays in the voicemail state structure were not handled properly following the memory leak fix in r354890 and a fix for an invalid free in r356797. This could result in accessing and writing into freed memory. The allocation for these arrays has been reworked to avoid the possibility of invalid frees, access of freed memory, and crashes that were occurring as a result of this. Locking around accesses and modifications of the voicemail state structure members dh_arraysize, heard, and deleted has been added to prevent simultaneous modification and access when IMAP storage is in use. If IMAP storage is not in use, this locking is not compiled in. Review: https://reviewboard.asterisk.org/r/1994/ (closes issue ASTERISK-19923) Reported by: Dan Delaney Tested by: Dan Delaney, Julian Yap Patches: vm_alloc_fix.diff uploaded by kmoore (license 6273) ........ Merged revisions 369652 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369653 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369676 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-25Add AMI event documentationMatthew Jordan
This patch adds the core changes necessary to support AMI event documentation in the source files of Asterisk, and adds documentation to those AMI events defined in the core application modules. Event documentation is built from the source by two new python scripts, located in build_tools: get_documentation.py and post_process_documentation.py. The get_documentation.py script mirrors the actions of the existing AWK get_documentation scripts, except that it will scan the entirety of a source file for Asterisk documentation. Upon encountering it, if the documentation happens to be an AMI event, it will attempt to extract information about the event directly from the manager event macro calls that raise the event. The post_process_documentation.py script combines manager event instances that are the same event but documented in multiple source files. It generates the final core-[lang].xml file. As this process can take longer to complete than a typical 'make all', it is only performed if a new make target, 'full', is chosen. Review: https://reviewboard.asterisk.org/r/1967/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369346 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-15Fix voicemail API tests by using the correct argument order for create/destroy.Jason Parker
........ Merged revisions 369024 from http://svn.asterisk.org/svn/asterisk/certified/branches/1.8.11 ........ Merged revisions 369026 from http://svn.asterisk.org/svn/asterisk/branches/10-digiumphones git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369027 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-14Multiple revisions 368963,368965Jason Parker
........ r368963 | qwell | 2012-06-14 13:47:03 -0500 (Thu, 14 Jun 2012) | 14 lines Remove global symbol requirement from app_voicemail. This uses the existing "function installation" stuff that already existed for other functions, like getting message counts. (closes issue AST-807) (issue AST-901) (issue AST-908) Review: https://reviewboard.asterisk.org/r/1965/ ........ Merged revisions 368962 from http://svn.asterisk.org/svn/asterisk/certified/branches/1.8.11 ........ r368965 | qwell | 2012-06-14 14:04:57 -0500 (Thu, 14 Jun 2012) | 11 lines These functions that were moved need to be static. Also wrap test functions in a #ifdef. (issue AST-807) (issue AST-901) (issue AST-908) ........ Merged revisions 368964 from http://svn.asterisk.org/svn/asterisk/certified/branches/1.8.11 ........ Merged revisions 368963,368965 from http://svn.asterisk.org/svn/asterisk/branches/10-digiumphones git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368966 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-11Fix coverity UNUSED_VALUE findings in core support level filesKinsey Moore
Most of these were just saving returned values without using them and in some cases the variable being saved to could be removed as well. (issue ASTERISK-19672) ........ Merged revisions 368738 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 368739 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-05Ensure that pages and emails are sent using RFC822-compliant date formatKinsey Moore
When localization was added to app_voicemail, these headers were altered when they should have remained in en_US format for RFC compliance. This reverts the changes to those two lines. (closes issue ASTERISK-19876) ........ Merged revisions 368520 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 368524 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-04Merge changes dealing with support for Digium phones.Mark Michelson
Presence support has been added. This is accomplished by allowing for presence hints in addition to device state hints. A dialplan function called PRESENCE_STATE has been added to allow for setting and reading presence. Presence can be transmitted to Digium phones using custom XML elements in a PIDF presence document. Voicemail has new APIs that allow for moving, removing, forwarding, and playing messages. Messages have had a new unique message ID added to them so that the APIs will work reliably. The state of a voicemail mailbox can be obtained using an API that allows one to get a snapshot of the mailbox. A voicemail Dialplan App called VoiceMailPlayMsg has been added to be able to play back a specific message. Configuration hooks have been added. Configuration hooks allow for a piece of code to be executed when a specific configuration file is loaded by a specific module. This is useful for modules that are dependent on the configuration of other modules. chan_sip now has a public method that allows for a custom SIP INFO request to be sent mid-dialog. Digium phones use this in order to display progress bars when files are played. Messaging support has been expanded a bit. The main visible difference is the addition of an AMI action MessageSend. Finally, a ParkingLots manager action has been added in order to get a list of parking lots. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18Fix a variety of memory leaksMatthew Jordan
This patch addresses a number of memory leaks in a variety of modules that were found by a static analysis tool. A brief summary of the changes: * app_minivm: free ast_str objects on off nominal paths * app_page: free the ast_dial object if the requested channel technology cannot be appended to the dialing structure * app_queue: if a penalty rule failed to match any existing rule list names, the created rule would not be inserted and its memory would be leaked * app_read: dispose of the created silence detector in the presence of off nominal circumstances * app_voicemail: dispose of an allocated unique ID field for MWI event un-subscribe requests in off nominal paths; dispose of configuration objects when using the secret.conf option * chan_dahdi: dispose of the allocated frame produced by ast_dsp_process * chan_iax2: properly unref peer in CLI command "iax2 unregister" * chan_sip: dispose of the allocated frame produced by sip_rtp_read's call of ast_dsp_process; free memory in parse unit tests * func_dialgroup: properly deref ao2 object grhead in nominal path of dialgroup_read * func_odbc: free resultset in off nominal paths of odbc_read * cli: free match_list in off nominal paths of CLI match completion * config: free comment_buffer/list_buffer when configuration file load is unchanged; free the same buffers any time they were created and config files were processed * data: free XML nodes in various places * enum: free context buffer in off nominal paths * features: free ast_call_feature in off nominal paths of applicationmap config processing * netsock2: users of ast_sockaddr_resolve pass in an ast_sockaddr struct that is allocated by the method. Failures in ast_sockaddr_resolve could result in the users of the method not knowing whether or not the buffer was allocated. The method will now not allocate the ast_sockaddr struct if it will return failure. * pbx: cleanup hash table traversals in off nominal paths; free ignore pattern buffer if it already exists for the specified context * xmldoc: cleanup various nodes when we no longer need them * main/editline: various cleanup of pointers not being freed before being assigned to other memory, cleanup along off nominal paths * menuselect/mxml: cleanup of value buffer for an attribute when that attribute did not specify a value * res_calendar*: responses are allocated via the various *_request method returns and should not be allocated in the various write_event methods; ensure attendee buffer is freed if no data exists in the parsed node; ensure that calendar objects are de-ref'd appropriately * res_jabber: free buffer in off nominal path * res_musiconhold: close the DIR* object in off nominal paths * res_rtp_asterisk: if we run out of ports, close the rtp socket object and free the rtp object * res_srtp: if we fail to create the session in libsrtp, destroy the temporary ast_srtp object (issue ASTERISK-19665) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1922 ........ Merged revisions 366880 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366881 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10Resolve FORWARD_NULL static analysis warningsKinsey Moore
This resolves core findings from ASTERISK-19650 numbers 0-2, 6, 7, 9-11, 14-20, 22-24, 28, 30-32, 34-36, 42-56, 82-84, 87, 89-90, 93-102, 104, 105, 109-111, and 115. Finding numbers 26, 33, and 29 were already resolved. Those skipped were either extended/deprecated or in areas of code that shouldn't be disturbed. (Closes issue ASTERISK-19650) ........ Merged revisions 366167 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366168 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10Coverity Report: Fix issues for error type CHECKED_RETURN for coreJonathan Rose
(issue ASTERISK-19658) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1905/ ........ Merged revisions 366094 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366106 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-07Fix channel opaquification slip-up in r365477Matthew Jordan
Those channels are opaque now... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365480 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-07Support VoiceMail d() option when extension does not exist in channel's contextMatthew Jordan
The VoiceMail d([c]) option is documented to accept digits for a new extension in context <c>, if played during the greeting. This option works fine if the extension being redirected to has an extension with the same initial digit in the channel's current context. If that digit did not happen to exist in some extension, a dialplan match would fail and the user would not be redirected. This patch fixes it such that if the <c> option is used, the extensions are matched in that context as opposed to the caller's original context. (closes issue ASTERISK-18243) Reported by: mjordan Tested by: mjordan Review: https://reviewboard.asterisk.org/r/1892 ........ Merged revisions 365474 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 365475 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-04Fix many issues from the NULL_RETURNS Coverity reportKinsey Moore
Most of the changes here are trivial NULL checks. There are a couple optimizations to remove the need to check for NULL and outboundproxy parsing in chan_sip.c was rewritten to avoid use of strtok. Additionally, a bug was found and fixed with the parsing of outboundproxy when "outboundproxy=," was set. (Closes issue ASTERISK-19654) ........ Merged revisions 365398 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 365399 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-16Fix handling of negative return code when storing voicemails in ODBC storageMatthew Jordan
When storing a voicemail message using an ODBC connection to a database, the voicemail message is first stored on disk. The sound file associated with the message is read into memory before being transmitted to the database. When this occurs, a failure in the C library's lseek function would cause a negative value to be passed to the mmap as the size of the memory map to create. This would almost certainly cause the creation of the memory map to fail, resulting in the message being lost. (issue ASTERISK-19655) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1863 ........ Merged revisions 362201 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 362202 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362203 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-06Add missing newlines to CLI loggingKinsey Moore
........ Merged revisions 361471 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 361472 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13Fix IMAP storage compilation after opaquification changesTerry Wilson
(closes issue ASTERISK-19513) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358908 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-29Opaquify ast_channel structs and listsTerry Wilson
Review: https://reviewboard.asterisk.org/r/1773/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-25Fix crash in app_voicemail during close_mailboxMatthew Jordan
In r354890, a memory leak in app_voicemail was fixed by properly disposing of the allocated heard/deleted pointers. However, there are situations, particularly when no messages are found in a folder, where these pointers are not allocated and not NULL. In that case, an invalid free would be attempted, which could crash app_voicemail. As there are a number of code paths where this could occur, this patch uses the number of messages detected in the folder before it attempts to free the pointers. This resolves the crash detected in the Asterisk Test Suite's check_voicemail_nominal test. ........ Merged revisions 356797 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 356798 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356799 65c4cc65-6c06-0410-ace0-fbb531ad65f3