Commit Graph

3668 Commits

Author SHA1 Message Date
Joshua Colp f45833c9ad Merge "Restrict functionality when ACLs are misconfigured." 2015-05-05 10:13:23 -05:00
Corey Farrell c3ec5da156 Remove unneeded uses of optional_api providers.
A few cases exist where headers of optional_api provders are included but
not needed.  This causes unneeded calls to ast_optional_api_use.

* Don't include optional_api.h from sip_api.h.
* Move 'struct ast_channel_monitor' to channel.h.
* Don't include monitor.h from chan_sip.c, channel.c or features.c.

The move of struct ast_channel_monitor is needed since channel.c depends on
it.  This has no effect on users of monitor.h since channel.h is included
from monitor.h.

ASTERISK-25051 #close
Reported by: Corey Farrell

Change-Id: I53ea65a9fc9693c89f8bcfd6120649bfcfbc3478
2015-05-02 19:31:12 -05:00
Mark Michelson 11ffcf662f Restrict functionality when ACLs are misconfigured.
This patch has two main purposes:

1) Improve warning messages when ACLs are configured improperly.
2) Prevent misconfigured ACLs from allowing potentially unwanted
traffic.

To acomplish point (2) in most cases, whatever configuration object that
the ACL belonged to was not allowed to load.

The one exception is res_pjsip_acl. In that case, ACLs are their own
configuration object. Furthermore, the module loading code has no
indication that a ACL configuration had a failure. So the tactic taken
here is to create an ACL that just blocks everything.

ASTERISK-24969
Reported by Corey Farrell

Change-Id: I2ebcb6959cefad03cea4d81401be946203fcacae
2015-04-30 10:43:51 -05:00
Corey Farrell 5c1d07baf0 Astobj2: Allow reference debugging to be enabled/disabled by config.
* The REF_DEBUG compiler flag no longer has any effect on code that uses
  Astobj2.  It is used to determine if reference debugging is enabled by
  default.  Reference debugging can be enabled or disabled in asterisk.conf.
* Caller information is provided in logger errors for ao2 bad magic numbers.
* Optimizes AO2 by merging internal functions with the public counterpart.
  This was possible now that we no longer require a dual ABI.

ASTERISK-24974 #close
Reported by: Corey Farrell

Change-Id: Icf3552721fe999365ba8a8cf00a965aa6b897cc1
2015-04-27 18:37:26 -04:00
Matt Jordan 4a58261694 git migration: Refactor the ASTERISK_FILE_VERSION macro
Git does not support the ability to replace a token with a version
string during check-in. While it does have support for replacing a
token on clone, this is somewhat sub-optimal: the token is replaced
with the object hash, which is not particularly easy for human
consumption. What's more, in practice, the source file version was often
not terribly useful. Generally, when triaging bugs, the overall version
of Asterisk is far more useful than an individual SVN version of a file. As a
result, this patch removes Asterisk's support for showing source file
versions.

Specifically, it does the following:

* Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and
  remove passing the version in with the macro. Other facilities
  than 'core show file version' make use of the file names, such as
  setting a debug level only on a specific file. As such, the act of
  registering source files with the Asterisk core still has use. The
  macro rename now reflects the new macro purpose.

* main/asterisk:
  - Refactor the file_version structure to reflect that it no longer
    tracks a version field.
  - Remove the "core show file version" CLI command. Without the file
    version, it is no longer useful.
  - Remove the ast_file_version_find function. The file version is no
    longer tracked.
  - Rename ast_register_file_version/ast_unregister_file_version to
    ast_register_file/ast_unregister_file, respectively.

* main/manager: Remove value from the Version key of the ModuleCheck
  Action. The actual key itself has not been removed, as doing so would
  absolutely constitute a backwards incompatible change. However, since
  the file version is no longer tracked, there is no need to attempt to
  include it in the Version key.

* UPGRADE: Add notes for:
  - Modification to the ModuleCheck AMI Action
  - Removal of the "core show file version" CLI command

Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-13 03:48:57 -04:00
Kevin Harwell 66f3fd0028 chan_sip: make progressinband default to no
After the "progressinband" value setting of "never" was updated to never send a
183 this separated its use from the "no" value. Since "never" was the default,
but most users probably expect "no" this patch updates the default for the
"progressinband" setting to "no."

ASTERISK-24835 #close
Reported by: Andrew Nagy
Review: https://reviewboard.asterisk.org/r/4606/
........

