summaryrefslogtreecommitdiff
path: root/main
AgeCommit message (Collapse)Author
2017-02-14Merge "stream: Add stream topology unit tests and fix uncovered bugs."zuul
2017-02-14Merge "libasteriskssl: do nothing with OpenSSL >= 1.1"Joshua Colp
2017-02-14Merge "tcptls: use TLS_client_method with OpenSSL 1.1"zuul
2017-02-14Merge "openssl 1.1 support: use OPENSSL_VERSION_NUMBER"zuul
2017-02-14Merge "core: Cleanup some channel snapshot staging anomalies."Joshua Colp
2017-02-13Merge "stream: Add media stream topology definition and API"zuul
2017-02-13stream: Add stream topology unit tests and fix uncovered bugs.Joshua Colp
This change adds unit tests for the various API calls relating to stream topologies. This includes creation, destruction, inspection, and manipulation. Through this a few bugs were uncovered in the implementation: 1. Creating a topology using a format capabilities would fail as the code considered a return value of 0 from the append stream function to indicate an error which is incorrect. 2. Not all functions which placed a stream into a topology set the position on the stream itself. 3. Appending a stream would cause a frack if the position provided was the last one. This occurred because the existing stream was queried but the index was outside of what the vector was currently at for size. ASTERISK-26786 Change-Id: Id5590e87c8a605deea1a89e53169a9c011d66fa0
2017-02-13stream: Add media stream topology definition and APIGeorge Joseph
This change adds the media stream topology definition and API for accessing and using it. Some refactoring of the stream was also done. ASTERISK-26786 Change-Id: Ic930232d24d5ad66dcabc14e9b359e0ff8e7f568
2017-02-13Merge "manager: Restore Originate failure behavior from Asterisk 11"zuul
2017-02-10manager: Restore Originate failure behavior from Asterisk 11Sean Bright
In Asterisk 11, if the 'Originate' AMI command failed to connect the provided Channel while in extension mode, a 'failed' extension would be looked up and run. This was, I believe, unintentionally removed in 51b6c49. This patch restores that behavior. This also adds an enum for the various 'synchronous' modes in an attempt to make them meaningful. ASTERISK-26115 #close Reported by: Nasir Iqbal Change-Id: I8afbd06725e99610e02adb529137d4800c05345d
2017-02-10core: Cleanup some channel snapshot staging anomalies.Richard Mudgett
We shouldn't unlock the channel after starting a snapshot staging because another thread may interfere and do its own snapshot staging. * app_dial.c:dial_exec_full() made hold the channel lock while setting up the outgoing channel staging. Made hold the channel lock after the called party answers while updating the caller channel staging. * chan_sip.c:sip_new() completed the channel staging on off-nominal exit. Also we need to use ast_hangup() instead of ast_channel_unref() at that location. * channel.c:__ast_channel_alloc_ap() added a comment about not needing to complete the channel snapshot staging on off-nominal exit paths. * rtp_engine.c:ast_rtp_instance_set_stats_vars() made hold the channel locks while staging the channels for the stats channel variables. Change-Id: Iefb6336893163f6447bad65568722ad5d5d8212a
2017-02-10stream: Add media stream definition and API with unit tests.Joshua Colp
This change adds the media stream definition and API for accessing and using it. Unit tests have also been written which exercise aspects of the API. ASTERISK-26773 Change-Id: I3dbe54065b55aaa51f467e1a3bafd67fb48cac87
2017-02-07srv: Fix crash when ast_srv_lookup is used and 0 records are returned.Joshua Colp
When performing an SRV lookup using the ast_srv_lookup function it did not properly handle the situation where 0 records are returned. If this happened it would wrongly assume that at least one record was present. This change fixes the code so it will exit early if an error occurs or if 0 records are returned. ASTERISK-26772 patches: srv_lookup.patch submitted by nappsoft (license 6822) Change-Id: I09b19081c74e0ad11c12bf54a257243b1bcb2351
2017-02-03res_ari: fix memory leak for channelvarsSebastien Duthil
In ari.conf, when setting the option channelvars, every Stasis channel snapshot would create a list of variable/value that would not be freed when the snapshot is freed, resulting in a often-recurring memory leak. ASTERISK-26767 #close Change-Id: Ia37dd9d68063d7f879193df02ede293e5ded716d
2017-02-03libasteriskssl: do nothing with OpenSSL >= 1.1Tzafrir Cohen
OpenSSL 1.1 requires no explicit initialization. The hacks in the library are not needed. They also happen to fail running Asterisk. Change-Id: I3b3efd5d80234a4c45a8ee58dcfe25b15d9ad100
2017-02-03tcptls: use TLS_client_method with OpenSSL 1.1Tzafrir Cohen
OpenSSL 1.1 introduced TLS_client_method() and deprecated the previous version-specific methods (such as TLSv1_client_method(). Other than being simpler to use and more correct (gain support for TLS newer that TLS1, in our case), the older ones produce a deprecation warning that fails the build in dev-mode. Change-Id: I257b1c8afd09dcb0d96cda3a41cb9f7a15d0ba07
2017-02-03openssl 1.1 support: use OPENSSL_VERSION_NUMBERTzafrir Cohen
Use OPENSSL_VERSION_NUMBER instead of OPENSSL_API_COMPAT to detect the openssl 1.1 API. Change-Id: I4e448f55ef516aedf6ad154037c35577a421a458
2017-02-02channel.c: Fix unbalanced read queue deadlocking local channels.Richard Mudgett
Using the timerfd timing module can cause channel freezing, lingering, or deadlock issues. The problem is because this is the only timing module that uses an associated alert-pipe. When the alert-pipe becomes unbalanced with respect to the number of frames in the read queue bad things can happen. If the alert-pipe has fewer alerts queued than the read queue then nothing might wake up the thread to handle received frames from the channel driver. For local channels this is the only way to wake up the thread to handle received frames. Being unbalanced in the other direction is less of an issue as it will cause unnecessary reads into the channel driver. ASTERISK-26716 is an example of this deadlock which was indirectly fixed by the change that found the need for this patch. * In channel.c:__ast_queue_frame(): Adding frame lists to the read queue did not add the same number of alerts to the alert-pipe. Correspondingly, when there is an exceptionally long queue event, any removed frames did not also remove the corresponding number of alerts from the alert-pipe. ASTERISK-26632 #close Change-Id: Ia98137c5bf6e9d6d202ce0eb36441851875863f6
2017-02-02Frame deferral: Revert API refactoring.Richard Mudgett
There are several issues with deferring frames that are caused by the refactoring. 1) The code deferring frames mishandles adding a deferred frame to the deferred queue. As a result the deferred queue can only be one frame long. 2) Deferrable frames can come directly from the channel driver as well as the read queue. These frames need to be added to the deferred queue. 3) Whoever is deferring frames is really only doing the __ast_read() to collect deferred frames and doesn't care about the returned frames except to detect a hangup event. When frame deferral is completed we must make the normal frame processing see the hangup as a frame anyway. As such, there is no need to have varying hangup frame deferral methods. We also need to be aware of the AST_SOFTHANGUP_ASYNCGOTO hangup that isn't real. That fake hangup is to cause the PBX thread to break out of loops to go execute a new dialplan location. 4) To properly deal with deferrable frames from the channel driver as pointed out by (2) above, means that it is possible to process a dialplan interception routine while frames are deferred because of the AST_CONTROL_READ_ACTION control frame. Deferring frames is not implemented as a re-entrant operation so you could have the unsupported case of two sections of code thinking they have control of the media stream. A worse problem is because of the bad implementation of the AMI PlayDTMF action. It can cause two threads to be deferring frames on the same channel at the same time. (ASTERISK_25940) * Rather than fix all these problems simply revert the API refactoring as there is going to be only autoservice and safe_sleep deferring frames anyway. ASTERISK-26343 ASTERISK-26716 #close Change-Id: I45069c779aa3a35b6c863f65245a6df2c7865496
2017-02-02res_agi: Prevent an AGI from eating frames it should not. (Re-do)Richard Mudgett
A dialplan intercept routine is equivalent to an interrupt routine. As such, the routine must be done quickly and you do not have access to the media stream. These restrictions are necessary because the media stream is the responsibility of some other code and interfering with or delaying that processing is bad. A possible future dialplan processing architecture change may allow the interception routine to run in a different thread from the main thread handling the media and remove the execution time restriction. * Made res_agi.c:run_agi() running an AGI in an interception routine run in DeadAGI mode. No touchy channel frames. ASTERISK-25951 ASTERISK-26343 ASTERISK-26716 Change-Id: I638f147ca7a7f2590d7194a8ef4090eb191e4e43
2017-02-01audiohooks: Muting a hook can mute underlying framesSean Bright
If an audiohook is placed on a channel that does not require transcoding, muting that hook will cause the underlying frames to be muted as well. The original patch is from David Woolley but I have modified slightly. ASTERISK-21094 #close Reported by: David Woolley Patches: ASTERISK-21094-Patch-1.8-1.txt (license #5737) patch uploaded by David Woolley Change-Id: Ib2b68c6283e227cbeb5fa478b2d0f625dae338ed
2017-01-29Merge "debug_utilities: Add ast_logescalator"zuul
2017-01-27debug_utilities: Add ast_logescalatorGeorge Joseph
The escalator works by creating a set of startup commands in cli.conf that set up logger channels and issue the debug commands for the subsystems specified. If asterisk is running when it is executed, the same commands will be issued to the running instance. The original cli.conf is saved before any changes are made and can be restored by executing '$prog --reset'. The log output will be stored in... $astlogdir/message.$uniqueid $astlogdir/debug.$uniqueid $astlogdir/dtmf.$uniqueid $astlogdir/fax.$uniqueid $astlogdir/security.$uniqueid $astlogdir/pjsip_history.$uniqueid $astlogdir/sip_history.$uniqueid Some minor tweaks were made to chan_sip, and res_pjsip_history so their history output could be send to a log channel as packets are captured. A minor tweak was also made to manager so events are output to verbose when "manager set debug on" is issued. Change-Id: I799f8e5013b86dc5282961b27383d134bf09e543
2017-01-27libastssl/pj: libastssl/pj should have an so_versionTorrey Searle
Issue introduced in b59956a87. In the non-darwin case libastssl/pj should be versioned. This causes the symbol file for this lib to not be generated. Change-Id: Ib07ae8c40252813c488e2c1ac6204fd42816dd4c (cherry picked from commit 54b027916a71f2b83b2050cef5ef704ea5de39b2)
2017-01-27Merge "media: Add experimental support for RTCP feedback."George Joseph
2017-01-26Merge "PJPROJECT logging: Fix detection of max supported log level."zuul
2017-01-26Merge "ari: Implement 'debug all' and request/response logging"George Joseph
2017-01-26Merge "frame.c: Fix off-nominal format ref leaks."George Joseph
2017-01-26Merge "T.140: Fix format ref and memory leaks."George Joseph
2017-01-26Merge "main/app.c: Memory corruption from early format destruction."Joshua Colp
2017-01-25T.140: Fix format ref and memory leaks.Richard Mudgett
* channel.c:ast_sendtext(): Fix T.140 SendText memory leak. * format_compatibility.c: T.140 RED and T.140 were swapped. * res_rtp_asterisk.c:rtp_red_init(): Fix ast_format_t140_red ref leak. * res_rtp_asterisk.c:rtp_red_init(): Fix data race after starting periodic scheduled red_write(). * res_rtp_asterisk.c: Some other minor misc tweaks. Change-Id: Ifa27a2e0f8a966b1cf628607c86fc4374b0b88cb
2017-01-24astobj2.c: Add excessive ref count trap.Richard Mudgett
Change-Id: I32e6a589cf9009450e4ff7cb85c07c9d9ef7fe4a
2017-01-24main/app.c: Memory corruption from early format destruction.Richard Mudgett
* make_silence() created a malloced silence slin frame without adding a slin format ref. When the frame is destroyed it will unref the slin format that never had a ref added. Memory corruption is expected to follow. * Simplified and fixed counting the number of samples in a frame list for make_silence(). * Eliminated an unnecessary RAII_VAR associated with the make_silence() frame. Change-Id: I47de3f9b92635b7f8b4d72309444d6c0aee6f747
2017-01-24frame.c: Fix off-nominal format ref leaks.Richard Mudgett
* ast_frisolate() could leak frame format refs on allocation failures. * Similified code in ast_frisolate() and code used by ast_frisolate(). Change-Id: I79566d4d36b3d7801bf0c8294fcd3e9a86a2ed6d
2017-01-24PJPROJECT logging: Fix detection of max supported log level.Richard Mudgett
The mechanism used for detecting the maximum log level compiled into the linked pjproject did not work. The API call simply stores the requested level into an integer and does no range checking. Asterisk was assuming that there was range checking and limited the new value to the allowable range. To get the actual maximum log level compiled into the linked pjproject we need to get and save off the initial set log level from pjproject. This is the maximum log level supported. * Get and save off the initial log level setting before altering it to the desired level on startup. This has to be done by a macro rather than calling a core function to avoid incorrectly linking pjproject. * Split the initial log level warning messages to warn if the linked pjproject cannot support the requested startup level and if it is too low to get the pjproject buildopts for "pjproject show buildopts". * Adjust the CLI "pjproject set log level" to check the saved max log level and to generate normal output messages instead of a warning message. ASTERISK-26743 #close Change-Id: I40aa76653e2a1dece66c3f8734594b4f0471cfb4
2017-01-23ari: Implement 'debug all' and request/response loggingGeorge Joseph
The 'ari set debug' command has been enhanced to accept 'all' as an application name. This allows dumping of all apps even if an app hasn't registered yet. To accomplish this, a new global_debug global variable was added to res/stasis/app.c and new APIs were added to set and query the value. 'ari set debug' now displays requests and responses as well as events. This required refactoring the existing debug code. * The implementation for 'ari set debug' was moved from stasis/cli.{c,h} to ari/cli.{c,h}, and stasis/cli.{c,h} were deleted. * In order to print the body of incoming requests even if a request failed, the consumption of the body was moved from the ari stubs to ast_ari_callback in res_ari.c and the moustache templates were then regenerated. The body is now passed to ast_ari_invoke and then on to the handlers. This results in code savings since that template was inserted multiple times into all the stubs. An additional change was made to the ao2_str_container implementation to add partial key searching and a sort function. The existing cli code assumed it was already there when it wasn't so the tab completion was never working. Change-Id: Ief936f747ce47f1fb14035fbe61152cf766406bf (cherry picked from commit 1d890874f39a5a81b20da44358143ed9b54ab0fe)
2017-01-23media: Add experimental support for RTCP feedback.Lorenzo Miniero
This change adds experimental support for providing RTCP feedback information to codec modules so they can dynamically change themselves based on conditions. ASTERISK-26584 Change-Id: Ifd6aa77fb4a7ff546c6025900fc2baf332c31857
2017-01-17abstract/fixed/adpative jitter buffer: disallow frame re-insertsKevin Harwell
It was possible for a frame to be re-inserted into a jitter buffer after it had been removed from it. A case when this happened was if a frame was read out of the jitterbuffer, passed to the translation core, and then multiple frames were returned from said translation core. Upon multiple frames being returned the first is passed on, but sebsequently "chained" frames are put back into the read queue. Thus it was possible for a frame to go back into the jitter buffer where this would cause problems. This patch adds a flag to frames that are inserted into the channel's read queue after translation. The abstract jitter buffer code then checks for this flag and ignores any frames marked as such. Change-Id: I276c44edc9dcff61e606242f71274265c7779587
2017-01-13taskprocessor.c: Change when high water warning logged.Richard Mudgett
The task processor queue reached X scheduled tasks message was originally intended to get logged only once per task processor to prevent spamming the log. This is no longer necessary since high and low water thresholds can better control when the message is logged. It is beneficial to generate the warning each time a task processor reaches the high water level because PJSIP stops processing new requests while any high water alert is active. Without this change you would have to enable at least debug level 3 logging to know about a repeated alert trigger. * Made generate the warning message whenever a task is pushed into the task processor that triggers the high water alert. * Appended 'again' to the warning for a repeated high water alert trigger. Change-Id: Iabf75a004f7edaf1e5e8c323099418e667cac999
2017-01-05Merge "core/pbx: dialplan show - display filename/line#"zuul
2017-01-04core/pbx: dialplan show - display filename/line#Jonathan R. Rose
Adds the ability for extensions to be registered to include filename and line number so that dialplan show output can show the filename and line number of a config file responsible for generating a given extension. This only affects config modules that are written to use the new extension registering functions. In this patch, that only includes pbx_config, so extensions registered in extensions.conf and any included extension will be shown in this manner. Extensions registered in this manner will show the filename and line number *instead* of the registrar. ASTERISK-26658 #close Reported by: Jonathan R. Rose Change-Id: Ieccc6abccdff34ed5c7da3511fd24972b8f2dd30
2016-12-22acl.c: Improve ast_ouraddrfor() diagnostic messages.Richard Mudgett
* Made not generate strings unless they will actually be used. ASTERISK-26672 Change-Id: I155fbe7fdff5ce47dfe5326f3baf5446849702c3
2016-12-14MESSAGE: Flush Message/ast_msg_queue channel alert pipe.Richard Mudgett
ASTERISK-25083 Change-Id: Id54baa57a8dbca84e29f28bcd2ffc0a5ac12d8b2
2016-12-07Merge "http: Send headers and body in one write."Joshua Colp
2016-12-07Merge "Iostreams: Correct off-by-one error."Joshua Colp
2016-12-07http: Send headers and body in one write.Mark Michelson
This is a semi-regression caused by the iostreams change. Prior to iostreams, HTTP headers were written to a FILE handle using fprintf. Then the body was written using a call to fwrite(). Because of internal buffering, the result was that the HTTP headers and body would be sent out in a single write to the socket. With the change to iostreams, the HTTP headers are written using ast_iostream_printf(), which under the hood calls write(). The HTTP body calls ast_iostream_write(), which also calls write() under the hood. This results in two separate writes to the socket. Most HTTP client libraries out there will handle this change just fine. However, a few of our testsuite tests started failing because of the change. As a result, in order to reduce frustration for users, this change alters the HTTP code to write the headers and body in a single write operation. ASTERISK-26629 #close Reported by Joshua Colp Change-Id: Idc2d2fb3d9b3db14b8631a1e302244fa18b0e518
2016-12-06Iostreams: Correct off-by-one error.Mark Michelson
ast_iostream_printf() attempts first to use a fixed-size buffer to perform its printf-like operation. If the fixed-size buffer is too small, then a heap allocation is used instead. The heap allocation in this case was exactly the length of the string to print. The issue here is that the ensuing call to vsnprintf() will print a NULL byte in the final space of the string. This meant that the final character was being chopped off the string and replaced with a NULL byte. For HTTP in particular, this caused problems because HTTP publishes the expected Contact-Length. This meant HTTP was publishing a length one character larger than what was actually present in the message. This patch corrects the issue by adding one to the allocation length. ASTERISK-26629 Reported by Joshua Colp Change-Id: Ib3c5f41e96833d0415cf000656ac368168add639
2016-12-06pjproject_bundled: Fix missing inclusion of symbolsGeorge Joseph
Added back in a -g3, and an -O3 when DONT_OPTIMIZE is not set, to the CFLAGS. Not sure how they went missing. Also fixed an uninstall problem where we weren't removing the symlink from libasteriskpj.so.2 to libasteriskpj.so. While I was there, I fixed it for libasteriskssl as well. Change-Id: I9e00873b1e9082d05b5549d974534b48a2142556
2016-12-06Merge "app_originate: Add option to execute gosub prior to dial"Joshua Colp
2016-12-02Merge "tcptls: Use new certificate upon sip reload"Joshua Colp