]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
12 years agoPrevent exhaustion of system resources through exploitation of event cache certified/1.8.11
Matthew Jordan [Wed, 2 Jan 2013 18:17:26 +0000 (18:17 +0000)] 
Prevent exhaustion of system resources through exploitation of event cache

Asterisk maintains an internal cache for devices in the event subsystem. The
device state cache holds the state of each device known to Asterisk, such that
consumers of device state information can query for the last known state for
a particular device, even if it is not part of an active call. The concept of
a device in Asterisk can include entities that do not have a physical
representation. One way that this occurred was when anonymous calls are allowed
in Asterisk. A device was automatically created and stored in the cache for
each anonymous call that occurred; this was possible in the SIP and IAX2
channel drivers and through channel drivers that utilized the
res_jabber/res_xmpp resource modules (Gtalk, Jingle, and Motif). These devices
are never removed from the system, allowing anonymous calls to potentially
exhaust a system's resources.

This patch changes the event cache subsystem and device state management to
no longer cache devices that are not associated with a physical entity.

(issue ASTERISK-20175)
Reported by: Russell Bryant, Leif Madsen, Joshua Colp
Tested by: kmoore
patches:
  event-cachability-3.diff uploaded by jcolp (license 5000)
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@378323 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoResolve crashes due to large stack allocations when using TCP
Matthew Jordan [Wed, 2 Jan 2013 15:47:10 +0000 (15:47 +0000)] 
Resolve crashes due to large stack allocations when using TCP

Asterisk had several places where messages received over various network
transports may be copied in a single stack allocation. In the case of TCP,
since multiple packets in a stream may be concatenated together, this can
lead to large allocations that overflow the stack.

This patch modifies those portions of Asterisk using TCP to either
favor heap allocations or use an upper bound to ensure that the stack will not
overflow:
 * For HTTP, the allocation is now a heap allocation instead of a stack
   allocation
 * For XMPP (in res_jabber), the allocation has been eliminated since it was
   unnecesary.

Note that the HTTP portion of this issue was independently found by Brandon
Edwards of Exodus Intelligence.

(issue ASTERISK-20658)
Reported by: wdoekes, Brandon Edwards
Tested by: mmichelson, wdoekes
patches:
  ASTERISK-20658_res_jabber.c.patch uploaded by mmichelson (license 5049)
  issueA20658_http_postvars_use_malloc2.patch uploaded by wdoekes (license 5674)
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@378289 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agochan_misdn: Fix sending RELEASE_COMPLETE in response to SETUP.
Richard Mudgett [Fri, 30 Nov 2012 21:42:25 +0000 (21:42 +0000)] 
chan_misdn: Fix sending RELEASE_COMPLETE in response to SETUP.

Fix sending a RELEASE_COMPLETE in response to a SETUP if chan_misdn does
not have a B channel available to assign to the call.

