]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
9 years agoCHANGES: Fix a typo 23/1723/2
Niklas Larsson [Fri, 27 Nov 2015 13:39:22 +0000 (14:39 +0100)] 
CHANGES: Fix a typo

Change-Id: Iceb3d9bb78140c376174a7bee197dfcf8ef9cda7

9 years agoMerge "fastagi: record file closed after sending result" into 13
Matt Jordan [Thu, 26 Nov 2015 04:19:16 +0000 (22:19 -0600)] 
Merge "fastagi: record file closed after sending result" into 13

9 years agoMerge "main: Slight refactor of main. Improve color situation." into 13
Matt Jordan [Thu, 26 Nov 2015 04:17:43 +0000 (22:17 -0600)] 
Merge "main: Slight refactor of main. Improve color situation." into 13

9 years agofastagi: record file closed after sending result 20/1720/1
Kevin Harwell [Wed, 25 Nov 2015 21:26:35 +0000 (15:26 -0600)] 
fastagi: record file closed after sending result

The fastagi record-file testsuite test sometimes fails reporting an empty
recorded file. This was happening because Asterisk was sending the agi result
notification prior to actually closing the file and the data, being buffered,
had not been written to the file yet when the test attempts to check the file
size.

This patch makes it so the record file stream is closed prior to sending the
agi result notification.

ASTERISK-25593 #close

Change-Id: I6b2b3be3ae37f7c7b18e672c419a89b3b8513cde

9 years agomain: Slight refactor of main. Improve color situation. 13/1713/4
Walter Doekes [Wed, 25 Nov 2015 19:29:42 +0000 (20:29 +0100)] 
main: Slight refactor of main. Improve color situation.

Several issues are addressed here:
- main() is large, and half of it is only used if we're not rasterisk;
  fixed by spliting up the daemon part into a separate function.
- Call ast_term_init from rasterisk as well.
- Remove duplicate code reading/writing asterisk history file.
- Attempt to tackle background color issues and color changes that
  occur. Tested by starting asterisk -c until the colors stopped
  changing at odd locations.

ASTERISK-25585 #close

Change-Id: Ib641a0964c59ef9fe6f59efa8ccb481a9580c52f

9 years agoMerge "Fixed some typos" into 13
Matt Jordan [Wed, 25 Nov 2015 02:23:06 +0000 (20:23 -0600)] 
Merge "Fixed some typos" into 13

9 years agoFixed some typos 07/1707/1
David M. Lee [Tue, 24 Nov 2015 19:54:54 +0000 (13:54 -0600)] 
Fixed some typos

Fixes some minor typos in the CHANGES file, plus an embarrasing typo in
the StatsD API.

Change-Id: I9ca4858c64a4a07d2643b81baa64baebb27a4eb7

9 years agores_pjsip_notify: Fix CLI usage info 05/1705/1
Corey Farrell [Tue, 24 Nov 2015 19:07:12 +0000 (14:07 -0500)] 
res_pjsip_notify: Fix CLI usage info

The usage info for 'pjsip send notify' previously referenced the
chan_sip configuration sip_notify.conf.  Fix this to reference
the correct configuration pjsip_notify.conf.

ASTERISK-25590 #close

Change-Id: I3898271a8e8a8b1db201741e790ebe2c6bf5cdea

9 years agoMerge "translate: Provide translation modules the result of SDP negotiation." into 13
Joshua Colp [Tue, 24 Nov 2015 14:20:52 +0000 (08:20 -0600)] 
Merge "translate: Provide translation modules the result of SDP negotiation." into 13

9 years agoMerge "res_sorcery_realtime.c: Fix crash from NULL sorcery object type." into 13
Mark Michelson [Tue, 24 Nov 2015 00:04:53 +0000 (18:04 -0600)] 
Merge "res_sorcery_realtime.c: Fix crash from NULL sorcery object type." into 13

9 years agores_sorcery_realtime.c: Fix crash from NULL sorcery object type. 99/1699/1
Richard Mudgett [Mon, 23 Nov 2015 20:27:27 +0000 (14:27 -0600)] 
res_sorcery_realtime.c: Fix crash from NULL sorcery object type.

If the sorcery object type is not found a NULL is returned.
Unfortunately, sorcery_realtime_filter_objectset() will crash after
complaining about not finding the object type and saying to expect errors.

* Use ao2_cleanup() instead of ao2_ref() to prevent the crash.

ASTERISK-25165
Reported by Corey Farrell

Change-Id: Ic3b64453ea3058cb68d5c26d97d4fe7b8eea2e97

9 years agoMerge "chan_pjsip: Handle T.38 faxes with direct media bridges" into 13
Matt Jordan [Mon, 23 Nov 2015 19:33:06 +0000 (13:33 -0600)] 
Merge "chan_pjsip: Handle T.38 faxes with direct media bridges" into 13

9 years agoMerge "res/res_endpoint_stats: Add module to emit endpoint StatsD statistics" into 13
Matt Jordan [Mon, 23 Nov 2015 15:26:49 +0000 (09:26 -0600)] 
Merge "res/res_endpoint_stats: Add module to emit endpoint StatsD statistics" into 13

9 years agoMerge "res_pjsip/pjsip_options: Add StatsD statistics for PJSIP contacts" into 13
Matt Jordan [Mon, 23 Nov 2015 15:26:34 +0000 (09:26 -0600)] 
Merge "res_pjsip/pjsip_options: Add StatsD statistics for PJSIP contacts" into 13

9 years agoMerge "res/res_pjsip_outbound_registration: Add registration statistics for StatsD...
Matt Jordan [Mon, 23 Nov 2015 15:26:14 +0000 (09:26 -0600)] 
Merge "res/res_pjsip_outbound_registration: Add registration statistics for StatsD" into 13

9 years agoMerge "res_statsd: Add functions that support variable arguments" into 13
Matt Jordan [Mon, 23 Nov 2015 14:43:29 +0000 (08:43 -0600)] 
Merge "res_statsd: Add functions that support variable arguments" into 13

9 years agoMerge "StatsD: Add res_statsd compatibility" into 13
Matt Jordan [Mon, 23 Nov 2015 04:38:20 +0000 (22:38 -0600)] 
Merge "StatsD: Add res_statsd compatibility" into 13

