Commit Graph

2927 Commits

Author SHA1 Message Date
David Vossel 3a875d8524 minor fixes for white/black event filters
This fixes a ref count leak in event filters and checks for
a filter container allocation failure during session creation.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-22 17:57:28 +00:00
Jeff Peeler 42c24b585a Add regular expression filtering for manager events.
This patch as documented in the sample config allows one to optionally apply
white, black, or both types of filtering to manager events. The new
'eventfilter' option is set per user.

(closes issue #14861)
Reported by: fnordian
Patches: 
      eventfilter3.patch uploaded by fnordian (license 110),
      modified by me

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271868 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-22 16:29:18 +00:00
David Vossel 6d82dbb905 fixes attended transfer behavior when both transferee and transferer hung up
If both the transferer and transferee of a attended transfer hangup before
the new channel picks up, the new channel should be hung up as well as it
has no endpoint to talk to.  This mirrors the expected behavior used in 1.4. 

(closes issue #17444)
Reported by: corruptor



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271831 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-22 15:46:22 +00:00
David Vossel 3f9c6bb3bc file.c was truncating audio file formats to the lower 32bits.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271341 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-18 18:59:05 +00:00
David Vossel ba3d1ad680 adds support for slin16 in sip
(closes issue #16153)
Reported by: kfister
Patches:
      16153-1.6.2.0-rc5.patch uploaded by kfister (license 912)
      slin16.sip.patch.1 uploaded by malcolmd (license 924)
Tested by: kfister, malcolmd


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-17 18:36:06 +00:00
David Vossel b00f58da25 adds speex 16khz audio support
(closes issue #17501)
Reported by: fabled
Patches:
      asterisk-trunk-speex-wideband-v2.patch uploaded by fabled (license 448)
Tested by: malcolmd, fabled, dvossel



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271231 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-17 17:23:43 +00:00
Matthew Nicholson 9f1136143b Set sin_family to AF_INET when doing lookups, also reset sin_port the first time the ip address changes.
(closes issue #17496)
Reported by: ManChicken

(closes issue #15827)
Reported by: DennisD
Patches:
      dnsmgr_15827.patch uploaded by chappell (license 8)
Tested by: DennisD, gentlec, damage, wimpy


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-16 20:34:31 +00:00
David Vossel fcb055fb4e addition of G.719 pass-through support
(closes issue #16293)
Reported by: malcolmd
Patches:
      g719.passthrough.patch.7 uploaded by malcolmd (license 924)
      format_g719.c uploaded by malcolmd (license 924)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270940 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-16 19:03:24 +00:00
Terry Wilson de18661bee Don't continue sending the file when there has been an error
If there is a problem with a firmware file, Polycom phones will close the
connection. We were continuing to send the file anyway. There should be no
reason to continue sending a file if there is an error writing it.

(closes issue #16682)
Reported by: lmadsen


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270692 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-15 21:42:33 +00:00
Tilghman Lesher 7037dd6680 Merged revisions 270583 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r270583 | tilghman | 2010-06-15 13:25:12 -0500 (Tue, 15 Jun 2010) | 5 lines
  
  Variables have always been case-sensitive, so we should not be removing case-insensitive matches.
  
  Bug reported via the -dev list.  See
  http://lists.digium.com/pipermail/asterisk-dev/2010-June/044510.html
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-15 18:26:26 +00:00
Tilghman Lesher 479ce4351e Merged revisions 269960 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r269960 | tilghman | 2010-06-11 13:23:05 -0500 (Fri, 11 Jun 2010) | 8 lines
  
  For SpeeX, 0 bits remaining is valid and does not need an emitted warning.
  
  (closes issue #15762)
   Reported by: nblasgen
   Patches: 
         issue15672.patch uploaded by pabelanger (license 224)
   Tested by: nblasgen
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269976 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-11 18:31:14 +00:00
Tilghman Lesher d66b4616f0 Add DBGetComplete event after a DBGetResponse.
(closes issue #16965)
 Reported by: rrb3942
 Patches: 
       DBGetComplete.patch uploaded by rrb3942 (license 1003)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269938 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-11 18:17:28 +00:00
Tilghman Lesher c7293780b8 Remove lines from the output related to the backtrace itself.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-11 18:04:54 +00:00
Mark Michelson e8d2153da6 Merged revisions 269821 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r269821 | mmichelson | 2010-06-10 14:30:12 -0500 (Thu, 10 Jun 2010) | 19 lines
  
  Fix potential crash when writing raw SLIN audio on a PLC-enabled channel.
  
  The issue here was that the frame created when adjusting for PLC had no offset
  to its audio data. If this frame were translated to another format prior to
  being sent out an RTP socket, all went well because the translation code would
  put an appropriate offset into the frame. However, if the SLIN audio were not
  translated before being sent out the RTP socket, bad things would happen.
  Specifically, the ast_rtp_raw_write makes the assumption that the frame has
  at least enough of an offset that it can accommodate an RTP header. This was
  not the case. As such, data was being written prior to the allocation, likely
  corrupting the data the memory allocator had written. Thus when the time came
  to free the data, all hell broke loose. ....Well, Asterisk crashed at least.
  
  The fix was just what one would expect. Offset the data in the frame by a reasonable
  amount. The method I used is a bit odd since the data in the frame is 16 bit integers
  and not bytes. I left a big ol' comment about it. This can be improved on if someone
  is interested. I was more interested in getting the crash resolved.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269822 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-10 19:34:03 +00:00
Kevin P. Fleming 33ba94eb0b Ensure that 'logger show channels' works properly when wildcards are used in logger.conf.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269707 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-10 12:28:17 +00:00
Tilghman Lesher 5d313f51b9 Merged revisions 269635 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r269635 | tilghman | 2010-06-10 02:52:34 -0500 (Thu, 10 Jun 2010) | 9 lines
  
  Ensure restartable system calls can restart (BSD signal semantics).
  
  This eliminates the annoying <beep> on the console.
  
  (closes issue #17477)
   Reported by: jvandal
   Patches: 
         20100610__issue17477.diff.txt uploaded by tilghman (license 14)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-10 08:15:45 +00:00
Russell Bryant 90ac07ce45 Attempt to fix FreeBSD build problem.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-09 23:56:08 +00:00
Russell Bryant 05c46771ca Resolve an invalid memory read on an event.
Valgrind pointed out that attempting to get an IE value from an event that has
no IEs produces an invalid memory read past the end of the event.  Thanks to
mmichelson for pointing the problem out to me and then testing the fix.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269417 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-09 21:11:43 +00:00
Paul Belanger 9aafd4c6b1 Merged revisions 269334 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r269334 | pabelanger | 2010-06-09 13:24:53 -0400 (Wed, 09 Jun 2010) | 12 lines
  
  Fix Debian init script to not use -c.
  
  When using the init script as-is currently, it could cause issues on Debian
  such as high CPU usage. This fix has worked for several people so I'm
  implementing the change.  We now handle color displays properly.
  
  (closes issue #16784)
  Reported by: pabelanger
  Patches:
        20100530__issue16784__2.diff.txt uploaded by tilghman (license 14)
  Tested by: pabelanger, tilghman
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269346 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-09 17:32:52 +00:00
Leif Madsen c672763af8 Fix some doxygen warnings.
(closes issue #17336)
Reported by: snuffy
Patches:
      doxygen-fixes1.diff uploaded by snuffy (license 35)
Tested by: russell

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268969 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-08 14:38:18 +00:00
Terry Wilson 857814f435 Add SRTP support for Asterisk
After 5 years in mantis and over a year on reviewboard, SRTP support is finally
being comitted. This includes generic CHANNEL dialplan functions that work for
getting the status of whether a call has secure media or signaling as defined
by the underlying channel technology and for setting whether or not a new
channel being bridged to a calling channel should have secure signaling or
media. See doc/tex/secure-calls.tex for examples.

Original patch by mikma, updated for trunk and revised by me.

(closes issue #5413)
Reported by: mikma
Tested by: twilson, notthematrix, hemanshurpatel

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268894 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-08 05:29:08 +00:00
Tilghman Lesher 17bd11b8aa Seems strange (and the code backs up) that if the max and min of a statistic is expressed as a double, the last value would not also need to be a double.
(closes issue #15807)
 Reported by: klaus3000


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268773 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-07 19:52:39 +00:00
Tilghman Lesher de625d9c08 Event well was going dry.
(issue #17234)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268731 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-07 18:59:27 +00:00
Paul Belanger 1bc478656e Set threshold for silence detection defaults to 256
(closes issue #15685)
Reported by: david_s5
Patches:
      dsp-silence-threshold-init.diff uploaded by dant (license 670)
      issue15685.patch.v5 uploaded by pabelanger (license 224)
Tested by: danti

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268690 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-07 17:34:45 +00:00
Richard Mudgett a8b0a415fc Suppress warning in waitstream_core().
Suppress the warning about unexpected control subclass frames for
AST_CONTROL_CONNECTED_LINE, AST_CONTROL_REDIRECTING, and AST_CONTROL_AOC
in file.c:waitstream_core().


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-07 15:51:39 +00:00
Tilghman Lesher 47ad8c27f5 Fix crash in DTMF detection.
What I did not originally see in my previous commit was that even though the
next digit could be detected before the previous was considered ended, the
detection of the next digit effectively ends the detection of the previous.
Therefore, the length moves in lockstep with the digit, and no separate counter
is needed for the length alone.

(closes issue #17371)
 Reported by: alecdavis

(closes issue #17474)
 Reported by: kenner


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268456 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-05 17:55:28 +00:00
Tilghman Lesher 0807833f8d Verify event is not NULL before attempting to lower its usecount.
(closes issue #17234)
 Reported by: mav3rick


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-05 17:27:12 +00:00
Russell Bryant 4e77fc3c58 Remove a LOG_WARNING.
This came up when using the sample configs, and just indicates expected behavior.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267714 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-03 20:41:24 +00:00
Mark Michelson a68f5b96bc Remove unnecessary code relating to PLC.
The logic for handling generic PLC is now handled in ast_write in
channel.c instead of in translation code.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267492 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-03 17:09:11 +00:00
Richard Mudgett 0760f4e70a Add ETSI Malicious Call ID support.
Add the ability to report malicious callers as an AMI event in the call
event class.

Relevant specification: EN 300 180

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 22:28:58 +00:00
Russell Bryant 6aa4002270 Ensure the -Wno-strict-aliasing flag makes it, even if ASTCFLAGS has been specified.
When ASTCFLAGS was specified with the make command, Makefile.rules was using
the specified value from the command line and not the one here, making it so this
flag would go missing.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267303 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 21:41:54 +00:00
Russell Bryant 98ef8df1ab Add a CLI command that blocks until Asterisk has fully booted.
Review: https://reviewboard.asterisk.org/r/684/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267138 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 18:53:38 +00:00
Richard Mudgett afd4454c44 Generic Advice of Charge.
Asterisk Generic AOC Representation
- Generic AOC encode/decode routines.
  (Generic AOC must be encoded to be passed on the wire in the AST_CONTROL_AOC frame)
- AST_CONTROL_AOC frame type to represent generic encoded AOC data
- Manager events for AOC-S, AOC-D, and AOC-E messages

Asterisk App Support
- app_dial AOC-S pass-through support on call setup
- app_queue AOC-S pass-through support on call setup

AOC Unit Tests
- AOC Unit Tests for encode/decode routines
- AOC Unit Test for manager event representation.

SIP AOC Support
- Pass-through of generic AOC-D and AOC-E messages to snom phones via the
  snom AOC specification.
- Creation of chan_sip page3 flags for the addition of the new
  'snom_aoc_enabled' sip.conf option.

IAX AOC Support
- Natively supports AOC pass-through through the use of the new
  AST_CONTROL_AOC frame type

DAHDI AOC Support
- ETSI PRI full AOC Pass-through support
- 'aoc_enable' chan_dahdi.conf option for independently enabling
  pass-through of AOC-S, AOC-D, AOC-E.
- 'aoce_delayhangup' option for retrieving AOC-E on disconnect.
- DAHDI A() dial string option for requesting AOC services.
  example usage:
  ;requests AOC-S, AOC-D, and AOC-E on call setup
  exten=>1111,1,Dial(DAHDI/g1/1112/A(s,d,e))

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267096 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 18:10:15 +00:00
Paul Belanger c2e059292d Merged revisions 267009 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r267009 | pabelanger | 2010-06-02 13:14:37 -0400 (Wed, 02 Jun 2010) | 7 lines
  
  Cleanup error/warning messages in AEL2 parser
  
  (closes issue #16684)
  Reported by: Silmaril
  Patches:
        patch_ael2_logmsg.diff uploaded by Silmaril (license 979)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267041 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 17:25:05 +00:00
Richard Mudgett 28264c52b9 Add ETSI Advice Of Charge (AOC) event reporting.
This feature generates AMI events in the new aoc event class from the
events passed up by libpri.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267008 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 17:13:53 +00:00
Paul Belanger 7bdc11519b pthread_join to assure the thread is really gone
(closes issue #15465)
Reported by: fnordian
Patches:
      bridging.patch uploaded by fnordian (license 110)
Tested by: lmadsen, fnordian, peterh

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 13:32:22 +00:00
Tilghman Lesher b0357dcc3e Support setting locale per-mailbox (changes date/time languages for email, pager messages).
(closes issue #14333)
 Reported by: klaus3000
 Patches: 
       20090515__issue14333.diff.txt uploaded by tilghman (license 14)
       app_voicemail.c-svn-trunk-rev211675-patch.txt uploaded by klaus3000 (license 65)
 Tested by: klaus3000


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-01 21:28:19 +00:00
Tilghman Lesher 7718567b24 Eliminate stale manager events after a set interval, even if AMI clients don't query for them.
Actions (or failures to act) by external clients should not cause memory leaks
in Asterisk, especially when those continued leaks could cause Asterisk to
misbehave later.

(closes issue #17234)
 Reported by: mav3rick
 Patches: 
       20100510__issue17234.diff.txt uploaded by tilghman (license 14)
       20100517__issue17234__trunk.diff.txt uploaded by tilghman (license 14)
 Tested by: mav3rick, davidw

(closes issue #17365)
 Reported by: davidw


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266682 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-01 16:41:00 +00:00
Tilghman Lesher dd26c53707 Merged revisions 266585 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r266585 | tilghman | 2010-06-01 10:17:46 -0500 (Tue, 01 Jun 2010) | 11 lines
  
  Prevent CLI prompt from distorting output of lines shorter than the prompt.
  
  Uses the VT100 method of clearing the line from the cursor position to the
  end of the line:  Esc-0K
  
  (closes issue #17160)
   Reported by: coolmig
   Patches: 
         20100531__issue17160.diff.txt uploaded by tilghman (license 14)
   Tested by: coolmig
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-01 15:18:59 +00:00
Tilghman Lesher 2da88f1977 Setup environment variables for the benefit of child processes and disallow changing them.
(closes issue #14899)
 Reported by: jmls
 Patches: 
       20090916__issue14899.diff.txt uploaded by tilghman (license 14)
 Tested by: jmls


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266385 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-28 22:50:06 +00:00
Tilghman Lesher 7e204048fc Only report swap on platforms which can examine those statistics
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266337 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-28 20:53:04 +00:00
Tilghman Lesher fb80119b87 Merged revisions 266142 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r266142 | tilghman | 2010-05-26 16:11:44 -0500 (Wed, 26 May 2010) | 14 lines
  
  Use sigaction for signals which should persist past the initial trigger, not signal.
  
  If you call signal() in a Solaris signal handler, instead of just resetting
  the signal handler, it causes the signal to refire, because the signal is not
  marked as handled prior to the signal handler being called.  This effectively
  causes Solaris to immediately exceed the threadstack in recursive signal
  handlers and crash.
  
  (closes issue #17000)
   Reported by: rmcgilvr
   Patches: 
         20100526__issue17000.diff.txt uploaded by tilghman (license 14)
   Tested by: rmcgilvr
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-26 21:17:46 +00:00
Mark Michelson 8999372c33 Fix misspelling of macro args.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-26 20:04:51 +00:00
David Vossel 77a96c5a93 do all sip registry parsing before transmit_register
This patch breaks up every part of the sip registry string during
config parsing and removes all parsing from transmit_register().
Thanks to Nick_Lewis for contributing this patch!

(closes issue #14331)
Reported by: Nick_Lewis
Patches:
      chan_sip.c-domparse.patch uploaded by Nick Lewis (license 657)
      chan_sip.c.patch uploaded by Nick Lewis (license 657)
      chan_sip.c.domainparse3.patch uploaded by Nick Lewis (license 657)
      chan_sip.c-domparse4.patch uploaded by Nick Lewis (license 657)
      chan_sip.c-domparse5.patch uploaded by Nick Lewis (license 657)
      nicklewispatch.diff uploaded by dvossel (license 671)
Tested by: Nick_Lewis, dvossel

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266090 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-26 19:46:49 +00:00
Richard Mudgett 838ce15e20 Memory leak in connected line data when SIP blond transfer done.
The handling of the control subclass AST_CONTROL_READ_ACTION frame leaked
connected line string memory in __ast_read().

Also in __ast_read() the frame type switch should not have had a case for
AST_CONTROL_READ_ACTION.  AST_CONTROL_READ_ACTION is not a frame type.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265608 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-25 16:23:51 +00:00
Terry Wilson 0390dae08d Merge the rest of the FullyBooted patch
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265467 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-24 22:21:58 +00:00
Tilghman Lesher 6f998f06af On systems with a LOT of RAM, a signed integer sometimes printed negative.
(closes issue #16837)
 Reported by: jlpedrosa
 Patches: 
       20100504__issue16837.diff.txt uploaded by tilghman (license 14)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265316 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-24 18:19:08 +00:00
David Vossel fdb698ca2b fixes segfault when using generic plc
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-24 16:10:09 +00:00
Richard Mudgett ba8e183938 Channel initialization failure causes crashes.
__ast_channel_alloc_ap() has several points in the initialization of a new
channel structure where it could fail.  Since the channel structure is now
an ao2 object, the destructor callback needs to be able to handle clean up
when the structure setup is incomplete.

Problems corrected:

1) Failing to setup the alertpipe would not unreference the structure but
free it directly.  Doing this to an ao2_object is very bad.

2) File descriptors need to be initialized to -1 before a construction
failure could occur so the destructor will not close unopened descriptors.

3) The destructor needs to check that the string field has been
initialized before using any string field values.  Crashes expected.

4) The destructor should not notify devstate if the device name is empty.
It is a waste of cycles and a couple ERROR log messages are generated.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265174 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-21 22:46:52 +00:00
Mark Michelson 73e8c7572e Merged revisions 264996 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r264996 | mmichelson | 2010-05-21 11:28:34 -0500 (Fri, 21 May 2010) | 32 lines
  
  Allow ast_safe_sleep to defer specific frames until after the sleep has concluded.
  
  From reviewboard
  
  Background:
  A Digium customer discovered a somewhat odd bug. The setup is that parties A
  and B are bridged, and party A places party B on hold. While party B is 
  listening to hold music, he mashes a bunch of DTMF. Party A takes party
  B off hold while this is happening, but party B continues to hear hold
  music. I could reproduce this about 1 in 5 times.
  
  The issue:
  When DTMF features are enabled and a user presses keys, the channel that
  the DTMF is streamed to is placed in an ast_safe_sleep for 100 ms, the
  duration of the emulated tone. If an AST_CONTROL_UNHOLD frame is read
  from the channel during the sleep, the frame is dropped. Thus the
  unhold indication is never made to the channel that was originally placed
  on hold.
  
  The fix:
  Originally, I discussed with Kevin possible ways of fixing the specific
  problem reported. However, we determined that the same type of problem
  could happen in other situations where ast_safe_sleep() is used. Using
  autoservice as a model, I modified ast_safe_sleep_conditional() to
  defer specific frame types so they can be re-queued once the sleep has
  finished. I made a common function for determining if a frame should
  be deferred so that there are not two identical switch blocks to
  maintain.
  
  Review: https://reviewboard.asterisk.org/r/674/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-21 16:44:27 +00:00
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