Merged revisions 434654 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-10 21:06:23 +00:00
Matthew Jordan 477536ef25 chan_sip: Handle IPv4 mapped IPv6 clients when NAT is enabled
When udpbindaddr is set to the IPv6 bind all address of '::', Asterisk will
attempt to handle both IPv4 and IPv6 addresses, although the information will
be stored in a struct with an AF_INET6 address type. However, the current
NAT handling code won't handle the IPv4 mapped IPv6 addresses correctly.
This patch adds an additional check for the mapped address case, allowing
the NAT code to handle clients even when the address is IPv6.

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

ASTERISK-18032 #close
Reported by: Christoph Timm
patches:
  nat_with_ipv6.diff submitted by Valentin Vidić (License 6697)
........

Merged revisions 434288 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 434289 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434290 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-08 11:54:09 +00:00
Matthew Jordan c1cfe3fae2 clang compiler warnings: Fix non-literal-null-conversion warnings
Clang will flag errors when a char pointer is set to '\0', as opposed to a
value that the char pointer points to. This patch fixes this warning
in a variety of locations.

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

ASTERISK-24917
Reported by: dkdegroot
patches:
  rb4551.patch submitted by dkdegroot (License 6600)
........

Merged revisions 434187 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 434188 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434189 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-07 02:03:48 +00:00
George Joseph e48f2e7897 build: Fixes for gcc 5 compilation
These are fixes for compilation under gcc 5.0...

chan_sip.c:    In parse_request needed to make 'lim' unsigned.
inline_api.h:  Needed to add a check for '__GNUC_STDC_INLINE__' to detect C99 
               inline semantics (same as clang).
ccss.c:        In ast_cc_set_parm, needed to fix weird comparison.
dsp.c:         Needed to work around a possible compiler bug.  It was throwing 
               an array-bounds error but neither
               sgriepentrog, rmudgett nor I could figure out why.
manager.c:     In action_atxfer, needed to correct an array allocation.

This patch will go to 11, 13, trunk.

Review: https://reviewboard.asterisk.org/r/4581/
Reported-by: Jeffrey Ollie
Tested-by: George Joseph
ASTERISK-24932 #close
........

Merged revisions 434113 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 434114 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434115 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-06 19:04:32 +00:00
Matthew Jordan ce59fabd5c clang compiler warnings: Fix invalid enum conversion
This patch fixes some invalid enum conversion warnings caught by clang. In
particular:
* chan_sip: Several functions mixed usage of the st_refresher_param
  enum and st_refresher enum. This patch corrects the functions to use the
  right enum.
* chan_pjsip: Fixed mixed usage of ast_sip_session_t38state and ast_t38_state.
* strings: Fixed incorrect usage of AO2 flags with strings container.
* res_stasis: Change a return enumeration to stasis_app_user_event_res.

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

ASTERISK-24917
Reported by: dkdegroot
patches:
  rb4535.patch submitted by dkdegroot (License 6600)
........

Merged revisions 433746 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 433747 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433748 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-30 02:39:57 +00:00
Corey Farrell d486659502 chan_sip: Simplify dialog/peer references, improve REF_DEBUG output.
* Replace functions for ref/undef of dialogs and peers with macro's
  to call ao2_t_bump/ao2_t_cleanup.
* Enable passthough of REF_DEBUG caller information to sip_alloc and
  find_call.

ASTERISK-24882 #close 
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4189/
........

Merged revisions 433115 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433116 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19 09:57:59 +00:00
Corey Farrell 2c83ac4364 chan_sip: Fix dialog reference leaked to scheduler for reinvite_timeout.
Release the scheduler reference to the dialog for reinvite timeout during
dialog_unlink_all.

ASTERISK-24876 #close 
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4491/
........

Merged revisions 433112 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 433113 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433114 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19 09:46:06 +00:00
Corey Farrell c08fd275bf Logger: Convert 'struct ast_callid' to unsigned int.
Switch logger callid's from AO2 objects to simple integers.
This helps in two ways.  Copying integers is faster than
referencing AO2 objects, so this will result in a small
reduction in logger overhead.  This also erases the possibility
of an infinate loop caused by an invalid callid in
threadstorage.

