aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/pbx.h
AgeCommit message (Collapse)AuthorFilesLines
2009-07-08moving ast_devstate_to_extenstate to pbx.c from devicestate.cdvossel1-0/+8
ast_devstate_to_extenstate belongs in pbx.c. This change fixes a compile time error with chan_vpb as well. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@205409 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-02moving device state functions from pbx.h to devicestate.h to sync with other ↵dvossel1-58/+0
branches git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@204755 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-02Improved mapping of extension states from combined device states.dvossel1-0/+59
This fixes a few issues with incorrect extension states and adds a cli command, core show device2extenstate, to display all possible state mappings. (closes issue #15413) Reported by: legart Patches: exten_helper.diff uploaded by dvossel (license 671) Tested by: dvossel, legart, amilcar Review: https://reviewboard.asterisk.org/r/301/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@204681 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-19This merges the masqpark branch into 1.4murf1-2/+0
These changes eliminate the need for (and use of) the KEEPALIVE return code in res_features.c; There are other places that use this result code for similar purposes at a higher level, these appear to be left alone in 1.4, but attacked in trunk. The reason these changes are being made in 1.4, is that parking ends a channel's life, in some situations, and the code in the bridge (and some other places), was not checking the result code properly, and dereferencing the channel pointer, which could lead to memory corruption and crashes. Calling the masq_park function eliminates this danger in higher levels. A series of previous commits have replaced some parking calls with masq_park, but this patch puts them ALL to rest, (except one, purposely left alone because a masquerade is done anyway), and gets rid of the code that tests the KEEPALIVE result, and the NOHANGUP_PEER result codes. While bug 13820 inspired this work, this patch does not solve all the problems mentioned there. I have tested this patch (again) to make sure I have not introduced regressions. Crashes that occurred when a parked party hung up while the parking party was listening to the numbers of the parking stall being assigned, is eliminated. These are the cases where parking code may be activated: 1. Feature one touch (eg. *3) 2. Feature blind xfer to parking lot (eg ##700) 3. Run Park() app from dialplan (eg sip xfer to 700) (eg. dahdi hookflash xfer to 700) 4. Run Park via manager. The interesting testing cases for parking are: I. A calls B, A parks B a. B hangs up while A is getting the numbers announced. b. B hangs up after A gets the announcement, but before the parking time expires c. B waits, time expires, A is redialed, A answers, B and A are connected, after which, B hangs up. d. C picks up B while still in parking lot. II. A calls B, B parks A a. A hangs up while B is getting the numbers announced. b. A hangs up after B gets the announcement, but before the parking time expires c. A waits, time expires, B is redialed, B answers, A and B are connected, after which, A hangs up. d. C picks up A while still in parking lot. Testing this throroughly involves acting all the permutations of I and II, in situations 1,2,3, and 4. Since I added a few more changes (ALL references to KEEPALIVE in the bridge code eliimated (I missed one earlier), I retested most of the above cases, and no crashes. H-extension weirdness. Current h-extension execution is not completely correct for several of the cases. For the case where A calls B, and A parks B, the 'h' exten is run on A's channel as soon as the park is accomplished. This is expected behavior. But when A calls B, and B parks A, this will be current behavior: After B parks A, B is hung up by the system, and the 'h' (hangup) exten gets run, but the channel mentioned will be a derivative of A's... Thus, if A is DAHDI/1, and B is DAHDI/2, the h-extension will be run on channel Parked/DAHDI/1-1<ZOMBIE>, and the start/answer/end info will be those relating to Channel A. And, in the case where A is reconnected to B after the park time expires, when both parties hang up after the joyful reunion, no h-exten will be run at all. In the case where C picks up A from the parking lot, when either A or C hang up, the h-exten will be run for the C channel. CDR's are a separate issue, and not addressed here. As to WHY this strange behavior occurs, the answer lies in the procedure followed to accomplish handing over the channel to the parking manager thread. This procedure is called masquerading. In the process, a duplicate copy of the channel is created, and most of the active data is given to the new copy. The original channel gets its name changed to XXX<ZOMBIE> and keeps the PBX information for the sake of the original thread (preserving its role as a call originator, if it had this role to begin with), while the new channel is without this info and becomes a call target (a "peer"). In this case, the parking lot manager thread is handed the new (masqueraded) channel. It will not run an h-exten on the channel if it hangs up while in the parking lot. The h exten will be run on the original channel instead, in the original thread, after the bridge completes. See bug 13820 for our intentions as to how to clean up the h exten behavior. Review: http://reviewboard.digium.com/r/29/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@166093 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-15Add the deadlock note to ast_spawn_extension as wellmmichelson1-0/+4
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@164422 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-15Add notes to autoservice and pbx doxygen regarding a potentialmmichelson1-0/+20
deadlock scenario so that it is avoided in the future git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@164416 f38db490-d61c-443f-a65b-d21fe96a405b
2008-10-29The magic trick to avoid this crash is not tomurf1-2/+3
try to find the channel by name in the list, which is slow and resource consuming, but rather to pay attention to the result codes from the ast_bridge_call, to which I added the AST_PBX_NO_HANGUP_PEER_PARKED value, which now are returned when a channel is parked. If you get AST_PBX_KEEPALIVE, then don't touch the channel pointer. If you get AST_PBX_NO_HANGUP_PEER, or AST_PBX_NO_HANGUP_PEER_PARKED, then don't touch the peer pointer. Updated the several places where the results from a bridge were not being properly obeyed, and fixed some code I had introduced so that the results of the bridge were not overridden (in trunk). All the places that previously tested for AST_PBX_NO_HANGUP_PEER now have to check for both AST_PBX_NO_HANGUP_PEER and AST_PBX_NO_HANGUP_PEER_PARKED. I tested this against the 4 common parking scenarios: 1. A calls B; B answers; A parks B; B hangs up while A is getting the parking slot announcement, immediately after being put on hold. 2. A calls B; B answers; A parks B; B hangs up after A has been hung up, but before the park times out. 3. A calls B; B answers; B parks A; A hangs up while B is getting the parking slot announcement, immediately after being put on hold. 4. A calls B; B answers; B parks A; A hangs up after B has been hung up, but before the park times out. No crash. I also ran the scenarios above against valgrind, and accesses looked good. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@152535 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-04Fix the 'dialplan remove extension' logic, so that it a) works with cidmatch,tilghman1-1/+9
and b) completes contexts correctly when the extension is ambiguous. (closes issue #12980) Reported by: licedey Patches: 20080703__bug12980.diff.txt uploaded by Corydon76 (license 14) Tested by: Corydon76 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@127973 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-21Convert the contexts lock to a read/write lock to resolve a deadlock. Thisrussell1-1/+3
has a nice side benefit of improving performance. :) (closes issue #11609) (closes issue #11080) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@94466 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-28 - update documentation for some of the goto functions to note that theyrussell1-1/+20
handle locking the channel as needed - update ast_explicit_goto() to lock the channel as needed git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@89893 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-05After seeing crashes related to channel variables, I went looking around at therussell1-0/+24
ways that channel variables are handled. In general, they were not handled in a thread-safe way. The channel _must_ be locked when reading or writing from/to the channel variable list. What I have done to improve this situation is to make pbx_builtin_setvar_helper() and friends lock the channel when doing their thing. Asterisk API calls almost all lock the channel for you as necessary, but this family of functions did not. (closes issue #10923, reported by atis) (closes issue #11159, reported by 850t) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@88805 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-16merge markster's usersconf branch with some slight changeskpfleming1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43052 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-14add MacroExclusive application, a Macro that only one call can executed atrussell1-0/+23
a time (issue #7366, Steve Davies, with mods by me as discussed in the report) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@39681 f38db490-d61c-443f-a65b-d21fe96a405b
2006-07-08Support hold/unhold in Zap, update IAX2 parser to know about modern ↵markster1-0/+1
commands, forward hold/unhold in dial, add hold device state and implement holding in the SLA. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@37318 f38db490-d61c-443f-a65b-d21fe96a405b
2006-05-09Formatting fixoej1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@26131 f38db490-d61c-443f-a65b-d21fe96a405b
2006-05-08 - convert the lists of switches to use the linked list macrosrussell1-1/+2
- remove some checks of the result of ast_mutex_lock, since it is not necessary (this would be a good project to add to the janitor projects list). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@25443 f38db490-d61c-443f-a65b-d21fe96a405b
2006-05-08remove an XXX commentrussell1-1/+8
- we can't use ast_true here because non-empty strings would no longer be evaluated as true document the return values of pbx_checkcondition() in doxygen format git-svn-id: http://svn.digium.com/svn/asterisk/trunk@25411 f38db490-d61c-443f-a65b-d21fe96a405b
2006-05-05constify the argument to pbx_checkconditionrussell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@24878 f38db490-d61c-443f-a65b-d21fe96a405b
2006-05-01- convert the list of dialplan function to the list macrosrussell1-1/+1
- add missing locking of the functions list in the "show functions" CLI command git-svn-id: http://svn.digium.com/svn/asterisk/trunk@23950 f38db490-d61c-443f-a65b-d21fe96a405b
2006-04-14constify a couple of function argumentsrizzo1-5/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20138 f38db490-d61c-443f-a65b-d21fe96a405b
2006-04-05- Doxygen fixesoej1-32/+24
- Typos corrected git-svn-id: http://svn.digium.com/svn/asterisk/trunk@17694 f38db490-d61c-443f-a65b-d21fe96a405b
2006-04-04some fields are constrizzo1-4/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@17226 f38db490-d61c-443f-a65b-d21fe96a405b
2006-03-30as discussed with Mark a few weeks ago, the 'newstack' argumentrizzo1-30/+11
in pbx_exec is always 1 so it can be removed. This change also takes away ast_exec_extension(), and lets all switch functions (exists, canmatch, exec, matchmore) all use the same prototype, which makes the code a bit cleaner. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@16558 f38db490-d61c-443f-a65b-d21fe96a405b
2006-03-29Merged revisions 16192 via svnmerge from tilghman1-0/+3
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r16192 | tilghman | 2006-03-29 13:11:18 -0600 (Wed, 29 Mar 2006) | 2 lines Bug 6830 - Let GosubIf work with the same conditions as a GotoIf (change in API approved by Russell) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@16193 f38db490-d61c-443f-a65b-d21fe96a405b
2006-03-28make 'show hints' CLI command show context name for each hintkpfleming1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@15815 f38db490-d61c-443f-a65b-d21fe96a405b
2006-03-18- remove some unnecessary extern keywordsrussell1-223/+401
- cleanups to doxygen formatted documentation git-svn-id: http://svn.digium.com/svn/asterisk/trunk@13393 f38db490-d61c-443f-a65b-d21fe96a405b
2006-03-17move the definition of the mappings between extension states and their textrussell1-12/+0
representation into pbx.c so that every file that includes pbx.h does not unnecessarily get a copy of it git-svn-id: http://svn.digium.com/svn/asterisk/trunk@13357 f38db490-d61c-443f-a65b-d21fe96a405b
2006-02-12major dialplan functions updatekpfleming1-11/+10
deprecate LANGUAGE() and MUSICCLASS(), in favor of CHANNEL() git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9674 f38db490-d61c-443f-a65b-d21fe96a405b
2006-02-11Merged revisions 9581 via svnmerge from russell1-2/+2
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r9581 | russell | 2006-02-11 13:15:00 -0500 (Sat, 11 Feb 2006) | 2 lines now that CDR is a loadable module, don't depend on it elsewhere (issue #6460) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9582 f38db490-d61c-443f-a65b-d21fe96a405b
2006-01-04add memory-pool based string field management for structureskpfleming1-1/+1
convert chan_sip sip_pvt and sip_registry structures to use string fields add 'const' qualifiers to a few API calls that don't modify their input strings add an asprintf() wrapper to astmm git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7797 f38db490-d61c-443f-a65b-d21fe96a405b
2005-12-24minor cleanups ...russell1-1/+1
- use for loops instead of while loops for basic list traversals - only calculate word length one time in CLI complete functions - use calloc instead of malloc + memset - remove some unnecessary casts - formatting tweaks git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7618 f38db490-d61c-443f-a65b-d21fe96a405b
2005-12-03Bug 5858 - Make the chanvars.c functions return a 'const char *'tilghman1-3/+3
This should prevent us from unintentionally changing variable values when they're returned from pbx_builtin_getvar_helper. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7304 f38db490-d61c-443f-a65b-d21fe96a405b
2005-11-29git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7221 ↵kpfleming1-0/+0
f38db490-d61c-443f-a65b-d21fe96a405b
2005-11-08issue #2720kpfleming1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7034 f38db490-d61c-443f-a65b-d21fe96a405b
2005-10-26clean up a lot of doxygen errors and warnings (issue #5522)russell1-6/+9
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6865 f38db490-d61c-443f-a65b-d21fe96a405b
2005-10-24Doxygen documentation update from oej (issue #5505)russell1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6847 f38db490-d61c-443f-a65b-d21fe96a405b
2005-09-13check call limit in ast_pbx_start(), instead of waiting until background ↵kpfleming1-5/+11
thread has been launched (needed for issue #5131) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6568 f38db490-d61c-443f-a65b-d21fe96a405b
2005-08-30major header file cleanup: license, copyrights, descriptions, markers, etc.kpfleming1-8/+17
remove deprecated config_old.c/config_old.h remove unused cvsid.h git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6454 f38db490-d61c-443f-a65b-d21fe96a405b
2005-08-29massive upgrade to SUBSCRIBE, device state and messaging support (issue #3644)kpfleming1-3/+25
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6446 f38db490-d61c-443f-a65b-d21fe96a405b
2005-08-27preserve hint watchers and laststate across 'extensions reload' (issue #2522)kpfleming1-9/+15
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6431 f38db490-d61c-443f-a65b-d21fe96a405b
2005-07-15Allow manager originate to specifiy more than one variable to be set.russell1-2/+2
Allow manager originate and spool files to set writable dialplan functions, including those that use the pipe symbol to seperate arguments. Allow CDR dialplan function to be able to set the account code and userfield. This deprecates the use of the Account header in manager originate and spool files, as well as the SetAccount and SetCDRUserField applications. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6147 f38db490-d61c-443f-a65b-d21fe96a405b
2005-07-08queue device state changes and handle them serially in a background threadkpfleming1-21/+2
optimize device state related functions add ast_get_channel_by_name_prefix to allow searching for matching channels in O(1) operation git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6062 f38db490-d61c-443f-a65b-d21fe96a405b
2005-05-18Add optional call limitmarkster1-0/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5712 f38db490-d61c-443f-a65b-d21fe96a405b
2005-05-05expose function execution routines and warn about trying to set a read-only ↵anthm1-0/+23
cdr var git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5589 f38db490-d61c-443f-a65b-d21fe96a405b
2005-05-05major re-work of dialplan functions, including:kpfleming1-6/+8
- locking of functions list during registration/unregistration/searching - rename of function description structure to be consistent with the rest of the API - addition of 'desc' element to description structure, for detailed description (like applications) - addition of 'show function' CLI command to show function details - conversion of existing functions to use uppercase names to match policy - creation of new 'pbx_functions.so' module to contain standard 'builtin' functions - removal of all builtin functions from pbx.c and apps and placement into new 'funcs' directory git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5583 f38db490-d61c-443f-a65b-d21fe96a405b
2005-04-21use double-quotes instead of angle-brackets for non-system include files ↵kpfleming1-2/+2
(bug #4058) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5490 f38db490-d61c-443f-a65b-d21fe96a405b
2005-03-29Allow functions to be written to (bug #2278, with mods)markster1-3/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5296 f38db490-d61c-443f-a65b-d21fe96a405b
2005-03-04Add registerable functional variables (bug #3636, with doc mods)markster1-0/+13
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5136 f38db490-d61c-443f-a65b-d21fe96a405b
2005-02-02Include uniqueid in response for ManagerOriginate stuff (bug #3439)markster1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4948 f38db490-d61c-443f-a65b-d21fe96a405b
2005-02-01Allow hints to have names (bug #3471)markster1-1/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4938 f38db490-d61c-443f-a65b-d21fe96a405b