Commit Graph

26288 Commits

Author SHA1 Message Date
Matthew Jordan 1cf949c489 clang compiler warnings: Fix warning for -Wgnu-variable-sized-type-not-at-end
This patch fixes a warning caught by clang, wherein a variable sized struct is
not located at the end of a struct. While the code in question actually
expected this, this is a good warning to watch for. Hence, this patch refactors
the code in question to not have two variable length elements in the same
struct.

Review: https://reviewboard.asterisk.org/r/4530/

ASTERISK-24917
Reported by: dkdegroot
patches:
  rb4530.patch submitted by dkdegroot (License 6600)
........

Merged revisions 433717 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 433718 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-30 01:53:15 +00:00
Matthew Jordan d2776d4d45 clang compiler warnings: Fix a variety of "unused" warnings
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
........

Merged revisions 433694 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28 12:56:43 +00:00
Matthew Jordan cb7b6bc4be clang compiler warnings: Fix -Wself-assign
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
........

Merged revisions 433691 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433692 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28 12:48:45 +00:00
Matthew Jordan e9520dbe0d clang compiler warnings: Fix -Wparantheses-equality warnings
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
........

Merged revisions 433688 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433689 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28 12:41:24 +00:00
Matthew Jordan fd50e5bfb5 clang compiler warnings: Fix -Wbitfield-constant-conversion warning
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
........

Merged revisions 433684 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433686 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28 12:33:21 +00:00
Matthew Jordan c747b3b12a clang compiler warnings: Fix -Winitializer-overrides
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)
........

Merged revisions 433682 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433685 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28 12:32:42 +00:00
Matthew Jordan d6173cd1d0 clang compiler warnings: Fix -Wunused-function; make inline function static
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
........

Merged revisions 433680 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433681 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28 12:20:26 +00:00
Jonathan Rose b56592e3ae SAC: Add conferencing extensions and configuration
Review: https://reviewboard.asterisk.org/r/4504/
........

Merged revisions 433656 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433657 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 22:26:30 +00:00
Rusty Newton c21e2e45a8 configs/basic-pbx - Super Awesome Company example configs Phase 1, Patch 2
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/
........

Merged revisions 433624 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 21:21:05 +00:00
Richard Mudgett 2659e48d9d res_pjsip_registrar_expire.c: Made use ao2 container template routines and 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/
........

Merged revisions 433622 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 21:06:22 +00:00
Mark Michelson 0b62e41654 Add stateful PJSIP response API call, and use it for out-of-dialog responses.
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/
........

Merged revisions 433619 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 20:46:55 +00:00
Richard Mudgett a18da4eaf2 res_pjsip_registrar_expire.c: Cleanup scheduler leaks on unload/shutdown.
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/
........

Merged revisions 433596 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433617 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 20:23:58 +00:00
Richard Mudgett cb1c639817 Add missing file. ASTERISK-24781
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 17:58:16 +00:00
Matthew Jordan a024af1156 res/res_timing_kqueue: Update the module to conform to current timer API
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)
........

Merged revisions 433574 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 14:41:46 +00:00
Corey Farrell 10458d2878 Fix link error for utils/aelparse.
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
........

Merged revisions 433550 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 12:27:23 +00:00
Corey Farrell 28e3bd0af7 Improved and portable ast_log recursion avoidance
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
........

Merged revisions 433523 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 07:12:25 +00:00
Corey Farrell 554eb74516 Fix compile errors caused by r4500 / r4501.
* 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
........

Merged revisions 433500 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433501 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26 23:09:04 +00:00
Corey Farrell 3ddd92902a Replace most uses of ast_register_atexit with ast_register_cleanup.
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
........

Merged revisions 433497 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26 22:24:26 +00:00
Corey Farrell d7fc85e69d res_pjsip: Enable unload of all modules at shutdown.
* 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/
........

Merged revisions 433469 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433470 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26 17:47:42 +00:00
Kevin Harwell ab674f67b5 app_confbridge: file playback blocks dtmf
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
........

Merged revisions 433446 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26 17:13:26 +00:00
Richard Mudgett e953d15223 A couple minor cleanup tweaks.
* 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().
........

Merged revisions 433420 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433421 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-25 18:37:51 +00:00
Matthew Jordan 47156aab92 res_xmpp: Buddies are always auto-registered when processing the roster
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
........

Merged revisions 433396 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-25 15:31:06 +00:00
Joshua Colp abf3e40902 dns: Add core DNS API + unit tests and res_resolver_unbound module + unit tests.
This change adds an abstracted core DNS API which resembles the API described
here[1]. The API provides a pluggable mechanism for resolvers and also a
consistent view for records. Both synchronous and asynchronous queries are
supported.

This change also adds a res_resolver_unbound module which uses the libunbound
library to provide resolution.