9 years agochan_pjsip: Handle T.38 faxes with direct media bridges 68/1668/3
Matt Jordan [Sat, 21 Nov 2015 03:08:49 +0000 (21:08 -0600)] 
chan_pjsip: Handle T.38 faxes with direct media bridges

When a channel is in a direct media bridge, a re-INVITE may arrive that forces
Asterisk to re-negotiate the media to a T.38 fax. When this occurs, the bridge
must change its technology to a simple bridge, and re-INVITE the media back
to Asterisk.

Generally, this logic mostly already exists in Asterisk. However, prior to this
patch, there were a few bugs:
(1) The T.38 framehook currently prevents a channel capable of T.38 faxes from
    ever entering into a direct media bridge. This applies even when the only
    media being passed over the channel is audio. This patch fixes this bug
    by having the framehook specify that it defers caring about any frame type.
    This allows the channels to enter into a direct media bridge, which will
    be broken when a re-INVITE is received.
(2) When a re-INVITE is received, nothing instructed the bridging layer to
    re-inspect the allowed bridging technology. This now occurs when either
    a re-INVITE is received from a peer, or when a response is received from
    the far end (that is, when the T.38 state changes to either
    T38_PEER_REINVITE or T38_LOCAL_REINVITE).
(3) chan_pjsip needs to do a small amount of work to prevent a direct media
    bridge from being chosen when a T.38 session is in progress. When a T.38
    session supplement has a t38 datastore - which is added when we detect
    we should start thinking about T.38 on a channel - we now refuse a native
    RTP bridge.
(4) When a BYE request is received, we don't terminate the T.38 session. If
    the other side of a T.38 fax survives the hangup (due to the 'g' flag
    in Dial, for example), we don't currently re-INVITE the media on the
    other channel back to audio. This patch now has res_pjsip_t38 intercept
    BYE requests and inform the far side that the T.38 session is terminated.
    This naturally causes the correct re-INVITEs to be sent.

ASTERISK-25582

Change-Id: Iabd6aa578e633d16e6b9f342091264e4324a79eb

9 years agoMerge "main/cli: Use proper string methods to check existence of context/exten/app...
Joshua Colp [Sat, 21 Nov 2015 17:36:47 +0000 (11:36 -0600)] 
Merge "main/cli: Use proper string methods to check existence of context/exten/app" into 13

9 years agoMerge "res/res_pjsip_t38: Add debug statements" into 13
Joshua Colp [Sat, 21 Nov 2015 17:14:14 +0000 (11:14 -0600)] 
Merge "res/res_pjsip_t38: Add debug statements" into 13

9 years agoMerge "res_pjsip_outbound_registration.c: Be tolerant of short registration timeouts...
Matt Jordan [Sat, 21 Nov 2015 16:57:12 +0000 (10:57 -0600)] 
Merge "res_pjsip_outbound_registration.c: Be tolerant of short registration timeouts." into 13

9 years agores/res_pjsip_t38: Add debug statements 67/1667/2
Matt Jordan [Sat, 21 Nov 2015 03:07:27 +0000 (21:07 -0600)] 
res/res_pjsip_t38: Add debug statements

This patch adds some debug statements to res_pjsip_t38. These statements help
to determine which SDP negotiation callbacks are being executed, and, when
a particular callback exits, why a callback may not have applied its logic
to the local or remote SDP.

Change-Id: I61b3fb9183b7ebbb5da8e9f48b59a5d9d7042d77

9 years agomain/cli: Use proper string methods to check existence of context/exten/app 73/1673/1
Matt Jordan [Thu, 22 Oct 2015 14:44:43 +0000 (09:44 -0500)] 
main/cli: Use proper string methods to check existence of context/exten/app

Because the context, extension, and application are stored in stringfields,
checking for them being NULL doesn't work so well. This patch uses the
appropriate string library call, ast_strlen_zero, to see if there is a value
in the context/exten/app values.

Change-Id: Ie09623bfdf35f5a8d3b23dd596647fe3c97b9a23

9 years agoMerge "res_pjsip_outbound_registration.c: Fix 423 response handling." into 13
Mark Michelson [Fri, 20 Nov 2015 19:03:18 +0000 (13:03 -0600)] 
Merge "res_pjsip_outbound_registration.c: Fix 423 response handling." into 13

9 years agoMerge "res_format_attr_h264: Do not reset string buffer." into 13
Joshua Colp [Fri, 20 Nov 2015 15:20:51 +0000 (09:20 -0600)] 
Merge "res_format_attr_h264: Do not reset string buffer." into 13

9 years agores/res_endpoint_stats: Add module to emit endpoint StatsD statistics 55/1655/2
Matt Jordan [Wed, 18 Nov 2015 15:43:08 +0000 (09:43 -0600)] 
res/res_endpoint_stats: Add module to emit endpoint StatsD statistics

This patch adds a module that emits StatsD statistics about Asterisk
endpoints. This includes:
 * A GUAGE statistic for endpoint states, tracking how many endpoints are in
   a particular state.
 * A GUAGE statistic for each endpoint, counting the number of channels
   currently associated with an endpoint.

ASTERISK-25572

Change-Id: If7e1333c5aeda8d136850b30c2101c0ee1c97305

9 years agores_pjsip/pjsip_options: Add StatsD statistics for PJSIP contacts 54/1654/2
Matt Jordan [Wed, 18 Nov 2015 16:07:09 +0000 (10:07 -0600)] 
res_pjsip/pjsip_options: Add StatsD statistics for PJSIP contacts

This patch adds the ability to send StatsD statistics related to the
state of PJSIP contacts. This includes:
 * A GUAGE statistic measuring the count of contacts in a particular state.
   This measures how many contacts are reachable, unreachable, etc.
 * The RTT time for each contact, if those contacts are qualified. This
   provides StatsD engines useful time-based data about each contact.

ASTERISK-25571

Change-Id: Ib8378d73afedfc622be0643b87c542557e0b332c

9 years agores/res_pjsip_outbound_registration: Add registration statistics for StatsD 53/1653/2
Matt Jordan [Fri, 13 Nov 2015 16:34:03 +0000 (10:34 -0600)] 
res/res_pjsip_outbound_registration: Add registration statistics for StatsD

