Commit Graph

41 Commits

Author SHA1 Message Date
Terry Wilson 34c55e8e7c Opaquify char * and char[] in ast_channel
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-13 17:27:06 +00:00
Terry Wilson 04da92c379 Replace direct access to channel name with accessor functions
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-09 22:15:50 +00:00
Kinsey Moore 389ac0cff1 Fix lua goto detection to prevent unexpected behavior with confbridge
A bug in the pbx_lua goto detection was causing the dialplan to hangup
unexpectedly after confbridge exited if it had called lua dialplan code during
execution.

Patch-by: Timo Teras
Acked-by: Matt Nicholson
(closes issue ASTERISK-18976)
........

Merged revisions 349928 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349929 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-06 21:26:16 +00:00
Matthew Nicholson f39cbc004d only process args that exist
ASTERISK-18395
........

Merged revisions 341809 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 341810 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@341811 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-21 16:42:56 +00:00
Matthew Nicholson 9c7a017540 don't limit the length of app and function arguments
ASTERISK-18395
........

Merged revisions 341806 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 341807 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@341808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-21 16:22:23 +00:00
Leif Madsen a525edea59 Merged revisions 328247 via svnmerge from
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-07-14 20:28:54 +00:00
Matthew Nicholson 7a1204d129 Default to starting an autoservice in pbx_lua. The autoservice is
automatically stopped when applications are executed, so this shouldn't cause
any problems.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@317806 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-06 19:14:39 +00:00
Matthew Nicholson d5e9ce9ab1 Make pbx_lua handle managing the autoservice better.
Make autoservice_start() and autoservice_stop() return nothing.  Also check if
the autoservice flag is set before starting or stopping the autoservice and
stop and start the autoservice when returning control to and getting control
from the pbx engine.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@317803 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-06 19:01:57 +00:00
Matthew Nicholson bccba53bcf Detect Goto in pbx_lua.
This code will actually detect any dialplan jump from any application that
calls ast_explicit_goto().  This change is only being done in trunk as it may
change the way some dialplans execute.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@317721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-06 18:04:23 +00:00
Russell Bryant ea4d4dfabf Merged revisions 317476 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r317476 | russell | 2011-05-05 17:47:57 -0500 (Thu, 05 May 2011) | 8 lines
  
  Add a datastore fixup to fix a pbx_lua crash.
  
  (closes issue #19055)
  Reported by: jamhed
  Patches:
        lua_datastore_fixup1.diff uploaded by mnicholson (license 96)
  Tested by: mnicholson, jamhed
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@317477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-05 22:49:36 +00:00
Russell Bryant f0f5e237bf Merged revisions 317474 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r317474 | russell | 2011-05-05 17:36:33 -0500 (Thu, 05 May 2011) | 2 lines
  
  Fix more "set but unused" warnings.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@317475 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-05 22:44:52 +00:00
Matthew Nicholson f6c2ebff45 Merged revisions 309585 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r309585 | mnicholson | 2011-03-04 13:38:25 -0600 (Fri, 04 Mar 2011) | 9 lines
  
  Merged revisions 309584 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r309584 | mnicholson | 2011-03-04 13:37:13 -0600 (Fri, 04 Mar 2011) | 2 lines
    
    Restore mysterious lua_pushvalue() call removed in r309494.  The mystery has been solved.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@309587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-04 19:38:59 +00:00
Matthew Nicholson 3ef45303e1 Merged revisions 309542 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r309542 | mnicholson | 2011-03-04 13:00:33 -0600 (Fri, 04 Mar 2011) | 11 lines
  
  Merged revisions 309541 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r309541 | mnicholson | 2011-03-04 12:59:20 -0600 (Fri, 04 Mar 2011) | 4 lines
    
    Check for errors from fseek() when loading config file, properly abort on errors from fread(), and supply a traceback for errors generated when loading the config file.
    
    Also, prepend a newline to traceback output so that the main error message is on it's own line.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@309543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-04 19:02:31 +00:00
Matthew Nicholson 8861d64ecc Merged revisions 309495 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r309495 | mnicholson | 2011-03-04 12:10:23 -0600 (Fri, 04 Mar 2011) | 9 lines
  
  Merged revisions 309494 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r309494 | mnicholson | 2011-03-04 11:55:57 -0600 (Fri, 04 Mar 2011) | 2 lines
    
    remove mysterious lua_pushvalue() that is never used
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@309496 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-04 18:11:43 +00:00
Matthew Nicholson b20fecdbbb Add support for defining hints from pbx_lua
(closes issue #16024)
Reported by: mnicholson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@309493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-04 17:44:44 +00:00
Matthew Nicholson 438ef2625a Merged revisions 309448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r309448 | mnicholson | 2011-03-04 09:59:25 -0600 (Fri, 04 Mar 2011) | 8 lines
  
  Export global symbols from pbx_lua to allow modules to be loaded.  Fixes a regression introduced in r278132.
  
  (closes issue #18671)
  Reported by: Igels
  Patches:
        pbx_lua_global_symbols1.diff uploaded by mnicholson (license 96)
  Tested by: Igels
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@309449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-04 16:00:05 +00:00
Tilghman Lesher b4e18d5660 Add load priority order, such that preload becomes unnecessary in most cases
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20 19:35:02 +00:00
Tilghman Lesher a7498ae02e Use configure to determine the prefixes and include directories properly.
This ensures cross-platform compatibility, even among Linux distributions,
which don't always put headers in the same place.

(closes issue #17391)
 Reported by: loloski


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-26 00:29:40 +00:00
Matthew Nicholson a723865e5c Load pbx_lua with global symbols to allow linking with other lua libraries.
Found by Maxim Litnitskiy.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@231189 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-25 15:42:48 +00:00
Tilghman Lesher 01fd08d5b9 If lua is detected with the lua5.1 prefix (or not), adjust the include path accordingly.
Based upon feedback to a release announcement on the -users list.  See
http://lists.digium.com/pipermail/asterisk-users/2009-August/236954.html


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@214819 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-30 06:43:04 +00:00
Kevin P. Fleming 82fb56886e More 'static' qualifiers on module global variables.
The 'pglobal' tool is quite handy indeed :-)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-15 17:34:30 +00:00
Kevin P. Fleming bd4eb070f3 bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 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-02 18:52:13 +00:00
Steve Murphy 1c2b1eb928 (closes issue #13564)
Reported by: mnicholson
Patches:
      pbx_lua9.diff uploaded by mnicholson (license 96)

Many thanks to Matt for his upgrade to the lua dialplan
option! 

the Description from the bug:

This patch adds a stack trace to errors encountered while executing lua extensions. The patch also handles out of memory errors reported by lua.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@144681 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-26 18:02:06 +00:00
Steve Murphy a36696f2e7 (closes issue #13559)
Reported by: mnicholson
Patches:
      pbx_lua8.diff uploaded by mnicholson (license 96)




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@144563 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-25 21:54:11 +00:00
Steve Murphy 38028fa641 I added a little verbage to hashtab for the hashtab_destroy func.
It was pretty sparsely documented.

This update fleshes out the pbx_lua module, to 
add the switch statements to the extensions in the
extensions.lua file, as well as removing them when
the module is unloaded.

Many thanks to Matt Nicholson for his fine
contribution!




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@144523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-25 21:18:12 +00:00
Steve Murphy f8ddaae70b (closes issue #13558)
Reported by: mnicholson

Considering that the example extensions.lua used nothing but ["12345"] notation,
and that the resulting error message: 

[Sep 24 17:01:16] ERROR[12393]: pbx_lua.c:1204 exec: Error executing lua extension: attempt to call a nil value

is not very informative as to the nature of the problem, I think this bug
fix is a big win!





git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@144482 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-25 17:51:11 +00:00
Kevin P. Fleming 7df8b8b848 make datastore creation and destruction a generic API since it is not really channel related, and add the ability to add/find/remove datastores to manager sessions
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135680 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-05 16:56:11 +00:00
Kevin P. Fleming 71b3fd1ef7 various minor fixes created while i worked on getting *every* Asterisk module to build on laptop in dev mode:
remove weird pre-setting of LUA paths; they are not necessary; also use the proper path for including the files in pbx_lua.c

add searching for OpenAIS libraries in /usr/lib/openais if a path is not specified; not sure if this is really the optimal solution, but it works

make the compiler shut up about some ignored function results in pbx_gtkconsole; this module is badly coded anyway



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@126356 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-29 16:19:29 +00:00
Russell Bryant 9eb8e7d665 Lock the channel around datastore access
(closes issue #12527)
Reported by: mnicholson
Patches:
      pbx_lua4.diff uploaded by mnicholson (license 96)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114676 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-25 22:04:46 +00:00
Jason Parker fc607d5be4 Update documentation for pbx_lua.
Closes issue #11492, patch by mnicholson.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 21:28:49 +00:00
Luigi Rizzo 7e8835e0d7 remove another set of redundant #include "asterisk/options.h"
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89512 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 23:24:55 +00:00
Tilghman Lesher cbfc6dcbea Make trunk build again
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89468 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-20 23:29:33 +00:00
Luigi Rizzo ffd86fc964 more errno.h removal
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89432 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-19 21:12:08 +00:00
Russell Bryant 49d1248c55 fix the build of pbx_lua
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89362 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-17 06:34:10 +00:00
Luigi Rizzo fdb7f7ba3d Start untangling header inclusion in a way that does not affect
build times - tested, there is no measureable difference before and
after this commit.

In this change:

use asterisk/compat.h to include a small set of system headers:
inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h,
stdlib.h, alloca.h, stdio.h

Where available, the inclusion is conditional on HAVE_FOO_H as determined
by autoconf.

Normally, source files should not include any of the above system headers,
and instead use either "asterisk.h" or "asterisk/compat.h" which does it
better. 

For the time being I have left alone second-level directories
(main/db1-ast, etc.).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16 20:04:58 +00:00
Jason Parker cfbc4f5fb8 Doxygen fixes.
Also fix a common typo I kept seeing (arguement) in various files.

Closes issue #11222, patch by snuffy (with arguement > argument by me).


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-12 23:44:20 +00:00
Jason Parker 267e829cbd Add check_hangup() method to pbx_lua, which can be used to check whether it is time to hangup a channel.
Closes issue #11202, patch by mnicholson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-08 23:38:30 +00:00
Russell Bryant c93520b88b propagate the DECLINE return value back to the loader
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88376 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-02 21:39:36 +00:00
Russell Bryant 9a47852673 Don't kill asterisk if extensions.lua is not present.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88371 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-02 21:36:37 +00:00
Tilghman Lesher ca55e2f671 Oops, some dev-mode changes for ISO C90
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88287 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-02 17:34:33 +00:00
Tilghman Lesher e8c781b215 Add pbx_lua as a method of doing extensions
Reported by: mnicholson
Patch by: mnicholson
Closes issue #11140


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88250 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-02 15:36:34 +00:00