Unit tests have also been written for all of the above to confirm the API and
functionality.

ASTERISK-24834 #close
Reported by: Matt Jordan

ASTERISK-24836 #close
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/4474/
Review: https://reviewboard.asterisk.org/r/4512/

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+DNS+API


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433370 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-25 12:32:26 +00:00
Richard Mudgett 4c2fc5b811 chan_pjsip: Add "rpid_immediate" option to prevent unnecessary "180 Ringing" 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/
........

Merged revisions 433338 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433339 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-24 19:41:36 +00:00
Matthew Jordan 60f01520e7 Fix compilations errors on 64-bit OpenBSD systems
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
........

Merged revisions 433269 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433270 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-23 00:05:48 +00:00
Matthew Jordan 66670f02e6 Fix compilation issues for OpenBSD
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
........

Merged revisions 433247 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433248 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-22 23:11:32 +00:00
Richard Mudgett 7e097bce86 Audit ast_pjsip_rdata_get_endpoint() usage for ref leaks.
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/
........

Merged revisions 433222 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-20 19:54:48 +00:00
Richard Mudgett 148e8799fe res_pjsip_sdp_rtp,sorcery: Fix invalid access and memory leak respectively.
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/
........

Merged revisions 433199 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-20 18:27:22 +00:00
Matthew Jordan 627cc16a8d funcs/func_env: Fix regression caused in FILE read operation
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
........

Merged revisions 433174 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19 19:20:21 +00:00
Kevin Harwell 79a81fed59 alemebic scripts: endpoint identifier order option
The script was added in 13, but when committed to trunk it caused a branch to
occur due to some trunk only alemebic changes. This fixes it so that the new
'add_pjsip_endpoint_identifier_order script points to the correct down revision.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19 15:27:56 +00:00
Corey Farrell 3aa0a869c2 logger: Apply default console logging when configuration cannot be loaded.
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
........

Merged revisions 433126 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433130 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19 10:21:42 +00:00
Corey Farrell d486659502 chan_sip: Simplify dialog/peer references, improve REF_DEBUG output.
* 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/
........

Merged revisions 433115 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433116 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19 09:57:59 +00:00
Corey Farrell 2c83ac4364 chan_sip: Fix dialog reference leaked to scheduler for reinvite_timeout.
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
........

Merged revisions 433113 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433114 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19 09:46:06 +00:00
Richard Mudgett e0ea490a11 res_pjsip_session: Fix off-nominal extra unref of session.
........

Merged revisions 433088 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-18 02:42:16 +00:00
Scott Griepentrog 8c65c9167e Various: bugfixes found via chaos
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/
........

Merged revisions 433064 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433065 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17 22:15:42 +00:00
Scott Griepentrog f25b265329 core: Introduce chaos into memory allocations
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-17 22:03:37 +00:00
Scott Griepentrog 62cf2a2c02 Reverting accidental ci of wrong change in r433061
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433062 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17 22:03:01 +00:00
Scott Griepentrog cb6c7eecfd various: cleanup issues found during leak hunt
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-17 22:00:05 +00:00
Richard Mudgett c41dd32b94 Audit ast_sockaddr_resolve() usage for memory leaks.
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-17 21:52:47 +00:00
Kevin Harwell 803a916334 res_pjsip: Allow configuration of endpoint identifier query order
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-17 18:35:07 +00:00
Kevin Harwell aef7278af6 res_pjsip: Allow configuration of endpoint identifier query order
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-17 18:22:20 +00:00
Richard Mudgett 259e833e88 res_pjsip: Add reason comment.
........

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-17 16:11:36 +00:00
Matthew Jordan e89f83b3ad main/frame: Don't report empty disallow values as an error
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-14 02:29:29 +00:00
Joshua Colp 0d52907d2b func_curl: Don't hold exclusive lock when performing HTTP request.
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-14 02:01:12 +00:00
Matthew Jordan ac1214d9d4 apps/app_sms: Add an option to prevent SMS content from being logged
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-14 01:53:13 +00:00
Joshua Colp b3fa35786f core: Fix tab completion of "core set debug channel" CLI command.
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-14 01:37:24 +00:00
Matthew Jordan b4cc056067 FILE: fix retrieval of file contents when offset is specified
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-14 01:22:01 +00:00
Matthew Jordan dc752f515b apps/app_amd: Document maximum_word_length option; fix AMDCAUSE documentation
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-14 00:24:52 +00:00
Richard Mudgett c52adca396 chan_pjsip: AMI action PJSIPShowEndpoint closes AMI connection on error.
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-13 17:06:39 +00:00
Richard Mudgett 636d82f4d8 chan_pjsip/res_pjsip_callerid: Make Party ID handling simpler and consistent.
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-13 16:37:17 +00:00