This patch adds outbound registration statistics for StatsD. This includes
the following:
 * A GUAGE metric for the overall count of outbound registrations.
 * A GUAGE metric for each state an outbound registration can be in. As the
   outbound registrations change state, the overall count of how many
   outbound registrations are in the particular state is changed.

These statistics are particularly useful for systems with a large number of
SIP trunks, and where measuring the change in state of the trunks is useful
for monitoring.

ASTERISK-25571

Change-Id: Iba6ff248f5d1c1e01acbb63e9f0da1901692eb37

9 years agores/res_pjsip_outbound_registration: Apply configuration on object type load 63/1663/1
Matt Jordan [Thu, 19 Nov 2015 15:40:24 +0000 (09:40 -0600)] 
res/res_pjsip_outbound_registration: Apply configuration on object type load

When Asterisk is configured to use a dynamic sorcery backend (such as
res_sorcery_astdb) with 'registration' objects, it will fail to create the
internal state objects associated with the registration objects on module
load. This is due to nothing actually querying for the specific objects
and calling their sorcery apply handler during module load.

This patch fixes that by calling get_registrations in the sorcery observer's
object_type_loaded handler. Doing this causes the sorcery backends to be
asked for the current state of all registration objects, which causes the
apply handler to be called and the internal run-time state to be created.

ASTERISK-25575 #close

Change-Id: Ie9306e797098c6d4da7bcf4a5434a15891508b23

9 years agotranslate: Provide translation modules the result of SDP negotiation. 99/1599/6
Alexander Traud [Wed, 11 Nov 2015 17:51:17 +0000 (18:51 +0100)] 
translate: Provide translation modules the result of SDP negotiation.

Previously, a trancoding module did not have access to the joint but cached
format. Therefore, the module did not have access to the attributes negotiated
via SDP (line fmtp). Now, a translation module receives the joint format.

ASTERISK-25545 #close

Change-Id: Id6878a989b50573298dab115d3371ea369e1a718

9 years agores_format_attr_h264: Do not reset string buffer. 62/1662/1
Alexander Traud [Thu, 19 Nov 2015 07:14:33 +0000 (08:14 +0100)] 
res_format_attr_h264: Do not reset string buffer.

When no parameter is present, Asterisk does not generate the line fmtp, as
expected. However, because a buffer was reset, even rtpmap and fmtp of previous
media codecs got removed. Now, Asterisk does not reset other codecs in case of
no parameter for H.264.

ASTERISK-25573 #close

Change-Id: I93811331f4a28c45418a9e14ee46c0debd47a286

9 years agores_statsd: Add functions that support variable arguments 52/1652/1
Matt Jordan [Wed, 18 Nov 2015 16:05:07 +0000 (10:05 -0600)] 
res_statsd: Add functions that support variable arguments

Often, the metric names of statistics we are generating for StatsD have some
dynamic component to them. This can be the name of a particular resource, or
some internal status label in Asterisk. With the current set of functions,
callers of the statsd API must first build the metric name themselves, then
pass this to the API functions. This results in a large amount of boilerplate
code and usage of either fixed length static buffers or dynamic memory
allocation, neither of which is desireable.

This patch adds two new functions to the StatsD API that support a printf
style format specifier for constructing the metric name. A dynamic string,
allocated in threadstorage, is used to build the metric name. This eases
the burden on users of the StatsD API.

Change-Id: If533c72d1afa26d807508ea48b4d8c7b32f414ea

9 years agores_pjsip_outbound_registration.c: Be tolerant of short registration timeouts. 45/1645/2
Richard Mudgett [Tue, 17 Nov 2015 20:53:19 +0000 (14:53 -0600)] 
res_pjsip_outbound_registration.c: Be tolerant of short registration timeouts.

Change-Id: Ie16f5053ebde0dc6507845393709b4d6a3ea526d

9 years agores_pjsip_outbound_registration.c: Fix 423 response handling. 44/1644/2
Richard Mudgett [Tue, 17 Nov 2015 20:53:57 +0000 (14:53 -0600)] 
res_pjsip_outbound_registration.c: Fix 423 response handling.

Receiving a 423 Interval Too Brief response after authentication for an
outbound registration attempt results in assuming that the registrar has
rejected the registration permanently.  If there are no configured retries
for fatal responses then the outbound registration is stopped for that
endpoint.

For registrations, PJSIP/PJPROJECT intercepts the handling of 423
responses and does not include any authentication in the updated
registration request.  When the updated request is challenged then the
Asterisk code assumes that we were challenged again because the peer
rejected the authentication we sent earlier.

* Made registration challenges keep track of the CSeq number to determine
if the received challenge response was for the request we thought we sent.
If the response's CSeq number differs from the CSeq number we last sent
with authentication then authenticate again because it is a challenge to a
different request.

Change-Id: I81b4bd36d1be095bab606e34b8b44e6302971b09

9 years agoStatsD: Add res_statsd compatibility 51/1651/1
tcambron [Tue, 3 Nov 2015 20:36:43 +0000 (14:36 -0600)] 
StatsD: Add res_statsd compatibility

Added a new api to res_statsd.c to allow it to receive a
character pointer for the value argument. This allows for a
'+' and a '-' to easily be sent with the value.

ASTERISK-25419
Reported By: Ashley Sanders

Change-Id: Id6bb53600943d27347d2bcae26c0bd5643567611

9 years agoMerge "res_pjsip_rfc3326.c: Fix crash when channel goes away." into 13
Matt Jordan [Wed, 18 Nov 2015 13:33:53 +0000 (07:33 -0600)] 
Merge "res_pjsip_rfc3326.c: Fix crash when channel goes away." into 13

9 years agoMerge "format: Register format-attribute module with cached formats." into 13
Matt Jordan [Tue, 17 Nov 2015 20:35:06 +0000 (14:35 -0600)] 
Merge "format: Register format-attribute module with cached formats." into 13

9 years agoMerge "res/res_pjsip: Fix off nominal crash with requests that fail and have a timer...
Matt Jordan [Tue, 17 Nov 2015 18:59:32 +0000 (12:59 -0600)] 
Merge "res/res_pjsip: Fix off nominal crash with requests that fail and have a timer" into 13

