summaryrefslogtreecommitdiff
path: root/apps/app_voicemail.c
AgeCommit message (Collapse)Author
2016-10-27app_voicemail: Clear voice mailbox in MailboxExists and MAILBOX_EXISTS.Joshua Colp
When executing the MailboxExists dialplan application and MAILBOX_EXISTS dialplan function the passed in temporary voice mailbox was not cleared, causing it to try to free garbage. ASTERISK-26503 #close Change-Id: Ie21ccfa1b80b9c59318e596f6b8e17da2b5a7cb3
2016-08-03app_voicemail: Add taskprocessor alert level options.Alexei Gradinari
On heavy loaded system with IMAP or DB storage, 'app_voicemail' taskprocessor queue could reach 500 scheduled tasks. It could happen when the IMAP or DB server dies or is unreachable. It could happen on startup when there are many (thousands) realtime endpoints configured with unsolicited mwi. If the taskprocessor queue reaches the high water level then the alert is triggered and pjsip stops processing new requests until the queue reaches the low water level to clear the alert. This patch adds 2 new 'general' configuration options to tune taskprocessor alert levels: 'tps_queue_high' - Taskprocessor high water alert trigger level. 'tps_queue_low' - Taskprocessor low water clear alert level ASTERISK-26229 #close Change-Id: I766294fbffedf64053c0d9ac0bedd3109f043ee8
2016-07-18Unit tests: Use AST_TEST_DEFINE in conditional code only.Corey Farrell
If AST_TEST_DEFINE is not conditional to TEST_FRAMEWORK it produces dead code. This places all existing unit tests into a conditional block if they weren't already. ASTERISK-26211 #close Change-Id: I8ef83ee11cbc991b07b7a37ecb41433e8c734686
2016-06-20app_voicemail.c: Fix IMAP compile error.Richard Mudgett
Fix compile error introduced by the patch for ASTERISK-26045 Change-Id: I5b02876266f2824f4cec2b54d6ff4db5de5778d3
2016-05-26app_voicemail: fix bugs, imap mm_status log change to debugAlexei Gradinari
Fixed some bugs: - create dirpath when save downloading message from IMAP storage. - create IMAP folder if not exists when saving to IMAP storage - check if file successfully opened before write to it - some IMAP checks - remove non-standard flag 'Unseen' etc Change to debug IMAP mm_status log instead of verbose. Remove unused X-Asterisk-VM-Caller-channel message header for security reason. The clients should not know name of peer/endpoint. ASTERISK-26045 #close Change-Id: I7f83d88b69b36934e2539c114b9fb612deed971b
2016-05-03app_voicemail: always copy dynamic struct to avoid race conditionAndrew Nagy
Voicemail email addresses can be corrupt or voicemail emails can end up being sent to the wrong email address if asterisk is reading voicemail.conf during a reload and processing an email at the same time. This patch always copies the struct that would otherwise only be copied once. ASTERISK-24463 #close Reported by: John Campbell Tested by: Etienne Lessard Tested by: Andrew Nagy Change-Id: I3a0643813116da84e2617291903d0d489b7425fb
2016-04-15Merge "app_voicemail/IMAP: function 'save_to_folder' creates wrong folder" ↵Joshua Colp
into 13
2016-04-12app_voicemail: Fix test_voicemail_notify_endl test.Joshua Colp
The test_voicemail_notify_endl test checks the end-of-line characters of an email message to confirm that they are consistent. The test wrongfully assumed that reading from the email message into a buffer will always result in more than 1 character being read. This is incorrect. If only 1 character was read the test would go outside of the buffer and access other memory causing a crash. The test now checks to ensure that 2 or more characters are read in ensuring the test stays within the buffer. ASTERISK-25874 #close Change-Id: Ic2c89cea6e90f2c0bc2d8138306ebbffd4f8b710
2016-04-11app_voicemail/IMAP: function 'save_to_folder' creates wrong folderAlexei Gradinari
If try to move message to Cust1 (number 5) the function 'save_to_folder' tries to create Greeting folder instead of Cust1. This patch fixed it by setting GREETINGS_FOLDER = -1 ASTERISK-24927 #close Change-Id: I03d1a761894bcc2d130ec9b003bbcddc28e25c51
2016-04-07app_voicemail/IMAP: IMAP access FATAL error: Out of memoryAlexei Gradinari
Sometimes uw-imap function 'mail_fetchbody' returns huge len which then pass to uw-imap function 'rfc822_base64'. uw-imap tries to allocate huge memory and abort() on fail. This patch check the len. If the len more than max size (128 Mbytes) log error. This patch also set variables len, newlen to avoid uninizialezed len. This patch also check pointer returned by rfc822_base64. ASTERISK-25899 #close Change-Id: I4a0e7d655f11abef6a5224e2169df6d5c1f1caca
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
2015-05-13app_voicemail: fix moving when old messages fullJonathan Rose
When completing voicemail playback of a message in the 'INBOX', the message gets moved to the 'Old' messages folder. Without this patch, if the 'Old' folder is already at its set limit, then the 'INBOX' message will simply be deleted. With this patch, the flag to delete the message will be removed if the save_to_folder function indicates that the message could not be moved due to a full folder. ASTERISK-25082 #close Reported by: Jonathan Rose Review: https://gerrit.asterisk.org/#/c/448/ Change-Id: I2be440a09f42e2d06d50975c40d1ad7f836ecb3f
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-10app_voicemail: Fix crash with IMAP backends when greetings aren't presentMatthew Jordan
When an IMAP backend is in use and greetings are set to be used, but aren't present for a user in their IMAP folder, Asterisk will crash. This occurs due to the mailstream being set to the 'greetings' folder and being left in that particular state, regardless of the success/failure of the attempt to access the folder the mailstream points to. Later access of the mailstream assumes that it points to the 'INBOX' (or some other folder), resulting in either a crash (if the greetings folder didn't exist and the mailstream is invalid) or an inability to read messages from the 'INBOX' folder. This patch restores the mailstream to its correct state after accessing the greetings. This fixes the crash, and sets the mailstream to the state that VoiceMailMain expects. Note that while ASTERISK-23390 also contained a patch for this issue, the patch on ASTERISK-24786 is the one being merged here. Review: https://reviewboard.asterisk.org/r/4459/ ASTERISK-23390 #close Reported by: Ben Smithurst ASTERISK-24786 #close Reported by: Graham Barnett Tested by: Graham Barnett patches: app_voicemail.c.patch.SIGSEGV3rev2 uploaded by Graham Barnett (License 6685) ........ Merged revisions 432695 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-05app_voicemail: Fix compile breaking in app_voicemail with IMAP_STORAGE.George Joseph
There is a leftover "assert" in app_voicemail/__messagecount that references variables that don't exist. This causes the compile to fail when --enable-dev-mode and IMAP_STORAGE are selected. This patch removes the assert. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4461/ ........ Merged revisions 432484 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432485 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21apps/app_voicemail: Demote an ERROR message to a WARNING messageMatthew Jordan
When using IMAP voicemail with FreePBX, you will often get ERROR messages complaining about not being able to find a mailbox. This is due to how FreePBX handles voicemail mailboxes. Unfortunately, app_voicemail has to consider this a configuration error, as in any other system it would be indicative of someone misconfiguring their system. Regardless, a misconfiguration is a WARNING, and not an ERROR. This patch demotes the message so that system administrators can hopefully reduce some of the noise in their log files. Note that in the original patch this was made into a NOTICE, but that's a too forgiving. ASTERISK-24790 #close Reported by: Graham Barnett patches: app_voicemail.c.patch_noise uploaded by Graham Barnett (License 6685) ........ Merged revisions 432098 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432099 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-20apps/app_voicemail: Fix IMAP header compatibility issue with Microsoft ExchangeMatthew Jordan
When interfacing with Microsoft Exchange, custom headers will be returned as all lower case. Currently, the IMAP header code will fail to parse the returned custom headers, as it will be performing a case sensitive comparison. This can cause playback of messages to fail, as needed information - such as origtime - will not be present. This patch updates app_voicemail's header parsing code to perform a case insensitive lookup for the requested custom headers. Since the headers are specific to Asterisk, e.g., 'x-asterisk-vm-orig-time', and headers should be unique in an IMAP message, this should cause no issues with other systems. ASTERISK-24787 #close Reported by: Graham Barnett patches: app_voicemail.c.patch_MSExchange uploaded by Graham Barnett (License 6685) ........ Merged revisions 432012 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-23Fix typo's (retrieve, specified, address).Walter Doekes
........ Merged revisions 430996 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430998 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-22apps/app_voicemail: Trigger MWI notification with MixMonitor m() optionMatthew Jordan
The MixMonitor m() option allows a recording to be pushed to a specific voicemail mailbox. If the message is delivered to the mailbox's INBOX, however, no MWI notification is currently raised. This patch corrects the issue by properly calling notify_new_state from the msg_create_from_file function. This will cause MWI to be triggered if the message was placed in the mailbox's INBOX. ASTERISK-24709 #close Reported by: Gareth Palmer patches: app_voicemail-430919.patch uploaded by Gareth Palmer (License 5169) ........ Merged revisions 430920 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-20app_voicemail: Temp message left after review/hangup with ODBC/IMAP backendMatthew Jordan
When using ODBC or IMAP storage, temporary files created on the file system must be disposed of using the DISPOSE macro. The DELETE macro will map to a deletion function for the backend storage, but does not clean up any local files created as a result of the operation. When using voicemail with the operator and review options enabled, pressing 0 to enter the menu, followed by 1 to save the message, followed by any other DTMF press to delete the message, will result in the temporary file lingering on the file system. This patch properly calls DISPOSE after the DELETE. This causes the local file to be disposed of. ASTERISK-24288 #close Reported by: LEI FU patches: voicemail_odbc_review_fix.diff uploaded by LEI FU (License 6640) ........ Merged revisions 430795 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430796 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09AMI: Make AMI actions that generate event lists consistent.Richard Mudgett
* Made the following AMI actions use list API calls for consistency: Agents BridgeInfo BridgeList BridgeTechnologyList ConfbridgeLIst ConfbridgeLIstRooms CoreShowChannels DAHDIShowChannels DBGet DeviceStateList ExtensionStateList FAXSessions Hangup IAXpeerlist IAXpeers IAXregistry MeetmeList MeetmeListRooms MWIGet ParkedCalls Parkinglots PJSIPShowEndpoint PJSIPShowEndpoints PJSIPShowRegistrationsInbound PJSIPShowRegistrationsOutbound PJSIPShowResourceLists PJSIPShowSubscriptionsInbound PJSIPShowSubscriptionsOutbound PresenceStateList PRIShowSpans QueueStatus QueueSummary ShowDialPlan SIPpeers SIPpeerstatus SIPshowregistry SKINNYdevices SKINNYlines Status VoicemailUsersList * Incremented the AMI version to 2.7.0. * Changed astman_send_listack() to not use the listflag parameter and always set the value to "Start" so the start capitalization is consistent. i.e., The FAXSessions used "Start" while the rest of the system used "start". The corresponding complete event always used "Complete". * Fixed ami_show_resource_lists() "PJSIPShowResourceLists" to output the AMI ActionID for all of its list events. * Fixed off-nominal AMI protocol error in manager_bridge_info(), manager_parking_status_single_lot(), and manager_parking_status_all_lots(). Use of astman_send_error() after responding to the original AMI action request violates the action response pattern by sending two responses. * Fixed minor protocol error in action_getconfig() when no requested categories are found. Each line needs to be formatted as "Header: text". * Fixed off-nominal memory leak in manager_build_parked_call_string(). * Eliminated unnecessary use of RAII_VAR() in ami_subscription_detail(). ASTERISK-24049 #close Reported by: Jonathan Rose Review: https://reviewboard.asterisk.org/r/4315/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430434 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-03apps/app_voicemail: Fix crash with IMAP when streams are opened simultaneouslyMatthew Jordan
The UW IMAP library is instrinsically not thread-safe, and relies upon higher level applications to guarantee thread safety. For the most part, this is provided by the vms object, which provides locking for individual streams. Unfortunately, this is not sufficient for calls to mail_open which create the IMAP stream. mail_open can, on some systems, call into a UW IMAP specific function for determining the address of a system based on a hostname, ip_nametoaddr. In the ip6_unix implementation of this function, static variables are used to hold parsing buffers. This can cause a crash if multiple threads attempt to convert a hostname to an address at the same time. Locking on a single mail stream is not sufficient to prevent simultaneous access to these static variables. In the IMAP library, this function can be called from the mail_open and imap_status functions. As the imap_status function is not used by app_voicemail, locking on access to mail_open is sufficient to prevent any mangling of the buffers. Review: https://reviewboard.asterisk.org/r/4188/ ASTERISK-24516 #close Reported by: David Duncan Ross Palmer Tested by: David Duncan Ross Palmer patches: ASTERISK-24516.diff uploaded by David Duncan Ross Palmer (License 6660) ........ Merged revisions 428863 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 428864 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@428865 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-09app_voicemail: Fix enhancement that allowed multiple recipients in To: headerMatthew Jordan
An issue existed in r420577, which added multiple recipients to voicemail emails. The patch, when looking at the intended recipients, looked ahead for the '|' character inside a while loop which already had pulled out the appropriate field parsing on the '|' character. This would cause it to skip the recipients. This patch fixes it such that it relies completely on the while loop to parse through the e-mail fields. Note that the original author of the patch looked at this fix and approved it. ASTERISK-24250 #close Reported by: abelbeck patches: voicemail-420577-to-comma-fix.diff uploaded by abelbeck (License 5903) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@427585 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-03Fix compile error caused by review 4138Corey Farrell
There is no procedure called ast_closeframe, fix code to use ast_closestream. Reported By: Matt Jordan ........ Merged revisions 427087 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 427088 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@427089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-02Fix ast_writestream leaksCorey Farrell
Fix cleanup in __ast_play_and_record where others[x] may be leaked. This was caught where prepend != NULL && outmsg != NULL, once realfile[x] == NULL any further others[x] would be leaked. A cleanup block was also added for prepend != NULL && outmsg == NULL. 11+: Fix leak of ast_writestream recording_fs in app_voicemail:leave_voicemail. ASTERISK-24476 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4138/ ........ Merged revisions 427023 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 427024 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 427025 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@427026 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-30app_voicemail: Fix unchecked bounds of myArray in IMAP_STORAGE.Walter Doekes
In update_messages_by_imapuser(), messages were appended to a finite array which resulted in a crash when an IMAP mailbox contained more than 256 entries. This memory is now dynamically increased as needed. Observe that this patch adds a bunch of XXX's to questionable code. See the review (url below) for more information. ASTERISK-24190 #close Reported by: Nick Adams Tested by: Nick Adams Review: https://reviewboard.asterisk.org/r/4126/ ........ Merged revisions 426691 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 426692 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 426696 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@426702 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-13manager/config: Support templates and non-unique category names via AMIGeorge Joseph
This patch provides the capability to manipulate templates and categories with non-unique names via AMI. Summary of changes: GetConfig and GetConfigJSON: Added "Filter" parameter: A comma separated list of name_regex=value_regex expressions which will cause only categories whose variables match all expressions to be considered. The special variable name TEMPLATES can be used to control whether templates are included. Passing 'include' as the value will include templates along with normal categories. Passing 'restrict' as the value will restrict the operation to ONLY templates. Not specifying a TEMPLATES expression results in the current default behavior which is to not include templates. UpdateConfig: NewCat now includes options for allowing duplicate category names, indicating if the category should be created as a template, and specifying templates the category should inherit from. The rest of the actions now accept a filter string as defined above. If there are non-unique category names, you can now update specific ones based on variable values. To facilitate the new capabilities in manager, corresponding changes had to be made to config, most notably the addition of filter criteria to many of the APIs. In some cases it was easy to change the references to use the new prototype but others would have required touching too many files for this patch so a wrapper with the original prototype was created. Macros couldn't be used in this case because it would break binary compatibility with modules such as res_digium_phone that are linked to real symbols. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4033/ ........ Merged revisions 425383 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@425384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-16Voicemail: get correct duration when copying file to vmScott Griepentrog
Changes made during format improvements resulted in the recording to voicemail option 'm' of the MixMonitor app writing a zero length duration in the msgXXXX.txt file. This change introduces a new function ast_ratestream(), which provides the sample rate of the format associated with the stream, and updates the app_voicemail function for ast_app_copy_recording_to_vm to calculate the right duration. Review: https://reviewboard.asterisk.org/r/3996/ ASTERISK-24328 #close git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@423192 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-15app_voicemail/app: Remove test events that were duplicated by r421059Matthew Jordan
Moving the test event raised when a file is played back (which occurred in r421059) broke the ever loving snot out of the voicemail tests. This caused duplicate test events to get raised, as app_voicemail and main/app were raising events prior to call ast_streamfile. The voicemail tests did not enjoy getting multiple events. Since raising the playback event in ast_streamfile is far more useful to the vast majority of tests, this patch keeps the call there and simply removes the extraneous calls that duplicated the event. ........ Merged revisions 421125 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 421164 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 421165 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@421166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-12app_voicemail: Fix the "test_voicemail_vm_info" unit test.Joshua Colp
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@420856 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-08Fix build in devmode.Jason Parker
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@420592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-08app_voicemail: Add the ability to specify multiple email addresses.Jason Parker
ASTERISK-24045 Reported by: Jacob Barber Review: https://reviewboard.asterisk.org/r/3833/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@420577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-23app_voicemail: use a consistent generator stringScott Griepentrog
When updating voicemail.conf when a user changes their pin, change the generator string to be the same as the module name when reading so that the same config_hook will be called. Review: https://reviewboard.asterisk.org/r/3837/ ........ Merged revisions 419284 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 419285 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419286 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-21res_smdi: convert to astobj2Corey Farrell
Remove functions: ast_smdi_interface_unref ast_smdi_md_message_putback ast_smdi_mwi_message_putback ast_smdi_md_message destructor ast_smdi_mwi_message destructor Includes for astobj.h are removed everywhere it's possible. ASTERISK-24066 #close Review: https://reviewboard.asterisk.org/r/3758/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20media formats: re-architect handling of media for performance improvementsMatthew Jordan
In the old times media formats were represented using a bit field. This was fast but had a few limitations. 1. Asterisk was limited in how many formats it could handle. 2. Formats, being a bit field, could not include any attribute information. A format was strictly its type, e.g., "this is ulaw". This was changed in Asterisk 10 (see https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for notes on that work) which led to the creation of the ast_format structure. This structure allowed Asterisk to handle attributes and bundle information with a format. Additionally, ast_format_cap was created to act as a container for multiple formats that, together, formed the capability of some entity. Another mechanism was added to allow logic to be registered which performed format attribute negotiation. Everywhere throughout the codebase Asterisk was changed to use this strategy. Unfortunately, in software, there is no free lunch. These new capabilities came at a cost. Performance analysis and profiling showed that we spend an inordinate amount of time comparing, copying, and generally manipulating formats and their related structures. Basic prototyping has shown that a reasonably large performance improvement could be made in this area. This patch is the result of that project, which overhauled the media format architecture and its usage in Asterisk to improve performance. Generally, the new philosophy for handling formats is as follows: * The ast_format structure is reference counted. This removed a large amount of the memory allocations and copying that was done in prior versions. * In order to prevent race conditions while keeping things performant, the ast_format structure is immutable by convention and lock-free. Violate this tenet at your peril! * Because formats are reference counted, codecs are also reference counted. The Asterisk core generally provides built-in codecs and caches the ast_format structures created to represent them. Generally, to prevent inordinate amounts of module reference bumping, codecs and formats can be added at run-time but cannot be removed. * All compatibility with the bit field representation of codecs/formats has been moved to a compatibility API. The primary user of this representation is chan_iax2, which must continue to maintain its bit-field usage of formats for interoperability concerns. * When a format is negotiated with attributes, or when a format cannot be represented by one of the cached formats, a new format object is created or cloned from an existing format. That format may have the same codec underlying it, but is a different format than a version of the format with different attributes or without attributes. * While formats are reference counted objects, the reference count maintained on the format should be manipulated with care. Formats are generally cached and will persist for the lifetime of Asterisk and do not explicitly need to have their lifetime modified. An exception to this is when the user of a format does not know where the format came from *and* the user may outlive the provider of the format. This occurs, for example, when a format is read from a channel: the channel may have a format with attributes (hence, non-cached) and the user of the format may last longer than the channel (if the reference to the channel is released prior to the format's reference). For more information on this work, see the API design notes: https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite Finally, this work was the culmination of a large number of developer's efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the work in the Asterisk core, chan_sip, and was an invaluable resource in peer reviews throughout this project. There were a substantial number of patches contributed during this work; the following issues/patch names simply reflect some of the work (and will cause the release scripts to give attribution to the individuals who work on them). Reviews: https://reviewboard.asterisk.org/r/3814 https://reviewboard.asterisk.org/r/3808 https://reviewboard.asterisk.org/r/3805 https://reviewboard.asterisk.org/r/3803 https://reviewboard.asterisk.org/r/3801 https://reviewboard.asterisk.org/r/3798 https://reviewboard.asterisk.org/r/3800 https://reviewboard.asterisk.org/r/3794 https://reviewboard.asterisk.org/r/3793 https://reviewboard.asterisk.org/r/3792 https://reviewboard.asterisk.org/r/3791 https://reviewboard.asterisk.org/r/3790 https://reviewboard.asterisk.org/r/3789 https://reviewboard.asterisk.org/r/3788 https://reviewboard.asterisk.org/r/3787 https://reviewboard.asterisk.org/r/3786 https://reviewboard.asterisk.org/r/3784 https://reviewboard.asterisk.org/r/3783 https://reviewboard.asterisk.org/r/3778 https://reviewboard.asterisk.org/r/3774 https://reviewboard.asterisk.org/r/3775 https://reviewboard.asterisk.org/r/3772 https://reviewboard.asterisk.org/r/3761 https://reviewboard.asterisk.org/r/3754 https://reviewboard.asterisk.org/r/3753 https://reviewboard.asterisk.org/r/3751 https://reviewboard.asterisk.org/r/3750 https://reviewboard.asterisk.org/r/3748 https://reviewboard.asterisk.org/r/3747 https://reviewboard.asterisk.org/r/3746 https://reviewboard.asterisk.org/r/3742 https://reviewboard.asterisk.org/r/3740 https://reviewboard.asterisk.org/r/3739 https://reviewboard.asterisk.org/r/3738 https://reviewboard.asterisk.org/r/3737 https://reviewboard.asterisk.org/r/3736 https://reviewboard.asterisk.org/r/3734 https://reviewboard.asterisk.org/r/3722 https://reviewboard.asterisk.org/r/3713 https://reviewboard.asterisk.org/r/3703 https://reviewboard.asterisk.org/r/3689 https://reviewboard.asterisk.org/r/3687 https://reviewboard.asterisk.org/r/3674 https://reviewboard.asterisk.org/r/3671 https://reviewboard.asterisk.org/r/3667 https://reviewboard.asterisk.org/r/3665 https://reviewboard.asterisk.org/r/3625 https://reviewboard.asterisk.org/r/3602 https://reviewboard.asterisk.org/r/3519 https://reviewboard.asterisk.org/r/3518 https://reviewboard.asterisk.org/r/3516 https://reviewboard.asterisk.org/r/3515 https://reviewboard.asterisk.org/r/3512 https://reviewboard.asterisk.org/r/3506 https://reviewboard.asterisk.org/r/3413 https://reviewboard.asterisk.org/r/3410 https://reviewboard.asterisk.org/r/3387 https://reviewboard.asterisk.org/r/3388 https://reviewboard.asterisk.org/r/3389 https://reviewboard.asterisk.org/r/3390 https://reviewboard.asterisk.org/r/3321 https://reviewboard.asterisk.org/r/3320 https://reviewboard.asterisk.org/r/3319 https://reviewboard.asterisk.org/r/3318 https://reviewboard.asterisk.org/r/3266 https://reviewboard.asterisk.org/r/3265 https://reviewboard.asterisk.org/r/3234 https://reviewboard.asterisk.org/r/3178 ASTERISK-23114 #close Reported by: mjordan media_formats_translation_core.diff uploaded by kharwell (License 6464) rb3506.diff uploaded by mjordan (License 6283) media_format_app_file.diff uploaded by kharwell (License 6464) misc-2.diff uploaded by file (License 5000) chan_mild-3.diff uploaded by file (License 5000) chan_obscure.diff uploaded by file (License 5000) jingle.diff uploaded by file (License 5000) funcs.diff uploaded by file (License 5000) formats.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) bridges.diff uploaded by file (License 5000) mf-codecs-2.diff uploaded by file (License 5000) mf-app_fax.diff uploaded by file (License 5000) mf-apps-3.diff uploaded by file (License 5000) media-formats-3.diff uploaded by file (License 5000) ASTERISK-23715 rb3713.patch uploaded by coreyfarrell (License 5909) rb3689.patch uploaded by mjordan (License 6283) ASTERISK-23957 rb3722.patch uploaded by mjordan (License 6283) mf-attributes-3.diff uploaded by file (License 5000) ASTERISK-23958 Tested by: jrose rb3822.patch uploaded by coreyfarrell (License 5909) rb3800.patch uploaded by jrose (License 6182) chan_sip.diff uploaded by mjordan (License 6283) rb3747.patch uploaded by jrose (License 6182) ASTERISK-23959 #close Tested by: sgriepentrog, mjordan, coreyfarrell sip_cleanup.diff uploaded by opticron (License 6273) chan_sip_caps.diff uploaded by mjordan (License 6283) rb3751.patch uploaded by coreyfarrell (License 5909) chan_sip-3.diff uploaded by file (License 5000) ASTERISK-23960 #close Tested by: opticron direct_media.diff uploaded by opticron (License 6273) pjsip-direct-media.diff uploaded by file (License 5000) format_cap_remove.diff uploaded by opticron (License 6273) media_format_fixes.diff uploaded by opticron (License 6273) chan_pjsip-2.diff uploaded by file (License 5000) ASTERISK-23966 #close Tested by: rmudgett rb3803.patch uploaded by rmudgetti (License 5621) chan_dahdi.diff uploaded by file (License 5000) ASTERISK-24064 #close Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose rb3814.patch uploaded by rmudgett (License 5621) moh_cleanup.diff uploaded by opticron (License 6273) bridge_leak.diff uploaded by opticron (License 6273) translate.diff uploaded by file (License 5000) rb3795.patch uploaded by rmudgett (License 5621) tls_fix.diff uploaded by mjordan (License 6283) fax-mf-fix-2.diff uploaded by file (License 5000) rtp_transfer_stuff uploaded by mjordan (License 6283) rb3787.patch uploaded by rmudgett (License 5621) media-formats-explicit-translate-format-3.diff uploaded by file (License 5000) format_cache_case_fix.diff uploaded by opticron (License 6273) rb3774.patch uploaded by rmudgett (License 5621) rb3775.patch uploaded by rmudgett (License 5621) rtp_engine_fix.diff uploaded by opticron (License 6273) rtp_crash_fix.diff uploaded by opticron (License 6273) rb3753.patch uploaded by mjordan (License 6283) rb3750.patch uploaded by mjordan (License 6283) rb3748.patch uploaded by rmudgett (License 5621) media_format_fixes.diff uploaded by opticron (License 6273) rb3740.patch uploaded by mjordan (License 6283) rb3739.patch uploaded by mjordan (License 6283) rb3734.patch uploaded by mjordan (License 6283) rb3689.patch uploaded by mjordan (License 6283) rb3674.patch uploaded by coreyfarrell (License 5909) rb3671.patch uploaded by coreyfarrell (License 5909) rb3667.patch uploaded by coreyfarrell (License 5909) rb3665.patch uploaded by mjordan (License 6283) rb3625.patch uploaded by coreyfarrell (License 5909) rb3602.patch uploaded by coreyfarrell (License 5909) format_compatibility-2.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-30apps/app_voicemail: Fix compilation error introduced in r417591Matthew Jordan
Not sure why that change to ast_channel_alloc was made but ... okay. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417649 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-30app_voicemail, say: Add support for Japanese LanguageMatthew Jordan
This patch adds support for the Japanese language to both the say family of applications, as well as for VoiceMail and VoiceMailMain. A new pack of language sounds will be released at the same time as the next major version of Asterisk to support the new language features. The language features can be enabled using a language code of 'ja'. Review: https://reviewboard.asterisk.org/r/3477 ASTERISK-23324 #close Reported by: Kevin McCoy patches: app_voicemail.c.20140226.jb.patch uploaded by Kevin McCoy (License 6586) say.c.20140226.jb.patch uploaded by Kevin McCoy (License 6586) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417591 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-20voicemail API callbacks: Extract the sayname API call to its own registerd ↵Richard Mudgett
callback. * Extract the sayname API call to its own registerd callback. This allows the app_directory and app_chanspy applications to say a mailbox owner's name using an alternate provider when app_voicemail is not available because you are using res_mwi_external. app_directory still uses the voicemail.conf file. AFS-64 #close Reported by: Mark Michelson git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-28Logger/CLI/etc.: Fix some aesthetic issues; reduce chatty verbose messagesMatthew Jordan
This patch addresses some aesthetic issues in Asterisk. These are all just minor tweaks to improve the look of the CLI when used in a variety of settings. Specifically: * A number of chatty verbose messages were removed or demoted to DEBUG messages. Verbose messages with a verbosity level of 5 or higher were - if kept as verbose messages - demoted to level 4. Several messages that were emitted at verbose level 3 were demoted to 4, as announcement of dialplan applications being executed occur at level 3 (and so the effects of those applications should generally be less). * Some verbose messages that only appear when their respective 'debug' options are enabled were bumped up to always be displayed. * Prefix/timestamping of verbose messages were moved to the verboser handlers. This was done to prevent duplication of prefixes when the timestamp option (-T) is used with the CLI. * Verbose magic is removed from messages before being emitted to non-verboser handlers. This prevents the magic in multi-line verbose messages (such as SIP debug traces or the output of DumpChan) from being written to files. * _Slightly_ better support for the "light background" option (-W) was added. This includes using ast_term_quit in the output of XML documentation help, as well as changing the "Asterisk Ready" prompt to bright green on the default background (which stands a better chance of being displayed properly than bright white). Review: https://reviewboard.asterisk.org/r/3547/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
This resolves a large number of compiler warnings from GCC 4.10 which cause the build to fail under dev mode. The vast majority are signed/unsigned mismatches in printf-style format strings. ........ Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-27Fix dialplan function NULL channel safety issuesCorey Farrell
(closes issue ASTERISK-23391) Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/3386/ ........ Merged revisions 411313 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 411314 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 411315 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411328 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07uniqueid: channel linkedid, ami, ari object creation with id'sScott Griepentrog
Much needed was a way to assign id to objects on creation, and much change was necessary to accomplish it. Channel uniqueids and linkedids are split into separate string and creation time components without breaking linkedid propgation. This allowed the uniqueid to be specified by the user interface - and those values are now carried through to channel creation, adding the assignedids value to every function in the chain including the channel drivers. For local channels, the second channel can be specified or left to default to a ;2 suffix of first. In ARI, bridge, playback, and snoop objects can also be created with a specified uniqueid. Along the way, the args order to allocating channels was fixed in chan_mgcp and chan_gtalk, and linkedid is no longer lost as masquerade occurs. (closes issue ASTERISK-23120) Review: https://reviewboard.asterisk.org/r/3191/ ........ Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-06app_voicemail: Explicitly set defaultenabled=yesRichard Mudgett
........ Merged revisions 405006 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405007 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-06External MWI core support.Richard Mudgett
* The core external MWI resource provides for MWI message counts persistence using sorcery. With sorcery, the user is able to configure which sorcery wizzard backend to use if the default astdb is not desired. * The core external MWI resoruce provides some debugging CLI commands enabled by defining MWI_DEBUG_CLI. The debugging CLI commands are: "mwi delete all", "mwi delete like <regex>", "mwi delete mailbox <mailbox>", "mwi list all", "mwi list like <regex>", "mwi show mailbox <mailbox>", and "mwi update mailbox <mailbox> [<new> [<old>]]". (closes issue AFS-43) Review: https://reviewboard.asterisk.org/r/3061/ ........ Merged revisions 404952 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19Voicemail: Remove mailbox identifier format (box@context) assumptions in the ↵Richard Mudgett
system. This change is in preparation for external MWI support. Removed code from the system for normal mailbox handling that appends @default to the mailbox identifier if it does not have a context. The only exception is the legacy hasvoicemail users.conf option. The legacy option will only work for app_voicemail mailboxes. The system cannot make any assumptions about the format of the mailbox identifer used by app_voicemail. chan_sip and chan_dahdi/sig_pri had the most changes because they both tried to interpret the mailbox identifier. chan_sip just stored and compared the two components. chan_dahdi actually used the box information. The ISDN MWI support configuration options had to be reworked because chan_dahdi was parsing the box@context format to get the box number. As a result the mwi_vm_boxes chan_dahdi.conf option was added and is documented in the chan_dahdi.conf.sample file. Review: https://reviewboard.asterisk.org/r/3072/ ........ Merged revisions 404348 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-18channel locking: Add locking for channel snapshot creationKevin Harwell
Original commit message by mmichelson (asterisk 12 r403311): "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." The above was initially committed and then reverted at r403398. The problem was found to be in core_local.c in the publish_local_bridge_message function. The ast_unreal_lock_all function locks and adds a reference to the returned channels and while they were being unlocked they were not being unreffed when no longer needed. Fixed by unreffing the channels. Also in bridge.c a lock was obtained on "other->chan", but then an attempt was made to unlock "other" and not the previously locked channel. Fixed by unlocking "other->chan" (closes issue ASTERISK-22709) Reported by: John Bigelow ........ Merged revisions 404237 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-18channels: Return allocated channels locked.Joshua Colp
This change makes ast_channel_alloc return allocated channels locked. By doing so no other thread can acquire, lock, and manipulate the channel before it is completely set up. (closes issue AST-1256) Review: https://reviewboard.asterisk.org/r/3067/ ........ Merged revisions 404204 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-11app_voicemail: Voicemail callback registration/unregistration function ↵Richard Mudgett
improvements. * The voicemail registration/unregistration functions now take a struct of callbacks instead of a lengthy parameter list of callbacks. * The voicemail registration/unregistration functions now prevent a competing module from interfering with an already registered callback supplying module. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403643 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-05Reverting r403311. It's causing ARI tests to hang.David M. Lee
........ Merged revisions 403398 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403404 65c4cc65-6c06-0410-ace0-fbb531ad65f3