Commit Graph

3713 Commits

Author SHA1 Message Date
Mark Michelson d5716ecae2 Genericize the allocation and destruction of taskprocessor listeners.
The goal of this is to take the responsibility away from individual
listeners to be sure to properly unref the taskprocessor.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376121 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-09 22:28:10 +00:00
Mark Michelson 902a2d8919 Get rid of taskprocessor fields no longer necessary.
This includes changing the taskprocessor to use its builtin
ao2_lock instead of having a separate mutex. It can do this
now since there is no longer an ast_cond_t associated with
the taskprocessor.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376119 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-08 23:35:10 +00:00
Mark Michelson 77725bf293 Move taskprocessors to use a listener model.
Taskprocessors are now divided into two units: the task queue
and their listeners.

When a task is added to the queue, the listener is notified and
can take whatever action is desired. This means that taskprocessors
are no longer confined to having their tasks executed within a 
single thread.

A default taskprocessor listener has been added that mirrors the
old taskprocessor behavior.

I've tested it by running Asterisk and placing calls. It appears
to work as expected. I'm going to do some cleaning up first and
then write some unit tests to be sure everything works as expected.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376118 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-08 23:27:16 +00:00
Automerge script f69513b85b Merged revisions 376049 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r376049 | rmudgett | 2012-11-08 11:38:31 -0600 (Thu, 08 Nov 2012) | 41 lines
  
  Add MALLOC_DEBUG enhancements.
  
  * Makes malloc() behave like calloc().  It will return a memory block
  filled with 0x55.  A nonzero value.
  
  * Makes free() fill the released memory block and boundary fence's with
  0xdeaddead.  Any pointer use after free is going to have a pointer
  pointing to 0xdeaddead.  The 0xdeaddead pointer is usually an invalid
  memory address so a crash is expected.
  
  * Puts the freed memory block into a circular array so it is not reused
  immediately.
  
  * When the circular array rotates out a memory block to the heap it checks
  that the memory has not been altered from 0xdeaddead.
  
  * Made the astmm_log message wording better.
  
  * Made crash if the DO_CRASH menuselect option is enabled and something is
  found.
  
  * Fixed a potential alignment issue on 64 bit systems.
  struct ast_region.data[] should now be aligned correctly for all
  platforms.
  
  * Extracted region_check_fences() from __ast_free_region() and
  handle_memory_show().
  
  * Updated handle_memory_show() CLI usage help.
  
  Review: https://reviewboard.asterisk.org/r/2182/
  ........
  
  Merged revisions 376029 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 376030 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 376048 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-08 18:19:49 +00:00
Mark Michelson f2bb9afe17 Multiple revisions 375993-375994
........
  r375993 | mmichelson | 2012-11-07 11:01:13 -0600 (Wed, 07 Nov 2012) | 30 lines
  
  Fix misuses of timeouts throughout the code.
  
  Prior to this change, a common method for determining if a timeout
  was reached was to call a function such as ast_waitfor_n() and inspect
  the out parameter that told how many milliseconds were left, then use
  that as the input to ast_waitfor_n() on the next go-around.
  
  The problem with this is that in some cases, submillisecond timeouts
  can occur, resulting in the out parameter not decreasing any. When this
  happens thousands of times, the result is that the timeout takes much
  longer than intended to be reached. As an example, I had a situation where
  a 3 second timeout took multiple days to finally end since most wakeups
  from ast_waitfor_n() were under a millisecond.
  
  This patch seeks to fix this pattern throughout the code. Now we log the
  time when an operation began and find the difference in wall clock time
  between now and when the event started. This means that sub-millisecond timeouts
  now cannot play havoc when trying to determine if something has timed out.
  
  Part of this fix also includes changing the function ast_waitfor() so that it
  is possible for it to return less than zero when a negative timeout is given
  to it. This makes it actually possible to detect errors in ast_waitfor() when
  there is no timeout.
  
  (closes issue ASTERISK-20414)
  reported by David M. Lee
  
  Review: https://reviewboard.asterisk.org/r/2135/
........
  r375994 | mmichelson | 2012-11-07 11:08:44 -0600 (Wed, 07 Nov 2012) | 3 lines
  
  Remove some debugging that accidentally made it in the last commit.