9 years agoMerge "Confbridge: Add a user timeout option" into 13
Joshua Colp [Tue, 17 Nov 2015 14:12:15 +0000 (08:12 -0600)] 
Merge "Confbridge: Add a user timeout option" into 13

9 years agores/res_pjsip: Fix off nominal crash with requests that fail and have a timer 39/1639/1
Matt Jordan [Mon, 16 Nov 2015 19:56:49 +0000 (13:56 -0600)] 
res/res_pjsip: Fix off nominal crash with requests that fail and have a timer

When a request is sent using pjsip_endpt_send_request and fails, a condition
exists where the request wrapper, which is an AO2 object, may be de-ref'd
more times than it should. This occurs when the request's callback is called,
and, in the callback, the timer on the PJSIP heap is cancelled. When that
occurs, the request wrapper's lifetime is decremented. When
pjsip_endpt_send_request fails, we unilaterally decrement the lifetime of
the request wrapper again, even though we've already cancelled the reference
associated with the timer.

This patch checks the return result of pj_timer_heap_cancel_if_active before
removing the reference associated with the timer. We now only decrement it
in this case if a timer is cancelled as a result of the function call.

Change-Id: I21332343a1a019c1117076f9bf2df27be2850102

9 years agoConfbridge: Add a user timeout option 29/1629/3
Mark Michelson [Fri, 13 Nov 2015 20:03:35 +0000 (14:03 -0600)] 
Confbridge: Add a user timeout option

This option adds the ability to specify a timeout, in seconds, for a
participant in a ConfBridge. When the user's timeout has been reached,
the user is ejected from the conference with the CONFBRIDGE_RESULT
channel variable set to "TIMEOUT".

The rationale for this change is that there have been times where we
have seen channels get "stuck" in ConfBridge because a network issue
results in a SIP BYE not being received by Asterisk. While these
channels can be hung up manually via CLI/AMI/ARI, adding some sort of
automatic cleanup of the channels is a nice feature to have.

ASTERISK-25549 #close
Reported by Mark Michelson

Change-Id: I2996b6c5e16a3dda27595f8352abad0bda9c2d98

9 years agoapp_queue: (try_calling): mutex 'qe->chan' freed more times than we've locked! 38/1638/1
Alec Davis [Mon, 16 Nov 2015 10:29:25 +0000 (23:29 +1300)] 
app_queue: (try_calling): mutex 'qe->chan' freed more times than we've locked!

commit aae45acbd (Mark Michelson 2015-04-15 10:38:02 -0500 6525)
refer ASTERISK-24958

above commit removed ast_channel_lock(qe->chan);
but failed to remove corresponding ast_channel_unlock(qe->chan);

ASTERISK-25561 #close
Reported Alec Davis

Change-Id: Ie05f4e2d08912606178bf1fded57cc022c7a2e1a

9 years agohashtab: Add NULL check when destroying iterator. 33/1633/1
Joshua Colp [Sat, 14 Nov 2015 13:02:10 +0000 (09:02 -0400)] 
hashtab: Add NULL check when destroying iterator.

The hashtab API is pretty NULL tolerant which has resulted
in remaining callers not doing much checks themselves.
Unfortunately the function to destroy an iterator does not
do a NULL check and will result in a crash if passed NULL.
This change fixes that.

ASTERISK-25552 #close

Change-Id: Ic1bf8eec3639e5a440f1c941d3ae3893ac6ed619

9 years agores_pjsip_rfc3326.c: Fix crash when channel goes away. 25/1625/1
Richard Mudgett [Fri, 13 Nov 2015 20:32:10 +0000 (14:32 -0600)] 
res_pjsip_rfc3326.c: Fix crash when channel goes away.

If an authenticated incoming caller does not respond to our 200 OK INVITE
response with an ACK then PJSIP will hangup the call.  Unfortunately,
there is a chance that the session's channel will go away between one use
of the channel pointer and another when building the BYE request because
the BYE is being built by the monitor thread and not the call's serializer
thread.

* Added a check to ensure that the thread trying to add the Reason header
is the call's serializer thread.  This ensures that the channel will not
go away on us.

Change-Id: I866388d2b97ea2032eaae3f3ab3f1ca6cbd2df89

9 years agoTaskprocessors: Increase high-water mark 23/1623/1
Mark Michelson [Fri, 13 Nov 2015 20:19:35 +0000 (14:19 -0600)] 
Taskprocessors: Increase high-water mark

In practical tests, we have seen certain taskprocessors, specifically
Stasis subscription taskprocessors, cross the recently-added high-water
mark and emit a warning. This high-water mark warning is only intended
to be emitted when things have tanked on the system and things are
heading south quickly. In the practical tests, the Stasis taskprocessors
sometimes had a max depth of 180 tasks in them, and Asterisk wasn't in
any danger at all.

As such, this ups the high-water mark to 500 tasks instead. It also
redefines the SIP threadpool request denial number to be a multiple of
the taskprocessor high-water mark.

Change-Id: Ic8d3e9497452fecd768ac427bb6f58aa616eebce

9 years agoformat: Register format-attribute module with cached formats. 01/1601/3
Alexander Traud [Wed, 11 Nov 2015 17:46:28 +0000 (18:46 +0100)] 
format: Register format-attribute module with cached formats.

In Asterisk 13, cached formats are created before their corresponding format-
attribute module is registered. Cached formats are involved when a local
extension is called. Therefore, ast_format_generate_sdp_fmtp did not work
on local extensions. This change affects the Opus Codec, H.263 (Plus), H.264,
and format-attribute modules provided externally.

ASTERISK-25160 #close

Change-Id: I1ea1f0483e5261e2a050112e4ebdfc22057d1354

9 years agores_pjsip distributor: Don't send 503 response to responses. 17/1617/1
Mark Michelson [Thu, 12 Nov 2015 17:17:51 +0000 (11:17 -0600)] 
res_pjsip distributor: Don't send 503 response to responses.

When the SIP threadpool is backed up with tasks, we send 503 responses
to ensure that we don't try to overload ourselves. The problem is that
we were not insuring that we were not trying to send a 503 to an
incoming SIP response.

This change makes it so that we only send the 503 on incoming requests.

Change-Id: Ie2b418d89c0e453cc6c2b5c7d543651c981e1404

