summaryrefslogtreecommitdiff
path: root/main
AgeCommit message (Collapse)Author
2016-07-06res/res_corosync: Raise a Stasis message on node join/leave eventsMatt Jordan
When res_corosync detects that a node leaves or joins, it currently is informed of this via Corosync callbacks. However, there are a few limitations with the information presented: (1) While we have information that Corosync is aware of - such as the Corosync nodeid - that information is really only useful inside of Corosync or res_corosync. There's no way to translate a Corosync nodeid to some other internally useful unique identifier for the Asterisk instance that just joined or left the cluster. (2) While res_corosync is notified of the instance joining or leaving the cluster, it has no mechanism to inform the Asterisk core or other modules of this event. This limits the usefulness of res_corosync as a heartbeat mechanism for other modules. This patch addresses both issues. First, it adds the notion of a cluster discovery message both within the Stasis message bus, as well as the binary event messages that res_corosync uses to transmit data back and forth within the cluster. When Asterisk joins the cluster, it sends a discovery message to the other nodes in the cluster, which correlates the Corosync nodeid along with the Asterisk EID. res_corosync now maintains a hash of Corosync nodeids to Asterisk EIDs, such that it can map changes in cluster state with the Asterisk instance that has that nodeid. Likewise, when an Asterisk instance receives a discovery message from a node in the cluster, it now sends its own discovery message back to the originating node with the local Asterisk EID. This lets Asterisk instances within the cluster build a complete picture of the other Asterisk instances within the cluster. Second, it publishes the discovery messages onto the Stasis message bus. Said messages are published whenever a node joins or leaves the cluster. Interested modules can subscribe for the ast_cluster_discovery_type() message under the ast_system_topic() and be notified when changes in cluster state occur. Change-Id: I9015f418d6ae7f47e4994e04e18948df4d49b465
2016-06-30features: Fix channel datastore access.Richard Mudgett
Found as a result of the testsuite tests/callparking test crashing. Several calls to ast_get_chan_featuremap_config() and ast_get_chan_features_xfer_config() did not lock the channel before calling so the channel's datastore list was accessed without the lock's protection. Apparently another thread deleted a datastore on the channel's list while the crashing thread was walking the list. Crash at 0xdeaddead due to MALLOC_DEBUG's memory filler value as a result. * Add missing channel locks to calls that were not already protected as the doxygen for those calls indicates. Change-Id: Id273b3d305cc616406c353cbc841b2b7655efaa1
2016-06-28codecs: Fix ABI incompatibility created by adding format_name to ast_codecGeorge Joseph
Adding format_name even to the end of ast_codec caused issued with binary codec modules because the pointer would be garbage in asterisk when they registered. So, the ast_codec structure was reverted and an internal_ast_codec structure was created just for use in codec.c. A new internal-only API was also added (__ast_codec_register_with_format) so that codec_builtin could register codecs with the format_name in a separate parameter rather than in the ast_codec structure. ASTERISK-26144 #close Reported-by: Alexei Gradinari Change-Id: I6df1b08f6a6ae089db23adfe1ebc8636330265ba
2016-06-28BuildSystem: Fix a few issues hightlighted by gcc 6.xGeorge Joseph
gcc 6.1.1 caught a few more issues. Made sure the unit tests still pass for the func_env and stdtime issues. ASTERISK-26157 #close Change-Id: I6664d8f34a45bc1481d2a854481c7878b0c1cf8e
2016-06-22Merge "Fix Alembic upgrades." into 13zuul
2016-06-22Fix Alembic upgrades.Mark Michelson
A non-existent constraint was being referenced in the upgrade script. This patch corrects the problem by removing the reference. This patch fixes another realtime problem as well. Our Alembic scripts store booleans as yes or no values. However, Sorcery tries to insert "true" or "false" instead. This patch updates Sorcery to use "yes" and "no" ASTERISK-26128 #close Change-Id: I366dbbf91418a9cb160b3ca74b0e59b5ac284bec
2016-06-21Merge "fix: memory leaks, resource leaks, out of bounds and bugs" into 13zuul
2016-06-20fix: memory leaks, resource leaks, out of bounds and bugsAlexei Gradinari
ASTERISK-26119 #close Change-Id: Iecbf7d0f360a021147344c4e83ab242fd1e7512c
2016-06-20http: leverage 'bindaddr' for TLS in http.confAlexander Traud
The internal HTTP/WebSocket server supports both TCP and TLS, which can be activated separately via the file http.conf. The source code intends to re-use the TCP parameter 'bindaddr' for TLS, even if 'tlsbindaddr' is not specified explicitly. This did not work because of a typo. This change resolves this typo. ASTERISK-26126 #close Change-Id: I5efb0409ae12044dfb3495b6b97b6d40a8c9c51f
2016-06-10core: Not the configured but granted number of possible file descriptors.Alexander Traud
With CLI "core show settings", simply the parameter maxfiles of the file asterisk.conf was shown. If that parameter was not set, nothing was displayed although the environment might have set a default number itself. Or if maxfiles were not granted (completely), still maxfiles was shown. Now, the maximum number of possible file descriptors in the environment is shown. ASTERISK-26097 Change-Id: I2df5c58863b5007b34b77adbe28b885dfcdf7e0b
2016-06-10Merge "cel: Ensure only one dial status per channel exists." into 13Joshua Colp
2016-06-09Merge "stasis: Add setting subscription congestion levels." into 13Joshua Colp
2016-06-09Merge "sorcery: Add setting object type congestion levels." into 13Joshua Colp
2016-06-09Merge "taskprocessors: Implement high/low water mark alerts." into 13zuul
2016-06-09cel: Ensure only one dial status per channel exists.Joshua Colp
CEL wrongly assumed that a channel would only have a single dial event on it. This is incorrect. Particularly in a queue each call attempt to a member will result in a dial event, adding a new dial status in CEL without removing the old one. This would cause the container to grow with only one dial status being removed when the channel went away. The other dial status entries would remain leaking memory. This change fixes the memory leak by ensuring that only one dial status will only ever exist for each channel. The behavior during the scenario where multiple events are received has also been improved. For failure cases the first failure will be the dial status. If an answer dial status is received, though, it will take priority and the dial status for the channel will be answer. Memory usage has also been decreased by storing the minimal amount of information and the code has been cleaned up slightly. ASTERISK-25262 #close Change-Id: I5944eb923db17b6a0faa7317ff6abc9307c009fe
2016-06-09Merge "astfd: Not maximum size of a single file but maximum file ↵zuul
descriptors." into 13
2016-06-08Merge "BuildSystem: Avoid 'ar cru' and use 'ar cr' instead." into 13zuul
2016-06-08Merge "Fix #include poll.h and sys/cdefs.h" into 13Joshua Colp
2016-06-08astfd: Not maximum size of a single file but maximum file descriptors.Alexander Traud
With menuselect "DEBUG_FD_LEAKS" and CLI "core show fd", the maximum size of a single file was shown. Now, the maximum number of possible file descriptors is shown. ASTERISK-26097 Change-Id: Icf98d145774b38cac144ca76d19eaef42ce659a3
2016-06-08Merge "ari/resource_channels: Add 'formats' to channel create/originate" ↵zuul
into 13
2016-06-07Fix #include poll.h and sys/cdefs.hTimo Teräs
POSIX defines poll.h, sys/poll.h should not be used at is c-library internal header which may or may not exist. Notable in musl it generates warning of being incorrect. And add explict include of sys/cdefs.h where needed. Change-Id: I142930df53fe7585a06b854b6faddc5301e024be
2016-06-07stasis: 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-07sorcery: 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-07taskprocessors: 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-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-06Merge "core/dial: New channel variable FORWARDERNAME" into 13zuul
2016-06-03ari/resource_channels: Add 'formats' to channel create/originateGeorge Joseph
If you create a local channel and don't specify an originator channel to take capabilities from, we automatically add all audio formats to the new channel's capabilities. When we try to make the channel compatible with another, the "best format" functions pick the best format available, which in this case will be slin192. While this is great for preserving quality, it's the worst for performance and overkill for the vast majority of applications. In the absense of any other information, adding all formats is the correct thing to do and it's not always possible to supply an originator so a new parameter 'formats' has been added to the channel create/originate functions. It's just a comma separated list of formats to make availalble for the channel. Example: "ulaw,slin,slin16". 'formats' and 'originator' are mutually exclusive. To facilitate determination of format names, the format name has been added to "core show codecs". ASTERISK-26070 #close Change-Id: I091b23ecd41c1b4128d85028209772ee139f604b
2016-06-01logging,cdr,cel: Fix stringfield memory leak.Richard Mudgett
The stringfields refactor to allow adding stringfields to the end of a structure (f6f4cf459f43f072604927209b39646f84aaa2e2) exposed some incomplete cleanup code by some stringfield users. The most noticeable leaker is the logging system where there is a leak for every log message generated. ASTERISK-26078 #close Reported by: Etienne Lessard Patches: jira_asterisk_26078_v13.patch (license #5621) patch uploaded by Richard Mudgett Change-Id: If6a08b31336b492c3de6f9dfd07c447f8d5a8782
2016-05-31core/dial: New channel variable FORWARDERNAMEAlexei Gradinari
Added a new channel variable FORWARDERNAME which indicates which channel was responsible for a forwarding requests received on dial attempt. Fixed a bug in the app_queue: FORWARD_CONTEXT is not used. ASTERISK-26059 #close Change-Id: I34e93e8c1b5e17776a77b319703c48c8ca48e7b2
2016-05-31Merge "res_pjsip: add "via_addr", "via_port", "call_id" to contact" into 13Joshua Colp
2016-05-25res_pjsip: add "via_addr", "via_port", "call_id" to contactAlexei Gradinari
As res_pjsip_nat rewrites contact's address, only the last Via header can contain the source address of registered endpoint. Also Call-Id header may contain the source address of registered endpoint. Added "via_addr", "via_port", "call_id" to contact. Added new fields ViaAddress, CallID to AMI event ContactStatus. ASTERISK-26011 Change-Id: I36bcc0bf422b3e0623680152d80486aeafe4c576
2016-05-24threadpool: Fix potential data race.Corey Farrell
worker_start checked for ZOMBIE status without holding a lock. All other read/write of worker status are performed with a lock, so this check should do the same. ASTERISK-25777 #close Change-Id: I5e33685a5c26fdb300851989a3b82be8c4e03781
2016-05-18udptl: Don't eat sequence numbers until OK is receivedGeorge Joseph
Scenario: Local fax -> Asterisk w/ firewall -> Provider -> Remote fax * Local fax starts rtp call to remote fax * Remote fax starts t38 call back to local fax. * Local fax sends t38 no-signal to Asterisk before sending an OK. * udptl processes the frame and increments the expected sequence number. * chan_sip drops the frame because the call isn't up so nothing goes out the external interface to open the port for incoming packets. * Local fax sends OK and Asterisk sends OK to the remote fax. * Remote fax sends t38 packets which are dropped by the firewall. * Local fax re-sends t38 no-signal with the same sequence number. * udptl drops the frame because it thinks it's a dup. * Still no outgoing packets to open the firewall. * t38 negotiation fails. The patch drops frames t38 received before udptl sequence processing when the call hasn't been answered yet. The second no-signal frame is then seen as new and is relayed out the external interface which opens the port and allows negotiation to continue. ASTERISK-26034 #close Change-Id: I11744b39748bd2ecbbe8ea84cdb4f3c5943c5af9
2016-05-14Merge "logger: Add PID to syslog messages." into 13zuul
2016-05-12Use doubles instead of floats for conversions when comparing strings.Mark Michelson
In 13.9.0, there was an issue where PJSIP contacts added to an AOR would be deleted at seemingly random times. One reason this was happening was because of an operation to retrieve the contacts whose expiration time was less than or equal to the current time. When retrieving existing contacts, the contact's expiration time and the current time were converted from a string to a float, and those two floats were compared. On some systems, including mine, this conversion was horribly off. For instance, I could regularly see the string "1463079214" get converted into 1463079168.000000. When switching from using a float to using a double, the conversion was as expected. Why was the conversion to float off? My best guess is that the conversion to float was attempting to store the entire value in the 23 bit significand of the IEEE-754 floating point number. In particular, if you take only the 23 most significant bits of 1463079214, you get the messed up 1463079168 that we were seeing in the conversion. It likely was possible to get a more precise value by composing the number using an exponent, but the conversion did not work that way. With a double, you have a 52 bit significand, allowing the entire value to fit there, and thereby allowing an accurate conversion. ASTERISK-26007 #close Reported by Greg Siemon Change-Id: I83ca7944aae8b7cd994b254c78ec02411d321070
2016-05-12logger: Add PID to syslog messages.Alexei Gradinari
During refactoring of this support the addition of the PID to messages was removed. This change adds it back in. ASTERISK-25538 #close Change-Id: Ie2d43b0652e59b7ac319a7dba94501540d70ba36
2016-05-09Merge "file: Ensure nativeformats remains valid for lifetime of use." into 13zuul
2016-05-09Merge "stasis_endpoints: Add new Status and Headers to ContactStatus" into 13zuul
2016-05-06config_options.c: Expand #ifdef to contain whole if statement.Chris Trobridge
ASTERISK-25956 #close Change-Id: If6961ec54be276d5ab4f012ee7e7b420cb45de38
2016-05-05stasis_endpoints: Add new Status and Headers to ContactStatusAlexei Gradinari
ASTERISK-25903 added a new headers to AMI Event ContactStatusDetail. ASTERISK-25904 added a new Status to AMI Event ContactStatusDetail. These additions should be also in stasis_endpoints to include in command "manager show event ContactStatus" Change-Id: I7610ad02a998e1f26c20caa27aa50279d0164f6a
2016-05-05file: Ensure nativeformats remains valid for lifetime of use.Joshua Colp
It is possible for the nativeformats of a channel to change throughout its lifetime. As a result a user of it needs to either ensure the channel is locked when accessing the formats or keep a reference to the nativeformats themselves. This change fixes the file playback support so it keeps a reference to the nativeformats when accessing things. ASTERISK-25998 #close Change-Id: Ie45b65475e1481ddf05b874ee48f63e39fff8915
2016-05-03pjproject_bundled: Various fixes discovered during testing of OSesGeorge Joseph
For all OSes: * Disabled third-party codecs in pjproject and added '--disable-speex-codec --disable-speex-aec --disable-gsm-codec' to the configure options since we don't use the pjsip codec capability. FreeBSD: * Added FreeBSD support to install_prereq. * Changed pjproject/configure.m4 to use $GNU_MAKE instead of hardcoding "make". * Added __progname and environ to asterisk.exports.in. * Reverted the use of ldconfig to create shared library symlinks to ln. * Only enable epoll in pjproject if `uname -s` is Linux. * Added a patch to pjproject to take the name of the 'make' command from an environment variable if supplied. This is needed for the python bindings. (merged by Teluu into pjproject trunk 5/3/2016) FreeBSD support isn't complete. Still some general issues regarding make/gmake having nothing to do with pjproject. With some handholding it DOES build successfully. CentOS: Added 'patch' and 'bzip2' to install_prereq PACKAGES_RH. CentOS 6/7 32/64 build and run the pjsip testsuite successfully. Ubuntu: No changes required. Ubuntu 15/16 32/64 build and run the pjsip testsuite successfully. Debian: No changes required. Debian 6/7/8 32/64 build and run the pjsip testsuite successfully. There will utimately be a follow-up patch to create an install_prereq for the testsuite as I've discovered a few missing requirements. ASTERISK-25968 #close Change-Id: I5756a07facfc63798115a5e73a8709382fe9259c
2016-04-27Merge "config: Fix ast_config_text_file_save2 writability check for missing ↵Joshua Colp
files" into 13
2016-04-26Merge changes from topic 'system_stress_patches' into 13Joshua Colp
* changes: test_message.c: Wait longer in case dialplan also processes the test message. Manager: Short circuit AMI message processing. manager.c: Eliminate most RAII_VAR usage. manager_channels.c: Fix allocation failure crash.
2016-04-26Merge changes from topic 'system_stress_patches' into 13Joshua Colp
* changes: Bridge system: Fix memory leaks and double frees on impart failure. bridge_softmix.c: Fix crash if channel fails to join mixing tech.
2016-04-25config: Fix ast_config_text_file_save2 writability check for missing filesGeorge Joseph
A patch I did back in 2014 modified ast_config_text_file_save2 to check the writability of the main file and include files before truncating and re-writing them. An unintended side-effect of this was that if a file doesn't exist, the check fails and the write is aborted. This patch causes ast_config_text_file_save2 to check the writability of the parent directory of missing files instead of checking the file itself. This allows missing files to be created again. A unit test was also added to test_config to test saving of config files. The regression was discovered when app_voicemail's passwordlocation=spooldir feature stopped working. ASTERISK-25917 #close Reported-by: Jonathan Rose Change-Id: Ic4dbe58c277a47b674679e49daed5fc6de349f80
2016-04-22Merge "bridge: Hold off more than one imparting channel at a time." into 13zuul
2016-04-22Manager: Short circuit AMI message processing.Richard Mudgett
Improve AMI message processing performance if there are no consumers listening for the messages. We now skip creating the AMI event message text strings. Change-Id: I7b22fc5ec4e500d00635c1a467aa8ea68a1bb2b3
2016-04-22manager.c: Eliminate most RAII_VAR usage.Richard Mudgett
* Made ast_manager_event_blob_create() not allocate the ao2 event object with a lock as it is not needed. Change-Id: I8e11bfedd22c21316012e0b9dd79f5918f644b7c
2016-04-22manager_channels.c: Fix allocation failure crash.Richard Mudgett
An earlier allocation failure failed to create a channel snapshot for the AMI HangupRequest/SoftHangupRequest event which resulted in a crash in channel_hangup_request_cb(). Where the stasis message gets generated cannot tell if the NULL snapshot returned was because of an allocation failure or the channel was a dummy channel. * Made channel_hangup_request_cb() check if the channel blob has a snapshot and exit if it doesn't. * Eliminated the RAII_VAR usage in channel_hangup_request_cb(). Change-Id: I0b6a1c4e95cbb7d80b2a7054c6eadecc169dfd24