ASTERISK-24833 #comment Committed callid conversion to trunk. 
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4466/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13 01:12:35 +00:00
Richard Mudgett f1ab2c5e8b chan_sip: Fix realtime locking inversion when poking a just built peer.
When a realtime peer is built it can cause a locking inversion when the
just built peer is poked.  If the CLI command "sip show channels" is
periodically executed then a deadlock can happen because of the locking
inversion.

* Push the peer poke off onto the scheduler thread to avoid the locking
inversion of the just built realtime peer.

AST-1540
ASTERISK-24838 #close
Reported by: Richard Mudgett

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

Merged revisions 432526 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 432528 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-06 19:34:35 +00:00
Matthew Jordan 3725173b9e channels/chan_sip: Don't send a BYE after final response when PBX thread fails
When Asterisk fails to start a PBX thread for a new channel - for example, when
the maxcalls setting in asterisk.conf is exceeded - we currently send a final
response, and then attempt to send a BYE request to the UA. Since that's all
sorts of wrong, this patch fixes that by setting sipalreadygone on the sip_pvt
such that we don't get stuck sending BYE requests to something that does not
want it.

Note that this patch is a slight modification of the one on ASTERISK-15434.
For clarity, it explicitly calls sipalreadygone with the calls to transmit a
final response.

ASTERISK-21845
ASTERISK-15434 #close
Reported by: Makoto Dei
Tested by: Matt Jordan
patches:
  sip-pbxstart-failed.patch uploaded by Makoto Dei (License 5027)
........

Merged revisions 432320 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 432321 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432322 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-26 03:03:39 +00:00
Matthew Jordan 4b63da7f7d channels/chan_sip: Clarify WARNING message in mismatched SRTP scenario
When we receive an SDP as part of an offer/answer for a peer/friend has been
configured to require encryption, and that SDP offer/answer failed to provide
acceptable crypto attributes, we currently issue a WARNING that uses the phrase
"we" and "requested". In this case, both of those terms are ambiguous - the
user will probably think "we" is Asterisk (it most likely isn't) and it may
not be a "request", so much as an SDP that was received in some fashion.

This patch makes the WARNING messages slightly less bad and a bit more
accurate as well.

ASTERISK-23214 #close
Reported by: Rusty Newton
........

Merged revisions 432277 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 432278 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25 23:05:40 +00:00
Matthew Jordan 8574c4d197 channels/chan_sip: Fix crash when transmitting packet after thread shutdown
When the monitor thread is stopped, its pthread ID is set to a specific value
(AST_PTHREADT_STOP) so that later portions of the code can determine whether
or not it is safe to manipulate the thread. Unfortunately, __sip_reliable_xmit
failed to check for that value, checking instead only for AST_PTHREAD_STOP.
Passing the invalid yet very specific value to pthread_kill causes a crash.

This patch adds a check for AST_PTHREADT_STOP in __sip_reliable_xmit such that
it doesn't attempt to poke the thread if the thread has already been stopped.

ASTERISK-24800 #close
Reported by: JoshE
........

Merged revisions 432198 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 432199 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24 22:14:44 +00:00
Richard Mudgett e2d3215b83 HTTP: Stop accepting requests on final system shutdown.
There are three CLI commands to stop and restart Asterisk each.

1) core stop/restart now - Hangup all calls and stop or restart Asterisk.
New channels are prevented while the shutdown request is pending.

2) core stop/restart gracefully - Stop or restart Asterisk when there are
no calls remaining in the system.  New channels are prevented while the
shutdown request is pending.

3) core stop/restart when convenient - Stop or restart Asterisk when there
are no calls in the system.  New calls are not prevented while the
shutdown request is pending.

ARI has made stopping/restarting Asterisk more problematic.  While a
shutdown request is pending it is desirable to continue to process ARI
HTTP requests for current calls.  To handle the current calls while a
shutdown request is pending, a new committed to shutdown phase is needed
so ARI applications can deal with the calls until the system is fully
committed to shutdown.

* Added a new shutdown committed phase so ARI applications can deal with
calls until the final committed to shutdown phase is reached.

* Made refuse new HTTP requests when the system has reached the final
system shutdown phase.  Starting anything while the system is actively
releasing resources and unloading modules is not a good thing.

* Split the bridging framework shutdown to not cleanup the global bridging
containers when shutting down in a hurry.  This is similar to how other
modules prevent crashes on rapid system shutdown.

* Moved ast_begin_shutdown(), ast_cancel_shutdown(), and
ast_shutting_down().  You should not have to include channel.h just to
access these system functions.