9 years agoMerge "res_pjsip: Deny requests when threadpool queue is backed up." into 13
Joshua Colp [Thu, 12 Nov 2015 16:56:04 +0000 (10:56 -0600)] 
Merge "res_pjsip: Deny requests when threadpool queue is backed up." into 13

9 years agoMerge "format_cap: Don't append the 'none' format when appending all." into 13
Matt Jordan [Thu, 12 Nov 2015 16:54:04 +0000 (10:54 -0600)] 
Merge "format_cap: Don't append the 'none' format when appending all." into 13

9 years agores_pjsip: Deny requests when threadpool queue is backed up. 07/1607/2
Mark Michelson [Wed, 11 Nov 2015 23:11:53 +0000 (17:11 -0600)] 
res_pjsip: Deny requests when threadpool queue is backed up.

We have observed situations where the SIP threadpool may become
deadlocked. However, because incoming traffic is still arriving, the SIP
threadpool's queue can continue to grow, eventually running the system
out of memory.

This change makes it so that incoming traffic gets rejected with a 503
response if the queue is backed up too much.

Change-Id: I4e736d48a2ba79fd1f8056c0dcd330e38e6a3816

9 years agoMerge "Further fixes to improper usage of scheduler" into 13
Joshua Colp [Thu, 12 Nov 2015 13:56:30 +0000 (07:56 -0600)] 
Merge "Further fixes to improper usage of scheduler" into 13

9 years agoformat_cap: Don't append the 'none' format when appending all. 11/1611/3
Joshua Colp [Thu, 12 Nov 2015 12:24:06 +0000 (08:24 -0400)] 
format_cap: Don't append the 'none' format when appending all.

When appending all formats of a type all the codecs are iterated
and added. This operation was incorrectly adding the ast_format_none
format which is special in that it is supposed to be used when no
format is present. It shouldn't be appended.

ASTERISK-25535

Change-Id: I7b00f3bdf4a5f3022e483d6ece602b1e8b12827c

9 years agoFurther fixes to improper usage of scheduler 09/1609/1
Steve Davies [Wed, 11 Nov 2015 10:16:22 +0000 (10:16 +0000)] 
Further fixes to improper usage of scheduler

When ASTERISK-25449 was closed, a number of scheduler issues mentioned in
the comments were missed. These have since beed raised in ASTERISK-25476
and elsewhere.

This patch attempts to collect all of the scheduler issues discovered so
far and address them sensibly.

ASTERISK-25476 #close

Change-Id: I87a77d581e2e0d91d33b4b2fbff80f64a566d05b

9 years agothreadpool: Handle worker thread transitioning to dead when going active. 02/1602/4
Joshua Colp [Wed, 11 Nov 2015 17:04:08 +0000 (13:04 -0400)] 
threadpool: Handle worker thread transitioning to dead when going active.

This change adds handling of dead worker threads when moving them
to be active. When this happens the worker thread is removed from
both the active and idle threads container. If no threads are able
to be moved to active then the pool grows as configured.

A unit test has also been added which thrashes the idle timeout
and thread activation to exploit any race conditions between the
two.

ASTERISK-25546 #close

Change-Id: I6c455f9a40de60d9e86458d447b548fb52ba1143

9 years agoMerge "rtp_engine: Init a format-attribute module to its RFC defaults." into 13
Matt Jordan [Wed, 11 Nov 2015 14:09:51 +0000 (08:09 -0600)] 
Merge "rtp_engine: Init a format-attribute module to its RFC defaults." into 13

9 years agoMerge "res_pjsip_sdp_rtp: Enable Opus to be negotiated via SIP/SDP." into 13
Matt Jordan [Wed, 11 Nov 2015 14:08:51 +0000 (08:08 -0600)] 
Merge "res_pjsip_sdp_rtp: Enable Opus to be negotiated via SIP/SDP." into 13

9 years agoMerge "ast_format_cap: Avoid format creation on module load, use cache instead."...
Matt Jordan [Wed, 11 Nov 2015 14:07:58 +0000 (08:07 -0600)] 
Merge "ast_format_cap: Avoid format creation on module load, use cache instead." into 13

9 years agoMerge "xmldoc: Improve xmldoc wrapping of 'core show ...' output." into 13
Matt Jordan [Wed, 11 Nov 2015 14:06:51 +0000 (08:06 -0600)] 
Merge "xmldoc: Improve xmldoc wrapping of 'core show ...' output." into 13

9 years agortp_engine: Init a format-attribute module to its RFC defaults. 93/1593/2
Alexander Traud [Tue, 10 Nov 2015 15:27:57 +0000 (16:27 +0100)] 
rtp_engine: Init a format-attribute module to its RFC defaults.

Previously, format-attribute modules relied on an existing fmtp line in SDP
negotiation. However, fmtp is optional for several formats like the Opus Codec.
Now, the format-attribute module is called with an empty fmtp, which allows the
module to initialise itself to RFC defaults. Furthermore now, Asterisk is able
to differentiate between internally and externally created formats.

ASTERISK-25537 #close

Change-Id: I28f680cef7fdf51c0969ff8da71548edad72ec52

9 years agoMerge "taskprocessor: Add high water mark warnings" into 13
Joshua Colp [Wed, 11 Nov 2015 13:10:22 +0000 (07:10 -0600)] 
Merge "taskprocessor: Add high water mark warnings" into 13

9 years agoMerge "ast_format_cap_get_names: To display all formats, the buffer was increased...
Joshua Colp [Tue, 10 Nov 2015 20:58:24 +0000 (14:58 -0600)] 
Merge "ast_format_cap_get_names: To display all formats, the buffer was increased." into 13

9 years agoMerge "func_callerid: Document that CALLERID(pres) is available." into 13
Joshua Colp [Tue, 10 Nov 2015 16:04:38 +0000 (10:04 -0600)] 
Merge "func_callerid: Document that CALLERID(pres) is available." into 13

9 years agoast_format_cap_get_names: To display all formats, the buffer was increased. 91/1591/1
Alexander Traud [Mon, 9 Nov 2015 09:04:24 +0000 (10:04 +0100)] 
ast_format_cap_get_names: To display all formats, the buffer was increased.

ASTERISK-25533 #close

Change-Id: Ie1a9d1a6511b3f1a56b93d04475fbf8a4e40010a

