summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-06-09Merge "ARI: Ensure proper channel state on operations."zuul
2016-06-09Merge "test_http_media_cache: Fix failing test."zuul
2016-06-09Merge "chan_sip: Support auth username for callbackextension feature"zuul
2016-06-09Merge "res_pjsip_registrar.c: Eliminate rx REGISTER request race condition."Joshua Colp
2016-06-09Merge "stasis: Add setting subscription congestion levels."Joshua Colp
2016-06-09Merge "sorcery: Add setting object type congestion levels."Joshua Colp
2016-06-09Merge "taskprocessors: Implement high/low water mark alerts."Joshua Colp
2016-06-09Merge "res_pjsip_session: Use distributor serializer for incoming calls."Joshua Colp
2016-06-09Merge "res_pjsip_pubsub.c: Recreate subscriptions using distributor serializer."Joshua Colp
2016-06-09Merge "res_pjsip_pubsub.c: Use distributor serializer for incoming ↵Joshua Colp
subscriptions."
2016-06-09Merge "pjsip_distributor.c: Consistently pick a serializer for messages."Joshua Colp
2016-06-09Merge "pjsip_distributor.c: Ignore messages until fully booted."zuul
2016-06-09ARI: Ensure proper channel state on operations.Mark Michelson
ARI was recently outfitted with operations to create and dial channels. This leads to the ability to try funny stuff. You could create a channel and then immediately try to play back media on it. You could create a channel, dial it, and while it is ringing attempt to make it continue in the dialplan. This commit attempts to fix this by adding a channel state check to operations that should not be able to operate on outbound channels that have not yet answered. If a channel is in an invalid state, we will send a 412 response. ASTERISK-26047 #close Reported by Mark Michelson Change-Id: I2ca51bf9ef2b44a1dc5a73f2d2de35c62c37dfd8
2016-06-09test_http_media_cache: Fix failing test.Mark Michelson
The retrieve_cache_control_directives test has been failing occasionally in Jenkins. The apparent failure occurs when attempting to validate the expiration of the retrieved file. After reproducing, the problem was pretty clear. At the beginning of the test, the current time is retrieved. The seconds value of this timestamp is X. When the file is retrieved, res_http_media_cache calculates the expiration and in doing so retrieves the current time. In most cases, since the test executes quickly, it will also retrieve a timestamp with X seconds. However, if the test starts very near to when the timestamp seconds are set to increment, res_http_media_cache may retrieve a timestamp with X+1 seconds instead. The test attempted to account for this by allowing a tolerance of 1 second when validating the expiration. However, the problem was that the comparisons being used in the validation used > and < operations. This meant that values that fell within the tolerance (because they equaled the upper bound of the tolerance) would fail. The solution is to use >= and <= operators in the expiration validation. However, I estimated that while the one second tolerance should be fine on most machines, it would still be possible on a very slow machine to end up falling outside the one second tolerance. So I have also relaxed the tolerance of expiration validation to be three seconds instead. The final change here is to add a debug message when validating expiration so that we can see what values are being compared. ASTERISK-25959 #close Reported by Joshua Colp Change-Id: Ic1a0e10722c1c5d276d5a4d6a67136d6ec26c247
2016-06-09Merge "chan_pjsip: Lock channel when checking for RTP changes."zuul
2016-06-09cdr.c: Remove assert in base_process_dial_endGeorge Joseph
Scenario: Caller blonde transfer Bob calls Charlie who answers. Bob puts Charlie on hold and calls Alice. Before Alice answers, Bob transfers Charlie to Alice. Charlie's channel triggers an assert because he gets an "ANSWERED" event even though he never dialed anything. With recent changes to dial events, this is now a valid scenario so the assert needed to be removed. ASTERISK-26103 #close Change-Id: I2679b517b696e7952ab7fb29403df9140e7d1de2
2016-06-09chan_pjsip: Lock channel when checking for RTP changes.Mark Michelson
bridge_native_rtp can call into an RTP-capable channel driver in order for the driver to update information about who the channel is communicating with. For SIP channel drivers, this means deactivating RTCP and sending a reinvite so that the endpoints can communicate directly. bridge_native_rtp does the right thing and has the channel locked when calling into the channel driver. chan_pjsip can't alter session properties in this thread, though. chan_pjsip queues a task on the session serializer in order to update properties there. The problem is that this queued task was not locking the channel. This meant that the queued task could attempt to deactivate RTCP at the same time that the channel thread was attempting to process an incoming RTCP packet. This could lead to a crash. This patch fixes the issue by locking the channel in the queued task when altering RTP properties. ASTERISK-26092 #close Reported by Niklas Larsson Change-Id: I3464e226a3c41f6b915f97891e07fa1599e2a159
2016-06-09res_pjsip_registrar.c: Eliminate rx REGISTER request race condition.Richard Mudgett
This patch fixes a race condition processing received REGISTER requests and their retransmissions caused by REGISTER requests being processed by two threads. The "sip_transaction Unable to register REGISTER transaction (key exists)" message is a notable symptom of this issue. This issue was more likely to happen before the pjsip/distributor serializers were created. Instead of steps one and two below placing the REGISTER messages into the same pjsip/distributor they were placed in random pjsip/default serializers. 1) REGISTER requests come in and get placed on the pjsip/distributor serializer. 2) Before the first request is processed a retransmission comes in and is placed on the same pjsip/distributor serializer. 3) The first request goes up the pjsip stack and is then shunted off to the pjsip/aor/<aor> serializer. 4) Before the first request is completed processing in the pjsip/aor/<aor> serializer, the second request goes up the pjsip stack and is also shunted off to the pjsip/aor/<aor> serializer. 5) The first request completes processing and sends out its response. 6) The second request completes processing and tries to send out its response but pjlib complains that the REGISTER transaction key already exists. 7) Sadness ensues. * The race is eliminated by removing the pjsip/aor/<aor> serializer and continuing the processing in the pjsip/distributor serializer. Now any retransmissions queued in the pjsip/distributor serializer will be processed after the first message is completely processed. ASTERISK-26088 #close Reported by: Richard Mudgett Change-Id: I842d714346088bf717ea27437f1dd85bff0bab5a
2016-06-09stasis: Add setting subscription congestion levels.Richard Mudgett
Stasis subscriptions and message routers create taskprocessors to process the event messages. API calls are needed to be able to set the congestion levels of these taskprocessors for selected subscriptions and message routers. * Updated CDR, CEL, and manager's stasis subscription congestion levels based upon stress testing. Increased the congestion levels to reduce the potential for bursty call setup/teardown activity from triggering the taskprocessor overload alert. CDRs in particular need an extra high congestion level because they can take awhile to process the stasis messages. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: Id0a716394b4eee746dd158acc63d703902450244
2016-06-09sorcery: Add setting object type congestion levels.Richard Mudgett
Sorcery creates taskprocessors for object types to process object observer callbacks. An API call is needed to be able to set the congestion levels of these taskprocessors for selected object types. * Updated PJSIP's contact and contact_status sorcery object type observer default congestion levels based upon stress testing. Increased the congestion levels to reduce the potential for bursty register/unregister and subscribe/unsubscribe activity from triggering the taskprocessor overload alert. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I4542e83b556f0714009bfeff89505c801f1218c6
2016-06-09taskprocessors: Implement high/low water mark alerts.Richard Mudgett
When taskprocessors get backed up, there is a good chance that we are being overloaded and need to defer adding new work to the system. * Implemented a high/low water alert mechanism for modules to check if the system is being overloaded and take appropriate action. When a taskprocessor is created it has default congestion levels set. A taskprocessor can later have those congestion levels altered for specific needs if stress testing shows that the taskprocessor is a symptom of overloading or needs to handle bursty activity without triggering an overload alert. * Add CLI "core show taskprocessor" low/high water columns. * Fixed __allocate_taskprocessor() to not use RAII_VAR(). RAII_VAR() was never a good thing to use when creating a taskprocessor because of the nature of how its references needed to be cleaned up on a partial creation. * Made res_pjsip's distributor check if the taskprocessor overload alert is active before placing a message representing brand new work onto a distributor serializer. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I182f1be603529cd665958661c4c05ff9901825fa
2016-06-09res_pjsip_session: Use distributor serializer for incoming calls.Richard Mudgett
We must continue using the serializer that the original INVITE came in on for the dialog. There may be retransmissions already enqueued in the original serializer that can result in reentrancy and message sequencing problems. Outgoing call legs create the pjsip/outsess/<endpoint> serializers for their dialogs. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I24d7948749c582b8045d5389ba3f6588508adbbc
2016-06-09res_pjsip_pubsub.c: Recreate subscriptions using distributor serializer.Richard Mudgett
* Resolves potential reentrancy problems if system restarted in the middle of subscription message transactions. * Fixes memory leak recreating persistent subscriptions when the subscription resource tree could not be created. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I71e34d7ae8ed35a694f1030e820e2548c48697be
2016-06-09res_pjsip_pubsub.c: Use distributor serializer for incoming subscriptions.Richard Mudgett
We must continue using the serializer that the original SUBSCRIBE came in on for the dialog. There may be retransmissions already enqueued in the original serializer that can result in reentrancy and message sequencing problems. The "sip_transaction Unable to register SUBSCRIBE transaction (key exists)" message is a notable symptom of this issue. Outgoing subscriptions still create the pjsip/pubsub/<endpoint> serializers for their dialogs. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I18b00bb74a56747b2c8c29543a82440b110bf0b0
2016-06-09pjsip_distributor.c: Consistently pick a serializer for messages.Richard Mudgett
Incoming messages that are not part of a dialog or a recognized response to one of our requests need to be sent to a consistent serializer. Under load we may be queueing retransmissions before we can process the original message. We don't need to throw these messages onto random serializers and cause reentrancy and message sequencing problems. * Created a pool of pjsip/distributor serializers that get picked by hashing the call-id and remote tag strings of the received messages. * Made ast_sip_destroy_distributor() destroy items in the reverse order of creation. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I2ce769389fc060d9f379977f559026fbcb632407
2016-06-09pjsip_distributor.c: Ignore messages until fully booted.Richard Mudgett
We should not be processing any incoming messages until we are fully booted. We may not have dialplan or other needed configuration loaded yet. ASTERISK-26089 #close Reported by: Scott Griepentrog ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I584aefb4f34b885a8927e1f13a2c64babd606264
2016-06-09build: Fix ast_sockaddr initialization to be more portableGeorge Joseph
A change to glibc 2.22 changed the order of the sockadddr_storage members which caused the places where we do an initialization of ast_sockaddr with '{ { 0, 0, } }' to fail compilation. Those initializers (which we shouldn't have been using anyway) have been replaced with memsets. Change-Id: Idd1b3b320903d8771bfe221f0b015685de628fa4
2016-06-09Merge "translate: Enables native Packet-Loss Concealment (PLC) for ↵Joshua Colp
supporting codecs."
2016-06-09Merge "chan_sip: No rtpmap for static RTP payload IDs in SDP."Joshua Colp
2016-06-09Merge "BuildSystem: Avoid 'ar cru' and use 'ar cr' instead."Joshua Colp
2016-06-09Merge "Detect and use proper libraries for musl toolchains"Joshua Colp
2016-06-09Merge "Fixes to include signal.h"Joshua Colp
2016-06-09Merge "Make use of GLOB_BRACE and GLOB_NOMAGIC optional"Joshua Colp
2016-06-08Merge "res_hep_{pjsip|rtcp}: Decline module loads if res_hep had not loaded"Joshua Colp
2016-06-08Merge "Fix res_search usage"Joshua Colp
2016-06-08Merge "Fix #include poll.h and sys/cdefs.h"Joshua Colp
2016-06-08Detect and use proper libraries for musl toolchainsTimo Teräs
Change-Id: I8d9b212f70813404b82918a3f99439e500d4bfcb
2016-06-08Fixes to include signal.hTimo Teräs
POSIX defines signal.h. sys/signal.h should not be used as it is c-library internal header which may or may not exist. Notably with musl it generates warning of being incorrect. Change-Id: Ia56b0aa1d84b5c590114867b1b384a624f39a6fc
2016-06-08res_hep_{pjsip|rtcp}: Decline module loads if res_hep had not loadedMatt Jordan
A crash can occur in res_hep_pjsip or res_hep_rtcp if res_hep has not loaded and does not have a configuration file. Previously when this occurred, checks were put in to see if the configuration was loaded successfully. While this is a good idea - and has been added to the offending function in res_hep - the reality is res_hep_pjsip and res_hep_rtcp have no business running if res_hep isn't also running. As such, this patch also adds a function to res_hep that returns whether or not it successfully loaded. Oddly enough, ast_module_check returns "everything is peachy" even if a module declined its load - so it cannot be solely relied on. res_hep_pjsip and res_hep_rtcp now also check this function to see if they should continue to load; if it fails, they decline their load as well. ASTERISK-26096 #close Change-Id: I007e535fcc2e51c2ca48534f48c5fc2ac38935ea
2016-06-08Merge "chan_rtp.c: Simplify options to UnicastRTP channel creation."Joshua Colp
2016-06-08Merge "apps/app_voicemail.c and main/say.c: Add support for Icelandic language"Joshua Colp
2016-06-08Merge "ari/resource_channels: Add 'formats' to channel create/originate"Joshua Colp
2016-06-08chan_sip: No rtpmap for static RTP payload IDs in SDP.Alexander Traud
This saves around 100 bytes when G.711, G.722, G.729, and GSM are advertised in SDP. This reduces the chance to hit the MTU bearer of 1300 bytes for SIP over UDP, if many codecs are allowed in Asterisk. This new feature is enabled together with the optional feature compactheaders=yes via the file sip.conf. ASTERISK-25578 #close Change-Id: I16491b1937862de26f84fa0ffe679a6bab925044
2016-06-07Merge "res_odbc: Implement a connection pool."Joshua Colp
2016-06-07res_odbc: Implement a connection pool.Joshua Colp
Testing has shown that our usage of UnixODBC is problematic due to bugs within UnixODBC itself as well as the heavy weight cost of connecting and disconnecting database connections, even when pooling is enabled. For users of UnixODBC 2.3.1 and earlier crashes would occur due to insufficient protection of the disconnect operation. This was fixed in UnixODBC 2.3.2 and above. For users of UnixODBC 2.3.3 and higher a slow-down would occur under heavy database use due to repeated connection establishment. A regression is present where on each connection the database configuration is cached again, with the cache growing out of control. The connection pool implementation present in this change helps to mitigate these issues by reducing how much we connect and disconnect database connections. We also solve the issue of crashes under UnixODBC 2.3.1 by defaulting the maximum number of connections to 1, returning us to the previous working behavior. For users who may have a fixed version the maximum concurrent connection limit can be increased helping with performance. The connection pool works by keeping a list of active connections. If the connection limit has not been reached a new connection is established. If the connection limit has been reached then the request waits until a connection becomes available before continuing. ASTERISK-26074 #close ASTERISK-26054 #close Change-Id: I6774bf4bac49a0b30242c76a09c403d2e856ecff
2016-06-07apps/app_voicemail.c and main/say.c: Add support for Icelandic languageÖrn Arnarson
Icelandic has some weird grammar rules when dealing with dates and numbers. There are different genders used depending on which number you're dealing with, and only a handful of numbers do change depending on the gender. There is also an implied gender in several cases. This patch was originally written for asterisk 1.6, and has been in use for several years without crashes. I cleaned it up a bit and rewrote what was necessary for Asterisk 13. The functions were copied from other similar languages and modified where appropriate. If i recall correctly, the German and Danish functions were used as a base. ASTERISK-26087 Reported by: Örn Arnarson Tested by: Örn Arnarson Change-Id: Ib7d8bd7b0fede5767921ed821315b5b508c0e665
2016-06-07res_srtp: Instead of libSRTP use OpenSSL as random source.Alexander Traud
Since libSRTP 1.5, its Random Number Generator (RNG) is not maintained anymore. Therefore, the symbol RAND_bytes is used instead of crypto_get_random. ASTERISK-24436 #close Change-Id: Iea0bae4d4e3c9aa0926ea442b6484b5159789d96
2016-06-07BuildSystem: Avoid 'ar cru' and use 'ar cr' instead.Alexander Traud
In several internal library projects, the files are archived with the help of 'ar cr'. Only the projects editline and the Objective Open H.323 stack implementation in C (ooh323c) use 'ar cru' instead. Recently, some platforms changed the default parameters of AR which creates "/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U')". For consistency and to avoid this message all projects use 'ar cr' now. ASTERISK-26091 #close Change-Id: I710a9b1c01c1b5a1931a646098c044c8161ead40
2016-06-06chan_rtp.c: Simplify options to UnicastRTP channel creation.Richard Mudgett
Change the awkward and not as flexible UnicastRTP options format From: Dial(UnicastRTP/127.0.0.1[/[<engine>][/[<codec>]]]) To: Dial(UnicastRTP/127.0.0.1[/[<options>]]) Where <options> can be standard Asterisk flag options: c(<codec>) - Specify which codec/format to use such as 'ulaw'. e(<engine>) - Specify which RTP engine to use such as 'asterisk'. More option flags can be easily added later such as the codec's RTP payload type to use when the codec does not have a static payload type defined. Change-Id: I0c297aaf09e2ee515536cb7437bb8042ff8ff3c9
2016-06-05translate: Enables native Packet-Loss Concealment (PLC) for supporting codecs.Jaco Kroon
ASTERISK-25629 #close Change-Id: Ibfcf0670e094e9718d82fd9920f1fb2dae122006