Commit Graph

2927 Commits

Author SHA1 Message Date
Richard Mudgett 43991ce806 Merged revisions 264820 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r264820 | rmudgett | 2010-05-20 18:23:21 -0500 (Thu, 20 May 2010) | 6 lines
  
  ast_callerid_parse() had a path that left name uninitialized.
  
  Several callers of ast_callerid_parse() do not initialize the name
  parameter before calling thus there is the potential to use an
  uninitialized pointer.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-20 23:29:43 +00:00
Tilghman Lesher 815d7bfe44 Let ExtensionState resolve dynamic hints.
(closes issue #16623)
 Reported by: tilghman
 Patches: 
       20100116__issue16623.diff.txt uploaded by tilghman (license 14)
 Tested by: lmadsen


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264779 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-20 22:23:32 +00:00
Richard Mudgett dafb48fe09 Avoid crash in generic CC agent init if caller name or number is NULL.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264711 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-20 20:49:40 +00:00
Kevin P. Fleming 2aa0c11679 Correct 'all logger levels' patch to work properly.
Nick Lewis pointed out that the patch as committed wouldn't actually include
dynamic logger levels, which was missed by the other reviewers. Thanks!



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-20 12:06:11 +00:00
Mark Michelson 6bb45831eb Fix transcode_via_sln option with SIP calls and improve PLC usage.
From reviewboard:
The problem here is a bit complex, so try to bear with me...

It was noticed by a Digium customer that generic PLC (as configured in
codecs.conf) did not appear to actually be having any sort of benefit when
packet loss was introduced on an RTP stream. I reproduced this issue myself
by streaming a file across an RTP stream and dropping approx. 5% of the
RTP packets. I saw no real difference between when PLC was enabled or disabled
when using wireshark to analyze the RTP streams.

After analyzing what was going on, it became clear that one of the problems
faced was that when running my tests, the translation paths were being set
up in such a way that PLC could not possibly work as expected. To illustrate,
if packets are lost on channel A's read stream, then we expect that PLC will
be applied to channel B's write stream. The problem is that generic PLC can
only be done when there is a translation path that moves from some codec to
SLINEAR. When I would run my tests, I found that every single time, read
and write translation paths would be set up on channel A instead of channel
B. There appeared to be no real way to predict which channel the translation
paths would be set up on.

This is where Kevin swooped in to let me know about the transcode_via_sln
option in asterisk.conf. It is supposed to work by placing a read translation
path on both channels from the channel's rawreadformat to SLINEAR. It also
will place a write translation path on both channels from SLINEAR to the
channel's rawwriteformat. Using this option allows one to predictably set up
translation paths on all channels. There are two problems with this, though.
First and foremost, the transcode_via_sln option did not appear to be working
properly when I was placing a SIP call between two endpoints which did not
share any common formats. Second, even if this option were to work, for PLC
to be applied, there had to be a write translation path that would go from
some format to SLINEAR. It would not work properly if the starting format
of translation was SLINEAR.

The one-line change presented in this review request in chan_sip.c fixed the
first issue for me. The problem was that in sip_request_call, the
jointcapability of the outbound channel was being set to the format passed to
sip_request_call. This is nativeformats of the inbound channel. Because of this,
when ast_channel_make_compatible was called by app_dial, both channels already
had compatibly read and write formats. Thus, no translation path was set up at
the time. My change is to set the jointcapability of the sip_pvt created during
sip_request_call to the intersection of the inbound channel's nativeformats and
the configured peer capability that we determined during the earlier call to
create_addr. Doing this got the translation paths set up as expected when using
transcode_via_sln.

The changes presented in channel.c fixed the second issue for me. First and
foremost, when Asterisk is started, we'll read codecs.conf to see the value of
the genericplc option. If this option is set, and ast_write is called for a
frame with no data, then we will attempt to fill in the missing samples for
the frame. The implementation uses a channel datastore for maintaining the
PLC state and for creating a buffer to store PLC samples in. Even when we
receive a frame with data, we'll call plc_rx so that the PLC state will have
knowledge of the previous voice frame, which it can use as a basis for when
it comes time to actually do a PLC fill-in.

So, reviewers, now I ask for your help. First off, there's the one line change
in chan_sip that I have put in. Is it right? By my logic it seems correct, but
I'm sure someone can tell me why it is not going to work. This is probably the
change I'm least concerned about, though. What concerns me much more is the
set of changes in channel.c. First off, am I even doing it right? When I run
tests, I can clearly see that when PLC is activated, I see a significant increase
in RTP traffic where I would expect it to be. However, in my humble opinion, the
audio sounds kind of crappy whenever the PLC fill-in is done. It sounds worse to
me than when no PLC is used at all. I need someone to review the logic I have used
to be sure that I'm not misusing anything. As far as I can see my pointer arithmetic
is correct, and my use of AST_FRIENDLY_OFFSET should be correct as well, but I'm
sure someone can point out somewhere where I've done something incorrectly.

As I was writing this review request up, I decided to give the code a test run under
valgrind, and I find that for some reason, calls to plc_rx are causing some invalid
reads. Apparently I'm reading past the end of a buffer somehow. I'll have to dig around
a bit to see why that is the case. If it's obvious to someone reviewing, speak up!

Finally, I have one other proposal that is not reflected in my code review. Since
without transcode_via_sln set, one cannot predict or control where a translation
path will be up, it seems to me that the current practice of using PLC only when
transcoding to SLINEAR is not useful. I recommend that once it has been determined
that the method used in this code review is correct and works as expected, then
the code in translate.c that invokes PLC should be removed.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 21:29:08 +00:00
David Vossel d7e9d07156 fixes infinite loop during udptl.c's decode_open_type
When decode_length returns the length there is a check to see if that
length is negative, if so the decode loop breaks as this means the
limit has been reached.  The problem here is that length is an
unsigned int, so length can never be negative.  This resulted in
an infinite loop.

(issue #17352)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 20:30:33 +00:00
Matthew Nicholson 6eaf9b874f Cast an unsigned int to a signed int when comparing it with 0.
(AST-377)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264379 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 20:26:27 +00:00
Tilghman Lesher 07df131a7f Keep track of digit duration, when we're decoding inband to pass DTMF frames.
(closes issue #17235)
 Reported by: frawd
 Patches: 
       new_dtmf_dsp_len.patch uploaded by frawd (license 610)
       20100518__issue17235.diff.txt uploaded by tilghman (license 14)
 Tested by: frawd


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264204 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 16:42:20 +00:00
Leif Madsen e3c9e6ae86 Fix compilation problem with previous commit.
(issue #16009)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264161 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 15:39:39 +00:00
Kevin P. Fleming e77efbc12e Add ability for logger channels to include *all* levels.
Now that Asterisk modules can dynamically create and destroy logger levels
on demand, it's useful to be able to configure a logger channel (console,
file, whatever) to be able to accept log messages from *all* levels, even
levels created dynamically. This patch adds support for this, by allowing
the '*' level name to be used in logger.conf.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264160 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 15:29:28 +00:00
Leif Madsen a8a1961be7 Add ability to hangup all channels from the CLI.
Added the keyword 'all' to the 'channel hangup request' CLI command
so that you can request all channels to be hungup without having to
restart Asterisk.

(closes issue #16009)
Reported by: moy
Patches:
      hangup-all-rev-221688.patch uploaded by moy (license 222)
Tested by: moy, russell

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264117 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 15:12:18 +00:00
Tilghman Lesher f55aff74ed Merged revisions 263949 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r263949 | tilghman | 2010-05-19 01:32:27 -0500 (Wed, 19 May 2010) | 8 lines
  
  Because progress is called multiple times, across several frames, we must persist states when detecting multitone sequences.
  
  (closes issue #16749)
   Reported by: dant
   Patches: 
         dsp.c-bug16749-1.patch uploaded by dant (license 670)
   Tested by: dant
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 06:41:04 +00:00
David Vossel 10789ef88a fixes segfault on logging
(closes issue #17331)
Reported by: under
Patches:
      utils.diff uploaded by under (license 914)
      segfault_on_logging.diff uploaded by dvossel (license 671)
Tested by: under, dvossel


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-18 22:48:51 +00:00
Mark Michelson e3ac20a7f6 Merged revisions 263639 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r263639 | mmichelson | 2010-05-17 17:00:28 -0500 (Mon, 17 May 2010) | 10 lines
  
  Fix logic error when checking for a devstate provider.
  
  When using strsep, if one of the list of specified separators is not found,
  it is the first parameter to strsep which is now NULL, not the pointer returned
  by strsep.
  
  This issue isn't especially severe in that the worst it is likely to do is waste
  some cycles when a device with no '/' and no ':' is passed to ast_device_state.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263640 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-17 22:08:01 +00:00
Mark Michelson b5d5cc565f Enhancements to connected line and redirecting work.
From reviewboard:

Digium has a commercial customer who has made extensive use of the connected party and
redirecting information present in later versions of Asterisk Business Edition and which
is to be in the upcoming 1.8 release. Through their use of the feature, new problems and solutions
have come about. This patch adds several enhancements to maximize usage of the connected party
and redirecting information functionality.

First, Asterisk trunk already had connected line interception macros. These macros allow you to
manipulate connected line information before it was sent out to its target. This patch adds the
same feature except for redirecting information instead.

Second, the ast_callerid and ast_party_id structures have been enhanced to provide a "tag." This
tag can be set with func_callerid, func_connectedline, func_redirecting, and in the case of DAHDI,
mISDN, and SIP channels, can be set in a configuration file. The idea behind the callerid tag is
that it can be set to whatever value the administrator likes. Later, when running connected line
and redirecting macros, the admin can read the tag off the appropriate structure to determine what
action to take. You can think of this sort of like a channel variable, except that instead of having
the variable associated with a channel, the variable is associated with a specific identity within
Asterisk.

Third, app_dial has two new options, s and u. The s option lets a dialplan writer force a specific
caller ID tag to be placed on the outgoing channel. The u option allows the dialplan writer to force
a specific calling presentation value on the outgoing channel.

Fourth, there is a new control frame subclass called AST_CONTROL_READ_ACTION added. This was added
to correct a very specific situation. In the case of SIP semi-attended (blond) transfers, the party
being transferred would not have the opportunity to run a connected line interception macro to
possibly alter the transfer target's connected line information. The issue here was that during a
blond transfer, the SIP transfer code has no bridged channel on which to queue the connected line
update. The way this was corrected was to add this new control frame subclass. Now, we queue an
AST_CONTROL_READ_ACTION frame on the channel on which the connected line interception macro should
be run. When ast_read is called to read the frame, ast_read responds by calling a callback function
associated with the specific read action the control frame describes. In this case, the action taken
is to run the connected line interception macro on the transferee's channel.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-17 15:36:31 +00:00
Leif Madsen fa5350f7d7 Missing newlines added to Set-Cookie line in manager.c
Sean Bright pointed out that we lost a set of newline characters in commit
190349 on a line I had recently changed. Yay for code review on commits.

(issue #17231, #10961)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263460 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-17 15:14:22 +00:00
Leif Madsen 193d495a8a Recorded merge of revisions 263456 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r263456 | lmadsen | 2010-05-17 09:35:18 -0500 (Mon, 17 May 2010) | 11 lines
  
  Manager cookies are not compatible with RFC2109.
  
  The Version field in the cookies we're setting contain quotes around the version
  number which is not compatible with RFC2109 and breaks some implementations.
  
  (closes issue #17231)
  Reported by: ecarruda
  Patches:
        manager_rfc2109-trunk-v1.patch uploaded by ecarruda (license 559)
        manager_rfc2109-1.6.2-v1.patch uploaded by ecarruda (license 559)
  Tested by: ecarruda, russell
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263457 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-17 14:37:35 +00:00
Kevin P. Fleming c44da92360 Improve some very confusing structure names in astobj2.c
As pointed out by 'akshayb' on #asterisk-dev, the code here called a list of
bucket entries a 'bucket', and the entries within the bucket were called
'bucket_list'. This made the code very hard to understand without reading
all of it... so I've renamed 'bucket_list' to 'bucket_entry' to clarify the
purpose of the structure.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263208 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-16 11:14:37 +00:00
Russell Bryant 420acb8f0a Fix build on linux.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262896 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-13 15:35:30 +00:00
Tilghman Lesher 8d6ee962c7 Add kqueue(2) implementation to Asterisk in various places.
This will save a considerable amount of CPU on the BSDs, including Mac OS X,
as it eliminates several places in the code that we previously used a busy
loop.  Additionally, this adds a res_timing interface, using kqueue timers.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262852 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-13 05:37:31 +00:00
Paul Belanger 7d53dc86d6 Notify CLI when modules is loaded / unloaded
(closes issue #17308)
Reported by: pabelanger
Patches:
      cli.modules.patch uploaded by pabelanger (license 224)
Tested by: pabelanger, russell


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262800 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-12 19:59:16 +00:00
Russell Bryant 12631bc3a0 Fix handling of removing nodes from the middle of a heap.
This bug surfaced in 1.6.2 and does not affect code in any other released
version of Asterisk.  It manifested itself as SIP qualify not happening when
it should, causing peers to go unreachable.  This was debugged down to scheduler
entries sometimes not getting executed when they were supposed to, which was in
turn caused by an error in the heap code.

The problem only sometimes occurs, and it is due to the logic for removing an entry
in the heap from an arbitrary location (not just popping off the top).  The scheduler
performs this operation frequently when entries are removed before they run (when
ast_sched_del() is used).

In a normal pop off of the top of the heap, a node is taken off the bottom,
placed at the top, and then bubbled down until the max heap property is restored
(see max_heapify()).  This same logic was used for removing an arbitrary node
from the middle of the heap.  Unfortunately, that logic is full of fail.  This
patch fixes that by fully restoring the max heap property when a node is thrown
into the middle of the heap.  Instead of just pushing it down as appropriate, it
first pushes it up as high as it will go, and _then_ pushes it down.

Lastly, fix a minor problem in ast_heap_verify(), which is only used for
debugging.  If a parent and child node have the same value, that is not an
error.  The only error is if a parent's value is less than its children.

A huge thanks goes out to cappucinoking for debugging this down to the scheduler,
and then producing an ast_heap test case that demonstrated the breakage.  That
made it very easy for me to focus on the heap logic and produce a fix.  Open source
projects are awesome.

(closes issue #16936)
Reported by: ib2
Tested by: cappucinoking, crjw

(closes issue #17277)
Reported by: cappucinoking
Patches:
      heap-fix.rev2.diff uploaded by russell (license 2)
Tested by: cappucinoking, russell


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261496 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-06 13:58:07 +00:00
Paul Belanger b2f59bea24 New 'manager show settings' CLI command.
See the CHANGES file for more details.

(closes issue #16343)
Reported by: pabelanger
Patches:
      issue16343.patch.v5 uploaded by pabelanger (license 224)
Tested by: pabelanger, tilghman, lmadsen

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-05 00:44:37 +00:00
Tilghman Lesher 6a0ea1d79e Merged revisions 261093-261094 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r261093 | tilghman | 2010-05-04 18:36:53 -0500 (Tue, 04 May 2010) | 7 lines
  
  Protect against overflow, when calculating how long to wait for a frame.
  
  (closes issue #17128)
   Reported by: under
   Patches: 
         d.diff uploaded by under (license 914)
........
  r261094 | tilghman | 2010-05-04 18:47:08 -0500 (Tue, 04 May 2010) | 2 lines
  
  Add a tiny corner case to the previous commit
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261095 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-04 23:51:52 +00:00
Eliel C. Sardanons caa2eff30c Avoid making AstData depend on libxml2 to compile.
We have some functions inside the AstData API to get the tree
in XML form, but it is not required at the moment to compile 
asterisk and we can disable that part of the API if we don't have
libxml2 support.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@260521 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-02 02:52:23 +00:00
Tilghman Lesher 623ba816fa Don't allow file descriptors to go above 64k, when we're closing them in a fork(2).
This saves time, when, even though the system allows the process limit to be
that high, the practical limit is much lower.  Also introduce an additional
optimization, in the form of using the CLOEXEC flag to close descriptors at
the right time.

(closes issue #17223)
 Reported by: dbackeberg
 Patches: 
       20100423__issue17223.diff.txt uploaded by tilghman (license 14)
 Tested by: dbackeberg


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@260292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-30 06:19:35 +00:00
David Vossel d4358a46a9 Merged revisions 260049 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r260049 | dvossel | 2010-04-29 10:31:02 -0500 (Thu, 29 Apr 2010) | 14 lines
  
  Fixes crash in audiohook_write_list
  
  The middle_frame in the audiohook_write_list function was
  being freed if a audiohook manipulator returned a failure.
  This is incorrect logic.  This patch resolves this and
  adds detailed descriptions of how this function should work
  and why manipulator failures must be ignored.
  
  (closes issue #17052)
  Reported by: dvossel
  Tested by: dvossel

  (closes issue #16196)
  Reported by: atis
  
  Review: https://reviewboard.asterisk.org/r/623/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@260050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-29 15:33:27 +00:00
David Vossel 6722251986 Merged revisions 259858 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r259858 | dvossel | 2010-04-28 16:16:03 -0500 (Wed, 28 Apr 2010) | 33 lines
  
  resolves deadlocks in chan_local
  
  Issue_1.
  In the local_hangup() 3 locks must be held at the same time... pvt, pvt->chan,
  and pvt->owner.  Proper deadlock avoidance is done when the channel to hangup
  is the outbound chan_local channel, but when it is not the outbound channel we
  have an issue... We attempt to do deadlock avoidance only on the tech pvt, when
  both the tech pvt and the pvt->owner are locked coming into that loop.  By
  never giving up the pvt->owner channel deadlock avoidance is not entirely possible.
  This patch resolves that by doing deadlock avoidance on both the pvt->owner and the pvt
  when trying to get the pvt->chan lock.
  
  Issue_2.
  ast_prod() is used in ast_activate_generator() to queue a frame on the channel
  and make the channel's read function get called.  This function is used in
  ast_activate_generator() while the channel is locked, which mean's the channel
  will have a lock both from the generator code and the frame_queue code by the
  time it gets to chan_local.c's local_queue_frame code... local_queue_frame
  contains some of the same crazy deadlock avoidance that local_hangup requires,
  and this recursive lock prevents that deadlock avoidance from happening correctly.
  This patch removes ast_prod() from the channel lock so only one lock is held during
  the local_queue_frame function.
  
  (closes issue #17185)
  Reported by: schmoozecom
  Patches:
        issue_17185_v1.diff uploaded by dvossel (license 671)
        issue_17185_v2.diff uploaded by dvossel (license 671)
  Tested by: schmoozecom, GameGamer43
  
  Review: https://reviewboard.asterisk.org/r/631/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-28 21:20:03 +00:00
Mark Michelson 5fd23b2ed4 Shuffle some casts to make builds on bamboo happier.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259533 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-27 22:11:58 +00:00
Jason Parker 7108038175 Add gar to the check for AR for those silly OSes (Solaris) that don't have ar.
autoconf2.13 couldn't handle AC_PROG_GREP, so I removed it.  This is fine,
since we don't need to use anything that the configure script doesn't.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-27 21:13:01 +00:00
Mark Michelson 57c8eea6fe Change cc_ref and cc_unref from macros to inline functions.
The hope is that Solaris won't be as whiny after this change.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259357 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-27 19:52:18 +00:00
Mark Michelson af6690ba7f Merged revisions 259104 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r259104 | mmichelson | 2010-04-26 16:44:43 -0500 (Mon, 26 Apr 2010) | 3 lines
  
  Let compilation succeed warning-free when DONT_OPTIMIZE is turned off.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-26 21:45:13 +00:00
Mark Michelson 317a12d950 Merged revisions 259018 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r259018 | mmichelson | 2010-04-26 16:03:08 -0500 (Mon, 26 Apr 2010) | 13 lines
  
  Prevent Newchannel manager events for dummy channels.
  
  No Newchannel manager event will be fired for channels that are
  allocated to not match a registered technology type. Thus bogus
  channels allocated solely for variable substitution or CDR
  operations do not result in a Newchannel event.
  
  (closes issue #16957)
  Reported by: atis
  
  Review: https://reviewboard.asterisk.org/r/601
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259023 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-26 21:13:35 +00:00
Matthew Nicholson 99a7b2fed0 Fix previous commit.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-22 22:11:23 +00:00
Matthew Nicholson 8c41f2db82 Merged revisions 193391,258670 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r193391 | mnicholson | 2009-05-08 16:01:25 -0500 (Fri, 08 May 2009) | 8 lines
  
  Set the proper disposition on originated calls.
  
  (closes issue #14167)
  Reported by: jpt
  Patches:
        call-file-missing-cdr2.diff uploaded by mnicholson (license 96)
  Tested by: dlotina, rmartinez, mnicholson
........
  r258670 | mnicholson | 2010-04-22 16:49:07 -0500 (Thu, 22 Apr 2010) | 11 lines
  
  Fix broken CDR behavior.
  
  This change allows a CDR record previously marked with disposition ANSWERED to be set as BUSY or NO ANSWER.
  
  Additionally this change partially reverts r235635 and does not set the AST_CDR_FLAG_ORIGINATED flag on CDRs generated from ast_call().  To preserve proper CDR behavior, the AST_CDR_FLAG_DIALED flag is now cleared from all brige CDRs in ast_bridge_call().
  
  (closes issue #16797)
  Reported by: VarnishedOtter
  Tested by: mnicholson
........

(closes issue #16222)
Reported by: telles
Tested by: mnicholson



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258671 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-22 21:57:59 +00:00
Russell Bryant 52a8ddba51 Add ast_event subscription unit test and fix some ast_event API bugs.
This patch introduces another test in test_event.c that exercises most of the
subscription related ast_event API calls.  I made some minor additions to the
existing event allocation test to increase API coverage by the test code.
Finally, I made a list in a comment of API calls not yet touched by the test
module as a to-do list for future test development.

During the development of this test code, I discovered a number of bugs in
the event API.

1) subscriptions to AST_EVENT_ALL were not handled appropriately in a couple
   of different places.  The API allows a subscription to all event types,
   but with IE parameters, just as if it was a subscription to a specific
   event type.  However, the parameters were being ignored.  This affected
   ast_event_check_subscriber() and event distribution to subscribers.

2) Some of the logic in ast_event_check_subscriber() for checking subscriptions
   against query parameters was wrong.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258632 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-22 21:06:53 +00:00
Jason Parker 9e3f5fa6fb Remove ABI differences that occured when compiling with DEBUG_THREADS.
"Bad Things" would happen if Asterisk was compiled with DEBUG_THREADS, but a
loaded module was not (or vice versa).  This also immensely simplifies the
lock code, since there are no longer 2 separate versions of them.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-22 19:08:01 +00:00
Eliel C. Sardanons a753e8878b Asterisk data retrieval API.
This module implements an abstraction for retrieving and exporting
asterisk data.
Developed by:
	Brett Bryant <brettbryant@gmail.com>
	Eliel C. Sardanons (LU1ALY) <eliels@gmail.com>
For the Google Summer of code 2009 Project.
Documentation can be found in doxygen format and inside the
header include/asterisk/data.h

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258517 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-22 18:07:02 +00:00
Julian Lyndon-Smith d85650e4aa Added MixMonitorMute manager command
Added a new manager command to mute/unmute MixMonitor audio on a channel. 
Added a new feature to audiohooks so that you can mute either read / write
(or both) types of frames - this allows for MixMonitor to mute either side
of the conversation without affecting the conversation itself.

(closes issue #16740)
Reported by: jmls

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-21 11:27:27 +00:00
Jason Parker c7cf47ce7b Change log message to match severity.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257949 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-19 21:57:56 +00:00
Jason Parker 7965dd9509 Don't consider a missing indications.conf to be a critical error.
There were many changes in revision 176627 which would avoid the error that a
missing config would have caused.  Other than this, there are no other config
files (including asterisk.conf, surprisingly) that are required.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-19 21:49:30 +00:00
Terry Wilson 9674766487 Fix incomplete CDR merge from r195881
Because res/res_features.c was removed and main/cdr.c added, these changes
didn't make it to trunk and the 1.6.x branches


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257810 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-19 17:57:41 +00:00
Tilghman Lesher 8ced3317ed Merged revisions 257544 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r257544 | tilghman | 2010-04-15 16:23:24 -0500 (Thu, 15 Apr 2010) | 6 lines
  
  Allow application options with arguments to contain parentheses, through a variety of escaping techniques.
  
  Fixes SWP-1194 (ABE-2143).
  
  Review: https://reviewboard.asterisk.org/r/604/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-15 21:26:19 +00:00
Tilghman Lesher 8b7a90a026 Yet another issue where the conversion of the application delimiter to comma caused an issue.
Application arguments within the feature map could possibly contain a comma,
which conflicts with the syntax of the features.conf configuration file.  This
patch allows the argument to be wrapped in parentheses or quoted, to allow the
application arguments to be interpreted as a single configuration parameter.

(closes issue #16646)
 Reported by: pinga-fogo
 Patches: 
       20100414__issue16646.diff.txt uploaded by tilghman (license 14)
 Tested by: tilghman
 
Review: https://reviewboard.asterisk.org/r/547/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-14 22:57:35 +00:00
Matthew Nicholson 2724f89bba Merged revisions 257070 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r257070 | mnicholson | 2010-04-13 11:46:30 -0500 (Tue, 13 Apr 2010) | 9 lines
  
  Add an option to restore past broken behavor of the Events manager action
  
  Before r238915, certain values for the EventMask parameter of the Events action would result in no response being returned.  This patch adds an option to restore that broken behavior.  Also while fixing this bug I discovered that passing an empty EventMasks parameter would also result in no response being returned, this has been fixed as well while being preserved when the broken behavior is requested.
  
  (closes issue #17023)
  Reported by: nblasgen
  
  Review: https://reviewboard.asterisk.org/r/602/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-13 18:10:30 +00:00
Mark Michelson 69c252c290 Fix issue where recall would not happen when it should.
Specifically, the situation would happen when multiple
callers would request CC for a single generically-monitored
device. If the monitored device became available but the
caller did not answer the recall, then there was nothing
that would poke the CC core to let it know that it should
attempt to recall someone else instead.

After careful consideration, I came to the conclusion that
the only area of Asterisk that needed to be touched was the
generic CC monitor. All other types of CC would require something
outside of Asterisk to invoke a recall for a separate device.

This was accomplished by changing the generic monitor destructor
to poke other generic monitor instances if the device is currently
available and the specific instance was currently not suspended.

In order to not accidentally trigger recalls at bad times, the
fit_for_recall flag was also added to the generic_monitor_instance_list
struct. This gets set as soon as a monitored device becomes available.
It gets cleared if a CCNR request triggers the creation of a new
generic monitor instance. By doing this, we don't accidentally try
to recall a device when the monitored device was being monitored
for CCNR and never actually became available for recall in the first
place.

This error was discovered by Steve Pitts during in-house testing
at Digium.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256985 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-12 22:27:07 +00:00
Leif Madsen d2e1f421fa CLI command logger set level auto complete.
A simple patch to enable auto tab complete.

(closes issue #17152)
Reported by: pabelanger
Patches: 
      0017152.patch uploaded by pabelanger (license 224)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-12 14:39:37 +00:00
Mark Michelson 9afa6af881 Remove status_response callbacks where they are not needed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 22:20:22 +00:00
Mark Michelson e24661fd18 Merge Call completion support into trunk.
From Reviewboard:
CCSS stands for Call Completion Supplementary Services. An admittedly out-of-date
overview of the architecture can be found in the file doc/CCSS_architecture.pdf
in the CCSS branch. Off the top of my head, the big differences between what is
implemented and what is in the document are as follows:

1. We did not end up modifying the Hangup application at all.
2. The document states that a single call completion monitor may be used across
   multiple calls to the same device. This proved to not be such a good idea
   when implementing protocol-specific monitors, and so we ended up using one
   monitor per-device per-call.
3. There are some configuration options which were conceived after the document
   was written. These are documented in the ccss.conf.sample that is on this
   review request.
		      
For some basic understanding of terminology used throughout this code, see the
ccss.tex document that is on this review.

This implements CCBS and CCNR in several flavors.

First up is a "generic" implementation, which can work over any channel technology
provided that the channel technology can accurately report device state. Call
completion is requested using the dialplan application CallCompletionRequest and can
be canceled using CallCompletionCancel. Device state subscriptions are used in order
to monitor the state of called parties.

Next, there is a SIP-specific implementation of call completion. This method uses the
methods outlined in draft-ietf-bliss-call-completion-06 to implement call completion
using SIP signaling. There are a few things to note here:

* The agent/monitor terminology used throughout Asterisk sometimes is the reverse of
  what is defined in the referenced draft.

* Implementation of the draft required support for SIP PUBLISH. I attempted to write
  this in a generic-enough fashion such that if someone were to want to write PUBLISH
  support for other event packages, such as dialog-state or presence, most of the effort
  would be in writing callbacks specific to the event package.

* A subportion of supporting PUBLISH reception was that we had to implement a PIDF
  parser. The PIDF support added is a bit minimal. I first wrote a validation
  routine to ensure that the PIDF document is formatted properly. The rest of the
  PIDF reading is done in-line in the call-completion-specific PUBLISH-handling
  code. In other words, while there is PIDF support here, it is not in any state
  where it could easily be applied to other event packages as is.

Finally, there are a variety of ISDN-related call completion protocols supported. These
were written by Richard Mudgett, and as such I can't really say much about their
implementation. There are notes in the CHANGES file that indicate the ISDN protocols
over which call completion is supported.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256528 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 15:31:32 +00:00
Mark Michelson 6cad0f1602 func_srv and explicit specification of a remote IP for SIP.
From Review Board:
There are two interrelated changes here.

First, there is the introduction of func_srv. This adds two new read-only
dialplan functions, SRVQUERY and SRVRESULT. They work very similarly to the
ENUMQUERY and ENUMRESULT functions, except that this allows one to query SRV
records instead. In order to facilitate this work, I added a couple of new API
calls to srv.h. ast_srv_get_record_count tells the number of records returned
by an SRV lookup. This number is calculated at the time of the SRV lookup.
ast_srv_get_nth_record allows one to get a numbered SRV record.

Second, there is the modification to chan_sip that allows one to specify a
hostname or IP address (along with a port) to send an outgoing INVITE to when
dialing a SIP peer. This goes hand-in-hand with func_srv. You can query SRV
records and then use the host and port from the results to dial via a specific
host instead of what is configured in sip.conf.

Review: https://reviewboard.asterisk.org/r/608
SWP-1200



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256485 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 14:37:50 +00:00
Richard Mudgett a5a0a5f867 Consolidate ast_channel.cid.cid_rdnis into ast_channel.redirecting.from.number.
SWP-1229
ABE-2161

* Ensure chan_local.c:local_call() will not leak cid.cid_dnid when
copying.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256104 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-03 02:12:33 +00:00
Russell Bryant 37797ddd52 Merged revisions 256009 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r256009 | russell | 2010-04-02 18:30:15 -0500 (Fri, 02 Apr 2010) | 2 lines
  
  Remove extremely verbose debug message.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-02 23:30:58 +00:00
Tilghman Lesher 3c6c879681 Pass the PID of the Asterisk process, not the PID of the canary.
(closes issue #17065)
 Reported by: globalnetinc
 Patches: 
       astcanary.patch uploaded by makoto (license 38)
 Tested by: frawd, globalnetinc


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255952 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-02 20:19:01 +00:00
Kevin P. Fleming 2be88e05c0 Allow symbol export filtering to work properly on platforms that have symbol prefixes.
Some platforms prefix externally-visible symbols in object files generated
from C sources (most commonly, '_' is the prefix). On these platforms,
the existing symbol export filtering process ends up suppressing all the symbols
that are supposed to be left visible. This patch allows the prefix string
to be supplied to the top-level Makefile in the LINKER_SYMBOL_PREFIX variable,
and then generates the linker scripts as required to include the prefix
supplied.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-02 18:57:58 +00:00
Russell Bryant 899f995703 Remove a debugging log entry.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-29 05:10:41 +00:00
Terry Wilson 408ba24fad Merged revisions 254451 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r254451 | twilson | 2010-03-25 10:57:29 -0500 (Thu, 25 Mar 2010) | 2 lines
  
  Handle new SRCCHANGE control message here too
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254453 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-25 16:03:51 +00:00
Kevin P. Fleming 42577406fd Improve handling of T.38 re-INVITEs that arrive before a T.38-capable
application is executing on a channel.

This patch addresses an issue found during working with end-users
using res_fax. If an incoming call is answered in the dialplan, or
jumps to the 'fax' extension due to reception of a CNG tone (with
faxdetect enabled), and then the remote endpoint sends a T.38
re-INVITE, it is possible for the channel's T.38 state to be
'T38_STATE_NEGOTIATING' when the application starts up. Unfortunately,
even if the application wants to use T.38, it can't respond to the
peer's negotiation request, because the AST_CONTROL_T38_PARAMETERS
control frame that chan_sip sent originally has been lost, and the
application needs the content of that frame to be able to formulate a
reply.

This patch adds a new 'request' type to AST_CONTROL_T38_PARAMETERS,
AST_T38_REQUEST_PARMS. If the application sends this request, chan_sip
will re-send the original control frame (with
AST_T38_REQUEST_NEGOTIATE as the request type), and the application
can respond as normal. If this occurs within the five second timeout
in chan_sip, the automatic cancellation of the peer reinvite will be
stopped, and the application will 'own' the negotiation process from
that point onwards.

This also improves the code path in chan_sip to allow sip_indicate(),
when called for AST_CONTROL_T38_PARAMETERS, to be able to return a
non-zero response, which should have been in place before since the
control frame *can* fail to be processed properly. It also modifies
ast_indicate() to return whatever result the channel driver returned
for this control frame, rather than converting all non-zero results
into '-1'. Finally, the new request type intentionally returns a
positive value, so that an application that sends
AST_T38_REQUEST_PARMS can know for certain whether the channel driver
accepted it and will be replying with a control frame of its own, or
whether it was ignored (if the sip_indicate()/ast_indicate() path had
properly supported failure responses before, this would not be
necessary).

This patch also modifies res_fax to take advantage of the new request.

In addition, this patch makes sip_t38_abort() actually lock the
private structure before doing its work... bad programmer, no donut.

This patch also enhances chan_sip's 'faxdetect' support to allow
triggering on T.38 re-INVITEs received as well as CNG tone detection.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254450 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-25 15:27:31 +00:00
Mark Michelson 10d65ad6b1 Fix potential invalid reads that could occur in pbx.c
Here is a cut and paste of my review request for this change:
This past weekend, Russell ran our current suite of unit tests for Asterisk
under valgrind. The PBX pattern match test caused valgrind to spew forth two
invalid read errors. This patch contains two changes that shut valgrind up and
do not cause any new memory leaks.

Change 1: In ast_context_remove_extension_callerid2, valgrind reported an
invalid read in the for loop close to the function's end. Specifically, one of
the the strcmp calls in the loop control was reading invalid memory. This was
because the caller of ast_context_remove_extension_callerid2 (__ast_context
destroy in this case) passed as a parameter a shallow copy of an ast_exten's
exten field. This same ast_exten was what was destroyed inside the for loop,
thus any iterations of the for loop beyond the destruction of the ast_exten
would result in invalid reads. My fix for this is to make a copy of the
ast_exten's exten field and pass the copy to
ast_context_remove_extension_callerid2. In addition, I have also acted
similarly with the ast_exten's matchcid field. Since in this case a NULL is
handled quite differently than an empty string, I needed to be a bit more
careful with its handling.

Change 2: In __ast_context_destroy, we iterated over a hashtab and called
ast_context_remove_extension_callerid2 on each item. Specifically, the hashtab
over which we were iterating was an ast_exten's peer_table. Inside of
ast_context_remove_extension_callerid2, we could possibly destroy this
ast_exten, which also caused the hashtab to be freed. Attempting to call
ast_hashtab_end_traversal on the hashtab iterator caused an invalid read to
occur when trying to read the iterator->tab->do_locking field since
iterator->tab had already been freed. My handling of this problem is a bit less
straightforward. With each iteration over the hashtab's contents, we set a
variable called "end_traversal" based on the return of
ast_context_remove_extension_callerid2. If 0 is ever returned, then we know
that the extension was found and destroyed. Because of this, we cannot call
ast_hashtab_end_traversal because we will be guaranteeing a read of invalid
memory. In such a case, we forego calling ast_hashtab_end_traversal and instead
call ast_free on the hashtab iterator.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254362 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-24 21:10:38 +00:00
Tzafrir Cohen 5a5599a764 make 'core show settings' should show all settable directories
(closes issue #17086)
Reported by: tzafrir
Patches:
      asterisk_extra_settings_dirs.diff uploaded by tzafrir (license 46)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-23 22:48:03 +00:00
Russell Bryant d9b1ff23ba Put test output for a failure in a CDATA section in the XML results.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254159 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-23 22:35:56 +00:00
Jeff Peeler 48edf2c78a Exit native bridging early for greater timing accuracy with warnings
This changes native bridging to break one millisecond early so that the more
accurate timeval calculations done in the generic bridge can be performed using
the bridge config. Currently the time between exiting native bridging slightly
late can sometimes cause a large enough discrepancy for warnings to be missed.
For the record, 1.4 does not attempt to native bridge at all when warnings are
enabled.

(closes issue #15815)
Reported by: adomjan

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-23 21:17:23 +00:00
Terry Wilson 66053b8a58 Don't act like an http write failed when it didn't
fwrite returns the number of items written, not the number of bytes


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-23 16:52:53 +00:00
Kevin P. Fleming ae6008ef3a Change per-file debug and verbose levels to be per-module, the way
users expect them to work.

'core set debug' and 'core set verbose' can optionally change the
level for a specific filename; however, this is actually for a
specific source file name, not the module that source file is included
in. With examples like chan_sip, chan_iax2, chan_misdn and others
consisting of multiple source files, this will not lead to the
behavior that users expect. If they want to set the debug level for
chan_sip, they want it set for all of chan_sip, and not to have to
also set it for reqresp_parser and other files that comprise the
chan_sip module.

This patch changes this functionality to be module-name based instead
of file-name based.

To make this work, some Makefile modifications were required to ensure
that the AST_MODULE definition is present in each object file produced
for each module as well.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-23 14:22:27 +00:00
Mark Michelson f9e4d024c9 Initialize channels prior to loading "preload" modules.
We can have bad results when a module, upon being loaded, attempts
to reference the channels container if the container hasn't yet
been initialized. I saw this happen by trying to preload pbx_config.so
and having a hint defined which referenced a non-existent SIP peer.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253872 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-22 20:32:15 +00:00
Matthew Nicholson 8acef966ef Merged revisions 253799 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r253799 | mnicholson | 2010-03-22 14:50:00 -0500 (Mon, 22 Mar 2010) | 4 lines
  
  Unconditionally copy the caller's account code to the called party.
  
  (related to issue #16331)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253800 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-22 19:52:52 +00:00
Russell Bryant 3da9f8ed19 Resolve more compiler warnings on FreeBSD.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253540 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-20 12:03:07 +00:00
Alec L Davis 743b168319 prevent segfault if bad magic number is encountered.
internal_ao2_ref uses INTERNAL_OBJ which mzy report 'bad magic number', but
internal_ao2_ref continues on, causing segfault.

Although AO2_MAGIC number is checked by INTERNAL_OBJ before internal_ao2_ref is
called, A02_MAGIC is being destroyed (or a wrong pointer) by the time
internal_ao2_ref uses INTERNAL_OBJ.

internal_ao2_ref now returns -1 if INTERNAL_OBJ encouters a bad magic number.

(issue #17037)
Reported by: alecdavis
Patches:
      bug17037.diff.txt uploaded by alecdavis (license 585)
Tested by: alecdavis




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253490 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-19 07:37:00 +00:00
Russell Bryant 32a649c3b9 Update comment to reflect new timeout value.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-18 18:23:07 +00:00
Russell Bryant d6ca5ac86e Increase CLI command output timeout for asterisk -rx to 60 seconds.
(closes issue #17049)
Reported by: russell
Tested by: russell

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253357 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-18 18:18:43 +00:00
Tilghman Lesher 0c0bf14d99 Just in case of a race, send the signal on interrupt.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-18 15:45:26 +00:00
Leif Madsen 0c5fb8037c main/test.c reports erroneous CLI message.
(closes issue #17051)
Reported by: Nick_Lewis

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253205 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-17 19:06:04 +00:00
Leif Madsen 6587f0941d Fix a typo.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-17 00:40:51 +00:00
Tilghman Lesher 385a40226a Fix test_time on Mac OS X (and other platforms without inotify)
Reviewboard: https://reviewboard.asterisk.org/r/554/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-16 19:34:01 +00:00
Tilghman Lesher 4c8f14b7cf Merged revisions 252361 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r252361 | tilghman | 2010-03-14 20:33:50 -0500 (Sun, 14 Mar 2010) | 4 lines
  
  Launch Asterisk on Mac OS X with launchd.
  
  Reviewboard: https://reviewboard.asterisk.org/r/551/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252362 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-15 01:37:04 +00:00
Russell Bryant f72c83684b Resolve unit test failure that occurred on Mac OSX.
On Linux (glibc), regcomp() does not return an error for an empty string.
However, the version on OSX will return an error.  The test for channel group
matching by regex now passes on the mac, as well.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-13 22:21:18 +00:00
Terry Wilson 68d1ded8dd Only change the RTP ssrc when we see that it has changed
This change basically reverts the change reviewed in
https://reviewboard.asterisk.org/r/374/ and instead limits the
updating of the RTP synchronization source to only those times when we
detect that the other side of the conversation has changed the ssrc.

The problem is that SRCUPDATE control frames are sent many times where
we don't want a new ssrc, including whenever Asterisk has to send DTMF
in a normal bridge. This is also not the first time that this mistake
has been made. The initial implementation of the ast_rtp_new_source
function also changed the ssrc--and then it was removed because of
this same issue. Then, we put it back in again to fix a different
issue. This patch attempts to only change the ssrc when we see that
the other side of the conversation has changed the ssrc.

It also renames some functions to make their purpose more clear.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-12 22:04:51 +00:00
Jeff Peeler 2d26a2da1f Add new unit test for stringfields.
(Copied from reviewboard)
Tests the following:
1. Basic allocation and setting of string fields.
2. Shrinking a string field and re-expanding it.
3. Growing the last allocation in a string field pool.
4. Setting a string to a large value such that a new string field pool must be
allocated.
In each part, we make sure that the string field is accurate (has the correct
value in it), make sure that the 2 bytes before the string field has the correct
capacity for the field, and for tests 2-4, we make sure that the string field is
where we expect it to be in memory.

Also tested:
5. Shrinking a string field and partially re-expanding it.
6. Setting strings in such a way as to create three separate string field pools
and then removing the middle pool.

There is a bug fix in the init function, which ensures the embedded_pool is set
to NULL which is important for stack allocated structures.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@251736 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-10 23:15:55 +00:00
Jeff Peeler 9620ccf057 Fix ParkAndAnnounce not respecting parking options.
The patch ensures that if a peer does not exist, parking settings are read from
the channel. A unit test has been written to ensure proper operation for both
standard parking and parking using masquerades.

(closes issue #16592)
Reported by: mwyres
Patches: 
      bug_16592.diff uploaded by snuffy (license 35)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@251679 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-10 20:51:23 +00:00
Jeff Peeler 94c83acaf4 Fix jitterbuffer logging not creating logfiles.
Three changes made here:
1) Do not fail if a previous log does not exist (in fact, this is probably
expected).
2) Ensure that the file descriptor to write to gets assigned properly. I am at
a loss as to why assigning safe_fd outside the if fixes this, but it makes
the if statement slightly less complicated anyway.
3) Move up the failure message so that the errno of the failure is not
overwritten by fclose.

(closes issue #16917)
Reported by: Artem


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@251631 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-10 18:25:18 +00:00
Tilghman Lesher da6ba8e60e Remove portions that weren't meant to be committed for the OS X compat fix
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@251263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-08 05:15:01 +00:00
Tilghman Lesher e58fc610ae Change needed to make Mac OS X 10.6 happy
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@251262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-08 05:12:55 +00:00
Richard Mudgett 73ef4b8daf Removed cdrflags from ast_channel structure.
Only chan_dahdi set a value in cdrflags.  Everyone else just copied it
around the system.  Noone cared about any value it may have contained.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250565 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-03 19:38:06 +00:00
David Vossel 59f615dbca Changes 0ms to <1ms in cli END results during 'test execute'
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250478 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-03 19:02:13 +00:00
Tilghman Lesher de7dcfd5d3 One more fix to editline
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250346 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-03 16:43:10 +00:00
Tilghman Lesher 6a90983ce6 Eliminate remaining libedit warnings (shown in bamboo)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250303 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-03 15:54:28 +00:00
David Vossel 7b51d1d71d fixes assumption that test failed if it did not pass when generating results
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250237 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-03 00:04:28 +00:00
Leif Madsen 78fdaa6865 Add missing description of the PARKINGLOT variable in XML documentation.
(closes issue #16743)
Reported by: snuffy
Patches: 
      parkingdoc.diff uploaded by snuffy (license 35)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@249925 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-02 19:24:43 +00:00
David Vossel 862ebf4d00 fixes adaptive jitterbuffer configuration
When configuring the adaptive jitterbuffer, the target_extra
value not only could not be set from the configuration, but was
not even being set to its proper default.  This value is required
in order for the adaptive jitterbuffer to work correctly.  To resolve
this a config option has been added to expose this value to the conf
files, and a default value is provided when no config specific value
is present.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@249893 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-02 19:08:38 +00:00
David Vossel feae3dbbdf adds Time field to "test show results" cli command
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@249186 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-26 18:41:36 +00:00
Mark Michelson da96c84c67 Send a manager event when the manager BridgeAction command is used.
(closes issue #16769)
Reported by: syspert
Patches:
      bridgeaction.patch uploaded by syspert (license 938)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@249105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-26 17:13:36 +00:00
Russell Bryant b607585b07 Trim trailing whitespace (to help reduce diff against cdr-q branch)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@249056 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-26 08:35:42 +00:00
Mark Michelson a1af5f4f72 Fix incorrect ACL behavior when CIDR notation of "/0" is used.
AST-2010-003



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@248946 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-25 22:41:48 +00:00
Tilghman Lesher a0af2cff0e Merged revisions 248859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r248859 | tilghman | 2010-02-25 15:21:05 -0600 (Thu, 25 Feb 2010) | 15 lines
  
  Some platforms clear /var/run at boot, which makes connecting a remote console... difficult.
  
  Previously, we only created the default /var/run/asterisk directory at install
  time.  While we could create it in the init script, that would not work for
  those who start asterisk manually from the command line.  So the safest thing
  to do is to create it as part of the Asterisk boot process.  This also changes
  the ownership of the directory, because the pid and ctl files are created after
  we setuid/setgid.
  
  (closes issue #16802)
   Reported by: Brian
   Patches: 
         20100224__issue16802.diff.txt uploaded by tilghman (license 14)
   Tested by: tzafrir
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@248861 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-25 21:22:39 +00:00
Tilghman Lesher 4e1e6820db Merged revisions 248582 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r248582 | tilghman | 2010-02-24 15:02:18 -0600 (Wed, 24 Feb 2010) | 7 lines
  
  Remove color code sequences from verbose messages that go to logfiles.
  (closes issue #16786)
   Reported by: dodo
   Patches: 
         logger2.patch uploaded by dodo (license 989)
   Tested by: tilghman
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@248584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-24 21:17:26 +00:00
Russell Bryant 5665aa361f Minor tweaks to comment blocks and includes.
Fix the copyright lines, tweak doxygen formatting, and remove some unnecessary
includes.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@248226 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-22 06:45:52 +00:00
Matthew Nicholson 469fed1cd3 Merged revisions 247651 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r247651 | mnicholson | 2010-02-18 13:38:09 -0600 (Thu, 18 Feb 2010) | 6 lines
  
  Copy the calling party's account code to the called party if they don't already have one.
  
  (closes issue #16331)
  Reported by: bluefox
  Tested by: mnicholson
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-18 19:39:37 +00:00
Richard Mudgett efea9ad922 Fix placing ISDN calls on hold preventing native bridging from being reexamined after a transfer.
Consider the following scenario:

                 /-- B
A == * == Network
                 \-- C

Party B calls party A (EuroISDN BRI phone)
Party A puts B on hold using the HOLD/RETRIEVE messages.
Party A calls party C.
Party A puts C on hold to talk with party B again.
Party A transfers B to C by hanging up.

The call does not get the opportunity to get re-transferred into the ISDN
network by the native bridge because native bridging is not being
reexamined after the initial transfer.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247609 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-18 18:31:44 +00:00
Mark Michelson 23d1c9186d Fix a couple of bugs in test tab completion.
1. Add missing unlock of lists.
2. Swap order of arguments to test_cat_cmp in complete_test_name.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 22:44:53 +00:00
Mark Michelson dd975726fc Tab completion for test categories and names for "test show registered" and "test execute" CLI commands.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247380 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 22:40:43 +00:00
Mark Michelson 2ce7eabb24 Fix two problems in ast_str functions found while writing a unit test.
1. The documentation for ast_str_set and ast_str_append state that
the max_len parameter may be -1 in order to limit the size of the
ast_str to its current allocated size. The problem was that the max_len
parameter in all cases was a size_t, which is unsigned. Thus a -1 was
interpreted as UINT_MAX instead of -1. Changing the max_len parameter
to be ssize_t fixed this issue.

2. Once issue 1 was fixed, there was an off-by-one error in the case
where we attempted to write a string larger than the current allotted
size to a string when -1 was passed as the max_len parameter. When trying
to write more than the allotted size, the ast_str's __AST_STR_USED was
set to 1 higher than it should have been. Thanks to Tilghman for quickly
spotting the offending line of code.

Oh, and the unit test that I referenced in the top line of this commit
will be added to reviewboard shortly. Sit tight...



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 21:22:40 +00:00
Jeff Peeler 27a4cda821 Add support for GROUP_MATCH_COUNT regex matching on category
Current support for regex matching was previously only available on the group.
Also, error reporting for regex failures has been added. In addition to this
feature enhancement a unit test has been written to check the regular expression
logic to ensure the count operation is working as expected.

(closes issue #16642)
Reported by: kobaz
Patches: 
      groupmatch2.patch uploaded by kobaz (license 834)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 19:51:53 +00:00
David Vossel 57c819fd5e addition of dynamic parkinglots feature
This feature allows for parkinglots to be created dynamically within
the dialplan.  Thanks to all who were involved with getting this patch
written and tested!

(closes issue #15135)
Reported by: IgorG
Patches:
      features.dynamic_park.v3.diff uploaded by IgorG (license 20)
      2009090400_dynamicpark.diff.txt uploaded by mvanbaak (license 7)
      dynamic_parkinglot.diff uploaded by dvossel (license 671)
Tested by: eliel, IgorG, acunningham, mvanbaak, zktech

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247248 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 18:29:48 +00:00
Tilghman Lesher bbb5acc65e RTP documentation states that you can pass NULL as the module, so make sure that's really the case.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247125 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 07:01:13 +00:00
Mark Michelson 68c6175f87 Add va_end calls to __ast_str_helper.
According to the man page for stdarg(3),
"Each invocation of va_copy() must be matched by a
corresponding invocation of va_end() in the same
function."

There were several cases in __ast_str_helper where
va_copy was not matched with a corresponding call
to va_end.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247076 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-16 23:44:33 +00:00
David Vossel 0f9e5ab557 swap openssl with OpenSSL in warning message.
(issue #16673)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246981 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-16 21:03:34 +00:00
David Vossel d693767226 warning message if openssl support is missing while attempting tls connection
(closes issue #16673)
Reported by: michaesc
Patches:
      tls_error_msg.diff uploaded by dvossel (license 671)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246980 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-16 20:54:48 +00:00
David Vossel 091f850a58 fixes sample rate conversion issue with Monitor application
When using ast_seekstream with the read/write streams of a monitor,
the number of samples we are seeking must be of the same rate as the
stream or the jump calculation will be incorrect.  This patch adds logic
to correctly convert the number of samples to jump to the sample rate
the read/write stream is using.

For example, if the call is G722 (16khz) and the read/write stream is
recording a 8khz wav, seeking 320 samples of 16khz audio is not the
same as seeking 320 samples of 8khz audio when performing the ast_seekstream
on the stream.

ABE-2044



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246899 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-16 17:07:41 +00:00
Tilghman Lesher 22b144cef4 Change the blanket rules to delete .lastclean on all CFLAGS menuselect targets to be more particular.
This change builds upon the recent change to menuselect to add 'touch_on_change'
as an attribute of both categories and members.  This should allow only the most
invasive defines to cause a complete rebuild, while defines which only affect a
subset of modules will only cause a rebuild of that smaller set.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246789 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-16 00:52:45 +00:00
David Vossel 7d5d0311c1 Merged revisions 246545 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r246545 | dvossel | 2010-02-12 17:30:17 -0600 (Fri, 12 Feb 2010) | 16 lines
  
  lock channel during datastore removal
  
  On channel destruction the channel's datastores are removed and
  destroyed.  Since there are public API calls to find and remove
  datastores on a channel, a lock should be held whenever datastores are
  removed and destroyed.  This resolves a crash caused by a race
  condition in app_chanspy.c.
  
  (closes issue #16678)
  Reported by: tim_ringenbach
  Patches:
        datastore_destroy_race.diff uploaded by tim ringenbach (license 540)
  Tested by: dvossel
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246546 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-12 23:32:33 +00:00
David Vossel 9478670527 astobj2 unit test and bug fix
A bug was discovered during the creation of the astobj2 unit test.
When OBJ_MULTIPLE | OBJ_UNLINK is used, the objects being returned
had a ref count issue.  This patch resolves that.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-11 18:42:25 +00:00
Russell Bryant 1321748c19 Add a test module for the event API, test_event.c.
This module includes a single test so far that creates events using two
different methods and does some verification on the result to make sure
the correct data can be retrieved from the event that was created.

One bug was found in the event API while developing this test, which makes
me happy.  :-)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-10 23:19:16 +00:00
Russell Bryant bbed34f764 Various updates to the unit test API.
1) It occurred to me that the difference in usage between the error ast_str and
the ast_test_update_status() usage has turned out to be a bit ambiguous in
practice.  In a lot of cases, the same message was being sent to both.
In other cases, it was only sent to one or the other.  My opinion now is that
in every case, I think it makes sense to do both; we should output it to the
CLI as well as save it off for logging purposes.

This change results in most of the changes in this diff, since it required
changes to all existing unit tests.  It also allowed for some simplifications
of unit test API implementation code.

2) Update ast_test_status_update() to include the file, function, and line
number for the code providing the update.

3) There are some formatting tweaks here and there.  Hopefully they aren't too
distracting for code review purposes.  Reviewboard's diff viewer seems to do a
pretty good job of pointing out when something is a whitespace change.

4) I moved the md5_test and sha1_test into the test_utils module.  It seemed
like a better approach since these tests are so tiny.

5) I changed the number of nodes used in heap_test_2 from 1 million to
100 thousand.  The only reason for this was to reduce the time it took
for this test to run.

6) Remove an unused function prototype that was at the bottom of utils.h.

7) Simplify test_insert() using the LIST_INSERT_SORTALPHA() macro.  The one
minor difference in behavior is that it no longer checks for a test registered
with the same name.

8) Expand the code in test_alloc() to provide specific error messages for each
failure case, to clearly inform developers if they forget to set the name,
summary, description, etc.

9) Tweak the output of the "test show registered" CLI command.  I swapped the
name and category to have the category first.  It seemed more natural since
that is the sort key.

10) Don't output the status ast_str in the "test show results" CLI command.
This is going to tend to be pretty verbose, so just leave that for the
detailed test logs (test generate results).

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-09 23:32:14 +00:00
Russell Bryant f2282722dd Fix return value of get_ie_str() and get_ie_str_hash() for non-existent IE.
I found this bug while developing a unit test for event allocation.  Testing
is awesome.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245624 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-08 23:43:00 +00:00
Russell Bryant a0d74cef66 Use memmove() instead of memcpy() for a case where the buffers overlap.
Once again, valgrind is freaking awesome.  That is all.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245610 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-08 23:23:45 +00:00
Tilghman Lesher 2b01c7b185 Actually use _ASTLDFLAGS in the main/ and channels/ Makefiles.
They were previously passed correctly, but they simply weren't used.  This
caused issues with various platforms whose builds needed to pass special
linker flags via the configure script.

(closes issue #16596)
 Reported by: pprindeville
 Patches: 
       asterisk-1.6-astldflags.patch uploaded by pprindeville (license 347)
 Tested by: tilghman


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-08 22:31:40 +00:00
Jason Parker e90a6b4646 Merged revisions 245496 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r245496 | qwell | 2010-02-08 14:39:50 -0600 (Mon, 08 Feb 2010) | 4 lines
  
  Remove reference of documentation in source directory.
  
  People don't always build Asterisk from source (distro packages, anybody?).
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-08 20:41:05 +00:00
Russell Bryant 2191c94336 Remove an extra space.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-07 20:56:57 +00:00
David Vossel bc16d44b73 fixes astobj2 unlinking of multiple objects when OBJ_MULTIPLE was disabled
When OBJ_MULTIPLE was off but OBJ_UNLINK was on, all the items in a bucket
were being unlinked instead of just the first match.  This fixes that.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245147 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-05 21:21:05 +00:00
Tilghman Lesher cf6592e58e Merge tests that verify the same thing. (Oops.)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-05 19:07:18 +00:00
Sean Bright acdb1bd82f Merged revisions 244926 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r244926 | seanbright | 2010-02-05 12:03:35 -0500 (Fri, 05 Feb 2010) | 1 line
  
  Update main copyright date.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244927 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-05 17:05:32 +00:00
David Vossel a7123b5f4f fixes memory leak in astobj2 test
ao2_iterator_destroy was not being used on the
iterator during the test.  This resulted in the
container never actually being destroyed.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-05 04:22:15 +00:00
Tilghman Lesher 962b1a22fd Try to make ast_format_str_reduce fail...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244768 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-04 22:43:33 +00:00
David Vossel 6c0399452c fix truncated format string in 'test show registered'
When using the 'test show registered' cli command the 'Test Results'
category was truncating the last few characters making it look like 
'Test Resul'.  I also expanded other parts of the format to better
represent how long function names and categories will likely be.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-04 15:36:33 +00:00
Jeff Peeler b527525ffc Add some additional option support for non-default parking lots.
The options are: parkedcallparking, parkedcallhangup, parkedcallrecording, and
parkedcalltransfers. Previously these options were only available for the 
default parking lot.

(closes issue #16641)
Reported by: bluecrow76
Patches: 
      asterisk-1.6.2.1-features.c.diff uploaded by bluecrow76 (license 270)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-03 20:48:36 +00:00
Mark Michelson dbc3111652 Initialize counters in ast_sched_report so that resulting data is not bogus.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244547 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-03 19:26:53 +00:00
David Vossel 36bbf8f902 fixes crash during T.38 negotiation caused by invalid or missing FaxMaxDatagram field
AST-2010-001

(closes issue #16634)
Reported by: krn

(closes issue #16724)
Reported by: barthpbx

(closes issue #16517)
Reported by: bklang

(closes issue #16485)
Reported by: elsto




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244443 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-02 22:27:23 +00:00
Tilghman Lesher 72c1b76038 Merged revisions 244070 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r244070 | tilghman | 2010-02-01 11:46:31 -0600 (Mon, 01 Feb 2010) | 16 lines
  
  Revert previous chan_local fix (r236981) and fix instead by destroying expired frames in the queue.
  
  (closes issue #16525)
   Reported by: kobaz
   Patches: 
         20100126__issue16525.diff.txt uploaded by tilghman (license 14)
         20100129__issue16525__1.6.0.diff.txt uploaded by tilghman (license 14)
   Tested by: kobaz, atis
  
  (closes issue #16581)
   Reported by: ZX81
  
  (closes issue #16681)
   Reported by: alexr1
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244071 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-01 17:53:39 +00:00
Jeff Peeler 80d3e91714 Optimization to manager events.
When potentially sending manager events, return immediately if there are no
sessions or hooks. Also, avoid locking the hooks list if it is empty.

(issue #16455)
Reported by: atis
Patches: 
      manager_hooks_trunk.patch uploaded by atis (license 242)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243986 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-28 22:37:15 +00:00
Jeff Peeler a170cd28e0 Add new option to asterisk.conf (lockconfdir) to protect conf dir during reloads
(closes issue #16358)
Reported by: raarts
Patches: 
      lockconfdir.diff uploaded by raarts (license 937)
      modified by me


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-27 18:29:49 +00:00
Mark Michelson 630b8027c3 Merged revisions 243486 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r243486 | mmichelson | 2010-01-27 12:06:43 -0600 (Wed, 27 Jan 2010) | 3 lines
  
  Use a safe list traversal while checking for duplicate vars in pbx_builtin_setvar_helper.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243487 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-27 18:08:02 +00:00
David Vossel 7662c7fed2 Merged revisions 243390 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r243390 | dvossel | 2010-01-26 17:55:49 -0600 (Tue, 26 Jan 2010) | 9 lines
  
  fixes bug with channel receiving wrong privileges after call parking 
  
  (closes issue #16429)
  Reported by: Yasuhiro Konishi
  Patches:
        features.c.diff uploaded by Yasuhiro Konishi (license 947)
  Tested by: dvossel
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 23:56:57 +00:00
Jeff Peeler c277952cea Merged revisions 243258 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r243258 | jpeeler | 2010-01-26 12:19:10 -0600 (Tue, 26 Jan 2010) | 2 lines
  
  Remove unnecessary code in ast_read as issue 16058 has been fully solved now.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 18:20:55 +00:00
Jeff Peeler 1d293d0093 Fix crash resulting from frames with invalid data pointers.
In ast_frdup the frame data union does not get set to point to malloced memory 
if the datalen is zero, so make sure to handle the same case in ast_frisolate
appropriately.

(closes issue #16058)
Reported by: atis
Patches: 
      bug16058-fix.patch uploaded by jpeeler (license 325)
Tested by: atis


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243244 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 18:07:57 +00:00
David Vossel adfa169e46 modify 'test show registered' cli output format
In order to improve readability, the output from 'test show
registered' has been modified to truncate fields to fit within
the format output if they are over a certain length.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243242 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 17:40:02 +00:00
David Vossel d16b89be17 RFC compliant uri and display-name encode/decode
1.  URI Encoding
This patch changes ast_uri_encode()'s behavior when doreserved is enabled.
Previously when doreserved was enabled only a small set of reserved
characters were encoded.  This set was comprised primarily of the reserved
characters defined in RFC3261 section 25.1, but contained other characters as
well.  Rather than only escaping the reserved set, doreserved now escapes
all characters not within the unreserved set as defined by RFC 3261 and
RFC 2396.  Also, the 'doreserved' variable has been renamed to 'do_special_char'
in attempts to avoid confusion.

When doreserve is not enabled, the previous logic of only encoding the
characters <= 0X1F and > 0X7f remains, except for the '%' character, which
must always be encoded as it signifies a HEX escaped character during the decode
process.

2. URI Decoding: Break up URI before decode.
In chan_sip.c ast_uri_decode is called on the entire URI instead of it's
individual parts after it is parsed.  This is not good as ast_uri_decode
can introduce special characters back into the URI which can mess up parsing.
This patch resolves this by not decoding a URI until parsing is completely
done.  There are many instances where we check to see if pedantic checking
is enabled before we decode a URI.  In these cases a new macro,
SIP_PEDANTIC_DECODE, is used on the individual parsed segments of the URI
rather than constantly putting if (pedantic) { decode() } checks everywhere
in the code.  In the areas where ast_uri_decode is not dependent upon
pedantic checking this macro is not used, but decoding is still moved to
each individual part of the URI.  The only behavior that should change from
this patch is the time at which decoding occurs.

Since I had to look over every place URI parsing occurs to create this
patch, I found several places where we use duplicate code for parsing.
To consolidate the code, those areas have updated to use the parse_uri()
function where possible.

3. SIP display-name decoding according to RFC3261 section 25.
To properly decode the display-name portion of a FROM header, chan_sip's
get_calleridname() function required a complete re-write.  More information
about this change can be found in the comments at the beginning of this function.

4. Unit Tests.
Unit tests for ast_uri_encode, ast_uri_decode, and get_calleridname() have been
written.  This involved the addition of the test_utils.c file for testing the
utils api.

(closes issue #16299)
Reported by: wdoekes
Patches:
      astsvn-16299-get_calleridname.diff uploaded by wdoekes (license 717)
      get_calleridname_rewrite.diff uploaded by dvossel (license 671)
Tested by: wdoekes, dvossel, Nick_Lewis

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 16:30:08 +00:00
Tilghman Lesher 1ffdf5c2ee Merged revisions 242969 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r242969 | tilghman | 2010-01-25 15:50:22 -0600 (Mon, 25 Jan 2010) | 2 lines
  
  Err, and use the new menuselect define, too.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242971 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 21:51:41 +00:00
Olle Johansson 7c61a7105f Change api for pbx_builtin_setvar to actually return error code if a function can't be written to.
This patch removes code that was duplicated from pbx.c to manager.c
in order to prevent API change in released versions of Asterisk.

There are propably also other places that would benefit from reading the
return code and react if a function returns error codes on writing a value into it.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242919 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 21:13:20 +00:00
Olle Johansson 52b0cb912b Merged revisions 242850 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r242850 | oej | 2010-01-25 21:03:38 +0100 (Mån, 25 Jan 2010) | 2 lines

Report error when writing to functions returns error in AMI setvar action

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 20:27:59 +00:00
Tilghman Lesher 245bd1861f Merged revisions 242852 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r242852 | tilghman | 2010-01-25 14:15:45 -0600 (Mon, 25 Jan 2010) | 2 lines
  
  Restore FreeBSD to able-to-compile-ish-mode
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 20:18:15 +00:00
Tilghman Lesher afb9fab574 Merged revisions 242728 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r242728 | tilghman | 2010-01-24 23:42:22 -0600 (Sun, 24 Jan 2010) | 2 lines
  
  Buildbot pointed out an error (thanks, buildbot!)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242729 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 05:45:00 +00:00
Tilghman Lesher 2016dbb826 Merged revisions 242683 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r242683 | tilghman | 2010-01-24 23:13:28 -0600 (Sun, 24 Jan 2010) | 2 lines
  
  Make the build of the Asterisk expression parser match that of the AEL parser.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 05:30:33 +00:00
Russell Bryant d6ad0f30b4 Update the doxygenification of some comments.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242186 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-22 04:57:03 +00:00
Mark Michelson c8c4ea9bf4 Add missing argument to ast_calloc calls.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-21 22:37:55 +00:00
Olle Johansson fccf277864 Make sure we initialize the ast_ha structure with ast_calloc
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-21 21:05:56 +00:00
Russell Bryant e718ef4d45 Point to a useful reference on the XML output format.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241856 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-21 14:10:51 +00:00
Russell Bryant efdbde9c25 Modify test results XML format to match the JUnit format.
When this code was developed, we came up with our own XML format for the test
output.  I have since started looking at integration with other tools, namely
continuous integration frameworks, and this format seems to be supported
across a number of applications.  With these changes in place, I was able
to get Atlassian Bamboo to interpret the test results.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241855 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-21 13:59:41 +00:00
Alec L Davis 3a24f8ad06 Add Calling and Called Subaddress to CDR record
Requires 'callingsubaddr' and 'calledsubaddr' fields in backend cdr.

(closes issue #16600)
Reported by: alecdavis
Patches: 
      cdr_subaddr.diff.txt uploaded by alecdavis (license 585)
Tested by: alecdavis

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241581 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-20 17:49:30 +00:00
Alec L Davis c7be027151 Update CDR variables as pbx starts
Allows CDR variables added in cdr.c:set_one_cid to become visable during the call,
by executing ast_cdr_update() early in __ast_pbx run.
Reverts sig_pri changes in trunk that are specific to isdn technology only.

(closes issue #16638)
Reported by: alecdavis
Patches: 
      cdr_update.diff3.txt uploaded by alecdavis (license 585)
Tested by: alecdavis



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-20 08:18:45 +00:00
Jeff Peeler 8fd9401e3d Initialize data on the stack so that Park doesn't interpret random arguments.
passdata was only being set in pbx_substitue_variables when arguments were
passed.

(closes issue #16406)
(closes issue #16586)
Reported by: DLNoah
Patches: 
      bug16586v2.patch uploaded by jpeeler (license 325)
Tested by: DLNoah



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241366 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-19 22:59:53 +00:00
Tilghman Lesher 49bf540c71 Create iterative method for querying SRV results, and use that for finding AGI servers.
(closes issue #14775)
 Reported by: _brent_
 Patches: 
       20091215__issue14775.diff.txt uploaded by tilghman (license 14)
       hagi-5.patch uploaded by brent (license 388)
 Tested by: _brent_
 Reviewboard: https://reviewboard.asterisk.org/r/378/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241188 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-19 00:28:49 +00:00
Jeff Peeler 568c057c4c Extend max call limit duration from 24.8 days to 292+ million years.
If the limit was set past MAX_INT upon answering, the call was immediately
hung up due to overflow from the return of ast_tvdiff_ms (in ast_check_hangup).
The time calculation functions ast_tvdiff_sec and ast_tvdiff_ms have been
changed to return an int64_t to prevent overflow. Also the reporter suggested
adding a message indicating the reason for the call hanging up. Given that the
new limit is so much higher, the message (which would only really be useful in
the overflow scenario) has been made a debug message only.

(closes issue #16006)
Reported by: viraptor


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-18 22:31:25 +00:00
Jason Parker bbd290308f Fix an RTP instance allocation failure on Solaris.
(closes issue #16543)
Reported by: crjw
Patches:
      rtp_sin_family.patch uploaded by crjw (license 963)
Tested by: crjw, qwell


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241098 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-18 22:03:49 +00:00
Sean Bright bb03a2f7d9 Merged revisions 241015 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r241015 | seanbright | 2010-01-18 14:54:19 -0500 (Mon, 18 Jan 2010) | 12 lines
  
  Plug a memory leak when reading configs with their comments.
  
  While reading through configuration files with the intent of returning their
  full contents (comments specifically) we allocated some memory and then forgot
  to free it.  This doesn't fix 16554 but clears up a leak I had in the lab.
  
  (issue #16554)
  Reported by: mav3rick
  Patches:
        issue16554_20100118.patch uploaded by seanbright (license 71)
  Tested by: seanbright
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241016 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-18 19:57:52 +00:00
Sean Bright 9e02292e5c Avoid a crash on Solaris when running 'core show functions.'
(closes issue #16309)
Reported by: asgaroth


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-17 19:45:48 +00:00
Tilghman Lesher 6c1e69370e Err, oops, it was already the way I intended.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240629 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-15 23:50:47 +00:00
Tilghman Lesher 8037982fa6 The previous attempt at using a pipe to guarantee astcanary shutdown did not work.
We're revisiting the previous patch, albeit with a method that overcomes the
prior criticism that it was not POSIX-compliant.
(closes issue #16602)
 Reported by: frawd
 Patches: 
       20100114__issue16602.diff.txt uploaded by tilghman (license 14)
 Tested by: frawd


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240499 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-15 21:40:14 +00:00
Tilghman Lesher e8a6d2995e Add pickup event to AMI. Also, fix AMI documentation.
(closes issue #16431)
 Reported by: syspert
 Patches: 
       20100112__issue16431.diff.txt uploaded by tilghman (license 14)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240421 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-15 21:04:34 +00:00
Mark Michelson fe72baf06b Make sure to set owner_line, ownder_func, and owner_file in ast_calloc_with_stringfields.
Asterisk would crash on startup if MALLOC_DEBUG were set in menuselect. This is because
the manager action UpdateConfig had to resize its string field allocation to set the
description. When the resize occurred, ast_copy_string would crash because we were
attempting to copy a string from a NULL pointer. Setting the strings initially makes
the code much less crashy.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240420 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-15 20:58:24 +00:00
Russell Bryant 86c57df84e Ensure payload type is properly checked when comparing against cached events.
(closes issue #16607)
Reported by: ddv2005
Patches:
      event.patch uploaded by ddv2005 (license 769)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240411 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-15 20:41:11 +00:00
Sean Bright e612d87695 Convert a few places to use ast_calloc_with_stringfields where applicable.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240368 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-15 18:21:50 +00:00
Jeff Peeler 9228fba7d7 Fix broken call pickup
The problem was the OUTGOING flag was not getting set properly on the channel,
resulting in pickup failing as ast_read thought the call was inbound. Refer to
170393 for a more verbose description as this is the same exact change.

(closes issue #16539)
Reported by: syspert
Patches: 
      bug16539.patch uploaded by jpeeler (license 325)
Tested by: syspert


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240179 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-14 18:03:31 +00:00
Tilghman Lesher 3eb8f0a8dc Similarly, ensure that matchcid is duplicated correctly when merging contexts.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-14 17:34:53 +00:00
Tilghman Lesher 20e57b12e8 Ensure that the callerid is NULL when the parent is effectively NULL.
This applies only to pattern-match hints, which create exact-match
hints on the fly.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240129 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-14 16:52:22 +00:00
Matthew Nicholson ef0da09c74 This change fixes a few bugs in the way the far max IFP was calculated that were introduced in r231692.
(closes issue #16497)
Reported by: globalnetinc
Patches:
      udptl-max-ifp-fix1.diff uploaded by mnicholson (license 96)
Tested by: globalnetinc



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240078 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-14 16:14:35 +00:00
Tilghman Lesher 87ea570ef1 Oops, another tag error
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-13 23:22:56 +00:00
Tilghman Lesher b01df91513 Oops, missed a closing tag
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239996 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-13 23:21:46 +00:00
Tilghman Lesher ecbe7eff7a Add the TESTTIME() dialplan function, which permits testing GotoIfTime.
Specifically, by setting TESTTIME() to a particular date and time, you
can test whether a dialplan correctly branches as was intended.  This was
developed after recent questions on the -users list on how to test their
holiday dialplan logic.
(closes issue #16464)
 Reported by: tilghman
 Patches: 
       20100112__issue16464.diff.txt uploaded by tilghman (license 14)
 
Review: https://reviewboard.asterisk.org/r/458/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-13 21:27:34 +00:00
Tilghman Lesher 919437428e Flex uses fwrite incorrectly, which breaks the build. Providing a workaround.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239920 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-13 20:38:42 +00:00
Jeff Peeler 495b701a85 Merged revisions 239838 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r239838 | jpeeler | 2010-01-13 13:43:33 -0600 (Wed, 13 Jan 2010) | 11 lines
  
  Fix regression for timed out parked call returning to caller
  
  This issue seems to have been exposed by the fix in 160390 whereby using a
  masquerade prevented a crash. The new channel used in the masquerade was
  not copying the macro information from the old channel.
  
  (closes issue #15459)
  Reported by: djrodman
  Patches: 
        patch_15459.txt uploaded by mnick (license )
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239839 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-13 19:48:16 +00:00
Tilghman Lesher 6d1086ec86 Code previously added to ast_expr2f.c warranted a change in the source file ast_expr2.fl.
Also, made a Makefile change to ensure that the expression parser C source files get
regenerated correctly, when we need that to happen.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239797 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-13 18:16:13 +00:00
David Vossel 03529837cc add silence gen to wait apps
asterisk.conf's 'transmit_silence' option existed before
this patch, but was limited to only generating silence
while recording and sending DTMF.  Now enabling the
transmit_silence option generates silence during wait
times as well.

To achieve this, ast_safe_sleep has been modified to
generate silence anytime no other generators are present
and transmit_silence is enabled.  Wait apps not using
ast_safe_sleep now generate silence when transmit_silence
is enabled as well.

(closes issue #16524)
Reported by: kobaz

(closes issue #16523)
Reported by: kobaz
Tested by: dvossel

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239712 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-13 16:31:14 +00:00
Olle Johansson c300b12b18 MAX() moved to utils.h
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-13 10:45:19 +00:00
Tilghman Lesher d80a38310a Blank callerid and NULL callerid should not compare equal.
The second is the default state for matching CID in the dialplan (no matching)
while the first matches one particular CallerID.  This is a regression.
(fixes AST-314, SWP-611)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239571 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-12 19:58:00 +00:00
Alec L Davis 113ff66f7f add Dialed Number Identifier (DNID) field to cdr records.
reviewboard link: https://reviewboard.asterisk.org/r/455/

  Reported by: alecdavis
  Tested by: alecdavis
  Patch
	 cdr_dnid.diff2.txt uploaded by alecdavis (license 585)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-12 18:55:54 +00:00
Sean Bright ba6201cae6 Fix ao2_callback when both OBJ_MULTIPLE and OBJ_NODATA are passed.
There is an issue which only affects trunk and the new ao2_callback OBJ_MULTIPLE
implementation.  When both OBJ_MULTIPLE and OBJ_NODATA are passed, only the first
object is visited, regardless of what is returned by the specified callback. This
causes a problem when we are clearing a container, i.e.:

    ao2_callback(container, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL);

Only unlinks the first object.  This patch resolves this.

(closes issue #16564)
Reported by: pj
Patches:
      issue16564_20100111.diff uploaded by seanbright (license 71)
Tested by: pj, seanbright

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239113 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-11 16:40:23 +00:00
Sean Bright 1ad2999112 Fix spelling of 'category.'
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239111 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-11 16:22:09 +00:00
Tilghman Lesher 9c1b53cab4 According to POSIX, the capital L modifier applies only to floating point types.
Fixes a crash on Solaris.
(closes issue #16572)
 Reported by: crjw
 Patches: 
       frame_changes.patch uploaded by crjw (license 963)
       Plus several others found and fixed by me


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239074 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-10 19:37:30 +00:00
Tilghman Lesher 5e0762370c It's been long enough -- make the behavior introduced in 1.6 the default.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239000 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-10 06:56:36 +00:00
Tilghman Lesher 31e93b2865 Merged revisions 238915 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r238915 | tilghman | 2010-01-08 18:57:58 -0600 (Fri, 08 Jan 2010) | 6 lines
  
  -1 is interpreted as an error, intead of the maximum mask.
  (closes issue #16241)
   Reported by: vnovy
   Patches: 
         manager.c.patch uploaded by vnovy (license 922)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238916 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-09 01:08:04 +00:00
Jeff Peeler cde1057ec3 Merged revisions 238834 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r238834 | jpeeler | 2010-01-08 17:28:37 -0600 (Fri, 08 Jan 2010) | 4 lines
  
  Stop a crash when no peer is passed to masq_park_call.
  
  (distantly related to issue #16406)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238835 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-08 23:30:55 +00:00
David Vossel bf06747778 fixes AUDIOHOOK_INHERIT regression
During the process of removing an audiohook from one channel
and attaching it to another the audiohook's status is updated
to DONE and then back to whatever it was previously.  Typically
updating the status after setting it to DONE is not a good idea
because DONE can trigger unrecoverable audiohook destruction
events... because of this a conditional check was added to
audiohook_update_status to explicitly prevent the audiohook
from ever changing after being set to DONE.  It was this check
that prevented audiohook inherit from work properly though.

Now ast_audiohook_move_by_source is treated as a special exception,
as the audiohook must be returned to its previous status after
attaching it to the new channel.  This is only a safe operation
because the audiohook's lock is held the entire time, otherwise
this could cause trouble.

(closes issue #16522)
Reported by: corruptor



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238635 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-08 19:39:30 +00:00
Matthew Nicholson 98b69d84e1 Merged revisions 238629 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r238629 | mnicholson | 2010-01-08 13:20:44 -0600 (Fri, 08 Jan 2010) | 5 lines
  
  Properly calculate the remaining space in the output string when reducing format strings.
  
  (closes issue #16560)
  Reported by: goldwein
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238630 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-08 19:32:11 +00:00
Jeff Peeler 7df5564a61 Stop trying to find a parking space after traversing the parkinglot one time.
(closes issue #16428)
Reported by: Yasuhiro Konishi


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-08 17:18:41 +00:00
David Vossel a575a50cd5 fixes ast_transfer stall until hangup if called with a channel that doesn't support transfers
ast_transfer sets res to 0 if there is no technology transfer function,
but then tests for it to be negative before deciding to do an early exit.
As a result, it will will wait for an AST_CONTROL_TRANSFER message that
will never come.

(closes issue #16424)
Reported by: davidw
Patches:
      Issue_16424_trunk_234134.patch uploaded by davidw (license 780)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238492 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-07 20:42:27 +00:00
Jeff Peeler 0a4f80cbcf Fix channel name comparison for bridge application.
The channel name comparison was not comparing the whole string and therefore
if one channel name was a substring of the other, the bridge would fail.

(closes issue #16528)
Reported by: telecos82
Patches: 
      res_features_r236843.diff uploaded by telecos82 (license 687)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238134 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-06 19:05:06 +00:00
David Vossel bebe42f3a7 fixes subscriptions being lost after 'module reload'
During a module reload if multiple extension configs are present,
such as both extensions.conf and extensions.ael, watchers for one
config's hints will be lost during the merging of the other config.

This happens because hint watchers are only preserved for the
current config being merged.  The old context list is destroyed
after the merging takes place, meaning any watchers that were not
perserved will be removed.

Now all hints are preserved during merging regardless of what config
file is being merged.  These hints are only restored if they
are present within the new context list.

(closes issue #16093)
Reported by: jlaroff



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237839 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-05 19:29:47 +00:00
Russell Bryant 3a6d247def Fix build of utility apps that include utils.c.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-05 17:26:50 +00:00
Russell Bryant 630152f848 Merged revisions 237697 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r237697 | russell | 2010-01-05 11:13:28 -0600 (Tue, 05 Jan 2010) | 7 lines
  
  Change a NOTICE log message to DEBUG where it belongs.
  
  (closes issue #16479)
  Reported by: alexrecarey
  
  (closes SWP-577)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-05 17:16:01 +00:00
Tilghman Lesher 3f33c38c8a Merged revisions 237573 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r237573 | tilghman | 2010-01-04 15:45:46 -0600 (Mon, 04 Jan 2010) | 6 lines
  
  Bounds checking for input string
  (closes issue #16407)
   Reported by: qwell
   Patches: 
         20100104__issue16407.diff.txt uploaded by tilghman (license 14)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237574 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-04 21:48:20 +00:00
Tilghman Lesher 7acf8196d0 Merged revisions 237493 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r237493 | tilghman | 2010-01-04 14:57:35 -0600 (Mon, 04 Jan 2010) | 8 lines
  
  Regression in issue #15421 - Pattern matching
  (closes issue #16482)
   Reported by: wdoekes
   Patches: 
         astsvn-16482-betterfix.diff uploaded by wdoekes (license 717)
         20091223__issue16482.diff.txt uploaded by tilghman (license 14)
   Tested by: wdoekes, tilghman
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237494 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-04 20:59:01 +00:00
Tilghman Lesher c0eb48380a Oops, didn't compile (thanks, kpfleming)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-04 19:03:20 +00:00
Tilghman Lesher f2a282ce17 Further reduce the encoded blank values back to blank in the realtime API.
(closes issue #16533)
 Reported by: sergee
 Patches: 
       200100104__issue16533.diff.txt uploaded by tilghman (license 14)
 Tested by: sergee


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237410 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-04 18:42:10 +00:00
Tilghman Lesher 386b847075 Merged revisions 237405 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r237405 | tilghman | 2010-01-04 12:19:00 -0600 (Mon, 04 Jan 2010) | 16 lines
  
  Add a flag to disable the Background behavior, for AGI users.
  This is in a section of code that relates to two other issues, namely
  issue #14011 and issue #14940), one of which was the behavior of
  Background when called with a context argument that matched the current
  context.  This fix broke FreePBX, however, in a post-Dial situation.
  Needless to say, this is an extremely difficult collision of several
  different issues.  While the use of an exception flag is ugly, fixing all
  of the issues linked is rather difficult (although if someone would like
  to propose a better solution, we're happy to entertain that suggestion).
  (closes issue #16434)
   Reported by: rickead2000
   Patches: 
         20091217__issue16434.diff.txt uploaded by tilghman (license 14)
         20091222__issue16434__1.6.1.diff.txt uploaded by tilghman (license 14)
   Tested by: rickead2000
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-04 18:28:28 +00:00
Jason Parker f93071483f Add app_voicemail and say.c support for Vietnamese.
Also add an XXX comment that I'm baffled nobody has ever complained about.  We
say "first message", and then we go into language-specific stuff where we
proceed to say..."first message".

(closes issue #15053)
Reported by: dinhtrung
Patches:
      vietnamese.ods uploaded by dinhtrung (license 776)
      app_voicemail.c.diff uploaded by dinhtrung (license 776)

(closes issue #15626)
Reported by: dinhtrung
Patches:
      say.c.diff uploaded by dinhtrung (license 776)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-30 22:30:21 +00:00
Jeff Peeler 1a219ad725 Fix compiling with LOW_MEMORY.
Modified handle_verbose to be LOW_MEMORY aware, removed old RTP related code
in chan_sip.

(closes issue #16381)
Reported by: michael_iedema
Patches: 
      ast_complete_source_filename.patch uploaded by michael iedema (license 942)
      modified by me


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@236893 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-30 20:34:41 +00:00
Jason Parker 21954cea7d Allow "REMAINDER" to function properly in expressions.
(closes issue #16427)
Reported by: wdoekes
Patches:
      ast16-reminder-remainder.patch uploaded by wdoekes (license 717)
Tested by: wdoekes


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@236713 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-28 22:09:40 +00:00
David Vossel 73cb2d507b Unit Test Framework API
The Unit Test Framework is a new API that manages registration and
execution of unit tests in Asterisk with the purpose of verifying the
operation of C functions.  The Framework consists of a single test
manager accompanied by a list of registered test functions defined
within the code.  A test is defined, registered, and unregistered
from the framework using a set of macros which allow the test code
to only be compiled within asterisk when the TEST_FRAMEWORK flag is
enabled in menuselect.  This allows the test code to exist in the
same file as the C functions it intends to verify.  Registered tests
may be viewed and executed via a set of new CLI commands.  CLI commands
are also present for generating and exporting test results into xml
and txt formats.

For more information and use cases please refer to the documentation
provided at the beginning of the test.h file.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@236027 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-22 16:09:11 +00:00
Kevin P. Fleming ef9be94b35 Change all refererences to 1.6.3 to be 1.8, since that will be the next feature release
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@235904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-21 18:51:17 +00:00
Tilghman Lesher 128e4022d0 Merged revisions 235821 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r235821 | tilghman | 2009-12-21 10:45:03 -0600 (Mon, 21 Dec 2009) | 8 lines
  
  Send parking lot announcement to the channel which parked the call, not the park-ee.
  (closes issue #16234)
   Reported by: yeshuawatso
   Patches: 
         20091210__issue16234.diff.txt uploaded by tilghman (license 14)
         20091221__issue16234__1.4.diff.txt uploaded by tilghman (license 14)
   Tested by: yeshuawatso
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@235822 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-21 17:00:46 +00:00
Alec L Davis ec0581fef4 restarts busydetector (if enabled) when DTMF is received after call is bridged.
(closes issue 0016389)
  Reported by: alecdavis
  Tested by: alecdavis
  Patch
    dtmf_busydetector.diff2.txt uploaded by alecdavis (license 585)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@235774 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-20 08:22:35 +00:00