Commit Graph

896 Commits

Author SHA1 Message Date
Tilghman Lesher 53459f86b2 Expand RQ_INTEGER type out to multiple types, one for each precision
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121367 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-09 22:51:59 +00:00
Tilghman Lesher 9471b87d27 Merge the adaptive realtime branch, which will make adding new required fields
to realtime less painful in the future.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120789 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-05 19:07:27 +00:00
Russell Bryant 5866b0dfe8 Merged revisions 120168 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r120168 | russell | 2008-06-03 16:34:55 -0500 (Tue, 03 Jun 2008) | 4 lines

Fix another place where peer->callno could change at a very bad time, and also
fix a place where a peer was used after the reference was released.
(inspired by rev 120001)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-03 21:35:11 +00:00
Tilghman Lesher f3a62ab27e Merged revisions 120001 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r120001 | tilghman | 2008-06-03 11:10:53 -0500 (Tue, 03 Jun 2008) | 9 lines

Save the callno when we're poking, because our peer structure could change
during destruction (and thus we unlock the wrong callno, causing a
cascade failure).
(closes issue #12717)
 Reported by: gewfie
 Patches: 
       20080525__bug12717.diff.txt uploaded by Corydon76 (license 14)
 Tested by: gewfie

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120012 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-03 16:19:35 +00:00
Russell Bryant d6240ac21e Merged revisions 119838 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r119838 | russell | 2008-06-02 15:08:04 -0500 (Mon, 02 Jun 2008) | 7 lines

Revert a change made for issue #12479.  This change caused a regression such that
a dial string such as (IAX2/foo) did not automatically fall back to dialing the 's'
extension anymore.

(closes issue #12770)
Reported by: dagmoller

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@119839 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-02 20:08:24 +00:00
Russell Bryant 2feb90d511 Merged revisions 119687 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r119687 | russell | 2008-06-02 07:30:17 -0500 (Mon, 02 Jun 2008) | 3 lines

Even of the first PING or LAGRQ doesn't get sent because it comes up too soon,
make sure to reschedule so it gets sent later.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@119688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-02 12:30:42 +00:00
Russell Bryant ea3c47e7df Merged revisions 119533 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r119533 | russell | 2008-06-01 20:06:09 -0500 (Sun, 01 Jun 2008) | 2 lines

Change a debug message to an actual debug message

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@119534 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-02 01:08:16 +00:00
Russell Bryant 87c9b6fc25 Merged revisions 119238 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r119238 | russell | 2008-05-30 07:55:36 -0500 (Fri, 30 May 2008) | 15 lines

Merged revisions 119237 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r119237 | russell | 2008-05-30 07:49:39 -0500 (Fri, 30 May 2008) | 7 lines

- Instead of only enforcing destination call number checking on an ACK, check
  all full frames except for PING and LAGRQ, which may be sent by older versions
  too quickly to contain the destination call number.
  (As suggested by Tim Panton on the asterisk-dev list)
- Merge changes from team/russell/iax2-frame-race, which prevents PING and LAGRQ
  from being sent before the destination call number is known.

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@119239 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-30 12:59:11 +00:00
Russell Bryant 9397f04294 Merged revisions 119009 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r119009 | russell | 2008-05-29 13:49:12 -0500 (Thu, 29 May 2008) | 16 lines

Merged revisions 119008 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r119008 | russell | 2008-05-29 13:45:21 -0500 (Thu, 29 May 2008) | 7 lines

Merge changes from team/russell/iax2-another-fix-to-the-fix

As described in the following post to the asterisk-dev mailing list, only
enforce destination call numbers when processing an ACK.

http://lists.digium.com/pipermail/asterisk-dev/2008-May/033217.html

(closes issue #12631)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@119010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-29 18:54:11 +00:00
Tilghman Lesher 6e5d843a71 Merged revisions 118953 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118953 | tilghman | 2008-05-29 12:20:16 -0500 (Thu, 29 May 2008) | 3 lines

Add some debugging code that ensures that when we do deadlock avoidance, we
don't lose the information about how a lock was originally acquired.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118955 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-29 17:35:19 +00:00
Brett Bryant 7d6496c247 Fixes a bug in chan_iax that uses send_command to poke a peer while a channel is unlocked in some cases, and because it can cause seemingly
random failures could be related to some bugs in the tracker...


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118702 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-28 16:01:05 +00:00
Brett Bryant a06df81624 Remove loop from the detection of a sequence number that acknowledges
the receiving of a packet that we've kept in memory just incase the 
packet needs to be retransmitted.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118562 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-27 19:45:41 +00:00
Michiel van Baak f1e9371da8 - revert change to ast_queue_hangup and create ast_queue_hangup_with_cause
- make data member of the ast_frame struct a named union instead of a void

Recently the ast_queue_hangup function got a new parameter, the hangupcause
Feedback came in that this is no good and that instead a new function should be created.
This I did.

The hangupcause was stored in the seqno member of the ast_frame struct. This is not very
elegant, and since there's already a data member that one should be used.
Problem is, this member was a void *.
Now it's a named union so it can hold a pointer, an uint32 and there's a padding in case someone
wants to store another type in there in the future.

This commit is so massive, because all ast_frame.data uses have to be
altered to ast_frame.data.data

Thanks russellb and kpfleming for the feedback.

(closes issue #12674)
Reported by: mvanbaak


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117802 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-22 16:29:54 +00:00
Russell Bryant affbbe3bd2 Merged revisions 116978 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r116978 | russell | 2008-05-18 22:44:04 -0500 (Sun, 18 May 2008) | 4 lines

Avoid access of uninitialized memory.  This caused a bunch of crashes for me
while doing load testing of development branch where I'm working on some
performance improvements.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116979 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-19 03:44:28 +00:00
Joshua Colp 4943cbcf2c Improve native transfers when a chain of IAX2 connections are in use.
(closes issue #7567)
Reported by: tjd
Patches:
      bug_7567_update_v2.diff uploaded by snuffy (license 35)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116884 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-17 19:39:35 +00:00
Brett Bryant 9575b82389 A small change to fix iax2 native bridging.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115669 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-12 15:17:32 +00:00
Mark Michelson 7daebcd610 Adding support for "urgent" voicemail messages. Messages which are
marked "urgent" are considered to be higher priority than other messages
and so they will be played before any other messages in a user's mailbox.

There are two ways to leave an urgent message. 
1. send the 'U' option to VoiceMail().
2. Set review=yes in voicemail.conf. This will give instructions for 
   a caller to mark a message as urgent after the message has been recorded.

I have tested that this works correctly with file and ODBC storage, and James
Rothenberger (who wrote initial support for this feature) has tested its use
with IMAP storage.

(closes issue #11817)
Reported by: jaroth
	Based on branch http://svn.digium.com/svn/asterisk/team/jrothenberger/asterisk-urgent
Tested by: putnopvut, jaroth



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-09 21:22:42 +00:00
Russell Bryant b280054c38 Merged revisions 115568 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115568 | russell | 2008-05-08 14:19:50 -0500 (Thu, 08 May 2008) | 2 lines

Remove debug output.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-08 19:20:35 +00:00
Russell Bryant c961d9637f Merged revisions 115565 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r115565 | russell | 2008-05-08 14:15:25 -0500 (Thu, 08 May 2008) | 33 lines

Merged revisions 115564 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r115564 | russell | 2008-05-08 14:14:04 -0500 (Thu, 08 May 2008) | 25 lines

Fix a race condition that bbryant just found while doing some IAX2 testing.
He was running Asterisk trunk running IAX2 calls through a few Asterisk boxes,
however, the audio was extremely choppy.  We looked at a packet trace and saw
a storm of INVAL and VNAK frames being sent from one box to another.

It turned out that what had happened was that one box tried to send a CONTROL
frame before the 3 way handshake had completed.  So, that frame did not include
the destination call number, because it didn't have it yet.  Part of our recent
work for security issues included an additional check to ensure that frames that
are supposed to include the destination call number have the correct one.  This
caused the frame to be rejected with an INVAL.  The frame would get retransmitted
for forever, rejected every time ...

This race condition exists in all versions that got the security changes,
in theory.  However, it is really only likely that this would cause a problem in
Asterisk trunk.  There was a control frame being sent (SRCUPDATE) at the _very_
beginning of the call, which does not exist in 1.2 or 1.4.  However, I am fixing
all versions that could potentially be affected by the introduced race condition.

These changes are what bbryant and I came up with to fix the issue.  Instead of
simply dropping control frames that get sent before the handshake is complete,
the code attempts to wait a little while, since in most cases, the handshake
will complete very quickly.  If it doesn't complete after yielding for a little
while, then the frame gets dropped.

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115566 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-08 19:17:04 +00:00
Russell Bryant 9c549e6cf5 Merged revisions 115512 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r115512 | russell | 2008-05-07 11:24:09 -0500 (Wed, 07 May 2008) | 11 lines

Merged revisions 115511 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r115511 | russell | 2008-05-07 11:22:49 -0500 (Wed, 07 May 2008) | 3 lines

Remove remnants of dlinkedlists.  I didn't actually use them in the final version
of my IAX2 improvements.

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115513 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-07 17:28:19 +00:00
Russell Bryant 27521f9e63 Remove my rant, since I have now replaced the rant with code.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115315 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-05 20:28:17 +00:00
Russell Bryant 59f170973e Merged revisions 114891 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114891 | russell | 2008-04-30 11:30:01 -0500 (Wed, 30 Apr 2008) | 28 lines

Merge changes from team/russell/iax2_find_callno and iax2_find_callno_1.4

These changes address a critical performance issue introduced in the latest
release.  The fix for the latest security issue included a change that made
Asterisk randomly choose call numbers to make them more difficult to guess by
attackers.  However, due to some inefficient (this is by far, an understatement)
code, when Asterisk chose high call numbers, chan_iax2 became unusable after
just a small number of calls.  On a small embedded platform, it would not be
able to handle a single call.  On my Intel Core 2 Duo @ 2.33 GHz, I couldn't
run more than about 16 IAX2 channels.  Ouch.

These changes address some performance issues of the find_callno() function
that have bothered me for a very long time.  On every incoming media frame,
it iterated through every possible call number trying to find a matching
active call.  This involved a mutex lock and unlock for each call number
checked.  So, if the random call number chosen was 20000, then every media
frame would cause 20000 locks and unlocks.  Previously, this problem was
not as obvious since Asterisk always chose the lowest call number it could.

A second container for IAX2 pvt structs has been added.  It is an astobj2
hash table.  When we know the remote side's call number, the pvt goes into
the hash table with a hash value of the remote side's call number.  Then,
lookups for incoming media frames are a very fast hash lookup instead of an
absolutely insane array traversal.

In a quick test, I was able to get more than 3600% more IAX2 channels
on my machine with these changes.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114892 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-30 16:34:24 +00:00
Kevin P. Fleming 63f5e27842 Merged revisions 114880 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114880 | kpfleming | 2008-04-30 09:46:57 -0500 (Wed, 30 Apr 2008) | 2 lines

use the ARRAY_LEN macro for indexing through the iaxs/iaxsl arrays so that the size of the arrays can be adjusted in one place, and change the size of the arrays from 32768 calls to 2048 calls when LOW_MEMORY is defined

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114884 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-30 14:49:51 +00:00
Russell Bryant 7be171455d Merged revisions 114673 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114673 | russell | 2008-04-25 16:54:40 -0500 (Fri, 25 Apr 2008) | 3 lines

Use consistent logic for checking to see if a call number has been chosen yet.
Also, remove some redundant logic I recently added in a fix.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114674 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-25 22:00:35 +00:00
Michiel van Baak 08e674bce0 Pass the hangup cause all the way to the calling app/channel.
(closes issue #11328)
Reported by: rain
Patches:
      20071207__pass_cause_in_hangup_control_frame.diff.txt uploaded by Corydon76 (license 14)
brought up-to-date to trunk by me


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-24 22:16:48 +00:00
Russell Bryant 8bb98b63d8 Merged revisions 114608 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114608 | russell | 2008-04-24 10:55:21 -0500 (Thu, 24 Apr 2008) | 4 lines

Fix a silly mistake in a change I made yesterday that caused chan_iax2 to blow
up very quickly.
(issue #12515)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114609 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-24 15:56:55 +00:00
Russell Bryant 0fa42f819a Merged revisions 114587 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114587 | russell | 2008-04-23 12:16:32 -0500 (Wed, 23 Apr 2008) | 2 lines

Fix find_callno_locked() to actually return the callno locked in some more cases.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 17:18:29 +00:00
Russell Bryant fe8b7f31db Merged revisions 114558 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114558 | russell | 2008-04-22 17:15:36 -0500 (Tue, 22 Apr 2008) | 5 lines

When we receive a full frame that is supposed to contain our call number,
ensure that it has the correct one.
(closes issue #10078)
(AST-2008-006)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114559 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-22 22:17:31 +00:00
Russell Bryant 580cb27eec Merged revisions 114537 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114537 | russell | 2008-04-22 13:03:33 -0500 (Tue, 22 Apr 2008) | 9 lines

If the dial string passed to the call channel callback does not indicate an
extension, then consider the extension on the channel before falling back
to the default.

(closes issue #12479)
Reported by: darren1713
Patches:
      exten_dial_fix_chan_iax2.c.patch uploaded by darren1713 (license 116)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-22 18:04:39 +00:00
Jeff Peeler 41fd7a6a21 (closes issue #6113)
Reported by: oej
Tested by: jpeeler

This patch implements multiple parking lots for parked calls. The default parkinglot is used by default, however setting the channel variable PARKINGLOT in the dialplan will allow use of any other configured parkinglot. See configs/features.conf.sample for more details on setting up another non-default parkinglot. Also, one can (currently) set the default parkinglot to use in the driver configuration file via the parkinglot option.

Patch initially written by oej, brought up to date and finalized by mvanbaak, and then stabilized and converted to astobj2 by me.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114487 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-21 23:42:45 +00:00
Terry Wilson 4bc75c9a55 Merged revisions 114083 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114083 | twilson | 2008-04-11 17:32:51 -0500 (Fri, 11 Apr 2008) | 7 lines

Several places in the code called find_callno() (which releases the lock on the pvt structure) and then immediately locked the call and did things with it. Unfortunately, the call can disappear between the find_callno and the lock, causing Bad Stuff(tm) to happen.

Added find_callno_locked() function to return the callno withtout unlocking for instances that it is needed.

(issue #12400)
Reported by: ztel

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114084 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-11 22:48:52 +00:00
Joshua Colp 230d9d1465 Merged revisions 113784 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r113784 | file | 2008-04-09 13:50:45 -0300 (Wed, 09 Apr 2008) | 4 lines

If we receive an AUTHREQ from the remote server and we are unable to reply (for example they have a secret configured, but we do not) then queue a hangup frame on the Asterisk channel. This will cause the channel to hangup and a HANGUP to be sent via IAX2 to the remote side which is the proper thing to do in this scenario.
(closes issue #12385)
Reported by: viraptor

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@113785 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-09 16:52:04 +00:00
Terry Wilson 3ee1602b6a Merged revisions 113596 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r113596 | twilson | 2008-04-08 20:34:25 -0500 (Tue, 08 Apr 2008) | 2 lines

Initialize fr->cacheable to make valgrind happy

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@113597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-09 01:36:58 +00:00
Russell Bryant 094fc2c616 Fix a typo that prevented configuration of non-dynamic peers.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@112351 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-01 22:25:45 +00:00
Jeff Peeler e9825d7c8a Existing DNS manager lookups extended to check for SRV records.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@112321 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-01 22:07:30 +00:00
Jeff Peeler a5cdd849e5 This adds DNS SRV record support to DNS manager. If there is a SRV record for a given domain, the hostname and port listed in the SRV record will be used. If no SRV record exists or a SRV lookup is not attempted, the DNS lookup on the specified domain will be performed as normal. Chan_sip has been modified to take advantage of the new SRV support.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@112207 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-01 17:53:08 +00:00
Joshua Colp febd162ed2 Merged revisions 110628 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r110628 | file | 2008-03-25 11:37:35 -0300 (Tue, 25 Mar 2008) | 4 lines

Add an option (transmit_silence) which transmits silence during both Record() and DTMF generation. The reason this is an option is that in order to transmit silence we have to setup a translation path. This may not be needed/wanted in all cases.
(closes issue #10058)
Reported by: tracinet

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111017 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-26 18:42:52 +00:00
Russell Bryant c087390452 Merged revisions 110614 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r110614 | russell | 2008-03-24 12:34:56 -0500 (Mon, 24 Mar 2008) | 2 lines

Turn a NOTICE into a DEBUG message.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@110615 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-24 17:36:04 +00:00
Russell Bryant 2860d9f83c Merged revisions 110336 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r110336 | russell | 2008-03-20 16:54:58 -0500 (Thu, 20 Mar 2008) | 14 lines

Merged revisions 110335 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r110335 | russell | 2008-03-20 16:53:27 -0500 (Thu, 20 Mar 2008) | 6 lines

Fix some very broken code that was introduced in 1.2.26 as a part of the security
fix.  The dnsmgr is not appropriate here.  The dnsmgr takes a pointer to an address
structure that a background thread continuously updates.  However, in these cases,
a stack variable was passed.  That means that the dnsmgr thread would be continuously
writing to bogus memory.

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@110337 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-20 21:55:50 +00:00
Terry Wilson b02bc230af Go through and fix a bunch of places where character strings were being interpreted as format strings. Most of these changes are solely to make compiling with -Wsecurity and -Wformat=2 happy, and were not
actual problems, per se.  I also added format attributes to any printf wrapper functions I found that didn't have them.  -Wsecurity and -Wmissing-format-attribute added to --enable-dev-mode.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-18 15:43:34 +00:00
Steve Murphy 377e51c4d4 (closes issue #6002)
Reported by: rizzo
Tested by: murf

Proposal of the changes to be made, and then an announcement of how they were accomplished:

http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html

and:

http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html

Here is a recap, file by file, of what I have done:

pbx/pbx_config.c
pbx/pbx_ael.c

All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.

We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.

pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and 
then call merge_contexts_and_delete, which will merge (now) existing contexts and 
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then 
destroy the old dialplan.



chan_sip.c
chan_iax.c
chan_skinny.c

All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.

chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.


apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c

All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.


include/asterisk/pbx.h

ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create()  interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.


include/asterisk/pval.h

ast_compile_ael2() interface changed to include the local hashtab table ptr.


main/features.c

For the sake of the parking context, we use ast_context_find_or_create().



main/pbx.c

I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.

refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.

Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.

Added some calls to ast_verb(3,...) for debug messages

Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.

find_or_create was upgraded to handle both local lists/tables as well as the globals.

context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables

ast_merge_contexts_and_delete() was heavily modified.

ast_add_extension2() was also upgraded to handle changes. 

the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.



res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile

Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps.  The main gotcha was I had to 
include lock.h and hashtab.h in several places.


As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.

How's this for verbose commit messages?




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
Russell Bryant 82b3a87fd7 Merged revisions 106237 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r106237 | russell | 2008-03-05 16:37:09 -0600 (Wed, 05 Mar 2008) | 3 lines

Fix a potential deadlock and a few different potential crashes.
(closes issue #12145, reported by thiagarcia, patched by me)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106238 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-05 22:40:58 +00:00
Joshua Colp 581c8c7bf2 Instead of outputting a verbose message every so often let's make it a debug message.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-25 19:02:33 +00:00
Olle Johansson 17c761c5ff - No space in manager event names, please
- Add new event to CHANGES


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103755 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-18 10:10:35 +00:00
Russell Bryant 958ed2b620 Merged revisions 103741 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r103741 | russell | 2008-02-15 17:31:39 -0600 (Fri, 15 Feb 2008) | 8 lines

Fix a crash in chan_iax2 due to a race condition

(closes issue #11780)
Reported by: guillecabeza
Patches: 
      bug_iax2_jb_1.4.patch uploaded by guillecabeza (license 380)
      bug_iax2_jb_trunk.patch uploaded by guillecabeza (license 380)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-15 23:32:18 +00:00
Jason Parker a38a5d9ab6 Add periodic jitter stats to CLI and manager.
(closes issue #8188)
Reported by: stevedavies
Patches:
      jblogging-trunk.patch uploaded by stevedavies
      jblogging-trunk_wmgrevent.patch uploaded by johann8384
      updated_jbloggin-trunk_mgrevent.patch uploaded by johann8384 (license 190)
      (with additional changes by me)
Tested by: stevedavies, johann8384


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103677 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-14 18:39:51 +00:00
Joshua Colp 9587f09103 Add support for allowing a native bridge to happen when the L option is enabled. The RTP bridging could already handle this, it just needed to be enabled in the main bridging code.
(issue #10647)
Reported by: samdell3


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-11 16:17:15 +00:00
Russell Bryant 1ec8cb41a8 Merge changes from team/mvanbaak/cli-command-audit
(closes issue #8925)

About a year ago, as Leif Madsen and Jim van Meggelen were going over the CLI
commands in Asterisk 1.4 for the next version of their book, they documented
a lot of inconsistencies.  This set of changes addresses all of these issues
and has been reviewed by Leif.

While this does introduce even more changes to the CLI command structure, it
makes everything consistent, which is the most important thing.

Thanks to all that helped with this one!


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103171 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-08 21:26:32 +00:00
Mark Michelson b7764b534a Merged revisions 103070 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r103070 | mmichelson | 2008-02-08 12:00:38 -0600 (Fri, 08 Feb 2008) | 6 lines

Yield the thread and return -1 if the ioctl fails for Zaptel timing device.

(closes issue #11891)
Reported by: tzafrir


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103071 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-08 18:02:48 +00:00
Joshua Colp 3d3852f125 Merged revisions 102968 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r102968 | file | 2008-02-08 11:08:20 -0400 (Fri, 08 Feb 2008) | 4 lines

Make sure the presence of dbsecret is factored into user scoring.
(closes issue #11952)
Reported by: bbhoss

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@102969 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-08 15:09:47 +00:00
Russell Bryant c2d9664f6f Merged revisions 101693 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r101693 | russell | 2008-01-31 18:32:49 -0600 (Thu, 31 Jan 2008) | 8 lines

Add some more sanity checking on IAX2 dial strings for the case that no peer
or hostname was provided, which is the one part of the dial string that is
absolutely required.  If it's not there, bail out.

(closes issue #11897)
Reported by sokhapkin
Patch by me

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@101694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-01 00:34:11 +00:00
Jason Parker 245661a158 Merged revisions 101482 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r101482 | qwell | 2008-01-31 13:52:49 -0600 (Thu, 31 Jan 2008) | 4 lines

Solaris compat fixes for struct in_addr funkiness.

Issue #11885, patch by snuffy.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@101483 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-31 19:54:46 +00:00
Tilghman Lesher 69ade72e3c With the switch to the ast_sched_replace* API in trunk, we lose the correction
that was just merged from 1.4, so this is a changeover to those APIs to use the
macro versions, so that we properly detect errors from ast_sched_del, instead
of simply ignoring the return values.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-27 23:14:48 +00:00
Tilghman Lesher ac699196f5 Merged revisions 100465 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100465 | tilghman | 2008-01-27 15:59:53 -0600 (Sun, 27 Jan 2008) | 11 lines

When deleting a task from the scheduler, ignoring the return value could
possibly cause memory to be accessed after it is freed, which causes all
sorts of random memory corruption.  Instead, if a deletion fails, wait a
bit and try again (noting that another thread could change our taskid
value).
(closes issue #11386)
 Reported by: flujan
 Patches: 
       20080124__bug11386.diff.txt uploaded by Corydon76 (license 14)
 Tested by: Corydon76, flujan, stuarth`

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-27 22:35:29 +00:00
Joshua Colp f44ef30a3e Remove dependency on res_features from some channel drivers. It is now part of the core and no longer exists as a module.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100112 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-24 15:54:32 +00:00
Russell Bryant 2a91da6613 Merged revisions 99004 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r99004 | russell | 2008-01-17 16:37:22 -0600 (Thu, 17 Jan 2008) | 10 lines

Have IAX2 optimize the codec translation path just like chan_sip does it.  If
the caller's codec is in our codec list, move it to the top to avoid transcoding.

(closes issue #10500)
Reported by: stevedavies
Patches:
      iax-prefer-current-codec.patch uploaded by stevedavies (license 184)
      iax-prefer-current-codec.1.4.patch uploaded by stevedavies (license 184)
Tested by: stevedavies, pj, sheldonh

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@99006 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-17 22:50:13 +00:00
Joshua Colp a6da07a515 Merged revisions 98966 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r98966 | file | 2008-01-16 13:50:10 -0400 (Wed, 16 Jan 2008) | 6 lines

Add missing NULLs at end of two ast_load_realtimes.
(closes issue #11769)
Reported by: tequ
Patches:
      chaniax.patch uploaded by dimas (license 88)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98967 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-16 17:51:52 +00:00
Russell Bryant 4fb04cb58a Merged revisions 98943 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r98943 | russell | 2008-01-15 17:26:52 -0600 (Tue, 15 Jan 2008) | 25 lines

Commit a fix for some memory access errors pointed out by the valgrind2.txt
output on issue #11698.

The issue here is that it is possible for an instance of a translator to get
destroyed while the frame allocated as a part of the translator is still being
processed.  Specifically, this is possible anywhere between a call to ast_read()
and ast_frame_free(), which is _a lot_ of places in the code.  The reason this
happens is that the channel might get masqueraded during this time.  During a
masquerade, existing translation paths get destroyed.

So, this patch fixes the issue in an API and ABI compatible way.  (This one is
 for you, paravoid!)

It changes an int in ast_frame to be used as flag bits.  The 1 bit is still used
to indicate that the frame contains timing information.  Also, a second flag has
been added to indicate that the frame came from a translator.  When a frame with
this flag gets released and has this flag, a function is called in translate.c to
let it know that this frame is doing being processed.  At this point, the flag gets
cleared.  Also, if the translator was requested to be destroyed while its internal
frame still had this flag set, its destruction has been deffered until it finds out
that the frame is no longer being processed.

Admittedly, this feels like a hack.  But, it does fix the issue, and I was not able 
to think of a better solution ...

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98944 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-15 23:31:53 +00:00
Tilghman Lesher 857e3412f4 Several manager changes:
1) Add the Dialplan class, for NewExten and VarSet events, which should cut
down on the volume of traffic in the Call class.
2) Permit some commands to be run from multiple classes, such as allowing
DBGet to be run from either the System or the Reporting class.
3) Heavily document each class in the sample config, as there were several
that made no sense to be in the write= line, and two that made no sense to be
in the read= line (since they controlled no permissions there).

(Closes issue #10386)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@97651 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-10 00:12:35 +00:00
Russell Bryant 4d6c570974 Merged revisions 96394 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r96394 | russell | 2008-01-03 16:44:22 -0600 (Thu, 03 Jan 2008) | 3 lines

Don't crash if the iax2 pvt structure has been destroyed before we get to this point
(closes issue #11672, reported by snuffy, patched by me)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96395 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-03 22:46:37 +00:00
Russell Bryant 21e057e79d Fix a bug in peer handling that caused multiple instances of a peer to end up
in the peers container after a reload.  Somehow, this bug doesn't exist in 1.4 ...
(closes issue #11626)
(reported by pnlarsson, additional info from mvanbaak, fixed by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@94788 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-26 16:51:16 +00:00
Russell Bryant 3de7bc9ae3 Merged revisions 94256 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r94256 | russell | 2007-12-20 14:22:22 -0600 (Thu, 20 Dec 2007) | 13 lines

Merged revisions 94255 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r94255 | russell | 2007-12-20 14:21:41 -0600 (Thu, 20 Dec 2007) | 5 lines

Fix another potential seg fault ...

(closes issue #11606)
Reported by: dimas

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@94257 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-20 20:25:05 +00:00
Tilghman Lesher c019f13746 Merged revisions 93949 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r93949 | tilghman | 2007-12-19 11:04:13 -0600 (Wed, 19 Dec 2007) | 3 lines

Avoid segfault in chan_iax when peer isn't defined
(Closes issue #11602)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93952 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-19 17:13:06 +00:00
Tilghman Lesher df9dbc3951 Merged revisions 93668 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r93668 | tilghman | 2007-12-18 12:29:39 -0600 (Tue, 18 Dec 2007) | 10 lines

Merged revisions 93667 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r93667 | tilghman | 2007-12-18 12:23:06 -0600 (Tue, 18 Dec 2007) | 2 lines

Fixing AST-2007-027 (Closes issue #11119)

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-18 18:39:25 +00:00
Luigi Rizzo fd88390af7 remove unnecessary (char *) casts for ast_config_AST_* variables.
There are some left in the .flex files, left to the maintainer...



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-18 09:46:18 +00:00
Olle Johansson f3471c1652 Merged revisions 93182 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r93182 | oej | 2007-12-17 08:15:13 +0100 (MÃ¥n, 17 Dec 2007) | 8 lines

Issue 11574: Add dependencies on res_monitor and res_features. 

I wonder if Asterisk can run at all without res_features. My guess is that 
there's propably a lot of more modules and the core that depends on it.

Reported by: caio1982
(closes issue #11574)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-17 21:12:24 +00:00
Olle Johansson 17afebc1a6 HUGE improvements to QoS/CoS handling by IgorG
- Refer to the proper documentation
- Implement separate signalling/media QoS/CoS in many channels using RTP
- Improve warnings and verbose messages
- Deprecate some old settings

Minor modifications by me, a big effort from IgorG.
Thanks!


Reported by: IgorG
Patches: 
      qoscleanup-89394-4-trunk.patch uploaded by IgorG (license 20)
Tested by: IgorG
(closes issue #11145)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93163 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-16 10:51:53 +00:00
Russell Bryant 44fc07ee63 Revert an "optimization" that I added in revision 89887, as the user who reported
issue #11449 has demonstrated that it actually was a performance hit on his
machine.  I think that it is possible that it could still be a benefit on systems
under higher load, especially SMP systems, but I don't have enough time or interest
to find out at the moment.
(closes issue #11449)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@92676 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-12 23:44:26 +00:00
Russell Bryant fac7480820 Merged revisions 90348 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r90348 | russell | 2007-11-30 13:26:04 -0600 (Fri, 30 Nov 2007) | 8 lines

Change the behavior of ao2_link().  Previously, in inherited a reference.
Now, it automatically increases the reference count to reflect the reference
that is now held by the container.

This was done to be more consistent with ao2_unlink(), which automatically
releases the reference held by the container.  It also makes it so it is
no longer possible for a pointer to be invalid after ao2_link() returns.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90351 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-30 19:34:47 +00:00
Russell Bryant 753f7086cd Merge changes from team/russell/iax2_frame_queue
This patch is an optimization for chan_iax2.  This module is now heavily
multi-threaded.  However, there is still a good number of globally shared
resources that prevent things from happen asynchronously.  One of those things
was the global IAX frame queue.  This queue was used to hold frames that have
been deferred for transmitting by another thread, and frames that may need to
get retransmitted.

I changed the frame queue to be per-call, since almost all of the frame queue
handling only cares about frames specific to a call number.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-27 23:50:25 +00:00
Olle Johansson 28257e4005 More additions from the "moremanager" branch, this time for IAX2.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-27 20:36:59 +00:00
Steve Murphy 86476c607f closes issue #11285, where an unload of a module that creates a dialplan context, causes a crash when you do a 'dialplan show' of that context. This is because the registrar string is defined in the module, and the stale pointer is traversed. The reporter offered a patch that would always strdup the registrar string, which is practical, but I preferred to destroy the created contexts in each module where one is created. That seemed more symmetric. There were only 6 place in asterisk where this is done: chan_sip, chan_iax2, chan_skinny, res_features, app_dial, and app_queue. The two apps destroyed the context, but left the contexts. All is fixed now and unloads should be dialplan friendly.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89513 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 23:54:12 +00:00
Luigi Rizzo 7e8835e0d7 remove another set of redundant #include "asterisk/options.h"
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89512 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 23:24:55 +00:00
Russell Bryant 192252ec58 fix a small gramatical error in a comment
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 18:24:23 +00:00
Luigi Rizzo a23c055c3d move asterisk/paths.h outside asterisk.h and into those files
who really need it.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89466 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-20 23:16:15 +00:00
Luigi Rizzo 0595b5e2aa include "logger.h" and errno.h from asterisk.h - usage shows that they
were included almost everywhere.
Remove some of the instances.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89424 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-19 18:52:04 +00:00
Luigi Rizzo fdb7f7ba3d Start untangling header inclusion in a way that does not affect
build times - tested, there is no measureable difference before and
after this commit.

In this change:

use asterisk/compat.h to include a small set of system headers:
inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h,
stdlib.h, alloca.h, stdio.h

Where available, the inclusion is conditional on HAVE_FOO_H as determined
by autoconf.

Normally, source files should not include any of the above system headers,
and instead use either "asterisk.h" or "asterisk/compat.h" which does it
better. 

For the time being I have left alone second-level directories
(main/db1-ast, etc.).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16 20:04:58 +00:00
Tilghman Lesher fc74a46ee2 Merged revisions 89298 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89298 | tilghman | 2007-11-15 12:05:56 -0600 (Thu, 15 Nov 2007) | 5 lines

Yet another memory corruption issue.
Reported by: atis
Patch by: tilghman
Fixes issue #10923

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-15 18:11:36 +00:00
Luigi Rizzo 7f8ecd2cd3 make the 'name' and 'value' fields in ast_variable const char *
This prevents modifying the strings in the stored variables, 
and catched a few instances where this was actually done.

Given the differences between trunk and 1.4 (and the fact that this
is effectively an API change) it is better to fix 1.4 independently.
These are

chan_sip.c::sip_register()
chan_skinny.c:: near line 2847
config.c:: near line 1774
logger.c::make_components()
res_adsi.c:: near line 1049

I may have missed some instances for modules that do not build here.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-14 13:18:40 +00:00
Kevin P. Fleming edc78d6023 improve linked-list macros in two ways:
- the *_CURRENT macros no longer need the list head pointer argument
  - add AST_LIST_MOVE_CURRENT to encapsulate the remove/add operation when moving entries between lists


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89106 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-08 05:28:47 +00:00
Luigi Rizzo 08b10da53b Simplify the implementation and the API for stringfields;
details and examples are in include/asterisk/stringfields.h.

Not applicable to older branches except for 1.4 which will
receive a fix for the routines that free memory pools.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-04 19:44:31 +00:00
Tilghman Lesher 97fe45ab93 Janitor: use ast_free to pair calls of ast_malloc and ast_calloc
Reported by: eliel
Patch by: eliel
Closes issue #11135


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88008 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-01 06:07:18 +00:00
Russell Bryant 3978cb6f1c Merged revisions 87686 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r87686 | russell | 2007-10-30 16:19:09 -0500 (Tue, 30 Oct 2007) | 11 lines

Merge the changes from team/russell/iax2_poke_fix and iax2-poke-fix-trunk

There was a race condition related to the handling of POKEing peers.  Essentially, 
a reference to a peer is held by the scheduler when there are pending callbacks, 
but the reference count didn't reflect it.  So, it was possible for a peer to hit
a reference count of zero and have its destructor begin to be called at the same
time that the scheduler thread ran a POKE related callback.  If that happened,
a crash would likely occur.

(closes issue #11082, closes issue #11094)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87687 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-30 21:22:48 +00:00
Jason Parker ebe4050128 Switch from AST_CLI (formerly NEW_CLI) to AST_CLI_DEFINE, since the former didn't make much sense
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-22 20:05:18 +00:00
Jason Parker b0f3e6097e Convert NEW_CLI to AST_CLI.
Closes issue #11039, as suggested by seanbright.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-19 18:29:40 +00:00
Jason Parker 65761cbd7a More changes to NEW_CLI.
Also fixes a few cli messages and some minor formatting.

(closes issue #11001)
Reported by: seanbright
Patches:
      newcli.1.patch uploaded by seanbright (license 71)
      newcli.2.patch uploaded by seanbright (license 71)
      newcli.4.patch uploaded by seanbright (license 71)
      newcli.5.patch uploaded by seanbright (license 71)
      newcli.6.patch uploaded by seanbright (license 71)
      newcli.7.patch uploaded by seanbright (license 71)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86534 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-19 18:01:00 +00:00
Jason Parker ed690fc348 Switch dundi to new tos config format.
Remove old unused defines for old style.

Closes issue 10860, patch by IgorG.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-15 23:20:40 +00:00
Russell Bryant d78463be1e Corydon posted this janitor project to the bug tracker and mvanbaak provided
a patch for it.  It replaces a bunch of simple calls to snprintf with ast_copy_string

(closes issue #10843)
Reported by: Corydon76
Patches: 
      2007092900_10843.diff uploaded by mvanbaak (license 7)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@84173 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-01 15:23:19 +00:00
Russell Bryant 9f64905d4e Merged revisions 83432 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r83432 | russell | 2007-09-21 09:37:20 -0500 (Fri, 21 Sep 2007) | 4 lines

gcc 4.2 has a new set of warnings dealing with cosnt pointers.  This set of
changes gets all of Asterisk (minus chan_alsa for now) to compile with gcc 4.2.
(closes issue #10774, patch from qwell)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@83433 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-21 14:40:10 +00:00
Russell Bryant 86e640bf77 Merged revisions 83175 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r83175 | russell | 2007-09-19 14:13:29 -0500 (Wed, 19 Sep 2007) | 8 lines

When handling a reload of chan_iax2, don't use an ao2_callback() to POKE all
peers.  Instead, use an iterator.  By using an iterator, the peers container
is not locked while the POKE is being done.  It can cause a deadlock if the
peers container is locked because poking a peer will try to lock pvt structs,
while there is a lot of other code that will hold a pvt lock when trying to
go lock the peers container.
(reported to me directly by Loic Didelot.  Thank you for the debug info!)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@83176 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-19 19:14:58 +00:00
Russell Bryant ded76a8988 convert various places that access the channel lock directly to use the channel lock wrappers
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82728 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-17 22:59:36 +00:00
Russell Bryant 9388173f85 Make the MALLOC_DEBUG output for free() useful again. After changing calls to
free to be ast_free, astmm said all calls to free were coming from utils.h


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82628 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-17 18:57:56 +00:00
Jason Parker 6a90ea5cf4 After some discussions, we decided that the return values here were a bit messy.
This also fixes a bug on reload, where peers may not have reregistered properly.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-12 21:55:32 +00:00
Tilghman Lesher c121ed6bec Change the IAXPeers command to have manager-style output, instead of CLI-style output (closes issue #8254)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-10 20:03:51 +00:00
Russell Bryant 9bda1c5a94 Merged revisions 81448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81448 | russell | 2007-09-04 13:37:44 -0500 (Tue, 04 Sep 2007) | 4 lines

Remove the typedefs on ao2_container and ao2_iterator.  This is simply because
we don't typedef objects anywhere else in Asterisk, so we might as well make
this follow the same convention.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-04 18:40:07 +00:00
Joshua Colp 3213f6dc2d Merged revisions 81439 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81439 | file | 2007-09-04 11:23:18 -0300 (Tue, 04 Sep 2007) | 6 lines

(closes issue #10632)
Reported by: jamesgolovich
Patches:
      asterisk-iaxfirmwareleak.diff.txt uploaded by jamesgolovich (license 176)
Fix memory leak when unloading chan_iax2. The firmware files were not being freed.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81440 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-04 14:25:21 +00:00
Russell Bryant 51af103a79 Merged revisions 81433 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81433 | russell | 2007-09-03 13:57:53 -0500 (Mon, 03 Sep 2007) | 5 lines

Remove a couple of calls to ast_string_field_free_pools() on peers in error
handling blocks in the code for building peers.  The peer object destructor
does this and doing it twice will cause a crash.
(closes issue #10625, reported by and patched by pnlarsson)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81434 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-03 18:59:08 +00:00
Steve Murphy b5cd67adc3 This code was in team/murf/bug8684-trunk; it should fix bug 8684 in trunk. I didn't add it to 1.4 yet, because it's not entirely clear to me if this is a bug fix or an enhancement. A lot of files were affected by small changes like ast_variable_new getting an added arg, for the file name the var was defined in; ast_category_new gets added args of filename and lineno; ast_category and ast_variable structures now record file and lineno for each entry; a list of all #include and #execs in a config file (or any of its inclusions are now kept in the ast_config struct; at save time, each entry is put back into its proper file of origin, in order. #include and #exec directives are folded in properly. Headers indicating that the file was generated, are generated also for each included file. Some changes to main/manager.c to take care of file renaming, via the UpdateConfig command. Multiple inclusions of the same file are handled by exploding these into multiple include files, uniquely named. There's probably more, but I can't remember it right now.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-29 20:55:40 +00:00
Tilghman Lesher 6bdc66e9b0 Changed one too many variable settings in issue #9315 (closes issue #10592)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-29 15:21:10 +00:00
Russell Bryant 225d9166ec Merged revisions 81291 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81291 | russell | 2007-08-28 16:38:26 -0500 (Tue, 28 Aug 2007) | 3 lines

Change the message about receiving a mini-frame before the first full voice
frame to a DEBUG message.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-28 21:39:36 +00:00
Russell Bryant d3687bdb93 Merged revisions 80932 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80932 | russell | 2007-08-26 13:11:26 -0500 (Sun, 26 Aug 2007) | 3 lines

Remove an extra signal_condition() for the scheduler thread.
(closes issue #10564, patch from casper)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80933 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-26 18:12:58 +00:00
Russell Bryant 7c41c3a5bc Merged revisions 80895 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80895 | russell | 2007-08-25 12:37:39 -0500 (Sat, 25 Aug 2007) | 7 lines

Fix some issues with the handling of the scheduler in chan_iax2.  Most of the
places that scheduled items to be executed by the scheduler thread did not
signal the scheduler thread to wake up so that it could recalculate the time
until the next action.  These changes will make the scheduler thread more
responsive and ensure that actions get executed as close to when intended as
possible instead of it being possible for very long delays.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80898 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-25 17:55:45 +00:00
Russell Bryant 700b5d8442 Merged revisions 80849 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80849 | russell | 2007-08-24 16:22:50 -0500 (Fri, 24 Aug 2007) | 5 lines

If dnsmgr is in use, and no DNS servers are available when Asterisk first
starts, then don't give up on poking peers.  Allow the poke to get rescheduled
so that it will work once the dnsmgr is able to resolve the host.
(closes issue #10521, patch by jamesgolovich)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80850 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-24 21:23:14 +00:00
Russell Bryant 488cd9a7a6 Merged revisions 80499 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80499 | russell | 2007-08-23 12:02:50 -0500 (Thu, 23 Aug 2007) | 3 lines

Fix some code where it was possible for a reference to a peer to not get
released when it should.  Thank you to Marta Carbone for pointing this out!

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-23 17:04:04 +00:00
Russell Bryant f6f9c14723 allow peers and users to go into a hash table
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-22 21:35:08 +00:00
Russell Bryant f04ed4641b Unsubscribe from MWI events in the peer destructor
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80388 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-22 20:46:16 +00:00
Russell Bryant 50d7fc81aa Merged revisions 80362 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80362 | russell | 2007-08-22 15:21:36 -0500 (Wed, 22 Aug 2007) | 34 lines

Merge changes from team/russell/iax_refcount.

This set of changes fixes problems with the handling of iax2_user and iax2_peer
objects.  It was very possible for a thread to still hold a reference to one of
these objects while a reload operation tries to delete them.  The fix here is to
ensure that all references to these objects are tracked so that they can't go away
while still in use.

To accomplish this, I used the astobj2 reference counted object model.  This
code has been in one of Luigi Rizzo's branches for a long time and was primarily
developed by one of his students, Marta Carbone.  I wanted to go ahead and bring
this in to 1.4 because there are other problems similar to the ones fixed by these
changes, so we might as well go ahead and use the new astobj if we're going to go
through all of the work necessary to fix the problems.

As a nice side benefit of these changes, peer and user handling got more efficient.
Using astobj2 lets us not hold the container lock for peers or users nearly as long
while iterating.  Also, by changing a define at the top of chan_iax2.c, the objects
will be distributed in a hash table, drastically increasing lookup speed in these
containers, which will have a very big impact on systems that have a large number of
users or peers.

The use of the hash table will be made the default in trunk.  It is not the default
in 1.4 because it changes the behavior slightly.  Previously, since peers and users
were stored in memory in the same order they were specified in the configuration file,
you could influence peer and user matching order based on the order they are specified
in the configuration.  The hash table does not guarantee any order in the container,
so this behavior will be going away.  It just means that you have to be a little
more careful ensuring that peers and users are matched explicitly and not forcing
chan_iax2 to have to guess which user is the right one based on secret, host, and
access list settings, instead of simply using the username.

If you have any questions, feel free to ask on the asterisk-dev list.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-22 20:44:23 +00:00
Joshua Colp 477e7dcbc7 (closes issue #10495)
Reported by: stevedavies
Make sure context pointer is valid or else chan_iax2 will go kaboom.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-20 00:54:19 +00:00
Tilghman Lesher 749b67bd1d We weren't properly encapsulating the mtime ignores of config files (closes issue #10488)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79940 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-18 13:52:44 +00:00
Russell Bryant c67f7fd3da Make use of ast_sched_replace() in some places in chan_iax2
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79862 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-17 14:14:59 +00:00
Russell Bryant 0b44b92cf5 Merged revisions 79756 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79756 | russell | 2007-08-16 16:29:24 -0500 (Thu, 16 Aug 2007) | 11 lines

Fix more deadlocks in chan_iax2 that were introduced by making frame handling
and scheduling multi-threaded.  Unfortunately, we have to do some expensive
deadlock avoidance when queueing frames on to the ast_channel owner of the IAX2
pvt struct.  This was already handled for regular frames, but ast_queue_hangup
and ast_queue_control were still used directly.  Making these changes introduced
even more places where the IAX2 pvt struct can disappear in the context of a
function holding its lock due to calling a function that has to unlock/lock it
to avoid deadlocks.  I went through and fixed all of these places to account for
this possibility.
(issue #10362, patch by me)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-16 21:33:38 +00:00
Tilghman Lesher 56b9568164 Don't reload a configuration file if nothing has changed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-16 21:09:46 +00:00
Dwayne M. Hubbard 6186647ac3 added counter for iax2 show registry CLI output, closes issue 10461, thanks junky
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79725 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-16 18:23:39 +00:00
Russell Bryant 4b584bbdf7 Merged revisions 79470 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79470 | russell | 2007-08-14 13:49:10 -0500 (Tue, 14 Aug 2007) | 2 lines

Fix another spot where an iax2_peer would be leaked if realtime was in use.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79471 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-14 18:50:12 +00:00
Russell Bryant 4e038cdc7c Merged revisions 79436 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79436 | russell | 2007-08-14 12:31:39 -0500 (Tue, 14 Aug 2007) | 3 lines

Fix some memory leaks throughout chan_iax2 related to the use of realtime.
I found these while working on iax2_peer object reference tracking.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79437 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-14 17:33:12 +00:00
Russell Bryant e05da8e948 Merged revisions 79301 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79301 | russell | 2007-08-13 15:37:50 -0500 (Mon, 13 Aug 2007) | 3 lines

Don't call find_peer in registry_authrequest with the pvt lock held to avoid a
deadlock.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79306 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-13 20:40:47 +00:00
Russell Bryant 16373a4e5f Merged revisions 79276 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79276 | russell | 2007-08-13 15:18:30 -0500 (Mon, 13 Aug 2007) | 4 lines

Release the pvt lock before calling find_peer in register_verify to avoid a
deadlock.  Also, remove some unnecessary locking in auth_fail that was only done
recursively.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79277 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-13 20:20:43 +00:00
Russell Bryant 982a3ac424 Merged revisions 79274 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79274 | russell | 2007-08-13 15:02:57 -0500 (Mon, 13 Aug 2007) | 3 lines

Don't call find_peer within update_registry with a pvt lock held.  This can
cause a deadlock as the code will eventually call find_callno.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79275 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-13 20:06:19 +00:00
Russell Bryant 0dd52f7196 Merged revisions 79272 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79272 | russell | 2007-08-13 14:27:39 -0500 (Mon, 13 Aug 2007) | 9 lines

I am fighting deadlocks in chan_iax2.  I have tracked them down to a single
core issue.  You can not call find_callno() while holding a pvt lock as this
function has to lock another (every) other pvt lock.  Doing so can lead to a
classic deadlock.  So, I am tracking down all of the code paths where this
can happen and fixing them.

The fix I committed earlier today was along the same theme.  This patch fixes
some code down the path of authenticate_reply.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-13 19:29:30 +00:00
Russell Bryant a2847deb73 Merged revisions 79214 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79214 | russell | 2007-08-13 10:28:13 -0500 (Mon, 13 Aug 2007) | 4 lines

Fix a potential deadlock in socket_process.  check_provisioning can eventually
call find_callno.  You can't hold a pvt lock while calling find_callno because
it goes through and locks every single one looking for a match.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79222 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-13 15:32:05 +00:00
Joshua Colp d5eda8709c Merged revisions 79174 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79174 | file | 2007-08-13 11:18:04 -0300 (Mon, 13 Aug 2007) | 4 lines

(closes issue #10437)
Reported by: haklin
Don't set the callerid name and number a second time on a newly created channel. ast_channel_alloc itself already sets it and setting it twice would cause a memory leak.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-13 14:22:46 +00:00
Russell Bryant 9d1acad76b Fix a problem that I had introduced into MWI handling. I had ignored
the mailbox context.  Now, all related MWI event dealings pay attention
to the context as well.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-09 17:07:36 +00:00
Joshua Colp f2fc44d07e Correct spelling. s/threaads/threads/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-08 19:03:46 +00:00
Russell Bryant d9407da71d Merged revisions 78242 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r78242 | russell | 2007-08-06 15:44:09 -0500 (Mon, 06 Aug 2007) | 4 lines

Fix an issue where dynamic threads can get free'd, but still exist in the 
dynamic thread list.
(closes issue #10392, patch from Mihai, with credit to his colleague, Pete)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78243 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-06 20:45:09 +00:00
Russell Bryant 661fa0b374 Merged revisions 78063 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r78063 | russell | 2007-08-03 12:01:07 -0500 (Fri, 03 Aug 2007) | 4 lines

Only pass through HOLD and UNHOLD control frames when the mohinterpret option
is set to "passthrough".  This was pointed out by Kevin in the middle of a
training session.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78064 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-03 17:02:00 +00:00
Russell Bryant bcabfbb89a Merged revisions 78028 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r78028 | russell | 2007-08-02 21:04:22 -0500 (Thu, 02 Aug 2007) | 6 lines

Don't reuse the timespec that was set to 0 in the previous timedwait as it
will just return immediately.  Also, fix some logic so the thread's lock
isn't unlocked twice in the weird case of dynamic threads getting acquired
right after a timeout.
(pointed out by SteveK)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-03 02:05:02 +00:00
Russell Bryant 7b3dcbb842 Merged revisions 77949 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77949 | russell | 2007-08-02 14:25:14 -0500 (Thu, 02 Aug 2007) | 5 lines

Fix the case where a dynamic thread times out waiting for something to do
during the first time it runs.  This shouldn't ever happen, but we should
account for it anyway.
(pointed out by pete, who works with mihai)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-02 19:26:12 +00:00
Russell Bryant 85ba8d515a Merged revisions 77943 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77943 | russell | 2007-08-02 13:04:43 -0500 (Thu, 02 Aug 2007) | 9 lines

Fix another race condition in the handling of dynamic threads.  If the dynamic
thread timed out waiting for something to do, but was acquired to perform an
action immediately afterwords, then wait on the condition again to give the
other thread a chance to finish setting up the data for what action this thread
should perform.  Otherwise, if it immediately continues, it will perform the
wrong action.
(reported on IRC by mihai, patch by me)
(related to issue #10289)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77944 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-02 18:05:23 +00:00
Russell Bryant 12ed8e8d07 Fix an issue that Simon pointed out to me on IRC. There were cases in the
trunk version of find_idle_thread() where the old full frame processing
information was not cleared out.  This would have caused full frames to get
deferred for processing by threads that weren't actually processing frames for
that call.  Nice catch!!


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77941 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-02 17:09:42 +00:00
Russell Bryant 171791dd8b Merged revisions 77939 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77939 | russell | 2007-08-02 11:56:04 -0500 (Thu, 02 Aug 2007) | 4 lines

Add another sanity check to vnak_retransmit().  This check ensures that frames
that have already been marked for deletion don't get retransmitted.
(closes issue #10361, patch from mihai)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77940 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-02 16:58:26 +00:00
Russell Bryant 1990a00ca4 Merged revisions 77887 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77887 | russell | 2007-08-01 17:16:17 -0500 (Wed, 01 Aug 2007) | 23 lines

Fix some race conditions which have been causing weird problems in chan_iax2.
The most notable problem is that people have been seeing storms of VNAK frames
being sent due to really old frames mysteriously being in the retransmission
queue and never getting removed.

It was possible that a dynamic thread got created, but did not acquire its lock
before the thread that created it signals it to perform an action.  When this
happens, the thread will sleep until it hits a timeout, and then get destroyed.
So, the action never gets performed and in some cases, means a frame doesn't
get transmitted and never gets freed since the scheduler never gets a chance
to reschedule transmission.

Another less severe race condition is in the handling of a timeout for a dynamic
thread.  It was possible for it to be acquired to perform at action at the same
time that it hit a timeout.  When this occurs, whatever action it was acquired
for would never get performed.

(patch contributed by Mihai and SteveK)
(closes issue #10289)
(closes issue #10248)
(closes issue #10232)
(possibly related to issue #10359)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77889 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-01 22:24:23 +00:00
Joshua Colp d9aee5e353 Merged revisions 77869 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77869 | file | 2007-08-01 14:56:59 -0300 (Wed, 01 Aug 2007) | 2 lines

Add some fixes for building on Solaris.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-01 18:01:33 +00:00
Russell Bryant 3ca4126887 Change another unnecessary use of the increment operator to explicitly set the var to 1
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77800 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-30 20:36:18 +00:00
Russell Bryant 3b49339387 Explicitly set a variable to 1 instead of using the increment operator.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77799 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-30 20:33:44 +00:00
Russell Bryant a27203a5bc Merged revisions 77794 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77794 | russell | 2007-07-30 15:16:43 -0500 (Mon, 30 Jul 2007) | 8 lines

Fix an issue that could potentially cause corruption of the global iax frame
queue.  In the network_thread() loop, it traverses the list using the
AST_LIST_TRAVERSE_SAFE macro.  However, to remove an element of the list within
this loop, it used AST_LIST_REMOVE, instead of AST_LIST_REMOVE_CURRENT, which I
believe could leave some of the internal variables of the SAFE macro invalid.
Mihai says that he already made this change in his local copy and it didn't help
his VNAK storm issues, but I still think it's wrong.  :)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77797 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-30 20:21:05 +00:00
Russell Bryant f8483a0d04 Do a massive conversion for using the ast_verb() macro
(closes issue #10277, patches by mvanbaak)

Basically, this changes ...

if (option_verbose > 2)
   ast_verbose(VERBOSE_PREFIX_3, "Something\n");

to ...

ast_verb(3, "Something\n");


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-26 15:49:18 +00:00
Luigi Rizzo 546c742106 silence a warning in ast-devmode on a potentially uninitialized var.
At first sight (but the function is very large so i am not 100% sure)
the code seems correct, so maybe my compiler is just not smart
enough to figure that out at the optimization level it has.

Not worthwhile merging to 1.4 i believe.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77156 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-25 21:58:13 +00:00
Tilghman Lesher 1c17bc177d Merged revisions 76803 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r76803 | qwell | 2007-07-24 11:32:20 -0500 (Tue, 24 Jul 2007) | 3 lines

Don't create the Asterisk channel until we are starting the PBX on it.
(ASA-2007-018)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-24 17:05:10 +00:00
Russell Bryant 3c10aab644 Merged revisions 76485 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r76485 | russell | 2007-07-23 07:25:01 -0500 (Mon, 23 Jul 2007) | 6 lines

Use a signed integer for storing the number of bytes in the packet read from
the network.  Using an unsigned value here made it impossible to handle an
error returned from recvfrom().  Furthermore, in the case that recvfrom()
did return an error, this would cause a crash due to a heap overflow.
(closes issue #10265, reported by and fix suggested by timrobbins)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76486 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-23 12:29:46 +00:00
Steve Murphy 0e969271ae After some study, thought, comparing, etc. I've backed out the previous universal mod to make ast_flags a 64 bit thing. Instead, I added a 64-bit version of ast_flags (ast_flags64), and 64-bit versions of the test-flag, set-flag, etc. macros, and an app_parse_options64 routine, and I use these in app_dial alone, to eliminate the 30-option limit it had grown to meet. There is room now for 32 more options and flags. I was heavily tempted to implement some of the other ideas that were presented, but this solution does not intro any new versions of dial, doesn't have a different API, has a minimal/zero impact on code outside of dial, and doesn't seriously (I hope) affect the code structure of dial. It's the best I can think of right now. My goal was NOT to rewrite dial. I leave that to a future, coordinated effort.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-19 23:24:27 +00:00
Russell Bryant 7b09e738f0 Merged revisions 75928 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r75928 | russell | 2007-07-19 10:53:15 -0500 (Thu, 19 Jul 2007) | 14 lines

Merged revisions 75927 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r75927 | russell | 2007-07-19 10:49:42 -0500 (Thu, 19 Jul 2007) | 6 lines

When processing full frames, take sequence number wraparound into account when
deciding whether or not we need to request retransmissions by sending a VNAK.
This code could cause VNAKs to be sent erroneously in some cases, and to not
be sent in other cases when it should have been.
(closes issue #10237, reported and patched by mihai)

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75929 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-19 15:53:50 +00:00
Russell Bryant 5272289355 I thought I noticed a memory leak earlier when I saw that the contents of this
list were not destroyed when the module is unloaded.  However, after reading
the code related to the use of this list a lot today, I realized that it isn't
necessary.  So, I have added a comment to explain why it isn't necessary.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75806 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-18 22:52:54 +00:00
Tilghman Lesher 9c99cba373 Change IAX variables to use datastores (closes issue #9315)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75805 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-18 22:40:03 +00:00
Russell Bryant 4681316959 Merged revisions 75759 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r75759 | russell | 2007-07-18 16:09:46 -0500 (Wed, 18 Jul 2007) | 13 lines

Merged revisions 75757 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r75757 | russell | 2007-07-18 16:09:13 -0500 (Wed, 18 Jul 2007) | 5 lines

When traversing the queue of frames for possible retransmission after
receiving a VNAK, handle sequence number wraparound so that all frames that 
should be retransmitted actually do get retransmitted.
(issue #10227, reported and patched by mihai)

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75761 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-18 21:10:27 +00:00
Russell Bryant 707ca59923 convert some lines indented with spaces to tabs
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75709 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-18 19:50:21 +00:00
Tilghman Lesher 81bc1d7af5 Merge in ast_strftime branch, which changes timestamps to be accurate to the microsecond, instead of only to the second
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-18 19:47:20 +00:00
Russell Bryant b5ff588044 Merged revisions 75445 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r75445 | russell | 2007-07-17 15:48:21 -0500 (Tue, 17 Jul 2007) | 13 lines

Merged revisions 75444 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r75444 | russell | 2007-07-17 15:45:27 -0500 (Tue, 17 Jul 2007) | 5 lines

Ensure that when encoding the contents of an ast_frame into an iax_frame, that
the size of the destination buffer is known in the iax_frame so that code
won't write past the end of the allocated buffer when sending outgoing frames.
(ASA-2007-014)

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75446 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-17 20:49:09 +00:00
Russell Bryant 681e45f0b2 Merged revisions 75441 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r75441 | russell | 2007-07-17 15:42:12 -0500 (Tue, 17 Jul 2007) | 12 lines

Merged revisions 75440 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r75440 | russell | 2007-07-17 15:41:41 -0500 (Tue, 17 Jul 2007) | 4 lines

After parsing information elements in IAX frames, set the data length to zero,
so that code later on does not think it has data to copy.
(ASA-2007-015)

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75442 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-17 20:42:50 +00:00
Steve Murphy 8a7732f067 via 10206, I have added an option (e) to Dial to allow the h exten to get run on peer. Had to upgrade ast_flag stuff to 64 bits to do this.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-17 19:40:29 +00:00
Russell Bryant 08b1a342e5 Merged revisions 74767 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r74767 | russell | 2007-07-11 17:57:07 -0500 (Wed, 11 Jul 2007) | 13 lines

Merged revisions 74766 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r74766 | russell | 2007-07-11 17:53:26 -0500 (Wed, 11 Jul 2007) | 5 lines

The function make_trunk() can fail and return -1 instead of a valid new call
number.  Fix the uses of this function to handle this instead of treating it
as the new call number.  This would cause a deadlock and memory corruption.
(possible cause of issue #9614 and others, patch by me)

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@74769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-11 23:05:34 +00:00