(closes issue ABE-2869)
Reported by: Guenther Kelleter
Patches:
      setup-reject_2.diff (license #6372) patch uploaded by Guenther Kelleter
      Modified

........

Merged revision 376949 from https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@376954 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoapp_queue: Fix a lock that was being held forever caused by a merging mistake
Jonathan Rose [Thu, 15 Nov 2012 21:48:33 +0000 (21:48 +0000)] 
app_queue: Fix a lock that was being held forever caused by a merging mistake

r375591 merged with conflicts and an oversight resulted in an unlock being
missed which resulted in a deadlock when updating realtime members in queues.
This patch adds that unlock back in.

(closes issue AST-1035)
Reported by: Steve Pitts
Patches:
    certified_1.8.11_oops_missed_an_unlock.diff uploaded by Jonathan Rose (license 6182)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@376302 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoMultiple revisions 375519-375524
Richard Mudgett [Fri, 2 Nov 2012 18:51:21 +0000 (18:51 +0000)] 
Multiple revisions 375519-375524

........
  r375519 | rmudgett | 2012-10-30 16:06:15 -0500 (Tue, 30 Oct 2012) | 11 lines

  chan_misdn: Timer primitives must be handled first.

  The frm->addr is a different "address space" than the stack/instance
  address of other Lx primitives.  The test for B channel instance address
  could fail.

  Patches:
patch01_timers.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2888

  ........
  r375520 | rmudgett | 2012-10-30 16:14:58 -0500 (Tue, 30 Oct 2012) | 10 lines

  chan_misdn: Free memory in error paths and other memory leaks.

  The one line commented with BUG is not easily fixable because there is no
  de-init function one can call.

  Patches:
patch02_memory.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2888

  ........
  r375521 | rmudgett | 2012-10-30 16:38:41 -0500 (Tue, 30 Oct 2012) | 14 lines

  chan_misdn: ISDN NT L2 de-establish/establish

  * An NT-PTMP cannot de/establish L2 since it doesn't know the TEIs.
  * On NT-PTP L2 is started when L1 is finally active in handle_l1.
  * L2 deactivation logging cleanup.
  * L2 aggregate link status is unknown for NT-PTMP, show as "UNKN".
  * Removed unused functions and code for L2 handling.

  Patches:
patch03_L2estab.diff (license #6372) patch uploaded by Guenther Kelleter
Modified

  JIRA ABE-2888

  ........
  r375522 | rmudgett | 2012-10-30 16:56:14 -0500 (Tue, 30 Oct 2012) | 22 lines

  chan_misdn: Fix broken upper_id/lower_id usage.

  Sending PH prim via lower_id layer (3 or 1) simply does not work.  For TE
  (3) it returns an error (len=-6) which is not evaluated by handle_l1(), so
  the L1 layer status ends up wrong.  Instead PH must be sent via L4, only
  then does it reach L1 without an error message.

  And NT PH prims only reach L1 when they are sent to layer 2 id.
  --> use upper_id to send PH primitives.

  * Check for errors in PH_(DE)ACTIVATE | CONFIRM.
  * Debug messages are improved.

  * The lower_id is now not used for anything, except: Why is lower_id layer
  deleted when it wasn't created?  I removed this code since it looks very
  wrong.

  Patches:
patch04_l1activation.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2888

  ........
  r375523 | rmudgett | 2012-10-30 17:29:15 -0500 (Tue, 30 Oct 2012) | 31 lines

  chan_misdn: Fix loss of B channels if L1 is down.

  If you make 2 calls out an NT PTMP port which is not connected to any
  phone, the B channel associated with that call becomes unusable until
  Asterisk is restarted.

  The problem is the EVENT_SETUP is queued when L1 is not up in
  misdn_lib_send_event().  If L1 cannot be activated the event won't be
  dequeued.  It gets even worse when the call is hung up.  The queued
  EVENT_SETUP will be overwritten by an EVENT_DISCONNECT.  The reserved B
  channel then will never be freed.  If later someone connects a phone to
  the port, L1 will eventually activate and the queued EVENT_DISCONNECT is
  sent down the stack.  However, it is ignored because it is the wrong call
  state.

  The real fix would be that activation and queueing for a new SETUP is done
  by the NT stack.  But since it doesn't, the workaround must be removed
  because it doesn't always work.

  Fix: The event is no longer queued but immediately sent to the stack.  If
  L1 cannot be activated, the L3 state machine that was started by the
  EVENT_SETUP will do its work, i.e.  a timeout will release the B channel
  properly.  The SETUP possibly cannot be sent the first time but is resent
  by T303 in case L1 could be activated.

  Patches:
patch05_bchan-loss.diff (license #6372) patch uploaded by Guenther Kelleter
Modified

  JIRA ABE-2888

........
  r375524 | rmudgett | 2012-10-30 18:26:05 -0500 (Tue, 30 Oct 2012) | 13 lines

  chan_misdn: Remove some calls to exit().

  Try proper cleanup when something goes wrong in misdn_lib_init().
  Especially do not call exit()!

  * Fix memory leak because stack_destroy() does not free the stack struct.

  Patches:
patch06_cleanup-init.diff (license #6372) patch uploaded by Guenther Kelleter
Modified

  JIRA ABE-2888
........

Merged revisions 375519-375524 from https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@375629 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoMultiple revisions 375242,375244
Matthew Jordan [Wed, 31 Oct 2012 20:26:07 +0000 (20:26 +0000)] 
Multiple revisions 375242,375244

........
  r375242 | jrose | 2012-10-18 16:30:13 -0500 (Thu, 18 Oct 2012) | 8 lines

  app_queue: add upgrade notes for 375216

  Adds notes describing behavioral changes to rrmemory strategy caused by
  375216

  (issue AST-989)
  Reported by: Thomas Arimont
........
  r375244 | jrose | 2012-10-18 16:36:59 -0500 (Thu, 18 Oct 2012) | 4 lines

  Correct version number in Upgrade.txt release notes pertaining to queue order

  Showed 1.8.17 to 1.8.18, needs to be 1.8.18 to 1.8.19
........

Merged revisions 375242,375244 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@375570 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoapp_queue: Make ordering of rrmemory/rrordered persist over add/remove members
Matthew Jordan [Wed, 31 Oct 2012 20:25:00 +0000 (20:25 +0000)] 
app_queue: Make ordering of rrmemory/rrordered persist over add/remove members

Prior to this patch, adding, removing or reloading  members to rrmemory would
cause the order to become completely jumbled. Now it behaves more or less like
rrordered other than the fact that it stores the members on a hash table rather
than a linked list. This patch also prevents removal of members and member
reloads from jumbling rrordered queues.

(issue AST-989)
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2164/
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@375569 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoMultiple revisions 369436,369557,369579,369626,369652,372628 for 1.8.11-cert8
Matthew Jordan [Wed, 31 Oct 2012 20:22:19 +0000 (20:22 +0000)] 
Multiple revisions 369436,369557,369579,369626,369652,372628 for 1.8.11-cert8

........
  r369436 | twilson | 2012-06-27 15:58:51 -0500 (Wed, 27 Jun 2012) | 17 lines

  AST-2012-010: Clean up after a reinvite that never gets a final response

  The basic problem is that if a re-INVITE is sent by Asterisk and it receives a
  provisional response, but no final response, then the dialog is never torn
  down. In addition to leaking memory, this also leaks file descriptors and will
  eventually lead to Asterisk no longer being able to process calls.

  This patch just keeps track of whether there is an outstanding re-INVITE, and if
  there is goes ahead and cleans up everything as though there was no outstanding
  reinvite.

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

  (closes issue ASTERISK-19992)
  Reported by: Steve Davies
  Tested by: Steve Davies, Terry Wilson
........
  r369557 | twilson | 2012-07-03 09:27:02 -0500 (Tue, 03 Jul 2012) | 11 lines

  Better handle re-INVITEs with provisional but no final repsonses

  A previous attempt at fixing this issue had negative side effects related
  to attended transfers which this patch should resolve. Many thanks to
  Steve Davies for all of the good suggestions and testing.

  (closes issue ASTERISK-19992)
  Reported by: Steve Davies
  Tested by: Steve Davies, Terry Wilson
  Review: https://reviewboard.asterisk.org/r/2009/
........
  r369579 | twilson | 2012-07-03 11:58:16 -0500 (Tue, 03 Jul 2012) | 8 lines

  More improvements to re-INVITEs timing out after a provisional response

  There is no need to call check_pendings() on a final response to an INVITE
  when destroying the scheduler entry as it will be done later during normal
  processing.

  (issue ASTERISK-19992)
........
  r369626 | mjordan | 2012-07-05 12:01:52 -0500 (Thu, 05 Jul 2012) | 16 lines

  Do not send a BYE when a provisional response arrives during a re-INVITE

  Commits r369557 and r369579 were done to improve handling of re-INVITEs
  when the UA that was supposed to receive the re-INVITE fails to respond.
  A limitation of those patches occurred when a UA sent a provisional
  response to the re-INVITE.  This triggered a sending of a BYE in
  check_pending.  This patch tweaks the handling of the re-INVITE such that
  a BYE is not sent in response to those messages.

  (issue ASTERISK-19992)
  Reported by: Steve Davies
  Tested by: Steve Davies
  patches:
    (reinvite_tweak.diff license #5012 by Steve Davies)
........
  r369652 | kmoore | 2012-07-05 14:01:52 -0500 (Thu, 05 Jul 2012) | 22 lines

  AST-2012-011: Resolve heap corruption issue with voicemail

  The heard and deleted arrays in the voicemail state structure were not
  handled properly following the memory leak fix in r354890 and a fix for
  an invalid free in r356797.  This could result in accessing and writing
  into freed memory.  The allocation for these arrays has been reworked
  to avoid the possibility of invalid frees, access of freed memory, and
  crashes that were occurring as a result of this.

  Locking around accesses and modifications of the voicemail state
  structure members dh_arraysize, heard, and deleted has been added to
  prevent simultaneous modification and access when IMAP storage is in
  use.  If IMAP storage is not in use, this locking is not compiled in.

  Review: https://reviewboard.asterisk.org/r/1994/
  (closes issue ASTERISK-19923)
  Reported by: Dan Delaney
  Tested by: Dan Delaney, Julian Yap
  Patches:
    vm_alloc_fix.diff uploaded by kmoore (license 6273)
........
  r372628 | rmudgett | 2012-09-07 17:06:29 -0500 (Fri, 07 Sep 2012) | 5 lines

  Remove annoying unconditional debug message from INC/DEC functions.

  (closes issue AST-1001)
  Reported by: Guenther Kelleter
........

Merged revisions 369436,369557,369579,369626,369652,372628 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@375568 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoProperly handle UAC/UAS roles for SIP session timers
Matthew Jordan [Mon, 15 Oct 2012 14:11:46 +0000 (14:11 +0000)] 
Properly handle UAC/UAS roles for SIP session timers

The SIP session timer mechanism contains a mandatory 'refresher' parameter
(included in the Session-Expires header) which is used in the session timer
offer/answer signaling within a SIP Invite dialog. It looks like asterisk is
interpreting the uac resp. uas role only as the initial role of client and
server (caller is uac, callee is uas). The standard rfc 4028 however assigns
the client role to the ((RE)-Invite) requester, the server role to the
((RE)-Invite) responder.

This patch has Asterisk track the actual refresher as "us" or "them" as opposed
to relying on just the configured "uas" or "uac" properties.

(closes issue AST-922)
Reported by: Thomas Airmont

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@375024 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoFix incorrect billing duration reported when batch mode is enabled
Matthew Jordan [Thu, 11 Oct 2012 15:46:29 +0000 (15:46 +0000)] 
Fix incorrect billing duration reported when batch mode is enabled

Similar to r369351, the billing duration can be skewed when batch mode is
enabled.  This happened much more rarely than the duration, as it only
occured when the call was answered (thereby indicating an actual answer
time) and immediately hung up on (indicating a billsec of 0).  Since
a billing time of '0' can either mean that the call immediately ended
or that the CDR was improperly answered, we have to use additional information
to know whether or not we can trust the CDR billsec value.  Prior to this
patch, we looked to see if we had a valid answer time.  If we did, and
billsec was zero, we used the current time to calculate what billsec value
we could from the CDR being written.  If batch mode is enabled, this will
incorrectly report a billsec value being much greater than the actual
duration of the call.

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

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@374847 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoFix compiler warnings.
Richard Mudgett [Wed, 10 Oct 2012 21:31:35 +0000 (21:31 +0000)] 
Fix compiler warnings.

gcc (GCC) 4.2.4 has problems casting away constness.
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@374832 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoapp_queue: Made pass connected line updates from the caller to ringing queue members.
Richard Mudgett [Wed, 10 Oct 2012 21:12:20 +0000 (21:12 +0000)] 
app_queue: Made pass connected line updates from the caller to ringing queue members.

Party A calls Party B
Party B puts Party A on hold.
Party B calls a queue.
Ringing queue member D sees Party B identification.
Party B transfers Party A to the queue.
Queue member D does not get a connected line update for Party A.
Queue member D answers the call and still sees Party B information.

However, if Party A later transfers the call to Party C then queue member
D gets a connected line update for Party C.

* Made pass connected line updates from the caller to queue members while
the queue members are ringing.

(closes issue AST-1017)
Reported by: Thomas Arimont

(closes issue ABE-2886)
Reported by: Thomas Arimont
Tested by: rmudgett

........

Merged revisions 374801 from https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@374806 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoMultiple revisions 370563,374536
Richard Mudgett [Fri, 5 Oct 2012 18:56:08 +0000 (18:56 +0000)] 
Multiple revisions 370563,374536

........
  r370563 | rmudgett | 2012-07-30 11:47:19 -0500 (Mon, 30 Jul 2012) | 2 lines

  Release B channel allocation on error path in chan_misdn.
........
  r374536 | rmudgett | 2012-10-05 13:20:01 -0500 (Fri, 05 Oct 2012) | 159 lines

  Merged revisions 374515-374535 from
  https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier

  ................
    r374515 | rmudgett | 2012-10-04 17:52:36 -0500 (Thu, 04 Oct 2012) | 10 lines

    chan_misdn: Remove some deadcode

    * Made setup_bc() static.

    Patches:
   patch1_unused-code.diff (license #6372) patch uploaded by Guenther Kelleter
   Modified

    JIRA ABE-2882

  ................
    r374516 | rmudgett | 2012-10-04 18:01:01 -0500 (Thu, 04 Oct 2012) | 7 lines

    chan_misdn: Remove unused bchan states

    Patches:
   patch2_unused-states.diff (license #6372) patch uploaded by Guenther Kelleter

    JIRA ABE-2882

  ................
    r374517 | rmudgett | 2012-10-04 18:17:51 -0500 (Thu, 04 Oct 2012) | 16 lines

    chan_misdn: Remove unnecessary null pointer checks and checks for stack->nt

    * cleanup_bc() is always called with valid bc (or it would've crashed
    before).

    * Value of stack->nt is known in advance at some places.

    * Rename handle_event() to handle_event_te(), handle_frm() to
    handle_frm_te().

    Patches:
   patch3_checks.diff (license #6372) patch uploaded by Guenther Kelleter
   Modified

    JIRA ABE-2882

  ................
    r374518 | rmudgett | 2012-10-04 18:21:59 -0500 (Thu, 04 Oct 2012) | 7 lines

    chan_misdn: Fix spelling in log messages

    Patches:
   patch4_spelling.diff (license #6372) patch uploaded by Guenther Kelleter

    JIRA ABE-2882

  ................
    r374519 | rmudgett | 2012-10-04 18:31:59 -0500 (Thu, 04 Oct 2012) | 15 lines

    chan_misdn: Don't cleanup a bc twice.

    In handle_frm_te() after calling misdn_lib_send_event(bc,
    EVENT_RELEASE_COMPLETE) bc is emptied, cleaned and set not in use,
    although misdn_lib_send_event() already did the same.  This is bad.  When
    it's not in use we are not allowed to touch it.

    * Moved log message in front of the resulting actions and fixed it to
    match the case.

    Patches:
   patch5_bccleanup.diff (license #6372) patch uploaded by Guenther Kelleter

    JIRA ABE-2882

  ................
    r374520 | rmudgett | 2012-10-04 18:43:56 -0500 (Thu, 04 Oct 2012) | 12 lines

    chan_misdn: Fix memory leaks, bc, chan not cleaned up etc., really bad stuff.

    * Fix return codes of cb_events() for EVENT_SETUP to use caller's cleanup
    mechanisms.

    * Move cl_queue_chan() call after bearer check.

    Patches:
   patch6_leaks.diff (license #6372) patch uploaded by Guenther Kelleter

    JIRA ABE-2882

  ................
    r374521 | rmudgett | 2012-10-04 18:48:38 -0500 (Thu, 04 Oct 2012) | 11 lines

    chan_misdn: We must initialize cause on sending a DISCONNECT.

    We must initialize cause on sending a DISCONNECT, so it is later correctly
    indicated to ast_channel in case the answer (RELEASE/RELEASE_COMPLETE)
    does not include one.

    Patches:
   patch7_hangupcause.diff (license #6372) patch uploaded by Guenther Kelleter

    JIRA ABE-2882

  ................
    r374522 | rmudgett | 2012-10-04 19:03:56 -0500 (Thu, 04 Oct 2012) | 7 lines

    chan_misdn: Remove unused code for upqueue

    Patches:
   patch8_unused-upqueue.diff (license #6372) patch uploaded by Guenther Kelleter

    JIRA ABE-2882

  ................
    r374523 | rmudgett | 2012-10-04 19:11:50 -0500 (Thu, 04 Oct 2012) | 7 lines

    chan_misdn: Improve debugging (port number, messages fixed, dups removed)

    Patches:
   patch9_debug.diff (license #6372) patch uploaded by Guenther Kelleter

    JIRA ABE-2882

  ................
    r374533 | rmudgett | 2012-10-05 12:17:18 -0500 (Fri, 05 Oct 2012) | 8 lines

    chan_misdn: Better debug: we can print_bc_info even if there's no ast leg.

    Patches:
   patch10_debug-bc-2.diff (license #6372) patch uploaded by Guenther Kelleter
   Modified.

    JIRA ABE-2882

  ................
    r374534 | rmudgett | 2012-10-05 12:34:10 -0500 (Fri, 05 Oct 2012) | 16 lines

    chan_misdn: setup_bc() is called too early for an incoming SETUP on TE.

    This prevents the B channel from being setup for HDLC mode when requested
    by the bearer capability and config option hdlc=yes.  It violates
    ETS300102 Ch.5.2.3.2: "The user, in any case, must not connect to the
    channel until a CONNECT ACKNOWLEDGE message has been received."

    * Call setup_bc() on receipt of CONNECT_ACKNOWLEGDE for PTMP, and on first
    response to SETUP for PTP.

    Patches:
   abe-2881-2.diff (license #6372) patch uploaded by Guenther Kelleter
   Modified.

    JIRA ABE-2881

  ................
    r374535 | rmudgett | 2012-10-05 12:41:05 -0500 (Fri, 05 Oct 2012) | 2 lines

    chan_misdn: Remove some more deadcode.

  ................
........

Merged revisions 370563,374536 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@374540 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoMultiple revisions 366052,367002,367416,369731,373061
Matthew Jordan [Fri, 14 Sep 2012 20:25:44 +0000 (20:25 +0000)] 
Multiple revisions 366052,367002,367416,369731,373061

........
  r366052 | mmichelson | 2012-05-10 11:10:18 -0500 (Thu, 10 May 2012) | 7 lines

  Close the proper tcptls_session when session creation fails.

  (issue AST-998)
  Reported by: Thomas Arimont
  Tested by: Thomas Arimont
........
  r367002 | mmichelson | 2012-05-18 11:53:47 -0500 (Fri, 18 May 2012) | 17 lines

  Fix memory leak of SSL_CTX structures in TLS core.

  SSL_CTX structures were allocated but never freed. This was a bigger
  issue for clients than servers since new SSL_CTX structures could be
  allocated for each connection. Servers, on the other hand, typically
  set up a single SSL_CTX for their lifetime.

  This is solved in two ways:

  1. In __ssl_setup(), if a tcptls_cfg has an ssl_ctx on it, it is
  freed so that a new one can take its place.
  2. A companion to ast_ssl_setup() called ast_ssl_teardown() has
  been added so that servers can properly free their SSL_CTXs.

  (issue ASTERISK-19278)
........
  r367416 | mmichelson | 2012-05-23 15:27:47 -0500 (Wed, 23 May 2012) | 5 lines

  Only call SSL_CTX_free if DO_SSL is defined.

  Thanks to Paul Belanger for pointing out this error.
........
  r369731 | mmichelson | 2012-07-06 13:40:06 -0500 (Fri, 06 Jul 2012) | 19 lines

  Remove a superfluous and dangerous freeing of an SSL_CTX.

  The problem here is that multiple server sessions share
  a SSL_CTX. When one session ended, the SSL_CTX would be
  freed and set NULL, leaving the other sessions unable to
  function.

  The code being removed is superfluous because the SSL_CTX
  structures for servers will be properly freed when ast_ssl_teardown
  is called.

  (closes issue ASTERISK-20074)
  Reported by Trevor Helmsley
  Patches:
   ASTERISK-20074.diff uploaded by Mark Michelson (license #5049)
  Testers:
   Trevor Helmsley
........
  r373061 | mjordan | 2012-09-14 14:07:20 -0500 (Fri, 14 Sep 2012) | 28 lines

  Resolve memory leaks in TLS initialization and TLS client connections

  This patch resolves two sources of memory leaks when using TLS in Asterisk:
  1) It removes improper initialization (and multiple re-initializations) of
     portions of the SSL library.  Asterisk calls SSL_library_init and
     SSL_load_error_strings during SSL initialization; collectively this
     obviates the need for calling any of the following during initialization
     or client connection handling:
     * ERR_load_crypto_strings (handled by SSL_load_error_strings)
     * OpenSSL_add_all_algorithms (synonym for SSL_library_init)
     * SSLeay_add_ssl_algorithms (synonym for SSL_library_init)
  2) Failure to completely clean up all memory allocated by Asterisk and by
     the SSL library for TLS clients.  This included not freeing the SSL_CTX
     object in the SIP channel driver, as well as not clearing the error
     stack when the TLS client exited.

  Note that these memory leaks were found by Thomas Arimont, and this patch
  was essentially written by him with some minor tweaks.

  (closes issue AST-889)
  Reported by: Thomas Arimont
  Tested by: Thomas Arimont
  patches:
    (bugAST-889.patch) by Thomas Arimont (license 5525)

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

Merged revisions 366052,367002,367416,369731,373061 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@373088 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoAST-2012-012: Resolve AMI User Unauthorized Shell Access through ExternalIVR
Matthew Jordan [Thu, 30 Aug 2012 16:28:49 +0000 (16:28 +0000)] 
AST-2012-012: Resolve AMI User Unauthorized Shell Access through ExternalIVR

The AMI Originate action can allow a remote user to specify information that can
be used to execute shell commands on the system hosting Asterisk. This can
result in an unwanted escalation of permissions, as the Originate action, which
requires the "originate" class authorization, can be used to perform actions
that would typically require the "system" class authorization. Previous attempts
to prevent this permission escalation (AST-2011-006, AST-2012-004) have sought
to do so by inspecting the names of applications and functions passed in with
the Originate action and, if those applications/functions matched a predefined
set of values, rejecting the command if the user lacked the "system" class
authorization. As reported by IBM X-Force Research, the "ExternalIVR"
application is not listed in the predefined set of values. The solution for
this particular vulnerability is to include the "ExternalIVR" application in the
set of defined applications/functions that require "system" class authorization.

Unfortunately, the approach of inspecting fields in the Originate action against
known applications/functions has a significant flaw. The predefined set of
values can be bypassed by creative use of the Originate action or by certain
dialplan configurations, which is beyond the ability of Asterisk to analyze at
run-time. Attempting to work around these scenarios would result in severely
restricting the applications or functions and prevent their usage for legitimate
means. As such, any additional security vulnerabilities, where an
application/function that would normally require the "system" class
authorization can be executed by users with the "originate" class authorization,
will not be addressed. Instead, the README-SERIOUSLY.bestpractices.txt file has
been updated to reflect that the AMI Originate action can result in commands
requiring the "system" class authorization to be executed. Proper system
configuration can limit the impact of such scenarios.

(closes issue ASTERISK-20132)
Reported by: Zubair Ashraf of IBM X-Force Research

AST-2012-013: Resolve ACL rules being ignored during calls by some IAX2 peers

When an IAX2 call is made using the credentials of a peer defined in a dynamic
Asterisk Realtime Architecture (ARA) backend, the ACL rules for that peer are
not applied to the call attempt. This allows for a remote attacker who is aware
of a peer's credentials to bypass the ACL rules set for that peer.

This patch ensures that the ACLs are applied for all peers, regardless of their
storage mechanism.

(closes issue ASTERISK-20186)
Reported by: Alan Frisch
Tested by: mjordan, Alan Frisch

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@372030 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoapp_meetme: Adding test events for following activity in MeetMe.
Jonathan Rose [Wed, 29 Aug 2012 21:23:05 +0000 (21:23 +0000)] 
app_meetme: Adding test events for following activity in MeetMe.
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@371941 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoMerge patches for 1.8.11-cert6
Matthew Jordan [Fri, 24 Aug 2012 13:55:18 +0000 (13:55 +0000)] 
Merge patches for 1.8.11-cert6

This includes the following
 * r369351 for AST-883
 * r368807 for AST-884
 * r356604, r356650, r364203 for AST-890
 * r370618 for AST-896
 * r370205, r370273, r370360 for AST-916
 * r371469 for AST-932

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@371651 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 years agoMerge r369351 for AST-883
Matthew Jordan [Fri, 24 Aug 2012 13:49:40 +0000 (13:49 +0000)] 
Merge r369351 for AST-883

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@371650 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix error in the "IPorHost" section of a SIP dialstring.
Mark Michelson [Tue, 7 Aug 2012 15:40:46 +0000 (15:40 +0000)] 
Fix error in the "IPorHost" section of a SIP dialstring.

This is based on the review request posted by Walter Doekes
(referenced lower in the commit message)

The main fix here is to treat the IPorHost portion of the dial
string as a temporary outbound proxy. This ensures requests
get sent to the proper location.

Due to the age of the request, some parts were no longer relevant.
For instance, the request moved outbound proxy parsing code into
a single method. This is done in a previous commit, so it was not
necessary to do again.

Also, the review request fixed some errors with regards to request
routing for CANCEL and ACK requests. This has also been fixed in
more recent commits.

(closes issue ASTERISK-19677)
reported by Walter Doekes

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@370843 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRevert a change that broke compilation
Terry Wilson [Wed, 25 Jul 2012 03:37:08 +0000 (03:37 +0000)] 
Revert a change that broke compilation

1) There is no such function as ast_ref()
2) The patch was originally credited as the one uploaded by Guenther
   Kelleter (license 6372) via issue AST-921, but the patch committed
   was not the patch referenced on the issue.
3) Guenther Kelleter's patch was actually correct. It moved the
   ast_free above the presencechange_cleanup label. I am not
   committing his change as it is not technically necesary--calling
   ast_free(NULL) is perfectly safe and I worry that moving the
   ast_free outside of the label could lead to future bugs if
   someone ever adds another failure conditional and expects
   'goto presencechange_cleanup;' to clean up after everything.

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@370472 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoDon't attempt free of NULL ptr in pbx.c handle_presencechange
Jonathan Rose [Tue, 24 Jul 2012 20:57:34 +0000 (20:57 +0000)] 
Don't attempt free of NULL ptr in pbx.c handle_presencechange

(closes issue AST-921)
Reported by: Guenther Kelleter
Patches:
    nullptr.patch uploaded by Guenther Kelleter (license 6372)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@370464 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix bad merge of r368759 in sig_analog
Matthew Jordan [Wed, 11 Jul 2012 19:44:51 +0000 (19:44 +0000)] 
Fix bad merge of r368759 in sig_analog

The patch for r368759 in Asterisk 1.8 relied upon the methods
analog_unlock_private/analog_lock_private.  In earlier versions of 1.8,
including the Certified Asterisk 1.8.11 branch, those two methods were
unused, and hence were undefined out of the source.  When the patch was made
for 1.8.11-cert5, those two functions were not re-defined back in.  This caused
linking errors when sig_analog was loaded.

This patch properly restores those two methods, such that the fix for AST-891
works correctly.

(issue AST-891)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@369964 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix deadlock between bridged channels that attempt to set the hangup source
Matthew Jordan [Mon, 9 Jul 2012 19:59:20 +0000 (19:59 +0000)] 
Fix deadlock between bridged channels that attempt to set the hangup source

Calling ast_set_hangupsource with the channel lock held can result in a
deadlock because the function also locks the bridged channel.

(issue AST-891)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@369848 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd support for exposing the received contact URI and also for setting the request...
Joshua Colp [Mon, 9 Jul 2012 19:50:56 +0000 (19:50 +0000)] 
Add support for exposing the received contact URI and also for setting the request URI in messages.

(closes issue AST-911)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@369845 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRemove file that should no longer exist.
Jason Parker [Mon, 9 Jul 2012 19:06:26 +0000 (19:06 +0000)] 
Remove file that should no longer exist.

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@369840 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRe-merge changes that were reverted.
Jason Parker [Mon, 9 Jul 2012 19:05:54 +0000 (19:05 +0000)] 
Re-merge changes that were reverted.

------------------------------------------------------------------------
r365395 | qwell | 2012-05-04 16:17:08 -0500 (Fri, 04 May 2012) | 7 lines

Add support for folders in MixMonitor 'm' option.  Backport manager actions.

The manager actions are needed, so MixMonitor can be executed on existing
channels.

(issue DPMA-68)

------------------------------------------------------------------------
r364761 | qwell | 2012-05-01 12:25:14 -0500 (Tue, 01 May 2012) | 6 lines

Remove folder_dir from voicemail snapshots API.

It was both unused (except in tests, where it was fudged) and unnecessary.

(closes issue AST-842)

------------------------------------------------------------------------
r367161 | mmichelson | 2012-05-21 14:05:52 -0500 (Mon, 21 May 2012) | 21 lines

Add "send to voicemail" Digium phone functionality to Asterisk.

This change accommodates two methods by which calls can be directed to
a user's voicemail.

* Incoming calls can be redirected to any user's voicemail.
* Established calls can be blind transferred to any user's voicemail.

Digium phones indicate the desire to direct a call to voicemail by using
a Diversion header with a reason parameter of "send_to_vm".

This patch adds the "send_to_vm" reason as a valid redirecting reason. In
addition, chan_sip.c has been modified to update redirecting information
on the transferred channel by reading a Diversion header on a REFER request.

(closes issue AST-871)
Reported by Malcolm Davenport

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

------------------------------------------------------------------------
r368790 | mjordan | 2012-06-12 08:44:36 -0500 (Tue, 12 Jun 2012) | 18 lines

Fix deadlock in SIP transfers that involve a REFER request

In r367163, "send to voicemail" functionality was added to the SIP channel
driver.  This required updating the party redirecting information for the
channel based on the headers provided in the REFER request.  When the
redirecting party information is updated on the channel, a call to
ast_indicate_data occurs.  Because handle_request_refer still had the sip_pvt
locked, a deadlock could occur between the pbx_thread and the do_monitor thread
servicing the REFER request.

This patch preserves the proper locking order between the channel and the
sip_pvt by ensuring that the sip_pvt is unlocked prior to updating the party
redirecting information on the channel.

(closes issue AST-903)
Reported by: Matt Jordan
patches:
  jira_ast_903_trunk.patch by rmudgett (license 5621)

------------------------------------------------------------------------
r368962 | qwell | 2012-06-14 13:38:48 -0500 (Thu, 14 Jun 2012) | 11 lines

Remove global symbol requirement from app_voicemail.

This uses the existing "function installation" stuff that already existed for
other functions, like getting message counts.

(closes issue AST-807)
(issue AST-901)
(issue AST-908)

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

------------------------------------------------------------------------
r368964 | qwell | 2012-06-14 14:03:24 -0500 (Thu, 14 Jun 2012) | 8 lines

These functions that were moved need to be static.

Also wrap test functions in a #ifdef.

(issue AST-807)
(issue AST-901)
(issue AST-908)

------------------------------------------------------------------------
r368998 | qwell | 2012-06-15 10:31:43 -0500 (Fri, 15 Jun 2012) | 6 lines

Remove some symbol exports that got missed in the removal of global symbols.

(issue AST-807)
(issue AST-901)
(issue AST-908)

------------------------------------------------------------------------
r369024 | qwell | 2012-06-15 11:29:40 -0500 (Fri, 15 Jun 2012) | 2 lines

Fix voicemail API tests by using the correct argument order for create/destroy.

------------------------------------------------------------------------

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@369839 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRevert r369024,368998,368964,368962,368790,367161,365395,364761 for now.
Jason Parker [Tue, 26 Jun 2012 18:14:39 +0000 (18:14 +0000)] 
Revert r369024,368998,368964,368962,368790,367161,365395,364761 for now.

These changes ended up being made a bit prematurely.

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@369410 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix voicemail API tests by using the correct argument order for create/destroy.
Jason Parker [Fri, 15 Jun 2012 16:29:40 +0000 (16:29 +0000)] 
Fix voicemail API tests by using the correct argument order for create/destroy.

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@369024 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRemove some symbol exports that got missed in the removal of global symbols.
Jason Parker [Fri, 15 Jun 2012 15:31:43 +0000 (15:31 +0000)] 
Remove some symbol exports that got missed in the removal of global symbols.

(issue AST-807)
(issue AST-901)
(issue AST-908)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@368998 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoThese functions that were moved need to be static.
Jason Parker [Thu, 14 Jun 2012 19:03:24 +0000 (19:03 +0000)] 
These functions that were moved need to be static.

Also wrap test functions in a #ifdef.

(issue AST-807)
(issue AST-901)
(issue AST-908)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@368964 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRemove global symbol requirement from app_voicemail.
Jason Parker [Thu, 14 Jun 2012 18:38:48 +0000 (18:38 +0000)] 
Remove global symbol requirement from app_voicemail.

This uses the existing "function installation" stuff that already existed for
other functions, like getting message counts.

(closes issue AST-807)
(issue AST-901)
(issue AST-908)

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@368962 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoEnable res_smdi/res_adsi by default
Matthew Jordan [Wed, 13 Jun 2012 22:16:09 +0000 (22:16 +0000)] 
Enable res_smdi/res_adsi by default

Re-enable res_smdi/res_adsi by default, as they are both now considered
core supported modules.

(issue AST-900)
Reported by: Thomas Arimont

(issue AST-885)
Reported by: Denis Alberto Martinez

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@368919 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoMark res_smdi/res_adsi as 'core' supported modules
Matthew Jordan [Wed, 13 Jun 2012 20:29:33 +0000 (20:29 +0000)] 
Mark res_smdi/res_adsi as 'core' supported modules

Recently, various issues surrounding weak attributes have caused problems with
modules that rely on that feature to be enabled in menuselect.  This includes
app_voicemail and chan_dahdi, as they both rely upon res_smdi and res_adsi,
which, in certain circumstances, may not be enabled by default in menuselect.

Because res_smdi/res_adsi are dependencies for chan_dahdi/app_voicemail, this
patch marks both as 'core' supported modules.  This will allow both
app_voicemail and chan_dahdi to be enabled as well, regardless of whether or
not that system supports weak attributes.

(issue AST-900)
Reported by: Thomas Arimont

(issue AST-885)
Reported by: Denis Alberto Martinez
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@368897 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix deadlock in SIP transfers that involve a REFER request
Matthew Jordan [Tue, 12 Jun 2012 13:44:36 +0000 (13:44 +0000)] 
Fix deadlock in SIP transfers that involve a REFER request

In r367163, "send to voicemail" functionality was added to the SIP channel
driver.  This required updating the party redirecting information for the
channel based on the headers provided in the REFER request.  When the
redirecting party information is updated on the channel, a call to
ast_indicate_data occurs.  Because handle_request_refer still had the sip_pvt
locked, a deadlock could occur between the pbx_thread and the do_monitor thread
servicing the REFER request.

This patch preserves the proper locking order between the channel and the
sip_pvt by ensuring that the sip_pvt is unlocked prior to updating the party
redirecting information on the channel.

(closes issue AST-903)
Reported by: Matt Jordan
patches:
  jira_ast_903_trunk.patch by rmudgett (license 5621)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@368790 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd feature modifier to versions produced from branches
Matthew Jordan [Wed, 6 Jun 2012 17:32:45 +0000 (17:32 +0000)] 
Add feature modifier to versions produced from branches

Certain branches, such as Certified Asterisk, may have a modifier added to
them that specifies the features available in that branch.  For branches, this
modifier is expected to be reflected in the location of the branch in
subversion. For example, a subversion of URL of /certified/branches/1.8.11
would have a feature modifier of 'certified'.  This is slightly different then
how features are determined for tags, where the feature is part of the actual
tag name, e.g., "10.5.0-digiumphones".

In keeping with the nomenclature used for tags, the feature specifier for
branches is translated and placed after the revision numbers.  For the example
given previously, this would result in a branch version of
"Asterisk SVN-branch-1.8.11-cert-rXXXXXX".

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@368608 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAST-2012-007: Fix IAX receiving HOLD without suggested MOH class crash.
Matthew Jordan [Tue, 29 May 2012 18:47:28 +0000 (18:47 +0000)] 
AST-2012-007: Fix IAX receiving HOLD without suggested MOH class crash.

* Made schedule_delivery() set the received frame f->data.ptr to NULL if
the datalen is zero.

* Fix queue_signalling() memcpy() size error.

* Made queue_signalling() not use C++ keyword variable names.

(closes issue ASTERISK-19597)
Reported by: mgrobecker
Patches:
      jira_asterisk_19597_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett, Michael L. Youngi

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@367847 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAST-2012-008: Fix remote crash vulnerability in chan_skinny
Matthew Jordan [Tue, 29 May 2012 18:46:22 +0000 (18:46 +0000)] 
AST-2012-008: Fix remote crash vulnerability in chan_skinny

When a skinny session is unregistered, the corresponding device pointer is set
to NULL in the channel private data.  If the client was not in the on-hook state
at the time the connection was closed, the device pointer can later be
dereferened if a message or channel event attempts to use a line's pointer to
said device.

The patches prevent this from occurring by checking the line's pointer in
message handlers and channel callbacks that can fire after an unregistration
attempt.

(closes issue ASTERISK-19905)
Reported by: Christoph Hebeisen
Tested by: mjordan, Damien Wedhorn
Patches:
  AST-2012-008-1.8.diff uploaded by mjordan (license 6283)
  AST-2012-008-10.diff uploaded by mjordan (licesen 6283)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@367846 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd "send to voicemail" Digium phone functionality to Asterisk.
Mark Michelson [Mon, 21 May 2012 19:05:52 +0000 (19:05 +0000)] 
Add "send to voicemail" Digium phone functionality to Asterisk.

This change accommodates two methods by which calls can be directed to
a user's voicemail.

* Incoming calls can be redirected to any user's voicemail.
* Established calls can be blind transferred to any user's voicemail.

Digium phones indicate the desire to direct a call to voicemail by using
a Diversion header with a reason parameter of "send_to_vm".

This patch adds the "send_to_vm" reason as a valid redirecting reason. In
addition, chan_sip.c has been modified to update redirecting information
on the transferred channel by reading a Diversion header on a REFER request.

(closes issue AST-871)
Reported by Malcolm Davenport

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@367161 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd support for folders in MixMonitor 'm' option. Backport manager actions.
Jason Parker [Fri, 4 May 2012 21:17:08 +0000 (21:17 +0000)] 
Add support for folders in MixMonitor 'm' option.  Backport manager actions.

The manager actions are needed, so MixMonitor can be executed on existing
channels.

(issue DPMA-68)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@365395 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRemove folder_dir from voicemail snapshots API.
Jason Parker [Tue, 1 May 2012 17:25:14 +0000 (17:25 +0000)] 
Remove folder_dir from voicemail snapshots API.

It was both unused (except in tests, where it was fudged) and unnecessary.

(closes issue AST-842)

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@364761 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAsterisk 1.8-digiumphones branch has become Certified Asterisk 1.8.11.
Jason Parker [Wed, 25 Apr 2012 16:53:42 +0000 (16:53 +0000)] 
Asterisk 1.8-digiumphones branch has become Certified Asterisk 1.8.11.

For more details about Certified Asterisk, see http://tinyurl.com/7pfp639

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@363674 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoDisable extended and deprecated modules by default.
Jason Parker [Tue, 24 Apr 2012 20:57:26 +0000 (20:57 +0000)] 
Disable extended and deprecated modules by default.

Users can still enable any of these using menuselect if they so choose.

(closes issue AST-873)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@363374 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoMultiple revisions 363102,363106,363141
Jason Parker [Mon, 23 Apr 2012 15:17:20 +0000 (15:17 +0000)] 
Multiple revisions 363102,363106,363141

........
  r363102 | mjordan | 2012-04-23 08:37:55 -0500 (Mon, 23 Apr 2012) | 16 lines

  AST-2012-005: Fix remotely exploitable heap overflow in keypad button handling

  When handling a keypad button message event, the received digit is placed into
  a fixed length buffer that acts as a queue.  When a new message event is
  received, the length of that buffer is not checked before placing the new digit
  on the end of the queue.  The situation exists where sufficient keypad button
  message events would occur that would cause the buffer to be overrun.  This
  patch explicitly checks that there is sufficient room in the buffer before
  appending a new digit.

  (closes issue ASTERISK-19592)
  Reported by: Russell Bryant
  ........

  Merged revisions 363100 from http://svn.asterisk.org/svn/asterisk/branches/1.6.2
........
  r363106 | mjordan | 2012-04-23 09:05:02 -0500 (Mon, 23 Apr 2012) | 17 lines

  AST-2012-006: Fix crash in UPDATE handling when no channel owner exists

  If Asterisk receives a SIP UPDATE request after a call has been terminated and
  the channel has been destroyed but before the SIP dialog has been destroyed, a
  condition exists where a connected line update would be attempted on a
  non-existing channel.  This would cause Asterisk to crash.  The patch resolves
  this by first ensuring that the SIP dialog has an owning channel before
  attempting a connected line update.  If an UPDATE request is received and no
  channel is associated with the dialog, a 481 response is sent.

  (closes issue ASTERISK-19770)
  Reported by: Thomas Arimont
  Tested by: Matt Jordan
  Patches:
    ASTERISK-19278-2012-04-16.diff uploaded by Matt Jordan (license 6283)
........
  r363141 | jrose | 2012-04-23 09:33:16 -0500 (Mon, 23 Apr 2012) | 20 lines

  AST-2012-004: Fix an error that allows AMI users to run shell commands sans authorization.

  As detailed in the advisory, AMI users without write authorization for SYSTEM class AMI
  actions were able to run system commands by going through other AMI commands which did
  not require that authorization. Specifically, GetVar and Status allowed users to do this
  by setting their variable/s options to the SHELL or EVAL functions.
  Also, within 1.8, 10, and trunk there was a similar flaw with the Originate action that
  allowed users with originate permission to run MixMonitor and supply a shell command
  in the Data argument. That flaw is fixed in those versions of this patch.

  (closes issue ASTERISK-17465)
  Reported By: David Woolley
  Patches:
   162_ami_readfunc_security_r2.diff uploaded by jrose (license 6182)
   18_ami_readfunc_security_r2.diff uploaded by jrose (license 6182)
   10_ami_readfunc_security_r2.diff uploaded by jrose (license 6182)
  ........

  Merged revisions 363117 from http://svn.asterisk.org/svn/asterisk/branches/1.6.2
........

Merged revisions 363102,363106,363141 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@363161 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd a test application for sending custom SIP INFO messages.
Mark Michelson [Thu, 19 Apr 2012 20:31:07 +0000 (20:31 +0000)] 
Add a test application for sending custom SIP INFO messages.

When TEST_FRAMEWORK is enabled, SIPSendCustomInfo is available
to test sending custom INFO requests.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@362673 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRename property branches-1.8-merged to branch-1.8-merged
Matthew Jordan [Fri, 13 Apr 2012 17:19:57 +0000 (17:19 +0000)] 
Rename property branches-1.8-merged to branch-1.8-merged

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@362132 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoUpdate properties on 1.8-digiumphones
Matthew Jordan [Fri, 13 Apr 2012 16:01:09 +0000 (16:01 +0000)] 
Update properties on 1.8-digiumphones

Change the merge property tag from svnmerge-integrated to branches-1.8-merged.
Added merged revisions from r362042.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@362083 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoMerge of several needed fixes for 1.8-digiumphones
Matthew Jordan [Thu, 12 Apr 2012 18:47:16 +0000 (18:47 +0000)] 
Merge of several needed fixes for 1.8-digiumphones

This merges fixes for the following issues into the 1.8-digiumphones branch:
 * ASTERISK-19355 - Call transfer with consultation frequently fails in cross-
   linked Asterisk scenario (directmedia & sendrpid active)
 * ASTERISK 19365 - Remote SIP Call legs are frequently not released in a
   cross-linked Asterisk scenario (directmedia & sendrpid)
 * ASTERISK-19183 - Sporadically missing connectedline event to caller channel
   in directed pickup app

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@362042 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix bugs in voicemail APIs and add unit tests.
Mark Michelson [Mon, 9 Apr 2012 20:40:25 +0000 (20:40 +0000)] 
Fix bugs in voicemail APIs and add unit tests.

There were several crashes that could occur due to NULL
inputs, invalid inputs, and the like. This fixes all known
ones and adds unit tests to exercise the APIs.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@361704 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoUpdate Func MESSAGE() and AMI MessageSend documentation.
Richard Mudgett [Fri, 6 Apr 2012 19:08:00 +0000 (19:08 +0000)] 
Update Func MESSAGE() and AMI MessageSend documentation.

* Document MESSAGE(custom_data)

* Update AMI MessageSend documentation

* Eliminate a shadowed variable name in msg_func_write() for custom_data.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@361502 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd additional configuration and presence unit tests.
Mark Michelson [Thu, 5 Apr 2012 17:24:13 +0000 (17:24 +0000)] 
Add additional configuration and presence unit tests.

These were originally written while merging features into trunk, but
these tests apply just as much for the 1.8 version of Digium phones, so
might as well have them here, too.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@361283 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoMake m option for mixmonitor delete the source file once it is finished copying to vm.
Jonathan Rose [Tue, 3 Apr 2012 21:03:01 +0000 (21:03 +0000)] 
Make m option for mixmonitor delete the source file once it is finished copying to vm.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@361088 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoMultiple revisions 359656,359706,359979
Jason Parker [Thu, 29 Mar 2012 21:49:14 +0000 (21:49 +0000)] 
Multiple revisions 359656,359706,359979

........
  r359656 | mjordan | 2012-03-15 13:35:59 -0500 (Thu, 15 Mar 2012) | 22 lines

  Fix remotely exploitable stack overrun in Milliwatt

  Milliwatt is vulnerable to a remotely exploitable stack overrun when using
  the 'o' option.  This occurs due to the milliwatt_generate function not
  accounting for AST_FRIENDLY_OFFSET when calculating the maximum number of
  samples it can put in the output buffer.

  This patch resolves this issue by taking into account AST_FRIENDLY_OFFSET
  when determining the maximum number of samples allowed.  Note that at no
  point is remote code execution possible.  The data that is written into the
  buffer is the pre-defined Milliwatt data, and not custom data.

  (closes issue ASTERISK-19541)
  Reported by: Russell Bryant
  Tested by: Matt Jordan
  Patches:
    milliwatt_stack_overrun.rev1.txt by Russell Bryant (license 6283)
    Note that this patch was written by Russell, even though Matt uploaded it
  ........

  Merged revisions 359645 from http://svn.asterisk.org/svn/asterisk/branches/1.6.2
........
  r359706 | mjordan | 2012-03-15 14:01:22 -0500 (Thu, 15 Mar 2012) | 16 lines

  Fix remotely exploitable stack overflow in HTTP manager

  There exists a remotely exploitable stack buffer overflow in HTTP digest
  authentication handling in Asterisk.  The particular method in question
  is only utilized by HTTP AMI.  When parsing the digest information, the
  length of the string is not checked when it is copied into temporary buffers
  allocated on the stack.

  This patch fixes this behavior by parsing out pre-defined key/value pairs
  and avoiding unnecessary copies to the stack.

  (closes issue ASTERISK-19542)
  Reported by: Russell Bryant
  Tested by: Matt Jordan
........
  r359979 | rmudgett | 2012-03-20 12:21:16 -0500 (Tue, 20 Mar 2012) | 28 lines

  Allow AMI action callback to be reentrant.

  Fix AMI module reload deadlock regression from ASTERISK-18479 when it
  tried to fix the race between calling an AMI action callback and
  unregistering that action.  Refixes ASTERISK-13784 broken by
  ASTERISK-17785 change.

  Locking the ao2 object guaranteed that there were no active callbacks that
  mattered when ast_manager_unregister() was called.  Unfortunately, this
  causes the deadlock situation.  The patch stops locking the ao2 object to
  allow multiple threads to invoke the callback re-entrantly.  There is no
  way to guarantee a module unload will not crash because of an active
  callback.  The code attempts to minimize the chance with the registered
  flag and the maximum 5 second delay before ast_manager_unregister()
  returns.

  The trunk version of the patch changes the API to fix the race condition
  correctly to prevent the module code from unloading from memory while an
  action callback is active.

  * Don't hold the lock while calling the AMI action callback.

  (closes issue ASTERISK-19487)
  Reported by: Philippe Lindheimer

  Review: https://reviewboard.asterisk.org/r/1818/
  Review: https://reviewboard.asterisk.org/r/1820/
........

Merged revisions 359656,359706,359979 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@360826 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoPrevent potentially passing a NULL pointer to strcasecmp()
Mark Michelson [Wed, 21 Mar 2012 15:44:55 +0000 (15:44 +0000)] 
Prevent potentially passing a NULL pointer to strcasecmp()

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@360188 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix one more "(null)" string.
Mark Michelson [Tue, 20 Mar 2012 21:29:00 +0000 (21:29 +0000)] 
Fix one more "(null)" string.

If a hint with no presence portion were added, it would
result in another "(null)" string warning.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@360071 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix another "Possible programming error" bug.
Mark Michelson [Tue, 20 Mar 2012 20:40:46 +0000 (20:40 +0000)] 
Fix another "Possible programming error" bug.

Similar to the previous commit, don't pass
a printf-generated string to ast_strlen_zero.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@360035 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoGet rid of an annoying "Possible programming error" message.
Mark Michelson [Tue, 20 Mar 2012 19:30:07 +0000 (19:30 +0000)] 
Get rid of an annoying "Possible programming error" message.

If an extension's 'app' field is NULL, then a "(null)" string
would be written into an ast_str due to the way that snprintf
works. When this is passed to ast_strlen_zero(), it fires up
a big warning indicating something is probably wrong.

There indeed was a problem, but luckily it wasn't a very big
problem. After the failed ast_strlen_zero() check and big
warning message, the very next if statement, checking to
see if the "(null)" matched a presence provider, would fail,
so no harm was done.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@360031 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFixes unitialized variable use warning introduced by addition of mixmonitor forward...
Jonathan Rose [Thu, 8 Mar 2012 18:40:13 +0000 (18:40 +0000)] 
Fixes unitialized variable use warning introduced by addition of mixmonitor forward to vm

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@358725 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoPrevent outbound SIP NOTIFY packets from displaying a port of 0
Jason Parker [Thu, 8 Mar 2012 18:02:58 +0000 (18:02 +0000)] 
Prevent outbound SIP NOTIFY packets from displaying a port of 0

In the change from 1.6.2 to 1.8, ast_sockaddr was introduced which changed the
behavior of ast_find_ourip such that port number was wiped out.  This caused
the port in internip (which is used for Contact and Call-ID on NOTIFYs) to be
0.  This change causes ast_find_ourip to be port-preserving again.

(closes issue ASTERISK-19430)
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@358692 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFixed xmldoc formatting error for 'm' option
Paul Belanger [Fri, 2 Mar 2012 15:18:53 +0000 (15:18 +0000)] 
Fixed xmldoc formatting error for 'm' option

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@357808 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd support for Digium Phones.
Jason Parker [Tue, 28 Feb 2012 21:52:48 +0000 (21:52 +0000)] 
Add support for Digium Phones.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@357459 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agosvnmerge init
Jason Parker [Tue, 28 Feb 2012 21:48:06 +0000 (21:48 +0000)] 
svnmerge init

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@357457 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd branch that supports Digium Phones for Asterisk 1.8 users.
Jason Parker [Tue, 28 Feb 2012 21:47:07 +0000 (21:47 +0000)] 
Add branch that supports Digium Phones for Asterisk 1.8 users.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@357456 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix callerid of Originated calls.
Richard Mudgett [Mon, 27 Feb 2012 23:34:03 +0000 (23:34 +0000)] 
Fix callerid of Originated calls.

Thanks to Matt Riddell for tracking this down.

(closes issue ASTERISK-19385)
Reported by: ornix

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@357093 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoCopy CDR variables when set during a bridge
Terry Wilson [Mon, 27 Feb 2012 16:03:04 +0000 (16:03 +0000)] 
Copy CDR variables when set during a bridge

This patch makes sure amaflags, accountcode, and userfield get copied
to the bridge CDR when set during a bridge (like via a custom feature).

(closes issue ASTERISK-16990)
Review: https://reviewboard.asterisk.org/r/1721/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356963 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRemove possible segfaults from res_odbc by adding locks around usage of odbc handle
Jonathan Rose [Mon, 27 Feb 2012 15:14:45 +0000 (15:14 +0000)] 
Remove possible segfaults from res_odbc by adding locks around usage of odbc handle

(closes issue ASTERISK-19011)
Reported by: Walter Doekes
Patches:
issueA19011_combine_read_and_write_locks_WORK_IN_PROGRESS.patch uploaded by Walter Doekes (license 5674)
review: https://reviewboard.asterisk.org/r/1719/
review: https://reviewboard.asterisk.org/r/1622/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356917 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix crash in app_voicemail during close_mailbox
Matthew Jordan [Sat, 25 Feb 2012 17:21:29 +0000 (17:21 +0000)] 
Fix crash in app_voicemail during close_mailbox

In r354890, a memory leak in app_voicemail was fixed by properly disposing of
the allocated heard/deleted pointers.  However, there are situations,
particularly when no messages are found in a folder, where these pointers are
not allocated and not NULL.  In that case, an invalid free would be attempted,
which could crash app_voicemail.  As there are a number of code paths where
this could occur, this patch uses the number of messages detected in the folder
before it attempts to free the pointers.  This resolves the crash detected in
the Asterisk Test Suite's check_voicemail_nominal test.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356797 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix worker thread resource leak in SIP TCP/TLS.
Richard Mudgett [Fri, 24 Feb 2012 18:23:28 +0000 (18:23 +0000)] 
Fix worker thread resource leak in SIP TCP/TLS.

The SIP TCP/TLS worker threads were created joinable but noone could join
them if they died on their own.

* Fix the SIP TCP/TLS worker threads to not be created joinable.

* _sip_tcp_helper_thread() only needs one parameter since the pvt
parameter is only passed in as NULL and never used.

(closes issue ASTERISK-19203)
Reported by: Steve Davies

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356677 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRemove srtp_shutdown from res_srtp
Matthew Jordan [Fri, 24 Feb 2012 17:41:18 +0000 (17:41 +0000)] 
Remove srtp_shutdown from res_srtp

The patch for ASTERISK-19253 included properly shutting down the libsrtp
library in the case of module unload.  Unfortunately, not all distributions
have the srtp_shutdown call.  As such, this patch removes calling
srtp_shutdown.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356650 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAllow SRTP policies to be reloaded
Matthew Jordan [Fri, 24 Feb 2012 15:07:09 +0000 (15:07 +0000)] 
Allow SRTP policies to be reloaded

Currently, when using res_srtp, once the SRTP policy has been added to the
current session the policy is locked into place.  Any attempt to replace an
existing policy, which would be needed if the remote endpoint negotiated a new
cryptographic key, is instead rejected in res_srtp.  This happens in particular
in transfer scenarios, where the endpoint that Asterisk is communicating with
changes but uses the same RTP session.

This patch modifies res_srtp to allow remote and local policies to be reloaded
in the underlying SRTP library.  From the perspective of users of the SRTP API,
the only change is that the adding of remote and local policies are now added
in a single method call, whereas they previously were added separately.  This
was changed to account for the differences in handling remote and local
policies in libsrtp.

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

(closes issue ASTERISK-19253)
Reported by: Thomas Arimont
Tested by: Thomas Arimont
Patches:
  srtp_renew_keys_2012_02_22.diff uploaded by Matt Jordan (license 6283)
  (with some small modifications for this check-in)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356604 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix blind transfer parking issues if the dialed extension is not recognized as a...
Richard Mudgett [Thu, 23 Feb 2012 19:49:03 +0000 (19:49 +0000)] 
Fix blind transfer parking issues if the dialed extension is not recognized as a parking extension.

Custom parking extensions may not be coded such that the first and only
extension priority is the Park application.  These custom parking
extensions will not be recognized as parking extensions.  When a call is
blind transferred to an extension that is not recognized as a parking
extension, the normal blind transfer code causes the transferred channel
to start executing dialplan.  Calls that get parked in this manner do not
know the original channel name that parked the call so the original parker
could never be called back if the parked call is not retrieved before the
timeout time.  The parking space is also announced to the call being
parked as a side effect of not knowing the original parking channel.

* Fix handling of BLINDTRANSFER channel variable for call parking.

* Fixed SIP blind transfer using the wrong dialplan context variable to
check for the parking extension.

(closes issue ASTERISK-19322)
Reported by: aragon
Tested by: rmudgett, jparker

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

JIRA AST-766

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356521 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix ACK routing for non-2xx responses.
Mark Michelson [Thu, 23 Feb 2012 15:37:59 +0000 (15:37 +0000)] 
Fix ACK routing for non-2xx responses.

When we send an ACK for a 2xx response to an INVITE, we are supposed
to use the learned route set. However, when we receive a non-2xx final
response to an INVITE, we are supposed to send the ACK to the same place
we initially sent the INVITE.

We had been doing this up until the changes went in that would build a route
set from provisional responses. That introduced a regression where we would
use the learned route set under all circumstances.

With this change, we now will set the destination of our ACK based on the
invitestate. If it is INV_COMPLETED then that means that we have received
a non-2xx final response (INV_TERMINATED indicates a 2xx response was received).
If it is INV_CANCELLED, then that means the call is being canceled, which
means that we should be ACKing a 487 response.

The other change introduced here is setting the invitestate to INV_CONFIRMED
when we send an ACK *after* the reqprep instead of before. This way, we can
tell in reqprep more easily what the invitestate is prior to sending the ACK.

(closes issue ASTERISK-19389)
reported by Karsten Wemheuer
patches:
    ASTERISK-19389v2.patch uploaded by Mark Michelson (license #5049)
(with some slight modifications prior to commit)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356475 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix -Werror=unused-but-set-variable compiler error (gcc 4.6.2)
Paul Belanger [Thu, 23 Feb 2012 03:36:46 +0000 (03:36 +0000)] 
Fix -Werror=unused-but-set-variable compiler error (gcc 4.6.2)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356430 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoMissed one strsep() function
Paul Belanger [Wed, 22 Feb 2012 21:36:37 +0000 (21:36 +0000)] 
Missed one strsep() function

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356337 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd back strsep() function for previous commit
Paul Belanger [Wed, 22 Feb 2012 21:29:25 +0000 (21:29 +0000)] 
Add back strsep() function for previous commit

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356335 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoTrack module use count for res_calendar
Terry Wilson [Wed, 22 Feb 2012 21:08:50 +0000 (21:08 +0000)] 
Track module use count for res_calendar

If the res_calendar module was followed immediately by one of the
calendar tech modules and "core stop gracefully" was run, Asterisk
would crash.

This patch adds use count tracking for res_calendar so that it is
unloaded after the tech modules when shutting down gracefully. It
is now not possible to unload all the of the calendar modules via
"module unload res_calednar.so", but it is still possible to unload
them all via "module unload -h res_calendar.so".

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356291 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix -Werror=unused-but-set-variable compiler error (gcc 4.6.2)
Paul Belanger [Wed, 22 Feb 2012 20:20:29 +0000 (20:20 +0000)] 
Fix -Werror=unused-but-set-variable compiler error (gcc 4.6.2)

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356290 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix potential buffer overrun and memory leak when executing "sip show peers"
Matthew Jordan [Wed, 22 Feb 2012 14:50:20 +0000 (14:50 +0000)] 
Fix potential buffer overrun and memory leak when executing "sip show peers"

The "sip show peers" command uses a fix sized array to sort the current peers
in the peers ao2_container.  The size of the array is based on the current
number of peers in the container.  However, once the size of the array is
determined, the number of peers in the container can change, as the peers
container is not locked.  This could cause a buffer overrun when populating
the array, if peers were added to the container after the array was created.
Additionally, a memory leak of the allocated array would occur if a user
caused the _show_peers method to return CLI_SHOWUSAGE.

We now create a snapshot of the current peers using an ao2_callback with the
OBJ_MULTIPLE flag.  This size of the array is set to the number of peers
that the iterator will iterate over; hence, if peers are added or removed
from the peers container it will not affect the execution of the "sip show
peers" command.

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

(closes issue ASTERISK-19231)
(closes issue ASTERISK-19361)
Reported by: Thomas Arimont, Jamuel Starkey
Tested by: Thomas Arimont, Jamuel Starkey
Patches: sip_show_peers_2012_02_16.diff uploaded by mjordan (license 6283)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356214 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoMake 'iax2 show callnumber usage' output make sense when an IP is passed in.
Sean Bright [Tue, 21 Feb 2012 11:16:23 +0000 (11:16 +0000)] 
Make 'iax2 show callnumber usage' output make sense when an IP is passed in.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@356107 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRemove spurious warning when 'qualifyfreqnotok' is set successfully.
Sean Bright [Mon, 20 Feb 2012 18:38:28 +0000 (18:38 +0000)] 
Remove spurious warning when 'qualifyfreqnotok' is set successfully.

(closes issue ASTERISK-17176)
Reported by: John Covert
Tested by: Sean Bright
Patches:
   chan_iax2.c.qualifyfreqnotok.patch uploaded by John Covert (license 5512)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355997 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoThis was a LOG_NOTICE, so roll it back.
Sean Bright [Mon, 20 Feb 2012 14:40:10 +0000 (14:40 +0000)] 
This was a LOG_NOTICE, so roll it back.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355952 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoChange some debug messages from LOG_DEBUG to ast_debug.
Sean Bright [Mon, 20 Feb 2012 14:30:38 +0000 (14:30 +0000)] 
Change some debug messages from LOG_DEBUG to ast_debug.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355949 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoAdd some boilerplate documentation for IAXVAR and IAXPEER.
Sean Bright [Sun, 19 Feb 2012 18:04:52 +0000 (18:04 +0000)] 
Add some boilerplate documentation for IAXVAR and IAXPEER.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355904 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoSet the length of the ast_sockaddr, so that we can set it's port later.
Sean Bright [Sun, 19 Feb 2012 17:49:45 +0000 (17:49 +0000)] 
Set the length of the ast_sockaddr, so that we can set it's port later.

Without this, the call to ast_sockaddr_set_port a few lines later is a noop.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355901 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agopush 'outgoing' flag from sig_XXX up to chan_dahdi
Alec L Davis [Sat, 18 Feb 2012 07:55:11 +0000 (07:55 +0000)] 
push 'outgoing' flag from sig_XXX up to chan_dahdi

'p->outgoing' in chan_dahdi and sig_analog wern't kept in sync, particulary FXS ast_hangup didn't clear the 'outgoing' flag.
sig_pri and sig_ss7 were keeping 'outgoing' flag insync.

Now provides a callback for all the low level sig_XXX modules.

(issue ASTERISK-19316)

alecdavis (license 585)
Reported by: Jeremy Pepper
Tested by: alecdavis

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355850 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix -Werror=unused-but-set-variable compiler error (gcc 4.6.2)
Paul Belanger [Sat, 18 Feb 2012 03:59:26 +0000 (03:59 +0000)] 
Fix -Werror=unused-but-set-variable compiler error (gcc 4.6.2)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355839 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoDon't allow trunkfreq to be greater than 1000ms.
Sean Bright [Fri, 17 Feb 2012 22:01:49 +0000 (22:01 +0000)] 
Don't allow trunkfreq to be greater than 1000ms.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355793 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoPass the correct value to ast_timer_set_rate() for IAX2 trunking.
Sean Bright [Fri, 17 Feb 2012 19:32:52 +0000 (19:32 +0000)] 
Pass the correct value to ast_timer_set_rate() for IAX2 trunking.

IAX2 uses the trunkfreq variable to determine how often to send trunk packets, but
this value is in milliseconds while ast_timer_set_rate() expects the rate argument
to be ticks per second.  So we divide 1000 by trunkfreq and pass that in instead.

With a default of 20ms, this change makes IAX2 send trunk packets every 20ms
instead of every 50ms.

Tracked down by myself and Bob Wienholt.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355746 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix regressions with regards to route-set creation on early dialogs.
Mark Michelson [Fri, 17 Feb 2012 18:57:28 +0000 (18:57 +0000)] 
Fix regressions with regards to route-set creation on early dialogs.

This fixes two main issues:

1. Asterisk would send a CANCEL to the route created by the provisional response
   instead of using the same destination it did in the initial INVITE.
2. If a new route set arrives in a 200 OK than was in the 1XX response (perfectly
   possible if our outbound INVITE gets forked), then the route set in the 200 OK
   needs to overwrite the route set in the 1XX response.

(closes issue ASTERISK-19358)
Reported by: Karsten Wemheuer
Tested by: Karsten Wemheuer
patches:
   ASTERISK-19358.patch uploaded by Mark Michelson (license 5049)
   ASTERISK-19358.patch uploaded by Stefan Schmidt (license 6034)

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355732 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRevert change to translate.c as it has caused an infinite loop to occur in circumstances.
Mark Michelson [Fri, 17 Feb 2012 16:04:24 +0000 (16:04 +0000)] 
Revert change to translate.c as it has caused an infinite loop to occur in circumstances.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355721 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRevert 355700 and 355701
Paul Belanger [Fri, 17 Feb 2012 00:25:13 +0000 (00:25 +0000)] 
Revert 355700 and 355701

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355711 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoMissed a variable
Paul Belanger [Thu, 16 Feb 2012 23:54:54 +0000 (23:54 +0000)] 
Missed a variable

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355701 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix -Werror=unused-but-set-variable compiler error (gcc 4.6.2)
Paul Belanger [Thu, 16 Feb 2012 23:53:08 +0000 (23:53 +0000)] 
Fix -Werror=unused-but-set-variable compiler error (gcc 4.6.2)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355700 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoRevert a change to audio_audiohook_write_list that had no affect.
Sean Bright [Thu, 16 Feb 2012 20:01:15 +0000 (20:01 +0000)] 
Revert a change to audio_audiohook_write_list that had no affect.

When I made this change initially, I was under the false impression that the
audiohooks structure remained on the channel after all of the hooks had been
detached.  This is not the case, ast ast_read takes care of removing the
audiohooks structure if the lists are empty.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355622 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix compile problem when old version of libvorbisfile v1.1.2 is used.
Richard Mudgett [Thu, 16 Feb 2012 19:26:16 +0000 (19:26 +0000)] 
Fix compile problem when old version of libvorbisfile v1.1.2 is used.

The principle difference between libvorbisfile v1.1.2 and newer (at least
v1.2.0) is the addition of the predefined callbacks OV_CALLBACKS_xxx in
vorbis/vorbisfile.h used for ov_open_callbacks().

* Updated the configure script to detect if libvorbisfile.h declares
OV_CALLBACKS_NOCLOSE.

* Copied the declaration of OV_CALLBACKS_NOCLOSE from v1.2.0 to allow
v1.1.2 to compile.

(closes issue ASTERISK-19370)
Reported by: Jonn Taylor

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355608 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix AMI Monitor action without File header converting channel name into filename.
Richard Mudgett [Thu, 16 Feb 2012 18:26:37 +0000 (18:26 +0000)] 
Fix AMI Monitor action without File header converting channel name into filename.

* Fix potential Solaris crash if Monitor application has a urlbase and no
fname_base option.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355574 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoWhen IAX2 debugging is enabled, make sure to log 'apathetic' messages too.
Sean Bright [Wed, 15 Feb 2012 19:26:38 +0000 (19:26 +0000)] 
When IAX2 debugging is enabled, make sure to log 'apathetic' messages too.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355529 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoOnly use maxtrunkcall and maxnontrunkcall in chan_iax2 if IAX_OLD_FIND is specified.
Sean Bright [Wed, 15 Feb 2012 18:19:46 +0000 (18:19 +0000)] 
Only use maxtrunkcall and maxnontrunkcall in chan_iax2 if IAX_OLD_FIND is specified.

These variables are only accessed from the IAX_OLD_FIND path, so there is no reason
to keep them updated otherwise.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355458 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoUse TRUNK_CALL_START as originally intended.
Sean Bright [Wed, 15 Feb 2012 17:24:22 +0000 (17:24 +0000)] 
Use TRUNK_CALL_START as originally intended.

Back in r646, TRUNK_CALL_START was added and defined as 0x4000.  That same value
was also hard-coded in one part of the IAX2 code instead of using the #define.

TRUNK_CALL_START has changed over the years (for dealing with LOW_MEMORY), but
the hard-coded usage was never updated to match.  This patch fixes that.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355448 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix voicemail problems when using ogg/vorbis.
Richard Mudgett [Tue, 14 Feb 2012 19:10:35 +0000 (19:10 +0000)] 
Fix voicemail problems when using ogg/vorbis.

Ogg/vorbis was fairly useless as a voicemail file format because it did
not implement the seek and tell format callbacks among other problems.

Since we were already using the libvorbis and libvorbisenc libraries we
can use libvorbisfile as it is also part of the vorbis library package.

* Made use the libvorbisfile to handle the ogg/vorbis file stream.  The
format_ogg_vorbis.c is now mostly a wrapper around libvorbisfile.

(closes issue ASTERISK-16926)
Reported by: sque
Patches:
      ogg_vorbis_use_libvorbisfile.patch (license #6108) patch uploaded by sque

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355365 65c4cc65-6c06-0410-ace0-fbb531ad65f3

13 years agoFix lock typo that should be unlock in cel_sqlite_custom reload.
Richard Mudgett [Tue, 14 Feb 2012 18:12:16 +0000 (18:12 +0000)] 
Fix lock typo that should be unlock in cel_sqlite_custom reload.

(closes issue ASTERISK-19356)
Reported by: Alex Villacis Lasso
Patches:
      asterisk-1.8.9.2-cel_sqlite3_custom-fix-reload-locking-typo.patch (license #5617) patch uploaded by Alex Villacis Lasso

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@355319 65c4cc65-6c06-0410-ace0-fbb531ad65f3