summaryrefslogtreecommitdiff
path: root/main/pbx.c
AgeCommit message (Collapse)Author
2012-07-25Revert a change that broke compilationTerry Wilson
1) There is no such function as ast_ref() 2) The patch was originally credited as the one uploaded by Guenther Kelleter (license 6372) via issue AST-921, but the patch committed was not the patch referenced on the issue. 3) Guenther Kelleter's patch was actually correct. It moved the ast_free above the presencechange_cleanup label. I am not committing his change as it is not technically necesary--calling ast_free(NULL) is perfectly safe and I worry that moving the ast_free outside of the label could lead to future bugs if someone ever adds another failure conditional and expects 'goto presencechange_cleanup;' to clean up after everything. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370474 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-24Don't attempt free of NULL ptr in pbx.c handle_presencechangeJonathan Rose
(closes issue AST-921) Reported by: Guenther Kelleter Patches: nullptr.patch uploaded by Guenther Kelleter (license 6372) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370466 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-18Ensure that all ast_datastore_info structures are 'const'.Kevin P. Fleming
While addressing a bug, I came across a instance of 'struct ast_datastore_info' that was not declared 'const'. Since the API already expects them to be 'const', this patch changes the declarations of all existing instances that were not already declared that way. ........ Merged revisions 370183 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 370184 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370187 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-10Add some additional documentation for core AMI eventsMatthew Jordan
This patch adds some basic documentation for a number of modules. This includes core source files in Asterisk (those in main), as well as chan_agent, chan_dahdi, chan_local, sig_analog, and sig_pri. The DTD has also been updated to allow referencing of AMI commands. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-10Improve Goto and GotoIf related documentationKinsey Moore
Correct documentation on labeliftrue and labeliffalse parameters of GotoIf() and update several other locations that use the same syntax. (closes issue ASTERISK-20007) Patch-by: Leif Madsen Reported-by: WIMPy ........ Merged revisions 369869 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369871 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369872 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-29Hangup handlers - Dialplan subroutines that run when the channel hangs up.Richard Mudgett
Hangup handlers are an alternative to the h extension. They can be used in addition to the h extension. The idea is to attach a Gosub routine to a channel that will execute when the call hangs up. Whereas which h extension gets executed depends on the location of dialplan execution when the call hangs up, hangup handlers are attached to the call channel. You can attach multiple handlers that will execute in the order of most recently added first. (closes issue ASTERISK-19549) Reported by: Mark Murawski Tested by: rmudgett Review: https://reviewboard.asterisk.org/r/2002/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-26Unique Call ID logging Phases III and IVJonathan Rose
Adds call ID logging changes to specific channel drivers that weren't handled handled in phase II of Call ID Logging. Also covers logging for threads for threads created by systems that may be involved with many different calls. Extra special thanks to Richard for rigorous review of chan_dahdi and its various signalling modules. review: https://reviewboard.asterisk.org/r/1927/ review: https://reviewboard.asterisk.org/r/1950/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-15Multiple revisions 369001-369002Kevin P. Fleming
........ r369001 | kpfleming | 2012-06-15 10:56:08 -0500 (Fri, 15 Jun 2012) | 11 lines Add support-level indications to many more source files. Since we now have tools that scan through the source tree looking for files with specific support levels, we need to ensure that every file that is a component of a 'core' or 'extended' module (or the main Asterisk binary) is explicitly marked with its support level. This patch adds support-level indications to many more source files in tree, but avoids adding them to third-party libraries that are included in the tree and to source files that don't end up involved in Asterisk itself. ........ r369002 | kpfleming | 2012-06-15 10:57:14 -0500 (Fri, 15 Jun 2012) | 3 lines Add a script to enable finding source files without support-levels defined. ........ Merged revisions 369001-369002 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369005 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-14Make the Hangup application set a softhangup flag.Richard Mudgett
The Hangup application used to just return -1 to cause normal dialplan execution to hangup a channel. For the non-normal execution routines like predial and connected-line interception routines, the hangup request would exit the routine early but otherwise be ignored. * Made the Hangup application not allow setting a cause code of zero. A zero cause code is not defined. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368979 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-04Merge changes dealing with support for Digium phones.Mark Michelson
Presence support has been added. This is accomplished by allowing for presence hints in addition to device state hints. A dialplan function called PRESENCE_STATE has been added to allow for setting and reading presence. Presence can be transmitted to Digium phones using custom XML elements in a PIDF presence document. Voicemail has new APIs that allow for moving, removing, forwarding, and playing messages. Messages have had a new unique message ID added to them so that the APIs will work reliably. The state of a voicemail mailbox can be obtained using an API that allows one to get a snapshot of the mailbox. A voicemail Dialplan App called VoiceMailPlayMsg has been added to be able to play back a specific message. Configuration hooks have been added. Configuration hooks allow for a piece of code to be executed when a specific configuration file is loaded by a specific module. This is useful for modules that are dependent on the configuration of other modules. chan_sip now has a public method that allows for a custom SIP INFO request to be sent mid-dialog. Digium phones use this in order to display progress bars when files are played. Messaging support has been expanded a bit. The main visible difference is the addition of an AMI action MessageSend. Finally, a ParkingLots manager action has been added in order to get a list of parking lots. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-23Fix WaitExten(x,m(musicclass)) string termination.Richard Mudgett
The AST_CONTROL_HOLD MOH class from the WaitExten application can now be queued onto a channel, passed over local channels with the /m option, and passed over IAX channels. ........ Merged revisions 367469 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 367470 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-23logger: Fix a potential callid reference leak discovered in developmentJonathan Rose
Uncovered a nasty reference leak while I was writing some changes to chan_dahdi/sig_analog. Slapped myself around a bit after seeing that I performed the unchecked return causing this problem. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367419 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18Fix a variety of memory leaksMatthew Jordan
This patch addresses a number of memory leaks in a variety of modules that were found by a static analysis tool. A brief summary of the changes: * app_minivm: free ast_str objects on off nominal paths * app_page: free the ast_dial object if the requested channel technology cannot be appended to the dialing structure * app_queue: if a penalty rule failed to match any existing rule list names, the created rule would not be inserted and its memory would be leaked * app_read: dispose of the created silence detector in the presence of off nominal circumstances * app_voicemail: dispose of an allocated unique ID field for MWI event un-subscribe requests in off nominal paths; dispose of configuration objects when using the secret.conf option * chan_dahdi: dispose of the allocated frame produced by ast_dsp_process * chan_iax2: properly unref peer in CLI command "iax2 unregister" * chan_sip: dispose of the allocated frame produced by sip_rtp_read's call of ast_dsp_process; free memory in parse unit tests * func_dialgroup: properly deref ao2 object grhead in nominal path of dialgroup_read * func_odbc: free resultset in off nominal paths of odbc_read * cli: free match_list in off nominal paths of CLI match completion * config: free comment_buffer/list_buffer when configuration file load is unchanged; free the same buffers any time they were created and config files were processed * data: free XML nodes in various places * enum: free context buffer in off nominal paths * features: free ast_call_feature in off nominal paths of applicationmap config processing * netsock2: users of ast_sockaddr_resolve pass in an ast_sockaddr struct that is allocated by the method. Failures in ast_sockaddr_resolve could result in the users of the method not knowing whether or not the buffer was allocated. The method will now not allocate the ast_sockaddr struct if it will return failure. * pbx: cleanup hash table traversals in off nominal paths; free ignore pattern buffer if it already exists for the specified context * xmldoc: cleanup various nodes when we no longer need them * main/editline: various cleanup of pointers not being freed before being assigned to other memory, cleanup along off nominal paths * menuselect/mxml: cleanup of value buffer for an attribute when that attribute did not specify a value * res_calendar*: responses are allocated via the various *_request method returns and should not be allocated in the various write_event methods; ensure attendee buffer is freed if no data exists in the parsed node; ensure that calendar objects are de-ref'd appropriately * res_jabber: free buffer in off nominal path * res_musiconhold: close the DIR* object in off nominal paths * res_rtp_asterisk: if we run out of ports, close the rtp socket object and free the rtp object * res_srtp: if we fail to create the session in libsrtp, destroy the temporary ast_srtp object (issue ASTERISK-19665) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1922 ........ Merged revisions 366880 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366881 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-17logger: Adds additional support for call id logging and chan_sip specific stuffJonathan Rose
This patch improves the handling of call id logging significantly with regard to transfers and adding APIs to better handle specific aspects of logging. Also, changes have been made to chan_sip in order to better handle the creation of callids and to enable the monitor thread to bind itself to a particular call id when a dialog is determined to be related to a callid. It then unbinds itself before returning to normal monitoring. review: https://reviewboard.asterisk.org/r/1886/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10Resolve FORWARD_NULL static analysis warningsKinsey Moore
This resolves core findings from ASTERISK-19650 numbers 0-2, 6, 7, 9-11, 14-20, 22-24, 28, 30-32, 34-36, 42-56, 82-84, 87, 89-90, 93-102, 104, 105, 109-111, and 115. Finding numbers 26, 33, and 29 were already resolved. Those skipped were either extended/deprecated or in areas of code that shouldn't be disturbed. (Closes issue ASTERISK-19650) ........ Merged revisions 366167 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366168 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10Coverity Report: Fix issues for error type CHECKED_RETURN for coreJonathan Rose
(issue ASTERISK-19658) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1905/ ........ Merged revisions 366094 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366106 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-07Fix channel opaquification slip-up in r365477Matthew Jordan
Those channels are opaque now... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365480 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-07Support VoiceMail d() option when extension does not exist in channel's contextMatthew Jordan
The VoiceMail d([c]) option is documented to accept digits for a new extension in context <c>, if played during the greeting. This option works fine if the extension being redirected to has an extension with the same initial digit in the channel's current context. If that digit did not happen to exist in some extension, a dialplan match would fail and the user would not be redirected. This patch fixes it such that if the <c> option is used, the extensions are matched in that context as opposed to the caller's original context. (closes issue ASTERISK-18243) Reported by: mjordan Tested by: mjordan Review: https://reviewboard.asterisk.org/r/1892 ........ Merged revisions 365474 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 365475 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-20* Add more information to some messages in __ast_pbx_run().Richard Mudgett
* Simplify some dialplan priority setting code in ast_explicit_goto() because of opaquification. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362867 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-06Add missing newlines to CLI loggingKinsey Moore
........ Merged revisions 361471 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 361472 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29Introducing the log message unique call identifiers featureJonathan Rose
Log messages will now display a call number that they are tied to (ordered for calls based on when they started). This feature is made to be minimally invasive without requiring changes to many of the existing log messages. These IDs won't show up for verbose messages on CLI (but they will in log files) This is currently in phase II of production, see more about this feature on the wiki -- https://wiki.asterisk.org/wiki/display/AST/Unique+Call-ID+Logging Review: https://reviewboard.asterisk.org/r/1823/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29undoing 360785 due to merging mistakeJonathan Rose
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360786 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29Introducing the log message unique call identifiers featureJonathan Rose
Log messages will now display a call number that they are tied to (ordered for calls based on when they started). This feature is made to be minimally invasive without requiring changes to many of the existing log messages. These IDs won't show up for verbose messages on CLI (but they will in log files) This is currently in phase II of production, see more about this feature on the wiki -- https://wiki.asterisk.org/wiki/display/AST/Unique+Call-ID+Logging Review: https://reviewboard.asterisk.org/r/1823/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360785 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-22Kill off red blobs in most of main/*Kinsey Moore
Everything still compiled after making these changes, so I assume these whitespace-only changes didn't break anything (and shouldn't have). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-20Allow AMI action callback to be reentrant.Richard Mudgett
Fix AMI module reload deadlock regression from ASTERISK-18479 when it tried to fix the race between calling an AMI action callback and unregistering that action. Refixes ASTERISK-13784 broken by ASTERISK-17785 change. Locking the ao2 object guaranteed that there were no active callbacks that mattered when ast_manager_unregister() was called. Unfortunately, this causes the deadlock situation. The patch stops locking the ao2 object to allow multiple threads to invoke the callback re-entrantly. There is no way to guarantee a module unload will not crash because of an active callback. The code attempts to minimize the chance with the registered flag and the maximum 5 second delay before ast_manager_unregister() returns. The trunk version of the patch changes the API to fix the race condition correctly to prevent the module code from unloading from memory while an action callback is active. * Don't hold the lock while calling the AMI action callback. (closes issue ASTERISK-19487) Reported by: Philippe Lindheimer Review: https://reviewboard.asterisk.org/r/1818/ Review: https://reviewboard.asterisk.org/r/1820/ ........ Merged revisions 359979 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 359980 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359981 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-16Revert the pre-dial addition.Mark Michelson
The code may be just fine, but it had not received a "ship it!" on review board yet. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-15Fix warning from commit r359705 (predial options for app_dial)Mark Murawki
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-15Add options PreDial options 'b' and 'B' to app_dialMark Murawki
* Added 'b' and 'B' options to Dial. These options will allow you to run last-minute dialplan on the caller and callee channels while the Dial application is executing, but before the call is started. For example you can use the 'b' option to run dialplan on the callee channel to get the name of the newly created channel right away. Review: https://reviewboard.asterisk.org/r/1229/ (closes issue: ASTERISK-19548) Reported by: Mark Murawski Tested by: Mark Murawski, Stefan Schmidt git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359705 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14Don't use a buffer after it goes out of scope.Russell Bryant
's' is set to 'workspace'. Make sure 'workspace' doesn't go out of scope while the reference to it via 's' is still used. ........ Merged revisions 359056 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 359057 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359058 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13Finalize ast_channel opaquificationTerry Wilson
Review: https://reviewboard.asterisk.org/r/1786/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-01Opaquify ast_channel typedefs, fd arrays, and softhangup flagTerry Wilson
Review: https://reviewboard.asterisk.org/r/1784/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-29Opaquify ast_channel structs and listsTerry Wilson
Review: https://reviewboard.asterisk.org/r/1773/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24Opaquification for ast_format structs in struct ast_channelTerry Wilson
Review: https://reviewboard.asterisk.org/r/1770/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-20ast_channel opaquification of pointers and integral typesTerry Wilson
Review: https://reviewboard.asterisk.org/r/1753/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-14Re-commit the verbose branch.Tilghman Lesher
This change permits each verbose destination (consoles, logger) to have its own concept of what the verbosity level is. The big feature here is that the logger will now be able to capture a particular verbosity level without condemning each console to need to suffer that level of verbosity. Additionally, a stray 'core set verbose' will no longer change what will go to the log. Review: https://reviewboard.asterisk.org/r/1599/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355413 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-13Opaquify char * and char[] in ast_channelTerry Wilson
Review: https://reviewboard.asterisk.org/r/1733/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-08Avoid cppcheck warnings; removing unused vars and a bit of cleanup.Walter Doekes
Patch by: Clod Patry Review: https://reviewboard.asterisk.org/r/1651 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-01Constify some more channel driver technology callback parameters.Richard Mudgett
Review: https://reviewboard.asterisk.org/r/1707/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353685 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-27Audit of ao2_iterator_init() usage for v1.8.Richard Mudgett
Fixes numerous reference leaks and missing ao2_iterator_destroy() calls as a result. Review: https://reviewboard.asterisk.org/r/1697/ ........ Merged revisions 352955 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 352956 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-24Opaquify channel stringfieldsTerry Wilson
Continue channel opaque-ification by wrapping all of the stringfields. Eventually, we will restrict what can actually set these variables, but the purpose for now is to hide the implementation and keep people from adding code that directly accesses the channel structure. Semantic changes will follow afterward. Review: https://reviewboard.asterisk.org/r/1661/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352348 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-09Replace direct access to channel name with accessor functionsTerry Wilson
There are many benefits to making the ast_channel an opaque handle, from increasing maintainability to presenting ways to kill masquerades. This patch kicks things off by taking things a field at a time, renaming the field to '__do_not_use_${fieldname}' and then writing setters/getters and converting the existing code to using them. When all fields are done, we can move ast_channel to a C file from channel.h and lop off the '__do_not_use_'. This patch sets up main/channel_interal_api.c to be the only file that actually accesses the ast_channel's fields directly. The intent would be for any API functions in channel.c to use the accessor functions. No more monkeying around with channel internals. We should use our own APIs. The interesting changes in this patch are the addition of channel_internal_api.c, the moving of the AST_DATA stuff from channel.c to channel_internal_api.c (note: the AST_DATA stuff will have to be reworked to use accessor functions when ast_channel is really opaque), and some re-working of the way channel iterators/callbacks are handled so as to avoid creating fake ast_channels on the stack to pass in matching data by directly accessing fields (since "name" is a stringfield and the fake channel doesn't init the stringfields, you can't use the ast_channel_name_set() function). I went with ast_channel_name(chan) for a getter, and ast_channel_name_set(chan, name) for a setter. The majority of the grunt-work for this change was done by writing a semantic patch using Coccinelle ( http://coccinelle.lip6.fr/ ). Review: https://reviewboard.asterisk.org/r/1655/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-04Fix documentation for SayNumber to reflect the fact that language is changed ↵Jonathan Rose
in CHANNEL() (closes issue ASTERISK-18962) reported by: Nir Simionovich ........ Merged revisions 349450 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 349451 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-23Fix extension state callback references in chan_sip.Richard Mudgett
Chan_sip gives a dialog reference to the extension state callback and assumes that when ast_extension_state_del() returns, the callback cannot happen anymore. Chan_sip then reduces the dialog reference count associated with the callback. Recent changes (ASTERISK-17760) have resulted in the potential for the callback to happen after ast_extension_state_del() has returned. For chan_sip, this could be very bad because the dialog pointer could have already been destroyed. * Added ast_extension_state_add_destroy() so chan_sip can account for the sip_pvt reference given to the extension state callback when the extension state callback is deleted. * Fix pbx.c awkward statecbs handling in ast_extension_state_add_destroy() and handle_statechange() now that the struct ast_state_cb has a destructor to call. * Ensure that ast_extension_state_add_destroy() will never return -1 or 0 for a successful registration. * Fixed pbx.c statecbs_cmp() to compare the correct information. The passed in value to compare is a change_cb function pointer not an object pointer. * Make pbx.c ast_merge_contexts_and_delete() not perform callbacks with AST_EXTENSION_REMOVED with locks held. Chan_sip is notorious for deadlocking when those locks are held during the callback. * Removed unused lock declaration for the pbx.c store_hints list. (closes issue ASTERISK-18844) Reported by: rmudgett Review: https://reviewboard.asterisk.org/r/1635/ ........ Merged revisions 348940 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 348952 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-16Fix crash during CDR update.Richard Mudgett
The ast_cdr_setcid() and ast_cdr_update() were shown in ASTERISK-18836 to be called by different threads for the same channel. The channel driver thread and the PBX thread running dialplan. * Add lock protection around CDR API calls that access an ast_channel pointer. (closes issue ASTERISK-18836) Reported by: gpluser Review: https://reviewboard.asterisk.org/r/1628/ ........ Merged revisions 348362 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 348363 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-09Fix some parsing issues in add_exten_to_pattern_tree().Richard Mudgett
* Simplify compare_char() and avoid potential sign extension issue. * Fix infinite loop in add_exten_to_pattern_tree() handling of character set escape handling. * Added buffer overflow checks in add_exten_to_pattern_tree() character set collection. * Made ignore empty character sets. * Added escape character handling to end-of-range character in character sets. This has a slight change in behavior if the end-of-range character is an escape character. You must now escape it. * Fix potential sign extension issue when expanding character set ranges. * Made remove duplicated characters from character sets. The duplicate characters lower extension matching priority and prevent duplicate extension detection. * Fix escape character handling when the escape character is trying to escape the end-of-string. We could have continued processing characters after the end of the exten string. We could have added the previous character to the pattern matching tree incorrectly. (closes issue ASTERISK-18909) Reported by: Luke-Jr ........ Merged revisions 347811 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 347812 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347813 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-06Documents CHANNEL(musicclass) taking priority over m([x]) in waitExtenJonathan Rose
If waitExten specifies a music class to use with its music on hold option, it will use CHANNEL(musicclass) instead if that channel variable has been set on the initiating channel. This documents that behavior in the waitExten app so that this can be known without checking the documentation of the code in function local_ast_moh_start. (closes issue ASTERISK-18804) ........ Merged revisions 347239 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 347240 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-05Resolve duplicate label used in multiple priorities for the same extension.Jonathan Rose
Prior to this patch, if labels with the same name were used for different priorities in the same extension, the new label would be accepted, but it would be unusable since attempts to reach that label would just go to the first one. Now pbx.c detects this, generates a warning in logs, and culls the label before adding it to the dialplan. (closes issue ASTERISK-18807) Reported by: Kenneth Shumard Patches: pbx.c.patch uploaded by Kenneth Shumard (License 5077) ........ Merged revisions 346954 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 346955 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346956 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-14Fix Progress spelling error in main/pbx.c.Richard Mudgett
(closes issue ASTERISK-18857) Reported by: David M Patches: mainpbx-trivial.patch (License #6326) patch uploaded by David M ........ Merged revisions 345219 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 345220 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@345221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-11Fix a segmentation fault when using an extension with CID matching and no CID.Jonathan Rose
Attempting to call an extension which used Caller ID matching with a channel that has an empty caller id string would result in a segmentation fault. (closes issue ASTERISK-18392 Reported By: Ales Zelenik ........ Merged revisions 344608 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 344609 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344610 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-31Fixed invalid memory access when adding extension to pattern match treeMatthew Jordan
When an extension is removed from a context, its entry in the pattern match tree is not deleted. Instead, the extension is marked as deleted. When an extension is removed and re-added, if that extension is also a prefix of another extension, several log messages would report an error and did not check whether or not the extension was deleted before accessing the memory. Additionally, if the extension was already in the tree but previously deleted, and the pattern was at the end of a match, the findonly flag was not honored and the extension would be erroneously undeleted. Additionaly, it was discovered that an IAX2 peer could be unregistered via the CLI, while at the same time it could be scheduled for unregistration by Asterisk. The unregistration method now checks to see if the peer was already unregistered before continuing with an unregistration. (closes issue ASTERISK-18135) Reported by: Jaco Kroon, Henry Fernandes, Kristijan Vrban Tested by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1526 ........ Merged revisions 342769 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 342770 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@342771 65c4cc65-6c06-0410-ace0-fbb531ad65f3