........

Merged revisions 375993-375994 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375995 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376015 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-07 19:15:26 +00:00
Richard Mudgett 6ad0126425 Fix stuck DTMF when bridge is broken.
When a bridge is broken by an AMI Redirect action or the ChannelRedirect
application, an in progress DTMF digit could be stuck sending forever.

* Made simulate a DTMF end event when a bridge is broken and a DTMF digit
was in progress.

(closes issue ASTERISK-20492)
Reported by: Jeremiah Gowdy
Patches:
      bridge_end_dtmf-v3.patch.txt (license #6358) patch uploaded by Jeremiah Gowdy
      Modified to jira_asterisk_20492_v1.8.patch
      jira_asterisk_20492_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett

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

Merged revisions 375964 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375965 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375967 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-06 19:05:11 +00:00
Matthew Jordan a0c363e227 Refactor ast_timer_ack to return an error and handle the error in timer users
Currently, if an acknowledgement of a timer fails Asterisk will not realize
that a serious error occurred and will continue attempting to use the timer's
file descriptor.  This can lead to situations where errors stream to the
CLI/log file.  This consumes significant resources, masks the actual problem
that occurred (whatever caused the timer to fail in the first place), and
can leave channels in odd states.

This patch propagates the errors in the timing resource modules up through
the timer core, and makes users of these timers handle acknowledgement
failures.  It also adds some defensive coding around the use of timers
to prevent using bad file descriptors in off nominal code paths.

Note that the patch created by the issue reporter was modified slightly for
this commit and backported to 1.8, as it was originally written for
Asterisk 10.

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

(issue ASTERISK-20032)
Reported by: Jeremiah Gowdy
patches:
  jgowdy-timerfd-6-22-2012.diff uploaded by Jeremiah Gowdy (license 6358)
........

Merged revisions 375893 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375894 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375896 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-05 23:10:14 +00:00
Richard Mudgett 5336a97f25 Add safety NULL pointer check in module user references.
Made __ast_module_user_remove() check for NULL pointers.
........

Merged revision 375860 from C.3
........

Merged revisions 375862 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375863 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375865 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-05 21:42:49 +00:00
Matthew Jordan b6bac916f0 Don't attempt to purge sessions when no sessions exist
Manager's tcp/tls objects have a periodic function that purge old manager
sessions periodically.  During shutdown, the underlying container holding
those sessions can be disposed of and set to NULL before the tcp/tls periodic
function is stopped.  If the periodic function fires, it will attempt to
iterate over a NULL container.

This patch checks for whether or not the sessions container exists before
attempting to purge sessions out of it.  If the sessions container is NULL,
we simply return.

Note that this error was also caught by the Asterisk Test Suite.
........

Merged revisions 375800 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375801 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375803 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-04 03:10:21 +00:00
Matthew Jordan 4bd66cb96b Properly clean up manager resources on exit
This patch does two things:
1) It properly unregisters the manager CLI commands
2) It cleans up AMI users on exit.  Prior to this patch, the AMI users
   were not being disposed of properly, resulting in a memory leak.

(closes issue ASTERISK-20646)
Reported by: Corey Farrell
patches:
  manager_shutdown.patch uploaded by Corey Farrell (license 5909)
........

Merged revisions 375793 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375794 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375796 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-04 02:38:19 +00:00
Matthew Jordan a243f4f153 Properly finalize prepared SQLite3 statements to prevent memory leak
The AstDB uses prepared SQLite3 statements to retrieve data from the SQLite3
database.  These statements should be finalized during Asterisk shutdown so
that the SQLite3 database can be properly closed.  Failure to finalize the
statements results in a memory leak and a failure when closing the database.

This patch fixes those issues by ensuring that all prepared statements are
properly finalized at shutdown.

(closes issue ASTERISK-20647)
Reported by: Corey Farrell
patches:
  astdb-sqlite3_close.patch uploaded by Corey Farrell (license 5909)
........

Merged revisions 375761 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375770 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-04 01:19:43 +00:00
Matthew Jordan ff469e9d5d Fix memory leaks in XML documentation
This patch fixes two memory leaks:
1) When building XML documentation items, the 'name' attribute was extracted
   from XML elements but not properly freed after being copied into the item
   being built.
