aboutsummaryrefslogtreecommitdiffstats
path: root/main/autoservice.c
AgeCommit message (Collapse)AuthorFilesLines
2008-08-15Merged revisions 138028 via svnmerge from russell1-9/+5
https://origsvn.digium.com/svn/asterisk/trunk ................ r138028 | russell | 2008-08-15 10:09:46 -0500 (Fri, 15 Aug 2008) | 17 lines Merged revisions 138027 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r138027 | russell | 2008-08-15 10:07:16 -0500 (Fri, 15 Aug 2008) | 9 lines Ensure that when a hangup occurs in autoservice, that a hangup frame gets properly deferred to be read from the channel owner when it gets taken out of autoservice. (closes issue #12874) Reported by: dimas Patches: v1-12874.patch uploaded by dimas (license 88) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@138029 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-13Merged revisions 122714 via svnmerge from mmichelson1-0/+4
https://origsvn.digium.com/svn/asterisk/trunk ................ r122714 | mmichelson | 2008-06-13 16:45:21 -0500 (Fri, 13 Jun 2008) | 17 lines Merged revisions 122713 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r122713 | mmichelson | 2008-06-13 16:44:53 -0500 (Fri, 13 Jun 2008) | 9 lines Short circuit the loop in autoservice_run if there are no channels to poll. If we continued, then the result would be calling poll() with a NULL pollfd array. While this is fine with POSIX's poll(2) system call, those who use Asterisk's internal poll mechanism (Darwin systems) would have a failed assertion occur when poll is called. (related to issue #10342) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@122715 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-30Merged revisions 119355 via svnmerge from file1-14/+13
https://origsvn.digium.com/svn/asterisk/trunk ................ r119355 | file | 2008-05-30 16:47:30 -0300 (Fri, 30 May 2008) | 10 lines Merged revisions 119354 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r119354 | file | 2008-05-30 16:46:37 -0300 (Fri, 30 May 2008) | 2 lines Fix a bug I found while testing for another issue. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@119356 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-29Merged revisions 119157 via svnmerge from russell1-62/+85
https://origsvn.digium.com/svn/asterisk/trunk ................ r119157 | russell | 2008-05-29 17:28:50 -0500 (Thu, 29 May 2008) | 18 lines Merged revisions 119156 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r119156 | russell | 2008-05-29 17:24:29 -0500 (Thu, 29 May 2008) | 10 lines Fix a race condition in channel autoservice. There was still a small window of opportunity for a DTMF frame, or some other deferred frame type, to come in and get dropped. (closes issue #12656) (closes issue #12656) Reported by: dimas Patches: v3-12656.patch uploaded by dimas (license 88) -- with some modifications by me ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@119158 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-13Merged revisions 116001 via svnmerge from russell1-5/+9
https://origsvn.digium.com/svn/asterisk/trunk ................ r116001 | russell | 2008-05-13 16:07:59 -0500 (Tue, 13 May 2008) | 13 lines Merged revisions 115990 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r115990 | russell | 2008-05-13 16:05:57 -0500 (Tue, 13 May 2008) | 5 lines Fix an issue that I noticed in autoservice while mmichelson and I were debugging a different problem. I noticed that it was theoretically possible for two threads to attempt to start the autoservice thread at the same time. This change makes the process of starting the autoservice thread, thread-safe. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@116020 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-17Merged revisions 114233 via svnmerge from russell1-4/+0
https://origsvn.digium.com/svn/asterisk/trunk ................ r114233 | russell | 2008-04-17 17:24:00 -0500 (Thu, 17 Apr 2008) | 14 lines Merged revisions 114230 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r114230 | russell | 2008-04-17 17:15:43 -0500 (Thu, 17 Apr 2008) | 6 lines Remove redundant safety net. The check for the autoservice channel list state accomplishes the same goal in a better way. (issue #12470) Reported By: atis ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@114234 f38db490-d61c-443f-a65b-d21fe96a405b
2008-03-20Merged revisions 110396 via svnmerge from russell1-1/+1
https://origsvn.digium.com/svn/asterisk/trunk ................ r110396 | russell | 2008-03-20 18:14:13 -0500 (Thu, 20 Mar 2008) | 17 lines Merged revisions 110395 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r110395 | russell | 2008-03-20 18:13:56 -0500 (Thu, 20 Mar 2008) | 9 lines Shorten the ast_waitfor() timeout from 500 ms to 50 ms in the autoservice thread. This really should not make a difference except in very rare cases. That case would be that all of the channels in autoservice are not generating any frames. In that case, this change reduces the potential amount of time that a thread waits in ast_autoservice_stop() for the autoservice thread to wrap back around to the beginning of its loop. (closes issue #12266, reported by dimas) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@110397 f38db490-d61c-443f-a65b-d21fe96a405b
2008-03-03Merged revisions 105565 via svnmerge from russell1-1/+3
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r105565 | russell | 2008-03-03 10:01:50 -0600 (Mon, 03 Mar 2008) | 3 lines Update the copyright information for autoservice. Most of the code in this file now is stuff that I have written recently ... ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@105566 f38db490-d61c-443f-a65b-d21fe96a405b
2008-03-033) In addition to merging the changes below, change trunk back to a regularrussell1-21/+35
LIST instead of an RWLIST. The way this list works makes it such that a RWLIST provides no additional benefit. Also, a mutex is needed for use with the thread condition. Merged revisions 105563 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r105563 | russell | 2008-03-03 09:50:43 -0600 (Mon, 03 Mar 2008) | 24 lines Merge in some changes from team/russell/autoservice-nochans-1.4 These changes fix up some dubious code that I came across while auditing what happens in the autoservice thread when there are no channels currently in autoservice. 1) Change it so that autoservice thread doesn't keep looping around calling ast_waitfor_n() on 0 channels twice a second. Instead, use a thread condition so that the thread properly goes to sleep and does not wake up until a channel is put into autoservice. This actually fixes an interesting bug, as well. If the autoservice thread is already running (almost always is the case), then when the thread goes from having 0 channels to have 1 channel to autoservice, that channel would have to wait for up to 1/2 of a second to have the first frame read from it. 2) Fix up the code in ast_waitfor_nandfds() for when it gets called with no channels and no fds to poll() on, such as was the case with the previous code for the autoservice thread. In this case, the code would call alloca(0), and pass the result as the first argument to poll(). In this case, the 2nd argument to poll() specified that there were no fds, so this invalid pointer shouldn't actually get dereferenced, but, this code makes it explicit and ensures the pointers are NULL unless we have valid data to put there. (related to issue #12116) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@105564 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-29Merged revisions 105409 via svnmerge from russell1-0/+18
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r105409 | russell | 2008-02-29 17:34:32 -0600 (Fri, 29 Feb 2008) | 23 lines Fix a major bug in autoservice. There was a race condition in the handling of the list of channels in autoservice. The problem was that it was possible for a channel to get removed from autoservice and destroyed, while the autoservice thread was still messing with the channel. This led to memory corruption, and caused crashes. This explains multiple backtraces I have seen that have references to autoservice, but do to the nature of the issue (memory corruption), could cause crashes in a number of areas. (fixes the crash in BE-386) (closes issue #11694) (closes issue #11940) The following issues could be related. If you are the reporter of one of these, please update to include this fix and try again. (potentially fixes issue #11189) (potentially fixes issue #12107) (potentially fixes issue #11573) (potentially fixes issue #12008) (potentially fixes issue #11189) (potentially fixes issue #11993) (potentially fixes issue #11791) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@105410 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-08Merged revisions 97194 via svnmerge from tilghman1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r97194 | tilghman | 2008-01-08 14:47:07 -0600 (Tue, 08 Jan 2008) | 3 lines Increase constants to where we're less likely to hit them while debugging. (Closes issue #11694) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@97198 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-26Merged revisions 94801 via svnmerge from russell1-25/+38
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r94801 | russell | 2007-12-26 13:04:31 -0600 (Wed, 26 Dec 2007) | 4 lines Just in case the AST_FLAG_END_DTMF_ONLY flag was already set before starting autoservice, remember it and ensure that the channel has the same setting when autoservice gets stopped. (pointed out by d1mas, patched up by me) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@94802 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-26Merged revisions 94797 via svnmerge from russell1-0/+2
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r94797 | russell | 2007-12-26 12:46:39 -0600 (Wed, 26 Dec 2007) | 4 lines When a channel is in autoservice, mark a flag on the channel that says that we only care about the END of a digit. That way, no magic digit emulation stuff will happen when all we're doing is queueing up END frames. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@94798 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-26Merged revisions 94790 via svnmerge from russell1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r94790 | russell | 2007-12-26 11:06:26 -0600 (Wed, 26 Dec 2007) | 5 lines Don't store DTMF BEGIN frames while a channel is in autoservice. It's just going to make ast_read() do a lot of extra work when the channel comes back out of autoservice. (closes issue #11628, patched by me) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@94791 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-07Merged revisions 91777 via svnmerge from russell1-15/+29
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r91777 | russell | 2007-12-07 10:08:35 -0600 (Fri, 07 Dec 2007) | 6 lines * Add a bit more of a verbose comment as to why a hangup frame needs to be queued up if autoservice gets a NULL return from ast_read(). * Make the process of queueing the hangup frame more efficient by putting the frame where it is going to end up and avoiding some locking and extra memory allocations and freeing. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@91778 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-07Merged revisions 91737 via svnmerge from mmichelson1-1/+4
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r91737 | mmichelson | 2007-12-07 09:39:58 -0600 (Fri, 07 Dec 2007) | 7 lines Hangups that happen during autoservice were not processed appropriately. This is because a hangup actually causes a NULL frame to be received, not a hangup frame. Queueing a hangup if we receive a NULL frame during autoservice corrects this problem (closes issue #11467, reported by jmls, patched by me) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@91738 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-02Merged revisions 90432 via svnmerge from tilghman1-7/+11
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r90432 | tilghman | 2007-12-02 03:34:23 -0600 (Sun, 02 Dec 2007) | 7 lines Clarify the return value on autoservice. Specifically, if you started autoservice and autoservice was already on, it would erroneously return an error. Reported by: adiemus Patch by: dimas (Closes issue #11433) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@90433 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-27Merged revisions 89886 via svnmerge from russell1-0/+3
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89886 | russell | 2007-11-27 17:47:28 -0600 (Tue, 27 Nov 2007) | 2 lines Don't do frame processing if ast_read() returned NULL. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89888 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-27Merged revisions 89790 via svnmerge from russell1-3/+67
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89790 | russell | 2007-11-27 15:45:51 -0600 (Tue, 27 Nov 2007) | 41 lines Merge changes from team/russell/autoservice_1.4 This set of changes fixes an issue that was reported to me on IRC yesterday. The user, d1mas, was using chan_zap for incoming calls and was having DTMF recognition issues in some situations. Specifically, he noticed that the problem occurred when using DISA or WaitExten. He also noticed that when using Read, the problem did not occur. His system also used DUNDi for dialplan lookups. So, he theorized that if the DUNDi lookups blocked for some period of time, that audio from the zap channel could get lost. If the audio got lost, then it wouldn't be run through the DTMF detector, and digits could get lost. He was correct, and the following set of changes fixes the problem. However, the changes go a little bit further than what was necessary to fix this exact problem. 1) I updated pbx_extension_helper() to autoservice the associated channel to handle cases where extension lookups may take a long time. This would normally be a dialplan switch that does some lookup over the network, such as the DUNDi or IAX2 switches. This ensures that even while a DUNDi lookup is blocking, the channel will be continuously serviced. 2) I made a change to the autoservice code. This is actually something that has bothered me for a long time. When a channel is in autoservice, _all_ frames get thrown away. However, some frames really shouldn't be thrown away. The most notable examples are signalling (CONTROL) frames, and DTMF. So, this patch queues up important frames while a channel is in autoservice. When autoservice is stopped on the channel, the queued up frames get stuck back on the channel so that they can get processed instead of thrown away. 3) I made another change to the autoservice code to handle the case where autoservice is started on channels recursively. Previously, you could call ast_autoservice_start() multiple times on a channel, and it would stop the first time ast_autoservice_stop() gets called. Now, it will ensure that autoservice doesn't actually stop until the final call to ast_autoservice_stop(). ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89791 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-21remove a bunch of useless #include "options.h"rizzo1-1/+0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89511 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-19another bunch of include removals (errno.h and asterisk/logger.h)rizzo1-2/+0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89425 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-16Start untangling header inclusion in a way that does not affectrizzo1-4/+0
build times - tested, there is no measureable difference before and after this commit. In this change: use asterisk/compat.h to include a small set of system headers: inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h, stdlib.h, alloca.h, stdio.h Where available, the inclusion is conditional on HAVE_FOO_H as determined by autoconf. Normally, source files should not include any of the above system headers, and instead use either "asterisk.h" or "asterisk/compat.h" which does it better. For the time being I have left alone second-level directories (main/db1-ast, etc.). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89333 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-08improve linked-list macros in two ways:kpfleming1-2/+2
- the *_CURRENT macros no longer need the list head pointer argument - add AST_LIST_MOVE_CURRENT to encapsulate the remove/add operation when moving entries between lists git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89106 f38db490-d61c-443f-a65b-d21fe96a405b
2007-08-01Convert code that checks the _softhangup member of ast_channel directory to userussell1-2/+2
the ast_check_hangup() funciton. This function takes scheduled hangups into account. (closes issue #10230, patch by Juggie) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@77858 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-12Even more minor code cleanup!file1-4/+5
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@68920 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-06Issue 9869 - replace malloc and memset with ast_calloc, and other coding ↵tilghman1-2/+2
guidelines changes git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67864 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-23Might as well go crazy here too and make the autoservice list read/write.file1-14/+15
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51487 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-23Cosmetic changes. Make main source files better conform to coding guidelines ↵file1-2/+2
and standards. (issue #8679 reported by johann8384) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51486 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-04Merged revisions 44378 via svnmerge from kpfleming1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r44378 | kpfleming | 2006-10-04 14:47:22 -0500 (Wed, 04 Oct 2006) | 4 lines update thread creation code a bit reduce standard thread stack size slightly to allow the pthreads library to allocate the stack+data and not overflow a power-of-2 allocation in the kernel and waste memory/address space add a new stack size for 'background' threads (those that don't handle PBX calls) when LOW_MEMORY is defined ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44379 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21merge new_loader_completion branch, including (at least):kpfleming1-0/+154
- restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b