9 years agoast_format_cap: Avoid format creation on module load, use cache instead. 90/1590/1
Alexander Traud [Mon, 9 Nov 2015 13:04:43 +0000 (14:04 +0100)] 
ast_format_cap: Avoid format creation on module load, use cache instead.

Since Asterisk 13, formats are immutable and cached. However while loading a
module like chan_sip, some formats were created instead using cached ones.

ASTERISK-25535 #close

Change-Id: I479cdc220d5617c840a98f3389b3bd91e91fbd9b

9 years agofunc_callerid: Document that CALLERID(pres) is available. 83/1583/3
Walter Doekes [Fri, 6 Nov 2015 13:54:59 +0000 (14:54 +0100)] 
func_callerid: Document that CALLERID(pres) is available.

CALLERPRES() says that it's deprecated in favor of CALLERID(num-pres)
and CALLERID(name-pres).  But for channel driver that don't make a
distinction between the two (e.g. SIP), it makes more sense to get/set
both at once.  This change reveals the availability of CALLERID(pres),
CONNECTEDLINE(pres), REDIRECTING(orig-pres), REDIRECTING(to-pres) and
REDIRECTING(from-pres).

ASTERISK-25373 #close

Change-Id: I5614ae4ab7d3bbe9c791c1adf147e10de8698d7a

9 years agodocs: Fix a few typo's in app docs (more then, resourse). 80/1580/2
Walter Doekes [Fri, 6 Nov 2015 13:52:00 +0000 (14:52 +0100)] 
docs: Fix a few typo's in app docs (more then, resourse).

Change-Id: Iba57efadf6c0b822e762c7a001bc89611d98afd7

9 years agoxmldoc: Improve xmldoc wrapping of 'core show ...' output. 77/1577/1
Walter Doekes [Fri, 6 Nov 2015 13:36:40 +0000 (14:36 +0100)] 
xmldoc: Improve xmldoc wrapping of 'core show ...' output.

Previously, the wrapping did both lookahead and lookback, which,
together with color escape sequences, caused some lines to be wrapped
way earlier than other lines.  This led to inconsistent output.

This simplifies the wrapping code and makes it more sane: if maxcolumns
is hit, we simply jump back to the last space and wrap there.

ASTERISK-25527 #close

Change-Id: I56d01c6f9a812642b1b05535c98d4db48d17c957

9 years agores_pjsip_sdp_rtp: Enable Opus to be negotiated via SIP/SDP. 75/1575/1
Alexander Traud [Fri, 6 Nov 2015 12:57:15 +0000 (13:57 +0100)] 
res_pjsip_sdp_rtp: Enable Opus to be negotiated via SIP/SDP.

In SIP/SDP, Opus has two channels always (see RFC 7587 section 7). The actual
amount of channels is negotiated in-band. Therefore now, the Opus codec and its
attribute rtpmap are registered with two channels.

ASTERISK-24779 #close
Reported by: PowerPBX
Tested by: Alexander Traud
patches:
  asterisk-24779.patch submitted by Sean Bright (license #5060)

Change-Id: Ic7ac13cafa1d3450b4fa4987350924b42cbb657b

9 years agotaskprocessor: Add high water mark warnings 72/1572/1
Jonathan Rose [Tue, 3 Nov 2015 22:19:43 +0000 (16:19 -0600)] 
taskprocessor: Add high water mark warnings

If a taskprocessor's queue grows large, this can indicate that there
may be a problem with tasks not leaving the processor or else that
the number of available task processors for a given type of task is
too low. This patch makes it so that if a taskprocessor's task queue
grows above 100 queued tasks that it will emit a warning message.
Warning messages are emitted only once per task processor.

ASTERISK-25518 #close
Reported by: Jonathan Rose

Change-Id: Ib1607c35d18c1d6a0575b3f0e3ff5d932fd6600c

9 years agomain/dial: Protect access to the format_cap structure of the requesting channel 66/1566/1
Matt Jordan [Wed, 4 Nov 2015 20:31:28 +0000 (14:31 -0600)] 
main/dial: Protect access to the format_cap structure of the requesting channel

When a dial attempt is made that involves a requesting channel, we previously
were not:
a) Protecting access to the native format capabilities structure on the
   requesting channel. That is inherently unsafe.
b) Reference bumping the lifetime of the format capabilities structure.

In both cases, something else could sneak in, blow away the format
capabilities, and we'd be holding onto an invalid format_cap structure. When
the newly created channel attempts to construct its format capabilities, things
go poorly.

This patch:
a) Ensures that we get a reference to the native format capabilities while
   the requesting channel is locked
b) Holds a reference to the native format capabilities during the creation
   of the new channel.

ASTERISK-25522 #close

Change-Id: I0bfb7ba8b9711f4158cbeaae96edf9626e88a54f

9 years agoFix cli display of build options. 64/1564/1
Corey Farrell [Sat, 31 Oct 2015 03:57:58 +0000 (23:57 -0400)] 
Fix cli display of build options.

A previous commit reduced the AST_BUILDOPTS compiler define to
only include options that affected ABI.  This included some options
that were previously displayed by cli "core show settings".  This
change corrects the CLI display while still restricting buildopts.h
to ABI effecting options only.

ASTERISK-25434 #close
Reported by: Rusty Newton

Change-Id: Id07af6bedd1d7d325878023e403fbd9d3607e325

9 years agores_pjsip/location: Destroy contact_status objects on contact deletion 57/1557/2
Matt Jordan [Tue, 3 Nov 2015 17:15:09 +0000 (11:15 -0600)] 
res_pjsip/location: Destroy contact_status objects on contact deletion

The contact_status Sorcery objects are currently not destroyed when a contact
is deleted. This causes the contact's last known RTT/status to be 'sticky'
when the contact itself may no longer exist. This patch causes the
contact_status objects associated with both dynamic and static contacts to
be destroyed if the AoR holding those contacts is also destroyed (or via
other paths where a contact may be deleted.)

Change-Id: I7feec8b9278cac3c5263a4c0483f4a0f3b62426e

9 years agoMerge "pjsip_configuration: On delete, remove the persistent version of an endpoint...
Matt Jordan [Wed, 4 Nov 2015 13:44:12 +0000 (07:44 -0600)] 
Merge "pjsip_configuration: On delete, remove the persistent version of an endpoint" into 13