2) When unloading XML documentation, the doctree container objects were not
   properly freed.

This patch corrects these memory leaks.  Note that this patch was modified
slightly for this commmit, as the case where the 'name' attribute doesn't
exist also wasn't handled in the item construction.  This patch also checks
for that attribute not existing.

(closes issue ASTERISK-20648)
Reported by: Corey Farrell
Tested by: mjordan
patches:
  xmldoc-memory_leak.patch uploaded by Corey Farrell (license 5909)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-04 00:48:24 +00:00
Matthew Jordan 19282f682e Prevent multiple CDR batches from conflicting when scheduling the CDR write
The Asterisk Test Suite caught an error condition where a scheduled CDR batch
write can be deleted twice if two channels attempt to post their CDRs at the
same time.  The batch CDR mutex is locked while the CDRs are appended to the
current batch list; however, it is unlocked prior to actually scheduling the
CDR write.  As such, two threads can attempt to remove the currently scheduled
batch write at the same time, resulting in an assertion error.

This patch extends the time that the mutex is locked to encompass actually
scheduling the write.  This prevents two threads from unscheduling the
currently scheduled write at the same time.
........

Merged revisions 375727 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375728 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375730 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-04 00:02:06 +00:00
Richard Mudgett f85db0e34d Things don't need to be that const.
........

Merged revisions 375658 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375659 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375662 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-02 21:01:33 +00:00
Mark Michelson da85f8489f Make evaluation of channel variables consistently case-sensitive.
Due to inconsistencies in how variable names were evaluated, the
decision was made to make all evaluations case-sensitive. See the
UPGRADE.txt file or https://wiki.asterisk.org/wiki/display/AST/Case+Sensitivity
for more details.

(closes issue ASTERISK-20163)
reported by Matt Jordan

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375442 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-29 21:27:09 +00:00
Richard Mudgett 8d65c777c8 Fix the Park 'r' option when a channel parks itself.
When a channel uses the Park appliation to park itself with the 'r'
option, the channel hears music-on-hold instead of the requested ringing.

* Added a missing check for the 'r' option when a channel parks itself.

(closes issue ASTERISK-19382)
Reported by: James Stocks
Patches by: dsessions

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

Merged revisions 375388 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375389 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-29 19:31:36 +00:00
Jonathan Rose 3d540ef218 core: Fix a memory leak in app.c from an early return
ast_app_group_match_get_count allocates memory with the regcomp
function and we previously forgot to free it when bailing out
due to a regex compilation failure against category.

(closes issue AST-1018)
Reported by: Guenther Kelleter
Patches:
	regcomp_memleak.diff uploaded by Guenther Kelleter (license 6372)
........

Merged revisions 375299 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375300 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375311 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-22 20:19:51 +00:00
Andrew Latham 6c20cf2d8a Doxygen Updates - Title update
Update and extend the configuration_file group and enable linking. Commit other cleanups from multi-version Doxygen testing.  Update title that was left behind many years ago.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-18 14:17:40 +00:00
Jonathan Rose 68c63d7965 manager: remove curses dependent stuff from r375103
Upon further examination, this code was causing compliation problems on
CentOS at the least (possibly on any machine without curses) and also
the local value of COLS is used even with a remote console, so it is
less than ideal.

(issue ASTERISK-20396)
Reported by: Johan Wilfer


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-17 20:34:40 +00:00
Kinsey Moore 372e29620c Ensure Asterisk fails TCP/TLS SIP calls when certificate checking fails
When placing a call to a TCP/TLS SIP endpoint whose certificate is not
signed by a configured CA certificate, Asterisk would issue a warning
and continue to process the call as if there was not an issue with the
certificate.  Asterisk now properly fails the call if the certificate
fails verification or if the certificate does not exist when
certificate checking is enabled (the default behavior).

(closes issue ASTERISK-20559)
Reported by: kmoore

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

