summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-10-21Merge "funcs/func_holdintercept: Actually add the HOLD_INTERCEPT function"Joshua Colp
2015-10-21Merge "rest-api-templates: Wikify error code response reasons"Joshua Colp
2015-10-21Merge "main/cdr: Allow modules to modify CDR fields before dispatching them"Joshua Colp
2015-10-20rest-api-templates: Wikify error code response reasonsMatt Jordan
Error response code descriptions may contain wiki markup that need to be escaped. Without this patch, Confluence will reject the document being sent and the responsible script will raise an exception. Change-Id: I21fcb66fee7f6332381f2b99b1b0195dff215ee5
2015-10-20funcs/func_holdintercept: Actually add the HOLD_INTERCEPT functionMatt Jordan
When ab803ec342 was committed, it accidentally forgot to actually *add* the HOLD_INTERCEPT function. This highlights two interesting points: * Gerrit forces you to put the patch as it is going to into the repo up for review, which Review Board did not. Yay Gerrit. * No one apparently bothered to use this feature, or else they don't know about it. I'm going to go with the latter explanation. ASTERISK-24922 Change-Id: Ida38278f259dd07c334a36f9b7d5475b5db72396
2015-10-20main/cdr: Allow modules to modify CDR fields before dispatching themJonh Wendell
This patch adds the functions ast_cdr_modifier_register() ast_cdr_modifier_unregister() That work much like ast_cdr_register() and ast_cdr_unregister(). Modules registered will be given a chance to modify (or to do whatever they want) CDR fields just before they are passed to registered engines. Thus, for instance, if a module change the "userfield" field of a CDR, the modified value will be passed to every registered CDR backend for logging. ASTERISK-25479 #close Change-Id: If11d8fd19ef89b1a66ecacf1201e10fcf86ccd56
2015-10-20contrib/scripts/autosupport: Update for Asterisk 13Matt Jordan
This patch adds some minor tweaks for autosupport to update it for Asterisk 13. This includes: * Finally removing most references to Zaptel * Adding support for some additional 'core' commands, and fixing nomenclature that generally hasn't been used for some time * Adding some PJSIP/SIP commands to gather endpoints/peers and active channels Change-Id: Ic997b418cbd9313588b6608e50f47b0ce6f4f1f1 (cherry picked from commit 9fc9777fa34753fb38991d42d8dbed516e907ca2)
2015-10-16res_ari_events: Fix memory leak in mustache template.Corey Farrell
ASTERISK-25308 fixed a memory leak in res_ari_events.c, but this file is regenerated by a template and the template was not fixed. Change-Id: Ied4c6deae89d21f87f9cf99676b1d055aa83b38b
2015-10-16Merge topic 'ASTERISK-25461'Matt Jordan
* changes: config.c: Fix off-nominal memory leak. config.c: Fix potential memory corruption after [section](+). config.c: Fix #include after [section](+).
2015-10-15Merge "res_config_pgsql.c: Fix deadlock loading realtime configuration."Joshua Colp
2015-10-15Merge "Build: Add menuselect options for using compiler sanitizers"Joshua Colp
2015-10-14res_config_pgsql.c: Fix deadlock loading realtime configuration.Richard Mudgett
On v13, loading several thousand PJSIP endpoints on Asterisk start causes a deadlock most of the time. Thanks to mdu113 for discovering that there was a call to pgsql_exec() not protected by the pgsql_lock reentrancy lock. {quote} I believe a code path exists that attempts to use pgsql connection without locking pgsql_lock. I believe what happens during that deadlock that I see is two concurrent threads are both attempting to send query to pgsql, one of the thread is using a code path without locking pgsql_lock. If they managed to send queries at the same time, it seems postgres ignores one of the queries and replies only to the one of them. If it happens so that the thread holding the lock didn't receive the reply it will wait for it (and hold the lock) forever (or at least for very long time), thus completely blocking all access to db. {quote} * Added missing reentrancy locking around pgsql_exec() in find_table(). * Moved unlock of pgsql_lock in unload_module() to avoid locking inversion between the psql_tables list lock and the pgsql_lock. ASTERISK-25455 #close Reported by: mdu113 Patches: res_config_pgsql.c-connlock2.diff (license #5543) patch uploaded by mdu113 Change-Id: Id9e7cdf8a3b65ff19964b0cf942ace567938c4e2
2015-10-13channels/chan_sip: Set cause code to 44 on RTP timeoutMatt Jordan
To quote Olle: "When issuing a hangup due to RTP timeouts the cause code is not set. I have selected 44 based on Cisco's implementation..." ASTERISK-25135 #close Reported by: Olle Johansson patches: rtp-timeout-cause-1.8.diff uploaded by Olle Johansson (License 5267) Change-Id: Ia62100c55077d77901caee0bcae299f8dc7375fc
2015-10-13Merge "StatsD: Write skeleton Asterisk application"Matt Jordan
2015-10-12config.c: Fix off-nominal memory leak.Richard Mudgett
Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0
2015-10-12config.c: Fix potential memory corruption after [section](+).Richard Mudgett
The memory corruption could happen if the [section](+) is the last section in the file with trailing comments. In this case process_text_line() has left *last_cat is set to newcat and newcat is destroyed. Change-Id: I0d1d999f553986f591becd000e7cc6ddfb978d93
2015-10-12config.c: Fix #include after [section](+).Richard Mudgett
An #include right after a [section](+) would associate any variable assignments before a new section in the #include with the wrong section. * Fix section association by setting the current section to the appended section. * Fix '+' and '!' section flag interaction corner case depending upon which flag came first. If the '!' came first then it would be ignored. If the '!' came after then it would affect the appended section. The '!' will now no longer be ignored. ASTERISK-25461 #close Reported by: Sean Pimental Change-Id: Ic9d3191c8758048e2cbce6432f854b32531731c3
2015-10-10Build: Add menuselect options for using compiler sanitizersIvan Poddubny
This patch adds menuselect options for building Asterisk with various sanitizers provided by gcc and clang. When one of *SANITIZER flags is set in menuselect, the appropriate option is added to CFLAGS ad LDFLAGS for the build. Information on sanitizers in the project wiki: https://github.com/google/sanitizers/wiki GCC Manual: https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html Clang Compiler User's Manual: http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation ASTERISK-24718 #close Reported by: Badalian Vyacheslav Change-Id: Iafa51b792b7bcb20e848b99d16cf362d08590fa0
2015-10-09Merge "configure: Fix check for libunbound to require v1.5.0 as minimum."Joshua Colp
2015-10-08configure: Fix check for libunbound to require v1.5.0 as minimum.Richard Mudgett
Versions of libunbound before v1.4.21 do not compile with Asterisk. However, since v1.4.21 has a configure script bug that fails to detect the ldns library (which is fixed in v1.4.22) and v1.4.22 is not an easily detectable version we will require v1.5.0 as a minimum version of the library to work with Asterisk. ASTERISK-25108 #close Reported by: Richard Mudgett Change-Id: Ieb228bfb01467573fc121c7356a9dde27128894d
2015-10-08StatsD: Write skeleton Asterisk applicationtcambron
Wrote the skeleton framework for the Asterisk StatsD dialplan application. This includes a load function, unload function, a callback for execution, and XML documentation. ASTERISK-25419 Reported By: Ashley Sanders Change-Id: I9597730e134c6e82c8a55ef4d5334b62dd473363
2015-10-08Merge "chan_pjsip: Fix crash on reINVITE before initial INVITE completes."Joshua Colp
2015-10-07res_pjsip: Fix deadlock when sending out-of-dialog requests.Richard Mudgett
The struct send_request_wrapper has a pjsip lock associated with it that is created non-recursive. There is a code path for the struct send_request_wrapper lock that will attempt to lock it recursively. The reporter's deadlock showed that the thread calling endpt_send_request() deadlocked itself right after the wrapper object got created. Out-of-dialog requests such as MESSAGE, qualify OPTIONS, and unsolicited MWI NOTIFY messages can hit this deadlock. * Replaced the struct send_request_wrapper pjsip lock with the mutex lock that can come with an ao2 object since all of Asterisk's mutexes are recursive. Benefits include removal of code maintaining the pjsip non-recursive lock since ao2 objects already know how to maintain their own lock and the lock will show up in the CLI "core show locks" output. ASTERISK-25435 #close Reported by: Dmitriy Serov Change-Id: I458e131dd1b9816f9e963f796c54136e9e84322d
2015-10-07Merge "res/res_rtp_asterisk.c: Fix incorrect assignment of ↵Joshua Colp
frame->subclass.frame_ending"
2015-10-07res/res_rtp_asterisk.c: Fix incorrect assignment of frame->subclass.frame_endingStefanEng86
In ast_rtp_read, the value of the variable 'mark' which we try to assign to a frame->subclass.frame_ending may be 0, 1 or (1<<23), but we should translate it to 0 or 1. ASTERISK-25451 #close Change-Id: I53bdf5c026041730184a6a809009c028549ce626
2015-10-07func_presencestate: Return "not_set" when no data is set in AstDBIvan Poddubny
Return AST_PRESENCE_NOT_SET when CustomPresence AstDB key does not exist, i.e. when a new CustomPresence is added in the dialplan. ASTERISK-25400 #close Reported by: Andrew Nagy Change-Id: I6fb17b16591b5a55fbffe96f3994ec26b1b1723a
2015-10-06res/res_rtp_asterisk: Fix assignment after ao2 decrementMatt Jordan
When we decide we will no longer schedule an RTCP write, we remove the reference to the RTP instance, then assign -1 to the stored scheduler ID in case something else comes along and wants to see if anything is scheduled. That scheduler ID is on the RTP instance. After 60a9172d7ef2 was merged to fix the regression introduced by 3cf0f29310, this improper assignment on a potentially destroyed object started getting tripped on the build agents. Frankly, this should have been crashing a lot more often earlier. I can only assume that the timing was changed just enough by both changes to start actually hitting this problem. As it is, simply moving the assignment prior to the ao2 deference is sufficient to keep the RTP instance from being referenced when it is very, truly, aboslutely dead. (Note that it is still good practice to assign -1 to the scheduler ID when we know we won't be scheduling it again, as the ao2 deref *may* not always destroy the ao2 object.) ASTERISK-25449 Change-Id: Ie6d3cb4adc7b1a6c078b1c38c19fc84cf787cda7
2015-10-06chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers.Florian Sauerteig
If a Via header containes an IPv6 address and a port number is ommitted, as it is the standard port, we now leave the port empty and to not set it to the value after the first colon of the IPv6 address. ASTERISK-25443 #close Change-Id: Ie3c2f05471cd006bf04ed15598589c09577b1e70
2015-10-06chan_pjsip: Fix crash on reINVITE before initial INVITE completes.Richard Mudgett
Apparently some endpoints attempt to send a reINVITE before completing the initial INVITE transaction. In this case PJSIP responds appropriately to the reINVITE with a 491 INVITE request pending. Unfortunately chan_pjsip is using the initial INVITE transaction state to determine if an INVITE is the initial INVITE or a reINVITE. Since the initial INVITE transaction has not been confirmed yet chan_pjsip thinks the reINVITE is an initial INVITE and starts another PBX thread on the channel. The extra PBX thread ensures that hilarity ensues. * Fix checks for a reINVITE on incoming requests to look for the presence of a to-tag instead of the initial INVITE transaction state. * Made caller_id_incoming_request() determine what to do if there is a channel on the session or not. After a channel is created it is too late to just store the new party id on the session because the session's party id has already been copied to the channel's caller id. ASTERISK-25404 #close Reported by: Chet Stevens Change-Id: Ie78201c304a2b13226f3a4ce59908beecc2c68be
2015-10-06Merge "Fix improper usage of scheduler exposed by 5c713fdf18f"Matt Jordan
2015-10-06Fix improper usage of scheduler exposed by 5c713fdf18fMatt Jordan
When 5c713fdf18f was merged, it allowed for scheduled items to have an ID of '0' returned. While this was valid per the documentation for the API, it was apparently never returned previously. As a result, several users of the scheduler API viewed the result as being invalid, causing them to reschedule already scheduled items or otherwise fail in interesting ways. This patch corrects the users such that they view '0' as valid, and a returned ID of -1 as being invalid. Note that the failing HEP RTCP tests now pass with this patch. These tests failed due to a duplicate scheduling of the RTCP transmissions. ASTERISK-25449 #close Change-Id: I019a9aa8b6997584f66876331675981ac9e07e39
2015-10-05chan_pjsip: Add Referred-By header to the PJSIP REFER packet.Debian Amtelco
Some systems require the REFER packet to include a Referred-By header. If the channel variable SIPREFERREDBYHDR is set, it passes that value as the Referred-By header value. Otherwise, it adds the current dialog’s local info. Reported by: Dan Cropp Tested by: Dan Cropp Change-Id: I3d17912ce548667edf53cb549e88a25475eda245
2015-10-03manager: Fix GetConfigJSON returning invalid JSONIvan Poddubny
When GetConfigJSON was introduced back in 1.6, it returned each section as an array of strings: ["key=value", "key2=value2"]. Afterwards, it was changed a few times and became ["key": "value", "key2": "value2"], which is not a correct JSON. This patch fixes that by constructing a JSON object {} instead of an array []. Also, the keys "istemplate" and "tempates" that are used to indicate templates and their inherited categories are now wrapped in quotes. ASTERISK-25391 #close Reported by: Bojan Nemčić Change-Id: Ibbe93c6a227dff14d4a54b0d152341857bcf6ad8
2015-10-02Merge "res_sorcery_memory_cache.c: Fix deadlock with scheduler."Joshua Colp
2015-10-02Merge "res_sorcery_memory_cache.c: Replace inline code with function."Joshua Colp
2015-10-02Merge "res_sorcery_memory_cache.c: Shutdown in a less crash potential order."Joshua Colp
2015-10-02Merge "res_sorcery_memory_cache.c: Misc tweaks."Joshua Colp
2015-10-02Merge "res_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK."Joshua Colp
2015-10-02Merge "sched.c: Add warning about negative time interval request."Joshua Colp
2015-10-01res_sorcery_memory_cache.c: Fix deadlock with scheduler.Richard Mudgett
A deadlock can happen when a sorcery object is being expired from the memory cache when at the same time another object is being placed into the memory cache. There are a couple other variations on this theme that could cause the deadlock. Basically if an object is being expired from the sorcery memory cache at the same time as another thread tries to update the next object expiration timer the deadlock can happen. * Add a deadlock avoidance loop in expire_objects_from_cache() to check if someone is trying to remove the scheduler callback from the scheduler. ASTERISK-25441 #close Change-Id: Iec7b0bdb81a72b39477727b1535b2539ad0cf4dc
2015-10-01res_sorcery_memory_cache.c: Replace inline code with function.Richard Mudgett
Make sorcery_memory_cache_close() call remove_all_from_cache() instead of partially inlining it. ASTERISK-25441 Change-Id: I1aa6cb425b1a4307096f3f914d17af8ec179a74c
2015-10-01res_sorcery_memory_cache.c: Shutdown in a less crash potential order.Richard Mudgett
Basically you should shutdown in the opposite order of how you setup since later setup pieces likely depend on earlier setup pieces. e.g., Registering your external API with the rest of the system should be the last thing setup and the first thing unregistered during shutdown. Change-Id: I5715765b723100c8d3c2642e9e72cc7ad5ad115e
2015-10-01res_sorcery_memory_cache.c: Misc tweaks.Richard Mudgett
Change-Id: I8cd32dffbb4f33bb0c39518d6e4c991e73573160
2015-10-01res_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK.Richard Mudgett
Change-Id: Ibca6574dc3c213b29cc93486e01ccd51f5caa46c
2015-09-30res_rtp_asterisk: Move "Set role" warning to be debug.Joshua Colp
In practice the set_role API callback can be invoked even when no ICE is present on an RTP instance. This can occur if ICE has not been enabled on it. ASTERISK-25438 #close Change-Id: I0e17e4316f0f0d7f095c78c3d4fd73a913b6ba69
2015-09-30sched.c: Add warning about negative time interval request.Richard Mudgett
Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc
2015-09-29res/ari/config.c: Fix user sort compare function.Richard Mudgett
Made use the ao2 sort compare template function and OBJ_SEARCH_xxx identifiers. Change-Id: Ic53005dc5aafa7a36c72300dd89b75fb63c92f4c
2015-09-29res/ari/config.c: Optimize conf_alloc() object init.Richard Mudgett
* Now conf_alloc() has more off nominal error checking. * Eliminated RAII_VAR() use in conf_alloc(). * Eliminated a dubius shortcut when destroying cfg->general in conf_destructor() that would cause a crash if cfg->general failed to get allocated. * Add some ACO registration section comments. Change-Id: Ia40c2b1b2d0777d641605118ae019c5a73865e1a
2015-09-29res/ari/config.c: Fix conf_alloc() object init.Richard Mudgett
Need to finish initializing the string fields in the ao2 object before putting any default strings into them. ASTERISK-25383 #close Reported by: yaron nahum Change-Id: I9f7f3a03f0c4991a01593abf8697b9a587c0ea84
2015-09-29main/logger: Add log formatters and JSON structured logsMatt Jordan
When Asterisk is part of a larger distributed system, log files are often gathered using tools (such as logstash) that prefer to consume information and have it rendered using other tools (such as Kibana) that prefer a structured format, e.g., JSON. This patch adds support for JSON formatted logs by adding support for an optional log format specifier in Asterisk's logging subsystem. By adding a format specifier of '[json]': full => [json]debug,verbose,notice,warning,error Log messages will be output to the 'full' channel in the following format: { "hostname": Hostname or name specified in asterisk.conf "timestamp": Date/Time "identifiers": { "lwp": Thread ID, "callid": Call Identifier } "logmsg": { "location": { "filename": Name of the file that generated the log statement "function": Function that generated the log statement "line": Line number that called the logging function } "level": Log level, e.g., DEBUG, VERBOSE, etc. "message": Actual text of the log message } } ASTERISK-25425 #close Change-Id: I8649bfedf3fb7bf3138008cc11565553209cc238