ASTERISK-24752 #close
Reported by: Matthew Jordan

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

Merged revisions 431692 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11 17:39:13 +00:00
Matthew Jordan 5a17ed7a38 channels/chan_sip: Fix RealTime error during SIP unregistration with MariaDB
When a SIP device that has its registration stored in RealTime unregisters,
the entry for that device is updated with blank values, i.e., "", indicating
that it is no longer registered. Unfortunately, one of those values that is
'blanked' is the device's port. If the column type for the port is not a
string datatype (the recommended type is integer), an ODBC or database error
will be thrown. MariaDB does not coerce empty strings to a valid integer value.

This patch updates the query run from chan_sip such that it replaces the port
value with a value of '0', as opposed to a blank value. This is the value that
other database backends coerce the empty string ("") to already, and the
handling of reading a RealTime registration value from a backend already
anticipates receiving a port of '0' from the backends.

ASTERISK-24772 #close
Reported by: Richard Miller
patches:
  chan_sip.diff uploaded by Richard Miller (License 5685)
........

Merged revisions 431673 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 431674 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11 17:13:28 +00:00
Mark Michelson fe76d4829f Use SIPS URIs in Contact headers when appropriate.
RFC 3261 sections 8.1.1.8 and 12.1.1 dictate specific
scenarios when we are required to use SIPS URIs in Contact
headers. Asterisk's non-compliance with this could actually
cause calls to get dropped when communicating with clients
that are strict about checking the Contact header.

Both of the SIP stacks in Asterisk suffered from this issue.
This changeset corrects the behavior in chan_sip.

ASTERISK-24646 #close
Reported by Stephan Eisvogel

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

Merged revisions 431423 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 431424 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-29 20:54:46 +00:00
Kevin Harwell 3b0f03ef7b chan_sip: stale nonce causes failure
When refreshing (with a small expiration) a registration that was sent to
chan_sip the nonce would be considered stale and reject the registration.
What was happening was that the initial registration's "dialog" still existed
in the dialogs container and upon refresh the dialog match algorithm would
choose that as the "dialog" instead of the newly created one. This occurred
because the algorithm did not check to see if the from tag matched if
authentication info was available after the 401. So, it ended up assuming
the original "dialog" was a match and stopped the search. The old "dialog"
of course had an old nonce, thus the stale nonce message.

This fix attempts to leave the original functionality alone except in the case
of a REGISTER. If a REGISTER is received if searches for an existing "dialog"
matching only on the callid. If the expires value is low enough it will reuse
dialog that is there, otherwise it will create a new one.

ASTERISK-24715 #close
Reported by: John Bigelow
Review: https://reviewboard.asterisk.org/r/4367/
........

Merged revisions 431187 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 431194 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-27 19:22:41 +00:00
Walter Doekes 49cbfa7de6 Fix typo's (retrieve, specified, address).
........

Merged revisions 430996 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 430998 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431000 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-23 15:13:08 +00:00
Walter Doekes 874cb5615d chan_sip: Case insensitive comparison of "defaultuser" parameter.
All the other configuration options are case insensitive, so this one
should be too.

ASTERISK-24355 #close
Reported by: HZMI8gkCvPpom0tM
patches:
  ast.patch uploaded by HZMI8gkCvPpom0tM (License 6658)
........

Merged revisions 430993 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 430994 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430995 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-23 14:39:52 +00:00
Matthew Jordan 5835bf7a7f channels/chan_sip: Fix registration leak during reload
When the SIP registrations were migrated to using ao2 in what was then trunk,
the explicit destruction of the registrations on module reload was removed and
not replaced with an ao2 equivalent. Debugging done by Stefan Engström, the
issue reporter, on ASTERISK-24673 confirmed that the reference in the
registry_list container was being leaked.

Since the purpose of cleanup_all_regs is to prep a registration for
destruction, this function now calls an ao2_callback function callback with the
OBJ_MULTIPLE | OBJ_NODATA | OBJ_UNLINK flags used to remove the registrations.
This cleans up each registration, and also removes it from the registration
container registry_list.

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

ASTERISK-24640 #close
Reported by: Max Man

ASTERISK-24673 #close
Reported by: Stefan Engström
Tested by: Stefan Engström
........