Merged revisions 375146 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375147 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375149 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-17 19:01:27 +00:00
Walter Doekes 6d57ecd48c Change a few warnings to debug and the inverse.
Remove the "RTP Read too short" warning for RTP keepalives. Remove the
the warning about the application delimiter switch from pipe to comma.
(You should've done this by now.) Make cdr_odbc report more when an
insert fails. Make chan_sip warn less when the peer wants SRTP (and we
don't) or sends a zero port to disable a media type.

Review: https://reviewboard.asterisk.org/r/2167
(closes issue ASTERISK-20538)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375137 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-17 14:24:52 +00:00
Jonathan Rose b2f9542f61 manager: Change display of 'manager show commands' and 'manager show command'
manager show commands now shows the full name of the command being displayed
regardless of size. The privilege column has also been removed from this
display. It will also now use the full length of the terminal if curses is
available. Manager show command will now always display the privilege of
the manager command within the CLI.

(closes ASTERISK-20396)
Reported by: Johan Wilfer
Review: https://reviewboard.asterisk.org/r/2143/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-16 20:45:49 +00:00
Mark Michelson e9ab568f88 Fix some potential misuses of ast_str in the code.
Passing an ast_str pointer by value that then calls
ast_str_set(), ast_str_set_va(), ast_str_append(), or
ast_str_append_va() can result in the pointer originally
passed by value being invalidated if the ast_str had
to be reallocated.

This fixes places in the code that do this. Only the
example in ccss.c could result in pointer invalidation
though since the other cases use a stack-allocated ast_str
and cannot be reallocated.

I've also updated the doxygen in strings.h to include
notes about potential misuse of the functions mentioned
previously.

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

Merged revisions 375025 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375026 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-15 21:25:29 +00:00
Andrew Latham b106b77041 Title update
Update title that was left behind many years ago. Used revision 6596 as my guide for what it should be.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375007 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-14 21:56:13 +00:00
Andrew Latham e51432027a Doxygen Clean ups
Add app_skel.c as an example in app.c and fix some formating for the "Dial Privacy scripts" so it actually shows up in the Doxygen output.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374956 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-13 16:38:48 +00:00
Mark Michelson c7b23cbb0a Do not use a FILE handle when doing SIP TCP reads.
This is used to solve an issue where a poll on a file
descriptor does not necessarily correspond to the readiness
of a FILE handle to be read.

This change makes it so that for TCP connections, we do a
recv() on the file descriptor instead.

Because TCP does not guarantee that an entire message or even
just one single message will arrive during a read, a loop has
been introduced to ensure that we only attempt to handle a
single message at a time. The tcptls_session_instance structure
has also had an overflow buffer added to it so that if more
than one TCP message arrives in one go, there is a place to
throw the excess.

Huge thanks goes out to Walter Doekes for doing extensive review
on this change and finding edge cases where code could fail.

(closes issue ASTERISK-20212)
reported by Phil Ciccone

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

Merged revisions 374905 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374906 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374924 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-12 16:31:01 +00:00
Andrew Latham 7226606f77 Continue to group config files
(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-11 22:39:02 +00:00
Mark Michelson 825607e09b Don't make chan_sip export global symbols.
During testing, it was discovered that having chan_sip
export global symbols was problematic.

The biggest problem was that load order was affected.
Trying to use realtime could be problematic since in
all likelihood the necessary realtime driver(s) would
not be loaded before chan_sip.

In addition, it was found that it was impossible to
use the Digium Phone Module for Asterisk since it
must be loaded before chan_sip since it must hook
into chan_sip's configuration parsing.

The solution is to use a virtual table in the same
manner that other modules in Asterisk do, like
app_voicemail.

(closes issue ASTERISK-20545)
Reported by: kmoore

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374849 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-11 15:49:02 +00:00
Matthew Jordan 5ac43a08ad Fix incorrect billing duration reported when batch mode is enabled
Similar to r369351, the billing duration can be skewed when batch mode is
enabled.  This happened much more rarely than the duration, as it only
occured when the call was answered (thereby indicating an actual answer
time) and immediately hung up on (indicating a billsec of 0).  Since
a billing time of '0' can either mean that the call immediately ended
or that the CDR was improperly answered, we have to use additional information
to know whether or not we can trust the CDR billsec value.  Prior to this
patch, we looked to see if we had a valid answer time.  If we did, and
billsec was zero, we used the current time to calculate what billsec value
we could from the CDR being written.  If batch mode is enabled, this will
incorrectly report a billsec value being much greater than the actual
duration of the call.

Instead of relying on the presence of an answer time to know whether or not
we can re-calculate the billsec for the CDR, we now also use the presence
of the CDR's end time to know if we need to re-calculate or whether we can
trust the billsec value that we have.  This prevents erroneous jumps in the
billsec value, while still making sure that in the worst case, some billing
time will be calculated.

(closes issue AST-1016)
Reported by: Thomas Arimont
Tested by: Thomas Arimont
........

Merged revisions 374843 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374844 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-11 15:44:38 +00:00
Kinsey Moore 357b733b66 Fix segfault regression from r370681
Due to usage of ast_hook_send_action, AMI action handling code should
be able to handle a NULL mansession->session.  This would cause a crash
on NULL dereference if action_originate was called from
ast_hook_send_action.

(closes issue ASTERISK-20544)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374793 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-10 13:40:40 +00:00
Richard Mudgett 9a0ff62452 Fix execution of 'i' extension due to uninitialized variable.
The fix for ASTERISK-18243 added code that could potentially use
dst_exten[] uninitialized.  As a result the 'i' exten may not be executed
when it should.

(closes issue ASTERISK-20455)
Reported by: Richard Miller
Patches:
      pbx-1.8.16.0.diff (license #5685) patch uploaded by Richard Miller
      Made some cosmetic modifications.
........

Merged revisions 374758 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374763 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374778 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-09 22:24:10 +00:00
Matthew Jordan 6b5677a41d Trivial patch to make 'best_score' defined for all architectures.
Fixes trivial build error on Solaris:

  acl.c: In function `get_local_address':
  acl.c:196: error: `best_score' undeclared (first use in this function)
  acl.c:196: error: (Each undeclared identifier is reported only once
  acl.c:196: error: for each function it appears in.)
  make[2]: *** [acl.o] Error 1

(issue ASTERISK-20366)
Reported by: Ben Klang
Tested by: Ben Klang
patches:
  0002-main-acl.c-Trivial.-best_score-should-be-defined-for.patch by Shaun Ruffell (license 5417)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374633 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-07 17:33:38 +00:00
Matthew Jordan 15b35972ff Update documentation for MessageSend application/command's From field for XMPP
When using the channel technology agnostic application/AMI command MessageSend,
the "From" field is technically optional for the SIP channel driver.  However,
if being sent by the XMPP resource module (either res_xmpp or res_jabber), the
"From" field is necessary, and must correspond to a defined account.  This
patch updates the documentation for this application/AMI command to reflect
this.

(closes issue ASTERISK-20405)
Reported by: Leif Madsen
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374612 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-06 01:47:00 +00:00
David M. Lee 5f9f6f3867 Multiple revisions 374570,374581
........
  r374570 | dlee | 2012-10-05 15:14:41 -0500 (Fri, 05 Oct 2012) | 22 lines
  
  Improve AMI long line error handling
  
  In AMI's parser, when it receives a long line (> 1024 characters), it discards
  that line, but continues to process the message normally.
  
  Typically, this is not a problem because a) who has lines that long and b)
  usually a discarded line results in an invalid message. But if that line is
  specifying an optional field, then the message will be processed, you get a
  'Response: Success', but things don't work the way you expected them to.
  
  This patch changes the behavior when a line-too-long parse error occurs.
  
  * Changes the log message to avoid way-too-long (and truncated anyways) log
    messages
  * Adds a 'parsing' status flag to Response: Success
  * Sets parsing = MESSAGE_LINE_TOO_LONG if, well, a line is too long
  * Responds with an appropriate error if parsing != MESSAGE_OKAY
  
  (closes issue AST-961)
  Reported by: John Bigelow
  Review: https://reviewboard.asterisk.org/r/2142/
........
  r374581 | dlee | 2012-10-05 15:20:28 -0500 (Fri, 05 Oct 2012) | 1 line
  
  I've committed too much. Reverting part of r374570.
........

Merged revisions 374570,374581 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374586 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-05 20:33:56 +00:00
Alec L Davis 90f8c90b10 dsp.c User Configurable DTMF_HITS_TO_BEGIN and DTMF_MISSES_TO_END
Instead of a recompile, allow values to be adjusted in dsp.conf

For binary distributions allows easy adjustment for wobbly GSM calls, and other reasons.

Defaults to DTMF_HITS_TO_BEGIN=2 and DTMF_MISSES_TO_END=3

(closes issue ASTERISK-17493)
Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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

Merged revisions 374479 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374481 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-04 20:21:36 +00:00
Alec L Davis 36405ae659 dsp.c fix incorrect DTMF Digit_Duration.
it's always short by 'hits_to_begin*DTMF_GSIZE', or 25.5ms if hitstobegin=2

(issue ASTERISK-16003)
Tested by: alecdavis
alecdavis (license 585)

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

Merged revisions 374475 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374476 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374478 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-04 20:08:22 +00:00
David M. Lee c5acf22cec Fix DBDelTree error codes for AMI, CLI and AGI
The AMI DBDelTree command will return Success/Key tree deleted successfully even
if the given key does not exist. The CLI command 'database deltree' had a
similar problem, but was saved because it actually responded with '0 database
entries removed'. AGI had a slightly different error, where it would return
success if the database was unavailable.

This came from confusion about the ast_db_deltree retval, which is -1 in the
event of a database error, or number of entries deleted (including 0 for
deleting nothing).

* Changed some poorly named res variables to num_deleted
* Specified specific errors when calling ast_db_deltree (database unavailable
  vs. entry not found vs. success)
* Fixed similar bug in AGI database deltree, where 'Database unavailable'
  results in successful result

(closes issue AST-967)
Reported by: John Bigelow
Review: https://reviewboard.asterisk.org/r/2138/
........

Merged revisions 374426 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374427 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-04 15:48:24 +00:00
Joshua Colp d78f7f92b2 Add support for applying direct media ACLs between differing channel technologies.
Review: https://reviewboard.asterisk.org/r/2122/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-04 13:49:45 +00:00
Alec L Davis 4af961a03a dsp.c User configuration of DTMF_NORMAL_TWIST and DTMF_REVERSE_TWIST values
Asterisk's DTMF Specifications are based on AT&T specs, which may not be compatible in other countries.

Various countries have different specifications for the maximum power level differences
between the DTMF low group and high group of frequencies.

Power level difference between frequencies for different Administrations/RPOAs
 NTT        = Max. 5 dB
 AT&T       = 4dB(reverse) to 8dB(normal)
 Danish     = Max. 6 dB
 Australian = Max. 10 dB
 Brazilian  = Max. 9 dB
 ETSI       = Max. 6 dB from ETSI ES 201 235-3 V1.3.1 (2006-03)

Now allow 4 variables to be individually configured in dsp.conf, with reasonable min/max of 2dB to 20dB.
Default is AT&T specifications

Add's the following variables to dsp.conf
;dtmf_normal_twist=6.31 
;dtmf_reverse_twist=2.51 
;relax_dtmf_normal_twist=6.31 
;relax_dtmf_reverse_twist=3.98 


(closes issue ASTERISK-20442)
Reported by: tbsky
Tested by: tbsky,alecdavis

alecdavis (license 585)

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

Merged revisions 374384 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374385 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-04 04:50:16 +00:00
Matthew Jordan 9367893cff Destroy the generic_monitors container after the core_instances in ccss
For each item in core_instances disposed of in the shutdown of ccss, any
generic monitor instances referenced by the objects will be removed from
generic_monitors during their destruction.  Hilarity ensues if
generic_monitors no longer exists.

Thanks to the Asterisk Test Suite's generic_ccss test for complaining loudly
when it ran into this.
........

Merged revisions 374300 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-03 17:27:53 +00:00
Richard Mudgett 9b25076e83 Missed an astobj2.c debug tag.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-02 23:23:30 +00:00
Richard Mudgett 427abb240a * Add ref debug tags to astobj2.c ref usage.
* Make container nodes not show up in the ref debug log.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-02 22:39:47 +00:00
Matthew Jordan bfe35ee0b0 Ensure Shutdown AMI event is still fired during Asterisk shutdown
Richard pointed out that having the manager dispose of itself gracefully
during shutdown meant that the Shutdown event will no longer get fired.
This patch moves the AMI event just prior to running the atexit callbacks.
........

Merged revisions 374230 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374231 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-02 21:26:27 +00:00
Matthew Jordan ed3acdeb21 Fix findings from check-in on r374177
Richard pointed out two problems with the check-in from r374177:
* The ast_msg_shutdown function declaration doesn't match the prototype
  in main/message.c.
* The ref/alloc function usage in astobj2 (in trunk) can use the ao2_t_*
  variants of the functions to allow the REF_DEBUG flag to enable/disable
  their debug counterparts.
........

Merged revisions 374210 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374213 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-02 17:16:20 +00:00
Matthew Jordan a094707d51 Fix a variety of ref counting issues
This patch resolves a number of ref leaks that occur primarily on Asterisk
shutdown.  It adds a variety of shutdown routines to core portions of
Asterisk such that they can reclaim resources allocate duringd initialization.

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

Merged revisions 374177 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374178 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-02 01:47:16 +00:00
Andrew Latham 4e228fce03 Doxygen Cleanup
Start adding configuration file linking and pages.  Add module loading doxygen block.

Breaking up commits to keep it easy to track

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374167 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01 23:39:45 +00:00
Sean Bright b9eeff1521 app_queue: Support persisting and loading of long member lists.
Greenlight in #asterisk brought up that he was receiving an error message "Could
not create persistent member string, out of space" when running app_queue in
Asterisk 10.  dump_queue_members() made an assumption that 8K would be enough to
store the generated string, but with queues that have large member lists this is
not always the case.  This patch removes the limitation and uses ast_str instead
of a fixed sized buffer.

The complicating factor comes from the fact that ast_db_get requires a buffer
and buffer size argument, which doesn't let us pull back more than what we pass
in, so I introduced a new ast_db_get_allocated() which returns an ast_strdup()'d
copy of the value from astdb.

As an aside, I did some testing on the maximum size of data that we can store in
the BDB library we distribute and was able to store a 10MB string and retrieve
it with no problems, so I feel this is a safe patch.

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

Merged revisions 374108 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374135 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374151 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01 20:36:25 +00:00
Sean Bright b3c739a842 Use ast_copy_string instead of strncpy to guarantee a NUL terminated string.
........

Merged revisions 374132 from http://svn.asterisk.org/svn/asterisk/branches/10
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374134 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01 17:28:41 +00:00
Richard Mudgett 154ee24ae8 Change core show help output format.
The CLI "core show help" output leaves something to be desired.
1) The command is truncated to a maximum of 30 characters.
2) The output columns are mirrored from the 31st column.

