Commit Graph

2927 Commits

Author SHA1 Message Date
Terry Wilson f9816a6265 Merged revisions 215682 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r215682 | twilson | 2009-09-02 16:41:22 -0500 (Wed, 02 Sep 2009) | 18 lines
  
  Re-send non-100 provisional responses to prevent cancellation
  
  From section 13.3.1.1 of RFC 3261:
  
     If the UAS desires an extended period of time to answer the INVITE,
     it will need to ask for an "extension" in order to prevent proxies
     from canceling the transaction. A proxy has the option of canceling
     a transaction when there is a gap of 3 minutes between responses in a
     transaction. To prevent cancellation, the UAS MUST send a non-100
     provisional response at every minute, to handle the possibility of
     lost provisional responses.
  
  (closes issue #11157)
  Reported by: rjain
  Tested by: twilson
  
  Review: https://reviewboard.asterisk.org/r/315/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215758 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-02 23:31:04 +00:00
David Vossel a83cf36204 port string to int conversion using sscanf
There are several instances where a port is parsed
from a uri or some other source and converted to
an int value using atoi(), if for some reason the
port string is empty, then a standard port is used.
This logic is used over and over, so I created a function
to handle it in a safer way using sscanf().



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215681 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-02 21:39:31 +00:00
Michiel van Baak 0a67bc6610 add Parkinglot info to sip show peer <foo> and skinny show line <foo>
If we had this from the start, debugging the 'parking not using configured parkinglot'
bug would have been easier.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-02 21:23:17 +00:00
David Vossel 5537a4babe SIP uri parsing cleanup
Now, the scheme passed to parse_uri can either be a
single scheme, or a list of schemes ',' delimited.
This gets rid of the whole problem of having to create
two buffers and calling parse_uri twice to check for
separate schemes.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215522 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-02 17:26:40 +00:00
David Vossel b5dc4efb58 SIP support for keep-alive event
keep-alive events are used by Sipura/Linksys for NAT keepalive.
There currently don't appear to be any problems with NAT, but
everytime a keep-alive event is received, Asterisk responds with a
"489 Bad event".  This error may indicate to a user that NAT
problems exist just because this even is not supported.  Now,
rather than respond with an error, the packet is consumed and
a "200 ok" is sent just to indicate we received the packet.

(issue #15084)
Patches:
      chan_sip.keepalive.v1.diff uploaded by IgorG (license 20)




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215466 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-02 16:08:00 +00:00
Michiel van Baak 7e7081439a Honor configured parkinglot when parking and retrieving parked calls
Thank oej for pointing out the fact that sip_new did not copy parkinglot from the peer
into the newly created channel.

(closes issue #15538)
Reported by: gracedman
Patches:
      2009090100_sipnewparkinglot-161.diff.txt uploaded by mvanbaak (license 7)
	  With mod by me to also fix callparking as well (this uploaded patch only fixed retrieving a parked call)
Tested by: gracedman, mvanbaak


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-02 15:56:46 +00:00
Tilghman Lesher 2cfddf8cb6 Add MASTER_CHANNEL() dialplan function, as well as a useful usage.
(closes issue #13140)
 Reported by: cpina
 Patches: 
       20090807__issue13140.diff.txt uploaded by tilghman (license 14)
 Tested by: lmadsen
 Change-type: feature


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215301 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-01 23:41:06 +00:00
Tilghman Lesher 4af7d0c949 Fix register such that lines with a transport string, but without an authuser, parse correctly.
(AST-228)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215222 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-01 21:19:40 +00:00
Olle Johansson 8c56b871de Removing whitespace that causes red dots in reviewboard
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215110 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-01 14:40:42 +00:00
Tilghman Lesher 552b1aa17d Typo fix ("SIP/2.0 XXX" is 11 chars, not 10)
(closes issue #15362)
 Reported by: klaus3000
 Patches: 
       chan_sip.c_logmessagefix_patch.txt uploaded by klaus3000 (license 65)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@214199 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-26 16:53:03 +00:00
Tilghman Lesher c28fb2bf19 Clarifying comments in sip_register, and removing a dead section
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@213738 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-21 22:36:39 +00:00
David Vossel 06ff8023f5 Register request line contains wrong address when user domain and register host differ
(closes issue #15539)
Reported by: Nick_Lewis
Patches:
      chan_sip.c-registraraddr.patch uploaded by Nick (license 657)
      register_domain_fix_1.6.2 uploaded by dvossel (license 671)
Tested by: Nick_Lewis, dvossel



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@213716 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-21 22:22:11 +00:00
David Vossel 1f81e544c0 fixes sip register parsing when user@domain is used
(issue #15008)
(issue #15672)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@213635 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-21 21:02:50 +00:00
Tilghman Lesher 3028e257bb Better parsing for the "register" line
Allows characters that are otherwise used as delimiters to be used within
certain fields (like the secret).
(closes issue #15008, closes issue #15672)
 Reported by: tilghman
 Patches: 
       20090818__issue15008.diff.txt uploaded by tilghman (license 14)
 Tested by: lmadsen, tilghman


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@213098 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-19 21:05:17 +00:00
Tilghman Lesher 68b255eedc If we have realtime caching enabled, 'sip reload' must purge users/peers, even if the config files haven't changed.
(closes issue #12869)
 Reported by: bcnit
 Patches: 
       20090819__issue12869__2.diff.txt uploaded by tilghman (license 14)
 Tested by: lasko


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@213093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-19 20:29:41 +00:00
Kevin P. Fleming c3bc5cf567 Ensure that T38FaxVersion is put into outgoing SDP in the proper case.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@212113 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-13 15:46:25 +00:00
Joshua Colp 47220d3506 Check an actual populated variable when seeing if we need to do video or not.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@212067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-13 13:51:04 +00:00
Matthew Nicholson 5583a4e955 This patch adds support for choosing a realm based on the domain in the From or To header in the incoming request. Eligible domains are taken from the domains list in the config file. This functionality is enabled when domainsasrealm is enabled in the config file.
(closes issue #11361)
Reported by: arkadia
Patches:
      sip_realm_mnich_to_added_2.patch uploaded by arkadia (license 233)
Tested by: arkadia


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-12 22:18:09 +00:00
Matthew Nicholson 56110dd4f1 Make asterisk handle 423 Interval Too Short messages better.
This change uses separate values for the acceptable minimum expiry provided by the 423 error and the expiry value stored in the configuration file.  Previously, the value pulled from the configuration file would be overwritten.

(closes issue #14366)
Reported by: Nick_Lewis
Patches:
      sip-expiry-fix1.diff uploaded by mnicholson (license 96)
      chan_sip.c-reqexpiry.patch uploaded by Nick (license 657)
Tested by: mnicholson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211876 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-12 19:53:14 +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
Joshua Colp 6391976270 Fix retrieval of the port used for the video stream when adding SDP to a SIP message.
(closes issue #15121)
Reported by: jsmith


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211347 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-10 14:07:44 +00:00
Joshua Colp 3bf326b898 Accept additional T.38 reinvites after an initial one has been handled.
Discussion of this subject has yielded that it is not actually acceptable to change
T.38 parameters after the initial reinvite but declining is harsh and can cause the
fax to fail when it may be possible to allow it to continue. This patch changes things
so that additional T.38 reinvites are accepted but parameter changes ignored. This gives
the fax a fighting chance.

(closes issue #15610)
Reported by: huangtx2009


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@210817 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-06 17:47:04 +00:00
Kevin P. Fleming e9d22f802e Rename 'canreinvite' option to 'directmedia', with backwards compatibility.
It is clear from multiple mailing list, forum, wiki and other sorts of posts
that users don't really understand the effects that the 'canreinvite' config
option actually has, and that in some cases they think that setting it to 'no'
will actually cause various other features (T.38, MOH, etc.) to not work properly,
when in fact this is not the case. This patch changes the proper name of the
option to what it should have been from the beginning ('directmedia'), but
preserves backwards compatibility for existing configurations.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@210190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-03 20:48:48 +00:00
Mark Michelson 2df5b70b16 Improve chan_sip's ability to determine what methods should and should not be used in a dialog.
The previous effort here was to store what a peer is capable of receiving by parsing REGISTER
requests from the peer and keeping that information for as long as the registration was active.
The problem with this is that there are a great number of SIP devices which give no indication
of the methods allowed in their REGISTER requests, and it is unreasonable to try to guess what
the device may or may not support. In addition, some SIP devices have been found to claim support
for a specific method, but their handling the method is less than ideal, or they are actually
lying.

With this patch, we now determine what methods a device supports  by parsing the Allow header we
receive from them, and we do this with each new dialog. In addition, a configuration option has
been added so that an administrator can essentially blacklist certain methods from being used
with certain peers if the admin knows that support for a specific method is dodgy or nonexistent.

ABE-1822



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@209673 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-31 17:55:44 +00:00
Mark Michelson 192e2be596 Fix a crash that can result if text codecs are allowed but textsupport is disabled.
(closes issue #15596)
Reported by: fabled
Patches:
      sip-red.patch uploaded by fabled (license 448)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@209516 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-30 14:38:21 +00:00
Kevin P. Fleming ba020fc390 Define side-effect-safe MIN and MAX macros and remove duplicate definitions from various files.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@209400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-28 13:49:46 +00:00
Mark Michelson 554c5e62d0 Merged revisions 208587 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208587 | mmichelson | 2009-07-24 13:26:50 -0500 (Fri, 24 Jul 2009) | 10 lines
  
  Only send a BYE when hanging up a channel that is up.
  
  For cases where Asterisk sends an INVITE and receives a non 2XX final
  response, Asterisk would follow the INVITE transaction by immediately
  sending a BYE, which was unnecessary.
  
  (closes issue #14575)
  Reported by: chris-mac
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-24 18:31:04 +00:00
Kevin P. Fleming 17e2d9fdbc Resolve a T.38 negotiation issue left over from the udptl-updates merge.
The udptl-updates branch that was merged yesterday failed to properly send back
T.38 SDP responses with the correct error correction mode, if the incoming SDP
from the other end caused us to change error correction modes. This patch
corrects that situation.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208548 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-24 15:02:53 +00:00
Kevin P. Fleming 0a6e06c7ff Rework of T.38 negotiation and UDPTL API to address interoperability problems
Over the past couple of months, a number of issues with Asterisk
negotiating (and successfully completing) T.38 sessions with various
endpoints have been found. This patch attempts to address many of
them, primarily focused around ensuring that the endpoints'
MaxDatagram size is honored, and in addition by ensuring that T.38
session parameter negotiation is performed correctly according to the
ITU T.38 Recommendation.

The major changes here are:

1) T.38 applications in Asterisk (app_fax) only generate/receive IFP
packets, they do not ever work with UDPTL packets. As a result of
this, they cannot be allowed to generate packets that would overflow
the other endpoints' MaxDatagram size after the UDPTL stack adds any
error correction information. With this patch, the application is told
the maximum *IFP* size it can generate, based on a calculation using
the far end MaxDatagram size and the active error correction mode on
the T.38 session. The same is true for sending *our* MaxDatagram size
to the remote endpoint; it is computed from the value that the
application says it can accept (for a single IFP packet) combined with
the active error correction mode.

2) All treatment of T.38 session parameters as 'capabilities' in
chan_sip has been removed; these parameters are not at all like
audio/video stream capabilities. There are strict rules to follow for
computing an answer to a T.38 offer, and chan_sip now follows those
rules, using the desired parameters from the application (or channel)
that wants to accept the T.38 negotiation.

3) chan_sip now stores and forwards ast_control_t38_parameters
structures for tracking 'our' and 'their' T.38 session parameters;
this greatly simplifies negotiation, especially for pass-through
calls.

4) Since T.38 negotiation without specifying parameters or receiving
the final negotiated parameters is not very worthwhile, the
AST_CONTROL_T38 control frame has been removed. A note has been added
to UPGRADE.txt about this removal, since any out-of-tree applications
that use it will no longer function properly until they are upgraded
to use AST_CONTROL_T38_PARAMETERS.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-23 21:57:24 +00:00
Mark Michelson 88f1d14766 Merged revisions 208386 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208386 | mmichelson | 2009-07-23 14:24:21 -0500 (Thu, 23 Jul 2009) | 17 lines
  
  Fix a problem where a 491 response could be sent out of dialog.
  
  This generalizes the fix for issue 13849. The initial fix corrected the
  problem that Asterisk would reply with a 491 if a reinvite were received
  from an endpoint and we had not yet received an ACK from that endpoint
  for the initial INVITE it had sent us. This expansion also allows Asterisk
  to appropriately handle an INVITE with authorization credentials if Asterisk
  had not received an ACK from the previous transaction in which Asterisk had
  responded to an unauthorized INVITE with a 407.
  
  (closes issue #14239)
  Reported by: klaus3000
  Patches:
        14239.patch uploaded by mmichelson (license 60)
  Tested by: klaus3000
  	  
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208388 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-23 19:34:49 +00:00
Mark Michelson bacf6ab51e Merged revisions 208312 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208312 | mmichelson | 2009-07-23 11:29:18 -0500 (Thu, 23 Jul 2009) | 3 lines
  
  Remove inaccurate XXX comment.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-23 16:29:37 +00:00
Mark Michelson 98b4bdc1b9 Merged revisions 208262 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208262 | mmichelson | 2009-07-23 10:43:07 -0500 (Thu, 23 Jul 2009) | 8 lines
  
  Properly handle 183 responses which do not contain an SDP.
  
  (closes issue #15442)
  Reported by: ffloimair
  Patches:
        15442.patch uploaded by mmichelson (license 60)
  Tested by: tkarl, ffloimair
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-23 15:46:34 +00:00
Mark Michelson 3843480b8f Fix potential crash if p->owner is NULL.
Problem was observed when a call-forwarding loop was accidentally
configured.

ABE-1906



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208229 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-23 14:46:53 +00:00
David Vossel 3f8059f87d reg->username is parsed only once on sip reload
The registration string can contain an expanded user portion of the
form user@domain. This expanded user portion was stored in
reg->username and parsed each time there is a registration refresh.
Now, the domain portion of the user is parsed and stored separately
in the regdomain field.

(closes issue #14331)
Reported by: Nick_Lewis
Patches:
      chan_sip.c.domainparse3.patch uploaded by Nick (license 657)
Tested by: Nick_Lewis, dvossel




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@207484 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-20 20:45:26 +00:00
Mark Michelson bec894cbe5 Merged revisions 207423 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r207423 | mmichelson | 2009-07-20 14:39:59 -0500 (Mon, 20 Jul 2009) | 33 lines
  
  Answer video SDP offers properly when videosupport is not enabled.
  
  Copied from Review board:
  
  In issue 12434, the reporter describes a situation in which audio and video 
  is offered on the call, but because videosupport is disabled in sip.conf, 
  Asterisk gives no response at all to the video offer. According to RFC 3264, 
  all media offers should have a corresponding answer. For offers we do not 
  intend to actually reply to with meaningful values, we should still reply 
  with the port for the media stream set to 0.
  
  In this patch, we take note of what types of media have been offered and 
  save the information on the sip_pvt. The SDP in the response will take into 
  account whether media was offered. If we are not otherwise going to answer 
  a media offer, we will insert an appropriate m= line with the port set to 0.
  
  It is important to note that this patch is pretty much a bandage being 
  applied to a broken bone. The patch *only* helps for situations where video 
  is offered but videosupport is disabled and when udptl_pt is disabled but 
  T.38 is offered. Asterisk is not guaranteed to respond to every media offer. 
  Notable cases are when multiple streams of the same type are offered. 
  The 2 media stream limit is still present with this patch, too.
  
  In trunk and the 1.6.X branches, things will be a bit different since Asterisk 
  also supports text in SDPs as well.
  
  (closes issue #12434)
  Reported by: mnnojd
  
  Review: https://reviewboard.asterisk.org/r/311
  Review: https://reviewboard.asterisk.org/r/313
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@207424 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-20 19:48:12 +00:00
David Vossel 65388d4e21 sip option flags handled incorrectly
(closes issue #15376)
Reported by: Takehiko Ooshima
Tested by: dvossel, Takehiko_Ooshima


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

........
  r206938 | dvossel | 2009-07-17 11:05:06 -0500 (Fri, 17 Jul 2009) | 14 lines
  
  SIP incorrect From: header information when callpres is prohib
  
  Some ITSP make use of the "Anonymous" display name to detect a
  requirement to withhold caller id across the PSTN. This does
  not work if the display name is "Unknown".
  
  (closes issue #14465)
  Reported by: Nick_Lewis
  Patches:
        chan_sip.c-callerpres.patch uploaded by Nick (license 657)
        chan_sip.c-callerpres_trunk.patch uploaded by dvossel (license 671)
  Tested by: Nick_Lewis, dvossel
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@206939 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-17 16:13:22 +00:00
David Vossel f91bc197cd Session timer were not activated if Supported header field in INVITE had both "timer" and other options.
(closes issue #15403)
Reported by: makoto
Patches:
      sip-session-timer.patch uploaded by makoto (license 38)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@206768 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-15 22:04:13 +00:00
David Vossel 3402f34e9b callerid(num) is wrong when username is missing
A domain only sip uri <sip:123.123.123.123> would return
123.123.123.123 as callid num.  Now, if the username is
missing from a uri, the callerid num field is left empty.

(closes issue #15476)
Reported by: viraptor



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@206702 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-15 20:20:01 +00:00
David Vossel 6891ccad28 dns lookup of peername rather than peer's host in transmit_register()
(closes issue #15052)
Reported by: fsantulli
Patches:
      chan_sip_bug_15052_[20090626204511].patch uploaded by fsantulli (license 818)
Tested by: fsantulli



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@206280 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-13 23:26:51 +00:00
David Vossel c01286976a SIP register not using peer's outbound proxy
If callbackextension is defined for a peer it successfully causes
a registration to occur, but the registration ignores the
outboundproxy settings for the peer.  This patch allows the
peer to be passed to obproxy_get() in transmit_register().

(closes issue #14344)
Reported by: Nick_Lewis
Patches:
      callbackextension_peer_trunk.diff uploaded by dvossel (license 671)
Tested by: dvossel

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205985 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-10 21:42:10 +00:00
Mark Michelson 5aab96f0b7 Merged revisions 205877 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
  r205877 | mmichelson | 2009-07-10 12:39:13 -0500 (Fri, 10 Jul 2009) | 23 lines
  
  Merged revisions 205776 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/trunk
  
  ................
    r205776 | mmichelson | 2009-07-10 10:56:45 -0500 (Fri, 10 Jul 2009) | 16 lines
    
    Merged revisions 205775 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r205775 | mmichelson | 2009-07-10 10:51:36 -0500 (Fri, 10 Jul 2009) | 10 lines
      
      Ensure that outbound NOTIFY requests are properly routed through stateful proxies.
      
      With this change, we make note of Record-Route headers present in any SUBSCRIBE
      request that we receive so that our outbound NOTIFY requests will have the proper
      Route headers in them.
      
      (closes issue #14725)
      Reported by: ibc
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205878 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-10 17:39:57 +00:00
David Vossel fe493cf85e Merged revisions 205804 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r205804 | dvossel | 2009-07-10 11:23:59 -0500 (Fri, 10 Jul 2009) | 31 lines
  
  SIP registration auth loop caused by stale nonce
  
  If an endpoint sends two registration requests in a very short
  period of time with the same nonce, both receive 401 responses
  from Asterisk, each with a different nonce (the second 401
  containing the current nonce and the first one being stale).
  If the endpoint responds to the first 401, it does not match
  the current nonce so Asterisk sends a third 401 with a newly
  generated nonce (which updates the current nonce)... Now if
  the endpoint responds to the second 401, it does not match the
  current nonce either and Asterisk sends a fourth 401 with a
  newly generated nonce... This loop goes on and on.
  
  There appears to be a simple fix for this.  If the nonce from
  the request does not match our nonce, but is a good response
  to a previous nonce, instead of sending a 401 with a newly
  generated nonce, use the current one instead.  This breaks
  the loop as the nonce is not updated until a response is
  received. Additional logic has been added to make sure no
  nonce can be responded to twice though.
  
  (closes issue #15102)
  Reported by: Jamuel
  Patches:
        patch-bug_0015102 uploaded by Jamuel (license 809)
        nonce_sip.diff uploaded by dvossel (license 671)
  Tested by: Jamuel
  
  Review: https://reviewboard.asterisk.org/r/289/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-10 16:42:04 +00:00
Mark Michelson aafa57cf4b Merged revisions 205775 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r205775 | mmichelson | 2009-07-10 10:51:36 -0500 (Fri, 10 Jul 2009) | 10 lines
  
  Ensure that outbound NOTIFY requests are properly routed through stateful proxies.
  
  With this change, we make note of Record-Route headers present in any SUBSCRIBE
  request that we receive so that our outbound NOTIFY requests will have the proper
  Route headers in them.
  
  (closes issue #14725)
  Reported by: ibc
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205776 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-10 15:56:45 +00:00
Kevin P. Fleming 67d1957e60 Repair ability of SendFAX/ReceiveFAX to respond to T.38 switchover.
Recent changes in T.38 negotiation in Asterisk caused these applications to
not respond when the other endpoint initiated a switchover to T.38; this
resulted in the T.38 switchover failing, and the FAX attempt to be made
using an audio connection, instead of T.38 (which would usually cause the
FAX to fail completely).

This patch corrects this problem, and the applications will now correctly
respond to the T.38 switchover request. In addition, the response will include
the appopriate T.38 session parameters based on what the other end offered
and what our end is capable of.

(closes issue #14849)
Reported by: afosorio


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-09 21:20:23 +00:00
Tilghman Lesher e76a0e92d2 Permit setting custom headers from the peer definition.
(closes issue #14059)
 Reported by: fnordian


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205086 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-07 21:10:14 +00:00
Mark Michelson 320c8d27b9 Move the masquerade in local_attended_transfer to a point where we hold the channel lock.
Masquerading without the channel's lock held is a *horrible* idea.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204532 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-30 19:59:20 +00:00
Mark Michelson ab2b9bd16d Remove some bogus deadlock avoidance code from local_attended_transfer.
First of all, the code was unnecessary. The goal was to lock a channel
which was already locked. Second, the assumption of the deadlock avoidance
loop was that the sip_pvt was already locked and we were trying to get the
channel lock. The problem is that the sip_pvt was unlocked a few lines above.

Basically, I'm removing 5 lines of no-op.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204530 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-30 19:55:59 +00:00
Mark Michelson a4dc276ed9 Merged revisions 204300 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r204300 | mmichelson | 2009-06-29 17:45:34 -0500 (Mon, 29 Jun 2009) | 9 lines
  
  Add error message so that it is clear why a SIP peer was not processed when
  a DNS lookup fails on a host or outboundproxy.
  
  (closes issue #13432)
  Reported by: p_lindheimer
  Patches:
        outboundproxy.patch uploaded by p (license 558)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204301 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-29 22:50:35 +00:00
Mark Michelson 200f1dc19e Merged revisions 204243,204246 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r204243 | mmichelson | 2009-06-29 16:23:43 -0500 (Mon, 29 Jun 2009) | 22 lines
  
  Fix a problem where chan_sip would ignore "old" but valid responses.
  
  chan_sip has had a problem for quite a long time that would manifest when
  Asterisk would send multiple SIP responses on the same dialog before receiving
  a response. The problem occurred because chan_sip only kept track of the highest
  outgoing sequence number used on the dialog. If Asterisk sent two requests out,
  and a response arrived for the first request sent, then Asterisk would ignore
  the response. The result was that Asterisk would continue retransmitting the
  requests and ignoring the responses until the maximum number of retransmissions
  had been reached.
  
  The fix here is to rearrange the code a bit so that instead of simply comparing
  the sequence number of the response to our latest outgoing sequence number, we
  walk our list of outstanding packets and determine if there is a match. If there is,
  we continue. If not, then we ignore the response.
  
  In doing this, I found a few completely useless variables that I have now removed.
  
  (closes issue #11231)
  Reported by: flefoll

  Review: https://reviewboard.asterisk.org/r/298
........
  r204246 | mmichelson | 2009-06-29 16:37:05 -0500 (Mon, 29 Jun 2009) | 3 lines
  
  Fix build oops.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204247 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-29 21:48:54 +00:00
Russell Bryant 92f0cdfce7 Ensure the TCP read buffer is fully initialized before handling each packet.
(closes issue #14452)
Reported by: umberto71


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203779 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 20:45:00 +00:00
Joshua Colp 48f7381af0 Fix the 'nat' option to actually do RFC3581 as expected and extend the configurable values for finer control.
(closes issue #8855)
Reported by: mikma
Tested by: klaus3000, file


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 20:19:49 +00:00
Joshua Colp 59c1998d67 Improve T.38 negotiation by exchanging session parameters between application and channel.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 19:27:24 +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
Russell Bryant c6a986222e Merged revisions 203115 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r203115 | russell | 2009-06-25 11:02:16 -0500 (Thu, 25 Jun 2009) | 11 lines
  
  Resolve a crash related to a T.38 reinvite race condition.
  
  This change resolves a crash observed locally during some T.38 testing.
  A call was set up using a call file, and when the T.38 reinvite came in,
  the channel state was still AST_STATE_DOWN.  The reason is explained by
  a comment in the code that previously lived in the handling of
  AST_STATE_RINGING.  This change modifies the logic to handle the same
  race condition for any channel state that is not UP.
  
  (closes ABE-1895)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203116 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-25 16:04:10 +00:00
Mark Michelson 0a915a84e6 Merged revisions 202966 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202966 | mmichelson | 2009-06-24 13:28:47 -0500 (Wed, 24 Jun 2009) | 3 lines
  
  Use the handy UNLINK macro instead of hand-coding the same thing in-line.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@202967 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-24 18:29:10 +00:00
Joshua Colp 4c07c7a6b2 Ensure the default settings are applied for T.38 when we set it up for a peer.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@202925 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-24 18:08:17 +00:00
David Vossel 5f73ab9f4e Merged revisions 202671 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202671 | dvossel | 2009-06-23 11:28:46 -0500 (Tue, 23 Jun 2009) | 12 lines
  
  MWI NOTIFY contains a wrong URI if Asterisk listens to non-standard port and transport
  
  (closes issue #14659)
  Reported by: klaus3000
  Patches:
        patch_chan_sip_fixMWIuri_1.4.txt uploaded by klaus3000 (license 65)
        mwi_port-transport_trunk.diff uploaded by dvossel (license 671)
  Tested by: dvossel, klaus3000
  
  Review: https://reviewboard.asterisk.org/r/288/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@202672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-23 16:31:30 +00:00
Russell Bryant e2bfdbac0a Merged revisions 202414 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202414 | russell | 2009-06-22 11:00:00 -0500 (Mon, 22 Jun 2009) | 2 lines
  
  Make Polycom subscription type override check more explicit.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@202415 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-22 16:05:08 +00:00
Mark Michelson f142cbe10c Merged revisions 202341-202342 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202341 | mmichelson | 2009-06-22 09:42:55 -0500 (Mon, 22 Jun 2009) | 26 lines
  
  Fix a situation in which Asterisk would not stop retransmitting 487s.
  
  If a CANCEL were received by Asterisk, we would send a 487 in response
  to the original INVITE and a 200 OK for the CANCEL. If there were a network
  hiccup which caused the 200 OK and the 487 to be lost, then the UA communicating
  with Asterisk may try to retransmit its CANCEL. Asterisk's response to this used
  to be to try sending another 487 to the canceled INVITE and another 200 OK to the
  CANCEL.
  
  The problem here is that the originally-sent 487 was sent "reliably" meaning that
  it will be retransmitted until it is received properly. So when we receive the second
  CANCEL it is likely that the first batch of 487s we sent is still going strong and
  reaches the UA. The result was that the second set of 487s would be retransmitted
  constantly until the maximum number of retries had been reached.
  
  The fix for this is that if we receive a second CANCEL for an INVITE, then we cancel
  the retransmission of the first set of 487s and start a second set. This causes the
  dialog to be terminated reasonably.
  
  (closes issue #14584)
  Reported by: klaus3000
  Patches:
        14584_v2.patch uploaded by mmichelson (license 60)
  Tested by: klaus3000
........
  r202342 | mmichelson | 2009-06-22 09:44:58 -0500 (Mon, 22 Jun 2009) | 3 lines
  
  Remove an extra debug line left from previous commit.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@202343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-22 14:58:24 +00:00
Mark Michelson e68e6f9d75 Merged revisions 202336 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202336 | mmichelson | 2009-06-22 09:34:05 -0500 (Mon, 22 Jun 2009) | 25 lines
  
  Fix a possible infinite loop in SDP parsing during glare situation.
  
  There was a while loop in get_ip_and_port_from_sdp which was controlled
  by a call to get_sdp_iterate. The loop would exit either if what we were
  searching for was found or if the return was NULL. The problem is that
  get_sdp_iterate never returns NULL. This means that if what we were searching
  for was not present, the loop would run infinitely. This modification of the
  loop fixes the problem.
  
  (closes issue #15213)
  Reported by: schmidts
  
  (closes issue #15349)
  Reported by: samy
  
  (closes issue #14464)
  Reported by: pj
  
  (closes issue #15345)
  Reported by: aragon
  Patches:
        sip_inf_loop.patch uploaded by mmichelson (license 60)
  Tested by: aragon
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@202337 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-22 14:35:09 +00:00
Matthew Nicholson 55c6789f74 Use sched_yield() instead of usleep(1)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@202039 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-19 21:25:06 +00:00
Joshua Colp e85296e244 Add support for allowing an RTP engine to decide on whether it is possible for specific formats to be transcoded for an RTP instance.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201902 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-19 15:41:24 +00:00
Matthew Nicholson 21ad428d0d Added deadlock protection to try_suggested_sip_codec in chan_sip.c.
Review: https://reviewboard.asterisk.org/r/285/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-18 17:41:09 +00:00
Mark Michelson dce6a54a4a Trunk implementation of setting an alternate RTP source.
This contains the interface by which we can let an rtp instance know
that it might start receiving audio from a new source. This is similar
in nature to revision 197588 of Asterisk 1.4.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-18 15:20:17 +00:00
David Vossel a11ac5ae2f parsing extension correctly from sip register lines
If a transport type was specified, but no extension, parsing of the extension would return whatever was after the transport rather than defaulting to 's'.

(closes issue #15111)
Reported by: ffs
Patches:
      chan_sip.c_register-parser.patch uploaded by ffs (license 730)
Tested by: ffs, dvossel



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-18 15:16:05 +00:00
Mark Michelson 99b98d8f9a Fix problem with no audio due to ignoring the SDP.
A recent change to our SDP version comparison made audio not function
on some calls. This was because of a test wherein we were trying to
see if an unsigned value was less than 0. This is a dumb comparison
and arguably the compiler should have warned about it. Alas, though,
it slipped past. Now it's fixed by changing the variable to be a
signed type.

Found by several developers. Tested by mnicholson and dbrooks.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-17 20:10:01 +00:00
David Brooks ecfbab0782 Merged revisions 201380 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r201380 | dbrooks | 2009-06-17 13:45:50 -0500 (Wed, 17 Jun 2009) | 9 lines
  
  Checks for NULL sip_pvt pointer in chan_sip.c->acf_channel_read()
  
  Zombie channels could be passed, and chan_sip.c wasn't checking for it.
  Could crash Asterisk. Now checking for NULL pointer.
  
  (closes issue #15330)
  Reported by: okrief
  Tested by: dbrooks
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-17 19:15:07 +00:00
David Vossel 9bf67151c9 SIP registry ref count error
During a sip reload, the list of sip_registry objects are
supposed to be traversed, unlinked, and destroyed, but
destruction never takes place due to a ref counting error.
This causes a memory leak when registry items are removed
from sip.conf and reloaded.  While the registries are removed
from the global list, they are not removed from the scheduler.
Because of this, SIP register attempts continue to be sent
out for the item even though it may no longer be in the .conf.

(closes issue #15295)
Reported by: amorsen

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201344 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-17 15:20:26 +00:00
David Vossel 9a66b1dcdf fix issue with build_contact introduced by the "SIP trasnport type issues" commit
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-16 22:29:30 +00:00
Kevin P. Fleming f1dc620467 Enable applications to enable/disable digit and tone detection.
Some applications (notably app_fax) do not need digit detection nor FAX tone
detection while they are running, and if Asterisk is using software DSPs to provide
the detection, this consumes extra CPU cycles that could be better spent on the
actual application. This patch allows applications to query and control the state
of digit and tone detection on a channel, and modifies app_fax to disable them
while the FAX operations are occurring (and re-enable digit detection afterwards).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201139 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-16 21:10:15 +00:00
David Vossel ee8cdd555f SIP transport type issues
What this patch addresses:
1. ast_sip_ouraddrfor() by default binds to the UDP address/port
reguardless if the sip->pvt is of type UDP or not.  Now when no
remapping is required, ast_sip_ouraddrfor() checks the sip_pvt's
transport type, attempting to set the address and port to the
correct TCP/TLS bindings if necessary.
2.  It is not necessary to send the port number in the Contact
header unless the port is non-standard for the transport type.
This patch fixes this and removes the todo note.
3.  In sip_alloc(), the default dialog built always uses transport
type UDP.  Now sip_alloc() looks at the sip_request (if present)
and determines what transport type to use by default.
4.  When changing the transport type of a sip_socket, the file
descriptor must be set to -1 and in some cases the tcptls_session's
ref count must be decremented and set to NULL.  I've encountered
several issues associated with this process and have created a function,
set_socket_transport(), to handle the setting of the socket type.


(closes issue #13865)
Reported by: st
Patches:
      dont_add_port_if_tls.patch uploaded by Kristijan (license 753)
      13865.patch uploaded by mmichelson (license 60)
      tls_port_v5.patch uploaded by vrban (license 756)
      transport_issues.diff uploaded by dvossel (license 671)
Tested by: mmichelson, Kristijan, vrban, jmacz, dvossel

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200946 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-16 16:03:30 +00:00
Kevin P. Fleming 85e57521ab Accept T.38 re-INVITE responses with invalid SDP versions.
This commit changes the 'incoming SDP version' check logic a bit more; when
'ignoresdpversion' is *not* set for a peer, if we initiate a re-INVITE to
switch to T.38, we'll always accept the peer's SDP response, even if they
don't properly increment the SDP version number as they should. If this situation
occurs, a warning message will be generated suggesting that the peer's
configuration be changed to include the 'ignoresdpversion' configuration option
(although ideally they'd fix their SIP implementation to be RFC compliant).

AST-221


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200689 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-15 20:42:38 +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
Kevin P. Fleming 78ee46f13f Some minor structure size improvements in sip_pvt and sip_peer.
Using the 'pahole' tool, it is now quite easy to see where structure fields
could be organized differently to keep the compiler from having to add
padding to satisfy alignment requirements. These changes reduced the sizes of
sip_pvt and sip_peer by a few bytes each (on 64-bit platforms), and also fixed
a spelling error in a field name.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-15 16:38:32 +00:00
Mark Michelson d224f78dd5 Merged revisions 200513 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r200513 | mmichelson | 2009-06-15 10:21:46 -0500 (Mon, 15 Jun 2009) | 5 lines
  
  Add INFO to our allowed methods so that endpoints know they may send it to us.
  
  AST-223
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200514 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-15 15:22:11 +00:00
Mark Michelson 616e85c95f Fix a crash due to a potentially NULL p->options.
Thanks to mnicholson for pointing it out.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-11 21:17:14 +00:00
Mark Michelson 28fe3938b7 Only try to use the invite_branch on outgoing INVITEs with auth credentials.
I have added a comment to the code to help ease understanding of the logic here
as well.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-10 20:15:48 +00:00
David Vossel 59d93c1e2d CLI NOTIFY sending wrong transport type.
SIP's cli NOTIFY command only used UDP rather than copying the transport type from the peer.

(closes issue #15283)
Reported by: jthurman
Patches:
      sip-notify-tcp-svn199728.patch uploaded by jthurman (license 614)
Tested by: jthurman, dvossel



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-09 20:47:57 +00:00
Mark Michelson 5965e276a7 Fix a deadlock that could occur when setting rtp stats on SIP calls.
(closes issue #15143)
Reported by: cristiandimache
Patches:
      15143.patch uploaded by mmichelson (license 60)
Tested by: cristiandimache



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-08 17:32:04 +00:00
Joshua Colp 5fcf193d7b Correct documentation for the register line, specifically where the domain should be specified.
(closes issue #14367)
Reported by: Nick_Lewis


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198791 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-02 13:48:06 +00:00
Mark Michelson 298d745fb4 Add the ability to execute connected line interception macros.
When connected line updates are received or generated in the middle
of an application call, it is now possible to execute a macro to
manipulate the connected line data. This way, phone numbers may be
manipulated to be more presentable to users, names may be changed 
for...whatever reason, or whatever else needs to be done may be.

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

AST-165



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-01 20:57:31 +00:00
Joshua Colp 6e1bd8aad7 Fix a bug where the Event and Content-Type headers were added twice to outgoing SIP NOTIFY messages.
(closes issue #15239)
Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-01 13:31:27 +00:00
Joshua Colp 5c8626e315 When removing all packets from a dialog we also need to free the data if present.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198248 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-30 02:31:48 +00:00
Joshua Colp 9944bce43c Fix a bug where the default setting did not perform a remote bridge when it should have.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197996 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-29 17:51:06 +00:00
Mark Michelson 14d05f57d7 A few fixes to SIP with regards to connected line updates during transfers.
* Set the invitestate to INV_CALLING when we send a connected line reinvite.
This prevents us from potentially rapid-firing reinvites to a single peer.

* Use the astdb to store a peer's allowed methods. This prevents us from sending
an UPDATE during the interval between startup and the peer's first registration
if the peer does not support the UPDATE method.

* Handle Polycom's method of indicating allowed methods in REGISTER. Instead of
using an Allow header, they place the allowed methods in a methods= parameter
in the Contact header.

ABE-1873



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197959 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-29 15:48:04 +00:00
Mark Michelson 3eab939301 Treat 405 responses the same way we would a 501.
This makes sure that we mark a method as being unallowed if we
receive a 405 response so that we don't continue to try to 
send that same type of message.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197740 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-28 20:17:24 +00:00
Eliel C. Sardanons a109652532 Merged revisions 197562 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r197562 | eliel | 2009-05-28 11:21:32 -0400 (Thu, 28 May 2009) | 13 lines
  
  Use the address we already know when reloading a peer with nat=yes.
  
  If we already have an address for a peer, and we are reloading the sip
  configuration, try to use that address to contact the peer, instead of
  getting it from the Contact.
  
  (closes issue #15194)
  Reported by: ibc
  Patches:
        sip.patch uploaded by eliel (license 64)
        Tested by: manwe
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-28 16:01:48 +00:00
Joshua Colp 318929b75f Merged revisions 197466 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r197466 | file | 2009-05-28 10:44:58 -0300 (Thu, 28 May 2009) | 8 lines
  
  Fix a bug where the flag indicating the presence of rport would get overwritten by the nat setting.
  
  The presence of rport is now stored as a separate flag. Once the dialog is setup and authenticated
  (or it passes through unauthenticated) the proper nat flag is set.
  
  (closes issue #13823)
  Reported by: dimas
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197467 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-28 13:47:45 +00:00
Olle Johansson b6d95bef99 Adding some generic handling of error codes sent to us in replys to requests.
Previously they always set hangupcause 0, which is generally wrong. With this
change, we're setting some generic hangup causes. For 5xx errors, which indicate
some sort of problem with the remote server, we're now setting CONGESTION.

EDVX002


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-27 20:14:00 +00:00
Mark Michelson 83500e9b06 Remove some redundant or unnecessary connected line-related function calls.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196893 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-26 19:50:07 +00:00
Joshua Colp d4efe15c09 Fix a bug where the sip unregister CLI command did not completely unregister the peer.
(closes issue #15118)
Reported by: alecdavis
Patches:
      chan_sip_unregister.diff2.txt uploaded by alecdavis (license 585)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-26 13:43:13 +00:00
David Vossel f50bb3bfa4 SIP set outbound transport type from Registration
In sip.conf the transport option allows for the configuration of what transport types (udp, tcp, and tls) a peer will accept, but only the first type listed was used for outbound connections.  This patch changes this.  Now the default transport type is only used until the peer registers.  When registration takes place the transport type is parsed out of the Contact header.  If the Contact header's transport type is equal to one that the peer supports, the peer's default transport type for outbound connections is set to match the Contact header's type.  If the Contact header's transport type is not present, then the peer's default transport type is set to match the one the peer registered with.  When a peer unregisters or the registration expires, the default transport type for that peer is reset.

(closes issue #12282)
Reported by: rjain
Patches:
      reg_patch_1.diff uploaded by dvossel (license 671)
Tested by: dvossel

(closes issue #14727)
Reported by: pj
Patches:
      reg_patch_3.diff uploaded by dvossel (license 671)
Tested by: pj, dvossel

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-22 21:09:45 +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
Mark Michelson ee4f11cd24 s/it's/its/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-22 16:50:31 +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
Mark Michelson 56903a7485 Get rid of some duplicated code and correct a connected line error.
When receiving a 200 OK response to an INVITE, it was possible to transmit two
connected line updates instead of a single one. Furthermore, the second did not
have the proper information present.

Now the two have been combined into a single update and the correct information
is presented.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@195798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-20 20:45:05 +00:00
Mark Michelson 7b4eeed257 Add basic support for handling connected line-related UPDATE requests.
SIP purists may want to look the other way...

When COLP/CONP support for SIP was committed, there was a condition under 
which Asterisk may transmit a SIP UPDATE in order to communicate the change 
in connected line information. The issue here is that while we could send a 
SIP UPDATE message, we were not prepared to receive such an UPDATE and would 
always responde with a 501 when we received an UPDATE.

The situation was a bit rough. We really want to be able to receive UPDATEs 
having to do with connected line changes, but the amount of effort involved 
in properly supporting RFC 3311 was staggering. This commit represents a 
compromise.

First, it was decided that it is important to only send a SIP UPDATE to 
an endpoint that is able to handle one. So, now we have added parsing of 
the Allow header into SIP. We store the allowed methods on SIP peers so 
that when we communicate with them, we already will know what we can and 
cannot send to them. We will parse the peer's allowed methods when he registers
with us. If the peer is not the type to register with us, but the qualify option 
is enabled, then we will use the response to the OPTIONS request we send 
the peer to determine the peer's allowed methods. When the peer's registration 
expires, or when qualify deems the peer to be unreachable, we clear the allowed 
methods from the peer.

For an actual call, we will copy the peer's allowed methods to the sip_pvt 
representing the call leg. If we are communicating with an endpoint which is 
not a peer, then we will just parse the Allow header from the first message 
we receive during the call and store the information in the sip_pvt.

If, during communication with a peer, we receive a 501 response, then we will 
make sure to save the fact that we cannot use that method when communicating 
with that peer.

Now, with all that infrastructure in place, the only actual place we use this 
information currently is when attempting to send a connected line change using 
an UPDATE request. If we cannot send the change immediately using an UPDATE, 
we will set the SIP_NEEDREINVITE flag so that we can send a REINVITE as soon 
as it is allowed.

The second part of the changes here is for Asterisk to accept UPDATE requests 
that have connected line changes. Since we are not fully supporting RFC 3311, 
Asterisk will NOT place the UPDATE method in Allow headers it sends. Instead, 
if you are communicating with what you know to be another Asterisk box, you may 
set the rpid_update parameter in sip.conf so that we will send UPDATEs to that 
Asterisk box. When we send a connected line update, we set a custom header 
called "X-Asterisk-rpid-update."

On the receiving end, if Asterisk receives an UPDATE that does not have the 
"X-Asterisk-rpid-update" header present, then Asterisk will respond with a 501 
since media-changing UPDATEs are not supported. We should never get such 
UPDATEs, since as was stated earlier, Asterisk does not put UPDATE in its Allow
header. If the custom header is present in the received UPDATE, though, then we 
will check the incoming request for connected line updates and queue the update
on the channel where the change occurred.

ABE-1840
ABE-1822



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@195589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-19 20:59:38 +00:00
Joshua Colp 99a1e0ce01 Merged revisions 195448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r195448 | file | 2009-05-19 11:41:45 -0300 (Tue, 19 May 2009) | 7 lines
  
  Fix a bug where direct RTP setup would partially occur even when disabled if the calling channel was answered.
  
  (issue #13545)
  Reported by: davidw
  (issue #14244)
  Reported by: mbnwa
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@195449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-19 14:43:54 +00:00
Joshua Colp 9f4e8a5bda Fix a bug where specifying an empty outboundproxy would cause packets to get sent to ourself.
(closes issue #15106)
Reported by: timeshell


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@195089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-18 13:36:17 +00:00
Mark Michelson 64c6397bd0 Merged revisions 194484 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r194484 | mmichelson | 2009-05-14 17:17:55 -0500 (Thu, 14 May 2009) | 24 lines
  
  Fix a race condition where a reinvite could trigger a 482 response.
  
  The loop detection/spiral detection code in chan_sip used the owner
  channel's state as a criterion for determining if the incoming INVITE
  is a looped request. The problem with this is that the INVITE-handling
  code happens in a different thread than the thread that marks the owner
  channel as being up. As a result, if a reinvite were to come in very quickly,
  say from another Asterisk on the same LAN, it was possible for the reinvite
  to arrive before the owner channel had been set to the up state.
  
  This patch corrects the problem by using the invitestate of the sip_pvt
  instead, since that can be guaranteed to be set correctly by the time
  the reinvite arrives. Since there is a switch statement further in the
  INVITE-handling code, the AST_STATE_RINGING state also checks the invitestate
  of the sip_pvt in case we should actually be treating the channel as if it were
  up already.
  
  (closes issue #12215)
  Reported by: jpyle
  Patches:
        12215_confirmed.patch uploaded by mmichelson (license 60)
  Tested by: lmadsen
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194496 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-14 22:20:51 +00:00
Mark Michelson 56275abb32 Update spiral support in trunk and 1.6.X to match what is in 1.4.
In 1.4, a SIP spiral is treated the same way as a call forward. This
works much better than what is currently in trunk and 1.6.X. The code
in trunk and 1.6.X did not create a new call to the recipient of the spiral,
instead trying to continue the same call. In addition to just being plain
wrong, this also had the side effect of only being able to spiral calls
to other SIP channels.

With this in place, as long as call forwards are honored, SIP spirals
will work properly. This means that it will work for outbound calls
made  by the Queue, Dial, and Page applications. For originated calls and
spool calls, however, the spiral will not work properly until a generic
call forward mechanism is introduced into Asterisk.

(relates to issue #13630)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-12 20:28:13 +00:00
David Vossel fbad7a508d TCP not matching valid peer.
find_peer() does not find a valid peer when using pvt->recv as the sockaddr_in argument.  Because of the way TCP works, the port number in pvt->recv is not what we're looking for at all.  There is currently only one place that find_peer searches for a peer using the sockaddr_in argument.  If the peer is not found after using pvt->recv (works for UDP since the port number will be correct), a temp sockaddr_in struct is made using the Contact header in the sip_request.  This has the correct port number in it.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-08 20:32:51 +00:00
Tilghman Lesher 01e5a86e1a Merged revisions 192932 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r192932 | tilghman | 2009-05-07 11:29:08 -0500 (Thu, 07 May 2009) | 10 lines
  
  Eliminate repetition of fullcontact during reconstruction.
  If the fullcontact field appears in both the sippeers and the
  sipregs table, then during reconstruction of the field, it will
  otherwise be doubled.
  (closes issue #14754)
   Reported by: Alexei Gradinari
   Patches: 
         20090506__bug14754.diff.txt uploaded by tilghman (license 14)
   Tested by: lmadsen
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192933 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-07 16:43:56 +00:00
Joshua Colp 19916d118d Merged revisions 192633 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r192633 | file | 2009-05-06 10:30:51 -0300 (Wed, 06 May 2009) | 7 lines
  
  Update some old logic to stop both begin and end DTMF frames from reaching the core if rfc2833 is not enabled.
  
  (closes issue #15036)
  Reported by: dimas
  Patches:
        v1-15036.patch uploaded by dimas (license 88)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192634 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-06 13:34:35 +00:00
Richard Mudgett 7019ff68db Fixed crashes from issue8824 review board channel locking changes.
The local struct ast_party_connected_line connected_caller variable
was uninitialized when the copy function was called.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192590 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-05 20:54:07 +00:00
Joshua Colp 2e7c1e3613 Fix a bug with setting t38pt_udptl at the user or peer level.
If an incoming call authenticated as a user or peer and t38pt_udptl was
not set to yes in general then no UDPTL session would be present and any
T38 related things would fail. This commit changes it so that if after
authenticating T38 is enabled but no UDPTL session is present one will be
created.

(issue AST-215)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-05 14:22:47 +00:00
Tilghman Lesher a3229fd3e2 Merged revisions 191559 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r191559 | tilghman | 2009-05-01 15:00:23 -0500 (Fri, 01 May 2009) | 6 lines
  
  SIP Response 410 maps to cause code 22 (or 23), not 1.
  (closes issue #14993)
   Reported by: BigJimmy
   Patches: 
         causepatch uploaded by BigJimmy (license 371)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-01 20:01:21 +00:00
David Vossel ca138fc807 Consistent SSL/TLS options across conf files
ast_tls_read_conf() is a new api call for handling SSL/TLS options across all conf files.  Before this change, SSL/TLS options were not consistent.  http.conf and manager.conf required the 'ssl' prefix while sip.conf used options with the 'tls' prefix.  While the options had different names in different conf files, they all did the exact same thing.  Now, instead of mixing 'ssl' or 'tls' prefixes to do the same thing depending on what conf file you're in, all SSL/TLS options use the 'tls' prefix.  For example.  'sslenable' in http.conf and manager.conf is now 'tlsenable' which matches what already existed in sip.conf. Since this has the potential to break backwards compatibility, previous options containing the 'ssl' prefix still work, but they are no longer documented in the sample.conf files.  The change is noted in the CHANGES file though.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-29 14:39:48 +00:00
David Vossel 8f0b88c8c8 TLS/SSL private key option
Adds option to specify a private key .pem file when configuring TLS or SSL in AMI, HTTP, and SIP.  Before this, the certificate file was used for both the public and private key.  It is possible for this file to hold both, but most configurations allow for a separate private key file to be specified.  Clarified in .conf files how these options are to be used.  The current conf files do not explain how the private key is handled at all, so without knowledge of Asterisk's TLS implementation, it would be hard to know for sure what was going on or how to set it up.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190545 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24 21:22:31 +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
Joshua Colp f314c5f13f Fix nat setting on RTP instances.
(closes issue #14827)
Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190421 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24 13:49:03 +00:00
Russell Bryant bbcf30787d Merged revisions 190356 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r190356 | russell | 2009-04-23 16:07:07 -0500 (Thu, 23 Apr 2009) | 2 lines

Remove a bogus ast_channel_unlock().

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190357 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-23 21:13:07 +00:00
David Vossel 00d7c4fefc Fixes segfault when switching UDP to TCP in sip.conf after reload.
If transport in sip.conf is switched from UDP to TCP, Asterisk segfaults right after issuing a sip reload.  The problem is the socket type is changed to TCP but the fd may still be present for UDP.  Later, when the TCP session should be created or set using an existing one, it isn't because the old file descriptor is still present.  Now every time transport is changed during a sip.conf reload, the file descriptor is set to -1, signifying it must be created or found.

(closes issue #14727)
Reported by: pj
Tested by: dvossel

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189771 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-21 20:28:37 +00:00
Joshua Colp b5b18b7810 Fix a bug with non-UDP connections that caused dialogs to not get freed.
This issue crept up because of a reference count issue on non-UDP based dialogs.
The dialog reference count was increased when transmitting a packet reliably but never
decreased. This caused the dialog structure to hang around despite being unlinked from
the dialogs container.

(closes issue #14919)
Reported by: vrban


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-20 17:05:15 +00:00
Mark Michelson 4bf5e1b805 Prevent a crash when SIP blonde transferring an unbridged call.
If one attempts to use the attended transfer button on a SIP phone
to transfer an unbridged call (such as a call to an IVR) but hangs
up while the target of the transfer is still ringing, we need to not
crash.

The problem was that ast_hangup was called from outside the channel
thread.

AST-211



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189097 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-17 20:20:23 +00:00
Joshua Colp 6d2b446384 Merged revisions 188946 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r188946 | file | 2009-04-17 11:41:25 -0300 (Fri, 17 Apr 2009) | 15 lines
  
  Fix a bug where a value used to create the channel name was bogus.
  
  This commit fixes the scenario where an incoming call is authenticated
  using a peer entry. Previously the channel name was created using either
  the username setting from the sip.conf entry or the IP address that the
  call came from. Now the channel name will be created using the peer name
  itself. This commit will not change the way the channel name is generated
  for users or friends.
  
  (closes issue #14256)
  Reported by: Nick_Lewis
  Patches:
        chan_sip.c-chname.patch uploaded by Nick (license 657)
  Tested by: Nick_Lewis, file
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-17 14:44:56 +00:00
Tilghman Lesher ecc3c7c4a6 Merged revisions 188835 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r188835 | tilghman | 2009-04-16 16:41:13 -0500 (Thu, 16 Apr 2009) | 7 lines
  
  Only update realtime, if global option rtupdate != false
  (closes issue #14885)
   Reported by: deepesh
   Patches: 
         20090413__bug14885.diff.txt uploaded by tilghman (license 14)
   Tested by: deepesh
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188836 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-16 21:57:37 +00:00
David Vossel a9895c6833 SIP state notify reorganization
What I've done here is simply break up how a state NOTIFY is built.  Originally both the XML and sip header information were built within the same function.  While this does work, it does not allow for the creation of multipart/related message bodies that can contain multiple XML entries with only one sip header.  Now a separate function builds the XML for each notify.  This patch also makes maintaining and modifying state notifications in the future much less of a pain.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-16 19:30:23 +00:00
Joshua Colp 84fd750c10 Fix a bug with the change I made yesterday to outbound proxy support.
Per discussion with oej on IRC we need the actual IP address, not the
outbound proxy IP address, in the sa field. This change matches the already
existing code for all other uses of the outbound proxy setting.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188247 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-14 13:14:21 +00:00
Joshua Colp 75dba8ca1d Fix a bug where using an outbound proxy would cause the local address to be 127.0.0.1.
Copy the outbound proxy IP address into the SIP dialog structure as the IP address we will
be sending to. This has to be done because the logic that determines what local IP address to use
in the SIP messages is not aware of an outbound proxy being in place. It only knows what IP address
we are sending to.

(closes issue #12006)
Reported by: mnicholson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-13 16:28:06 +00:00
Joshua Colp 8e4b5df187 Fix some uninitialized memory notices that appeared under valgrind.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-10 18:02:44 +00:00
Tilghman Lesher 15e040d3f3 Ensure pvt is not NULL before dereferencing it.
(closes issue #14784)
 Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187674 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-10 15:59:40 +00:00
Mark Michelson 4d74179f20 Add a new option, mwi_from, to sip.conf.
This allows for you to change the From header for outgoing MWI
NOTIFY requests. Prior to this, the best you could do was to
set a callerid in the general section of sip.conf. The problem
was that this was used for all outbound requests, not just
MWI NOTIFY requests.

AST-201



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 21:06:26 +00:00
Mark Michelson e53bd994d0 Merged revisions 187484 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r187484 | mmichelson | 2009-04-09 13:51:20 -0500 (Thu, 09 Apr 2009) | 18 lines
  
  Handle a SIP race condition (reinvite before an ACK) properly.
  
  RFC 5047 explains the proper course of action to take if a 
  reINVITE is received before the ACK from a previous invite
  transaction. What we are to do is to treat the reINVITE as
  if it were both an ACK and a reINVITE and process it normally.
  
  Later, when we receive the ACK we had been expecting, we will
  ignore it since its CSeq is less than the current iseqno of
  the sip_pvt representing this dialog.
  
  (closes issue #13849)
  Reported by: klaus3000
  Patches:
        13849_v2.patch uploaded by mmichelson (license 60)
  Tested by: mmichelson, klaus3000
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 18:58:41 +00:00
Tilghman Lesher 7304ac444e Allow '/' in username portion of register; this is a regression.
(closes issue #14668)
 Reported by: Netview


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 17:20:49 +00:00
Tilghman Lesher 3a220874cc Merged revisions 187362 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r187362 | tilghman | 2009-04-09 11:38:37 -0500 (Thu, 09 Apr 2009) | 3 lines
  
  Permit zero-length text messages in SIP.
  (Related to an issue posted to the -users list, subject "AEL2, BASE64_DECODE and hexadecimal")
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 16:39:43 +00:00
Joshua Colp abcc0b9397 Add support for allowing the channel driver to handle transcoding.
This was accomplished using a set of options and the setoption channel callback.
The core calls into the channel driver using these options and the channel driver
either returns success or failure.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187360 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 16:19:35 +00:00
Russell Bryant c4058865dd Remove duplicate prototype for temp_peer().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-08 17:51:35 +00:00
Russell Bryant 0fab071d13 Update some comments and resolve potential memory corruption in chan_sip.
While browsing chan_sip the other day, I noticed this dangerous code in
dialog_needdestroy().  This function is an ao2_callback.  It is absolutely
_not_ okay to unlock the container from within this function.  It's also not
clear why it was useful.  Given that it could cause memory corruption, I have
removed it.

There was also a TODO comment left describing a potential implementation of
an improvement to the needdestroy handling.  I'm not convinced that what was
described is the best choice here, so I have briefly described the way that
this function is used today that could be improved.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186928 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-08 12:35:57 +00:00
Tilghman Lesher b289374dfe Add lastms to the require API call.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186899 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-08 05:06:22 +00:00
Mark Michelson 21dd185512 Fix bad merge from fix for issue 13867.
(closes issue #14686)
Reported by: davidw




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186837 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-08 00:01:49 +00:00
Joshua Colp 369ca78928 Fix problem when authenticating a non-RTP dialog.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186653 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-06 17:03:07 +00:00
Joshua Colp 4eaa651a8a Add support for changing the outbound codec on a SIP call using
a dialplan variable.

This adds a dialplan variable (SIP_CODEC_OUTBOUND) which controls
the codec offered for an outgoing SIP call. This is much like the
SIP_CODEC dialplan variable and has the same restrictions. The codec
set must be one that is configured for the call.

(closes issue #13243)
Reported by: samdell3
Patches:
      13243.diff uploaded by file (license 11)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186624 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-06 16:15:30 +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
Joshua Colp 63de834395 Merge in the RTP engine API.
This API provides a generic way for multiple RTP stacks to be
integrated into Asterisk. Right now there is only one present, res_rtp_asterisk,
which is the existing Asterisk RTP stack. Functionality wise this commit
performs the same as previously. API documentation can be viewed in the
rtp_engine.h header file.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186078 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-02 17:20:52 +00:00
Tilghman Lesher 08971ce205 Merged revisions 186059 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
  r186059 | tilghman | 2009-04-02 12:09:13 -0500 (Thu, 02 Apr 2009) | 9 lines
  
  Merged revisions 186056 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.2
  
  ........
    r186056 | tilghman | 2009-04-02 12:02:18 -0500 (Thu, 02 Apr 2009) | 2 lines
    
    Fix for AST-2009-003
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-02 17:10:28 +00:00
David Vossel 729f225225 Merged revisions 185845 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r185845 | dvossel | 2009-04-01 14:02:00 -0500 (Wed, 01 Apr 2009) | 10 lines
  
  Fixes issue with dropped calles due to re-Invite glare and re-Invites never executing after a 491
  
  Acknowledgement for 491 responses were never being processed because it didn't match our pending invite's seqno.  Since the ACK was never processed, the 491 frame would continue to be retransmitted until eventually the call was dropped due to max retries.  Now during a pending invite, if we receive another invite, we send an 491 and hold on to that glare invite's seqno in the "glareinvite" variable for that sip_pvt struct.  When ACK's are received, we first check to see if it is in response to our pending invite, if not we check to see if it is in response to a glare invite.  In this case, it is in response to the glare invite and must be dealt with or the call is dropped.  I've changed the wait time for resending the re-Invite after receving a 491 response to comply with RFC 3261.  Before this patch the scheduled re-Invite would only change a flag indicating that the re-Invite should be sent out, now it actually sends it out as well. 
  
  (closes issue #12013)
  Reported by: alx
  
  Review: http://reviewboard.digium.com/r/213/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@185846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-01 19:03:32 +00:00
Joshua Colp aa056be678 Merged revisions 184947 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r184947 | file | 2009-03-30 11:35:47 -0300 (Mon, 30 Mar 2009) | 14 lines
  
  Improve our handling of T38 in the initial INVITE from a device.
  
  We now answer with matching media streams to what is requested. If an INVITE
  is received with both a T38 and RTP media stream this means we answer with both.
  For any outgoing calls created as a result of this inbound one no T38 is requested
  in the initial INVITE. Instead if we start receiving udptl packets we trigger a
  reinvite on the outbound side.
  
  (closes issue #12437)
  Reported by: marsosa
  Tested by: pinga-fogo, okrief, file, afu
  
  Review: http://reviewboard.digium.com/r/208/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184948 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-30 14:37:47 +00:00
Joshua Colp 0580121cee Merged revisions 184565 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r184565 | file | 2009-03-27 10:06:45 -0300 (Fri, 27 Mar 2009) | 9 lines
  
  Fix an issue where nat=yes would not always take effect for the RTP session on outgoing calls.
  
  If calls were placed using an IP address or hostname the global nat setting was copied over
  but was not set on the RTP session itself. This caused the RTP stack to not perform symmetric RTP
  actions.
  
  (closes issue #14546)
  Reported by: acunningham
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184566 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-27 13:15:26 +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
Joshua Colp 9ae51a21c0 Fix issue with a T38 reinvite being sent even if not configured to do so.
If we receive a T38 request negotiate control frame we should only attempt to do so
if the option is enabled on the dialog.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184280 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-25 19:22:06 +00:00
David Vossel da2230adf0 SIP preferred codec only feature
Added an option to respond to a SIP invite with only the single most preferred joint codec.  This limits the options of what codecs the other side can use.

(closes issue #12485)
Reported by: bamby
Review: http://reviewboard.digium.com/r/206/




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183995 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-24 20:01:29 +00:00
Mark Michelson 7ed6354989 Fix chan_sip so it builds.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183555 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-20 16:25:17 +00:00
Mark Michelson abb71e3d55 Merged revisions 183115 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r183115 | mmichelson | 2009-03-19 11:04:02 -0500 (Thu, 19 Mar 2009) | 14 lines
  
  Fix an issue where cancelled outgoing SIP calls would erroneously report the device as "in use."
  
  A user was having an issue where if an outgoing SIP call was canceled, the SIP device
  would remain in use if we had not received any response to the initial INVITE we sent out.
  The SIP device would remain in use until the autocongestion timer was exhausted.
  
  I tracked down the cause of this to be the section of code I am removing here. I asked several
  people what the purpose of this code was meant to be, but no one could give me any sort of
  answer as to why this was here. The person who was having this issue has been using this patch
  for several months and it has stopped the problems they have had.
  
  AST-196
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183117 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 16:07:54 +00:00
Joshua Colp 12bd92898d Improve our triggering of a T38 switchover internally when triggered by a received reinvite.
Previously we reached across the channel bridge to get the other party's SIP dialog
structure in order to trigger an outgoing reinvite. This is extremely dangerous to do
and only works if bridged to another SIP channel. This patch changes this to use the
T38 control frame method of requesting a switchover. This change also causes the SIP
channel driver to propogate back whether the switchover worked or not instead of blindly
accepting the incoming T38 reinvite.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183108 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 15:37:23 +00:00
Joshua Colp a6734b5a95 Fix an issue with requesting a T38 reinvite before the call is answered.
The code responsible for sending the T38 reinvite did not check if an INVITE was
already being handled. This caused things to get confused and the call to fail.
The code now defers sending the T38 reinvite until the current INVITE is done being
handled.

(issue AST-191)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182022 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-13 17:25:09 +00:00
Kevin P. Fleming 87a8295303 improve a bit of suboptimal code
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181985 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-13 16:55:38 +00:00
Mark Michelson 593d643d24 Merged revisions 181768 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181768 | mmichelson | 2009-03-12 13:29:48 -0500 (Thu, 12 Mar 2009) | 22 lines
  
  Properly send a 487 on an INVITE we have not responded to if we receive a BYE.
  
  If we receive an INVITE from an endpoint and then later receive a BYE from that
  same endpoint before we have sent a final response for the INVITE, then we need
  to respond to the INVITE with a 487. 
  
  There was logic in the code prior to this commit which seemed to exist solely to 
  handle this situation, but there was one condition in an if statement which 
  was incorrect. The only way we would send a 487 was if the sip_pvt had no owner
  channel. This made no sense since we created the owner channel when we received
  the INVITE, meaning that the majority of the time we would never send the 487.
  The 487 being sent should not rely on whether we have created a channel. Its
  delivery should be dependent on the current state of the initial INVITE transaction.
  With this commit, that logic is now correctly in place.
  
  (closes issue #14149)
  Reported by: legranjl
  Patches:
        14149.patch uploaded by mmichelson (license 60)
  Tested by: legranjl
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-12 18:30:58 +00:00
Joshua Colp 1fc574dbf7 Merged revisions 181328 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181328 | file | 2009-03-11 14:22:52 -0300 (Wed, 11 Mar 2009) | 14 lines
  
  Fix issue where an attended transfer could not be completed under a rare scenario.
  
  When completing an attended transfer chan_sip does a check to make sure the extension
  in the URI portion of the Refer-To header is a local valid extension. We don't actually
  need to check this since we know for sure the other channel is already up and talking to
  the extension. Some devices do not put the extension in the Refer-To header either, which
  can cause the extension check to fail. We now no longer do this check if it is an attended
  transfer.
  
  (closes issue #14628)
  Reported by: sverre
  Patches:
        14628.diff uploaded by file (license 11)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181345 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 17:26:40 +00:00
Joshua Colp 60d58b8d15 Merged revisions 181295 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181295 | file | 2009-03-11 13:36:50 -0300 (Wed, 11 Mar 2009) | 9 lines
  
  Fix a problem with inband DTMF detection on outgoing SIP calls when dtmfmode=auto.
  
  When dtmfmode was set to auto the inband DTMF detector was not setup
  on outgoing SIP calls. This caused inband DTMF detection to fail.
  The inband DTMF detector is now setup for both dtmfmode inband and auto.
  
  (closes issue #13713)
  Reported by: makoto
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181296 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 16:40:48 +00:00
Jeff Peeler 58cf8b69da Fix malloc debug macros to work properly with h323.
The main problem here was that cstdlib was undefining free thereby causing the
proper debug macros to not be used. ast_h323.cxx has been changed to call
ast_free instead to avoid the issue. 

A few other issues were addressed:
- There were a few instances of functions improperly passing ast_free instead
of ast_free_ptr.
- Some clean up was done to avoid the debug macros intentionally being redefined.
(copied below from Kevin's commit, appreciate the help)
- disable astmm.h from doing anything when STANDALONE is defined, which is used
by the tools in the utils/ directory that use parts of Asterisk header files in
hackish ways; also ensure that utils/extconf.c and utils/conf2ael.c are
compiled with STANDALONE defined.

(closes issue #13593)
Reported by: pj



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181135 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 04:06:44 +00:00
Mark Michelson c1e2636be7 Add missing comment that quotes RFC 3891
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181033 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 00:49:00 +00:00
Mark Michelson 85a5f68fe1 Merged revisions 181029,181031 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181029 | mmichelson | 2009-03-10 19:30:26 -0500 (Tue, 10 Mar 2009) | 9 lines
  
  Fix incorrect tag checking on transfers when pedantic=yes is enabled.
  
  (closes issue #14611)
  Reported by: klaus3000
  Patches:
        patch_chan_sip_attended_transfer_1.4.23.txt uploaded by klaus3000 (license 65)
  Tested by: klaus3000
........
  r181031 | mmichelson | 2009-03-10 19:32:40 -0500 (Tue, 10 Mar 2009) | 3 lines
  
  Remove unused variables.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 00:46:47 +00:00
Russell Bryant 6c9f6d33c7 Resolve object matching issues related to the removal of the sip_user object.
Previously, chan_sip had both sip_peer and sip_user objects in memory.  A
patch went in to remove sip_user to simplify the code, since everything
could be done with just sip_peer.  This patch resolves some regressions
found that were introduced by those changes.

This code comes from svn/asterisk/team/group/sip-object-matching/.

Here is a list of the changes that have been made:

1) When doing a match by name with the find_peer() function, make it much
   easier to specify which objects should be matched by having a parameter
   that specifies exactly which object types should be considered.  Also,
   update find_by_name() to handle this parameter.  Finally, update all
   code to use the new option values.

2) When looking up an object for an outbound request by name, consider
   peers only.  (create_addr())

3) Only match peers on an incoming registration request.

4) When doing authentication (except for SUBSCRIBE), look up users
   by name, instead of all objects by name.
   
5) When doing authentication (except for SUBSCRIBE), after looking for
   a user by name, look for a peer by IP address, instead of all objects
   by IP address.

6) When handling the SIP qualify CLI command or manager action, look for
   a peer by name, instead of any object by name.

7) When handling the SIP unregister CLI command, look for a peer by name,
   instead of any object by name.

9) In sip_do_debug_peer(), search for a peer by name, instead of any object
   by name.

9) When handling the SIPPEER() dialplan function, search for a peer by name,
   instead of any object by name.

10) In the following session timer related functions, st_get_se(),
    st_get_refresher(), and st_get_mode(), when looking for an object for a
    given sip_pvt using pvt->peername, look for a peer by name, instead of any
    object by name.

11) Fix build_peer() to properly handle the case where separate type=peer and
    type=user entries were specified in sip.conf.

(closes issue #14505)
Reported by: lmadsen

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@180261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-04 21:01:05 +00:00
Mark Michelson 3a14487abf Allow for "magic" pickups to work when we wish to ignore the context
When the subscription context for a call pickup subscription differs
from the context of the call pickup target, there's not an easy way
to divine what context should be used for the pickup. The way to work
around this is to use PICKUPMARK as the context for the pickup.

This has been documented in the sip.conf.sample file

(ABE-1708)

closes issue #14567
submitted by: alecdavis


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@180155 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-04 17:03:32 +00:00
Olle Johansson f000d5bb0f Please prefix default values with DEFAULT
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-03 15:13:42 +00:00
Mark Michelson c9252cbaf0 Properly free memory and remove scheduler entries when a transmission failure occurs.
Previously, only the "data" field of the sip_pkt created during __sip_reliable_xmit 
was freed when XMIT_ERROR was returned by __sip_xmit. When retrans_pkt was called,
this inevitably resulted in the reading and writing of freed memory.

XMIT_ERROR is a condition meaning that we don't want to attempt resending the packet
at all. The proper action to take is to remove the scheduler entry we just created,
free the packet's data as well as the packet itself, and unlink it from the list of
packets on the sip_pvt structure.

(closes issue #14455)
Reported by: Nick_Lewis
Patches:
      14455.patch uploaded by mmichelson (license 60)
Tested by: Nick_Lewis



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179219 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-01 21:45:08 +00:00
Joshua Colp 9ccad1406b Merged revisions 178205 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r178205 | file | 2009-02-24 11:16:07 -0400 (Tue, 24 Feb 2009) | 9 lines
  
  Skip check for extension when subscribing for MWI.
  
  Since the remote side is not actually subscribing to a specific extension when
  subscribing for MWI just skip the check to see if the extension exists. They can't use it
  to specify the mailbox either since we require configuration of that in sip.conf
  
  (closes issue #14531)
  Reported by: festr
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@178213 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-24 15:18:38 +00:00
Tilghman Lesher bafd3372cf On update, test against the existence of sipregs.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177944 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-21 15:59:49 +00:00
Michiel van Baak d9eb973a3d make chan_sip.c compile on OpenBSD again.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177849 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-21 12:22:32 +00:00
Jeff Peeler 138f3de410 Set sip_request ast_str data to NULL so ast_str_copy allocates space properly
in copy_request

(issue #14478)
Reported by: erik_dedecker



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177624 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-20 00:35:53 +00:00
Joshua Colp 2ff89e817e Fix ordering of output for a ChannelUpdate manager event.
(closes issue #14497)
Reported by: vinsik
Patches:
      chan_update_fix-chan_sip.c.diff uploaded by vinsik (license 623)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177005 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-18 17:11:52 +00:00
Dwayne M. Hubbard 8f8f4adf7d T38 faxdetect should jump to the 'fax' extension for incoming calls only
The previous implementation of T38 faxdetect resulted in both sides of the
call jumping to a fax extension when both sides had 't38pt_udptl=yes' and
'faxdetect=yes' in sip.conf and a 'fax' extension in the current context.
This revision will jump to a 'fax' extension on incoming calls only.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-18 02:55:12 +00:00
Dwayne M. Hubbard e28b2b52b2 create a UDPTL structure in create_addr_from_peer() if it does not already exist for T38
This is required to create a UDPTL structure in create_addr_from_peer() to handle the
scenario where 't38pt_udptl=yes' is not defined in the [general] section of sip.conf but 
is defined the peer's context.  I tested this patch by enabling t38pt_udptl in the 
[general] section on one system and only enabling t38pt_udptl in a peer's context on
the system sending a fax.  Without the patch, the sending system will fail to initiate
T38 negotiation with the warning message, "No way to add SDP without an UDPTL structure".
When this patch is applied the sending side will successfully initiate T38 negotiation.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176705 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 21:59:38 +00:00
Tilghman Lesher ef94685d32 In this version, we can combine the queries, because we support dropping
nonexistent columns.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176501 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 14:39:36 +00:00
Tilghman Lesher 274c71e6ae Merged revisions 176426 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r176426 | tilghman | 2009-02-16 18:49:22 -0600 (Mon, 16 Feb 2009) | 10 lines
  
  After a 'sip reload', qualifies for realtime peers weren't immediately
  restarted, instead waiting until the next registration.  We're now
  caching the qualify across a reload/restart and starting the qualify
  immediately upon loading the peer.
  (closes issue #14196)
   Reported by: pdf
   Patches: 
         20090120__bug14196_1.4.diff.txt uploaded by pdf (license 663)
   Tested by: pdf
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176459 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 01:58:39 +00:00
Joshua Colp 8d00e7a6ed Merged revisions 176029 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r176029 | file | 2009-02-16 11:33:53 -0400 (Mon, 16 Feb 2009) | 9 lines
  
  Don't have the Via header stored as a stringfield as it can change often during the lifetime of a dialog.
  
  This issue crept up with subscriptions on the AA50. When an outgoing NOTIFY is sent a new branch value
  is created and the Via header is changed to reflect it. Since this was a stringfield a new spot in the
  pool was used for the value while the old was left untouched/unused. If the current pool was full a new
  pool was created. This would cause memory usage to increase steadily.
  
  (issue #AA50-2332)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-16 15:36:19 +00:00
Michiel van Baak 115c6abef4 Merged revisions 175921 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r175921 | mvanbaak | 2009-02-16 00:37:03 +0100 (Mon, 16 Feb 2009) | 3 lines
  
  fix mis-spelling of the word registered.
  Reported by De_Mon on #asterisk-dev.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175952 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-16 00:26:59 +00:00
Russell Bryant ca9d3b8ac9 Fix a number of problems with ast_sched_report().
1) It had numerous coding guidelines violations with regards to formatting.

2) It allocated memory using ast_calloc() that was never freed.

3) It didn't check for failure from the allocation.

4) It used sprintf() and strcat() to build the result, doing zero checking to
   prevent writing past the end of the provided buffer.

The function also lacks API documentation, but that has not been addressed in
this commit.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175829 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-15 20:56:27 +00:00
Olle Johansson c9a8142e58 Merged revisions 175777 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r175777 | oej | 2009-02-15 20:48:38 +0100 (Sön, 15 Feb 2009) | 2 lines

Make sure that the debug line is not printed on debug level 0

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-15 20:18:27 +00:00
Kevin P. Fleming 2a53f2ec98 Add basic (passthrough, playback, record) support for ITU G.722.1 and G.722.1C (also known as Siren7 and Siren14)
This patch adds passthrough, file recording and file playback support for the codecs listed above, with negotiation over SIP/SDP supported. Due to Asterisk's current limitation of treating a codec/bitrate combination as a unique codec, only G.722.1 at 32 kbps and G.722.1C at 48 kbps are supported.

Along the way, some related work was done:

1) The rtpPayloadType structure definition, used as a return result for an API call in rtp.h, was moved from rtp.c to rtp.h so that the API call was actually usable. The only previous used of the API all was chan_h323.c, which had a duplicate of the structure definition instead of doing it the right way.

2) The hardcoded SDP sample rates for various codecs in chan_sip.c were removed, in favor of storing these sample rates in rtp.c along with the codec definitions there. A new API call was added to allow retrieval of the sample rate for a given codec.

3) Some basic 'a=fmtp' parsing for SDP was added to chan_sip, because chan_sip *must* decline any media streams offered for these codecs that are not at the bitrates that we support (otherwise Bad Things (TM) would result).

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175508 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-13 13:35:24 +00:00
Russell Bryant a741658f58 Remove useless string copy, and make sscanf safe again
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175368 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-12 21:41:01 +00:00
Russell Bryant 768c73160e Avoid using ast_strdupa() in a loop.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-12 20:45:47 +00:00
Joshua Colp 6304c09149 Only decrease inringing count if above zero.
(issue #13238)
Reported by: kowalma


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174710 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-10 20:15:43 +00:00
Joshua Colp 8e6780a5b1 Set the type for the peer structure to be a peer as the default.
(closes issue #14447)
Reported by: triccyx


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-10 17:48:29 +00:00
Joshua Colp bb327036f1 Make the logic for inuse and inringing manipluation match that of 1.4. The old broken logic would reset the values back to 0 during certain scenarios causing the wrong state to be reported.
(closes issue #14399)
Reported by: caspy
(issue #13238)
Reported by: kowalma


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-10 15:37:07 +00:00
Mark Michelson e0b0ae07a3 Fix something I messed up in the merge I just did
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174327 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-09 17:27:32 +00:00
Mark Michelson a02ef73b25 Merged revisions 174282 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r174282 | mmichelson | 2009-02-09 11:11:05 -0600 (Mon, 09 Feb 2009) | 12 lines

Don't do an SRV lookup if a port is specified

RFC 3263 says to do A record lookups on a hostname
if a port has been specified, so that's what we're
going to do. See section 4.2.

(closes issue #14419)
Reported by: klaus3000
Patches:
      patch_chan_sip_nosrvifport_1.4.23.txt uploaded by klaus3000 (license 65)


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174301 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-09 17:20:55 +00:00
Dwayne M. Hubbard 0024ad62ab Merged revisions 174082 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r174082 | dhubbard | 2009-02-06 17:36:03 -0600 (Fri, 06 Feb 2009) | 5 lines

check ast_strlen_zero() before calling ast_strdupa() in sip_uri_headers_cmp()
and sip_uri_params_cmp()

The reporter didn't actually upload a properly-formed patch, instead a 
modified chan_sip.c file was uploaded.  I created a patch to determine the
changes, then modified the suggested changes to create a proper fix.  The
summary above is a complete description of the changes.

(closes issue #13547)
Reported by: tecnoxarxa
Patches:
      chan_sip.c.gz uploaded by tecnoxarxa (license 258)
Tested by: tecnoxarxa

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174084 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-06 23:51:56 +00:00
Joshua Colp 550f7f1e65 Merged revisions 173967-173968 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r173967 | file | 2009-02-06 13:14:15 -0400 (Fri, 06 Feb 2009) | 4 lines
  
  Some clients do not put the call-id for replaces at the beginning, so support it being anywhere in the string.
  (closes issue #14350)
  Reported by: fhackenberger
........
  r173968 | file | 2009-02-06 13:15:01 -0400 (Fri, 06 Feb 2009) | 2 lines
  
  Remove a debug message I put in by accident.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@173974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-06 17:18:35 +00:00
Matthew Nicholson 647b68ec23 Merged revisions 173917 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r173917 | mnicholson | 2009-02-06 10:20:23 -0600 (Fri, 06 Feb 2009) | 7 lines
  
  Limit the addition of the Contact header in SIP responses according to various
  SIP RFCs.
  
  (closes issue #13602)
  Reported by: hjourdain
  Tested by: mnicholson
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@173952 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-06 16:28:19 +00:00
Russell Bryant 326587ebe3 Fix a spelling mistake.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172855 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-02 16:42:58 +00:00
Olle Johansson a9ee30da54 Add a todo. I do need to really check what's going on with this kill-the-user business ;-)
Why do we suddenly have two flags to set peer type?


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-02 10:46:19 +00:00
Olle Johansson 81a3d40c08 Small formatting change
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172817 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-02 10:44:48 +00:00
Olle Johansson 9ea148b260 Add some well-needed improvements to the wishlist in the code, so that we can close
some bug reports. 


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172816 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-02 10:29:07 +00:00
Sean Bright 2af8f59958 The CID lookup feature wasn't actually working properly with dialog-info+xml
supporting devices.  The devices (snoms, specifically) need to receive a SIP
URI instead of just an extension.  This adds that functionality.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172778 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-02 01:41:29 +00:00
Olle Johansson 7ecda45482 Fix "cancel answered elsewhere" through app_queue with members in chan_local.
Also, implement a private cause code (as suggested by Tilghman). This works with
chan_sip, but doesn't propagate through chan_local.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172318 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-29 17:08:22 +00:00
Olle Johansson b79a12e929 - Make sure we set setvar= variables on outbound calls too, not only inbound calls.
- Also, change a function in app.c to return a userful value instead of always returning 0.

Patch by fnordian, changed by Corydon76 and myself.

This does not close the bug report, as fnordian had an additional change we're still discussing.

(related to issue #14059)
Reported by: fnordian
Patches: 
      chan_sip_hfield.patch uploaded by fnordian (license 110)
      20090116__bug14059.diff.txt uploaded by Corydon76 (license 14)
Tested by: fnordian, Corydon76, oej



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-29 13:21:31 +00:00
Olle Johansson 3e144e2a71 Make sure register= line supports both port and expiry at the same time.
(closes issue #14185)
Reported by: Nick_Lewis
Patches: 
      chan_sip.c-expiryrequest6.patch uploaded by Nick (license 657)
Tested by: Nick_Lewis


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172234 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-29 11:19:29 +00:00
Olle Johansson 55782a8dfa Merged revisions 172169 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r172169 | oej | 2009-01-29 09:48:18 +0100 (Tor, 29 Jan 2009) | 16 lines

Make sure that we always add the hangupcause headers. In some cases, the owner was disconnected before we checked for the cause.
This patch implements a temporary storage in the pvt and use that instead.

The code is based on ideas from code from Adomjan in issue #13385 (Add support for Reason: header)
Thanks to Klaus Darillion for testing!

(closes issue #14294)
related to issue #13385

Reported by: klaus3000 and adomjan
Patches: 
      bug14294b.diff uploaded by oej (license 306)
      Based on 20080829_chan_sip.c-q850reason_header.patch uploaded by adomjan (license 487)
Tested by: oej, klaus3000


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172173 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-29 09:18:01 +00:00
Olle Johansson a0a8a4d68e Solving the same issue, but a bit different in trunk...
Merged revisions 171527 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r171527 | oej | 2009-01-27 15:33:20 +0100 (Tis, 27 Jan 2009) | 13 lines

Use the same branch tag in CANCEL as in INVITE

Originally putnopvut implemented some changes in revision 142079 that according to the bug report seemed to have worked then, but somehow fails now.
I guess code, as humans, get old and forget stuff. Anyway, this bug caused CANCEL not to work with picky systems. 

Thanks Fredrik for pointing out where the bug in the SIP messaging was.

(closes issue #14346)
Reported by: oej
Patches: 
      bug14346.diff uploaded by oej (license 306)
Tested by: oej

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@171528 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-27 15:00:19 +00:00
Olle Johansson e9beff5969 Moving generic setting to friends
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@171401 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-26 15:56:13 +00:00
Olle Johansson f35874c3f5 Continue to move variables into the sip_cfg structure to make them easier to handle in the future as a group of settings for a group of devices.
At some point, I want one sip_cfg per domain handled, so we can have "group" settings.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@171400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-26 15:51:00 +00:00
Olle Johansson a6228ccaf3 Just moving around variable declarations so that we have all globals in the same place.
Default setting is set before we activate the channel or at reloads, not where we declare the variable.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@171364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-26 15:11:39 +00:00
Olle Johansson 08640496d1 Merged revisions 171264 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r171264 | oej | 2009-01-26 13:51:53 +0100 (MÃ¥n, 26 Jan 2009) | 9 lines

Don't retransmit 401 on REGISTER requests when alwaysauthreject=yes

(closes issue #14284)
Reported by: klaus3000
Patches: 
      patch_chan_sip_unreliable_1.4.23_14284.txt uploaded by klaus3000 (license 65)
Tested by: klaus3000


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@171326 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-26 13:44:40 +00:00
Joshua Colp a394fe3a7a Merged revisions 170504 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r170504 | file | 2009-01-23 14:04:08 -0400 (Fri, 23 Jan 2009) | 4 lines
  
  Use the on hold flag to see if the call is on hold or not. It is possible that our address for them will still be valid even though they are on hold.
  (closes issue #14295)
  Reported by: klaus3000
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@170505 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-23 18:09:45 +00:00
Mark Michelson 28dc82ea4e Further fix some oddities in sip show users and sip show peers logic
ccesario on IRC pointed out that his sip peers were not displayed
properly when he would issue the command "sip show peers." The problem
was that the onlymatchonip field was used to determine if the endpoint
was a "peer" or "user." The tricky part is that a "friend" is supposed
to be treated as both a "user" and a "peer" but the logic would not allow
"friends" to show up as "peers" since onlymatchonip was set to FALSE
for friends.

I have modified the sip_peer structure to more explicitly keep track of
what type endpoint it is so that the various manager and CLI commands
will display the expected information

Reported by ccesario via IRC
Tested by ccesario



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169791 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-21 21:53:55 +00:00
Mark Michelson 419bb42e04 Convert the character pointers in a sip_request to be pointer offsets
When an ast_str expands to hold more data, any pointers that were pointing
to the data prior to the expansion will be pointing at invalid memory. This
change makes such pointers used in chan_sip.c instead be offsets from the
beginning of the string so that the same math may be applied no matter where
in memory the string resides.

To help ease this transition, a macro called REQ_OFFSET_TO_STR has been added
to chan_sip.c so that given a sip_request and an offset, the string at that
offset is returned.

(closes issue #14220)
Reported by: riksta
Tested by: putnopvut

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-20 20:10:31 +00:00
Terry Wilson 6b32f4600d Fix port :0 added to SIP INVITE URI when outboundproxy used
(closes issue #14233)
Reported by: chris-mac
Patches: 
      asterisk-bug14233.diff.txt uploaded by jamesgolovich (license 176)
Tested by: jamesgolovich, chris-mac, otherwiseguy


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-17 00:03:39 +00:00
Mark Michelson a2ac43cb8a Merged revisions 168975 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r168975 | mmichelson | 2009-01-16 16:42:13 -0600 (Fri, 16 Jan 2009) | 18 lines

Account for possible NULL pointer when we receive a 408 in response to a REGISTER

It may be that by the time we receive a reply to a REGISTER request, the attempt has
timed out and thus the registry structure pointed to by the corresponding sip_pvt has
gone away. This situation was handled properly for a 200 OK response, but the 408
case assumed that the sip_registry struct was non-NULL, thus potentially causing a crash

This commit fixes this assumption and prints out a message to the console if we should
receive a late 408 response to a REGISTER


(closes issue #14211)
Reported by: aborghi
Patches:
      14211.diff uploaded by putnopvut (license 60)
Tested by: aborghi


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168976 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-16 22:43:09 +00:00
Mark Michelson 73694e15f1 Add missing brace
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168732 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-15 20:00:46 +00:00
Mark Michelson 78c440b7ad Fix the compactheaders option in sip.conf
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168728 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-15 19:16:29 +00:00
Mark Michelson 5c9daf4d3d Remove an unneeded condition for line addition to a SIP request/response
In Asterisk 1.4 and 1.6.0, the sip_request structure had a statically
allocated buffer to hold the text of the request. There was a check in the
add_line function to not attempt to write the line into the buffer if we
did not have room for it.

In trunk and Asterisk versions starting with 1.6.1, an expandable ast_str
structure is used to hold the text. Since it may grow to fit an arbitrarily
sized string, this check in add_line is no longer valid.

I found this oddity while attempting to fix issue #14220; however, I do not
believe that this is the fix for that issue since the output supplied by the
reporter did not contain the warning message that would be printed had this
condition been satisfied.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168725 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-15 19:00:06 +00:00
Olle Johansson 8ab629c767 Make sure that we have the same terminology in sip.conf.sample and the source code warning.
Thanks Nick Lewis for pointing this out in the bug tracker.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168712 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-15 18:08:59 +00:00
Olle Johansson 27c1d88021 Add capability to remove added SIP headers *before* INVITE is generated.
(closes issue #14246)
Reported by: klaus3000
Patches: 
      2patch_chan_sip_SIPRemoveHeader_trunk.txt uploaded by klaus3000 (license 65)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-15 13:35:50 +00:00
Mark Michelson b4271327d7 Restore the "sip show users" and "sip show user" CLI commands
(closes issue #14180)
Reported by: amorsen
Patches:
      sip_show_users_161v3.diff uploaded by putnopvut (license 60)
Tested by: blitzrage, amorsen



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168610 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-14 20:13:48 +00:00
Terry Wilson 938191bc19 Merged revisions 168551 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r168551 | twilson | 2009-01-13 12:34:14 -0600 (Tue, 13 Jan 2009) | 7 lines
  
  Don't pass a value with a side effect to a macro
  
  (closes issue #14176)
  Reported by: paraeco
  Patches: 
        chan_sip.c.diff uploaded by paraeco (license 658)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-13 22:22:34 +00:00
Mark Michelson 453b4cb8fb Allow specifying a port number in the user portion of a register => line in sip.conf
With this commit, a register => line in sip.conf may contain a port number in the
"user" section of the line. Please see CHANGES and sip.conf.sample for more
details regarding this.

(closes issue #14198)
Reported by: Nick_Lewis
Patches:
      chan_sip.c-domainport2.patch uploaded by Nick (license 657)
Tested by: Nick_Lewis



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-13 21:18:13 +00:00
Mark Michelson f488a2eec5 Merged revisions 168482 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r168482 | mmichelson | 2009-01-12 08:58:25 -0600 (Mon, 12 Jan 2009) | 5 lines

I am reverting the fix made in revision 168128 (and its upward merges)
after being contacted by Olle Johansson and being shown how this fix is
incorrect. Thanks to Olle for clearing this up for me.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168485 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-12 15:00:00 +00:00
Tilghman Lesher aebe65d9e7 sizeof for a stringfield is 4. Kinda low for reconstructing a field value.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168334 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-10 01:42:45 +00:00
Mark Michelson 9f355bf9fc Merged revisions 168128 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r168128 | mmichelson | 2009-01-09 14:08:04 -0600 (Fri, 09 Jan 2009) | 13 lines

Add check_via calls to more request handlers

INFO, NOTIFY, OPTIONS, REFER, and MESSAGE requests
were not checking the topmost Via to determine where
to send the response. Adding check_via calls to those
request handlers solves this.

(closes issue #13071)
Reported by: baron
Patches:
      check_via.patch uploaded by baron (license 531)
Tested by: baron

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168193 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-09 21:53:26 +00:00
Mark Michelson 5f3f4f0f33 Revert chan_sip changes which were accidentally committed
in revision 167792



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@167888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-08 22:34:52 +00:00
Mark Michelson 454241dd58 Add the average talk time for a queue
This patch adds the functionality to app_queue of calculating
the average amount of time that channels are bridged for a
queue. The algorithm used to calculate the average is the same
exponential average currently used to calculate the average holdtime.
See the CHANGES file to see the methods you may use to view this
information.

(closes issue #13960)
Reported by: coolmig
Patches:
      app_queue.c.diff.trunk-r158840 uploaded by coolmig (license 621)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@167792 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-08 19:48:42 +00:00
Kevin P. Fleming 92b6225abe Merged revisions 167714 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r167714 | kpfleming | 2009-01-08 11:24:21 -0600 (Thu, 08 Jan 2009) | 1 line
  
  remove an unnecessary argument to queue_request()
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@167720 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-08 17:26:03 +00:00
Kevin P. Fleming d5f97b4052 Merged revisions 167620 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r167620 | kpfleming | 2009-01-07 17:32:21 -0600 (Wed, 07 Jan 2009) | 5 lines
  
  When a SIP request or response arrives for a dialog with an associated Asterisk channel, and the lock on that channel cannot be obtained because it is held by another thread, instead of dropping the request/response, queue it for later processing when the channel lock becomes available.
  
  http://reviewboard.digium.com/r/123/
........



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@167700 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-08 16:43:26 +00:00
Mark Michelson 129e8a04e8 Merged revisions 167179 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r167179 | mmichelson | 2009-01-05 10:51:59 -0600 (Mon, 05 Jan 2009) | 41 lines

A couple of changes to T.38 SDP attribute handling

There are some boolean attributes for T.38 such
as T38FaxFillBitRemoval, T38FaxTranscodingMMR, and
T38FaxTranscodingJBIG. By simply being present, we
should treat these as a "true" value. The current
code, however, was requiring a 1 or 0 as the value
of the attribute in order to parse it. This is due
to the fact that there are some T.38 endpoints and
gateways that also transmit this information
incorrectly. This patch follows the "be liberal in
what you accept and strict in what you send"
philosophy by accepting both the correctly- and 
incorrectly-formatted attributes, but only sending
information as it is supposed to be sent.

It was also discovered that a particular type of 
T.38 gateway sends some non-standard T.38 SDP
attributes. Instead of using T38FaxMaxDatagram
and T38MaxBitRate, it used T38MaxDatagram and
T38FaxMaxRate respectively. We now will properly
accept these attributes as well.

Note that there are a lot of patches cited in
the below commit message template. This is
because the person who submitted these patches is
an awesome person and wrote 1.4, 1.6.0, and 1.6.1
variants.

(closes issue #13976)
Reported by: linulin
Patches:
     chan_sip.c.1.4-update1.diff uploaded by arcivanov (license 648)
	 chan_sip.c.1.6.0-update1.diff uploaded by arcivanov (license 648)
	 chan_sip.c.1.6.1-update1.diff uploaded by arcivanov (license 648)
	 chan_sip.c.1.4-relaxedT38_update1.diff uploaded by arcivanov (license 648)
	 chan_sip.c.1.6.0-relaxedT38_update1.diff uploaded by arcivanov (license 648)
	 chan_sip.c.1.6.1-relaxedT38_update1.diff uploaded by arcivanov (license 648)
Tested by: arcivanov


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@167180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-05 16:59:36 +00:00
Terry Wilson 8664b9111a There is no section 22.2.2 in rfc 3261. I believe 26.2.2 is what was meant:
Note that in the SIPS URI scheme, transport is independent of TLS,
      and thus "sips:alice@atlanta.com;transport=tcp" and
      "sips:alice@atlanta.com;transport=sctp" are both valid (although
      note that UDP is not a valid transport for SIPS).  The use of
      "transport=tls" has consequently been deprecated, partly because
      it was specific to a single hop of the request.  This is a change
      since RFC 2543.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166731 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-24 15:10:42 +00:00
Tilghman Lesher 8c2030b489 Allow semicolons and extended characters in user-specified SIP headers.
(closes issue #14110)
 Reported by: gork
 Patches: 
       20081222__bug14110__2.diff.txt uploaded by Corydon76 (license 14)
 Tested by: gork, putnopvut


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-23 20:47:08 +00:00
Joshua Colp 654ea55a65 Numerous documentation updates.
(closes issue #13970)
Reported by: pkempgen
Patches:
      __20081217_cli_usage_fixes.patch.txt uploaded by blitzrage (license 10)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@165792 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-18 21:21:44 +00:00
Joshua Colp 4534957e81 Call proxy_update so that the IP address gets populated. Sending stuff to 0.0.0.0 is silly!
(closes issue #14055)
Reported by: chris-mac


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@165216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-17 19:52:40 +00:00
Matthew Nicholson 91192e30c5 This patch adds a new 'ignoresdpversion' option to sip.conf. When this is
enabled (either globally or for a specific peer), chan_sip will treat any SDP
data it receives as new data and update the media stream accordingly.  By
default, Asterisk will only modify the media stream if the SDP session version
received is different from the current SDP session version.  This option is
required to interoperate with devices that have non-standard SDP session
version implementations (observed by toc on the bug tracker with Microsoft OCS
which always uses 0 as the session version).

http://reviewboard.digium.com/r/94/
(closes issue #13958)
Reported by: toc
Tested by: toc


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@165180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-17 18:49:12 +00:00
Mark Michelson 1d2b4e7a02 Merged revisions 164977 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r164977 | mmichelson | 2008-12-16 17:04:27 -0600 (Tue, 16 Dec 2008) | 7 lines

After looking through SIP registration code most of the day, this
is one of the few things I could find that was just plain wrong.
Even though it probably isn't possible for it to happen, it seems weird
to have code that checks if a pointer is NULL and then immediately dereferences
that pointer if it was NULL.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 23:06:04 +00:00
Terry Wilson 2e59fce6d8 Make a note of the feature request in bug #11157 as per the reporter and oej, and suspend the bug since no one seems to be keen on implementing it any time soon.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164941 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 22:31:47 +00:00
Joshua Colp fd62012a31 Qualify trumps poke per lmadsen.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164814 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 20:47:31 +00:00
Joshua Colp 92a4edc593 Add configuration options for finer control over how Asterisk handles having to poke all peers at seemingly the same time.
(closes issue #13217)
Reported by: cervajs


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 20:42:33 +00:00
Russell Bryant 36b1d08dc0 Merged revisions 164672 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r164672 | russell | 2008-12-16 09:56:37 -0600 (Tue, 16 Dec 2008) | 11 lines

Fix a memory leak related to the use of the "setvar" configuration option.

The problem was that these variables were being appended to the list of vars
on the sip_pvt every time a re-registration or re-subscription came in.
Since it's just a waste of memory to put them there unless the request was an
INVITE, then the fix is to check the request type before copying the vars.

(closes issue #14037)
Reported by: marvinek
Tested by: russell

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 16:00:29 +00:00
Joshua Colp ec6e4d2f60 When using externhost make sure the port gets set to the bindaddr port if one was not specified in the externhost value itself.
(closes issue #13634)
Reported by: performer


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164659 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 15:44:28 +00:00
Tilghman Lesher 42e26ee700 Revert ast_str opacity in chan_sip for now, since something wasn't quite right
in the merge.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164417 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-15 19:48:02 +00:00
Joshua Colp ae30bbf43d Merged revisions 164350 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r164350 | file | 2008-12-15 14:11:21 -0400 (Mon, 15 Dec 2008) | 6 lines
  
  Do not try to unlock a non-existant channel if the transfer fails.
  (closes issue #13800)
  Reported by: dwagner
  Patches:
        asterisk-1.4.22-chan-sip-nullp.patch uploaded by tweety (license 608)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164351 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-15 18:12:24 +00:00
Tilghman Lesher c8223fc957 Merge ast_str_opaque branch (discontinue usage of ast_str internals)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13 08:36:35 +00:00
Russell Bryant 90e65dc7d3 Rename a number of tcptls_session variables. There are no functional changes here.
The name "ser" was used in a lot of places.  However, it is a relic from when
the struct was a server_instance, not a session_instance.  It was renamed since
it represents both a server or client connection.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163670 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-12 18:45:03 +00:00
Russell Bryant 4dde380315 Fix a small race condition in sip_tcp_locate().
We must increase the reference count on the tcptls_session _before_ unlocking
the thread list.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163667 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-12 18:33:27 +00:00
Russell Bryant 4295303c56 Resolve crashes when using SIP TCP/TLS with qualify.
The problem was a reference count error on the tcptls_session structure.

(closes issue #13989)
Reported by: Nugget


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163642 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-12 18:19:47 +00:00
Joshua Colp 44b93b6859 When a device registers we need to unlink them (if linked) from the peers_by_ip container and link them back in since their IP address has changed. This would have manifested itself if you configured a new device (as type=peer), registered, and then tried to place a call from the device. Since the peer was not linked into the peers_by_ip container it would have never been found.
(closes issue #13811)
Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163629 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-12 18:17:12 +00:00
Joshua Colp 035a7552d6 Since chan_sip is callback devicestate driven do not pass in actual states, pass in unknown so we get asked. Additionally do not pass in an actual device state value in ast_setstate since the channel may be callback driven.
(closes issue #13525)
Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163579 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-12 16:55:15 +00:00
Joshua Colp a4a9815fe2 When a device registers to use it is entirely possible that they may be in use, so tell the core that we don't know the devstate and have it ask us for it.
(closes issue #13525)
Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-11 15:05:49 +00:00
Joshua Colp a039a65656 Merged revisions 162804 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r162804 | file | 2008-12-10 15:01:17 -0400 (Wed, 10 Dec 2008) | 6 lines
  
  Fix subscription based MWI up a bit. We only want to put sip: at the beginning of the URI if it is not already there and revert code to ignore destination check if subscribing for MWI.
  (closes issue #12560)
  Reported by: vsauer
  Patches:
        patch001.diff uploaded by ramonpeek (license 266)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162805 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-10 19:02:57 +00:00
Joshua Colp 02ce4faaeb Merged revisions 162738 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r162738 | file | 2008-12-10 13:50:43 -0400 (Wed, 10 Dec 2008) | 6 lines
  
  When a SIP peer unregisters set the expiry time back to 0 so that the 200 OK contains an expires of 0.
  (closes issue #13599)
  Reported by: hjourdain
  Patches:
        chan_sip.c.diff uploaded by hjourdain (license 583)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162739 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-10 17:53:09 +00:00
Mark Michelson d659ec3cd2 Merged revisions 162663 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r162663 | mmichelson | 2008-12-10 10:24:56 -0600 (Wed, 10 Dec 2008) | 11 lines

Revert fix for issue 13570. It has caused more problems than
it helped to fix.

(closes issue #13783)
Reported by: navkumar


(closes issue #14025)
Reported by: ffs


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162664 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-10 16:34:35 +00:00
Joshua Colp d8c152f7f0 When transmitting a register set the socket port to the local one for the transport being used, not the port for the remote server.
(closes issue #13633)
Reported by: performer


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162619 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-10 15:22:26 +00:00
Joshua Colp ac12d0d4ce Merged revisions 161725 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r161725 | file | 2008-12-08 13:52:10 -0400 (Mon, 08 Dec 2008) | 6 lines
  
  Make the usereqphone option work again.
  (closes issue #13474)
  Reported by: mmaguire
  Patches:
        20080912_bug13474.diff uploaded by mmaguire (license 571)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161726 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-08 17:53:32 +00:00
Matthew Nicholson 8b77d66a61 Fix a crash that can occur on a transfer in chan_sip when attempting to collect
rtp stats.

(closes issue #13956)
Reported by: chris-mac
Tested by: chris-mac


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-08 17:23:41 +00:00
Terry Wilson f6dda1e544 Add the ability to play a courtesy tone to the transfer target in a native SIP attended transfer by setting the variable ATTENEDED_TRANSFER_COMPLETE_SOUND.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161679 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-08 16:02:42 +00:00
Eliel C. Sardanons 1e8e12efcf Janitor, use ARRAY_LEN() when possible.
(closes issue #13990)
Reported by: eliel
Patches:
      array_len.diff uploaded by eliel (license 64)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-05 10:31:25 +00:00
Dwayne M. Hubbard f9b6507796 If 'faxdetect=yes' in sip.conf, switch to a 'fax' extension (if it exists) after T38 is negotiated.
Terry Wilson created the original patch for this functionality, which I slightly modified and added 
the faxdetect=yes|no configuration option.  This patch is only for T38 fax detection and does not 
do anything for G711 over SIP fax detection.  By default, this option is disabled. 

Reviewboard: http://reviewboard.digium.com/r/69/

This functionality is for issue AST-140.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161115 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-04 23:00:30 +00:00
Tilghman Lesher c9f471ac77 Merged revisions 160480 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r160480 | tilghman | 2008-12-03 08:09:35 -0600 (Wed, 03 Dec 2008) | 7 lines
  
  Jon Bonilla (Manwe) pointed out on the -dev list:
  "I guess that having only ip-phones in mind is not a good approach. Since it is
  possible to have a sip proxy connected to asterisk we could receive a 407
  (unauthorized) or 483 (too many hops) as response and dialog ending would not be
  a good behavior."
  So modified.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@160481 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-03 14:11:53 +00:00
Tilghman Lesher f96547b0b9 Merged revisions 160297 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r160297 | tilghman | 2008-12-02 11:42:09 -0600 (Tue, 02 Dec 2008) | 10 lines
  
  When the text does not match exactly (e.g. RTP/SAVP), then the %n conversion
  fails, and the resulting integer is garbage.  Thus, we must initialize the
  integer and check it afterwards for success.
  (closes issue #14000)
   Reported by: folke
   Patches: 
         asterisk-sipbg-sscanf-1.4.22.diff uploaded by folke (license 626)
         asterisk-sipbg-sscanf-1.6.0.1.diff uploaded by folke (license 626)
         asterisk-sipbg-sscanf-trunk-r159896.diff uploaded by folke (license 626)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@160308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-02 17:56:24 +00:00
Kevin P. Fleming 887e28d7aa incorporates r159808 from branches/1.4:
------------------------------------------------------------------------
r159808 | kpfleming | 2008-11-29 10:58:29 -0600 (Sat, 29 Nov 2008) | 7 lines

update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors

since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them

format attributes in a consistent way


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

in addition:

move some format attributes from main/utils.c to the header files they belong in, and fix up references to the relevant functions based on new compiler warnings



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-29 17:57:39 +00:00
Sean Bright fd8caa1778 This is basically a complete rollback of r155401, as it was determined that
it would be best to maintain API compatibility.  Instead, this commit introduces
ao2_callback_data() which is functionally identical to ao2_callback() except
that it allows you to pass arbitrary data to the callback.

Reviewed by Mark Michelson via ReviewBoard:
	http://reviewboard.digium.com/r/64


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158959 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-25 01:01:49 +00:00
Sean Bright 7bd3ce358b If you enabled 'notifycid' one of the limitations is that the calling channel
is only found if it dialed the extension that was subscribed to.  You can now
specify 'ignore-context' for the 'notifycid' option in sip.conf which will, as
it's value implies, ignore the current context of the caller when doing the
lookup.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158756 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-23 03:36:52 +00:00
Sean Bright 74c112a501 No need to use a separate structure for this since we can just pass
our sip_pvt pointer in directly.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158754 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-23 03:30:46 +00:00
Doug Bailey d68e8b8e02 Add fix to prevent crash during reload if there is an outstanding MWI registration message pending.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158315 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-21 15:53:49 +00:00
Mark Michelson 95c416df0b Use a more expressive constant for a 64-bit scanned int
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-21 01:22:18 +00:00
Mark Michelson bd6586e3d7 Use some magic constants to get the right size
for this sscanf statement. Thanks Richard!



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158265 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-21 01:14:20 +00:00
Mark Michelson 4e67fdd3f9 Fix the build for 32-bit systems. %lu is only 32-bits
on 32-bit systems, so we need to use %llu instead. Of course
%llu is 128-bits on 64-bit systems, so we have to cast to
unsigned long long. No harm, but it's sure annoying.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-21 00:59:23 +00:00
Mark Michelson e8aa0e29ce Change the remote user agent session version variable
from an int to a uint64_t. This prevents potential comparison
problems from happening if the version string exceeds
INT_MAX. This was an apparent problem for one user who could
not properly place a call on hold since the version in the
SDP of the re-INVITE to place the call on hold greatly 
exceeded INT_MAX.

This also aligns with RFC 2327 better since it recommends
using an NTP timestamp for the version (which is a 
64-bit number).


(closes issue #13531)
Reported by: sgofferj
Patches:
      13531.patch uploaded by putnopvut (license 60)
Tested by: sgofferj



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158230 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 23:12:50 +00:00
Mark Michelson 3a9c27459e Merged revisions 158072 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r158072 | twilson | 2008-11-20 11:48:58 -0600 (Thu, 20 Nov 2008) | 2 lines

Begin on a crusade to end trailing whitespace!

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158133 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 18:20:00 +00:00
Mark Michelson 2d4e3b21ee Merged revisions 158071 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r158071 | mmichelson | 2008-11-20 11:48:42 -0600 (Thu, 20 Nov 2008) | 16 lines

We don't handle 4XX responses to BYE well. According to
section 15 of RFC 3261, we should terminate a dialog if we
receive a 481 or 408 in response to our BYE. Since I am aware
of at least one phone manufacturer who may sometimes send a 
404 as well, I am being liberal and saying that any 4XX response
to a BYE should result in a terminated dialog.


(closes issue #12994)
Reported by: pabelanger
Patches:
      12994.patch uploaded by putnopvut (license 60)

Closes AST-129


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158082 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 17:54:31 +00:00
Mark Michelson 7a554a7386 Merged revisions 158053 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r158053 | mmichelson | 2008-11-20 11:33:06 -0600 (Thu, 20 Nov 2008) | 12 lines

Make sure to set the hangup cause on the calling channel in the case
that ast_call() fails. For incoming SIP channels, this was causing
us to send a 603 instead of a 486 when the call-limit was reached on
the destination channel.

(closes issue #13867)
Reported by: still_nsk
Patches:
      13867.diff uploaded by putnopvut (license 60)
Tested by: blitzrage


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158066 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 17:39:06 +00:00
Mark Michelson 1a4fc71415 Merged revisions 157503 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r157503 | mmichelson | 2008-11-18 16:47:57 -0600 (Tue, 18 Nov 2008) | 13 lines

Add some missing invite state changes necessary in the sip_write
function. Not setting the invite state correctly on the call was
resulting in the Record application leaving empty files. I also
have updated the doxygen comment next to the declaration of the
INV_EARLY_MEDIA constant to reflect that we also use this state
when we *send* a 18X response to an INVITE.

(closes issue #13878)
Reported by: nahuelgreco
Patches:
      sip-early-media-recording-1.4.22.patch uploaded by nahuelgreco (license 162)
	  Tested by: putnopvut

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157512 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-18 22:54:08 +00:00
Mark Michelson 2ede9a603f Based on Russell's advice on the asterisk-dev list, I have
changed from using a global lock in update_call_counter to
using the locks within the sip_pvt and sip_peer structures
instead.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157496 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-18 21:59:24 +00:00
Mark Michelson 16efb5c4dd * Add a lock to be used in the update_call_counter function.
* Revert logic to mirror 1.4's in the sense that it will not allow
  the call counter to dip below 0.

These two measures prevent potential races that could cause a SIP peer
to appear to be busy forever.

(closes issue #13668)
Reported by: mjc
Patches:
      hintfix_trunk_rev152649.patch uploaded by wolfelectronic (license 586)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157427 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-18 20:23:58 +00:00
Russell Bryant 1148e648b8 Fix a few more places where the case insensitive hash should be used since
the comparison is case insensitive.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157041 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-15 04:25:57 +00:00
Mark Michelson 6254c5cd2f Revision 155513 of chan_sip.c in trunk inadvertently
removed a very important line to set the "len" field
for incoming SIP requests. The result was that all incoming
SIP messages appeared to be 0-length, meaning Asterisk
could do no meaningful processing of anything SIP-related



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@156962 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-14 21:19:58 +00:00
Michiel van Baak 86f900b201 This commit does two things:
- Add CLI aliases module to asterisk.
- Remove all deprecated CLI commands from the code

Initial work done by file.
Junk-Y and lmadsen did a lot of work and testing to
get the list of deprecated commands into the configuration file.

Deprecated CLI commands are now handled by this new module,
see cli_aliases.conf for more info about that.

ok russellb@ via reviewboard

(closes issue #13735)
Reported by: mvanbaak


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@156120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-12 06:46:04 +00:00
Russell Bryant 72d5d58069 Remove commentary from the issues list for SIP TCP/TLS
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155929 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-11 16:07:36 +00:00
Sean Bright 48522988ab In order to move away from nested function use, some changes to the recently introduced
ast_channel_search_locked need to be made.  Specifically, the caller needs to be able to
pass arbitrary data which in turn is passed to the callback.  This patch addresses all
of the nested functions currently in asterisk trunk.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155590 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-09 01:59:59 +00:00
Russell Bryant ef489f8195 - Check for failure when putting the packet in the ast_str
- fix a spelling error in a header file


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155516 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-08 21:46:43 +00:00
Russell Bryant 648ea2aab9 Remove some code that is basically a no-op. Code above this already ensures that
the buffer is terminated.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155513 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-08 21:34:36 +00:00
Mark Michelson 111203aed9 Set the invite state to INV_CANCELLED in a place that
makes more sense. Where it was set before, it was impossible
to actually delay sending a CANCEL if we had not yet received
a provisional response to an INVITE.

(closes issue #13626)
Reported by: atis
Patches:
      13626.patch uploaded by putnopvut (license 60)
Tested by: atis



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155467 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07 23:41:44 +00:00
Sean Bright 30d1744ffc Add ability to pass arbitrary data to the ao2_callback_fn (called from
ao2_callback and ao2_find).  Currently, passing OBJ_POINTER to either
of these mandates that the passed 'arg' is a hashable object, making
searching for an ao2 object based on outside criteria difficult.

Reviewed by Russell and Mark M. via ReviewBoard:
    http://reviewboard.digium.com/r/36/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155401 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07 22:39:30 +00:00
Tilghman Lesher bd3f685f20 Merged revisions 155398 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r155398 | tilghman | 2008-11-07 16:27:32 -0600 (Fri, 07 Nov 2008) | 7 lines
  
  Clarify error message.
  (closes issue #13809)
   Reported by: denke
   Patches: 
         20081104__bug13809.diff.txt uploaded by Corydon76 (license 14)
   Tested by: denke
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155399 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07 22:28:58 +00:00
Kevin P. Fleming 90e573c373 stringfields conversion for struct sip_peer, as requested :-)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07 15:52:05 +00:00
Russell Bryant 41ab61a2a2 Remove a bogus ast_free() that Kevin noticed. This was probably just left over
from pre-astobj2ified chan_sip.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155264 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07 15:42:04 +00:00
Russell Bryant 1a239454f1 Fix some code in chan_sip that was intended to unlink multiple objects from a
container.  The OBJ_MULTIPLE flag must be provided here.  Otherwise, this would
only remove a single object.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07 14:50:30 +00:00
Sean Bright 086a52d9d1 Introduce a new API call ast_channel_search_locked, which iterates through the
channel list calling a caller-defined callback.  The callback returns non-zero
if a match is found.  This should speed up some of the code that I committed
earlier today in chan_sip (which is also updated by this commit).

Reviewed by russellb and kpfleming via ReviewBoard:
	http://reviewboard.digium.com/r/28/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-04 23:23:39 +00:00
Sean Bright 6ba4e7853e Allow devices that accept dialog-info+xml (like snoms) to get the Caller ID of
the calling party when subscribed to the state of an extension that is ringing.
This has some limitations which are documented in sip.conf.sample.

(closes issue #13827)
Reported by: seanbright
Patches:
      issue13827.patch uploaded by seanbright (license 71)
Reviewed by: russellb


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154187 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-04 17:00:45 +00:00
Olle Johansson 204845843e Adding a separation of remote authentication and our authentication.
remotesecret => our password for a remote service
secret => our authentication when someone calls us

Secret => still has both functions if remotesecret is not used.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-03 15:16:33 +00:00
Eliel C. Sardanons 105a020b6f Add XML documentation for:
Applications
        - SIPDtmfMode()
        - SIPAddHeader()
     Functions
        - SIP_HEADER()
        - SIPPEER()
        - SIPCHANINFO()
        - CHECKSIPDOMAIN()



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153803 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-03 12:35:05 +00:00
Kevin P. Fleming bd4eb070f3 bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 branch, and add the ones needed for all the new code here too
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-02 18:52:13 +00:00
Russell Bryant 981c2d03b6 Don't ignore the result of find_peer() when looking for a peer by IP in check_peer_ok().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153403 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-01 23:46:12 +00:00
Russell Bryant 1fef0f63bb Ensure that the sip_pvt properly has its refcount incremented when the scheduler holds
a reference to it for session timer processing.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153362 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-01 20:41:38 +00:00
Tilghman Lesher 44b484195e Merged revisions 153114 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r153114 | tilghman | 2008-10-31 11:30:32 -0500 (Fri, 31 Oct 2008) | 3 lines
  
  Turn off qualify on uncached realtime peers.
  (Closes issue #13383)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153122 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-31 16:35:21 +00:00
Russell Bryant 19f1e7e578 Fix the sip_peer reference count with respect to scheduler entries for
scheduling peer pokes, and scheduling peer poke expirations.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152920 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-30 19:40:15 +00:00
Russell Bryant 46a8b1deed Fix the sip_peer reference count with respect to scheduler entries for
registration expirations.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152915 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-30 19:35:36 +00:00
Mark Michelson c0b9b259ca I just noticed this construct and thought it was
silly to have a bunch of case statements with duplicated
code in each case. Instead, just use the built-in fallthrough
capability of case statements and reduce the code to
a single instance



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152879 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-30 19:23:16 +00:00
Russell Bryant 3d5b3249a8 Modify the documentation of the sip_registry struct
- Remove a comment that says that the monitor thread is the only one that
   ever touches these objects.  This is no longer the case with TCP.  Also,
   I would eventually like to get the scheduler in its own thread, so this
   is just a poor assumption to make.
 - Note that reference counting of these objects with respect to scheduler
   entries is not complete.  There are some leaked references when deleting
   scheduler entries.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-30 19:21:53 +00:00
Russell Bryant 0dbd863733 Merged revisions 152539 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r152539 | russell | 2008-10-29 00:23:51 -0500 (Wed, 29 Oct 2008) | 7 lines

Fix an incorrect usage of sizeof()

(closes issue #13795)
Reported by: andrew53
Patches:
	chan_sip_sizeof.patch uploaded by andrew53 (license 519)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-29 05:34:26 +00:00
Olle Johansson 0fdde26109 Trying to fix the user/peer matching correctly. This will need some testing before
getting merged into 1.6.1


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152020 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-26 10:23:01 +00:00
Olle Johansson 9137733e11 Moving more variables to the sip_cfg structure, as I have some future ideas for the usage of that structure.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152019 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-26 09:45:17 +00:00
Olle Johansson 31a9f1e6f0 Doxygen changes and some formatting.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151980 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-26 09:19:19 +00:00
Olle Johansson 5aa23add8c Adding a small new feature.
Setting _SIPFROMDOMAIN in a channel will set the domain we use for the URI in the outbound call leg.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151739 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-23 15:30:16 +00:00
BJ Weschke d7422c975e revert the changes in issue #13705 - it's being re-opened as while the results fixed the complaint in the issue, it introduced other more undesirable issues than what was already reported
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151642 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-22 20:45:03 +00:00
Russell Bryant 89e0def9f9 Print out the right var in the log message
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151555 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-22 17:45:05 +00:00
Russell Bryant ca14f718d7 Fix this check to use the proper variable (the result from get_in_brackets)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151554 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-22 17:44:05 +00:00
Mark Michelson cfa9531311 The logic of a strncasecmp call was reversed.
(closes issue #13706)
Reported by: andrew53
Patches:
      sip_notify_from_rfc3265.patch uploaded by andrew53 (license 519)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151512 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-22 15:08:25 +00:00
Mark Michelson 97dac2d91a Make the sip_standard_port function more granular by allowing separate
type and port arguments. This is necessary because when building our From
and Contact headers, we need to be absolutely sure that we are placing our
source port there and not the peer's source port.

(closes issue #12761)
Reported by: asbestoshead
Patches:
      patch-chan-sip-contact-port.txt uploaded by asbestoshead (license 455)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-21 23:54:41 +00:00
Mark Michelson f4561c0e46 Get this compiling in dev-mode
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-21 23:31:17 +00:00