9 years agoMerge "main/stasis_endpoints: Fix ContactStatusChange JSON for roundtrip_usec field...
Matt Jordan [Tue, 3 Nov 2015 21:38:10 +0000 (15:38 -0600)] 
Merge "main/stasis_endpoints: Fix ContactStatusChange JSON for roundtrip_usec field" into 13

9 years agopjsip_configuration: On delete, remove the persistent version of an endpoint 56/1556/2
Matt Jordan [Tue, 3 Nov 2015 16:58:47 +0000 (10:58 -0600)] 
pjsip_configuration: On delete, remove the persistent version of an endpoint

When an endpoint is deleted (such as through an API), the persistent endpoint
currently continues to lurk around. While this isn't harmful from a memory
consumption perspective - as all persistent endpoints are reclaimed on
shutdown - it does cause Stasis endpoint related operations to continue
to believe that the endpoint may or may not exist.

This patch causes the persistent endpoint related to a PJSIP endpoint to be
destroyed if the PJSIP endpoint is deleted.

Change-Id: I85ac707b4d5e6aad882ac275b0c2e2154affa5bb

9 years agomain/stasis_endpoints: Fix ContactStatusChange JSON for roundtrip_usec field 54/1554/1
Matt Jordan [Tue, 3 Nov 2015 14:15:16 +0000 (08:15 -0600)] 
main/stasis_endpoints: Fix ContactStatusChange JSON for roundtrip_usec field

The JSON packing for the ContactStatusChange event forgot to include the
roundtrip_usec field. As a result, the field never showed up in any event,
even when the data was available. This patch corrects that error by properly
packing the JSON blob with the data.

Change-Id: I8df80da659a44010afbd48f645967518ff5daa17

9 years agochan_sip: Allow websockets to be disabled. 53/1553/2
Corey Farrell [Tue, 3 Nov 2015 02:24:58 +0000 (21:24 -0500)] 
chan_sip: Allow websockets to be disabled.

This patch adds a new setting "websockets_enabled" to sip.conf.
Setting this to false allows chan_sip to be used without causing
conflicts with res_pjsip_transport_websocket.

ASTERISK-24106 #close
Reported by: Andrew Nagy

Change-Id: I04fe8c4f2d57b2d7375e0e25826c91a72e93bea7

9 years agores_pjsip: Set threadpool max size default to 50. 49/1549/1
Mark Michelson [Mon, 2 Nov 2015 23:19:21 +0000 (17:19 -0600)] 
res_pjsip: Set threadpool max size default to 50.

During a stress test of subscriptions, a huge blast of
subscription-related traffic resulted in the threadpool expanding to a
ridiculous number of threads. The balooning of threads resulted in an
increase of memory, which led to a crash due to being out of memory.

An easy fix for the particular test was to limit the size of the
threadpool, thus reining in the amount of memory that would be used. It
was decided that there really is no downside to having a non-infinite
default value for the maximum size of the threadpool, so this change
introduces 50 threads as the maximum threadpool size for the SIP
threadpool.

ASTERISK-25513 #close
Reported by John Bigelow

Change-Id: If0b9514f1d9b172540ce1a6e2f2ffa1f2b6119be

9 years agoMerge "pjsip_options: Schedule/unschedule qualifies on AoR creation/destruction"...
Joshua Colp [Mon, 2 Nov 2015 22:02:18 +0000 (16:02 -0600)] 
Merge "pjsip_options: Schedule/unschedule qualifies on AoR creation/destruction" into 13

9 years agopjsip_options: Schedule/unschedule qualifies on AoR creation/destruction 47/1547/2
Matt Jordan [Mon, 2 Nov 2015 12:57:22 +0000 (06:57 -0600)] 
pjsip_options: Schedule/unschedule qualifies on AoR creation/destruction

When an AoR is created or destroyed dynamically, the scheduled OPTIONS
requests that qualify the contacts on the AoR are not necessarily started
or destroyed, particularly for persistent contacts created for that AoR.
This patch adds create/update/delete sorcery observers for an AoR, which
schedule/unschedule the qualifies as expected.

Change-Id: Ic287ed2e2952a7808ee068776fe966f9554bdf7d

9 years agoMakefile: Add a rule 'basic-pbx' that installs the Basic PBX configs 43/1543/4
Matt Jordan [Fri, 30 Oct 2015 18:22:23 +0000 (13:22 -0500)] 
Makefile: Add a rule 'basic-pbx' that installs the Basic PBX configs

This patch adds a rule for installing the Super Awesome Company based 'Basic
PBX' configuration files. As part of adding this rule, a bit of the content
that makes up installing the configuration files under the 'samples' target
was refactored into a make subroutine for usage by additional later config
make targets.

Change-Id: I6c2e27906f73e2919a2b691da0be20ae70302404

9 years agores_pjsip_pubsub: Fix assertion when UAS dialog creation fails. 40/1540/1
Joshua Colp [Thu, 29 Oct 2015 13:28:33 +0000 (10:28 -0300)] 
res_pjsip_pubsub: Fix assertion when UAS dialog creation fails.

When compiled with assertions enabled one will occur when destroying
the subscription tree when UAS dialog creation fails. This is because
the code assumes that a dialog will always exist on a subscription
tree when in reality during this specific scenario it won't.

This change makes it so a dialog is not removed from the subscription
tree if it is not present.

ASTERISK-25505 #close

Change-Id: Id5c182b055aacc5e66c80546c64804ce19218dee

9 years agoMerge "chan_sip: Do not send all codecs on INVITE." into 13
Matt Jordan [Thu, 29 Oct 2015 13:26:45 +0000 (08:26 -0500)] 
Merge "chan_sip: Do not send all codecs on INVITE." into 13

9 years agoMerge "res_pjsip: Add "like" processing to pjsip list and show commands" into 13
Joshua Colp [Wed, 28 Oct 2015 11:30:56 +0000 (06:30 -0500)] 
Merge "res_pjsip:  Add "like" processing to pjsip list and show commands" into 13

9 years agochan_sip: Do not send all codecs on INVITE. 33/1533/1
Alexander Traud [Mon, 26 Oct 2015 16:42:03 +0000 (17:42 +0100)] 
chan_sip: Do not send all codecs on INVITE.