Current output format:
                   logger mute Toggle logging output to a console
                 logger reload Reopens the log files
                 logger rotate Rotates and reopens the log files
logger set level {DEBUG|NOTICE Enables/Disables a specific logging level for this console
          logger show channels List configured log channels


New format:
logger mute                    -- Toggle logging output to a console
logger reload                  -- Reopens the log files
logger rotate                  -- Rotates and reopens the log files
logger set level {DEBUG|NOTICE|WARNING|ERROR|VERBOSE|DTMF} {on|off} -- Enables/Disables a specific logging level for this console
logger show channels           -- List configured log channels

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374109 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01 17:05:37 +00:00
Richard Mudgett b5138fccf4 Add pause one second W dial modifier.
* The following dialplan applications now recognize 'W' to pause sending
DTMF for one second in addition to the previously existing 'w' that paused
sending DTMF for half a second.  Dial, ExternalIVR, and SendDTMF.

* The chan_dahdi analog port dialing and deferred DTMF dialing for PRI now
distinguishes between 'w' and 'W'.  The 'w' pauses dialing for half a
second.  The 'W' pauses dialing for one second.

* Created dahdi_dial_str() in chan_dahdi that eliminated a lot of
duplicated dialing code and diagnostic messages for the channel driver.

(closes issue ASTERISK-20039)
Reported by: Jeremiah Gowdy
Patches:
      jgowdy-wait-6-22-2012.diff (license #5621) patch uploaded by Jeremiah Gowdy
      Expanded patch to add support in chan_dahdi.
Tested by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-28 18:27:02 +00:00