summaryrefslogtreecommitdiff
path: root/funcs/func_odbc.c
AgeCommit message (Collapse)Author
2018-01-04func_odbc: Add missing unlock's to acf_odbc_read.Corey Farrell
Change-Id: I828329ecbd252ae8f27a369a046d2b03102b07c6
2017-12-22Remove as much trailing whitespace as possible.Sean Bright
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-02-13cli: Fix various CLI documentation and completion issuesSean Bright
* app_minivm: Use built-in completion facilities to complete optional arguments. * app_voicemail: Use built-in completion facilities to complete optional arguments. * app_confbridge: Add missing colons after 'Usage' text. * chan_alsa: Use built-in completion facilities to complete optional arguments. * chan_sip: Use built-in completion facilities to complete optional arguments. Add completions for 'load' for 'sip show user', 'sip show peer', and 'sip qualify peer.' * chan_skinny: Correct and extend completions for 'skinny reset' and 'skinny show line.' * func_odbc: Correct completions for 'odbc read' and 'odbc write' * main/asterisk: Correct and extend completions for 'core show file version.' * main/astmm: Use built-in completion facilities to complete arguments for 'memory' commands. * main/bridge: Correct completions for 'bridge kick.' * main/ccss: Use built-in completion facilities to complete arguments for 'cc cancel' command. * main/cli: Add 'all' completion for 'channel request hangup.' Correct completions for 'core set debug channel.' Correct completions for 'core show calls.' * main/pbx_app: Remove redundant completions for 'core show applications.' * main/pbx_hangup_handler: Remove unused completions for 'core show hanguphandlers all.' * res_sorcery_memory_cache: Add completion for 'reload' argument of 'sorcery memory cache stale' and properly implement. Change-Id: Iee58c7392f6fec34ad9d596109117af87697bbca
2016-07-10func_odbc: Fix connection deadlock.Joshua Colp
The func_odbc module was modified to ensure that the previous behavior of using a single database connection was maintained. This was done by getting a single database connection and holding on to it. With the new multiple connection support in res_odbc this will actually starve every other thread from getting access to the database as it also maintains the previous behavior of having only a single database connection. This change disables the func_odbc specific behavior if the res_odbc module is running with only a single database connection active. The connection is only kept for the duration of the request. ASTERISK-26177 #close Change-Id: I9bdbd8a300fb3233877735ad3fd07bce38115b7f
2016-05-20func_odbc: single database connection should be optionalAlexei Gradinari
func_odbc was changed in Asterisk 13.9.0 to make func_odbc use a single database connection per DSN because of reported bug ASTERISK-25938 with MySQL/MariaDB LAST_INSERT_ID(). This is drawback in performance when func_odbc is used very often in dialplan. Single database connection should be optional. ASTERISK-26010 Change-Id: I57d990616c957dabf7597dea5d5c3148f459dfb6
2016-04-27func_odbc: Check connection status before executing queries.Mark Michelson
A recent change to func_odbc made it so that a single connection was maintained per DSN. The problem was that the code was optimistic about the health of the connection after initially opening it and did nothing to re-connect in case the connection had died. This change adds a check before executing a query to ensure that the connection to the database is still up and running. ASTERISK-25963 #close Reported by Ross Beer Change-Id: Id33c86eb04ff48ca088bb2e3086c27b3b683491d
2016-04-22func_odbc: Use one connection per DSN.Mark Michelson
res_odbc was changed in Asterisk 13.8.0 to remove connection management, opting instead to let unixodbc maintain open connections and return those to Asterisk as requested. This was a boon for realtime, since it meant that multiple threads could potentially run parallel queries since they could each be using their own database connections. However, on the user-facing side, func_odbc, there were some inherent behaviors being relied on that no longer hold true after the change. One such reported behavior was that MySQL's LAST_INSERTED_ID() works per-connection. This means that if Asterisk uses separate connections for every database operation, whereas before it used one connection for everything, we have broken expectations and functionality. The fix provided in this patch is to make func_odbc use a single database connection per DSN. This way, user-facing database usage will have the same behavior as it did pre-13.8.0. However, realtime, which is the real workhorse of database interaction, will continue to let unixodbc manage connections. ASTERISK-25938 #close Reported by Edwin Vandamme Change-Id: Iac961fe79154c6211569afcdfec843c0c24c46dc
2016-01-29res_odbc: Remove connection managementMark Michelson
Asterisk by default will create a single database connection and share it among all threads that attempt to access the database. In previous versions of Asterisk, this was tolerable, because the most used channel driver, chan_sip, mostly accessed the database from a single thread. With PJSIP, however, many threads may be attempting to perform database operations, and there is the potential for many more database accesses, meaning the concurrency is a horrible bottleneck if only one connection is shared. Asterisk has a connection pooling facility built into it, but the implementation has flaws. For one, there is a strict limit on the number of simultaneous connections that could be made to the database. Anything beyond the maximum would result in a failed operation. Attempting to predict what the maximum should be is nearly impossible even for someone intimately familiar with Asterisk's threading model. In addition, use of transactions in the dialplan can cause some severe bugs if connection pooling is enabled. This commit seeks to fix the concurrency problem by removing all connection management code from Asterisk and leaving that to the underlying unixODBC code instead. Now, Asterisk does not share a single connection, nor does it try to maintain a connection pool. Instead, all Asterisk ever does is request a connection from unixODBC and allow unixODBC to either allocate those connections or retrieve them from a pool. Doing this has a bit of a ripple effect. For one, since connections are not long-lived objects, several of the safeguards that previously existed have been removed. We don't have to worry about trying to use a connection that has gone stale. In every case, when we request a connection, it has just been made and we don't need to perform any sanity checks to be sure it's still active. Another major player affected by this change is transactions. Transactions and their respective connections were so tightly coupled that it was almost pornographic. This code change moves transaction-related code to its own file separate from the core ODBC functionality. This way, the core of ODBC does not even have to know that transactions exist. In making this large change, I had to look at a lot of code and understand it. When making this change, I discovered several places where the behavior is definitely not ideal, but it seemed outside the scope of this change to be fixing it. Instead, any place where I saw some sort of room for improvement has had a XXX comment added explaining what could be altered to improve it. Change-Id: I37a84def5ea4ddf93868ce8105f39de078297fbf
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-03func_odbc: Fix fixed size buffers fix (r414968).Walter Doekes
The change that removed the fixed size buffers in odbc-related code -- removing arbitrary column width limits -- was incomplete. This change adds: no segfault on writesql without insertsql and return value checks after strdup. While I was in the vicinity I cleaned up the linefeeds in the odbc function descriptions, moved some code for clarity, removed some blobs and noted (but didn't fix) that the 'odbc write ... exec' CLI command doesn't behave as the dialplan equivalent when insertsql= is used. ASTERISK-23582 #close Review: https://reviewboard.asterisk.org/r/3579/ ........ Merged revisions 414997 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 414998 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 414999 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415000 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-28res_config_odbc: Use dynamically sized buffers to store row data so values ↵Joshua Colp
do not get truncated. ASTERISK-23582 #close ASTERISk-23582 #comment Reported by: Walter Doekes Review: https://reviewboard.asterisk.org/r/3557/ ........ Merged revisions 414693 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 414694 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 414695 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-27Fix dialplan function NULL channel safety issuesCorey Farrell
(closes issue ASTERISK-23391) Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/3386/ ........ Merged revisions 411313 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 411314 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 411315 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411328 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-21Fix misuses of asprintf throughout the code.Mark Michelson
This fixes three main issues * Change asprintf() uses to ast_asprintf() so that it pairs properly with ast_free() and no longer causes MALLOC_DEBUG to freak out. * When ast_asprintf() fails, set the pointer NULL if it will be referenced later. * Fix some memory leaks that were spotted while taking care of the first two points. (Closes issue ASTERISK-20135) reported by Richard Mudgett Review: https://reviewboard.asterisk.org/r/2071 ........ Merged revisions 371590 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 371591 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 371592 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371593 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-05-18Fix more memory leaksMatthew Jordan
This patch adds to what was fixed in r366880. Specifically, it addresses the following: * chan_sip: dispose of an allocated frame in off nominal code paths in sip_rtp_read * func_odbc: when disposing of an allocated resultset, ensure that any rows that were appended to that resultset are also disposed of * cli: free the created return string buffer in another off nominal code path * chan_dahdi: free a frame that was allocated by the dsp layer if we choose not to process that frame (issue ASTERISK-19665) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1922/ ........ Merged revisions 366944 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366948 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366955 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-04-17Avoid cppcheck warnings; removing unused vars and a bit of cleanup.Walter Doekes
Patch by: junky Review: https://reviewboard.asterisk.org/r/1743/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362307 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-01-24Fix locking issues with channel datastores in func_odbc.c.Richard Mudgett
* Fixed a potential memory leak when an existing datastore is manually destroyed by inline code instead of calling ast_datastore_free(). (closes issue ASTERISK-17948) Reported by: Archie Cobbs Review: https://reviewboard.asterisk.org/r/1687/ ........ Merged revisions 352291 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 352292 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352293 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-26Merged revisions 337974 via svnmerge from Richard Mudgett
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r337974 | rmudgett | 2011-09-26 14:35:23 -0500 (Mon, 26 Sep 2011) | 37 lines Merged revisions 337973 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r337973 | rmudgett | 2011-09-26 14:30:39 -0500 (Mon, 26 Sep 2011) | 30 lines Fix deadlock when using dummy channels. Dummy channels created by ast_dummy_channel_alloc() should be destoyed by ast_channel_unref(). Using ast_channel_release() needlessly grabs the channel container lock and can cause a deadlock as a result. * Analyzed use of ast_dummy_channel_alloc() and made use ast_channel_unref() when done with the dummy channel. (Primary reason for the reported deadlock.) * Made app_dial.c:dial_exec_full() not call ast_call() holding any channel locks. Chan_local could not perform deadlock avoidance correctly. (Potential deadlock exposed by this issue. Secondary reason for the reported deadlock since the held lock was part of the deadlock chain.) * Fixed some uses of ast_dummy_channel_alloc() not checking the returned channel pointer for failure. * Fixed some potential chan=NULL pointer usage in func_odbc.c. Protected by testing the bogus_chan value. * Fixed needlessly clearing a 1024 char auto array when setting the first char to zero is enough in manager.c:action_getvar(). (closes issue ASTERISK-18613) Reported by: Thomas Arimont Patches: jira_asterisk_18613_v1.8.patch (license #5621) patch uploaded by rmudgett Tested by: Thomas Arimont ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337975 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-18Merged revisions 328541 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.10 ................ r328541 | tilghman | 2011-07-18 02:11:26 -0500 (Mon, 18 Jul 2011) | 9 lines Merged revisions 328540 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r328540 | tilghman | 2011-07-18 02:10:15 -0500 (Mon, 18 Jul 2011) | 2 lines Typo ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14Merged revisions 328247 via svnmerge from Leif Madsen
https://origsvn.digium.com/svn/asterisk/branches/1.10 ................ r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines Merged revisions 328209 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines Introduce <support_level> tags in MODULEINFO. This change introduces MODULEINFO into many modules in Asterisk in order to show the community support level for those modules. This is used by changes committed to menuselect by Russell Bryant recently (r917 in menuselect). More information about the support level types and what they mean is available on the wiki at https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-12Merged revisions 310415 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r310415 | tilghman | 2011-03-12 14:05:46 -0600 (Sat, 12 Mar 2011) | 14 lines Merged revisions 310414 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r310414 | tilghman | 2011-03-12 13:51:23 -0600 (Sat, 12 Mar 2011) | 7 lines Transactional handles should be used for the insertbuf, if available. Also, fix a possible resource leak. (closes issue #18943) Reported by: irroot ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@310416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-10Merged revisions 310142 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r310142 | tilghman | 2011-03-09 23:53:29 -0600 (Wed, 09 Mar 2011) | 19 lines Merged revisions 310141 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r310141 | tilghman | 2011-03-09 23:51:37 -0600 (Wed, 09 Mar 2011) | 12 lines Merged revisions 310140 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r310140 | tilghman | 2011-03-09 23:38:44 -0600 (Wed, 09 Mar 2011) | 5 lines Initialize column size to 0 to deal with a potential UnixODBC bug on 64-bit systems. (closes issue #18295) Reported by: pruiz ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@310143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-28Merged revisions 308991 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r308991 | tilghman | 2011-02-28 03:33:22 -0600 (Mon, 28 Feb 2011) | 14 lines Merged revisions 308990 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r308990 | tilghman | 2011-02-28 03:32:22 -0600 (Mon, 28 Feb 2011) | 7 lines Statements updating zero rows may return SQL_NO_DATA. This is fine; it's handled. (closes issue #18815) Reported by: irroot Patches: func_odbc.insert_nodata.patch uploaded by irroot (license 52) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@308992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-15Merged revisions 307837 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r307837 | tilghman | 2011-02-15 01:02:45 -0600 (Tue, 15 Feb 2011) | 15 lines Merged revisions 307836 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r307836 | tilghman | 2011-02-15 01:01:37 -0600 (Tue, 15 Feb 2011) | 8 lines Need to retrieve the rows affected before using the associated variable. (closes issue #18795) Reported by: irroot Patches: 20110211__issue18795.diff.txt uploaded by tilghman (license 14) Tested by: tilghman ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@307838 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-08-24Merged revisions 283350 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r283350 | russell | 2010-08-24 07:49:41 -0500 (Tue, 24 Aug 2010) | 2 lines Don't attempt to release a NULL ODBC handle. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@283351 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-03Handle OOM errors more gracefully.Tilghman Lesher
(closes issue #17084) Reported by: falves11 Patches: issue17084_162_A.diff uploaded by falves11 (license 374) Tested by: falves11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267669 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-07Double free crashTilghman Lesher
(closes issue #17245) Reported by: thedavidfactor Patches: 20100426__issue17245.diff.txt uploaded by tilghman (license 14) Tested by: murraytm git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-07Allow multiple rows to be fetched within the normal mode of operation.Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@216846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-10AST-2009-005Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-09Convert func_odbc to use ast_dummy_alloc_channel()Matthew Nicholson
Review: https://reviewboard.asterisk.org/r/290/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205666 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26Merge the new Channel Event Logging (CEL) subsystem.Russell Bryant
CEL is the new system for logging channel events. This was inspired after facing many problems trying to represent what is possible to happen to a call in Asterisk using CDR records. For more information on CEL, see the built in HTML or PDF documentation generated from the files in doc/tex/. Many thanks to Steve Murphy (murf) and Brian Degenhardt (bmd) for their hard work developing this code. Also, thanks to Matt Nicholson (mnicholson) and Sean Bright (seanbright) for their assistance in the final push to get this code ready for Asterisk trunk. Review: https://reviewboard.asterisk.org/r/239/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-15More 'static' qualifiers on module global variables.Kevin P. Fleming
The 'pglobal' tool is quite handy indeed :-) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-21Const-ify the world (or at least a good part of it)Kevin P. Fleming
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes: - CLI command handlers - CLI command handler arguments - AGI command handlers - AGI command handler arguments - Dialplan application handler arguments - Speech engine API function arguments In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing. Review: https://reviewboard.asterisk.org/r/251/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-07Second result should not contain data from the first result.Tilghman Lesher
(closes issue #15039) Reported by: jims Patches: 20090506__issue15039.diff.txt uploaded by tilghman (license 14) Tested by: jims git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193006 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24Convert the ast_channel data structure over to the astobj2 framework.Russell Bryant
There is a lot that could be said about this, but the patch is a big improvement for performance, stability, code maintainability, and ease of future code development. The channel list is no longer an unsorted linked list. The main container for channels is an astobj2 hash table. All of the code related to searching for channels or iterating active channels has been rewritten. Let n be the number of active channels. Iterating the channel list has gone from O(n^2) to O(n). Searching for a channel by name went from O(n) to O(1). Searching for a channel by extension is still O(n), but uses a new method for doing so, which is more efficient. The ast_channel object is now a reference counted object. The benefits here are plentiful. Some benefits directly related to issues in the previous code include: 1) When threads other than the channel thread owning a channel wanted access to a channel, it had to hold the lock on it to ensure that it didn't go away. This is no longer a requirement. Holding a reference is sufficient. 2) There are places that now require less dealing with channel locks. 3) There are places where channel locks are held for much shorter periods of time. 4) There are places where dealing with more than one channel at a time becomes _MUCH_ easier. ChanSpy is a great example of this. Writing code in the future that deals with multiple channels will be much easier. Some additional information regarding channel locking and reference count handling can be found in channel.h, where a new section has been added that discusses some of the rules associated with it. Mark Michelson also assisted with the development of this patch. He did the conversion of ChanSpy and introduced a new API, ast_autochan, which makes it much easier to deal with holding on to a channel pointer for an extended period of time and having it get automatically updated if the channel gets masqueraded. Mark was also a huge help in the code review process. Thanks to David Vossel for his assistance with this branch, as well. David did the conversion of the DAHDIScan application by making it become a wrapper for ChanSpy internally. The changes come from the svn/asterisk/team/russell/ast_channel_ao2 branch. Review: http://reviewboard.digium.com/r/203/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190423 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-08If the first column is empty, output a delimiter anyway.Tilghman Lesher
(closes issue #14848) Reported by: john8675309 Patches: 20090408__bug14848.diff.txt uploaded by tilghman (license 14) Tested by: john8675309 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-19ODBC transaction supportTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177320 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17Add assertions in the quest to track down a refcount leak.Tilghman Lesher
(closes issue #14485) Reported by: davevg git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-19ast_str_SQLGetData is *not* part of the ast_str API, it's part of the ↵Kevin P. Fleming
ast_odbc API and just happens to use an ast_str as the buffer; move all of it to res_odbc.c and res_odbc.h, renaming appropriately along the way fix some minor coding style issues in strings.h and add some attribute_pure annotations to functions in the ast_str API git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169438 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-15remove the PBX_ODBC logic from the configure script, and add GENERIC_ODCB ↵Kevin P. Fleming
logic that includes copying the relevant LIB and INCLUDE data from either UnixODBC or iODBC, based on which was found; if both were found, prefer UnixODBC this stops modules from being linked against both sets of libraries on systems that have both installed git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13Merge ast_str_opaque branch (discontinue usage of ast_str internals)Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-09Avoid allocating memory for a thread that don't need it. Also, this memory ↵Eliel C. Sardanons
was not being freed until the main thread ends. (That is never). (closes issue #14040) Reported by: eliel Patches: func_odbc.c.patch uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07Two bugs relating to colnames found by Marquis42 on #asterisk-devTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155395 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-04improve configure script to remember the previous value of each dependency ↵Kevin P. Fleming
in build_tools/menuselect-deps, so that (once it has been written) menuselect can use this information to warn the user when a previously met dependency is no longer met along the way, change tags used in configure script, menuselect-deps and code for various dependencies to be consistently named git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154151 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-03Should have passed the string pointer, not the ast_str structure.Tilghman Lesher
(closes issue #13830) Reported by: Marquis git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154023 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-02bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 ↵Kevin P. Fleming
branch, and add the ones needed for all the new code here too git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-01Merge changes from team/group/appdocsxmlRussell Bryant
This commit introduces the first phase of an effort to manage documentation of the interfaces in Asterisk in an XML format. Currently, a new format is available for applications and dialplan functions. A good number of conversions to the new format are also included. For more information, see the following message to asterisk-dev: http://lists.digium.com/pipermail/asterisk-dev/2008-October/034968.html git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-31Failover for func_odbc, allowing an INSERT query to be performed when the ↵Tilghman Lesher
UPDATE query initially affects 0 rows. (closes issue #13083) Reported by: Corydon76 Patches: 20081031__bug13083.diff.txt uploaded by Corydon76 (license 14) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153124 65c4cc65-6c06-0410-ace0-fbb531ad65f3