Commit Graph

7605 Commits

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

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368793 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-12 14:07:13 +00:00
Kinsey Moore afa03bd310 Parse ANI2 information from SIP From header parameters
ANI2 information is now parsed out of SIP From headers when present in
the oli, isup-oli, and ss7-oli parameters and is available via the
CALLERID(ani2) dialplan function.

(closes issue ASTERISK-19912)
Patch-by: Rob Gagnon
Review: https://reviewboard.asterisk.org/r/1947/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368784 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-12 04:03:23 +00:00
Richard Mudgett 72eb8eb1e7 Fix deadlock potential with ast_set_hangupsource() calls.
Calling ast_set_hangupsource() with the channel lock held can result in a
deadlock because the function also locks the bridged channel.

(issue ASTERISK-19537)

(closes issue AST-891)
Reported by: Guenther Kelleter
Tested by: Guenther Kelleter

(closes issue ASTERISK-19801)
Reported by: Alec Davis
........

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

Merged revisions 368760 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-11 17:34:08 +00:00
Kinsey Moore c6142cf2cc Fix coverity UNUSED_VALUE findings in core support level files
Most of these were just saving returned values without using them and
in some cases the variable being saved to could be removed as well.

(issue ASTERISK-19672)
........

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

Merged revisions 368739 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-11 15:23:30 +00:00
Igor Goncharovskiy 4ca35e0907 Fix MWI update so LED display correct voicemail state after phone usage. Also fixes few warnings.
(closes issue #19675)
 Reported by: dbohling
 Patches: 
       fixmwi.patch uploaded by dbohling (license 6378)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-08 08:32:49 +00:00
Damien Wedhorn d979399071 Skinny cleanup (mwi_event_cb).
Original was testing for d->session, setting and testing again (all nested).

Removed duplicate testing and restructured function to test/return and then
the main code.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368681 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-07 21:44:15 +00:00
Damien Wedhorn 0271734f2e Skinny cleanup.
Removed d->registered which was mirroring d->session. Changed relevant
references to use d->session instead.

Moved setting and unsetting of l->device from session register to device 
configuration. As such, l->device will always be valid unless it is has not
been configured to a device. Revised various test where checking if a device
is registered to use l->device->session.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368680 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-07 21:23:42 +00:00
Richard Mudgett 0f71b29e2f Fix POTS flash hook to orignate a second call deadlock.
A deadlock can occur when a POTS phone tries to flash hook to originate a
second call for 3-way or transfer.  If another process is scanning the
channels container when the POTS line flash hooks then a deadlock will
occur.

* Release the channel and private locks when creating a new channel as a
result of a flash hook.

(closes issue ASTERISK-19842)
Reported by: rmudgett
Tested by: rmudgett
........

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

Merged revisions 368645 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-06 21:34:10 +00:00
Mark Michelson ea8cf8b5f3 Fix a specific scenario where ACKs are not matched.
If a dialog-starting INVITE contains a to-tag, then Asterisk
will respond with a 481. In this case, the resulting incoming
ACK would not be matched, so Asterisk would continue retransmitting
the 481 until the transaction times out.

There were two issues. Asterisk, upon creating a sip_pvt would generate
a local tag. However, when the time came to transmit the 481, since there
was a to-tag in the INVITE, Asterisk would place this original to-tag
in the 481 response. When the ACK came in, Asterisk would attempt to
match the to-tag in the ACK to the generated local tag. Unfortunately,
Asterisk never actually transmitted a response with the generated local
tag, so the to-tag in the ACK would not match.

The other problem was that when the 481 was sent, nothing was set
on the sip_pvt to indicate what CSeq is expected in the ACK.

To fix the first problem, we zero out the to-tag seen in the incoming
INVITE. This way, Asterisk, when time to send a response, will send
its generated local tag instead.

To fix the second problem, we set the sip_pvt's pendinginvite to the
CSeq of the INVITE when we send a 481.

(closes issue ASTERISK-19892)
Reported by Mark Michelson
........

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

Merged revisions 368629 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-06 19:25:44 +00:00
Kinsey Moore 1492177b7b Ensure overlapping hold flags do not conflict
When changing between different modes of hold, the flags were not being
cleared out properly causing a failure to change hold states.

(closes issue ASTERISK-19919)
Patch-by: Morten Tryfoss
Reported-by: Morten Tryfoss
........

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

Merged revisions 368587 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-06 16:11:01 +00:00
Kinsey Moore 571445ab9c Convert AST_FLAG_ANSWERED_ELSEWHERE usage to AST_CAUSE_ANSWERED_ELSEWHERE
This was essentially duplicated functionality where normal channels used
AST_CAUSE_ANSWERED_ELSEWHERE while local channels and queues used
AST_FLAG_ANSWERED_ELSEWHERE.  This removes the flag and converts that usage
into AST_CAUSE_ANSWERED_ELSEWHER usage.

Review: https://reviewboard.asterisk.org/r/1944
(closes issue ASTERISK-19865)
Patch-by: Birger Harzenetter


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-05 14:41:43 +00:00
Mark Michelson d210685a20 Relay proper SIP responses on calling side.
Revision 351130 broke corect HANGUPCAUSE setting
for the 404 case in chan_sip. Other cases were also
potentially broken. This patch fixes the relaying
of causes to be what they used to be.

(closes issue ASTERISK-19914)
Reported by Pavel Troller
Tested by Walter Doekes (via a reviewboard test to be committed later)
Patches:
	chan_sip.diff uploaded by Pavel Troller (license #6302)
........

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

Merged revisions 368499 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-04 22:12:19 +00:00
Mark Michelson 14a985560e Merge changes dealing with support for Digium phones.
Presence support has been added. This is accomplished by
allowing for presence hints in addition to device state
hints. A dialplan function called PRESENCE_STATE has been
added to allow for setting and reading presence. Presence
can be transmitted to Digium phones using custom XML
elements in a PIDF presence document.

Voicemail has new APIs that allow for moving, removing,
forwarding, and playing messages. Messages have had a new
unique message ID added to them so that the APIs will work
reliably. The state of a voicemail mailbox can be obtained
using an API that allows one to get a snapshot of the mailbox.
A voicemail Dialplan App called VoiceMailPlayMsg has been
added to be able to play back a specific message.

Configuration hooks have been added. Configuration hooks
allow for a piece of code to be executed when a specific
configuration file is loaded by a specific module. This is
useful for modules that are dependent on the configuration
of other modules.

chan_sip now has a public method that allows for a custom
SIP INFO request to be sent mid-dialog. Digium phones use
this in order to display progress bars when files are played.

Messaging support has been expanded a bit. The main
visible difference is the addition of an AMI action
MessageSend.

Finally, a ParkingLots manager action has been added in order
to get a list of parking lots.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-04 20:26:12 +00:00
Kevin P. Fleming dd02d976f5 Improve SDP offer/answer RFC compliance
Asterisk should not accept SDP offers that contain unknown RTP profiles (for
audio/video streams) or unknown top-level media types. When it does, it answers
with an SDP that does not match the offer properly, and this will nearly
always result in a broken call. This patch causes such offers to be rejected.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-01 20:42:10 +00:00
Kevin P. Fleming 66e5c30716 Improve SDP parsing warning messages
* 'Unsupported media type' is only reported when that is in fact the case,
   not when a supported media type is included in an 'm' line that has an
   invalid format.

* All warning messages related to parsing 'm' lines now include the 'm' line contents.

* (minor bugfix) newline added to port-number-zero warning messages.

* Warning messages improved to use RFC-specified terminology for various items.

* Warnings for offers that include more than one port for a single media type now
  include the media type.

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

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

Merged revisions 368267 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-01 20:31:15 +00:00
Mark Michelson 463f9d729a Help mitigate potential reinvite glare scenarios.
When Asterisk servers are set up back-to-back, and
direct media is to be used betweeen endpoints, it is
fairly common for the two Asterisk servers to send
direct media reinvites to each other simultaneously.
This results in 491s and ACKs being exchanged between
the servers. While the media eventually gets set up
properly, the problem is that there can be a noticeable
delay for the streams to stabilize.

This patch adds a new directmedia option called "outgoing".
With this set, an immediate direct media reinvite will only
be sent if the call direction is outgoing. For incoming
dialogs, an immediate direct media reinvite will not be sent,
but further "reactionary" direct media reinvites may be sent.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-01 13:04:32 +00:00
Richard Mudgett dd2427c141 Coverity Report: Fix issues for error type REVERSE_INULL (core modules)
* Fixes findings: 0-2,5,7-15,24-26,28-31

(issue ASTERISK-19648)
Reported by: Matt Jordan
........

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

Merged revisions 368042 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-31 18:39:30 +00:00
Richard Mudgett e65ad34770 Fix deadlock when executing CLI "pri show channels" and "ss7 show channels" commands.
* Fix sig_pri_lock_owner() to avoid deadlock properly.

* Code pri_grab() better.

* Fix sig_ss7_lock_owner() to avoid deadlock properly.

* Code ss7_grab() better.

(closes issue ASTERISK-19854)
Reported by: Jaxon
Patches:
      jira_asterisk_19854_v1.8.6.patch (license #5621) patch uploaded by rmudgett (Modified to do the same thing to sig_ss7)
Tested by: Jaxon
........

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

Merged revisions 367978 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367979 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-30 17:50:38 +00:00
Matthew Jordan 94187aafc0 AST-2012-008: Fix remote crash vulnerability in chan_skinny
When a skinny session is unregistered, the corresponding device pointer is set
to NULL in the channel private data.  If the client was not in the on-hook state
at the time the connection was closed, the device pointer can later be
dereferened if a message or channel event attempts to use a line's pointer to
said device.

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

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

Merged revisions 367844 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367845 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-29 18:40:26 +00:00
Richard Mudgett 2d418b596c AST-2012-007: Fix IAX receiving HOLD without suggested MOH class crash.
* Made schedule_delivery() set the received frame f->data.ptr to NULL if 
the datalen is zero.  

* Fix queue_signalling() memcpy() size error.

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

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

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

Merged revisions 367782 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-25 16:33:31 +00:00
Michael L. Young 2eff35bafa Fix pvt_sip for inbound call to use peer's allowtransfer setting
The pvt_sip allowtransfer was not being set to that of the peer's setting.
Therefore, the global allowtransfer setting was being used instead which would
lead to calls not being transfered if the global setting was set to 'no' despite
the setting on the peer being 'yes' and vice versa, calls would be allowed to
transfer even if the peer's setting was 'no' but the global setting was 'yes'.

(Closes issue ASTERISK-19856)
Reported by: Jacek
Tested by: Michael L. Young, Jacek 
Patches:
issue-asterisk-19856-branch10-v3.diff uploaded by 
                                                 Michael L. Young (license 5026)

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

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

Merged revisions 367731 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367732 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-25 02:31:58 +00:00
Jonathan Rose bdaecbb66b chan_sip: fix problem directmediapermit/deny uses the wrong address
When remotely bridging calls with directmedia, Asterisk would check
the address of the peers/users holding directmedia ACLs (set via
directmediapermit/directmediadeny) instead of the bridged peer. This
is similar to r366547, but trunk specific and involves changes to
the rtpengine instead of just chan_sip.

(closes issue AST-876)
review: https://reviewboard.asterisk.org/r/1924/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367640 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-24 18:56:43 +00:00
Richard Mudgett 8de31699d8 Made use IAX frame cache only for cacheable frame types.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-24 00:36:19 +00:00
Matthew Jordan f454dceaf3 Re-add LastMsgsSent value for SIP peers
Previously, MWI logic utilized a counter called 'lastmsgssent' to know whether
or not MWI NOTIFY requests had been sent to a specific peer.  When MWI
notifications were changed to use the internal event framework, this value was
no longer needed for its original purpose.  Hence, it was no longer updated
with the new/old message counts for a peer.  The value was previously removed
for Asterisk 10; however, since it was still present in Asterisk 1.8 and still
useful for reporting purposes, it was decided to re-add the value.

This patch re-adds the 'LastMsgsSent' field in the response to an AMI/CLI 'sip
show peer [peer]' command, and makes it so that the value of lastmsgssent is
updated appropriately. The value should now display the new/old message counts
for a particular peer.

(closes issue ASTERISK-17866)
Reported by: Steve Davies
patches by:
  ast-17866-rb1272.patch (License #5041 by irroot)
  Modified slightly for this commit

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

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

Merged revisions 367369 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367376 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-23 13:46:38 +00:00
Terry Wilson 1ffb200c0e Resolve crash in subscribing for MWI notifications
ASTOBJ_UNREF sets the variable to NULL after unreffing it, so the variable
should definitely not be used after that. To solve this in the two cases
that affect subscribing for MWI notifications, we instead save the ref
locally, and unref them in the error conditions.

(closes issue ASTERISK-19827)
Reported by: B. R
Review: https://reviewboard.asterisk.org/r/1940/
........

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

Merged revisions 367267 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367274 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-22 16:23:19 +00:00
Kinsey Moore ab4c9f2247 Make chan_iax2 reject cause code indications correctly
If chan_iax2 does not reject the PVT_CAUSE_CODE frames, the cause will not be
stored properly.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367189 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-21 20:35:58 +00:00
Mark Michelson 8b1193087e Revert revision 367163.
This should have been committed to my team trunk-digiumphones branch
instead of trunk.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-21 20:31:53 +00:00
Mark Michelson e5f1f0496a Add "send to voicemail" Digium phone functionality to Asterisk.
This change accommodates two methods by which calls can be directed to
a user's voicemail.

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

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

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

(closes issue AST-871)
Reported by Malcolm Davenport

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367163 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-21 19:22:25 +00:00
Mark Michelson 11348736af Address MISSING_BREAK static analysis reports some more.
This addresses core findings 4 and 6.

Moises Silva helped me by stating that a break could be
safely added to the case where it is added in chan_dahdi.c

In say.c, I have added a comment indicating that static analysis
complains but that it is currently unknown if this is correct.

This fixes all core findings of this type.

(closes issue ASTERISK-19662)
reported by Matthew Jordan
........

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

Merged revisions 367028 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18 17:54:07 +00:00
Mark Michelson 5c576aa3c2 Fix memory leak of SSL_CTX structures in TLS core.
SSL_CTX structures were allocated but never freed. This was a bigger
issue for clients than servers since new SSL_CTX structures could be
allocated for each connection. Servers, on the other hand, typically
set up a single SSL_CTX for their lifetime.

This is solved in two ways:

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

(issue ASTERISK-19278)
........

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

Merged revisions 367003 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18 17:24:57 +00:00
Matthew Jordan 6eb4e81033 Fix more memory leaks
This patch adds to what was fixed in r366880.  Specifically, it addresses the
following:

* chan_sip:   dispose of an allocated frame in off nominal code paths in
              sip_rtp_read
* func_odbc:  when disposing of an allocated resultset, ensure that any rows
              that were appended to that resultset are also disposed of
* cli:        free the created return string buffer in another off nominal code
              path
* chan_dahdi: free a frame that was allocated by the dsp layer if we choose
              not to process that frame

(issue ASTERISK-19665)
Reported by: Matt Jordan

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

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

Merged revisions 366948 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366955 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18 15:51:16 +00:00
Matthew Jordan 7b51320642 Fix a variety of memory leaks
This patch addresses a number of memory leaks in a variety of modules that were
found by a static analysis tool.  A brief summary of the changes:

* app_minivm:       free ast_str objects on off nominal paths
* app_page:         free the ast_dial object if the requested channel technology
                    cannot be appended to the dialing structure
* app_queue:        if a penalty rule failed to match any existing rule list
                    names, the created rule would not be inserted and its memory
                    would be leaked
* app_read:         dispose of the created silence detector in the presence of
                    off nominal circumstances
* app_voicemail:    dispose of an allocated unique ID field for MWI event
                    un-subscribe requests in off nominal paths; dispose of
                    configuration objects when using the secret.conf option
* chan_dahdi:       dispose of the allocated frame produced by ast_dsp_process
* chan_iax2:        properly unref peer in CLI command "iax2 unregister"
* chan_sip:         dispose of the allocated frame produced by sip_rtp_read's
                    call of ast_dsp_process; free memory in parse unit tests
* func_dialgroup:   properly deref ao2 object grhead in nominal path of
                    dialgroup_read
* func_odbc:        free resultset in off nominal paths of odbc_read
* cli:              free match_list in off nominal paths of CLI match completion
* config:           free comment_buffer/list_buffer when configuration file load
                    is unchanged; free the same buffers any time they were
                    created and config files were processed
* data:             free XML nodes in various places
* enum:             free context buffer in off nominal paths
* features:         free ast_call_feature in off nominal paths of applicationmap
                    config processing
* netsock2:         users of ast_sockaddr_resolve pass in an ast_sockaddr struct
                    that is allocated by the method.  Failures in
                    ast_sockaddr_resolve could result in the users of the method
                    not knowing whether or not the buffer was allocated.  The
                    method will now not allocate the ast_sockaddr struct if it
                    will return failure.
* pbx:              cleanup hash table traversals in off nominal paths; free
                    ignore pattern buffer if it already exists for the specified
                    context
* xmldoc:           cleanup various nodes when we no longer need them
* main/editline:    various cleanup of pointers not being freed before being
                    assigned to other memory, cleanup along off nominal paths
* menuselect/mxml:  cleanup of value buffer for an attribute when that attribute
                    did not specify a value
* res_calendar*:    responses are allocated via the various *_request method
                    returns and should not be allocated in the various
                    write_event methods; ensure attendee buffer is freed if no
                    data exists in the parsed node; ensure that calendar objects
                    are de-ref'd appropriately
* res_jabber:       free buffer in off nominal path
* res_musiconhold:  close the DIR* object in off nominal paths
* res_rtp_asterisk: if we run out of ports, close the rtp socket object and free
                    the rtp object
* res_srtp:         if we fail to create the session in libsrtp, destroy the
                    temporary ast_srtp object

(issue ASTERISK-19665)
Reported by: Matt Jordan

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

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

Merged revisions 366881 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18 14:43:44 +00:00
Jonathan Rose 6fc8e9928d chan_sip: Fix a small TEST_FRAMEWORK related error that prevents compiling
Introduced with r366842, a function call made only with TEST_FRAMEWORK enabled
was missing an argument since the function arguments were changed.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366896 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18 14:27:01 +00:00
Kinsey Moore 54268bca4a Reorder and renumber tests appropriately
It appears that a patch did not apply properly when adding tests 12 and
13 and test 11 was duplicated.  These tests have been reordered and
renumbered such that they make sense.
........

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

Merged revisions 366884 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18 14:21:37 +00:00
Jonathan Rose cd37bec058 logger: Adds additional support for call id logging and chan_sip specific stuff
This patch improves the handling of call id logging significantly with regard
to transfers and adding APIs to better handle specific aspects of logging.
Also, changes have been made to chan_sip in order to better handle the creation
of callids and to enable the monitor thread to bind itself to a particular
call id when a dialog is determined to be related to a callid. It then unbinds
itself before returning to normal monitoring.

review: https://reviewboard.asterisk.org/r/1886/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-17 16:28:20 +00:00
Matthew Jordan 87113f1a0c Fix checking bounds of array index after using it; improper sizeof
This patch fixes two problems pointed out by a static analysis tool.

* In chan_dahdi, when an event is handled the index of the sub channel is first
  obtained.  In very off nominal cases, the method that determines the index
  can return a negative value.  In the event handling code, whether or not
  the index returned is valid was being checked after that value was used to
  index into an array.  This patch makes it so the value is checked before
  any indexing is done.

* In res_calendar_ews, sizeof was being passed a pointer instead of the struct to
  determine the amount of memory to allocate.

(issue ASTERISK-19651)
Reported by: Matt Jordan

(closes issue ASTERISK-19671)
Reported by: Matt Jordan
........

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

Merged revisions 366741 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-17 13:21:19 +00:00
Mark Michelson 5629d66257 Correct misuse of ast_strip_quoted() when getting a Diversion header's reason parameter.
The use here was assuming that the pointer would be updated, but the updated string
is actually returned by ast_strip_quoted() instead.
........

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

Merged revisions 366598 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366599 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-15 23:41:59 +00:00
Richard Mudgett d5d984daa5 The predial routine must be run on the local;1 channel.
When ast_call() operates on a local channel, it copies a lot of things
from the local;1 channel to the local;2 channel.  This includes among
other things, channel variables and party id information.

Other reasons it was a bad idea to run predial on the local;2 channel:

1) The channel has not been completely setup.  The ast_call() completes
the setup.

2) The local;2 caller and connected line party information is opposite to
any other channels predial runs on.  (And it hasn't been setup yet.)

* Partially back out -r366183 by removing the chan_local implementation of
the struct ast_channel_tech.pre_call callback.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366546 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-15 19:36:26 +00:00
Richard Mudgett 0798012e39 Make chan_local use the API call instead of inlining its own version.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-14 21:34:14 +00:00
Kinsey Moore b5a6de76fc Commit framework for HANGUPCAUSE (replacement for SIP_CAUSE)
This is the starting point for the Asterisk 11: Who Hung Up work and provides
a framework which will allow channel drivers to report the types of hangup
cause information available in SIP_CAUSE without incurring the overhead of the
MASTER_CHANNEL dialplan function. The initial implementation only includes
cause generation for chan_sip and does not include cause code translation
utilities.

This change deprecates SIP_CAUSE and replaces its method of reporting cause
codes with the new framework. This change also deprecates the 'storesipcause'
option in sip.conf.

Review: https://reviewboard.asterisk.org/r/1822/
(Closes issue SWP-4221)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-14 19:44:27 +00:00
Mark Michelson fef9a32fb4 Fix broken reinvite glare scenario.
To make a long story short, reinvite glares were broken
because Asterisk would invert the To and From headers
when ACKing a 491 response.

The reason was because the initreq of the dialog was being
changed to the incoming glared reinvite instead of being
set to the outgoing glared reinvite. This change has three
parts

* In handle_incoming, we never will reject an ACK because it
has a to-tag present, even if we think the request may be out
of dialog.
* In handle_request_invite, we do not change the initreq when
receiving a reinvite to which we will respond with a 491.
* In handle_request_invite, several superflous settings up
pendinginvite have been removed since this is dones automatically
by transmit_response_reliable

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

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

Merged revisions 366390 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366401 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-14 19:27:58 +00:00
Richard Mudgett 4ea636c776 Run predial routine on local;2 channel where you would expect.
Before this patch, the predial routine executes on the ;1 channel of a
local channel pair.  Executing predial on the ;1 channel of a local
channel pair is of limited utility.  Any channel variables set by the
predial routine executing on the ;1 channel will not be available when the
local channel executes dialplan on the ;2 channel.

* Create ast_pre_call() and an associated pre_call() technology callback
to handle running the predial routine.  If a channel technology does not
provide the callback, the predial routine is simply run on the channel.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 21:29:41 +00:00
Kinsey Moore dd81b047db Resolve FORWARD_NULL static analysis warnings
This resolves core findings from ASTERISK-19650 numbers 0-2, 6, 7, 9-11, 14-20,
22-24, 28, 30-32, 34-36, 42-56, 82-84, 87, 89-90, 93-102, 104, 105, 109-111,
and 115. Finding numbers 26, 33, and 29 were already resolved.  Those skipped
were either extended/deprecated or in areas of code that shouldn't be
disturbed.

(Closes issue ASTERISK-19650)
........

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

Merged revisions 366168 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 20:56:09 +00:00
Jonathan Rose 8227f70cd7 Coverity Report: Fix issues for error type CHECKED_RETURN for core
(issue ASTERISK-19658)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/1905/
........

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

Merged revisions 366106 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 18:35:14 +00:00
Mark Michelson 3430da58e9 Close the proper tcptls_session when session creation fails.
(issue AST-998)
Reported by: Thomas Arimont
Tested by: Thomas Arimont
........

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

Merged revisions 366053 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366062 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 16:22:36 +00:00
Mark Michelson 6125190ca1 Prevent sip_pvt refleak when an ast_channel outlasts its corresponding sip_pvt.
chan_sip was coded under the assumption that a SIP dialog with an owner channel
will always be destroyed after the owner channel has been hung up.

However, there are situations where the SIP dialog can time out and auto destruct
before the corresponding channel has hung up. A typical example of this would be
if the 'h' extension in the dialplan takes a long time to complete. In such cases,
__sip_autodestruct() would complain about the dialog being auto destroyed with
an owner channel still in place. The problem is that even once the owner channel
was hung up, the sip_pvt would still be linked in its ao2_container because nothing
would ever unlink it.

The fix for this is that if __sip_autodestruct() is called for a sip_pvt that still
has an owner channel in place, the destruction is rescheduled for 10 seconds in the
future. This will continue until the owner channel is finally hung up.

(closes issue ASTERISK-19425)
reported by David Cunningham
Patches:
    ASTERISK-19425.patch uploaded by Mark Michelson (License #5049)

(closes issue ASTERISK-19455)
reported by Dean Vesvuio
Tested by Dean Vesvuio
........

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

Merged revisions 365898 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365913 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-09 16:36:10 +00:00
Mark Michelson abfe67b01e Send more accurate identification information in dialog-info SIP NOTIFYs.
This uses the calling channel's caller ID and connected line information
to populate the remote and local identities in the dialog-info NOTIFY when
an extension is ringing.

There is a bit of an oddity here, and that is that we seed the remote target
with the To header of the outbound call rather than the from header. This
is because it was reported that seeding with the from header caused hints
to be broken with certain SNOM devices. A comment has been added to the code
to explain this.

(closes issue ASTERISK-16735)
reported by Maciej Krajewski
patches:
    local_remote_hint2.diff uploaded by Mark Michelson (license #5049)
	16735_tweak1.diff uploaded by Mark Michelson (license #5049)
Tested by Niccolo Belli
........

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

Merged revisions 365575 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365576 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-08 15:57:14 +00:00
Kinsey Moore 781f4657b9 Fix many issues from the NULL_RETURNS Coverity report
Most of the changes here are trivial NULL checks.  There are a couple
optimizations to remove the need to check for NULL and outboundproxy parsing
in chan_sip.c was rewritten to avoid use of strtok.  Additionally, a bug was
found and fixed with the parsing of outboundproxy when "outboundproxy=," was
set.

(Closes issue ASTERISK-19654)
........

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

Merged revisions 365399 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-04 22:17:38 +00:00
Richard Mudgett 8842f76a7f Fix local channel chains optimizing themselves out of a call.
* Made chan_local.c:check_bridge() check the return value of
ast_channel_masquerade().  In long chains of local channels, the
masquerade occasionally fails to get setup because there is another
masquerade already setup on an adjacent local channel in the chain.

* Made the outgoing local channel (the ;2 channel) flush one voice or
video frame per optimization attempt.

* Made sure that the outgoing local channel also does not have any frames
in its queue before the masquerade.

* Made do the masquerade immediately to minimize the chance that the
outgoing channel queue does not get any new frames added and thus
unconditionally flushed.

* Made block indication -1 (Stop tones) event when the local channel is
going to optimize itself out.  When the call is answered, a chain of local
channels pass down a -1 indication for each bridge.  This blizzard of -1
events really slows down the optimization process.

(closes issue ASTERISK-16711)
Reported by: Alec Davis
Tested by: rmudgett, Alec Davis
Review: https://reviewboard.asterisk.org/r/1894/
........

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

Merged revisions 365320 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365356 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-04 17:38:39 +00:00
Terry Wilson 07309e586c Multiple revisions 365006,365068
........
  r365006 | twilson | 2012-05-02 10:49:03 -0500 (Wed, 02 May 2012) | 12 lines
  
  Fix a CEL LINKEDID_END race and local channel linkedids
  
  This patch has the ;2 channel inherit the linkedid of the ;1 channel and fixes
  the race condition by no longer scanning the channel list for "other" channels
  with the same linkedid. Instead, cel.c has an ao2 container of linkedid strings
  and uses the refcount of the string as a counter of how many channels with the
  linkedid exist. Not only does this eliminate the race condition, but it also
  allows us to look up the linkedid by the hashed key instead of traversing the
  entire channel list.
  
  Review: https://reviewboard.asterisk.org/r/1895/
........
  r365068 | twilson | 2012-05-02 12:02:39 -0500 (Wed, 02 May 2012) | 11 lines
  
  Don't leak a ref if out of memory and can't link the linkedid
  
  If the ao2_link fails, we are most likely out of memory and bad things
  are going to happen. Before those bad things happen, make sure to clean
  up the linkedid references.
  
  This patch also adds a comment explaining why linkedid can't be passed
  to both local channel allocations and combines two ao2_ref calls into 1.
  
  Review: https://reviewboard.asterisk.org/r/1895/
........

Merged revisions 365006,365068 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 365083 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365084 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-02 17:43:16 +00:00
Jason Parker 067064bd65 Save the address on which a MESSAGE was received, so it can be used in MESSAGE()
This is useful in cases where chan_sip may be listening on multiple addresses.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-02 15:59:43 +00:00
Mark Michelson 355a6d6f37 Remove a function that has been marked unused since Asterisk 1.6.0.
The reason I'm removing this is that Coverity reported a STRAY_SEMICOLON
issue here. Since the function has been unused for so long, I just elected
to remove it altogether.

(closes issue ASTERISK-19660)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364915 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-01 23:23:44 +00:00
Richard Mudgett 2b7e1affac * Fix error path resouce leak in local_request().
* Restructure local_request() to reduce indentation.
........

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

Merged revisions 364845 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-01 22:00:11 +00:00
Mark Michelson 6eb1ea3b79 Revert revision 360862.
Revision 360862 was intended to improve identities sent in dialog-info
NOTIFY requests. Some users reported that hint became broken once this
was done. It's not clear exactly what part of the patch has caused this
regression, but broken hints are bad.

For now, this revision is being reverted so that the next releases of
Asterisk do not have bad behavior in them. The original reported issue
will have to be fixed differently in the next version of Asterisk.

(issue ASTERISK-16735)
........

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

Merged revisions 364707 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364708 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-30 19:51:55 +00:00
Joshua Colp ae1502be33 Add support for lightweight NAT keepalive.
If enabled using the keepalive option in sip.conf a small packet will be sent
at a regular interval to keep the NAT mapping open. This is lightweight as the
remote side does not need to parse and handle a SIP message.

(closes issue AST-783)
Review: https://reviewboard.asterisk.org/r/1756/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-28 20:24:45 +00:00
Mark Michelson 1a58b3b775 Don't attempt to make use of the dynamic_exclude_static ACL if DNS lookup fails.
(closes issue ASTERISK-18321)
Reported by Dan Lukes
Patches:
	ASTERISK-18321.patch by Mark Michelson (license #5049)
........

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

Merged revisions 364342 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-27 22:11:01 +00:00
Kinsey Moore 83cf78deda Allow SIP pvts involved in Replaces transfers to fall out of reference sooner
Unref the SIP pvt stored in the refer structure as soon as it is no longer
needed so that the pvt and associated file descriptors can be freed sooner.
This change makes a reference decrement unnecessary in code that handles SIP
BYE/Also transfers which should not touch the reference anyway.

(Closes issue ASTERISK-19579)
Reported by: Maciej Krajewski
Tested by: Maciej Krajewski
........

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

Merged revisions 364259 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-27 18:59:36 +00:00
Matthew Jordan 103031330a Allow for reloading SRTP crypto keys within the same SIP dialog
As a continuation of the patch in r356604, which allowed for the
reloading of SRTP keys in re-INVITE transfer scenarios, this patch
addresses the more common case where a new key is requested within 
the context of a current SIP dialog.  This can occur, for example, when
certain phones request a SIP hold.

Previously, once a dialog was associated with an SRTP object, any
subsequent attempt to process crypto keys in any SDP offer - either
the current one or a new offer in a new SIP request - were ignored.  This
patch changes this behavior to only ignore subsequent crypto keys within
the current SDP offer, but allows future SDP offers to change the keys.

(issue ASTERISK-19253)
Reported by: Thomas Arimont
Tested by: Thomas Arimont

Review: https://reviewboard.asteriskorg/r/1885/
........

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

Merged revisions 364204 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364205 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-27 14:45:08 +00:00
Kinsey Moore 7bf6a01cfa Fix reference leaks involving SIP Replaces transfers
The reference held for SIP blind transfers using the Replaces header in an
INVITE was never freed on success and also failed to be freed in some error
conditions.  This caused a file descriptor leak since the RTP structures in use
at the time of the transfer were never freed.  This reference leak and another
relating to subscriptions in the same code path have now been corrected.

(closes issue ASTERISK-19579)
........

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

Merged revisions 363987 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363988 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-26 13:31:16 +00:00
Alec L Davis 5746e0d2ac chan_sip: [general] maxforwards, not checked for a value greater than 255
The peer maxforwards is checked for both '< 1' and '> 255',
but the default 'maxforwards' in the [general] section is only checked for '< 1'

alecdavis (license 585)
Reported by: alecdavis
Tested by: alecdavis
 
Review: https://reviewboard.asterisk.org/r/1888/
........

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

Merged revisions 363935 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-26 09:48:55 +00:00
Richard Mudgett af39a4374e Make DAHDISendCallreroutingFacility wait 5 seconds for a reply before disconnecting the call.
Some switches may not handle the call-deflection/call-rerouting message if
the call is disconnected too soon after being sent.  Asteisk was not
waiting for any reply before disconnecting the call.

* Added a 5 second delay before disconnecting the call to wait for a
potential response if the peer does not disconnect first.

(closes issue ASTERISK-19708)
Reported by: mehdi Shirazi
Patches:
      jira_asterisk_19708_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett
........

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

Merged revisions 363734 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363740 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-25 20:51:58 +00:00
Richard Mudgett d2ac624b87 Clear ISDN channel resetting state if the peer continues to use it.
Some ISDN switches occasionally fail to send a RESTART ACKNOWLEDGE in
response to a RESTART request.

* Made the second SETUP received after sending a RESTART request clear the
channel resetting state as if the peer had sent the expected RESTART
ACKNOWLEDGE before continuing to process the SETUP.  The peer may not be
sending the expected RESTART ACKNOWLEDGE.

(issue ASTERISK-19608)
(issue AST-844)
(issue AST-815)
Patches:
      jira_ast_815_v1.8.patch (license #5621) patch uploaded by rmudgett (modified)
........

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

Merged revisions 363688 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363689 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-25 19:55:12 +00:00
Matthew Jordan e8e12afc6a AST-2012-006: Fix crash in UPDATE handling when no channel owner exists
If Asterisk receives a SIP UPDATE request after a call has been terminated and
the channel has been destroyed but before the SIP dialog has been destroyed, a
condition exists where a connected line update would be attempted on a
non-existing channel.  This would cause Asterisk to crash.  The patch resolves
this by first ensuring that the SIP dialog has an owning channel before
attempting a connected line update.  If an UPDATE request is received and no
channel is associated with the dialog, a 481 response is sent.

(closes issue ASTERISK-19770)
Reported by: Thomas Arimont
Tested by: Matt Jordan
Patches:
  ASTERISK-19278-2012-04-16.diff uploaded by Matt Jordan (license 6283)
........

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

Merged revisions 363107 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363108 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-23 14:10:19 +00:00
Matthew Jordan c37c7b4a2c AST-2012-005: Fix remotely exploitable heap overflow in keypad button handling
When handling a keypad button message event, the received digit is placed into
a fixed length buffer that acts as a queue.  When a new message event is
received, the length of that buffer is not checked before placing the new digit
on the end of the queue.  The situation exists where sufficient keypad button
message events would occur that would cause the buffer to be overrun.  This
patch explicitly checks that there is sufficient room in the buffer before
appending a new digit.

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

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

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

Merged revisions 363103 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-23 13:53:24 +00:00
Richard Mudgett 01194c5811 Use ast_channel_lock_both() where it was inlined before.
The CHANNEL_DEADLOCK_AVOIDANCE() feature of preserving where the channel
lock was originally obtained is overkill where ast_channel_lock_both() was
inlined.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-20 16:23:01 +00:00
Richard Mudgett 73f48997f9 Add original party id and reason support.
ISDN ETSI PTP and Q.SIG (And SS7 in future) have support for reporting who
was the original redirecting party of a call.

* Added support for the original redirecting party and reason to the
REDIRECTING function and the system core as well as to the stubbed
locations in sig_pri.c.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362779 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-20 00:57:13 +00:00
Terry Wilson 6d6bacd5cb Convert some strncpys to ast_copy_string
Review: https://reviewboard.asterisk.org/r/1732/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362635 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-19 19:05:17 +00:00
Matthew Jordan f78290068a Fix a variety of potential buffer overflows
* chan_mobile: Fixed an overrun where the cind_state buffer (an integer array
  of size 16) would be overrun due to improper bounds checking. At worst, the
  buffer can be overrun by a total of 48 bytes (assuming 4-byte integers),
  which would still leave it within the allocated memory of struct hfp.  This
  would corrupt other elements in that struct but not necessarily cause any
  further issues.

* app_sms: The array imsg is of size 250, while the array (ud) that the data
  is copied into is of size 160.  If the size of the inbound message is 
  greater then 160, up to 90 bytes could be overrun in ud.  This would corrupt
  the user data header (array udh) adjacent to ud.

* chan_unistim: A number of invalid memmoves are corrected.  These would move
  data (which may or may not be valid) into the ends of these buffers.

* asterisk: ast_console_toggle_loglevel does not check that the console log
  level being set is less then or equal to the allowed log levels of 32.

* format_pref: In ast_codec_pref_prepend, if any occurrence of the specified
  codec is not found, the value used to index into the array pref->order
  would be one greater then the maximum size of the array.

* jitterbuf: If the element being placed into the jitter buffer lands in the
  last available slot in the jitter history buffer, the insertion sort attempts
  to move the last entry in the buffer into one slot past the maximum length
  of the buffer.  Note that this occurred for both the min and max jitter
  history buffers.

* tdd: If a read from fsk_serial returns a character that is greater then 32,
  an attempt to read past one of the statically defined arrays containing the
  values that character maps to would occur.

* localtime: struct ast_time and tm are not the same size - ast_time is larger,
  although it contains the elements of tm within it in the same layout.  Hence,
  when using memcpy to copy the contents of tm into ast_time, the size of tm
  should be used, as opposed to the size of ast_time.

* extconf: this treats ast_timing's minmask array as if it had a length of 48,
  when it has defined the size of the array as 24.  pbx.h defines minmask as
  having a size of 48.

(issue ASTERISK-19668)
Reported by: Matt Jordan
........

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

Merged revisions 362496 from http://svn.asterisk.org/svn/asterisk/branches/10



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-19 02:40:55 +00:00
Richard Mudgett c7cb03a975 Add ability to ignore layer 1 alarms for BRI PTMP lines.
Several telcos bring the BRI PTMP layer 1 down when the line is idle.
When layer 1 goes down, Asterisk cannot make outgoing calls.  Incoming
calls could fail as well because the alarm processing is handled by a
different code path than the Q.931 messages.

* Add the layer1_presence configuration option to ignore layer 1 alarms
when the telco brings layer 1 down.  This option can be configured by span
while the similar DAHDI driver teignorered=1 option is system wide.  This
option unlike layer2_persistence does not require libpri v1.4.13 or newer.

Related to JIRA AST-598

JIRA ABE-2845
........

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

Merged revisions 362429 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362430 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-18 16:41:17 +00:00
Walter Doekes fc63e07135 Avoid cppcheck warnings; removing unused vars and a bit of cleanup.
Patch by: junky
Review: https://reviewboard.asterisk.org/r/1743/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-17 18:57:40 +00:00
Michael L. Young 8337ecd38d Turn off warning message when bind address is set to any.
When a bind address is set to an ANY address (udpbindport=::), a warning message
is displayed stating that "Address remapping activated in sip.conf but we're
using IPv6, which doesn't need it.  Please remove 'localnet' and/or 'externaddr'
settings."  But if one is running dual stack, we shouldn't be told to turn those
settings off.

This patch checks if the bind address is an ANY address or not.  The warning
message will now only be displayed if the bind address is NOT an ANY address and
IPv6 is being used.

Also, updated the copyright year.

(closes issue ASTERISK-19456) 
Reported by: Michael L. Young 
Tested by: Michael L. Young 
Patches: 
  chan_sip_ipv6_message.diff uploaded by Michael L. Young (license 5026)
........

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

Merged revisions 362264 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-17 15:00:02 +00:00
Matthew Jordan 2fed9cfa8f Fix negative return handling in channel drivers
In chan_agent, while handling a channel indicate, the agent channel driver
must obtain a lock on both the agent channel, as well as the channel the
agent channel is using.  To do so, it attempts to lock the other channel
first, then unlock the agent channel which is locked prior to entry into
the indicate handler.  If this unlock fails with a negative return value,
which can occur if the object passed to agent_indicate is an invalid ao2
object or is NULL, the return value is passed directly to strerror, which
can only accept positive integer values.

In chan_dahdi, the return value of dahdi_get_index is used to directly
index into the sub-channel array.  If dahd_get_index returns a negative
value, it would use that value to index into the array, which could cause
an invalid memory access.  If dahdi_get_index returns a negative number,
we now default to SUB_REAL.

(issue ASTERISK-19655)
Reported by: Matt Jordan

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

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

Merged revisions 362205 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362206 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-16 21:58:06 +00:00
Michael L. Young abf40d9b28 Add IPv6 address support to security events framework.
The current Security Events Framework API only supports IPv4 when it comes to
generating security events.  This patch does the following:

* Changes the Security Events Framework API to support IPV6 and updates
  the components that use this API.

* Eliminates an error message that was being generated since the current
  implementation was treating an IPv6 socket address as if it was IPv4.

* Some copyright dates were updated on files touched by this patch.

(closes issue ASTERISK-19447) 
Reported by: Michael L. Young 
Tested by: Michael L. Young 
Patches: 
  security_events_ipv6v3.diff uploaded by Michael L. Young (license 5026)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-16 21:20:50 +00:00
Kinsey Moore f9155c9c3d Make trunkfreq take effect when set
Previously, setting trunkfreq had no effect on initial load or on reload and
only ever used the default value.  This causes trunkfreq to be used 
appropriately on initial load and reload.

(closes issue ASTERISK-19521)
Patch-by: Jaco Kroon
........

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

Merged revisions 361981 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361987 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-12 16:25:09 +00:00
Richard Mudgett 198046d706 Prevent invalid access of free'd memory if DAHDI channel during an MWI event
In the MWI processing loop, when a valid event occurs the temporary caller ID
information is deallocated.  If a new DAHDI channel is successfully created,
the event is passed up to the analog_ss_thread without error and the loop
exits.  If, however, the DAHDI channel is not created, then the caller ID
struct has been free'd, and the gains reset to their previous level.  This
will almost certainly cause an invalid access to the free'd memory, either
in subsequent calls to callerid_free or calls to callerid_feed.

* Rework the -r361705 patch to better manage the cs and mtd allocated
resources.

* Fixed use of mwimonitoractive flag to be correct if the mwi_thread()
fails to start.
........

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

Merged revisions 361855 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361856 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-10 21:50:46 +00:00
Matthew Jordan 97f813f3a4 Prevent invalid access of free'd memory if DAHDI channel during an MWI event
In the MWI processing loop, when a valid event occurs the temporary caller ID
information is deallocated.  If a new DAHDI channel is successfully created, 
the event is passed up to the analog_ss_thread without error and the loop
exits.  If, however, the DAHDI channel is not created, then the caller ID
struct has been free'd, and the gains reset to their previous level.  This
will almost certainly cause an invalid access to the free'd memory, either
in subsequent calls to callerid_free or calls to callerid_feed.

This patch makes it so that we only free the caller ID structure if a
DAHDI channel is successfully created, and we bump the gains back up
if we fail to make a DAHDI channel.
........

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

Merged revisions 361706 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361707 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-09 20:55:53 +00:00
Kinsey Moore a485f44022 Add missing newlines to CLI logging
........

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

Merged revisions 361472 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-06 18:19:03 +00:00
Matthew Jordan a2e127a651 Fix a typo in the warning messages for an ignored media stream
Added a '\n' to the warning messages when we ignore a media stream due to the
port number being '0'.

(closes issue ASTERISK-19646)
Reported by: Badalian Vyacheslav
........

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

Merged revisions 361333 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361334 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-06 14:02:16 +00:00
Jonathan Rose e96a59acfd Replace GNU old-style field designator extensions to fix clang warnings
(issue ASTERISK-19540)
Reported by: Makoto Dei
Patches:
	clang-gnu-designator.patch uploaded by Makoto Dei (license 5027)
........
Also add from the patch the portion in res_fax_spandsp that didn't apply to 1.8

Merged revisions 361142 from http://svn.asterisk.org/svn/asterisk/branches/1.8
(closes issue ASTERISK-19540)
........

Merged revisions 361143 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361155 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-04 18:08:28 +00:00
Kinsey Moore 9cc6f2c59e Stop sending out RTCP if RTP is inactive
This change prevents Asterisk from sending RTCP receiver reports during a
remote bridge since it is no longer receiving media and should not be
reporting anything.

(related to ASTERISK-19366)
........

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

Merged revisions 360993 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360994 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-02 22:27:13 +00:00
Mark Michelson cc2366bca0 Improve accuracy of identifying information sent in dialog-info SIP NOTIFY requests.
This change makes use of connected party information in addition to caller ID in order
to populate local and remote XML elements in the dialog-info NOTIFYs.

(closes issue ASTERISK-16735)
Reported by: Maciej Krajewski
Tested by: Maciej Krajewski
Patches:
    local_remote_hint2.diff uploaded by Mark Michelson (license 5049)
........

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

Merged revisions 360863 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360872 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29 23:22:01 +00:00
Terry Wilson dd9405db05 Fix setting CDR variables in the hangup extension
A previous CDR fix for setting CDR variables during a bridge via
custom dialplan features broke setting CDR variables in the
hangup extension. This patch fixes the issue.

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

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

Merged revisions 358989 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360724 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-28 19:39:24 +00:00
Mark Michelson 01cc64585e Make a debug message regarding subscription changes more accurate.
I was getting confused during some testing why Asterisk was saying that
a subscription was being added when it was clearly being removed. This
fixes that confusion.
........

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

Merged revisions 360672 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360673 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-27 18:44:53 +00:00
Russell Bryant d6d7f51476 chan_iax2: Use OBJ_NODATA to be a bit more explicit.
This is just a minor code cleanup change.  These uses of ao2_callback() would
never return anything since the callbacks always returned 0.  However, be more
explicit that no returned results are wanted by specifying OBJ_NODATA.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360369 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-24 03:18:13 +00:00
Richard Mudgett 721f92058f Make number not available presentation also set screening to network provided.
Q.951 indicates that when the presentation indicator is "Number not
available due to interworking" for a number then the screening indicator
field should be "Network provided".

* Made ast_party_id_presentation() return AST_PRES_NUMBER_NOT_AVAILABLE
when the presentation is "Number not available due to interworking".  This
fix makes Asterisk consistent and it also makes it consistent with earlier
branches as far as this presentation value is concerned.

* Made pri_to_ast_presentation() and ast_to_pri_presentation() conversions
handle the "Number not available due to interworking" case better in
sig_pri.c.  This change is possible because the minimum required libpri
version (v1.4.11) has the necessary defines in libpri.h.
........

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

Merged revisions 360310 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360311 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-24 00:40:51 +00:00
Richard Mudgett df16bd973e Add missing initialization of update_redirecting in chan_sip.c
........

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

Merged revisions 360263 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360264 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-23 22:56:14 +00:00
Matthew Jordan c88d1c8337 Ensure Asterisk sends a BYE when pending on the final response to a re-INVITE
When Asterisk detects a hangup and cannot send a BYE due to a pending
INVITE, it sets the pendingbye flag and waits for the final response to that
INVITE.  When the response is received, it transmits the BYE.  If, however,
that INVITE request is a pending re-INVITE, it needs to first send a CANCEL
request to terminate the pending re-INVITE.  In that circumstance, Asterisk
was, in some scenarios, clearing the pendingbye flag after processing the
CANCEL request and not checking for a pending BYE when receiving the final
487 response to the INVITE.

This patch ensures that if the pendingbye flag is set, it is honored
regardless of the nature of the INVITE request currently in flight.

(closes issue ASTERISK-19365)
Reported by: Thomas Arimont
Tested by: Thomas Arimont
Patches:
  bugASTERISK-19365_2012_03_08.patch uploaded by mjordan (license 6283)

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

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

Merged revisions 360088 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-21 13:31:09 +00:00
Sean Bright 3a231e090f chan_iax2: Correct spelling of 'Port' header in IAX2 PeerStatus AMI Events
The PeerStatus event for IAX2 channels currently includes a header named Post
which should have been Port.  Post was removed and the AMI version has been
updated to 1.3.
........

Merged revisions 359982 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-20 18:17:16 +00:00
Alec L Davis 9ac6938e09 Missed lastinvite CSeq int to uint32_t change
from Review: https://reviewboard.asterisk.org/r/1699/
........

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

Merged revisions 359810 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359811 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-16 08:27:14 +00:00
Paul Belanger 31462e7bd6 Remove unused variable ‘srch’
Missed on the previous commit


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359651 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-15 18:34:39 +00:00
Paul Belanger 831af9fbc7 Remove some dead code found in _sip_show_peers()
Review: https://reviewboard.asterisk.org/r/1696/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359607 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-15 17:36:15 +00:00
Russell Bryant 44434bf1cf chan_iax2: Fix use of uninitialized sockaddr_in in try_transfer().
Initialize a struct sockaddr_in in try_transfer() so that the code isn't
(potentially) trying to read from it while uninitialized.
........

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

Merged revisions 359559 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-15 00:54:32 +00:00
Russell Bryant 3b0eb28d86 chan_gtalk: Fix potential use of uninitialized variable.
Avoid potential use of idroster in gtalk_alloc() before it has been
initialized.
........

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

Merged revisions 359509 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359510 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-15 00:07:18 +00:00
Richard Mudgett 9b31bd3cd8 Fix deadlock potential with some ast_indicate/ast_indicate_data calls.
Calling ast_indicate()/ast_indicate_data() with the channel lock held can
result in a deadlock with a local channel because of how local channels
need to avoid deadlock.
........

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

Merged revisions 359453 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359455 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14 22:38:29 +00:00
Russell Bryant 6c9f009b6d Fix invalid reads/writes due to incorrect sizeof().
These few places in the code used sizeof() on h_addr in struct hostent.
This is sizeof(char *).  The correct way to get the size of this address is to
use h_length.  This error would result in reads/writes of 8 bytes instead of 4
on 64-bit machines.
........

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

Merged revisions 359212 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359213 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14 10:05:07 +00:00
Russell Bryant 4585000039 Remove chan_usbradio and app_rpt.
These modules are being maintained outside of the tree and have been for a long
time now, so it doesn't make sense to keep them here.

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

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

Merged revisions 359051 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 23:42:24 +00:00
Richard Mudgett a22b56235b Add ability for chan_dahdi ISDN to block connected line updates per span.
Added new chan_dahdi.conf colp_send option parameter to block connected
line updates per span.

(closes issue ASTERISK-17025)
Reported by: Michael Smith


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 21:18:31 +00:00
Terry Wilson 699d2bd705 Make hints for invalid SIP devices return Unavail, not idle
This patch drastically simplifies the device state aggegation code.
The old method was not only overly complex, but also made it impossible
to return AST_DEVICE_INVALID from the aggregation code. The unit test
update is as a result of fixing that bug.

The SIP change stems from a bug introduced by removing a DNS lookup
for hostname-based SIP channels.

(closes issue ASTERISK-16702)
Review: https://reviewboard.asterisk.org/r/1808/
........

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

Merged revisions 358944 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 20:06:57 +00:00
Terry Wilson 786f5898d1 Finalize ast_channel opaquification
Review: https://reviewboard.asterisk.org/r/1786/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 18:20:34 +00:00
Igor Goncharovskiy c369a4416b Massive changes in chan_unistim channel driver. Include many fixes in channel driver operation and add additional functionality:
* Added ability to use multiple lines on phone, so for one device in configuration multiple lines can be defined, it allows to have multiple calls on one phone, callwaiting and switching between calls.
 * Added ability for translation on-screen menu to multiple languages. Tested on Russian languages.  Supported encodings: ISO 8859-1, ISO 8859-2, ISO 8859-4, ISO 8859-5, ISO 2022-JP. Language controlled by 'language' and on-screen menu of phone
 * Other described in CHANGES file

Testing done by issue tracker users: ibercom, scsiborg, idarwin, TeknoJuce, c0rnoTa. 
Tested on production system by Jonn Taylor (jonnt) using phone models: Nortel i2004, 1120E and 1140E.

(closes issue ASTERISK-16890)

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358766 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-12 17:01:26 +00:00
Sean Bright 99bd5b1e2e Eliminate a bunch of shadow warnings.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-08 17:02:52 +00:00
Jonathan Rose 587cb230b2 Make transfer not ignore port information with SIP.
Attempting to transfer with SIP to an address like 1XXXXX@ip.ad.re.ss:5061 would fail
because port would be cut from the host string and ignored. This simply keeps chan_sip
from cutting off the port number during these kinds of transfers.

(closes issue ASTERISK-19321)
Reported by: Federico Alves
Review: https://reviewboard.asterisk.org/r/1790/diff/#index_header
........

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

Merged revisions 358644 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358645 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-08 16:59:30 +00:00
Richard Mudgett b9a7421482 Change directly setting _softhangup in sig_ss7.c to use ast_softhangup_nolock().
Update to:
(issue ASTERISK-19372)
........

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

Merged revisions 358531 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358532 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-07 18:33:12 +00:00
Richard Mudgett 82ac7fb643 Fix ring cadance setup for outgoing calls on FXS ports.
* Fix referencing the wrong variable in chan_dahdi.c:my_set_cadence().

Thanks to Sean Bright for compiling with -Wshadow and finding this bug.
........

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

Merged revisions 358378 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358379 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-06 17:47:40 +00:00
Richard Mudgett a0f8821749 Add dialtone_detect option for analog incoming calls.
For analog lines, enables Asterisk to use dialtone detection per channel
if an incoming call was hung up before it was answered.  If dialtone is
detected, the call is hung up.
no:       Disabled. (Default)
yes:      Look for dialtone for 10000 ms after answer.
<number>: Look for dialtone for the specified number of ms after answer.
always:   Look for dialtone for the entire call.  Dialtone may return
          if the far end hangs up first.

dialtone_detect=yes
dialtone_detect=5000
dialtone_detect=always

(closes issue ASTERISK-19316)
Reported by: Jeremy Pepper
Patch by: Jeremy Pepper
Tested by: rmudgett,Jeremy Pepper

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358344 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-06 01:56:10 +00:00
Richard Mudgett 85484c050d Drop SS7 call if not connected yet when INCOMPLETE/BUSY/CONGESTION.
SS7 is a trunk protocol and should clear a failed call as soon as
possible.

* Made SS7 hangup a call immediately if it has not connected yet for
INCOMPLETE/BUSY/CONGESTION causes.  Otherwise, play an appropriate inband
tone.

(closes issue ASTERISK-19372)
Reported by: Igor Nikolaev
........

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

Merged revisions 358284 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-05 22:32:48 +00:00
Richard Mudgett dda40528ed Setup DSP when SS7 call is connected or early media is available.
Outgoing SS7 calls fail to detect incoming DTMF so any bridged channel
that requires out-of-band DTMF will not work.

* Added sig_ss7_open_media() calls at appropriate places in sig_ss7.c.
The new call converts conditionaled out unconverted code and shows that
the code really did something useful.

* Improved some chan_dahdi DTMF debug messages to help track DTMF
handling.

(closes issue ASTERISK-19312)
Reported by: Igor Nikolaev
........

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

Merged revisions 358261 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-05 21:48:32 +00:00
Joshua Colp 2736fe9917 Defer sending the connected line reinvite if a reinvite is already in progress.
(issue ASTERISK-19355)
Reported by: tomaso

(closes issue AST-825)
........

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

Merged revisions 358163 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-05 16:44:16 +00:00
Kinsey Moore dec0d4f9e3 Ensure Asterisk acknowledges ACKs to 4xx on Replaces errors
Asterisk was not setting pendinginvite in the upper half of
handle_request_invite such that the 4xx was retransmitted repeatedly even
though an ack was received for every retransmission.

(closes issue ASTERISK-19303)
Reported by: Jon Tsiros
Patches:
  fix-19303.patch uploaded by Jeremiah Gowdy (license 6358)

........

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

Merged revisions 358116 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358117 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-05 16:00:32 +00:00
Terry Wilson b71deb0518 Fix unused-but-set-variable warnings
All of these were pretty obviously unused. Some were unused because
the code that used them was #if 0'd. In those cases, I just commented
out the unused-but-set variables.
........

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

Merged revisions 358033 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358038 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-02 23:29:53 +00:00
Terry Wilson e8f8d2c81e Make chan_usbradio compile under dev mode
x=++x and x=x=1? Really?
........

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

Merged revisions 357987 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357999 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-02 22:36:28 +00:00
Richard Mudgett 9926662aba Remove ISDN hold restriction for non-bridged calls.
The check if an ISDN call is bridged before it could be placed on hold is
not necessary and is overly restrictive.  The check was originally done to
prevent problems with call transfers in case a user tried to transfer a
call connected to an application to another call connected to an
application.  The ISDN transfer code has not required this restriction for
quite some time because ECT could transfer any two active calls to each
other.

* Remove ISDN hold restriction for calls connected to applications.

* Made ast_waitfordigit_full() ignore AST_CONTROL_HOLD and
AST_CONTROL_UNHOLD instead of generating a warning message.

(closes issue ASTERISK-19388)
Reported by: Birger Harzenetter
Tested by: rmudgett
........

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

Merged revisions 357895 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357896 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-02 18:38:49 +00:00
Richard Mudgett ced1211fad Fix compile error from latest channel opaquification change.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357814 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-02 16:01:05 +00:00
Sean Bright f6b2f05f8c The default value for mohinterpret is the empty string, so when resetting to
default values don't explicitly set the value to "default."
........

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

Merged revisions 357812 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357813 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-02 16:00:41 +00:00
Mark Michelson 4094a9f57e Fix compilation error due to typo during channel opaquification.
s/ast_channel_fd_set/ast_channel_internal_fd_set/g



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357774 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-02 01:25:36 +00:00
Terry Wilson 0e5c761c28 Opaquify ast_channel typedefs, fd arrays, and softhangup flag
Review: https://reviewboard.asterisk.org/r/1784/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-01 22:09:18 +00:00
Terry Wilson a9d607a357 Opaquify ast_channel structs and lists
Review: https://reviewboard.asterisk.org/r/1773/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-29 16:52:47 +00:00
Richard Mudgett 764d2ccae2 Use more reasonable cause code when rejecting incoming call waiting calls.
(closes issue ASTERISK-19397)
Reported by: Birger Harzenetter
Patches:
      nochannel-cause.patch (license #5870) patch uploaded by Birger Harzenetter
........

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

Merged revisions 357408 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 21:01:09 +00:00
Mark Michelson 1bef7695ce Add a security event for the case where fake authentication challenge is sent.
........

Merged revisions 357318 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357319 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 18:52:13 +00:00
Richard Mudgett 85ea4277f1 Convert struct ast_tcptls_session_instance to finally use the ao2 object lock.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 18:46:34 +00:00
Jonathan Rose 565f411868 Changes transport option in sip.conf so that using multiple instances doesn't stack.
Prior to this patch, Using "transport=" multiple times would cause them to add to one
another like allow/deny. This patch changes that behavior to simply use the transport
option specified last. Also, if no transport option is applied now, the default will
automatically be UDP.

(closes ASTERISK-19352)
Reported by: jamicque
Patches:
	asterisk-19352-transport-warning-message-v1.patch uploaded by Michael L. Young (license 5026)
	issueA19352_no_transport_is_udp.patch uploaded by Walter Doekes (license 5674)
Review: https://reviewboard.asterisk.org/r/1745/diff/#index_header
........

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

Merged revisions 357271 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 18:23:02 +00:00
Sean Bright c20cfcdcf0 Address comments from Mark Michelson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357014 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 17:03:46 +00:00
Sean Bright 3cf09f40f7 Convert netsock.h over to use ast_sockaddrs rather than sockaddr_in and update
chan_iax2 to pass in the correct types.

chan_iax2 is the only consumer for the various ast_netsock_* functions in trunk
at this point, so this feels like a safe change to make.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357005 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 16:31:24 +00:00
Jonathan Rose 299dd5d4fc Adds an option to sip.conf that prevents diversion headers from being added.
send_diversion=no will prevent Diversion headers from being added to SIP
requests. This doesn't prevent Diversion from being added with dialplan
such as with SIPAddHeader.

(closes issue ASTERISK-16862)
Reported by: rsw686
Review: https://reviewboard.asterisk.org/r/1769/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356987 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 16:24:17 +00:00
Sean Bright 9ed6de9fd2 There isn't much point in saving off and restoring a value that we never use again.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356966 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 16:12:51 +00:00
Sean Bright 51c24c88a1 Prefer ast_set_qos() over ast_netsock_set_qos()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356882 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 14:13:58 +00:00
Richard Mudgett ebe2c33b72 Fix worker thread resource leak in SIP TCP/TLS.
The SIP TCP/TLS worker threads were created joinable but noone could join
them if they died on their own.

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

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

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

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

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

Merged revisions 356690 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356697 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24 18:33:04 +00:00
Matthew Jordan 670797e5da Allow SRTP policies to be reloaded
Currently, when using res_srtp, once the SRTP policy has been added to the
current session the policy is locked into place.  Any attempt to replace an
existing policy, which would be needed if the remote endpoint negotiated a new
cryptographic key, is instead rejected in res_srtp.  This happens in particular
in transfer scenarios, where the endpoint that Asterisk is communicating with
changes but uses the same RTP session.

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

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

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

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

Merged revisions 356605 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356606 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24 15:10:35 +00:00
Terry Wilson ebaf59a656 Opaquification for ast_format structs in struct ast_channel
Review: https://reviewboard.asterisk.org/r/1770/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24 00:32:20 +00:00
Richard Mudgett 235f88d122 Fix blind transfer parking issues if the dialed extension is not recognized as a parking extension.
Custom parking extensions may not be coded such that the first and only
extension priority is the Park application.  These custom parking
extensions will not be recognized as parking extensions.  When a call is
blind transferred to an extension that is not recognized as a parking
extension, the normal blind transfer code causes the transferred channel
to start executing dialplan.  Calls that get parked in this manner do not
know the original channel name that parked the call so the original parker
could never be called back if the parked call is not retrieved before the
timeout time.  The parking space is also announced to the call being
parked as a side effect of not knowing the original parking channel.

* Fix handling of BLINDTRANSFER channel variable for call parking.

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

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

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

JIRA AST-766
........

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

Merged revisions 356522 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-23 20:14:54 +00:00
Mark Michelson c078a1819c Fix ACK routing for non-2xx responses.
When we send an ACK for a 2xx response to an INVITE, we are supposed
to use the learned route set. However, when we receive a non-2xx final
response to an INVITE, we are supposed to send the ACK to the same place
we initially sent the INVITE.

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

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

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

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

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

Merged revisions 356476 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-23 15:49:13 +00:00
Kevin P. Fleming 25a9b03cd1 Correct some set-but-unused variable warnings in the mISDN library.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-22 21:10:05 +00:00
Terry Wilson 90a6848c67 Fix chan_misdn after the lastest opaquification changes
It now compiles, but there are some unrelated warnings for set but
unused variables.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-22 17:34:33 +00:00
Matthew Jordan a8d9e0bf0b Merged revisions 356215 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r356215 | mjordan | 2012-02-22 08:53:53 -0600 (Wed, 22 Feb 2012) | 32 lines
  
  Merged revisions 356214 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r356214 | mjordan | 2012-02-22 08:50:20 -0600 (Wed, 22 Feb 2012) | 27 lines
    
    Fix potential buffer overrun and memory leak when executing "sip show peers"
    
    The "sip show peers" command uses a fix sized array to sort the current peers
    in the peers ao2_container.  The size of the array is based on the current
    number of peers in the container.  However, once the size of the array is
    determined, the number of peers in the container can change, as the peers
    container is not locked.  This could cause a buffer overrun when populating
    the array, if peers were added to the container after the array was created.
    Additionally, a memory leak of the allocated array would occur if a user
    caused the _show_peers method to return CLI_SHOWUSAGE.
    
    We now create a snapshot of the current peers using an ao2_callback with the
    OBJ_MULTIPLE flag.  This size of the array is set to the number of peers
    that the iterator will iterate over; hence, if peers are added or removed
    from the peers container it will not affect the execution of the "sip show
    peers" command.
    
    Review: https://reviewboard.asterisk.org/r/1738/
    
    (closes issue ASTERISK-19231)
    (closes issue ASTERISK-19361)
    Reported by: Thomas Arimont, Jamuel Starkey
    Tested by: Thomas Arimont, Jamuel Starkey
    Patches: sip_show_peers_2012_02_16.diff uploaded by mjordan (license 6283)
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-22 14:54:42 +00:00
Sean Bright 1c971ae604 Make 'iax2 show callnumber usage' output make sense when an IP is passed in.
........

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

Merged revisions 356108 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356111 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-21 11:17:53 +00:00
Terry Wilson 57f42bd74f ast_channel opaquification of pointers and integral types
Review: https://reviewboard.asterisk.org/r/1753/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-20 23:43:27 +00:00
Sean Bright 25e5eb3b96 Remove spurious warning when 'qualifyfreqnotok' is set successfully.
(closes issue ASTERISK-17176)
Reported by: John Covert
Tested by: Sean Bright
Patches:
   chan_iax2.c.qualifyfreqnotok.patch uploaded by John Covert (license 5512)
........

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

Merged revisions 355998 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355999 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-20 18:40:11 +00:00
Sean Bright db487bd7f8 This was a LOG_NOTICE, so roll it back.
........

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

Merged revisions 355953 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-20 14:41:21 +00:00
Sean Bright 2bd6649a93 Change some debug messages from LOG_DEBUG to ast_debug.
........

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

Merged revisions 355950 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355951 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-20 14:37:41 +00:00
Sean Bright bec0ee0851 Add some boilerplate documentation for IAXVAR and IAXPEER.
........

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

Merged revisions 355905 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-19 18:06:08 +00:00
Sean Bright 2c1b3144cb Set the length of the ast_sockaddr, so that we can set it's port later.
Without this, the call to ast_sockaddr_set_port a few lines later is a noop.
........

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

Merged revisions 355902 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355903 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-19 17:51:12 +00:00
Alec L Davis a4f6d96b2e push 'outgoing' flag from sig_XXX up to chan_dahdi
'p->outgoing' in chan_dahdi and sig_analog wern't kept in sync, particulary FXS ast_hangup didn't clear the 'outgoing' flag.
sig_pri and sig_ss7 were keeping 'outgoing' flag insync.

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

(issue ASTERISK-19316)

alecdavis (license 585)
Reported by: Jeremy Pepper
Tested by: alecdavis
 
Review: https://reviewboard.asterisk.org/r/1747/
........

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

Merged revisions 355851 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355852 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-18 08:02:08 +00:00
Sean Bright 3816fdde94 Don't allow trunkfreq to be greater than 1000ms.
........

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

Merged revisions 355794 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355795 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-17 22:03:56 +00:00
Sean Bright 7c373d8c13 Pass the correct value to ast_timer_set_rate() for IAX2 trunking.
IAX2 uses the trunkfreq variable to determine how often to send trunk packets, but
this value is in milliseconds while ast_timer_set_rate() expects the rate argument
to be ticks per second.  So we divide 1000 by trunkfreq and pass that in instead.

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

Tracked down by myself and Bob Wienholt.
........

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

Merged revisions 355747 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355748 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-17 19:35:11 +00:00
Mark Michelson 8a20faa8d7 Fix regressions with regards to route-set creation on early dialogs.
This fixes two main issues:

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

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

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

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

Merged revisions 355733 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355745 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-17 19:22:22 +00:00
Sean Bright b69fb773d2 When IAX2 debugging is enabled, make sure to log 'apathetic' messages too.
........

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

Merged revisions 355530 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355531 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-15 19:29:26 +00:00
Sean Bright 45f361c9bd Remove IAX_OLD_FIND from chan_iax2.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355495 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-15 18:41:22 +00:00
Sean Bright 0d12368261 Use TRUNK_CALL_START as originally intended.
Back in r646, TRUNK_CALL_START was added and defined as 0x4000.  That same value
was also hard-coded in one part of the IAX2 code instead of using the #define.

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

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

Merged revisions 355449 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355450 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-15 17:26:30 +00:00
Mark Michelson 03894236d0 Properly invert the return of a strncmp call.
This was causing identification that should have been
made private to be public.

(closes issue AST-814)
reported by Patrick Anderson

Patches:
	chan_sip.c.diff uploaded by Patrick Anderson (license 5430)
........

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

Merged revisions 355271 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355274 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-14 16:28:01 +00:00
Sean Bright 98111f8f1f Clear the high order bit from the destination call number before sending.
send_apathetic_reply takes the incoming frame's source call number as the
destination call number for the outgoing frame.  If the incoming frame was a
full frame, then the high order bit of the source call number is set and will be
interpreted as a retransmit when sent back out as the destination call number.
........

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

Merged revisions 355183 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355184 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-14 13:35:02 +00:00
Richard Mudgett d8af1a4882 Fix compile error from most recent ast_channel opaquification installment.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-13 21:36:26 +00:00
Terry Wilson 34c55e8e7c Opaquify char * and char[] in ast_channel
Review: https://reviewboard.asterisk.org/r/1733/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-13 17:27:06 +00:00
Kinsey Moore 6225c6cadc Fix parsing of SIP headers where compact and non-compact headers are mixed
Change parsing of SIP headers so that compactness of the header no longer
influences which header will be chosen.  Previously, a non-compact header
would be chosen instead of a preceeding compact-form header.

(closes issue ASTERISK-17192)
Review: https://reviewboard.asterisk.org/r/1728/
........

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

Merged revisions 354703 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354704 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-09 20:52:13 +00:00
Terry Wilson e5c51ee44c Add auto_force_rport and auto_comedia NAT options
This patch adds the auto_force_rport and auto_comedia NAT options. It
also converts the nat= setting to a list of comma-separated combinable
options: no, force_rport, comedia, auto_force_rport, and auto_comedia.
nat=yes remains as an undocumented option equal to
"force_rport,comedia". The first instance of 'yes' or 'no' in the list
stops parsing and overrides any previously set options. If an auto_*
option is specified with its non-auto_ counterpart, the auto setting
takes precedence.

This patch builds upon the patch posted to ASTERISK-17860 by JIRA user
pedro-garcia.

(closes issue ASTERISK-17860)
Review: https://reviewboard.asterisk.org/r/1698/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-09 18:14:39 +00:00
Matthew Jordan dff9b61f5c Clean-up of minor formatting issues in r354542/3/4
rmudgett pointed out some formatting issues in the check-in for
ASTERISK-19290.  This cleans those up.

Review: https://reviewboards.asterisk.org/r/1722/
........

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

Merged revisions 354548 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354549 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-09 17:09:10 +00:00
Matthew Jordan ba08e9f4d6 Fix SIP INFO DTMF handling for non-numeric codes
In ASTERISK-18924, SIP INFO DTMF handlingw as changed to account for both
lowercase alphatbetic DTMF events, as well as uppercase alphabetic DTMF
events.  When this occurred, the comparison of the character buffer containing
the event code was changed such that the buffer was first compared again '0'
and '9' to determine if it was numeric.  Unfortunately, since the first
character in the buffer will typically be '1' in the case of non-numeric
event codes (10-16), this caused those codes to be converted to a DTMF event
of '1'.  This patch fixes that, and cleans up handling of both
application/dtmf-relay and application/dtmf content types.

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

(closes issue ASTERISK-19290)
Reported by: Ira Emus
Tested by: mjordan
........

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

Merged revisions 354543 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354544 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-09 16:37:01 +00:00
Richard Mudgett 16fbc7e902 Fix some compile problems from the 'cppcheck' patch.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-09 03:09:39 +00:00
Terry Wilson 3342183016 Add callbackextension matching & realtime callbackextensions
This patch is based on the one by David Vossel, developer extrodinaire, at
https://reviewboard.asterisk.org/r/344/. If multiple peers are defined with the
same host/port, but differing callbackextensions, it chooses the peer with the
matching callbackextension. Since callbackextension creates an outbound
registration with the callbackextension as the Contact address, matching an
incoming request by that (in addition to the host/port) makes a lot of sense.

This patch also adds support for callbackextension to realtime by querying all
peers with callbackextensions on reload and adding registrations for them.

(closes issue ASTERISK-13456)
Review: https://reviewboard.asterisk.org/r/344/
Review: https://reviewboard.asterisk.org/r/1717/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354458 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-08 21:28:55 +00:00
Kevin P. Fleming f0e321b88a Restore some variables removed by the 'cppcheck' patch that were actually needed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354450 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-08 21:25:57 +00:00
Walter Doekes db24fc2523 Avoid cppcheck warnings; removing unused vars and a bit of cleanup.
Patch by: Clod Patry
Review: https://reviewboard.asterisk.org/r/1651


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-08 20:49:48 +00:00
Terry Wilson 8ba2d70602 Fix multiple SIP realtime issues
1. Set lastms to 0 when clearing instead of ""
2. Don't set ipaddr or port to the string "(null)" when they are empty
3. Add missing required fields, set default for lastms to 0, and modify
   the length of the ipaddr field to 45 in the Postgresql realtime.sql
   file.

(closes issue ASTERISK-19172)
Review: https://reviewboard.asterisk.org/r/1703/
........

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

Merged revisions 354349 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354360 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-07 21:33:42 +00:00
Richard Mudgett a4f5d2c2ef Restore alternate SIG_PRI_DEBUG_DEFAULT meaning.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354174 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-06 20:56:23 +00:00
Kinsey Moore 49ed50d8ac Allow more control over the output of pri debug
This changes the debuglevel of 'pri set debug' to a bit mask allowing the user
to independently select bits of output:
1 libpri internals including state machine
2 Decoded Q.931 messages
4 Decoded Q.921 headers
8 raw hex dump of the full frames

Additionally, this ensures that the meaning of "on" does not change and
intrudces intense and hex to simplify usage.

(closes issue ASTERISK-17159)
Original-patch-by: wimpy


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354165 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-06 20:18:16 +00:00
Jonathan Rose a898eb4d07 Fixes deadlocks occuring in chan_agent due to r335976
Bad locking order was added to chan_agent to prevent segfaults from having no locking
in a patch by irroot. This patch addresses the bad locking order by releasing locks before
getting the right locking order to stop deadlocks from occuring when doing multiple
interactions with agents.

(closes issue ASTERISK-19285)
Reported by: Alex Villacis Lasso
Review: https://reviewboard.asterisk.org/r/1708/
........

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

Merged revisions 354000 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354001 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-03 21:33:23 +00:00
Kinsey Moore 29318afc15 Ensure entering T.38 passthrough does not cause an infinite loop
After R340970 Asterisk was still polling the RTCP file descriptor after RTCP is
shut down and removed. If the descriptor happened to have data ready when the
removal occured then Asterisk would go into an infinite loop trying to read
data that it can never actually access. This change disables the audio RTCP
file descriptor for the duration of the T.38 transaction.

(closes issue ASTERISK-18951)
Reported-by: Kristijan Vrban
........

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

Merged revisions 353916 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-02 22:28:36 +00:00
Richard Mudgett 63c5eaee43 Restore the 'w' modifier support for ISDN spans. Dial(DAHDI/g0/1234w888)
This feature also causes the sending complete ie to be sent for switch
types that do not automatically send the ie.  (EuroISDN/ETSI)

The main difference between dialing Dial(DAHDI/g0/1234w888) and
Dial(DAHDI/g0/1234,,D(888)) is the sending of the sending complete ie.

(closes issue ASTERISK-19176)
Reported by: rmudgett
Tested by: rmudgett
........

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

Merged revisions 353868 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353872 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-02 20:18:11 +00:00
Jonathan Rose 5164196972 Fix sip show peers port output, align columns, and fix ami port output.
A previous patch I committed from ASTERISK-16930 unexpectedly changed some output for
the AMI action "sippeers" which this patch changes back. Also, this aligns the output
for the cli command "sip show peers" and fixes another issue that patch introduced by
using ast_sockaddr_stringify calls multiple times without immediately using the pointer.
I also went ahead and did a little janitorial work to clean up whitespace in
_sip_show_peers.

(issue ASTERISK-16930)
(closes issue ASTERISK-19281)
Reported by: Patrick El Youssef
Patches:
	ASTERISK-19281.diff uploaded by Walter Doekes (license 5674)
........

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

Merged revisions 353771 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-02 17:07:35 +00:00
Jonathan Rose 0e334d427b Use ast_sockaddr_stringify_fmt wrappers for various functions in chan_sip
There are a number of cleaner looking wrappers for ast_sockaddr_stringify_fmt
available which are slightly more readable than using a direct call to
ast_sockaddr_stringify_fmt. This patch switches a number of those calls in
chan_sip to use those wrappers and is generally harmless.

(Closes issue ASTERISK-16930)
Reported by: Michael L. Young
Patches:
	chan_sip-broken-registration-1.8.diff uploaded by Michael L. Young (license 5026)
........

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

Merged revisions 353721 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353725 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-01 21:18:03 +00:00
Richard Mudgett 23bc964e1c Constify some more channel driver technology callback parameters.
Review: https://reviewboard.asterisk.org/r/1707/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353685 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-01 19:53:38 +00:00
Terry Wilson de57235ac6 Re-link peers by IP when dnsmgr changes the IP
Asterisk's dnsmgr currently takes a pointer to an ast_sockaddr and updates it
anytime an address resolves to something different. There are a couple of
issues with this. First, the ast_sockaddr is usually the address of an
ast_sockaddr inside a refcounted struct and we never bump the refcount of those
structs when using dnsmgr. This makes it possible that a refresh could happen
after the destructor for that object is called (despite ast_dnsmgr_release
being called in that destructor). Second, the module using dnsmgr cannot be
aware of an address changing without polling for it in the code. If an action
needs to be taken on address update (like re-linking a SIP peer in the
peers_by_ip table), then polling for this change negates many of the benefits
of having dnsmgr in the first place.

This patch adds a function to the dnsmgr API that calls an update callback
instead of blindly updating the address itself. It also moves calls to
ast_dnsmgr_release outside of the destructor functions and into cleanup
functions that are called when we no longer need the objects and increments the
refcount of the objects using dnsmgr since those objects are stored on the
ast_dnsmgr_entry struct. A helper function for returning the proper default SIP
port (non-tls vs tls) is also added and used.

This patch also incorporates changes from a patch posted by Timo Teräs to
ASTERISK-19106 for related dnsmgr issues.

(closes issue ASTERISK-19106)

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

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

Merged revisions 353397 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353418 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-30 23:58:51 +00:00
Alec L Davis f92d6412ab Merged revisions 353369 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r353369 | alecdavis | 2012-01-31 11:42:28 +1300 (Tue, 31 Jan 2012) | 9 lines
  
  Merged revisions 353368 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r353368 | alecdavis | 2012-01-31 11:40:40 +1300 (Tue, 31 Jan 2012) | 2 lines
    
    prevent debug messsges displaying -ve Cseq numbers. Missed in R353320
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353370 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-30 22:44:50 +00:00
Alec L Davis 0ccc1f5274 Merged revisions 353321 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r353321 | alecdavis | 2012-01-31 11:16:22 +1300 (Tue, 31 Jan 2012) | 25 lines
  
  Merged revisions 353320 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r353320 | alecdavis | 2012-01-31 10:57:49 +1300 (Tue, 31 Jan 2012) | 18 lines
    
    RFC3261 Section 8.1.1.5. The sequence number value MUST be expressible as a 32-bit unsigned integer
    
    * fix: use %u instead of %d when dealing with CSeq numbers - to remove possibility of -ve numbers.
    
    * fix: change all uses of seqno and friends (ocseq icseq) from 'int' or 'unsigned int' to uint32_t.
    
    Summary of CSeq numbers.
    An initial CSeq number must be less than 2^31
    A CSeq number can increase in value up to 2^32-1
    An incrementing CSeq number must not wrap around to 0.
    
    Tested with Asterisk 1.8.8.2 with Grandstream phones.
     
    alecdavis (license 585)
    Tested by: alecdavis
     
    Review: https://reviewboard.asterisk.org/r/1699/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353347 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-30 22:28:37 +00:00
Kevin P. Fleming 82f313b7b8 Clarify log WARNING message when port-zero SDP 'm' lines received.
Previously, if an m-line in an SDP offer or answer had a port number of zero,
that line was skipped, and resulted in an 'Unsupported SDP media type...'
warning message. This was misleading, as the media type was not unsupported,
but was ignored because the m-line indicated that the media stream had been
rejected (in an answer) or was not going to be used (in an offer).
........

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

Merged revisions 353261 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-30 12:50:40 +00:00
Damien Wedhorn 843c7ef088 Allow softkey reject while device onhook.
Fixes up softkey endcall. Previous code was a copy of onhook, now
allows for endcall softkey to be used while device is still onhook.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353224 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-29 22:33:08 +00:00
Richard Mudgett 27b69e7d29 Audit of ao2_iterator_init() usage for v1.8.
Fixes numerous reference leaks and missing ao2_iterator_destroy() calls as
a result.

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

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

Merged revisions 352956 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-27 18:47:16 +00:00
Alec L Davis e0ca02fe21 Merged revisions 352863 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r352863 | alecdavis | 2012-01-27 13:08:03 +1300 (Fri, 27 Jan 2012) | 19 lines
  
  Merged revisions 352862 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r352862 | alecdavis | 2012-01-27 13:05:30 +1300 (Fri, 27 Jan 2012) | 12 lines
    
    rfc4235 - Section 4.1: Versions MUST be representable using a non-negative 32 bit integer.
    
    If a BLF subscription exists for long enough, using %d may print negative version numbers.
    Unlikely, as 2^32 at 1 update per second is ~137 years, or half that before the versions number started going negative.
    
    Tested with Asterisk 1.8.8.2 with Grandstream phones.
     
    alecdavis (license 585)
    Tested by: alecdavis
     
    Review: https://reviewboard.asterisk.org/r/1694/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-27 00:11:41 +00:00
Jonathan Rose f4d98aeb28 Copy amaflags to sip_pvt from peer during create_addr_from_peer
For whatever reason, we don't have a single function for copying data like this
from SIP peers to the SIP pvt. This patch adds the copying of amaflags to the
sip_pvt, but it would probably be worth discussing this function along with
the others that essentially just copy some amount of data from a peer to a
private.

(Closes issue ASTERISK-19029)
Reported by: Matt Lehner
........

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

Merged revisions 352756 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-26 19:09:02 +00:00
Alec L Davis ed32b1c098 Merged revisions 352705 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r352705 | alecdavis | 2012-01-26 19:33:11 +1300 (Thu, 26 Jan 2012) | 27 lines
  
  Merged revisions 352704 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r352704 | alecdavis | 2012-01-26 19:27:07 +1300 (Thu, 26 Jan 2012) | 20 lines
    
    Cleanup dialog-info+xml Notify dialog
    
    Make similar to other Notify messages.
    
    sample output:
    
    <?xml version="1.0"?>
    <dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="715" state="full" entity="sip:8523@192.168.x.xx">
    <dialog id="8523">
    <state>terminated</state>
    </dialog>
    </dialog-info>
    
    Tested with Asterisk 1.8.8.2 with Grandstream phones.
     
    alecdavis (license 585)
    Tested by: alecdavis
     
    Review: https://reviewboard.asterisk.org/r/1693/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-26 06:36:23 +00:00
Terry Wilson 080ea28515 Remove some extraneous debugging from registry memleak fix
........

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

Merged revisions 352556 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352565 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-25 17:33:23 +00:00
Richard Mudgett cbe57b11cb Fixes for sending SIP MESSAGE outside of calls.
* Fix authenticate MESSAGE losing custom headers added by the MESSAGE_DATA
function in the authorization attempt.

* Pass up better From header contents for SIP to use.  Now is in the
"display-name" <URI> format expected by MessageSend.  (Note that this is a
behavior change that could concievably affect some people.)

* Block user from adding standard headers that are added automatically.
(To, From,...)

* Allow the user to override the Content-Type header contents sent by
MessageSend.

* Decrement Max-Forwards header if the user transferred it from an
incoming message.

* Expand SIP short header names so the dialplan and other code only has to
deal with the full names.

* Documents what SIP expects in the MessageSend(from) parameter.

(closes issue ASTERISK-18992)
Reported by: Yuri

(closes issue ASTERISK-18917)
Reported by: Shaun Clark

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

Merged revisions 352520 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-25 17:23:25 +00:00
Terry Wilson 4bf5e3716e Clean up some SIP registry-related memory leaks
1) Be sure and free at unload the epa_backend we allocate at startup
2) Do the same sip_registry cleanup at unload we do at reload

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

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

Merged revisions 352515 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-25 17:02:29 +00:00
Terry Wilson 213f7a65b5 Fix channel opaquification of stringfields for chan_vpb
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352475 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-25 01:21:23 +00:00
Mark Michelson 0fe9043233 Don't do a DNS lookup on an outbound REGISTER host if there is an outbound proxy configured.
(closes issue ASTERISK-16550)
reported by: Olle Johansson
........

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

Merged revisions 352430 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352431 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-24 22:28:08 +00:00
Terry Wilson 99cae5b750 Opaquify channel stringfields
Continue channel opaque-ification by wrapping all of the stringfields.
Eventually, we will restrict what can actually set these variables, but
the purpose for now is to hide the implementation and keep people from
adding code that directly accesses the channel structure. Semantic
changes will follow afterward.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352348 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-24 20:12:09 +00:00
Richard Mudgett 74508e3bca Fix sip_cfg.notifycid to be set with the defined enum values.
The invalid value used when notifycid was enabled was benign.  As far as
the code was concerned -1 and 1 are equivalent.

(closes issue ASTERISK-19232)
Reported by: Eike Kuiper
........

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

Merged revisions 352091 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-23 17:36:28 +00:00
Mark Michelson 02408a2476 Remove XXX comment that is not necessary.
........

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

Merged revisions 352017 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352019 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-21 00:11:13 +00:00
Mark Michelson ab8ba431b6 Fix RTP reference leak.
If a blind transfer were initiated using a REFER without a prior
reINVITE to place the call on hold, AND if Asterisk were sending
RTCP reports, then there was a reference for the RTP instance
of the transferer.

This fixes the issue by merging two similar but slightly conflicting
sections of code into a single area. It also adds a stop_media_flows()
call in the case that the transferer's UA never sends a BYE to us
like it is supposed to.

(issue ASTERISK-19192)

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

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

Merged revisions 352015 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352018 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-21 00:10:35 +00:00
Richard Mudgett d0c765497d Make CLI sip show channel list the complete route set.
(closes issue ASTERISK-16877)
Reported by: klaus3000
Patches:
      show-complete-routeset-patch.txt (license #5054) patch uploaded by klaus3000 (modified)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351977 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-20 23:05:06 +00:00
Kinsey Moore c6fd4f5d74 SIP session timeout AMI event
Add an AMI event in the Call category that is issued when a call is terminated
due to either RTP stream inactivity or SIP session timer expiration.

Event description:

Event: SessionTimeout
Source: source
Channel: channel-name
Uniqueid: channel-unique-id

`source` can be either RTPTimeout or SIPSessionTimer

(closes issue ASTERISK-16467)
Patch-by: Kirill Katsnelson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351939 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-20 21:26:50 +00:00
Jonathan Rose 1a6960099b Adds setting of mwi_from field to check_auth_result check_peer_ok
(closes ASTERISK-19057)
Reported By: Yuri
Patches: 348360chan_sip.diff uploaded by Yuri (license 5242)
........

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

Merged revisions 351762 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-20 16:00:58 +00:00
Richard Mudgett ae32acfa3e Misc minor fixes in reqresp_parser.c and chan_sip.c.
* Fix corner cases in get_calleridname() parsing and ensure that the
output buffer is nul terminated.

* Make get_calleridname() truncate the name it parses if the given buffer
is too small rather than abandoning the parse and not returning anything
for the name.  Adjusted get_calleridname_test() unit test to handle the
truncation change.

* Fix get_in_brackets_test() unit test to check the results of
get_in_brackets() correctly.

* Fix parse_name_andor_addr() to not return the address of a local buffer.
This function is currently not used.

* Fix potential NULL pointer dereference in sip_sendtext().

* No need to memset(calleridname) in check_user_full() or tmp_name in
get_name_and_number() because get_calleridname() ensures that it is nul
terminated.

* Reply with an accurate response if get_msg_text() fails in
receive_message().  This is academic in v1.8 because get_msg_text() can
never fail.
........

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

Merged revisions 351646 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351667 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-19 23:31:17 +00:00
Jonathan Rose 6fd0ac9dcd Eliminates doubling the :port part of SIP Notify Message-Account headers.
This patch prevents the domain string from getting mangled during the initreqprep
step by moving the initialization to before its immediate use.  It also documents
this pitfall for the ast_sockaddr_stringify functions.

(issue ASTERISK-19057)
Reported by: Yuri
Review: https://reviewboard.asterisk.org/r/1678/
........

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

Merged revisions 351560 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-19 21:55:41 +00:00
Joshua Colp ddf421bd5c Prevent crash when an SDP offer is received with an encrypted video stream when support for video is disabled and res_srtp is loaded.
(closes issue ASTERISK-19202)
Reported by: Catalin Sanda
........

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

Merged revisions 351505 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351506 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-19 21:13:02 +00:00
Stefan Schmidt f69fd136f4 The get_pai function in chan_sip.c didn't recognized a proper callerid name and
number from a P-Asserted-Identity cause the header parsing logic was wrong. 
Changing the parsing functions to the sip header parsing APIs in 
reqresp_parser.h solves this problem.

Review: https://reviewboard.asterisk.org/r/1673
Reviewed by: wdoekes2 and Mark Michelson
........

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

Merged revisions 351408 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-18 16:02:15 +00:00
Mark Michelson 5af788ccd0 Use built-in parsing functions for Contact and Record-Route headers.
If a Contact or a Record-Route header had a quoted string with an
item in angle brackets, then we would mis-parse it. For instance,
"Bob <1234>" <1234@example.org>
would be misparsed as having the URI "1234"
The fix for this is to use parsing functions from reqresp_parser.h
since they are heavily tested and are awesome.

(issue ASTERISK-18990)
........

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

Merged revisions 351286 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-17 16:56:04 +00:00
Matthew Jordan f86621eb93 Fix udptl issue with initial INVITE introduced by r351027
When an inital INVITE occurs that contains image media, a channel
is not yet associated with the SIP dialog.  The file descriptor
associated with the udptl session needs to be set in
initialize_udptl or in sip_new to account for this scenario.
........

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

Merged revisions 351234 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351235 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-17 16:08:43 +00:00
Russell Bryant 141dd18848 Merged revisions 351183 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r351183 | russell | 2012-01-16 20:43:19 -0500 (Mon, 16 Jan 2012) | 29 lines
  
  Merged revisions 351182 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r351182 | russell | 2012-01-16 20:37:03 -0500 (Mon, 16 Jan 2012) | 22 lines
    
    Add some missing locking in chan_sip.
    
    This patch adds some missing locking to the function 
    send_provisional_keepalive_full().  This function is called from the scheduler,
    which is processed in the SIP monitor thread.  The associated channel (or pbx)
    thread will also be using the same sip_pvt and ast_channel so locking must be
    used.  The sip_pvt_lock_full() function is used to ensure proper locking order
    in a safe manner.
    
    In passing, document a suspected reference counting error in this function.
    The "fix" is left commented out because when the "fix" is present, crashes
    occur.  My theory is that fixing it is exposing a reference counting error
    elsewhere, but I don't know where.  (Or my analysis of this being a problem
    could have been completely wrong in the first place).  Leave the comment in
    the code for so that someone may investigate it again in the future.
    
    Also add a bit of doxygen to transmit_provisional_response().
    
    (closes issue ASTERISK-18979)
    
    Review: https://reviewboard.asterisk.org/r/1648
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351184 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-17 01:48:12 +00:00
Terry Wilson aacc158072 Ensure ACK retransmit & hangup on non-200 response to INVITE
When handling a non-2xx final response on an INVITE transaction, we have to
keep the transaction around after we send an ACK in case we receive a
retransmission of the response so we can re-transmit the ACK, but also tear
down the ast_channel as soon as we transmit the ACK. Before this patch, we
could fail at both of these things. Calling sip_alreadygone/needdestroy
prevented us from keeping the transaction up and retransmitting the ACK, and
queueing CONGESTION was not sufficient to cause the channel to be torn down
when originating calls via the CLI, for example.

This patch queues a hangup with CONGESTION instead of just queueing CONGESTION
for these responses and removes the sip_alreadygone and sip_needdestroy calls
from handle_response_invite on non-2xx responses. It relies on the hangup
calling sip_scheddestroy.

For more information, see section 17.1.1.1 of RFC 3261.

(closes issue ASTERISK-17717)
Review: https://reviewboard.asterisk.org/r/1672/
........

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

Merged revisions 351131 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-16 21:50:10 +00:00
Terry Wilson fb5924ebe8 Don't prematurely stop SIP session timer
When Asterisk is the UAS (incoming call, endpoint is re-inviting) the SIP session timer expires after half the time the sip endpoint indicates in the Session-expires header in proc_session_timer(). The session timer was being stopped totally and being handled as an error case instead of running again until the second expiry. This patch treats the half-time expiry as a non-error case and continues the timer until the true expiry.

(closes issue ASTERISK-18996)
Reported by: Thomas Arimont
Tested by: Thomas Arimont
Patches: session_timer_fix.diff by Terry Wilson (License #5357)
  based on session_timer.patch by Thomas Arimont (License #5525)
........

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

Merged revisions 351081 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351082 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-16 20:15:24 +00:00
Matthew Jordan e09527b10d Create and initialize udptl only when dialog negotiates for image media
Prior to this patch, the udptl struct was allocated and initialized when a
dialog was associated with a peer that supported T.38, when a new SIP
channel was allocated, or what an INVITE request was received.  This resulted
in any dialog associated with a peer that supported T.38 having udptl support
assigned to it, including the UDP ports needed for communication.  This
occurred even in non-INVITE dialogs that would never send image media.

This patch creates and initializes the udptl structure only when the SDP
for a dialog specifies that image media is supported, or when Asterisk
indicates through the appropriate control frame that a dialog is to support
T.38.

(closes issue ASTERISK-16698)
Reported by: under
Tested by: Stefan Schmidt
Patches: udptl_20120113.diff uploaded by mjordan (License #6283)

(closes issue ASTERISK-16794)
Reported by: Elazar Broad
Tested by: Stefan Schmidt

review: https://reviewboard.asterisk.org/r/1668/
........

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

Merged revisions 351028 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-16 19:13:56 +00:00
Kevin P. Fleming 0f83634984 Multiple revisions 350788-350789
........
  r350788 | kpfleming | 2012-01-14 09:22:33 -0600 (Sat, 14 Jan 2012) | 8 lines
  
  Ensure that two prerequisites are properly installed on Debian-style distributions.
  
  * Don't specify a specific version of libgmime; newer versions are available
    now and acceptable.
  
  * Install libsrtp so that res_srtp can be built.
........
  r350789 | kpfleming | 2012-01-14 09:23:32 -0600 (Sat, 14 Jan 2012) | 3 lines
  
  Correct some 'set-but-not-used' variable warnings.
........

Merged revisions 350788-350789 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 350790 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350791 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-14 15:51:43 +00:00
Mark Michelson 9c161503dc Set port to a default sane value if a bogus one is provided when parsing hostnames.
........

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

Merged revisions 350680 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350681 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-13 20:32:19 +00:00
Matthew Jordan a8276fe8ef Fix crash from bridge channel hangup race condition in ConfBridge
This patch addresses two issues in ConfBridge and the channel bridge layer:
1. It fixes a race condition wherein the bridge channel could be hung up
2. It removes the deadlock avoidance from the bridging layer and makes the
   bridge_pvt an ao2 ref counted object

Patch by David Vossel (mjordan was merely the commit monkey)

(issue ASTERISK-18988)
(closes issue ASTERISK-18885)
Reported by: Dmitry Melekhov
Tested by: Matt Jordan
Patches: chan_bridge_cleanup_v.diff uploaded by David Vossel (license 5628)

(closes issue ASTERISK-19100)
Reported by: Matt Jordan
Tested by: Matt Jordan

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

Merged revisions 350550 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-13 16:48:06 +00:00
Terry Wilson 04da92c379 Replace direct access to channel name with accessor functions
There are many benefits to making the ast_channel an opaque handle, from
increasing maintainability to presenting ways to kill masquerades. This patch
kicks things off by taking things a field at a time, renaming the field to
'__do_not_use_${fieldname}' and then writing setters/getters and converting the
existing code to using them. When all fields are done, we can move ast_channel
to a C file from channel.h and lop off the '__do_not_use_'.

This patch sets up main/channel_interal_api.c to be the only file that actually
accesses the ast_channel's fields directly. The intent would be for any API
functions in channel.c to use the accessor functions. No more monkeying around
with channel internals. We should use our own APIs.

The interesting changes in this patch are the addition of
channel_internal_api.c, the moving of the AST_DATA stuff from channel.c to
channel_internal_api.c (note: the AST_DATA stuff will have to be reworked to
use accessor functions when ast_channel is really opaque), and some re-working
of the way channel iterators/callbacks are handled so as to avoid creating fake
ast_channels on the stack to pass in matching data by directly accessing fields
(since "name" is a stringfield and the fake channel doesn't init the
stringfields, you can't use the ast_channel_name_set() function). I went with
ast_channel_name(chan) for a getter, and ast_channel_name_set(chan, name) for a
setter.

The majority of the grunt-work for this change was done by writing a semantic
patch using Coccinelle ( http://coccinelle.lip6.fr/ ).

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-09 22:15:50 +00:00
Richard Mudgett 64d1b247c4 Fix joinable thread terminating without joiner memory leak in chan_iax.c.
The iax2_process_thread() can exit without anyone waiting to join the
thread.  If noone is waiting to join the thread then a large memory leak
occurs.

* Made iax2_process_thread() deatach itself if nobody is waiting to join
the thread.

(closes issue ASTERISK-17339)
Reported by: Tzafrir Cohen
Patches:
      asterisk-1.8.4.4-chan_iax2-detach-thread-on-non-stop-exit.patch (license #5617) patch uploaded by Alex Villacis Lasso (modified)

(closes issue ASTERISK-17825)
Reported by: wangjin
........

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

Merged revisions 350221 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350222 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-09 21:56:29 +00:00
Terry Wilson b35a3a5c4a Don't leak CID in From header when presentation=unavailable
When someone does Set(CALLERPRES()=unavailable) (or
Set(CALLERID(pres)=unavailable)) when sendrpid=no, the From header shows
"Anonymous" <anonymous@anonymous.invalid>. When sendrpid=yes/pai, the From
header will still display the callerid info, even though we supply an rpid
header with the anonymous info. It seems like we shouldn't leak that info in
any case. Skimming http://tools.ietf.org/html/draft-ietf-sip-privacy-04 seems
to indicate that one shouldn't send identifying info in the From in this case.

This patch anonymizes the From header as well even when sendrpid=yes/pai.

(closes issue ASTERISK-16538)

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

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

Merged revisions 349977 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-06 23:31:25 +00:00
Richard Mudgett 963d52f63e Fix segfault in chan_dahdi for CHANNEL(dahdi_span) evaluation on hangup.
* Added NULL private pointer checks in the following chan_dahdi channel
callbacks: dahdi_func_read(), dahdi_func_write(), dahdi_setoption(), and
dahdi_queryoption().

(closes issue ASTERISK-19142)
Reported by: Diego Aguirre
Tested by: rmudgett
........

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

Merged revisions 349559 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-04 20:55:59 +00:00
Jonathan Rose dd3f9b51c8 Adds Subscription-State header to notify with call completion. per RFC3265
(Closes issue ASTERISK-17953)
Reported by: George Konopacki
Patches:
	19400.patch uploaded by mmichelson (license 5049)
........

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

Merged revisions 349502 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349503 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-04 19:53:49 +00:00
Russell Bryant 1a8b769fdc Fix some minor formatting issues based on coding guidelines.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349410 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-31 15:48:09 +00:00
Russell Bryant 2b2d34b3c9 Constify tag argument in REF_DEBUG related code.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-31 15:45:57 +00:00
Jonathan Rose 19a4928fee INFO/Record request configurable to use dynamic features
Adds two new options to SIP peers allowing them to specify features (dynamic or builtin)
to use when sending INFO/record requests. Recordonfeature activates whatever feature
is specified when recieving a record: on request while recordofffeature activates
whatever feature is specified when receiving a record: off request. Both of these
features can be disabled by setting the feature to an empty string.

(closes issue ASTERISK-16507)
Reported by: Jon Bright
Review: https://reviewboard.asterisk.org/r/1634/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349098 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-23 20:42:21 +00:00
Jonathan Rose 03596bcb47 chan_sip autocreatepeer=persist option for auto-created peers to survive reload
This patch moves destruction of sip peers to immediately after the general section of
sip.conf is read so that autocreatepeer setting can be read before deletion of peers.
If autocreatepeer=persist at reload, then peers created by the autocreatepeer setting
will be skipped when purging the current SIP peer list.

(closes ASTERISK-16508)
Reported by: Kirill Katsnelson
Patches:
	017797-kkm-persist-autopeers-1.8.patch uploaded by Kirill Katsnelson (license 5845)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349097 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-23 20:19:33 +00:00
Richard Mudgett 32e35e5fcd Fix extension state callback references in chan_sip.
Chan_sip gives a dialog reference to the extension state callback and
assumes that when ast_extension_state_del() returns, the callback cannot
happen anymore.  Chan_sip then reduces the dialog reference count
associated with the callback.  Recent changes (ASTERISK-17760) have
resulted in the potential for the callback to happen after
ast_extension_state_del() has returned.  For chan_sip, this could be very
bad because the dialog pointer could have already been destroyed.

* Added ast_extension_state_add_destroy() so chan_sip can account for the
sip_pvt reference given to the extension state callback when the extension
state callback is deleted.

* Fix pbx.c awkward statecbs handling in ast_extension_state_add_destroy()
and handle_statechange() now that the struct ast_state_cb has a destructor
to call.

* Ensure that ast_extension_state_add_destroy() will never return -1 or 0
for a successful registration.

* Fixed pbx.c statecbs_cmp() to compare the correct information.  The
passed in value to compare is a change_cb function pointer not an object
pointer.

* Make pbx.c ast_merge_contexts_and_delete() not perform callbacks with
AST_EXTENSION_REMOVED with locks held.  Chan_sip is notorious for
deadlocking when those locks are held during the callback.

* Removed unused lock declaration for the pbx.c store_hints list.

(closes issue ASTERISK-18844)
Reported by: rmudgett

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

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

Merged revisions 348952 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-23 02:35:13 +00:00
Damien Wedhorn 48f9a8f668 Fix segfault on answer.
Only update/change RTP source if RTP has already been started and 
connected to the subchannel.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348849 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-22 21:12:57 +00:00
Richard Mudgett e58d4e4093 Fix chan_iax2 to not report an RDNIS number if it is blank.
Some ISDN switches complain or block the call if the RDNIS number is
empty.

* Made chan_iax2 not save a RDNIS number into the ast_channel if the
string is blank.  This is what other channel drivers do.

(closes issue ASTERISK-17152)
Reported by: rmudgett
........

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

Merged revisions 348736 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348737 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-20 23:11:29 +00:00
Stefan Schmidt 7d1c55d093 Fix possible misshandling of an incoming SIP response as a peer poke response.
Also make sure peer has even qualify enabled when handle a peer poke response.

(closes issue ASTERISK-18940)
Reported by: Vitaliy
Tested by: Vitaliy and UnixDev

Review: https://reviewboard.asterisk.org/r/1620
Reviewed by: David Vossel
........

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

Merged revisions 348056 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-13 15:22:48 +00:00
Walter Doekes 463bfdb400 Fix regression when using tcpenable=no and tlsenable=yes.
The tlsenable settings are tucked away in main/tcptls.c, so I missed
them when resolving ASTERISK-18837. This should resolve the test suite
breakage of the sip tls tests.

Review: https://reviewboard.asterisk.org/r/1615
Reviewed by: Matt Jordan
........

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

Merged revisions 347727 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-08 21:32:36 +00:00
Terry Wilson e279b30f5a Don't crash on INFO automon request with no channel
AST-2011-014. When automon was enabled in features.conf, it was possible
to crash Asterisk by sending an INFO request if no channel had been
created yet.

(closes issue ASTERISK-18805)
........

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

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

Merged revisions 347532 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347533 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-08 16:24:29 +00:00
Damien Wedhorn 5952117559 Fix segfault on answer.
Fix a segfault if an attempt to answer a call is made between when
the inbound call gives up (and the channel is removed) and when the
device is notified and removes the call from the device.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347490 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-08 06:59:01 +00:00
Richard Mudgett 7e634c21f8 Make SIP INFO messages for dtmf-relay signals case insensitive.
(closes issue ASTERISK-18924)
Reported by: Kevin Taylor
........

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

Merged revisions 347293 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-06 23:58:44 +00:00
Walter Doekes e14f572132 Don't allow transport=tcp when tcpenable=no.
When tcpenable=no, sending to transport=tcp hosts was still allowed.
Resolving the source address wasn't possible and yielded the string
"(null)" in SIP messages. Fixed that and a couple of not-so-correct
log messages.

(closes issue ASTERISK-18837)
Reported by: Andreas Topp

Review: https://reviewboard.asterisk.org/r/1585
Reviewed by: Matt Jordan
........

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

Merged revisions 347167 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347168 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-06 19:44:27 +00:00
Matthew Jordan b8dba87a4c Fixed crash from orphaned MWI subscriptions in chan_sip
This patch resolves the issue where MWI subscriptions are orphaned
by subsequent SIP SUBSCRIBE messages.  When a peer is removed, either
by pruning realtime SIP peers or by unloading / loading chan_sip, the
MWI subscriptions that were orphaned would still be on the event engine
list of valid subscriptions but have a pointer to a peer that no longer
was valid.  When an MWI event would occur, this would cause a seg fault.

(closes issue ASTERISK-18663)
Reported by: Ross Beer
Tested by: Ross Beer, Matt Jordan
Patches:
  blf_mwi_diff_12_06_11.txt uploaded by Matt Jordan (license 6283)

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

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

Merged revisions 347068 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347069 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-06 17:34:35 +00:00
Richard Mudgett 938b642245 Restore call progress code for analog ports.
Extracting sig_analog from chan_dahdi lost call progress detection
functionality.

* Fix analog ports from considering a call answered immediately after
dialing has completed if the callprogress option is enabled.

(closes issue ASTERISK-18841)
Reported by: Richard Miller
Patches:
      chan_dahdi.diff (license #5685) patch uploaded by Richard Miller (Modified by me)
      sig_analog.c.diff (license #5685) patch uploaded by Richard Miller (Modified by me)
      sig_analog.h.diff (license #5685) patch uploaded by Richard Miller
........

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

Merged revisions 347007 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347008 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-05 17:44:15 +00:00
Walter Doekes 6209c5a894 For SIP REGISTER fix domain-only URIs and domain ACL bypass.
The code that allowed admins to create users with domain-only uri's had
stopped to work in 1.8 because of the reqresp parser rewrites. This is
fixed now: if you have a [mydomain.com] sip user, you can register with
useraddr sip:mydomain.com. Note that in that case -- if you're using
domain ACLs (a configured domain list) -- mydomain.com must be in the
allow list as well.

Reviewboard r1606 shows a list of registration combinations and which
SIP response codes are returned.

Review: https://reviewboard.asterisk.org/r/1533/
Reviewed by: Terry Wilson

(closes issue ASTERISK-18389)
(closes issue ASTERISK-18741)
........

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

Merged revisions 346900 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346901 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-04 10:08:19 +00:00
Matthew Jordan fa4a7dcc45 Update SIP MESSAGE To parsing to correctly handle URI
The previous patch (r346040) incorrectly parsed the URI in the presence
of a port, e.g., user@hostname:port would fail as the port would be
double appended to the SIP message.  This patch uses the parse_uri function
to correctly parse the URI into its username and hostname parts, and places
them in the correct fields in the sip_pvt structure.

(issue ASTERISK-18903)
Review: https://reviewboard.asterisk.org/r/1597/
........

Merged revisions 346856 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-02 23:30:21 +00:00
Alexandr Anikin db0ed2e5c8 Merged revisions 346763 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r346763 | may | 2011-12-02 20:42:32 +0400 (Fri, 02 Dec 2011) | 14 lines
  
  Merged revisions 346762 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r346762 | may | 2011-12-02 20:19:19 +0400 (Fri, 02 Dec 2011) | 7 lines
    
    process null frame pointer returned by ast_rtp_instance_read correctly
    
    (closes issue ASTERISK-16697)
    Reported by: under
    Patches: 
            segfault.diff (License #5871) patch uploaded by under
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346777 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-02 18:03:31 +00:00
Jonathan Rose 39424ebad2 Change 183 Ringing in sipfrag body to 180 ringing. 183 Ringing isn't even a thing.
183 is actually a session progress message.

(closes issue ASTERISK-18925)
Reported by: Sebastian Denz
Tested by: jrose
Patches:
	asterisk18-use_180_instead_of_183_in_sipfrag.diff by Sebastian Denz (License #6139)
........

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

Merged revisions 346698 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-01 20:46:12 +00:00
Tilghman Lesher 56b21b4683 Remove the few places where we try to ast_verbose() without a newline.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-30 23:38:34 +00:00
Jonathan Rose 9ef171ffe0 r346525 | jrose | 2011-11-30 15:10:38 -0600 (Wed, 30 Nov 2011) | 18 lines
Cleaning up chan_sip/tcptls file descriptor closing.

This patch attempts to eliminate various possible instances of undefined behavior caused
by invoking close/fclose in situations where fclose may have already been issued on a
tcptls_session_instance and/or closing file descriptors that don't have a valid index
for fd (-1). Thanks for more than a little help from wdoekes.

(closes issue ASTERISK-18700)
Reported by: Erik Wallin

(issue ASTERISK-18345)
Reported by: Stephane Cazelas

(issue ASTERISK-18342)
Reported by: Stephane Chazelas

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

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

Merged revisions 346565 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346566 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-30 22:03:02 +00:00
Jonathan Rose fb4c483eb7 Reverting 346525 due to accidental patch against trunk instead of 1.8
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346563 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-30 21:32:23 +00:00
Jonathan Rose 6fa827b5d0 Cleaning up chan_sip/tcptls file descriptor closing.
This patch attempts to eliminate various possible instances of undefined behavior caused
by invoking close/fclose in situations where fclose may have already been issued on a
tcptls_session_instance and/or closing file descriptors that don't have a valid index
for fd (-1). Thanks for more than a little help from wdoekes.

(closes issue ASTERISK-18700)
Reported by: Erik Wallin

(issue ASTERISK-18345)
Reported by: Stephane Cazelas

(issue ASTERISK-18342)
Reported by: Stephane Chazelas

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-30 21:10:38 +00:00
Tilghman Lesher 77b670c4ab Allow each logging destination and console to have its own notion of the verbosity level.
Review: https://reviewboard.asterisk.org/r/1599


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-29 18:43:16 +00:00
Richard Mudgett 7d9ba4875b Fix calls to ast_get_ip() not initializing the address family.
........

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

Merged revisions 346240 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-23 23:03:32 +00:00
Walter Doekes 2ee874178e Minor cleanup in chan_sip get_msg_text() function.
In r116240, get_msg_text() got an extra parameter to fix the unwanted
addition of trailing newlines to SIP MESSAGE bodies. This caused all
linefeeds to be trimmed, which isn't right either. This is a stop-gap;
the right fix is to return the original SIP request body.

Review: https://reviewboard.asterisk.org/r/1586
Reviewed by: Matt Jordan
........

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

Merged revisions 346198 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346199 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-23 20:48:42 +00:00
Kinsey Moore e6ca768081 Fix res_jabber resource leaks
This should fix almost all resource leaks in res_jabber that involve
ASTOBJ_CONTAINER_FIND and resolves an ambiguous situation where
ast_aji_get_client would sometimes bump an object's refcount and sometimes not.

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

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

Merged revisions 346087 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346088 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-23 17:16:33 +00:00
Matthew Jordan 76394a727f Fixed SendMessage stripping extension from To: header in SIP MESSAGE
When using the MessageSend application to send a SIP MESSAGE to a non-peer,
chan_sip attempted to validate the hostname or IP Address.  In the process,
it stripped off the extension and failed to add it back to the sip_pvt
structure before transmitting.  This patch adds the full URI passed in
from the message core to the sip_pvt structure.

(closes issue ASTERISK-18903)
Reported by: Shaun Clark
Tested by: Matt Jordan

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

Merged revisions 346040 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346053 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-23 16:23:34 +00:00
Terry Wilson 32d0faac9c Default to nat=yes; warn when nat in general and peer differ
It is possible to enumerate SIP usernames when the general and user/peer
nat settings differ in whether to respond to the port a request is sent
from or the port listed for responses in the Via header. In 1.4 and 1.6.2,
this would mean if one setting was nat=yes or nat=route and the other was
either nat=no or nat=never. In 1.8 and 10, this would mean when one was
nat=force_rport and the other was nat=no.

In order to address this problem, it was decided to switch the default
behavior to nat=yes/force_rport as it is the most commonly used option
and to strongly discourage setting nat per-peer/user when at all possible.

For more discussion of the issue, please see:
  http://lists.digium.com/pipermail/asterisk-dev/2011-November/052191.html

(closes issue ASTERISK-18862)
Review: https://reviewboard.asterisk.org/r/1591/
........

Merged revisions 345776 from http://svn.asterisk.org/svn/asterisk/branches/1.4
........

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

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

Merged revisions 345830 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@345831 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-21 21:09:59 +00:00
Richard Mudgett 4a125f45a0 Remove dead code since pri_grab() can never fail.
Dead code makes programmers sick.  I am sick of looking at it.
........

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

Merged revisions 345558 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@345559 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-17 17:31:16 +00:00
Richard Mudgett bd4f81b51f Fix typo in sig_pri using wrong structure name.
It is fortunate that the typo does not alter generated code since the
e->restart.channel and e->ring.channel members are in the same position.

(closes issue ASTERISK-18868)
Reported by: zvision
Patches:
      sig_pri.c.diff (License #5755) patch uploaded by zvision
........

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

Merged revisions 345371 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@345375 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-15 18:18:11 +00:00
Richard Mudgett 113612b9d6 Restore SIP DTMF overlap dialing method.
The recent fix for ASTERISK-17288 to get RFC3578 SIP overlap support
working correctly removed a long standing ability to do overlap dialing
using DTMF in the early media phase of a call.

See ASTERISK-18702 it has a very good description of the issue.

I started with Pavel Troller's chan_sip.diff patch on issue
ASTERISK-18702.

* Added 'dtmf' enum value to sip.conf allowoverlap config option.  The new
option value causes the Incomplte application to not send anything with
chan_sip so the caller can supply more digits via DTMF.

* Renames SIP_GET_DEST_PICKUP_EXTEN_FOUND to SIP_GET_DEST_EXTEN_MATCHMORE
since that is what it really means.

* Fixed get_destination() inconsistency with the pickup extension
matching.

* Fixed initialization of PAGE3 of global_flags in reload_config().

(closes issue ASTERISK-18702)
Reported by: Pavel Troller

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

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

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

Merged revisions 345275 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@345276 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-14 22:05:39 +00:00
Walter Doekes 6ef49c3214 Update reqresp_parser parse_uri doxygen comments.
The issue mentioned in the bug report had been fixed recently by
twilson. The reporter included this documentation fix.

(closes issue ASTERISK-18572)
Reported by: Richard Miller
Patch by: Richard Miller (modified)
........

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

Merged revisions 345161 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@345162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-14 19:03:29 +00:00
Kinsey Moore 818ac23b92 Ensure that a null vmexten does not cause a segfault
When sip_send_mwi_to_peer was modified recently to avoid deadlocks, vmexten
was not expected to be null.  This change handles that situation to avoid
a segfault.
........

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

Merged revisions 345064 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@345065 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-14 15:11:09 +00:00
Gregory Nietsky 3845299e46 mISDN Round Robin break when no channel is available
Prevent channels been parsed repetitively.
........

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

Merged revisions 344966 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344979 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-12 16:32:45 +00:00
Walter Doekes 863d7189b9 Remove unneeded if(params) checks in reqresp_parser.
Nick Lewis added them in https://reviewboard.asterisk.org/r/549/diff/1-2/
for no apparent reason. There is no way that params could become NULL in
that piece of code, so I removed these excess checks again.
........

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

Merged revisions 344839 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-11 21:37:53 +00:00
Kinsey Moore a4365a8ae2 Fix regression introduced by SDP fixups
If capability is adjusted when switching to UDPTL during fax transmission, fax
teardown fails.  Make sure capability is only touched if RTP is active.  This
regression was introduced in R344385.
........

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

Merged revisions 344770 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344771 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-11 20:15:16 +00:00
Richard Mudgett e48cecc848 Check sip.conf maxforwards parameter for range 1 <= x <= 255.
JIRA AST-710
........

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

Merged revisions 344716 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-11 18:37:32 +00:00
Kinsey Moore c225800646 Fix several bugs with SDP parsing and well-formedness of responses
Fix bug ASTERISK-16558 which dealt with the order of responses to incoming
streams defined by SDP.

Fix unreported bug where offering multiple same-type streams would cause
Asterisk to reply with an incorrect SDP response missing one or more streams
without a proper declination.

Fix bugs related to a single non-audio stream being offered with responses
requesting codecs that were not offered in the initial invite along with an
additional audio stream that was not in the initial invite.

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

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

Merged revisions 344386 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-10 18:15:02 +00:00
Richard Mudgett 6d481420ce Fix deadlock during dialplan reload.
Another deadlock between the conlock/hints and channels/channel locking
orders.

* Don't hold the channel and private lock in sip_new() when calling
ast_exists_extension().

(closes issue ASTERISK-18740)
Reported by: Byron Clark
Patches:
      sip_exists_exten_dlock_3.diff (license #5041) patch uploaded by Gregory Hinton Nietsky
      ASTERISK-18740.patch (license #6157) patch uploaded by Byron Clark
Tested by: Byron Clark
........

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

Merged revisions 344271 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-09 20:55:43 +00:00
Terry Wilson 04f04ff39d Don't treat a host:port string as a domain
The domain matching code prior to 1.8 used to manually remove the port
from the host:port string when determining if an incoming request
matched the list of domains. When switching to the new parsing
functions, the documentation implied that the "domain" was being
returned by these functions, when instead it was returning the
"hostport" as defined by RFC 3261. This led to confusion and resulted
in 1.8+ rejecting an incoming request from x.x.x.x:xxxxx when
domain=x.x.x.x was set in sip.conf.

This patch renames the "domain" variables in the parsing functions to
"hostport" to more accurately describe what it is that they are
returning and also properly truncates the resulting hostport strings
when dealing with domain matching.

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

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

Merged revisions 344216 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344217 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-09 20:10:52 +00:00
Richard Mudgett 9537f22c54 Residual changes for Asterisk v10 branch from ASTERISK-18747.
Residual changes for Asterisk v10 branch from ASTERISK-18747 after
https://reviewboard.asterisk.org/r/1564/ commit and associated dialogs
callid hash key change fix.

* Make check_rtp_timeout() return CMP_MATCH if need to delete dialog from
dialogs_rtpcheck.  This is an optimization to avoid an unneeded
lock/unlock and object search when using ao2_unlink.

* Prevent crash in check_rtp_timeout() if dialog->rtp is NULL.

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

Merged revisions 344004 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344005 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-08 22:14:38 +00:00