summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-03-28clang compiler warnings: Fix a variety of "unused" warningsMatthew Jordan
This patch fixes the -Wunused-value -Wunused-variable -Wunused-const-variable errors caught by clang. Specifically: * apps/app_queue.c: removed unused qpm_cmd_usage[], qum_cmd_usage[], qsmp_cmd_usage[] * cel/cel_sqlite3_custom.c: removed unused name[] = "cel_sqlite3_custom" * channels/chan_pjsip.c: removed unused desc[] = "PJSIP Channel" * codecs/gsm/src/gsm_create.c: removed unused ident[] = "$Header$" * funcs/func_env.c:729: Fixed ast_str_append_substr. * main/editline/np/strlcat.c: removed unused rcsid variable * main/editline/np/strlcpy.c: removed unused rcsid variable * main/security_events.c: removed unused TIMESTAMP_STR_LEN * utils/conf2ael.c: removed unused cfextension_states * utils/extconf.c: removed unused cfextension_states Review: https://reviewboard.asterisk.org/r/4526 ASTERISK-24917 Reported by: dkdegroot patches: rb4526.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433693 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28clang compiler warnings: Fix -Wself-assignMatthew Jordan
Assigning a variable to itself isn't super useful. However, the WAV format modules make use of this in order to perform byte endian checks. This patch works around the warning by only performing the self assignment if we are going to do more than just assign it to ourselves. Which is odd, but true. Review: https://reviewboard.asterisk.org/r/4544/ ASTERISK-24917 Reported by: dkdegroot patches: rb4544.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433690 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433691 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28clang compiler warnings: Fix -Wparantheses-equality warningsMatthew Jordan
Clang will treat ((a == b)) as a warning, as it reasonably expects that the developer may have intended to write (a == b) or ((a = b)). This patch cleans up all instances where equality, not assignment, was intended between two parantheses. Review: https://reviewboard.asterisk.org/r/4531/ ASTERISK-24917 Repoted by: dkdegroot patches: rb4531.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433687 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28clang compiler warnings: Fix -Wbitfield-constant-conversion warningMatthew Jordan
In chan_iax2, we attempt to assign a -1 to a bitfield. This gets caught by clang, as it will truncate the -1 to a 1 implicitly. Instead, we just assign the value a '1'. Review: https://reviewboard.asterisk.org/r/4537/ ASTERISK-24917 Reported by: dkdegroot patches: rb4537.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433683 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28clang compiler warnings: Fix -Winitializer-overridesMatthew Jordan
This patch fixes clange compiler warnings for initializer overrides. Specifically: res_pjsip/config_transport maps PJSIP_TLSV1_METHOD to the same enumeration value as PJSIP_SSL_DEFAULT_METHOD. When initializing an array containing those enum values, we therefore initialize the value twice to two different values, "tlsv1" and "default". This patch changes it to just initialize the index in the array to "tlsv1". Review: https://reviewboard.asterisk.org/r/4539/ ASTERISK-24917 Reported by: dkdegroot patches: rb4539.patch submitted by dkdegroot (License 6600) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433682 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28clang compiler warnings: Fix -Wunused-function; make inline function staticMatthew Jordan
This patch fixes clang compilers warnings for unused functions. Specifically: * channels/chan_iax2: removed user_ref function * main/dsp.c: removed goertzel_update function * main/config.c: made variable_list_switch static Review: https://reviewboard.asterisk.org/r/4527 ASTERISK-24917 Reported by: dkdegroot patches: rb4527.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433678 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433680 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27SAC: Add a few basic queuesJonathan Rose
Review: https://reviewboard.asterisk.org/r/4503/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27SAC: Add conferencing extensions and configurationJonathan Rose
Review: https://reviewboard.asterisk.org/r/4504/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433656 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27configs/basic-pbx - Super Awesome Company example configs Phase 1, Patch 2Rusty Newton
Example configuration files for a "basic PBX" deployment for the fictitious Super Awesome Company. Details at https://reviewboard.asterisk.org/r/4488/ and https://wiki.asterisk.org/wiki/display/AST/Super+Awesome+Company Patch 4488 includes all functionality needed for SAC's outside connectivity and some externally accessed features, as well as outbound dialing. Reported by: Malcolm Davenport Tested by: Rusty Newton Review: https://reviewboard.asterisk.org/r/4488/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433624 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27res_pjsip_registrar_expire.c: Made use ao2 container template routines and ↵Richard Mudgett
eliminated some RAII_VAR() usage. * Converted the contact_autoexpire container to use the ao2 template hash and cmp functions. Also made use the OBJ_SEARCH_xxx names instead of the deprecated names. * Eliminates several unnecessary uses of RAII_VAR(). Review: https://reviewboard.asterisk.org/r/4524/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433622 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27Add stateful PJSIP response API call, and use it for out-of-dialog responses.Mark Michelson
Asterisk had an issue where retransmissions of MESSAGE requests resulted in Asterisk processing the retransmission as if it were a new MESSAGE request. This patch fixes the issue by creating a transaction in PJSIP on the incoming request. This way, if a retransmission arrives, the PJSIP transaction layer will resend the response and Asterisk will not ever see the retransmission. ASTERISK-24920 #close Reported by Mark Michelson Review: https://reviewboard.asterisk.org/r/4532/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433619 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27res_pjsip_registrar_expire.c: Cleanup scheduler leaks on unload/shutdown.Richard Mudgett
Contact expiration object refs were leaked when the module was unloaded. * Made empty the scheduler of entries before destroying it to release the object ref held by the scheduler entry. Review: https://reviewboard.asterisk.org/r/4523/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433596 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27res/res_timing_kqueue: Update the module to conform to current timer APIMatthew Jordan
This patch updates the kqueue timing module to conform to current timer API. This fixes issues with using the kqueue timing source on Asterisk 13 on FreeBSD 10. These issues include: - Remove support for kevent64(). The values used to support Asterisk timers fit within 32bits and so can be handled on all platforms via kevent(). - Provide debug logging for, but do not track, unacked events. This matches the behavior of all other timer implementations. - Implement continuous mode by triggering and leaving active, a user event. This ensures that the file descriptor for the timer returns immediately from poll(), without placing the load of a high speed timer on the kernel. - In kqueue_timer_get_max_rate(), don't overstate the capability of the timer. On some platforms, UINT_MAX is greater than INTPTR_MAX, the largest integer type kqueue supports for timers. - In kqueue_timer_get_event(), assume the caller woke up from poll() and just return the mode the timer is currently in. This matches all other timer implementations. - Adjust the test code now that unacked events are not tracked. Review: https://reviewboard.asterisk.org/r/4465/ ASTERISK-24857 #close Reported by: scsiguy Tested by: Ed Hynan patches: rb4465.patch submitted by scsiguy (License 6692) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433574 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27Fix link error for utils/aelparse.Corey Farrell
Use the standard ast_log instead of ast_log_safe for STANDALONE programs. Review: https://reviewboard.asterisk.org/r/4538/ ........ Merged revisions 433549 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27Improved and portable ast_log recursion avoidanceCorey Farrell
This introduces a new logger routine ast_log_safe. This routine should be used for all error messages in code that can be run as a result of ast_log. ast_log_safe does nothing if run recursively. All error logging in astobj2.c, strings.c and utils.h have been switched to ast_log_safe. This required adding support for raw threadstorage. This provides direct access to the void* pointer in threadstorage. In ast_log_safe, NULL is used to signify that this thread is not already running ast_log_safe, (void*)1 when it is already running. This was done since it's critical that ast_log_safe do nothing that could log during recursion checking. ASTERISK-24155 #close Reported by: Timo Teräs Review: https://reviewboard.asterisk.org/r/4502/ ........ Merged revisions 433522 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26Fix compile errors caused by r4500 / r4501.Corey Farrell
* Add ast_register_cleanup to utils/clicompat.c to deal with any utils that copy sources from main. * Asterisk 13+: remove unused variables from core_local.c. Review: https://reviewboard.asterisk.org/r/4534/ ........ Merged revisions 433499 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26Replace most uses of ast_register_atexit with ast_register_cleanup.Corey Farrell
Since 'core stop now' and 'core restart now' do not stop modules, it is unsafe for most of the core to run cleanups. Originally all cleanups used ast_register_atexit, and were only changed when it was shown to be unsafe. ast_register_atexit is now used only when absolutely required to prevent corruption and close child processes. Exceptions that need to use ast_register_atexit: * CDR: Flush records. * res_musiconhold: Kill external applications. * AstDB: Close the DB. * canary_exit: Kill canary process. ASTERISK-24142 #close Reported by: David Brillert ASTERISK-24683 #close Reported by: Peter Katzmann ASTERISK-24805 #close Reported by: Badalian Vyacheslav ASTERISK-24881 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4500/ Review: https://reviewboard.asterisk.org/r/4501/ ........ Merged revisions 433495 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26res_pjsip: Enable unload of all modules at shutdown.Corey Farrell
* Move most of res_pjsip:module_unload to unload_pjsip to resolve crashes caused by running PJSIP functions from non-PJSIP threads. * Remove call to pjsip_endpt_destroy(ast_pjsip_endpoint), it was causing crashes in some cases. In theory pj_shutdown() should take care of this. * Mark res_pjsip_keepalive and res_pjsip_session as allowed to unload at shutdown. * Resolve leaked config global in res_pjsip_notify. * Unregister pubsub pjsip service module. * Implement cleanup for res_pjsip_session. ASTERISK-24731 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4498/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26app_confbridge: file playback blocks dtmfKevin Harwell
Attempting to execute DTMF in a confbridge while file playback (prompt, announcement, etc) is occurring is not allowed. You have to wait until the sound file has completed before entering DTMF. This patch fixes it so that app_confbridge now monitors for dtmf key presses during menu driven file playback. If a key is pressed playback stops and it executes the matched menu option. ASTERISK-24864 #close Reported by: Steve Pitts Review: https://reviewboard.asterisk.org/r/4510/ ........ Merged revisions 433445 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433446 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-25A couple minor cleanup tweaks.Richard Mudgett
* In res/res_sorcery_realtime.c: Broke long line. * In main/bucket.c: Eliminated unnecessary NULL check as ast_sorcery_unref() is NULL tolerant and set the global object to NULL after unref in the system shutdown bucket_cleanup(). git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433420 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-25res_xmpp: Buddies are always auto-registered when processing the rosterMatthew Jordan
Due to a quirk in the configuration handling of res_xmpp, the 'autoregister' setting was never actually processed. This was due to not properly copying over the global settings to the client settings when applying the configuration to the run-time object. Review: https://reviewboard.asterisk.org/r/4496/ ASTERISK-14233 ASTERISK-24780 #close Reported by: Simon Arlott patches: asterisk-13.1.0-24780 uploaded by Simon Arlott (License 5756) ........ Merged revisions 433395 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433396 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-24chan_pjsip: Add "rpid_immediate" option to prevent unnecessary "180 Ringing" ↵Richard Mudgett
messages. Incoming PJSIP call legs that have not been answered yet send unnecessary "180 Ringing" or "183 Progress" messages every time a connected line update happens. If the outgoing channel is also PJSIP then the incoming channel will always send a "180 Ringing" or "183 Progress" message when the outgoing channel sends the INVITE. Consequences of these unnecessary messages: * The caller can start hearing ringback before the far end even gets the call. * Many phones tend to grab the first connected line information and refuse to update the display if it changes. The first information is not likely to be correct if the call goes to an endpoint not under the control of the first Asterisk box. When connected line first went into Asterisk in v1.8, chan_sip received an undocumented option "rpid_immediate" that defaults to disabled. When enabled, the option immediately passes connected line update information to the caller in "180 Ringing" or "183 Progress" messages as described above. * Added "rpid_immediate" option to prevent unnecessary "180 Ringing" or "183 Progress" messages. The default is "no" to disable sending the unnecessary messages. ASTERISK-24781 #close Reported by: Richard Mudgett Review: https://reviewboard.asterisk.org/r/4473/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-22Fix compilations errors on 64-bit OpenBSD systemsMatthew Jordan
In versiong 5.5, OpenBSD went to 64-bit time values. This requires a cast to (long) when printing members of certain time structs. Review: https://reviewboard.asterisk.org/r/4507 ASTERISK-24879 #close Reported by: snuffy Tested by: snuffy patches: openbsd-time64.diff uploaded by snuffy (License 5024) ........ Merged revisions 433268 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-22Fix compilation issues for OpenBSDMatthew Jordan
This patch addresses compilation issues for OpenBSD. Specifically, it addresses: * It allows including <sys/vmmeter.h> in asterisk.c * Provides a needed (size_t) cast in xmldoc.c In 13+, it also addresses a conditional inclusion in loader.c. Review: https://reviewboard.asterisk.org/r/4506 ASTERISK-24880 #close Reported by: snuffy Tested by: snuffy patches: misc-openbsd.diff uploaded by snuffy (License 5024) ........ Merged revisions 433245 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433247 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-20Audit ast_pjsip_rdata_get_endpoint() usage for ref leaks.Richard Mudgett
Valgrind found some memory leaks associated with ast_pjsip_rdata_get_endpoint(). The leaks would manifest when sending responses to OPTIONS requests, processing MESSAGE requests, and res_pjsip supplements implementing the incoming_request callback. * Fix ast_pjsip_rdata_get_endpoint() endpoint ref leaks in res/res_pjsip.c:supplement_on_rx_request(), res/res_pjsip/pjsip_options.c:send_options_response(), res/res_pjsip_messaging.c:rx_data_to_ast_msg(), and res/res_pjsip_messaging.c:send_response(). * Eliminated RAII_VAR() use with ast_pjsip_rdata_get_endpoint() in res/res_pjsip_nat.c:nat_on_rx_message(). * Fixed inconsistent but benign return value in res/res_pjsip/pjsip_options.c:options_on_rx_request(). Review: https://reviewboard.asterisk.org/r/4511/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433222 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-20res_pjsip_sdp_rtp,sorcery: Fix invalid access and memory leak respectively.Richard Mudgett
Valgrind found a memory leak and invalid access. * Fix invalid access by sscanf() being fed a non-nul terminated string of digits in res/res_pjsip_sdp_rtp.c:get_codecs(). * Fix memory leak in main/sorcery.c:sorcery_object_field_destructor(). * Fix potential NULL pointer dereference in main/xmldoc.c:xmldoc_get_syntax_config_option(). Review: https://reviewboard.asterisk.org/r/4513/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433199 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19funcs/func_env: Fix regression caused in FILE read operationMatthew Jordan
When r432935 was merged, it did correctly fix a situation where a FILE read operation on the middle of a file buffer would not read the requested length in the parameters passed to the FILE function. Unfortunately, it would also allow the FILE function to append more bytes than what was available in the buffer if the length exceeded the end of the buffer length. This patch takes the minimum of the remaining bytes in the buffer along with the calculated length to append provided by the original patch, and uses that as the length to append in the return result. This patch also updates the unit tests with the scenarios that were originally pointed out in ASTERISK-21765 that the original implementation treated incorrectly. ASTERISK-21765 ........ Merged revisions 433173 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433174 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19logger: Apply default console logging when configuration cannot be loaded.Corey Farrell
When logger.conf is missing or invalid enable console logging and display an error message. ASTERISK-24817 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4497/ ........ Merged revisions 433122 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19chan_sip: Simplify dialog/peer references, improve REF_DEBUG output.Corey Farrell
* Replace functions for ref/undef of dialogs and peers with macro's to call ao2_t_bump/ao2_t_cleanup. * Enable passthough of REF_DEBUG caller information to sip_alloc and find_call. ASTERISK-24882 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4189/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433115 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19chan_sip: Fix dialog reference leaked to scheduler for reinvite_timeout.Corey Farrell
Release the scheduler reference to the dialog for reinvite timeout during dialog_unlink_all. ASTERISK-24876 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4491/ ........ Merged revisions 433112 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433113 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-18res_pjsip_session: Fix off-nominal extra unref of session.Richard Mudgett
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433088 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17Various: bugfixes found via chaosScott Griepentrog
Using DEBUG_CHAOS several instances of a null pointer crash, and one uninitialized variable were uncovered and fixed. Also added details on why Asterisk failed to initialize. Review: https://reviewboard.asterisk.org/r/4468/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433064 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433060 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433057 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433031 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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17res_pjsip: Add reason comment.Richard Mudgett
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433005 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432971 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432949 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432945 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432938 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432920 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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432894 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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432892 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432868 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432811 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432808 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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432787 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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432766 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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432764 65c4cc65-6c06-0410-ace0-fbb531ad65f3