Merged revisions 430864 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430866 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-21 13:36:52 +00:00
Richard Mudgett c7ea108e02 Revert -r430452 It needs to be redone for the next major AMI version change instead.
ASTERISK-24049


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-12 18:09:27 +00:00
Richard Mudgett ef34a05f21 AMI: Remove no longer used parameter from astman_send_listack().
Follow-up issue to -r430435 from reviewboard review.

ASTERISK-24049
Review: https://reviewboard.asterisk.org/r/4315/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09 18:53:49 +00:00
Richard Mudgett 52a7cdb101 AMI: Make AMI actions that generate event lists consistent.
* Made the following AMI actions use list API calls for consistency:
Agents
BridgeInfo
BridgeList
BridgeTechnologyList
ConfbridgeLIst
ConfbridgeLIstRooms
CoreShowChannels
DAHDIShowChannels
DBGet
DeviceStateList
ExtensionStateList
FAXSessions
Hangup
IAXpeerlist
IAXpeers
IAXregistry
MeetmeList
MeetmeListRooms
MWIGet
ParkedCalls
Parkinglots
PJSIPShowEndpoint
PJSIPShowEndpoints
PJSIPShowRegistrationsInbound
PJSIPShowRegistrationsOutbound
PJSIPShowResourceLists
PJSIPShowSubscriptionsInbound
PJSIPShowSubscriptionsOutbound
PresenceStateList
PRIShowSpans
QueueStatus
QueueSummary
ShowDialPlan
SIPpeers
SIPpeerstatus
SIPshowregistry
SKINNYdevices
SKINNYlines
Status
VoicemailUsersList

* Incremented the AMI version to 2.7.0.

* Changed astman_send_listack() to not use the listflag parameter and
always set the value to "Start" so the start capitalization is consistent.
i.e., The FAXSessions used "Start" while the rest of the system used
"start".  The corresponding complete event always used "Complete".

* Fixed ami_show_resource_lists() "PJSIPShowResourceLists" to output the
AMI ActionID for all of its list events.

* Fixed off-nominal AMI protocol error in manager_bridge_info(),
manager_parking_status_single_lot(), and
manager_parking_status_all_lots().  Use of astman_send_error() after
responding to the original AMI action request violates the action response
pattern by sending two responses.

* Fixed minor protocol error in action_getconfig() when no requested
categories are found.  Each line needs to be formatted as "Header: text".

* Fixed off-nominal memory leak in manager_build_parked_call_string().

* Eliminated unnecessary use of RAII_VAR() in ami_subscription_detail().

ASTERISK-24049 #close
Reported by: Jonathan Rose

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

Merged revisions 430434 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09 18:16:54 +00:00
Matthew Jordan 264a50c52a chan_sip: Send CANCEL via original INVITE destination even after UPDATE request
Given the following scenario:
* Three SIP phones (A, B, C), all communicating via a proxy with Asterisk
* A call is established between A and B. B performs a SIP attended transfer of
  A to C. B sets the call on hold (A is hearing MOH) and dials the extension of
  C. While phone C is ringing, B transfers the call (that is, what we typically
  call a 'blond transfer').
* When the transfer completes, A hears the ringing of phone C, while B is idle.

In the SIP messaging for the above scenario, a REFER request is sent to
transfer the call. When "sendrpid=yes" is set in sip.conf, Asterisk may send an
UPDATE request to phone C to update party information. This update is sent
directly to phone C, not through the intervening proxy. This has the unfortunate
side effect of providing route information, which is then set on the sip_pvt
structure for C. If someone (e.g. B) is trying to get the call back (through a
directed pickup), Asterisk will send a CANCEL request to C. However, since we
have now updated the route set, the CANCEL request will be sent directly to C
and not through the proxy. The phone ignores this CANCEL according to RFC3261
(Section 9.1).

This patch updates reqprep such that the route is not updated if an UPDATE
request is being sent while the INVITE state is INV_PROCEEDING or
INV_EARLY_MEDIA. This ensures that a subsequent CANCEL request is still sent
to the correct location.

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

ASTERISK-24628 #close
Reported by: Karsten Wemheuer
patches:
  issue.patch uploaded by Karsten Wemheuer (License 5930)
........

Merged revisions 429982 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 429983 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429984 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-22 15:40:27 +00:00
Walter Doekes 8b6ecc449c Fix printf problems with high ascii characters after r413586 (1.8).
In r413586 (1.8) various casts were added to silence gcc 4.10 warnings.
Those fixes included things like:

    -out += sprintf(out, "%%%02X", (unsigned char) *ptr);
    +out += sprintf(out, "%%%02X", (unsigned) *ptr);

