Commit Graph

27236 Commits

Author SHA1 Message Date
Matt Jordan 1d4f813a07 Merge "format_cap: Don't append the 'none' format when appending all." 2015-11-12 10:54:01 -06:00
Mark Michelson 264c74aa22 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
2015-11-12 11:39:41 -05:00
Joshua Colp 469ad02404 Merge "Further fixes to improper usage of scheduler" 2015-11-12 07:56:36 -06:00
Joshua Colp a159747660 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
2015-11-12 08:48:42 -05:00
Steve Davies d982b99e71 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
2015-11-12 11:46:43 +00:00
Joshua Colp 2954354404 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
2015-11-11 14:18:39 -05:00
Matt Jordan c1abe8906d Merge "rtp_engine: Init a format-attribute module to its RFC defaults." 2015-11-11 08:19:39 -06:00
Matt Jordan 21ee2f029c Merge "Increase account code maximum length to 80." 2015-11-11 08:09:18 -06:00
Matt Jordan 9c9ebbd482 Merge "dns: Use ntohl for ans->ttl in dns_parse_answer_ex" 2015-11-11 08:09:06 -06:00
Matt Jordan d77bba4326 Merge "res_pjsip_sdp_rtp: Enable Opus to be negotiated via SIP/SDP." 2015-11-11 08:08:55 -06:00
Matt Jordan 7987bf54c6 Merge "ast_format_cap: Avoid format creation on module load, use cache instead." 2015-11-11 08:08:02 -06:00
Matt Jordan 8b4b3e9b88 Merge "xmldoc: Improve xmldoc wrapping of 'core show ...' output." 2015-11-11 08:06:54 -06:00
Alexander Traud 525c7ab780 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
2015-11-11 15:00:26 +01:00
Joshua Colp d8dadf4894 Merge "taskprocessor: Add high water mark warnings" 2015-11-11 07:10:42 -06:00
Joshua Colp e4af14784e Merge "Remove ABI compatibility stub functions." 2015-11-10 16:11:07 -06:00
Joshua Colp 0be147f713 Merge "ast_format_cap_get_names: To display all formats, the buffer was increased." 2015-11-10 14:58:18 -06:00
Corey Farrell be93036a4e Remove ABI compatibility stub functions.
ABI compatibility stubs existed for ast_app_separate_args and ast_verbose,
this is not needed in master.

Change-Id: I07b4d2c16079da3c2c6efa55df4a74368e0bd453
2015-11-10 15:37:09 -05:00
Corey Farrell 02a124eda5 Remove execute permission from dns_system_resolver.c
Change-Id: I3185735db42064bab00d3e073aed703385a00bf4
2015-11-10 15:35:27 -05:00
Joshua Colp 131b750fc6 Merge "func_callerid: Document that CALLERID(pres) is available." 2015-11-10 10:04:50 -06:00
Alexander Traud cf79b62778 ast_format_cap_get_names: To display all formats, the buffer was increased.
ASTERISK-25533 #close

Change-Id: Ie1a9d1a6511b3f1a56b93d04475fbf8a4e40010a
2015-11-09 16:58:52 +01:00
Alexander Traud e85f0c81af 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
2015-11-09 14:05:14 +01:00
Walter Doekes 7dd8f89a50 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
2015-11-06 18:03:47 -05:00
Walter Doekes 39daf9f066 docs: Fix a few typo's in app docs (more then, resourse).
Change-Id: Iba57efadf6c0b822e762c7a001bc89611d98afd7
2015-11-06 16:46:31 -05:00
George Joseph d82a4b098f dns: Use ntohl for ans->ttl in dns_parse_answer_ex
dns_parse_answer_ex was not converting ans->ttl from network
by order to host byte order which was causing certain ttls
it to go negative. In turn this was causing answer edit checks
to fail.

ASTERISK-25528 #close
Reported-by: Daniel Tryba
Tested-by: George Joseph

Change-Id: I31505132d6321c46d2f39fd06c20ee808a864037
2015-11-06 13:19:11 -07:00
Walter Doekes 74e7333317 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
2015-11-06 08:46:24 -05:00
Alexander Traud 9d6e917349 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
2015-11-06 13:59:30 +01:00
Jonathan Rose a2c2a8e1bb 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
2015-11-05 16:20:40 -06:00
Corey Farrell cd5ae02812 Increase account code maximum length to 80.
This increases the maximum length of account code's to match
extensions.  This ensures it is always possible to set an
accountcode to ${EXTEN} without truncation.

ASTERISK-23904
Reported by: Ben Merrills

Change-Id: If122602304ce03362722eb213a3111b32da5eeb9
2015-11-05 10:20:34 -05:00
Joshua Colp f12ebe3584 Merge "StatsD: Add res_statsd compatibility" 2015-11-04 17:47:09 -06:00
tcambron 379c041038 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
2015-11-04 14:59:12 -06:00
Matt Jordan 9c293b5104 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
2015-11-04 15:42:32 -05:00
Corey Farrell b0bf189908 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
2015-11-04 09:15:51 -05:00
Matt Jordan 0aef8e058f Merge "res_pjsip/location: Destroy contact_status objects on contact deletion" 2015-11-04 07:44:26 -06:00
Matt Jordan 7d1c0c61ce Merge "pjsip_configuration: On delete, remove the persistent version of an endpoint" 2015-11-04 07:44:07 -06:00
Matt Jordan 63e02b45c6 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
2015-11-03 12:21:06 -05:00
Matt Jordan d33a1682e3 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
2015-11-03 12:19:16 -05:00
Matt Jordan e26a06c1da 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
2015-11-03 09:18:41 -05:00
Corey Farrell 40574a2ea3 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
2015-11-03 08:53:00 -05:00
Mark Michelson f80a0ae49b 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
2015-11-02 18:24:09 -05:00
Joshua Colp 1eeef9ea04 Merge "pjsip_options: Schedule/unschedule qualifies on AoR creation/destruction" 2015-11-02 16:02:10 -06:00
Joshua Colp 29810aa620 Merge "StatsD: Send stuff to the StatsD server and test" 2015-11-02 15:11:10 -06:00
tcambron c5093b21ad StatsD: Send stuff to the StatsD server and test
Added code to allow the StatsD dialplan application to
send data to the server specified in statsd.conf.

ASTERISK-25419

Change-Id: I400db2f37c6ddf61515ff5a019646e36dcd0f922
2015-11-02 09:24:49 -06:00
Matt Jordan 014e3d426b 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
2015-11-02 09:11:52 -05:00
Matt Jordan 2ddd9ff2d9 Merge "app_queue: Added reason pause of member" 2015-11-02 07:59:18 -06:00
Matt Jordan 80cf4960ff 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
2015-10-31 13:40:17 -05:00
Joshua Colp b522a5e30f 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
2015-10-29 08:33:08 -05:00
Matt Jordan a186c9ee30 Merge "chan_sip: Do not send all codecs on INVITE." 2015-10-29 08:26:39 -05:00
Joshua Colp 7f30944049 Merge "StatsD: Add user input validation to the application" 2015-10-28 15:42:55 -05:00
tcambron fdfd0fb488 StatsD: Add user input validation to the application
Added code to accept user input and validate it before
allowing it to be sent to the StatsD server.

ASTERISK-25419
Reported By: Ashley Sanders

Change-Id: I55c7ce44326a68ad6c5c1514b9575ac50f25bbc3
2015-10-28 11:44:29 -05:00
Joshua Colp df3aa29100 Merge "res_pjsip: Add "like" processing to pjsip list and show commands" 2015-10-28 06:31:02 -05:00