aboutsummaryrefslogtreecommitdiffstats
path: root/main/manager.c
AgeCommit message (Collapse)AuthorFilesLines
2010-07-20Off-by-one errortilghman1-5/+3
(closes issue #16506) Reported by: nik600 Patches: 20100629__issue16506.diff.txt uploaded by tilghman (license 14) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@278023 f38db490-d61c-443f-a65b-d21fe96a405b
2010-07-16If variable gotten is not set, will segfault on Solaris.tilghman1-1/+1
(closes issue #17636) Reported by: bklang git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@277261 f38db490-d61c-443f-a65b-d21fe96a405b
2010-05-25Merged revisions 265320,265467 via svnmerge from twilson1-0/+3
https://origsvn.digium.com/svn/asterisk/trunk ........ r265320 | twilson | 2010-05-24 14:06:40 -0500 (Mon, 24 May 2010) | 14 lines Add the FullyBooted AMI event It is possible to connect to the manager interface before all Asterisk modules are loaded. To ensure that an application does not send AMI actions that might require a module that has not yet loaded, the application can listen for the FullyBooted manager event. It will be sent upon connection if all modules have been loaded, or as soon as loading is complete. The event: Event: FullyBooted Privilege: system,all Status: Fully Booted Review: https://reviewboard.asterisk.org/r/639/ ........ r265467 | twilson | 2010-05-24 17:21:58 -0500 (Mon, 24 May 2010) | 1 line Merge the rest of the FullyBooted patch ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@265570 f38db490-d61c-443f-a65b-d21fe96a405b
2010-04-13Add an option to restore past broken behavor of the Events manager actionmnicholson1-1/+24
Before r238915, certain values for the EventMask parameter of the Events action would result in no response being returned. This patch adds an option to restore that broken behavior. Also while fixing this bug I discovered that passing an empty EventMasks parameter would also result in no response being returned, this has been fixed as well while being preserved when the broken behavior is requested. (closes issue #17023) Reported by: nblasgen Review: https://reviewboard.asterisk.org/r/602/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@257070 f38db490-d61c-443f-a65b-d21fe96a405b
2010-03-20Resolve a number of FreeBSD build issues.russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@253631 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-25Remove debugging that indeed should have been gone before commit. Sorry.oej1-3/+2
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@242851 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-25Report error when writing to functions returns error in AMI setvar actionoej1-3/+14
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@242850 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-09-1 is interpreted as an error, intead of the maximum mask.tilghman1-1/+1
(closes issue #16241) Reported by: vnovy Patches: manager.c.patch uploaded by vnovy (license 922) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@238915 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-02Send ack (response/message) after receiving manager action usereventjpeeler1-0/+1
(closes issue #16264) Reported by: dimas Patches: event-ack.patch uploaded by dimas (license 88) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@232581 f38db490-d61c-443f-a65b-d21fe96a405b
2009-10-27Manager output is not always NULL-terminated, so force a NULL at the end of ↵tilghman1-2/+6
the filestream. (closes issue #15495) Reported by: pdf Patches: 20090916__issue15495.diff.txt uploaded by tilghman (license 14) Tested by: pdf git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@226138 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-18Delay the creation of temporary files until we have a valid manager command ↵seanbright1-1/+3
to handle. Without this patch, asterisk creates a temporary file before determining if the specified command is valid. If invalid, we weren't properly cleaning up the file. (closes issue #15730) Reported by: zmehmood Patches: M15730.diff uploaded by junky (license 177) Tested by: zmehmood git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@212763 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-10AST-2009-005tilghman1-6/+6
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@211528 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-21Document default timeout for AMI originations.mmichelson1-1/+1
AST-224 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@207714 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-18Don't try to unlock a bogus channel.russell1-0/+1
(closes issue #15144) Reported by: cristiandimache git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@195020 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-20Clean up problem with manager implementation of mmap where it was not ↵dbailey1-11/+13
testing against MAP_FAILED response. Got rid of shadowed variable used in processign the mmap results. Change test of mmap results to compare against MAP_FAILED git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@189391 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-09Race condition between ast_cli_command() and 'module unload' could cause a ↵tilghman1-3/+14
deadlock. Add lock timeouts to avoid this potential deadlock. (closes issue #14705) Reported by: jamessan Patches: 20090320__bug14705.diff.txt uploaded by tilghman (license 14) Tested by: jamessan git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@187428 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-08Backport resolution for file descriptor leak in 1.6.0 to 1.4.tilghman1-105/+187
This fixes short reads in http manager sessions, such as those done by the ast-gui branch. (Fixes AST-198) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@187209 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-07Ensure that \r\n is printed after the ActionID in an OriginateResponse.mmichelson1-3/+4
(closes issue #14847) Reported by: kobaz git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@186719 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-18Fix cases where the internal poll() was not being used when it needed to be.russell1-2/+2
We have seen a number of problems caused by poll() not working properly on Mac OSX. If you search around, you'll find a number of references to using select() instead of poll() to work around these issues. In Asterisk, we've had poll.c which implements poll() using select() internally. However, we were still getting reports of problems. vadim investigated a bit and realized that at least on his system, even though we were compiling in poll.o, the system poll() was still being used. So, the primary purpose of this patch is to ensure that we're using the internal poll() when we want it to be used. The changes are: 1) Remove logic for when internal poll should be used from the Makefile. Instead, put it in the configure script. The logic in the configure script is the same as it was in the Makefile. Ideally, we would have a functionality test for the problem, but that's not actually possible, since we would have to be able to run an application on the _target_ system to test poll() behavior. 2) Always include poll.o in the build, but it will be empty if AST_POLL_COMPAT is not defined. 3) Change uses of poll() throughout the source tree to ast_poll(). I feel that it is good practice to give the API call a new name when we are changing its behavior and not using the system version directly in all cases. So, normally, ast_poll() is just redefined to poll(). On systems where AST_POLL_COMPAT is defined, ast_poll() is redefined to ast_internal_poll(). 4) Change poll() in main/poll.c to be ast_internal_poll(). It's worth noting that any code that still uses poll() directly will work fine (if they worked fine before). So, for example, out of tree modules that are using poll() will not stop working or anything. However, for modules to work properly on Mac OSX, ast_poll() needs to be used. (closes issue #13404) Reported by: agalbraith Tested by: russell, vadim http://reviewboard.digium.com/r/198/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@182810 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-28This patch fixes h-exten running misbehavior in manager-redirected murf1-2/+13
situations. What it does: 1. A new Flag value is defined in include/asterisk/channel.h, AST_FLAG_BRIDGE_HANGUP_DONT, which used as a messenge to the bridge hangup exten code not to run the h-exten there (nor publish the bridge cdr there). It will done at the pbx-loop level instead. 2. In the manager Redirect code, I set this flag on the channel if the channel has a non-null pbx pointer. I did the same for the second (chan2) channel, which gets run if name2 is set... and the first succeeds. 3. I restored the ending of the cdr for the pbx loop h-exten running code. Don't know why it was removed in the first place. 4. The first attempt at the fix for this bug was to place code directly in the async_goto routine, which was called from a large number of places, and could affect a large number of cases, so I tested that fix against a fair number of transfer scenarios, both with and without the patch. In the process, I saw that putting the fix in async_goto seemed not to affect any of the blind or attended scenarios, but still, I was was highly concerned that some other scenarios I had not tested might be negatively impacted, so I refined the patch to its current scope, and jmls tested both. In the process, tho, I saw that blind xfers in one situation, when the one-touch blind-xfer feature is used by the peer, we got strange h-exten behavior. So, I inserted code to swap CDRs and to set the HANGUP_DONT field, to get uniform behavior. 5. I added code to the bridge to obey the HANGUP_DONT flag, skipping both publishing the bridge CDR, and running the h-exten; they will be done at the pbx-loop (higher) level instead. 6. I removed all the debug logs from the patch before committing. 7. I moved the AUTOLOOP set/reset in the h-exten code in res_features so it's only done if the h-exten is going to be run. A very minor performance improvement, but technically correct. (closes issue #14241) Reported by: jmls Patches: 14241_redirect_no_bridgeCDR_or_h_exten_via_transfer uploaded by murf (license 17) Tested by: murf, jmls git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@172030 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-19Truncate userevents at the end of a line, when the command exceeds the buffer.tilghman1-2/+6
(closes issue #14278) Reported by: fnordian git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@169364 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-16Add "restart gracefully" to the AMI blacklist of CLI commands. russell1-0/+1
"module unload" was already identified as a command that can not be used from the AMI. "restart gracefully" effectively unloads all modules, and will run in to the same problems. (closes issue #13894) Reported by: kernelsensei git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@164806 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-01Get rid of the useless format string and argument in the Bogus/ manager ↵mvanbaak1-1/+1
channelname. Noted by kpfleming and name Bogus/manager suggested by eliel git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@159976 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-01make manager compile on OpenBSD.mvanbaak1-1/+1
The last (10th) argument to ast_channel_alloc here should be a pointer and NULL is not really a pointer. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@159897 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-13Provide more space for all the data which can appear in an originatingtilghman1-1/+2
channel name. (closes issue #13398) Reported by: bamby Patches: manager.c.diff uploaded by bamby (license 430) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@156688 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-01fix a bunch of potential problems found by gcc 4.3.x, primarily bare strings ↵kpfleming1-1/+3
being passed to printf()-like functions and ignored results from read()/write() and friends git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@153337 f38db490-d61c-443f-a65b-d21fe96a405b
2008-10-18 Using the GetVar handler in AMI is potentially dangerous (insta-crash [tm]) ↵bweschke1-2/+9
when you use a dialplan function that requires a channel and then you don't provide one or provide an invalid one in the Channel: parameter. We'll handle this situation exactly the same way it was handled in pbx.c back on r61766. We'll create a bogus channel for the function call and destroy it when we're done. If we have trouble allocating the bogus channel then we're not going to try executing the function call at all and run the risk of crashing. (closes issue #13715) reported by: makoto patch by: bweschke git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@150816 f38db490-d61c-443f-a65b-d21fe96a405b
2008-10-16Reverting changes from commits 150298 and 150301 sincemmichelson1-4/+1
I was mistakenly under the assumption that dialplan functions *always* required that a channel be present. I need to go home earlier, I think :) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@150304 f38db490-d61c-443f-a65b-d21fe96a405b
2008-10-16And don't forget to return on the error conditionmmichelson1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@150301 f38db490-d61c-443f-a65b-d21fe96a405b
2008-10-16Don't try to call a dialplan function's read callback frommmichelson1-1/+3
the manager's GetVar handler if an invalid channel has been specified. Several dialplan functions, including CHANNEL and SIP_HEADER, do not check for NULL-ness of the channel being passed in. (closes issue #13715) Reported by: makoto git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@150298 f38db490-d61c-443f-a65b-d21fe96a405b
2008-08-29After working on the ao2_containers branch, I noticedmmichelson1-1/+1
something a bit strange. In all cases where we provide a callback function to ao2_container_alloc, the callback function would only return 0 or CMP_MATCH. After inspecting the ao2_callback() code carefully, I found that if you're only looking for one specific item, then you should return CMP_MATCH | CMP_STOP. Otherwise, astobj2 will continue traversing the current bucket until the end searching for more matches. In cases like chan_iax2 where in 1.4, all the peers are shoved into a single bucket, this makes for potentially terrible performance since the entire bucket will be traversed even if the peer is one of the first ones come across in the bucket. All the changes I have made were for cases where the callback function defined was passed to ao2_container_alloc so that calls to ao2_find could find a unique instance of whatever object was being stored in the container. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@140488 f38db490-d61c-443f-a65b-d21fe96a405b
2008-08-25Fix a typo I made. Lesson learned, apply the patch if one exists.jpeeler1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@139927 f38db490-d61c-443f-a65b-d21fe96a405b
2008-08-22(closes issue #13359)jpeeler1-1/+1
Reported by: Laureano Patches: originate_channel_check.patch uploaded by Laureano (license 265) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@139621 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-31Specify codecs in callfiles and manager, to allow video calls to be set uptilghman1-4/+12
from callfiles and AMI. (closes issue #9531) Reported by: Geisj Patches: 20080715__bug9531__1.4.diff.txt uploaded by Corydon76 (license 14) 20080715__bug9531__1.6.0.diff.txt uploaded by Corydon76 (license 14) Tested by: Corydon76 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@134976 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-15astman_send_error does not need a newline appended -- the API takes care oftilghman1-6/+6
that for us. (closes issue #13068) Reported by: gknispel_proformatique Patches: asterisk_1_4_astman_send.patch uploaded by gknispel (license 261) asterisk_trunk_astman_send.patch uploaded by gknispel (license 261) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@130959 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-13fix memory leak when originate from manager cannot create a threadmvanbaak1-0/+1
(closes issue #13069) Reported by: gknispel_proformatique Patches: asterisk_trunk_action_originate.patch uploaded by gknispel (license 261) Tested by: gknispel_proformatique, mvanbaak git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@130573 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-03When listing the manager users, managers in users.conf are not shown, eventilghman1-1/+66
though they are allowed to connect. (closes issue #12594) Reported by: bkruse Patches: 12594-managerusers-2.diff uploaded by qwell (license 4) Tested by: bkruse git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@120061 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-02Improve CLI command blacklist checking for the command manager action. ↵russell1-9/+50
Previously, it did not handle case or whitespace properly. This made it possible for blacklisted commands to get executed anyway. (closes issue #12765) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@119742 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-23Store the manager session ID explicitly as 4 byte ID instead of a ulong. Therussell1-7/+7
mansession_id cookie is coded to be limited to 8 characters of hex, and this could break logins from 64-bit machines in some cases. (inspired by AST-20) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@114591 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-18Don't destroy a manager session if poll() returns an error of EAGAIN.russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@114284 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-02Fix a race condition in the manager. It is possible that a new manager eventmmichelson1-0/+13
could be appended during a brief time when the manager is not waiting for input. If an event comes during this period, we need to set an indicator that there is an event pending so that the manager doesn't attempt to wait forever for an event that already happened. (closes issue #12354) Reported by: bamby Patches: manager_race_condition.diff uploaded by bamby (license 430) (comments added by me) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@112468 f38db490-d61c-443f-a65b-d21fe96a405b
2008-03-07Safely use the strncat() function.tilghman1-2/+2
(closes issue #11958) Reported by: norman Patches: 20080209__bug11958.diff.txt uploaded by Corydon76 (license 14) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@106552 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-27Ensure the session ID can't be 0.tilghman1-1/+6
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@104704 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-21reduce the likelihood that HTTP Manager session ids will consist of ↵kpfleming1-1/+1
primarily '1' bits git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@104015 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-17missed that one while revertingpari1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@99010 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-17reverting 99001 - We need the Max-Age for extending the life of cookie ↵pari1-6/+2
mansession_id git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@99007 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-17we should only send the Set-Cookie header to the browser on the first ↵kpfleming1-2/+6
response after creating a manager session, not on every response (doing so causes the browser to clear any local cookies it may have associated with the session) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@99001 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-27make this comment explain the situation in an even more explicit fashionkpfleming1-5/+11
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@94824 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-26Workaround for what is probably a glibc bug (but we'll see this crop up againtilghman1-0/+8
and again, if we don't add the workaround). Reported by: rolek Patch by: tilghman (Closes issue #11601, closes issue #11426) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@94808 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-30Change the behavior of ao2_link(). Previously, in inherited a reference.russell1-2/+0
Now, it automatically increases the reference count to reflect the reference that is now held by the container. This was done to be more consistent with ao2_unlink(), which automatically releases the reference held by the container. It also makes it so it is no longer possible for a pointer to be invalid after ao2_link() returns. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@90348 f38db490-d61c-443f-a65b-d21fe96a405b