Since version 13, Asterisk sent all allowed codecs as callee, even when the
caller did not request/support them. In case of dynamic RTP payloads, this led
to the same ID for different codecs, which is not allowed by SIP/SDP. Now, the
intersection between the requested and the supported codecs is send again.

ASTERISK-24543 #close

Change-Id: Ie90cb8bf893b0895f8d505e77343de3ba152a287

9 years agoMerge "build: GCC 5.1.x catches some new const, array bounds and missing paren issues...
Joshua Colp [Mon, 26 Oct 2015 16:32:22 +0000 (11:32 -0500)] 
Merge "build: GCC 5.1.x catches some new const, array bounds and missing paren issues" into 13

9 years agoMerge "format: Update the maximum packetization time for iLBC 30." into 13
Matt Jordan [Mon, 26 Oct 2015 15:50:08 +0000 (10:50 -0500)] 
Merge "format: Update the maximum packetization time for iLBC 30." into 13

9 years agoMerge "res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog." into 13
Matt Jordan [Sun, 25 Oct 2015 15:14:55 +0000 (10:14 -0500)] 
Merge "res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog." into 13

9 years agoMerge "res_pjsip_pubsub: Ensure dialog lock balance." into 13
Matt Jordan [Sun, 25 Oct 2015 15:14:24 +0000 (10:14 -0500)] 
Merge "res_pjsip_pubsub: Ensure dialog lock balance." into 13

9 years agoMerge "res_pjsip_pubsub: Prevent crashes on final NOTIFY." into 13
Matt Jordan [Sun, 25 Oct 2015 15:12:58 +0000 (10:12 -0500)] 
Merge "res_pjsip_pubsub: Prevent crashes on final NOTIFY." into 13

9 years agoMerge "res_pjsip_pubsub: Remove serializer when sending final NOTIFY." into 13
Matt Jordan [Sun, 25 Oct 2015 15:12:36 +0000 (10:12 -0500)] 
Merge "res_pjsip_pubsub: Remove serializer when sending final NOTIFY." into 13

9 years agoMerge "res_pjsip_pubsub: Fix crash on destruction of empty subscription tree." into 13
Matt Jordan [Sun, 25 Oct 2015 15:12:03 +0000 (10:12 -0500)] 
Merge "res_pjsip_pubsub: Fix crash on destruction of empty subscription tree." into 13

9 years agoMerge "res_pjsip_pubsub: Solidify lifetime and ownership of objects." into 13
Matt Jordan [Sun, 25 Oct 2015 15:10:55 +0000 (10:10 -0500)] 
Merge "res_pjsip_pubsub: Solidify lifetime and ownership of objects." into 13

9 years agobuild: GCC 5.1.x catches some new const, array bounds and missing paren issues 23/1523/1
George Joseph [Sat, 24 Oct 2015 18:08:41 +0000 (12:08 -0600)] 
build: GCC 5.1.x catches some new const, array bounds and missing paren issues

Fixed 1 issue in each of the affected files.

ASTERISK-25494 #close
Reported-by: George Joseph
Tested-by: George Joseph
Change-Id: I818f149cd66a93b062df421e1c73c7942f5a4a77

9 years agores_pjsip: Add "like" processing to pjsip list and show commands 57/1457/7
George Joseph [Tue, 20 Oct 2015 21:02:30 +0000 (15:02 -0600)] 
res_pjsip:  Add "like" processing to pjsip list and show commands

Add the ability to filter output from pjsip list and show commands
using the "like" predicate like chan_sip.

For endpoints, aors, auths, registrations, identifyies and transports,
the modification was a simple change of an ast_sorcery_retrieve_by_fields
call to ast_sorcery_retrieve_by_regex.  For channels and contacts a
little more work had to be done because neither of those objects are
true sorcery objects.  That was just removing the non-matching object
from the final container.  Of course, a little extra plumbing in the
common pjsip_cli code was needed to parse the "like" and pass the regex
to the get_container callbacks.

Some of the get_container code in res_pjsip_endpoint_identifier was also
refactored for simplicity.

ASTERISK-25477 #close
Reported by: Bryant Zimmerman
Tested by: George Joseph

Change-Id: I646d9326b778aac26bb3e2bcd7fa1346d24434f1

9 years agoMerge "res_pjsip_outbound_registration: registration stops due to fatal 4xx response...
Joshua Colp [Fri, 23 Oct 2015 20:35:18 +0000 (15:35 -0500)] 
Merge "res_pjsip_outbound_registration: registration stops due to fatal 4xx response" into 13

9 years agores_pjsip_outbound_registration: registration stops due to fatal 4xx response 72/1472/6
Kevin Harwell [Wed, 21 Oct 2015 16:51:13 +0000 (11:51 -0500)] 
res_pjsip_outbound_registration: registration stops due to fatal 4xx response

During outbound registration it is possible to receive a fatal (any permanent/
non-temporary 4xx, 5xx, 6xx) response from the registrar that is simply due
to a problem with the registrar itself. Upon receiving the failure response
Asterisk terminates outbound registration for the given endpoint.

This patch adds an option, 'fatal_retry_interval', that when set continues
outbound registration at the given interval up to 'max_retries' upon receiving
a fatal response.

ASTERISK-25485 #close

Change-Id: Ibc2c7b47164ac89cc803433c0bbe7063bfa143a2

9 years agoMerge "chan_sip: Fix autoframing=yes." into 13
Joshua Colp [Fri, 23 Oct 2015 11:51:54 +0000 (06:51 -0500)] 
Merge "chan_sip: Fix autoframing=yes." into 13

9 years agoMerge topic 'fix_oom_crash' into 13
Joshua Colp [Fri, 23 Oct 2015 11:51:32 +0000 (06:51 -0500)] 
Merge topic 'fix_oom_crash' into 13

* changes:
  strings.c: Fix __ast_str_helper() to always return a terminated string.
  Add missing failure checks to ast_str_set_va() callers.

9 years agoMerge "res_pjsip: Move URI validation to use time." into 13
Joshua Colp [Fri, 23 Oct 2015 11:48:48 +0000 (06:48 -0500)] 
Merge "res_pjsip: Move URI validation to use time." into 13