That works for low ascii characters, but for the high range that yields
e.g. FFFFFFC3 when C3 is expected.

This changeset:
- fixes those casts to use the 'hh' unsigned char modifier instead
- consistently uses %02x instead of %2.2x (or other non-standard usage)
- adds a few 'h' modifiers in various places
- fixes a 'replcaes' typo
- dev/urandon typo (in 13+ patch)

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

ASTERISK-24619 #close
Reported by: Stefan27 (on IRC)
........

Merged revisions 429673 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 429674 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 429675 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-17 10:23:32 +00:00
Joshua Colp 58095d2486 chan_sip: Allow T.38 switch-over when SRTP is in use.
Previously when SRTP was enabled on a channel it was not possible
to switch to T.38 as no crypto attributes would be present.

This change makes it so it is now possible. If a T.38 re-invite
comes in SRTP is terminated since in practice you can't encrypt
a UDPTL stream. Now... if we were doing T.38 over RTP (which
does exist) then we'd have a chance but almost nobody does that so
here we are.

ASTERISK-24449 #close
Reported by: Andreas Steinmetz
patches:
 udptl-ignore-srtp-v2.patch submitted by Andreas Steinmetz (license 6523)
........

Merged revisions 429632 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 429633 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429634 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-16 16:39:47 +00:00
Joshua Colp 03c94ef761 res_http_websocket: Fix crash due to double freeing memory when receiving a payload length of zero.
Frames with a payload length of 0 were incorrectly handled in res_http_websocket.
Provided a frame with a payload had been received prior it was possible for a double
free to occur. The realloc operation would succeed (thus freeing the payload) but be
treated as an error. When the session was then torn down the payload would be
freed again causing a crash. The read function now takes this into account.

This change also fixes assumptions made by users of res_http_websocket. There is no
guarantee that a frame received from it will be NULL terminated.

ASTERISK-24472 #close
Reported by: Badalian Vyacheslav

Review: https://reviewboard.asterisk.org/r/4220/
Review: https://reviewboard.asterisk.org/r/4219/
........

