Commit Graph

925 Commits

Author SHA1 Message Date
Kevin P. Fleming 1c9fe00920 Recorded merge of revisions 222152 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r222152 | kpfleming | 2009-10-05 20:16:36 -0500 (Mon, 05 Oct 2009) | 20 lines
  
  Fix ao2_iterator API to hold references to containers being iterated.
  
  See Mantis issue for details of what prompted this change.
  
  Additional notes:
  
  This patch changes the ao2_iterator API in two ways: F_AO2I_DONTLOCK
  has become an enum instead of a macro, with a name that fits our
  naming policy; also, it is now necessary to call
  ao2_iterator_destroy() on any iterator that has been
  created. Currently this only releases the reference to the container
  being iterated, but in the future this could also release other
  resources used by the iterator, if the iterator implementation changes
  to use additional resources.
  
  (closes issue #15987)
  Reported by: kpfleming
  
  Review: https://reviewboard.asterisk.org/r/383/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@222176 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-06 01:24:24 +00:00
David Vossel 3cce68d329 Merged revisions 222026 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r222026 | dvossel | 2009-10-02 12:32:13 -0500 (Fri, 02 Oct 2009) | 3 lines
  
  Removes unnecessary unlock, clarifies a memcpy.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@222030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-02 17:34:07 +00:00
David Vossel 9329079bb4 Merged revisions 219720 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r219720 | dvossel | 2009-09-21 11:55:53 -0500 (Mon, 21 Sep 2009) | 3 lines
  
  Reverting merge 219520. This change was not necessary.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@219721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-21 16:59:05 +00:00
Russell Bryant 5996ab0ee2 Merged revisions 219586 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r219586 | russell | 2009-09-18 21:51:13 -0500 (Fri, 18 Sep 2009) | 6 lines
  
  Make sure the iax_pvt exists before dereferencing it.
  
  This fixes the latest crash posted on issue 15609.
  
  (issue #15609)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@219587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-19 02:59:52 +00:00
David Vossel 95be40493a Merged revisions 219519 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r219519 | dvossel | 2009-09-18 18:19:50 -0500 (Fri, 18 Sep 2009) | 9 lines
  
  iax2 frame double free
  
  The iax frame's retrans sched id was written over right
  before iax2_frame_free was called.  In iax2_frame_free that
  retrans id is used to delete the sched item.  By writing over
  the retrans field before the sched item could be deleted, it was
  possible for a retransmit to occur on a freed frame.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@219520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-18 23:20:58 +00:00
Tilghman Lesher 1b147b0094 Make calltoken support work with realtime users and peers.
In the course of this, I also found that the results of ast_gethostbyname
were being used incorrectly in both chan_iax2 and chan_sip, so both have
been fixed.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@217916 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-10 23:12:16 +00:00
David Vossel e716801ab2 Merged revisions 217806 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r217806 | dvossel | 2009-09-10 16:06:07 -0500 (Thu, 10 Sep 2009) | 22 lines
  
  IAX2 encryption regression
  
  The IAX2 Call Token security patch inadvertently broke the use of
  encryption due to the reorganization of code in the socket_process()
  function.  When encryption is used, an incoming full frame must first
  be decrypted before the information elements can be parsed.  The
  security release mistakenly moved IE parsing before decryption in
  order to process the new Call Token IE.  To resolve this, decryption
  of full frames is once again done before looking into the frame.  This
  involves searching for an existing callno, checking the pvt to see if
  encryption is turned on, and decrypting the packet before the internal
  fields of the full frame are accessed.
  
  (closes issue #15834)
  Reported by: karesmakro
  Patches:
        iax2_encryption_fix_1.4.diff uploaded by dvossel (license 671)
  Tested by: dvossel, karesmakro
  
  Review: https://reviewboard.asterisk.org/r/355/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@217807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-10 21:07:47 +00:00
David Vossel d09f9fd00a Merge code associated with AST-2009-006
(closes issue #12912)
Reported by: rathaus
Tested by: tilghman, russell, dvossel, dbrooks


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215955 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-03 16:31:54 +00:00
Tilghman Lesher 642bec4d6f AST-2009-005
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-10 19:20:57 +00:00
Jeff Peeler 0f31e6c26c Merged revisions 208923 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208923 | jpeeler | 2009-07-26 20:18:31 -0500 (Sun, 26 Jul 2009) | 2 lines
  
  Fix logic errors from 208746
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208924 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-27 01:20:37 +00:00
Jeff Peeler b7cfe90404 Merged revisions 208746 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208746 | jpeeler | 2009-07-25 01:19:50 -0500 (Sat, 25 Jul 2009) | 7 lines
  
  Fix compiling under dev-mode with gcc 4.4.0.
  
  Mostly trivial changes, but I did not know of any other way to fix the
  "dereferencing type-punned pointer will break strict-aliasing rules" error
  without creating a tmp variable in chan_skinny.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-25 06:23:18 +00:00
David Vossel 090066be3b fixes an error in r203638 CEL commit
(closes issue #15525)
Reported by: elguero
Patches:
      iax2-double-unlock.patch uploaded by elguero (license 37)
      15525.diff uploaded by dvossel (license 671)
Tested by: dvossel



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@207225 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-17 22:07:36 +00:00
Russell Bryant e55d1b11b9 Merged revisions 206385 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
  r206385 | russell | 2009-07-14 09:48:00 -0500 (Tue, 14 Jul 2009) | 13 lines
  
  Merged revisions 206384 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.2
  
  ........
    r206384 | russell | 2009-07-14 09:45:47 -0500 (Tue, 14 Jul 2009) | 6 lines
    
    Ensure apathetic replies are sent out on the proper socket.
    
    chan_iax2 supports multiple address bindings.  The send_apathetic_reply()
    function did not attempt to send its response on the same socket that the
    incoming message came in on.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@206386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-14 14:51:44 +00:00
David Vossel ba2a8457b8 Merged revisions 205471 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r205471 | dvossel | 2009-07-08 18:15:54 -0500 (Wed, 08 Jul 2009) | 10 lines
  
  Fixes 8khz assumptions
  
  Many calculations assume 8khz is the codec rate. This
  is not always the case.  This patch only addresses chan_iax.c
  and res_rtp_asterisk.c, but I am sure there are other areas
  that make this assumption as well.
  
  Review: https://reviewboard.asterisk.org/r/306/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205479 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-08 23:19:09 +00:00
David Vossel 519f1dd7d6 moving debug message from level 0 to 1.
(closes issue #15404)
Reported by: leobrown
Patches:
      iax_codec_debug.patch uploaded by leobrown (license 541)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203710 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 19:47:11 +00:00
Russell Bryant 0264eef115 Merge the new Channel Event Logging (CEL) subsystem.
CEL is the new system for logging channel events.  This was inspired after
facing many problems trying to represent what is possible to happen to a call
in Asterisk using CDR records.  For more information on CEL, see the built in
HTML or PDF documentation generated from the files in doc/tex/.

Many thanks to Steve Murphy (murf) and Brian Degenhardt (bmd) for their hard
work developing this code.  Also, thanks to Matt Nicholson (mnicholson) and
Sean Bright (seanbright) for their assistance in the final push to get this
code ready for Asterisk trunk.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 15:28:53 +00:00
David Vossel 05da5f14d9 Merged revisions 201993 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r201993 | dvossel | 2009-06-19 15:22:02 -0500 (Fri, 19 Jun 2009) | 8 lines
  
  timestamp was being converted to host order as a short rather than a long
  
  (closes issue #15361)
  Reported by: ffloimair
  Patches:
        ts_issue.diff uploaded by dvossel (license 671)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201994 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-19 20:24:37 +00:00
David Vossel 68ba81dfe6 Add rtsavesysname to chan_iax
chan_sip has an option to save the sysname on rtupdate.  This patch copies that same logic to chan_iax.

(closes issue #14837)
Reported by: barthpbx
Patches:
      iax2-rtsavesysname.patch uploaded by barthpbx (license 744)
      rt_iax.diff uploaded by dvossel (license 671)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201534 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-17 21:56:42 +00:00
David Vossel 940accbd99 update chan_iax to use 64bit feature flags.
(closes issue #15335)
Reported by: lmadsen

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-17 14:42:06 +00:00
Kevin P. Fleming 4379249674 Convert a number of global module variables to 'static'.
These modules all contained variables that are module-global but not system-global,
but were not marked 'static'.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-15 17:06:34 +00:00
David Vossel e018606c7e Merged revisions 199138 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r199138 | dvossel | 2009-06-04 14:00:15 -0500 (Thu, 04 Jun 2009) | 3 lines
  
  Additional updates to AST-2009-001
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199139 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-04 19:10:16 +00:00
David Vossel 61bc1854d5 fixes issue with channels not going down after transfer
Iax2 currently does not support native bridging if the timeoutms value is set.  We check for that in iax2_bridge, but then set timeoutms to 0 by default.  If the timeoutms is not provided it is set to -1. By setting timeoutms to 0 it is processed causing a bridging retry loop.

(closes issue #15216)
Reported by: oxymoron
Tested by: dvossel


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198824 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-02 17:55:35 +00:00
Joshua Colp e9e4efdcb6 Fix a bug where the trunkmtu setting was not set to the default value of 1240 on load but was on reload.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197697 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-28 18:45:11 +00:00
Eliel C. Sardanons 2c882626a0 Implement a new element in AstXML for AMI actions documentation.
A new xml element was created to manage the AMI actions documentation,
using AstXML.
To register a manager action using XML documentation it is now possible
using ast_manager_register_xml().
The CLI command 'manager show command' can be used to show the parsed
documentation.

Example manager xml documentation:
<manager name="ami action name" language="en_US">
    <synopsis>
        AMI action synopsis.
    </synopsis>
    <syntax>
        <xi:include xpointer="xpointer(...)" /> <-- for ActionID
        <parameter name="header1" required="true">
	    <para>Description</para>
	</parameter>
	...
    </syntax>
    <description>
        <para>AMI action description</para>
    </description>
    <see-also>
    	...
    </see-also>
</manager>



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-22 17:52:35 +00:00
Kevin P. Fleming e6b2e9a750 Const-ify the world (or at least a good part of it)
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes:

- CLI command handlers
- CLI command handler arguments
- AGI command handlers
- AGI command handler arguments
- Dialplan application handler arguments
- Speech engine API function arguments

In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-21 21:13:09 +00:00
David Vossel 88bda581ec Merged revisions 195991 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r195991 | dvossel | 2009-05-21 14:04:56 -0500 (Thu, 21 May 2009) | 14 lines
  
  Sign problem calculating timestamp for iax frame leads to no audio on the receiving peer.
  
  There are rare cases in which a frame's delivery timestamp is slightly less than the iax2_pvt's offset.  This causes the pvt's timestamp to be a small negative number, but since the timestamp value is unsigned it looks like a huge positive number.  This patch checks for this negative case and sets the ms to zero.  A similar check is already done right below this one in the 'else' statement.
  
  (closes issue #15032)
  Reported by: guillecabeza
  Patches:
        chan_iax2.c.patch_timestamp uploaded by guillecabeza (license 380)
  Tested by: guillecabeza
  
  (closes issue #14216)
  Reported by: Andrey Sofronov
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@195995 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-21 19:11:49 +00:00
David Vossel 2595c54876 Merged revisions 194873 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r194873 | dvossel | 2009-05-15 17:43:13 -0500 (Fri, 15 May 2009) | 17 lines
  
  IAX2 REGAUTH loop
  
  IAX was not sending REGREJ to terminate invalid registrations.  Instead it sent another REGAUTH if the authentication challenge failed.  This caused a loop of REGREQ and REGAUTH frames.
  
  (Related to Security fix AST-2009-001)
  
  (closes issue #14867)
  Reported by: aragon
  Tested by: dvossel
  
  (closes issue #14717)
  Reported by: mobeck
  Patches:
        regauth_loop_update_patch.diff uploaded by dvossel (license 671)
  Tested by: dvossel
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194874 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-15 22:44:44 +00:00
David Vossel d9ac4bfc6f Merged revisions 194557,194685 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r194557 | dvossel | 2009-05-14 17:59:43 -0500 (Thu, 14 May 2009) | 10 lines
  
  IAX2 "Ghost" Channels
  
  There is a bug tracker issue where people are reporting "Ghost" channels in their 'iax2 show channels' output.  The confusion is caused by channels being listed as "(NONE)" with format "unknown".  These are not channels of coarse.  They are usually just pending registration or poke requests, but it is confusing output.  To help make sense of this I have added two columns to 'iax2 show channels'.  One shows the first message which started the transaction, and the second shows the last message sent by either side of the call.  This helps diagnose why the entry exists and why it may not go away.
  
  (closes issue #14207)
  Reported by: clive18
  
  Review: https://reviewboard.asterisk.org/r/246/
........
  r194685 | dvossel | 2009-05-15 10:40:37 -0500 (Fri, 15 May 2009) | 6 lines
  
  Update to previous IAX2 "Ghost" Channels patch.
  
  Fixed some comments made on reviewboard for the previous patch.
  
  (issue #14207)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194833 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-15 20:52:12 +00:00
Joshua Colp 9936f0ca14 Fix a bug where a timer would be created but not acknowledged.
This scenario crept up if chan_iax2 was loaded with no configuration file present.
It would create a timer and tell it to go at an interval but the thread that normally
acknowledges it would not be created because no configuration file was present. The timer
will now be closed if no configuration file is present.

(closes issue #15014)
Reported by: madkins


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-06 17:38:51 +00:00
David Vossel 0d44a84870 Merged revisions 192213 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r192213 | dvossel | 2009-05-04 17:37:31 -0500 (Mon, 04 May 2009) | 11 lines
  
  global mohinterpret setting is ignored
  
  mohinterpret and mohsuggest global variables were not copied over during build_users and build_peers.
  
  (closes issue #14728)
  Reported by: dimas
  Patches:
        v1-14728.patch uploaded by dimas (license 88)
  Tested by: dimas, dvossel
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192214 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-04 22:44:51 +00:00
Tilghman Lesher 451c59aa18 Set debug message back to DEBUG level.
(closes issue #15007)
 Reported by: hulber


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191494 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-01 18:18:00 +00:00
Russell Bryant cba19c8a67 Convert the ast_channel data structure over to the astobj2 framework.
There is a lot that could be said about this, but the patch is a big 
improvement for performance, stability, code maintainability, 
and ease of future code development.

The channel list is no longer an unsorted linked list.  The main container 
for channels is an astobj2 hash table.  All of the code related to searching 
for channels or iterating active channels has been rewritten.  Let n be 
the number of active channels.  Iterating the channel list has gone from 
O(n^2) to O(n).  Searching for a channel by name went from O(n) to O(1).  
Searching for a channel by extension is still O(n), but uses a new method 
for doing so, which is more efficient.

The ast_channel object is now a reference counted object.  The benefits 
here are plentiful.  Some benefits directly related to issues in the 
previous code include:

1) When threads other than the channel thread owning a channel wanted 
   access to a channel, it had to hold the lock on it to ensure that it didn't 
   go away.  This is no longer a requirement.  Holding a reference is 
   sufficient.

2) There are places that now require less dealing with channel locks.

3) There are places where channel locks are held for much shorter periods 
   of time.

4) There are places where dealing with more than one channel at a time becomes 
   _MUCH_ easier.  ChanSpy is a great example of this.  Writing code in the 
   future that deals with multiple channels will be much easier.

Some additional information regarding channel locking and reference count 
handling can be found in channel.h, where a new section has been added that 
discusses some of the rules associated with it.

Mark Michelson also assisted with the development of this patch.  He did the 
conversion of ChanSpy and introduced a new API, ast_autochan, which makes it 
much easier to deal with holding on to a channel pointer for an extended period 
of time and having it get automatically updated if the channel gets masqueraded.
Mark was also a huge help in the code review process.

Thanks to David Vossel for his assistance with this branch, as well.  David 
did the conversion of the DAHDIScan application by making it become a wrapper 
for ChanSpy internally.

The changes come from the svn/asterisk/team/russell/ast_channel_ao2 branch.

Review: http://reviewboard.digium.com/r/203/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190423 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24 14:04:26 +00:00
Doug Bailey 9c2ff7bb1e Merged revisions 189391 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r189391 | dbailey | 2009-04-20 14:10:56 -0500 (Mon, 20 Apr 2009) | 4 lines
  
  Clean up problem with manager implementation of mmap where it was not testing against MAP_FAILED response.
  Got rid of shadowed variable used in processign the mmap results. 
  Change test of mmap results to compare against MAP_FAILED
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189419 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-20 19:28:16 +00:00
Joshua Colp e2a336124f Do not try to send the format read/format write/make compatible options over IAX2.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 16:27:53 +00:00
Mark Michelson 6f53ed4c67 This commit introduces COLP/CONP and Redirecting party information into Asterisk.
The channel drivers which have been most heavily tested with these enhancements are
chan_sip and chan_misdn. Further work is being done to add Q.SIG support and will be
introduced in a later commit. chan_skinny has code added to it here, but according
to user pj, the support on chan_skinny is not working as of now. This will be fixed in
a later commit.

A special thanks goes out to bugtracker user gareth for getting the ball rolling and
providing the initial support for this work. Without his initial work on this, this would
not have been nearly as painless as it was.

This functionality has been tested by Digium's product quality department, as well as a
customer site running thousands of calls every day. In addition, many many many many bugtracker
users have tested this, too.

(closes issue #8824)
Reported by: gareth

Review: http://reviewboard.digium.com/r/201



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-03 22:41:46 +00:00
Joshua Colp 2d9c6ef3d5 Add better support for relaying success or failure of the ast_transfer() API call.
This API call now waits for a special frame from the underlying channel driver to
indicate success or failure. This allows the return value to truly convey whether
the transfer worked or not. In the case of the Transfer() dialplan application this
means the value of the TRANSFERSTATUS dialplan variable is actually true.

(closes issue #12713)
Reported by: davidw
Tested by: file


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186382 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-03 16:47:27 +00:00
Russell Bryant 8dfcd7e418 Improve performance of the code handling the frame queue in chan_iax2.
In my tests that exercised full frame handling in chan_iax2, the version with
these changes took 30% to 40% of the CPU time compared to the same test of
Asterisk trunk before these modifications.

While doing some profiling for <http://reviewboard.digium.com/r/205/>,
one function that caught my eye was network_thread() in chan_iax2.c.
After the things that I was working on there, it was the next target
for analysis and optimization.  I used oprofile's source annotation
functionality and found that the loop traversing the frame queue in
network_thread() was to blame for the excessive CPU cycle consumption.

The frame_queue in chan_iax2 previously held all frames that either were
pending transmission or had been transmitted and are still pending
acknowledgment.

In network_thread(), the previous code would go back through the main
for loop after reading a single incoming frame or after being signaled
because a frame had been queued up for initial transmission.  In each
iteration of the loop, it traverses the entire frame queue looking for
frames that need to be transmitted.  On a busy server, this could easily
be quite a few entries.

This patch is actually quite simple.  The frame_queue has become only a list
of frames pending acknowledgment.  Frames that need to be transmitted are
queued up to a dedicated transmit thread via the taskprocessor API.

As a result, the code in network_thread() becomes much simpler, as its only
job is to read incoming frames.

In addition to the previously described changes, this patch includes some
additional changes to the frame_queue.  Instead of one big frame_queue, now
there is a list per call number to further reduce wasted list traversals.
The biggest impact of this change is in socket_process().

For additional details on testing and test results, see the review request.

Review: http://reviewboard.digium.com/r/212/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@185432 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-31 19:07:58 +00:00
Kevin P. Fleming 9381bff79d Improve timing interface to remember which provider provided a timer
The ability to load/unload timing interfaces is nice, but it means that when a timer is allocated, it may come from provider A, but later provider B becomes the 'preferred' provider. If this happens, all timer API calls on the timer that was provided by provider A will actually be handed to provider B, which will say WTF and return an error.

This patch changes the timer API to include a pointer to the provider of the timer handle so that future operations on the timer will be forwarded to the proper provider.

(closes issue #14697)
Reported by: moy

Review: http://reviewboard.digium.com/r/211/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184762 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-27 19:10:32 +00:00
Russell Bryant ee77b475f2 Improve performance of the ast_event cache functionality.
This code comes from svn/asterisk/team/russell/event_performance/.

Here is a summary of the changes that have been made, in order of both
invasiveness and performance impact, from smallest to largest.

1) Asterisk 1.6.1 introduces some additional logic to be able to handle
   distributed device state.  This functionality comes at a cost.
   One relatively minor change in this patch is that the extra processing
   required for distributed device state is now completely bypassed if
   it's not needed.

2) One of the things that I noticed when profiling this code was that a
   _lot_ of time was spent doing string comparisons.  I changed the way
   strings are represented in an event to include a hash value at the front.
   So, before doing a string comparison, we do an integer comparison on the
   hash.

3) Finally, the code that handles the event cache has been re-written.
   I tried to do this in a such a way that it had minimal impact on the API.
   I did have to change one API call, though - ast_event_queue_and_cache().
   However, the way it works now is nicer, IMO.  Each type of event that
   can be cached (MWI, device state) has its own hash table and rules for
   hashing and comparing objects.  This by far made the biggest impact on
   performance.

For additional details regarding this code and how it was tested, please see the
review request.

(closes issue #14738)
Reported by: russell

Review: http://reviewboard.digium.com/r/205/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184339 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-25 21:57:19 +00:00
Russell Bryant 7460afdd46 Exclude slin16, siren7, and siren14 from bandwidth=low and =medium
The default codec configuration for chan_iax2 is bandwidth=low.  I noticed
slin16 being negotiated as the codec in some test calls, but that no longer
happens after this change.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184037 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-24 21:40:44 +00:00
Russell Bryant f4d0347d02 Merged revisions 183559 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r183559 | russell | 2009-03-20 11:53:25 -0500 (Fri, 20 Mar 2009) | 2 lines

Fix a crash in IAX2 registration handling found during load testing with dvossel.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-20 17:00:58 +00:00
David Vossel 18ac659dc6 Merged revisions 182281 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r182281 | dvossel | 2009-03-16 12:47:42 -0500 (Mon, 16 Mar 2009) | 7 lines
  
  Randomize IAX2 encryption padding
  
  The 16-32 byte random padding at the beginning of an encrypted IAX2 frame turns out to not be all that random at all.  This patch calls ast_random to fill the padding buffer with random data.  The padding is randomized at the beginning of every encrypted call and for every encrypted retransmit frame.
  
  Review: http://reviewboard.digium.com/r/193/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-16 17:49:58 +00:00
David Vossel 5f476b6085 Merged revisions 181340 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181340 | dvossel | 2009-03-11 12:25:31 -0500 (Wed, 11 Mar 2009) | 11 lines
  
  encrypted IAX2 during packet loss causes decryption to fail on retransmitted frames
  
  If an iax channel is encrypted, and a retransmit frame is sent, that packet's iseqno is updated while it is encrypted.  This causes the entire frame to be corrupted.  When the corrupted frame is sent, the other side decrypts it and sends a VNAK back because the decrypted frame doesn't make any sense.  When we get the VNAK, we look through the sent queue and send the same corrupted frame causing a loop.  To fix this, encrypted frames requiring retransmission are decrypted, updated, then re-encrypted.  Since key-rotation may change the key held by the pvt struct, the keys used for encryption/decryption are held within the iax_frame to guarantee they remain correct.
  
  (closes issue #14607)
  Reported by: stevenla
  Tested by: dvossel
  
  Review: http://reviewboard.digium.com/r/192/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181371 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 17:34:57 +00:00
Joshua Colp 775b30307f Do not try to remove a registration scheduled item if the scheduler context has already been destroyed.
(closes issue #14580)
Reported by: alecdavis


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179323 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-02 14:28:09 +00:00
David Vossel 3d0aac6cd8 IAX2 prune realtime, minor tweak to last fix
A return statement was missing which caused unexpected cli output.

issue #14479


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@178871 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-26 17:46:12 +00:00
David Vossel a0ef434095 IAX2 prune realtime fix
Iax2 prune realtime had issues.  If "iax2 prune realtime all" was called, it would appear like the command was successful, but in reality nothing happened.  This is because the reload that was supposed to take place checks the config files, sees no changes, and does nothing.  If there had been a change in the the config file, the realtime users would have been marked for deletion and everything would have been fine.  Now prune_users() and prune_peers() are called instead of reload_config() to prune all users/peers that are realtime.  These functions remove all users/peers with the rtfriend and delme flags set. iax2_prune_realtime() also lacked the code to properly delete a single friend.  For example. if iax2 prune realtime <friend> was called, only the peer instance would be removed. The user would still remain.  

(closes issue #14479)
Reported by: mousepad99
Review: http://reviewboard.digium.com/r/176/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@178767 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-26 15:50:22 +00:00
David Vossel 641dd68c4d Allows manager command to see if IAX link is trunked and encrypted. Displays what kind of encryption is enabled as well.
Manager command "iaxpeers" now shows if a link is trunked and encrypted.  Instead of encryption saying simply "yes" or "no", it now displays what type of encryption is enabled and if keyrotation is on or not.  

(closes issue #14427)
Reported by: snuffy
Patches:
	iax_show_trunks.diff uploaded by snuffy (license 35)
	2009022200_iax2_show_trunkencryption.diff.txt uploaded by mvanbaak (license 7)
Tested by: mvanbaak, dvossel, snuffy
Review: http://reviewboard.digium.com/r/173/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@178300 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-24 17:42:37 +00:00
David Vossel 7d1ac32af1 Changes the way keyrotation is enabled by default
Key rotation was enabled by default by setting the global encryption method to IAX_ENCRYPT_KEYROTATE.  the problem with this is that if encryption is not enabled, and the encryption method is set to anything except 0, the peer appears to have encryption enabled when issuing a "iax2 show peers".  Rather than have the key rotation bit always set by default, it is now only set when an encryption method is enabled. 

(closes issue #14523)
Reported by: mvanbaak


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@178030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-23 17:59:55 +00:00
David Vossel 00b5dcfca4 Merged revisions 176354 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r176354 | dvossel | 2009-02-16 17:30:52 -0600 (Mon, 16 Feb 2009) | 8 lines
  
  Fixes issue with AST_CONTROL_SRCUPDATE not being relayed correctly during bridging
  
  This should have been committed with rev176247, but I missed it.  srcupdate frames no longer break out of the native bridge, but are not being sent to the other call leg either.  This fixs that.
  
  issue #13749
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176355 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-16 23:33:55 +00:00
David Vossel 0a792331bf Merged revisions 175597 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
  r175597 | dvossel | 2009-02-13 14:11:55 -0600 (Fri, 13 Feb 2009) | 4 lines
  
  Fixed iax2 key rotation backwards compatibility
  
  Turns key rotation back on by default.  Added bit into encryption IE to indicate whether or not key rotation is supported or not. If it is not supported then it is not enabled, which insures backwards compatibility.  This eliminates the need for the keyrotate option in iax.conf, so it has been removed.  
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176248 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-16 21:30:17 +00:00