summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-03-17core: Introduce chaos into memory allocationsScott Griepentrog
Locate potential crashes by exercising seldom used code paths. This patch introduces a new define DEBUG_CHAOS, and mechanism to randomly return an error condition from functions that will seldom do so. Functions that handle the allocation of memory get the first treatment. Review: https://reviewboard.asterisk.org/r/4463/ ........ Merged revisions 433060 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17Reverting accidental ci of wrong change in r433061Scott Griepentrog
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433062 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17various: cleanup issues found during leak huntScott Griepentrog
In this collection of small patches to prevent Valgrind errors are: fixes for reference leaks in config hooks, evaluating a parameter beyond bounds, and accessing a structure after a lock where it could have been already free'd. Review: https://reviewboard.asterisk.org/r/4407/ ........ Merged revisions 431583 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17Audit ast_sockaddr_resolve() usage for memory leaks.Richard Mudgett
Valgrind found some memory leaks associated with ast_sockaddr_resolve(). Most of the leaks had already been fixed by earlier memory leak hunt patches. This patch performs an audit of ast_sockaddr_resolve() and found one more. * Fix ast_sockaddr_resolve() memory leak in apps/app_externalivr.c:app_exec(). * Made main/netsock2.c:ast_sockaddr_resolve() always set the addrs parameter for safety so the pointer will never be uninitialized on return. The same goes for res/res_pjsip_acl.c:extract_contact_addr(). * Made functions that call ast_sockaddr_resolve() with RAII_VAR() controlling the addrs variable use ast_free instead of ast_free_ptr to provide better MALLOC_DEBUG information. Review: https://reviewboard.asterisk.org/r/4509/ ........ Merged revisions 433056 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433057 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433058 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17res_pjsip: Allow configuration of endpoint identifier query orderKevin Harwell
Updated some documentation stating that endpoint identifiers registered without a name are place at the front of the lookup list. Also renamed register method 'ast_sip_register_endpoint_identifier_by_name' to 'ast_sip_register_endpoint_identifier_with_name' ASTERISK-24840 Reported by: Mark Michelson ........ Merged revisions 433031 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17res_pjsip: Allow configuration of endpoint identifier query orderKevin Harwell
This patch fixes previously reverted code that caused binary incompatibility problems with some modules. And like the original patch it makes sure that no matter what order the endpoint identifier modules were loaded, priority is given based on the ones specified in the new global 'endpoint_identifier_order' option. ASTERISK-24840 Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/4489/ ........ Merged revisions 433028 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17res_pjsip: Add reason comment.Richard Mudgett
........ Merged revisions 433005 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433006 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-14main/frame: Don't report empty disallow values as an errorMatthew Jordan
In realtime, it is normal to have a database with both 'allow' and 'disallow' columns in the schema. It is perfectly valid to have an 'allow' value of '!all,g722,ulaw,alaw' and no 'disallow' value. Unlike in static conf files, you can't *not* provide the disallow value. Thus, the empty disallow value causes a spurious WARNING message, which is kind of annoying. This patch makes it so that a 'disallow' value with no ... value ... is ignored. Granted, you can still screw this up as well, as technically specifying 'disallow=all,!ulaw' allows only ulaw, and then you would have no 'allow' value in your database. But really, why would you do that? WHY? ASTERISK-16779 #close Reported by: Atis Lezdins ........ Merged revisions 432970 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432971 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432972 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-14func_curl: Don't hold exclusive lock when performing HTTP request.Joshua Colp
This code originally kept a lock held when performing the HTTP request to ensure that the options provided to curl remain valid. This doesn't seem to be necessary these days and holding the lock caused requests to happen sequentially instead of in parallel. ASTERISK-18708 #close Reported by: Dave Cabot ........ Merged revisions 432948 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432949 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-14apps/app_sms: Add an option to prevent SMS content from being loggedMatthew Jordan
In some countries, privacy laws specify that SMS content cannot be saved by a provider. This patch adds a new option to the SMS application, 'n', which prevents the SMS content from being written to the SMS log. ASTERISK-22591 #close Reported by: Jan Juergens patches: DisableSmsContentLoggingByParam.patch uploaded by Jan Juergens (License 6538) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-14core: Fix tab completion of "core set debug channel" CLI command.Joshua Colp
The "core set debug channel" CLI command mistakenly had source filenames added to its tab completion. This occurred because the CLI generator fell back to the "core set debug" command which permits setting debug at a source filename level. ASTERISK-21038 #close Reported by: Richard Kenner ........ Merged revisions 432944 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432945 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432946 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-14FILE: fix retrieval of file contents when offset is specifiedMatthew Jordan
The loop that reads in a file was not correctly using the offset when determining what bytes to append to the output. This patch corrects the logic such that the correct portion of the file is extracted when an offset is specified. ASTERISK-21765 Reported by: John Zhong Tested by: Matt Jordan, Di-Shi Sun patches: file_read_390821.patch uploaded by Di-Shi Sun (License 5076) ........ Merged revisions 432935 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432938 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432940 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-14apps/app_amd: Document maximum_word_length option; fix AMDCAUSE documentationMatthew Jordan
This patch corrects the documentation for the AMD application. Specifically: * It documents the maximum_word_length option, which limits the maximum allowed length of a single utterance. * It clarifies the AMDCAUSE values MAXWORDS and MAXWORDLENGTH. MAXWORDLENGTH was documented as MAXWORDS, while MAXWORDS was undocumented. Thanks to the issue reporter, Frank DiGennaro, for pointing out the issues. ASTERISK-19470 #close Reported by: Frank DiGennaro ........ Merged revisions 432918 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432920 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13chan_pjsip: AMI action PJSIPShowEndpoint closes AMI connection on error.Richard Mudgett
Also fixed similar problem with AMI action PJSIPShowEndpoints. ASTERISK-24872 #close Reported by: Dmitriy Serov Review: https://reviewboard.asterisk.org/r/4487/ ........ Merged revisions 432894 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432895 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13chan_pjsip/res_pjsip_callerid: Make Party ID handling simpler and consistent.Richard Mudgett
The res_pjsip modules were manually checking both name and number presentation values when there is a function that determines the combined presentation for a party ID struct. The function takes into account if the name or number components are valid while the manual code rarely checked if the data was even valid. * Made use ast_party_id_presentation() rather than manually checking party ID presentation values. * Ensure that set_id_from_pai() and set_id_from_rpid() will not return presentation values other than what is pulled out of the SIP headers. It is best if the code doesn't assume that AST_PRES_ALLOWED and AST_PRES_USER_NUMBER_UNSCREENED are zero. * Fixed copy paste error in add_privacy_params() dealing with RPID privacy. * Pulled the id->number.valid test from add_privacy_header() and add_privacy_params() up into the parent function add_id_headers() to skip adding PAI/RPID headers earlier. * Made update_connected_line_information() not send out connected line updates if the connected line number is invalid. Lower level code would not add the party ID information and thus the sent message would be unnecessary. * Eliminated RAII_VAR usage in send_direct_media_request(). Review: https://reviewboard.asterisk.org/r/4472/ ........ Merged revisions 432892 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432893 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13Revert - res_pjsip: Allow configuration of endpoint identifier query orderKevin Harwell
Due to a break in binary compatibility with some other modules these changes are being reverted until the issue can be resolved. ASTERISK-24840 Reported by: Mark Michelson ........ Merged revisions 432868 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13Logger: Fix MALLOC_DEBUG build error.Corey Farrell
Revision 432834 introduced a build error when MALLOC_DEBUG is used. Switch callid threadstorage to simple AST_THREADSTORAGE since we no longer need custom cleanup. Reported by: Corey Farrell git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432851 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13Logger: Convert 'struct ast_callid' to unsigned int.Corey Farrell
Switch logger callid's from AO2 objects to simple integers. This helps in two ways. Copying integers is faster than referencing AO2 objects, so this will result in a small reduction in logger overhead. This also erases the possibility of an infinate loop caused by an invalid callid in threadstorage. ASTERISK-24833 #comment Committed callid conversion to trunk. Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4466/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-12main/audiohook: Update internal sample rate on readsMatthew Jordan
When an audiohook is created (which is used by the various Spy applications and Snoop channel in Asterisk 13+), it initially is given a sample rate of 8kHz. It is expected, however, that this rate may change based on the media that passes through the audiohook. However, the read/write operations on the audiohook behave very differently. When a frame is written to the audiohook, the format of the frame is checked against the internal sample rate. If the rate of the format does not match the internal sample rate, the internal sample rate is updated and a new SLIN format is chosen based on that sample rate. This works just fine. When a frame is read, however, we do something quite different. If the format rate matches the internal sample rate, all is fine. However, if the rates don't match, the audiohook attempts to "fix up" the number of samples that were requested. This can result in some seriously large number of samples being requested from the read/write factories. Consider the worst case - 192kHz SLIN. If we attempt to read 20ms worth of audio produced at that rate, we'd request 3840 samples (192000 / (1000 / 20)). However, if the audiohook is still expecting an internal sample rate of 8000, we'll attempt to "fix up" the requested samples to: samples_converted = samples * (ast_format_get_sample_rate(format) / (float) audiohook->hook_internal_samp_rate); which is: 92160 = 3840 * (192000 / 8000) This results in us attempting to read 92160 samples from our factories, as opposed to the 3840 that we actually wanted. On a 64-bit machine, this miraculously survives - despite allocating up to two buffers of length 92160 on the stack. The 32-bit machines aren't quite so lucky. Even in the case where this works, we will either (a) get way more samples than we wanted; or (b) get about 3840 samples, assuming the timing is pretty good on the machine. Either way, the calculation being performed is wrong, based on the API users expectations. My first inclination was to allocate the buffers on the heap. As it is, however, there's at least two drawbacks with doing this: (1) It's a bit complicated, as the size of the buffers may change during the lifetime of the audiohook (ew). (2) The stack is faster (yay); the heap is slower (boo). Since our calculation is flat out wrong in the first place, this patch fixes this issue by instead updating the internal sample rate based on the format passed into the read operation. This causes us to read the correct number of samples, and has the added benefit of setting the audihook with the right SLIN format. Note that this issue was caught by the Asterisk Test Suite as a result of r432195 in the 13 branch. Because this issue is also theoretically possible in Asterisk 11, the change is being made here as well. Review: https://reviewboard.asterisk.org/r/4475/ ........ Merged revisions 432810 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432811 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432812 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-12Add support for the clang compiler; update RAII_VAR to use BlocksRuntimeMatthew Jordan
RAII_VAR, which is used extensively in Asterisk to manage reference counted resources, uses a GCC extension to automatically invoke a cleanup function when a variable loses scope. While this functionality is incredibly useful and has prevented a large number of memory leaks, it also prevents Asterisk from being compiled with clang. This patch updates the RAII_VAR macro such that it can be compiled with clang. It makes use of the BlocksRuntime, which allows for a closure to be created that performs the actual cleanup. Note that this does not attempt to address the numerous warnings that the clang compiler catches in Asterisk. Much thanks for this patch goes to: * The folks on StackOverflow who asked this question and Leushenko for providing the answer that formed the basis of this code: http://stackoverflow.com/questions/24959440/rewrite-gcc-cleanup-macro-with-nested-function-for-clang * Diederik de Groot, who has been extremely patient in working on getting this patch into Asterisk. Review: https://reviewboard.asterisk.org/r/4370/ ASTERISK-24133 ASTERISK-23666 ASTERISK-20399 ASTERISK-20850 #close Reported by: Diederik de Groot patches: RAII_CLANG.patch uploaded by Diederik de Groot (License 6600) ........ Merged revisions 432807 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432808 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-11res_pjsip: Move internal init/destroy prototypes to private header file.Richard Mudgett
Done as a separate commit from a finding in https://reviewboard.asterisk.org/r/4467/ ........ Merged revisions 432787 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432788 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-11res_pjsip: Fix pjsip.conf type=global object default value handling.Richard Mudgett
When a type=global section is not defined in pjsip.conf the global defaults are not applied. As a result the mandatory Max-Forwards header is not added to SIP messages for res_pjsip/chan_pjsip. The handling of pjsip.conf type=global objects has several problems: 1) If the global object is missing the defaults are not applied. 2) If the global object is missing the default_outbound_endpoint's default value is not returned by ast_sip_global_default_outbound_endpoint(). 3) Defines are needed so default values only need to be changed in one place. * Added a sorcery instance observer callback to check if there were any type=global sections loaded. If there were more than one then issue an error message. If there were none then apply the global defaults. * Fixed ast_sip_global_default_outbound_endpoint() to return the documented default when no type=global object is defined. * Made defines for the global default values. * Increased the default_useragent[] size because SVN version strings can get lengthy and 128 characters may not be enough. * Fixed an off-nominal code path ref leak in global_alloc() if the string fields fail to initialize. * Eliminated RAII_VAR in get_global_cfg() and ast_sip_global_default_outbound_endpoint(). ASTERISK-24807 #close Reported by: Anatoli Review: https://reviewboard.asterisk.org/r/4467/ ........ Merged revisions 432766 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432767 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-11res_pjsip: Fixed invalid empty Server and User-Agent SIP headers.Richard Mudgett
Setting pjsip.conf useragent to an empty string results in an empty SIP header being sent. * Made not add an empty SIP header item to the global SIP headers list. Review: https://reviewboard.asterisk.org/r/4467/ ........ Merged revisions 432764 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432765 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-10core: Don't create snapshots with locks.Joshua Colp
Snapshots are immutable and are never changed. Allocating them with a lock is wasteful. Review: https://reviewboard.asterisk.org/r/4469/ ........ Merged revisions 432742 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432743 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-10res/res_config_odbc: Fix improper escaping of backslashes with MySQLMatthew Jordan
When escaping backslashes with MySQL, the proper way to escape the characters in a LIKE clause is to escape the '\' four times, i.e., '\\\\'. To quote the MySQL manual: "Because MySQL uses C escape syntax in strings (for example, “\n” to represent a newline character), you must double any “\” that you use in LIKE strings. For example, to search for “\n”, specify it as “\\n”. To search for “\”, specify it as “\\\\”; this is because the backslashes are stripped once by the parser and again when the pattern match is made, leaving a single backslash to be matched against." ASTERISK-24808 #close Reported by: Javier Acosta patches: res_config_odbc.diff uploaded by Javier Acosta (License 6690) ........ Merged revisions 432720 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432721 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432722 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 ........ Merged revisions 432696 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432697 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-10localtime: Fix file descriptor leak on kqueue(2) systemsMatthew Jordan
The localtime management in the Asterisk core contains a thread that watches for changes in the local timezone. On systems where the directory containing /etc/localtime is modified frequently, the thread monitoring the changes will be woken up to determine if any changes in timezone have occurred. When using kqueue(2), this can cause a leak of file descriptors due to some improper management of resources. This patch updates the kqueue(2) handling in localtime, such that is no longer leaks resources. Review: https://reviewboard.asterisk.org/r/4450/ ASTERISK-24739 #close Reported by: Ed Hynan patches: 11.15.0-u.diff uploaded by Ed Hynan (Licnese 6680) 11.7.0-u.diff uploaded by Ed Hynan (License 6680) svn-trunk-Jan-26-2015-u.diff uploaded by Ed Hynan (License 6680) ........ Merged revisions 432691 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432693 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-10res_pjsip_refer: Fix occasional unexpected BYE sent after receiving a REFER.Richard Mudgett
A race condition happened between initiating a transfer and requesting that a dialog termination be delayed. Occasionally, the transferrer channels would exit the bridge and hangup before the dialog termination delay was requested. * Made request dialog termination delay before initiating the transfer action. If the transfer fails then cancel the delayed dialog termination request. ASTERISK-24755 #close Reported by: John Bigelow Review: https://reviewboard.asterisk.org/r/4460/ ........ Merged revisions 432668 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432669 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-09res_pjsip: allow configuration of endpoint identifier query orderKevin Harwell
It's possible to have a scenario that will create a conflict between endpoint identifiers. For instance an incoming call could be identified by two different endpoint identifiers and the one chosen depended upon which identifier module loaded first. This of course causes problems when, for example, the incoming call is expected to be identified by username, but instead is identified by ip. This patch adds a new 'global' option to res_pjsip called 'endpoint_identifier_order'. It is a comma separated list of endpoint identifier names that specifies the order by which identifiers are processed and checked. ASTERISK-24840 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/4455/ ........ Merged revisions 432638 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-08res_rtp_asterisk: Fix wrongful use of USE_PJPROJECT define.Joshua Colp
As pjproject is now used as a shared library a different define, HAVE_PJPROJECT, is used to specify if pjproject is present. ASTERISK-24830 #close Reported by: Stefan Engström ........ Merged revisions 432614 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432615 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-06res_pjsip_refer: Make safely get the context for a blind transfer.Richard Mudgett
Made safely get the TRANSFER_CONTEXT channel value while the channel is locked in refer_incoming_attended_request() and refer_incoming_blind_request(). The pointer returned by pbx_builtin_getvar_helper() is only valid while the channel is locked. ........ Merged revisions 432594 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432595 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-06res_pjsip_refer: Made refer_attended_alloc() not create the ao2 object with ↵Richard Mudgett
a lock. The lock is unused. ........ Merged revisions 432574 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432579 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-06app: Add functions to swap voicemail function table for testing purposesJonathan Rose
........ Merged revisions 432556 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-06chan_dahdi/sig_analog: Fix distinctive ring detection to suck less.Richard Mudgett
The distinctive ring feature interferes with detecting Caller ID and appears to have been broken for years. What happens is if you have a ring-ring cadence as used in the UK you get too many DAHDI events for the distinctive ring pattern array and Caller ID detection is aborted. I think when Zapata/DAHDI added the ring begin event it broke distinctive ring. More events happen than before and the code does no filtering of which event times are recorded in the pattern array. * Made distinctive ring only record the ringt count when the ring ends instead of on just any DAHDI event. Distinctive ring can be ring, ring-ring, ring-ring-ring, or different ring durations for the up to three rings. * Fixed the distinctive ring detection enable (chan_dahdi.conf option usedistinctiveringdetection) to be per port instead of somewhat per port and somewhat global. This has been broken since v1.8. * Fixed using the default distinctive ring context when the detected pattern does not match any configured dringX patterns. The default context did not get set when the previous call was a matched distinctive ring pattern and the current call is not matched. This has been broken since v1.8. * Made distinctive ring have no effect on Caller ID detection when it is disabled. Caller ID detection just monitors for 10 seconds before giving up. * Fixed leak of struct callerid_state memory when a polarity reversal during Caller ID detection causes the incoming call to be aborted. DAHDI-1143 AST-1545 ASTERISK-24825 #close Reported by: Richard Mudgett ASTERISK-17588 Reported by: Daniel Flounders Review: https://reviewboard.asterisk.org/r/4444/ ........ Merged revisions 432530 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432534 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-06chan_sip: Fix realtime locking inversion when poking a just built peer.Richard Mudgett
When a realtime peer is built it can cause a locking inversion when the just built peer is poked. If the CLI command "sip show channels" is periodically executed then a deadlock can happen because of the locking inversion. * Push the peer poke off onto the scheduler thread to avoid the locking inversion of the just built realtime peer. AST-1540 ASTERISK-24838 #close Reported by: Richard Mudgett Review: https://reviewboard.asterisk.org/r/4454/ ........ Merged revisions 432526 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432528 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432529 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 ........ Merged revisions 432485 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432486 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-04translate: Prevent invalid memory accesses on fast shutdownMatthew Jordan
When a 'core restart now' or 'core stop now' is executed and a channel is currently in a media operation, the translator matrix can be destroyed while a channel is currently blocked on getting the best translation choice (see ast_translator_best_choice). When the channel gets the mutex, the translation matrix now has invalid memory, and Asterisk crashes. This patch does two things: (1) We now only clean up the translation matrix on a graceful shutdown. In that case, there are no channels, and so there is no risk of this occurring. (2) We also now set the __matrix and __indextable to NULL. In some initial backtraces when this occurred, it looked as if there was a memory corruption occurring, and it wasn't until we determined that something had restarted Asterisk that the issue became clear. By setting these to NULL on shutdown, it becomes a bit easier to determine why a crash is occurring. Note that we could litter the code with NULL checks on the __matrix, but the act of making the translation matrix cleaned up on shutdown should preclude this issue from occurring in the first place, and this part of the code needs to be as fast as possible. Review: https://reviewboard.asterisk.org/r/4457/ ........ Merged revisions 432453 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432455 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-02res/res_pjsip_sdp_rtp: Revert portion of r432195Matthew Jordan
Unfortunately, while initial testing with ConfBridge did not reproduce the audio problem alluded to in the comment in res_pjsip_sdp_rtp, further testing did show that bridge_softmix and/or ConfBridge has a severe problem bridging two or more participants at different sampling rates. Sometimes, it even picks odd sampling rates that cause hideous audio problems. This patch backs out the offending portion of the code until the issues in the affected bridging modules can be more properly analyzed. ASTERISK-24841 ........ Merged revisions 432423 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-27ARI: Fix crash if integer values used in JSON payload 'variables' object.Richard Mudgett
Sending the following ARI commands caused Asterisk to crash if the JSON body 'variables' object passes values of types other than strings. POST /ari/channels POST /ari/channels/{channelid} PUT /ari/endpoints/sendMessage PUT /ari/endpoints/{tech}/{resource}/sendMessage * Eliminated RAII_VAR usage in ast_ari_channels_originate_with_id(), ast_ari_channels_originate(), ast_ari_endpoints_send_message(), and ast_ari_endpoints_send_message_to_endpoint(). ASTERISK-24751 #close Reported by: jeffrey putnam Review: https://reviewboard.asterisk.org/r/4447/ ........ Merged revisions 432404 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432405 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-26Dial API: add self destruct option when completeScott Griepentrog
This patch adds a self-destruction option to the dial api. The usefulness of this is mostly when using async mode to spawn a separate thread used to handle the new call, while the calling thread is allowed to go on about other business. The only alternative to this option would be the calling thread spawning a new thread, or hanging around itself waiting to destroy the dial struct after completion. Example of use (minus error checking): struct ast_dial *dial = ast_dial_create(); ast_dial_append(dial, "PJSIP", "200", NULL); ast_dial_option_global_enable(dial, AST_DIAL_OPTION_ANSWER_EXEC, "Echo"); ast_dial_option_global_enable(dial, AST_DIAL_OPTION_SELF_DESTROY, NULL); ast_dial_run(dial, NULL, 1); The dial_run call will return almost immediately after spawning the new thread to run and monitor the dial. If the call is answered, it is placed into the echo app. When completed, it will call ast_dial_destroy() on the dial structure. Note that any allocations made to pass values to ast_dial_set_user_data() or dial options must be free'd in a state callback function on any of: AST_DIAL_RESULT_UNASWERED, AST_DIAL_RESULT_ANSWERED, AST_DIAL_RESULT_HANGUP, or AST_DIAL_RESULT_TIMEOUT. Review: https://reviewboard.asterisk.org/r/4443/ ........ Merged revisions 432385 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-26app_chanspy, channel: fix frame leaksKevin Harwell
Fixed a couple of frame leaks that were found during testing. ASTERISK-24828 #close Reported by: John Hardin Review: https://reviewboard.asterisk.org/r/4445/ ........ Merged revisions 432362 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432363 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-26make: Remove 'res_features' from libraries to link against with cygwin/mingw32Matthew Jordan
Both the apps and channels Makefiles still listed 'res_features' as modules to link against when compiling for cygwin or mingw32. This module hasn't existed for quite some time. ASTERISK-18105 #close Reported by: feyfre ........ Merged revisions 432341 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432342 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-26channels/chan_sip: Don't send a BYE after final response when PBX thread failsMatthew Jordan
When Asterisk fails to start a PBX thread for a new channel - for example, when the maxcalls setting in asterisk.conf is exceeded - we currently send a final response, and then attempt to send a BYE request to the UA. Since that's all sorts of wrong, this patch fixes that by setting sipalreadygone on the sip_pvt such that we don't get stuck sending BYE requests to something that does not want it. Note that this patch is a slight modification of the one on ASTERISK-15434. For clarity, it explicitly calls sipalreadygone with the calls to transmit a final response. ASTERISK-21845 ASTERISK-15434 #close Reported by: Makoto Dei Tested by: Matt Jordan patches: sip-pbxstart-failed.patch uploaded by Makoto Dei (License 5027) ........ Merged revisions 432320 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432321 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432322 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25configs/basic-pbx - Super Awesome Company example configs Phase 1, Patch 1Rusty Newton
Example configuration files for a "basic PBX" deployment for the fictitious Super Awesome Company. Details at https://reviewboard.asterisk.org/r/4379/ and https://wiki.asterisk.org/wiki/display/AST/Super+Awesome+Company Reported by: Malcolm Davenport Tested by: Rusty Newton Review: https://reviewboard.asterisk.org/r/4379/ ........ Merged revisions 432301 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25configure: Promote SQLite3 "not installed" warning to errorMatthew Jordan
Since Asterisk won't build without the library, not having it is definitely an error. Thanks to Kyle Kurz for pointing this out. ........ Merged revisions 432280 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432281 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25channels/chan_sip: Clarify WARNING message in mismatched SRTP scenarioMatthew Jordan
When we receive an SDP as part of an offer/answer for a peer/friend has been configured to require encryption, and that SDP offer/answer failed to provide acceptable crypto attributes, we currently issue a WARNING that uses the phrase "we" and "requested". In this case, both of those terms are ambiguous - the user will probably think "we" is Asterisk (it most likely isn't) and it may not be a "request", so much as an SDP that was received in some fashion. This patch makes the WARNING messages slightly less bad and a bit more accurate as well. ASTERISK-23214 #close Reported by: Rusty Newton ........ Merged revisions 432277 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432278 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25channels/sip/sdp_crypto: Handle SRTP keys negotiated with key lifetime/MKIMatthew Jordan
Prior to this patch, SDP offers negotiating SDES-SRTP crypto attributes would be rejected if those crypto attributes contained either a key lifetime or a MKI parameter. While from a theoretical point of view this was defensible - Asterisk does not support key lifetimes or multiple crypto keys - from a practical point of view, this is quite a problem. A large number of endpoints offer lifetimes/MKI, which Asterisk can tolerate so long as it doesn't actually have to support anything more than a single key or refresh the key. In reality, this is (so far as we've seen) always the case. This patch is a forward port of Olle's work in the lingon-srtp-key-lifetime-1.8 branch. To quote Olle from ASTERISK-17721, it handles lifetime/MKI parameters in the following fashion: > The Lingon branch now handle lifetime and MKI parameters. > > We only accept lifetimes up to max for the crypto and higher than 10 hours > for packetization of 20 ms (50 pps). > > We only handle MKI with index 1. > > We do not really bother with counting packets and reinviting at end of > lifetime, so the min of 10 hours kind of takes care of most calls. If there > are longer ones, we rely on the other side for re-invites. > > It's still not perfect, but I personally think this is an improvement. A > configuration option for minimum lifetime accepted could be added. When the patch was ported forward, I decided against adding a configuration option as Olle's handling was more than sufficient for every case I've seen come through the issue tracker or through interoperability testing. We can revisit that decision if it proves to be false. A few small other tweaks were made to the surrounding code to reduce indentation and provide better type safety for the 'tag' parameter. Review: https://reviewboard.asterisk.org/r/4419/ Review: https://reviewboard.asterisk.org/r/4418/ ASTERISK-17721 #close Reported by: Terry Wilson ASTERISK-17899 #close Reported by: Dwayne Hubbard patches: lingon-srtp-key-lifetime-1.8.diff uploaded by oej (License 5267) ASTERISK-20233 Reported by: tootai ASTERISK-22748 Reported by: Alejandro Mejia ........ Merged revisions 432239 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432258 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25Increase WebSocket frame size and improve large read handlingDavid M. Lee
Some WebSocket applications, like [chan_respoke][], require a larger frame size than the default 8k; this patch bumps the default to 16k. This patch also fixes some problems exacerbated by large frames. The sanity counter was decremented on every fread attempt in ws_safe_read(), regardless of whether data was read from the socket or not. For large frames, this could result in loss of sanity prior to reading the entire frame. (16k frame / 1448 bytes per segment = 12 segments). This patch changes the sanity counter so that it only decrements when fread() doesn't read any bytes. This more closely matches the original intention of ws_safe_read(), given that the error message is "Websocket seems unresponsive". This patch also properly logs EOF conditions, so disconnects are no longer confused with unresponsive connections. [chan_respoke]: https://github.com/respoke/chan_respoke Review: https://reviewboard.asterisk.org/r/4431/ ........ Merged revisions 432236 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432237 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432238 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24config.h: Use real parameter names for ast_variable_new() define.Richard Mudgett
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432220 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24channels/chan_sip: Fix crash when transmitting packet after thread shutdownMatthew Jordan
When the monitor thread is stopped, its pthread ID is set to a specific value (AST_PTHREADT_STOP) so that later portions of the code can determine whether or not it is safe to manipulate the thread. Unfortunately, __sip_reliable_xmit failed to check for that value, checking instead only for AST_PTHREAD_STOP. Passing the invalid yet very specific value to pthread_kill causes a crash. This patch adds a check for AST_PTHREADT_STOP in __sip_reliable_xmit such that it doesn't attempt to poke the thread if the thread has already been stopped. ASTERISK-24800 #close Reported by: JoshE ........ Merged revisions 432198 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432199 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432200 65c4cc65-6c06-0410-ace0-fbb531ad65f3