Merged revisions 429270 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 429272 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 429273 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429274 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-10 13:35:52 +00:00
Kevin Harwell c17cef1c38 Direct Media calls within private network sometimes get one way audio
When endpoints with direct_media enabled, behind a firewall (Asterisk on a
separate network) and were bridged sometimes Asterisk would send the ip
address of the firewall in the sdp to one of the phones in the reinvite
resulting in one way audio. When sending the reinvite Asterisk will retrieve
the media address from the associated rtp instance, but if frames were being
read this can be overwritten with another address (in this case the
firewall's).  This patch ensures that Asterisk uses the original device
address when using direct media.

ASTERISK-24563
Reported by: Steve Pitts
Review: https://reviewboard.asterisk.org/r/4216/
........

Merged revisions 429195 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 429196 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-09 20:03:22 +00:00
Matthew Jordan 1106e8fd0f main/stasis: Allow subscriptions to use a threadpool for message delivery
Prior to this patch, all Stasis subscriptions would receive a dedicated
thread for servicing published messages. In contrast, prior to r400178
(see review https://reviewboard.asterisk.org/r/2881/), the subscriptions
shared a thread pool. It was discovered during some initial work on Stasis
that, for a low subscription count with high message throughput, the
threadpool was not as performant as simply having a dedicated thread per
subscriber.

For situations where a subscriber receives a substantial number of messages
and is always present, the model of having a dedicated thread per subscriber
makes sense. While we still have plenty of subscriptions that would follow
this model, e.g., AMI, CDRs, CEL, etc., there are plenty that also fall into
the following two categories:
* Large number of subscriptions, specifically those tied to endpoints/peers.
* Low number of messages. Some subscriptions exist specifically to coordinate
  a single message - the subscription is created, a message is published, the
  delivery is synchronized, and the subscription is destroyed.
In both of the latter two cases, creating a dedicated thread is wasteful (and
in the case of a large number of peers/endpoints, harmful). In those cases,
having shared delivery threads is far more performant.

This patch adds the ability of a subscriber to Stasis to choose whether or not
their messages are dispatched on a dedicated thread or on a threadpool. The
threadpool is configurable through stasis.conf.

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

ASTERISK-24533 #close
Reported by: xrobau
Tested by: xrobau
........

Merged revisions 428681 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 428687 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-01 17:59:21 +00:00
Richard Mudgett a7c9f4c668 ast_str: Fix improper member access to struct ast_str members.
Accessing members of struct ast_str outside of the string manipulation API
routines is invalid since struct ast_str is supposed to be treated as
opaque.

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

Merged revisions 428244 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 428245 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 428246 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-19 17:22:29 +00:00
Corey Farrell 4cea5fd4ba chan_sip: Fix theoretical leak of p->refer.
If transmit_refer is called when p->refer is already allocated,
it leaks the previous allocation.  Updated code to always free
previous allocation during a new allocation.  Also instead of
checking if we have a previous allocation, always create a
clean record.

ASTERISK-15242 #close
Reported by: David Woolley
Review: https://reviewboard.asterisk.org/r/4160/
........

Merged revisions 428117 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 428118 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 428119 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-17 16:02:06 +00:00
Joshua Colp bc02cbabd9 chan_sip: Fix bug where DTLS configuration from general would copy dtlsenable.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428034 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-16 12:12:33 +00:00
Joshua Colp d0523b4b3c chan_sip: Add support for setting DTLS configuration in the general section.
Configuration of DTLS in the general section will be applied to any users
or peers. If configuration exists at their level it overrides the general
section values.

ASTERISK-24128 #close
Reported by: Michael K.
patches:
  dtls_default_settings.patch submitted by Michael K. (license 6621)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-15 16:31:24 +00:00
Matthew Jordan 0ddc3bde24 channels/chan_sip: Add improved support for 4xx error codes
This patch adds support for 414, 493, 479, and a stray 400 response in REGISTER
response handling. This helps interoperability in a number of scenarios.

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

patches:
  rb3437.patch uploaded by oej (License 5267)
........

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

Merged revisions 426600 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 426601 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 426602 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426603 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-30 01:59:39 +00:00
Matthew Jordan ff83ff564c channels/chan_sip: Support mutltiple Supported and Required headers
A SIP request may contain multiple Supported: and Required: headers. Currently,
chan_sip only parses the first Supported/Required header it finds. This patch
adds support for multiple Supported/Required headers for INVITE requests.

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

ASTERISK-21721 #close
Reported by: Olle Johansson
patches:
  rb2478.patch uploaded by oej (License 5267)
........

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

Merged revisions 426595 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 426596 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 426597 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-30 01:48:00 +00:00
Matthew Jordan 86eea19c8f channels/chan_sip: Respect outboundproxy setting when sending qualify requests
The outboundproxy setting is currently ignored when sending OPTIONS requests
as a result of the qualify setting. This means that if an Asterisk server is
unable to send the packet directly to a peer, it is unable to qualify any
non-inbound registered peer (e.g. a peer SIP Trunk).

This patch grabs the outboundproxy information for a peer when a qualify
attempt is being constructed and, if it finds the information, uses it
when sending the OPTIONS request.

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

ASTERISK-24063 #close
Reported by: Damian Ivereigh
patches:
  outboundproxy-dai.patch uploaded by Damian Ivereigh (License 6632)
........

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

Merged revisions 425819 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 425820 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 425821 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425822 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-17 13:11:07 +00:00
Walter Doekes 9e72c74db5 chan_sip: Fix so asterisk won't send reINVITE after a BYE.
After a reINVITE glare situation, Asterisk would re-send the reINVITE
even though the call had been hung up in the mean time.  This patch
unschedules the reinvite when handling the BYE.

ASTERISK-22791 #close
Reported by: Paolo Compagnini
Tested by: Paolo Compagnini

Review: https://reviewboard.asterisk.org/r/4056/
(testcase is in review r4055)
........

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

Merged revisions 425297 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 425298 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 425299 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425300 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-12 08:17:08 +00:00
Walter Doekes d3f525fd8f chan_sip: Fix dialog leak resulting from missing ACK to re-INVITE.
If a device re-INVITEs at the same time as the dialog is hung up, and
if then the ACK to the re-INVITE never reaches Asterisk, chan_sip would
fail to destroy the dialog after a while.  This resulted in (most
prominently) file handle leaks.

(Patch reindented by me.)

ASTERISK-20784 #close
ASTERISK-15879 #close
Reported by: Torrey Searle, Nitesh Bansal
Patches:
  reinvite_ack_timeout.patch uploaded by Torrey Searle (License #5334)
  patch_asterisk_20784.txt uploaded by Nitesh Bansal (License #6418)

Reviewboard: https://reviewboard.asterisk.org/r/4052/
(testcase can be found at r4051)
........

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

Merged revisions 425069 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 425070 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 425071 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-10 07:34:50 +00:00
Richard Mudgett 0165c5f95a chan_pjsip: Fix deadlock when masquerading PJSIP channels.
Performing a directed call pickup resulted in a deadlock when PJSIP
channels were involved.

A masquerade needs to hold onto the channel locks while it swaps channel
information between the two channels involved in the masquerade.  With
PJSIP channels, the fixup routine needed to push a fixup task onto the
PJSIP channel's serializer.  Unfortunately, if the serializer was also
processing a task that needed to lock the channel, you get deadlock.

* Added a new control frame that is used to notify the channels that a
masquerade is about to start and when it has completed.

* Added the ability to query taskprocessors if the current thread is the
taskprocessor thread.

* Added the ability to suspend/unsuspend the PJSIP serializer thread so a
masquerade could fixup the PJSIP channel without using the serializer.

ASTERISK-24356 #close
Reported by: rmudgett

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

Merged revisions 424471 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 424472 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424473 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-03 17:47:42 +00:00
Walter Doekes c3a7524457 chan_sip: Simplify some unref code by removing unlink_peer_from_tables.
ASTERISK-22945 #related
Reported by: ibercom
Patches:
  asterisk11-chan_sip-simplifies.patch uploaded by ibercom (License #6599)
........

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

Merged revisions 424182 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 424183 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 424184 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-01 10:10:41 +00:00
Walter Doekes 841d978a30 chan_sip: Remove excess ref of realtime peer before sip_poke_peer.
The peer is referenced at the end of sip_poke_peer, it should not get
an extra ref before the call to sip_poke_peer. This fixes a memory
leak.

ASTERISK-22945 #close
Reported by: ibercom
Tested by: Yuriy Gorlichenko
Patches:
  asterisk11.patch uploaded by ibercom (License #6599)

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

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

Merged revisions 424177 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 424178 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 424179 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-01 09:55:10 +00:00
Walter Doekes 39fada4dc9 chan_sip: Unref outbound proxy structure on dialog/pvt destruction.
Make sure outbound proxy refs are always unreffed on dialog destruction.

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

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

Merged revisions 423801 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 423802 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 423803 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423804 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-24 08:55:02 +00:00
Walter Doekes 593455621b chan_sip: On INVITE retransmission, don't add an extra 503 response.
INVITE arrives to asterisk, asterisk responds Busy(). If the INVITE is
retransmitted, asterisk would generate a 503 in addition to the 486.

Thanks Torrey Searle for providing a working regression test.

ASTERISK-24335 #close

Review: https://reviewboard.asterisk.org/r/4003/
Patches:
  retrans_486_invite.patch uploaded by Torrey Searle (License #5334)
........

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

Merged revisions 423721 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 423722 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 423723 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423724 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-22 19:49:30 +00:00
Scott Griepentrog 2df2d785b7 The assertion that peer was not found on final event
message was being triggered on configuration reload.
This patch changes that case to just return instead.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422358 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-29 18:46:19 +00:00
Paul Belanger ef28cc0d43 chan_sip.c: Add 'rtpbindaddr' setting
Users now have the ability to bind the rtpengine instance to a specific IP
address.  For example, you want chan_sip (call control) on eth0 but rtp (media)
on eth1.

ASTERISK-24280 #close
Reported by: Paul Belanger
Tested by: Paul Belanger
Review: https://reviewboard.asterisk.org/r/3952/
Patches:
    rtpengine.diff uploaded by Paul Belanger


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-28 16:06:55 +00:00
Kinsey Moore bf85018107 CallerID: Fix parsing of malformed callerid
This allows the callerid parsing function to handle malformed input
strings and strings containing escaped and unescaped double quotes.
This also adds a unittest to cover many of the cases where the parsing
algorithm previously failed.

Review: https://reviewboard.asterisk.org/r/3923/
Review: https://reviewboard.asterisk.org/r/3933/
........

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

Merged revisions 422113 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 422114 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 422154 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-27 15:39:35 +00:00