Add pbx_lua as a method of doing extensions
Reported by: mnicholson Patch by: mnicholson Closes issue #11140 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@88250 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
91e1d7a423
commit
bad99f6a2a
|
@ -11,6 +11,7 @@ IMAP_TK=@PBX_IMAP_TK@
|
|||
IXJUSER=@PBX_IXJUSER@
|
||||
KDE=@PBX_KDE@
|
||||
LTDL=@PBX_LTDL@
|
||||
LUA=@PBX_LUA@
|
||||
NBS=@PBX_NBS@
|
||||
NETSNMP=@PBX_NETSNMP@
|
||||
NEWT=@PBX_NEWT@
|
||||
|
|
|
@ -0,0 +1,208 @@
|
|||
|
||||
|
||||
CONSOLE = "Console/dsp" -- Console interface for demo
|
||||
--CONSOLE = "Zap/1"
|
||||
--CONSOLE = "Phone/phone0"
|
||||
|
||||
IAXINFO = "guest" -- IAXtel username/password
|
||||
--IAXINFO = "myuser:mypass"
|
||||
|
||||
TRUNK = "Zap/g2"
|
||||
TRUNKMSD = 1
|
||||
-- TRUNK = "IAX2/user:pass@provider"
|
||||
|
||||
|
||||
--
|
||||
-- Extensions are expected to be defined in a global table named 'extensions'.
|
||||
-- The 'extensions' table should have a group of tables in it, each
|
||||
-- representing a context. Extensions are defined in each context. See below
|
||||
-- for examples.
|
||||
--
|
||||
-- This file can be automatically included in the extensions.conf file using
|
||||
-- the 'utils/build-extensions-conf.lua' script and a #exec statement in
|
||||
-- extensions.conf.
|
||||
--
|
||||
-- #exec /usr/bin/utils/build-extensions.conf.lua -c
|
||||
--
|
||||
-- The 'execincludes' option must be set to 'yes' in the [options] section of
|
||||
-- asterisk.conf for this to work properly.
|
||||
--
|
||||
-- Extension names may be numbers, letters, or combinations thereof. If
|
||||
-- an extension name is prefixed by a '_' character, it is interpreted as
|
||||
-- a pattern rather than a literal. In patterns, some characters have
|
||||
-- special meanings:
|
||||
--
|
||||
-- X - any digit from 0-9
|
||||
-- Z - any digit from 1-9
|
||||
-- N - any digit from 2-9
|
||||
-- [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
|
||||
-- . - wildcard, matches anything remaining (e.g. _9011. matches
|
||||
-- anything starting with 9011 excluding 9011 itself)
|
||||
-- ! - wildcard, causes the matching process to complete as soon as
|
||||
-- it can unambiguously determine that no other matches are possible
|
||||
--
|
||||
-- For example the extension _NXXXXXX would match normal 7 digit
|
||||
-- dialings, while _1NXXNXXXXXX would represent an area code plus phone
|
||||
-- number preceded by a one.
|
||||
--
|
||||
-- If your extension has special characters in it such as '.' and '!' you must
|
||||
-- explicitly make it a string in the tabale definition:
|
||||
--
|
||||
-- ["_special."] = function;
|
||||
-- ["_special!"] = function;
|
||||
--
|
||||
-- There are no priorities. All extensions to asterisk appear to have a single
|
||||
-- priority as if they consist of a single priority.
|
||||
--
|
||||
-- Each context is defined as a table in the extensions table. The
|
||||
-- context names should be strings.
|
||||
--
|
||||
-- One context may be included in another context using the 'includes'
|
||||
-- extension. This extension should be set to a table containing a list
|
||||
-- of context names. Do not put references to tables in the includes
|
||||
-- table.
|
||||
--
|
||||
-- include = {"a", "b", "c"};
|
||||
--
|
||||
-- Channel variables can be accessed thorugh the global 'channel' table.
|
||||
--
|
||||
-- v = channel.var_name
|
||||
-- v = channel["var_name"]
|
||||
-- v.value
|
||||
-- v:get()
|
||||
--
|
||||
-- channel.var_name = "value"
|
||||
-- channel["var_name"] = "value"
|
||||
-- v:set("value")
|
||||
--
|
||||
-- channel.func_name(1,2,3):set("value")
|
||||
-- value = channel.func_name(1,2,3):get()
|
||||
--
|
||||
-- channel["func_name(1|2|3)"]:set("value")
|
||||
-- channel["func_name(1|2|3)"] = "value"
|
||||
-- value = channel["func_name(1|2|3)"]:get()
|
||||
--
|
||||
-- Note the use of the ':' operator to access the get() and set()
|
||||
-- methods.
|
||||
--
|
||||
-- Also notice the absence of the following constructs from the examples above:
|
||||
-- channel.func_name(1,2,3) = "value" -- this will NOT work
|
||||
-- value = channel.func_name(1,2,3) -- this will NOT work as expected
|
||||
--
|
||||
--
|
||||
-- Dialplan applications can be accessed through the global 'app' table.
|
||||
--
|
||||
-- app.Dial("Zap/1")
|
||||
-- app.dial("Zap/1")
|
||||
--
|
||||
-- More examples can be found below.
|
||||
--
|
||||
-- Before starting long running operations, an autoservice should be started
|
||||
-- using the autoservice_start() function. This autoservice will automatically
|
||||
-- be stopped before executing applications and dialplan functions and will be
|
||||
-- restarted afterwards. The autoservice can be stopped using
|
||||
-- autoservice_stop() and the autoservice_status() function will return true if
|
||||
-- an autoservice is currently running.
|
||||
--
|
||||
|
||||
function outgoing_local(c, e)
|
||||
app.dial("zap/1/" .. e, "", "")
|
||||
end
|
||||
|
||||
function demo_instruct()
|
||||
app.background("demo-instruct")
|
||||
app.waitexten()
|
||||
end
|
||||
|
||||
function demo_congrats()
|
||||
app.background("demo-congrats")
|
||||
demo_instruct()
|
||||
end
|
||||
|
||||
-- Answer the chanel and play the demo sound files
|
||||
function demo_start(context, exten)
|
||||
app.wait(1)
|
||||
app.answer()
|
||||
|
||||
channel.TIMEOUT("digit"):set(5)
|
||||
channel.TIMEOUT("response"):set(10)
|
||||
-- app.set("TIMEOUT(digit)=5")
|
||||
-- app.set("TIMEOUT(response)=10")
|
||||
|
||||
demo_congrats(context, exten)
|
||||
end
|
||||
|
||||
function demo_hangup()
|
||||
app.playback("demo-thanks")
|
||||
app.hangup()
|
||||
end
|
||||
|
||||
extensions = {
|
||||
demo = {
|
||||
s = demo_start;
|
||||
|
||||
["2"] = function()
|
||||
app.background("demo-moreinfo")
|
||||
demo_instruct()
|
||||
end;
|
||||
["3"] = function ()
|
||||
channel.LANGUAGE():set("fr") -- set the language to french
|
||||
demo_congrats()
|
||||
end;
|
||||
|
||||
["1000"] = function()
|
||||
app.goto("default", "s", 1)
|
||||
end;
|
||||
|
||||
["1234"] = function()
|
||||
app.playback("transfer", "skip")
|
||||
-- do a dial here
|
||||
end;
|
||||
|
||||
["1235"] = function()
|
||||
app.voicemail("1234", "u")
|
||||
end;
|
||||
|
||||
["1236"] = function()
|
||||
app.dial("Console/dsp")
|
||||
app.voicemail(1234, "b")
|
||||
end;
|
||||
|
||||
["#"] = demo_hangup;
|
||||
t = demo_hangup;
|
||||
i = function()
|
||||
app.playback("invalid")
|
||||
demo_instruct()
|
||||
end;
|
||||
|
||||
["500"] = function()
|
||||
app.playback("demo-abouttotry")
|
||||
app.dial("IAX2/guest@misery.digium.com/s@default")
|
||||
app.playback("demo-nogo")
|
||||
demo_instruct()
|
||||
end;
|
||||
|
||||
["600"] = function()
|
||||
app.playback("demo-echotest")
|
||||
app.echo()
|
||||
app.playback("demo-echodone")
|
||||
demo_instruct()
|
||||
end;
|
||||
|
||||
["8500"] = function()
|
||||
app.voicemailmain()
|
||||
demo_instruct()
|
||||
end;
|
||||
|
||||
};
|
||||
|
||||
default = {
|
||||
-- by default, do the demo
|
||||
include = {"demo"};
|
||||
};
|
||||
|
||||
["local"] = {
|
||||
["_NXXXXXX"] = outgoing_local;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh
|
||||
# From configure.ac Revision: 87325 .
|
||||
# From configure.ac Revision: 88184 .
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.61.
|
||||
#
|
||||
|
@ -765,6 +765,10 @@ LTDL_LIB
|
|||
LTDL_INCLUDE
|
||||
LTDL_DIR
|
||||
PBX_LTDL
|
||||
LUA_LIB
|
||||
LUA_INCLUDE
|
||||
LUA_DIR
|
||||
PBX_LUA
|
||||
MISDN_LIB
|
||||
MISDN_INCLUDE
|
||||
MISDN_DIR
|
||||
|
@ -1537,6 +1541,7 @@ Optional Packages:
|
|||
--with-isdnnet=PATH use ISDN4Linux Library files in PATH
|
||||
--with-kde=PATH use KDE files in PATH
|
||||
--with-ltdl=PATH use libtool files in PATH
|
||||
--with-lua=PATH use Lua files in PATH
|
||||
--with-misdn=PATH use mISDN User Library files in PATH
|
||||
--with-nbs=PATH use Network Broadcast Sound files in PATH
|
||||
--with-ncurses=PATH use ncurses files in PATH
|
||||
|
@ -7991,6 +7996,34 @@ PBX_LTDL=0
|
|||
|
||||
|
||||
|
||||
LUA_DESCRIP="Lua"
|
||||
LUA_OPTION="lua"
|
||||
|
||||
# Check whether --with-lua was given.
|
||||
if test "${with_lua+set}" = set; then
|
||||
withval=$with_lua;
|
||||
case ${withval} in
|
||||
n|no)
|
||||
USE_LUA=no
|
||||
;;
|
||||
y|ye|yes)
|
||||
ac_mandatory_list="${ac_mandatory_list} LUA"
|
||||
;;
|
||||
*)
|
||||
LUA_DIR="${withval}"
|
||||
ac_mandatory_list="${ac_mandatory_list} LUA"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
PBX_LUA=0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MISDN_DESCRIP="mISDN User Library"
|
||||
MISDN_OPTION="misdn"
|
||||
|
||||
|
@ -47072,6 +47105,399 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
|||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
LUA_INCLUDE="-I/usr/include/lua5.1"
|
||||
LUA_LIB="-llua5.1"
|
||||
|
||||
if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
|
||||
pbxlibdir=""
|
||||
if test "x${LUA_DIR}" != "x"; then
|
||||
if test -d ${LUA_DIR}/lib; then
|
||||
pbxlibdir="-L${LUA_DIR}/lib"
|
||||
else
|
||||
pbxlibdir="-L${LUA_DIR}"
|
||||
fi
|
||||
fi
|
||||
pbxfuncname="luaL_newstate"
|
||||
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
|
||||
AST_LUA_FOUND=yes
|
||||
else
|
||||
as_ac_Lib=`echo "ac_cv_lib_lua5.1_${pbxfuncname}" | $as_tr_sh`
|
||||
{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -llua5.1" >&5
|
||||
echo $ECHO_N "checking for ${pbxfuncname} in -llua5.1... $ECHO_C" >&6; }
|
||||
if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-llua5.1 ${pbxlibdir} $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char ${pbxfuncname} ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return ${pbxfuncname} ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
eval "$as_ac_Lib=yes"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_Lib=no"
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
ac_res=`eval echo '${'$as_ac_Lib'}'`
|
||||
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
echo "${ECHO_T}$ac_res" >&6; }
|
||||
if test `eval echo '${'$as_ac_Lib'}'` = yes; then
|
||||
AST_LUA_FOUND=yes
|
||||
else
|
||||
AST_LUA_FOUND=no
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if test "${AST_LUA_FOUND}" = "yes"; then
|
||||
LUA_LIB="-llua5.1 "
|
||||
LUA_HEADER_FOUND="1"
|
||||
if test "x${LUA_DIR}" != "x"; then
|
||||
LUA_LIB="${pbxlibdir} ${LUA_LIB}"
|
||||
LUA_INCLUDE="-I${LUA_DIR}/include"
|
||||
saved_cppflags="${CPPFLAGS}"
|
||||
CPPFLAGS="${CPPFLAGS} -I${LUA_DIR}/include"
|
||||
if test "xlua5.1/lua.h" != "x" ; then
|
||||
as_ac_Header=`echo "ac_cv_header_${LUA_DIR}/include/lua5.1/lua.h" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
{ echo "$as_me:$LINENO: checking for ${LUA_DIR}/include/lua5.1/lua.h" >&5
|
||||
echo $ECHO_N "checking for ${LUA_DIR}/include/lua5.1/lua.h... $ECHO_C" >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
fi
|
||||
ac_res=`eval echo '${'$as_ac_Header'}'`
|
||||
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
echo "${ECHO_T}$ac_res" >&6; }
|
||||
else
|
||||
# Is the header compilable?
|
||||
{ echo "$as_me:$LINENO: checking ${LUA_DIR}/include/lua5.1/lua.h usability" >&5
|
||||
echo $ECHO_N "checking ${LUA_DIR}/include/lua5.1/lua.h usability... $ECHO_C" >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <${LUA_DIR}/include/lua5.1/lua.h>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
echo "${ECHO_T}$ac_header_compiler" >&6; }
|
||||
|
||||
# Is the header present?
|
||||
{ echo "$as_me:$LINENO: checking ${LUA_DIR}/include/lua5.1/lua.h presence" >&5
|
||||
echo $ECHO_N "checking ${LUA_DIR}/include/lua5.1/lua.h presence... $ECHO_C" >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <${LUA_DIR}/include/lua5.1/lua.h>
|
||||
_ACEOF
|
||||
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null && {
|
||||
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
}; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
echo "${ECHO_T}$ac_header_preproc" >&6; }
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||
yes:no: )
|
||||
{ echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: proceeding with the compiler's result" >&5
|
||||
echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: proceeding with the compiler's result" >&2;}
|
||||
ac_header_preproc=yes
|
||||
;;
|
||||
no:yes:* )
|
||||
{ echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: present but cannot be compiled" >&5
|
||||
echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: present but cannot be compiled" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: check for missing prerequisite headers?" >&5
|
||||
echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: check for missing prerequisite headers?" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: see the Autoconf documentation" >&5
|
||||
echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: see the Autoconf documentation" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: section \"Present But Cannot Be Compiled\"" >&5
|
||||
echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: proceeding with the preprocessor's result" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: in the future, the compiler will take precedence" >&5
|
||||
echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: in the future, the compiler will take precedence" >&2;}
|
||||
|
||||
;;
|
||||
esac
|
||||
{ echo "$as_me:$LINENO: checking for ${LUA_DIR}/include/lua5.1/lua.h" >&5
|
||||
echo $ECHO_N "checking for ${LUA_DIR}/include/lua5.1/lua.h... $ECHO_C" >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
eval "$as_ac_Header=\$ac_header_preproc"
|
||||
fi
|
||||
ac_res=`eval echo '${'$as_ac_Header'}'`
|
||||
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
echo "${ECHO_T}$ac_res" >&6; }
|
||||
|
||||
fi
|
||||
if test `eval echo '${'$as_ac_Header'}'` = yes; then
|
||||
LUA_HEADER_FOUND=1
|
||||
else
|
||||
LUA_HEADER_FOUND=0
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
CPPFLAGS="${saved_cppflags}"
|
||||
else
|
||||
if test "xlua5.1/lua.h" != "x" ; then
|
||||
if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
|
||||
{ echo "$as_me:$LINENO: checking for lua5.1/lua.h" >&5
|
||||
echo $ECHO_N "checking for lua5.1/lua.h... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_header_lua5_1_lua_h" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_lua5_1_lua_h" >&6; }
|
||||
else
|
||||
# Is the header compilable?
|
||||
{ echo "$as_me:$LINENO: checking lua5.1/lua.h usability" >&5
|
||||
echo $ECHO_N "checking lua5.1/lua.h usability... $ECHO_C" >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <lua5.1/lua.h>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
echo "${ECHO_T}$ac_header_compiler" >&6; }
|
||||
|
||||
# Is the header present?
|
||||
{ echo "$as_me:$LINENO: checking lua5.1/lua.h presence" >&5
|
||||
echo $ECHO_N "checking lua5.1/lua.h presence... $ECHO_C" >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <lua5.1/lua.h>
|
||||
_ACEOF
|
||||
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null && {
|
||||
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
}; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
echo "${ECHO_T}$ac_header_preproc" >&6; }
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||
yes:no: )
|
||||
{ echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
echo "$as_me: WARNING: lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: proceeding with the compiler's result" >&5
|
||||
echo "$as_me: WARNING: lua5.1/lua.h: proceeding with the compiler's result" >&2;}
|
||||
ac_header_preproc=yes
|
||||
;;
|
||||
no:yes:* )
|
||||
{ echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: present but cannot be compiled" >&5
|
||||
echo "$as_me: WARNING: lua5.1/lua.h: present but cannot be compiled" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: check for missing prerequisite headers?" >&5
|
||||
echo "$as_me: WARNING: lua5.1/lua.h: check for missing prerequisite headers?" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: see the Autoconf documentation" >&5
|
||||
echo "$as_me: WARNING: lua5.1/lua.h: see the Autoconf documentation" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: section \"Present But Cannot Be Compiled\"" >&5
|
||||
echo "$as_me: WARNING: lua5.1/lua.h: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: lua5.1/lua.h: proceeding with the preprocessor's result" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: in the future, the compiler will take precedence" >&5
|
||||
echo "$as_me: WARNING: lua5.1/lua.h: in the future, the compiler will take precedence" >&2;}
|
||||
|
||||
;;
|
||||
esac
|
||||
{ echo "$as_me:$LINENO: checking for lua5.1/lua.h" >&5
|
||||
echo $ECHO_N "checking for lua5.1/lua.h... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_cv_header_lua5_1_lua_h=$ac_header_preproc
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_header_lua5_1_lua_h" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_lua5_1_lua_h" >&6; }
|
||||
|
||||
fi
|
||||
if test $ac_cv_header_lua5_1_lua_h = yes; then
|
||||
LUA_HEADER_FOUND=1
|
||||
else
|
||||
LUA_HEADER_FOUND=0
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
if test "x${LUA_HEADER_FOUND}" = "x0" ; then
|
||||
LUA_LIB=""
|
||||
LUA_INCLUDE=""
|
||||
else
|
||||
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
|
||||
LUA_LIB=""
|
||||
fi
|
||||
PBX_LUA=1
|
||||
# XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LUA 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LUA_VERSION
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
|
||||
pbxlibdir=""
|
||||
|
@ -56493,6 +56919,10 @@ LTDL_LIB!$LTDL_LIB$ac_delim
|
|||
LTDL_INCLUDE!$LTDL_INCLUDE$ac_delim
|
||||
LTDL_DIR!$LTDL_DIR$ac_delim
|
||||
PBX_LTDL!$PBX_LTDL$ac_delim
|
||||
LUA_LIB!$LUA_LIB$ac_delim
|
||||
LUA_INCLUDE!$LUA_INCLUDE$ac_delim
|
||||
LUA_DIR!$LUA_DIR$ac_delim
|
||||
PBX_LUA!$PBX_LUA$ac_delim
|
||||
MISDN_LIB!$MISDN_LIB$ac_delim
|
||||
MISDN_INCLUDE!$MISDN_INCLUDE$ac_delim
|
||||
MISDN_DIR!$MISDN_DIR$ac_delim
|
||||
|
@ -56537,10 +56967,6 @@ PGSQL_LIB!$PGSQL_LIB$ac_delim
|
|||
PGSQL_INCLUDE!$PGSQL_INCLUDE$ac_delim
|
||||
PGSQL_DIR!$PGSQL_DIR$ac_delim
|
||||
PBX_PGSQL!$PBX_PGSQL$ac_delim
|
||||
PRI_LIB!$PRI_LIB$ac_delim
|
||||
PRI_INCLUDE!$PRI_INCLUDE$ac_delim
|
||||
PRI_DIR!$PRI_DIR$ac_delim
|
||||
PBX_PRI!$PBX_PRI$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
|
||||
|
@ -56582,6 +57008,10 @@ _ACEOF
|
|||
ac_delim='%!_!# '
|
||||
for ac_last_try in false false false false false :; do
|
||||
cat >conf$$subs.sed <<_ACEOF
|
||||
PRI_LIB!$PRI_LIB$ac_delim
|
||||
PRI_INCLUDE!$PRI_INCLUDE$ac_delim
|
||||
PRI_DIR!$PRI_DIR$ac_delim
|
||||
PBX_PRI!$PBX_PRI$ac_delim
|
||||
SS7_LIB!$SS7_LIB$ac_delim
|
||||
SS7_INCLUDE!$SS7_INCLUDE$ac_delim
|
||||
SS7_DIR!$SS7_DIR$ac_delim
|
||||
|
@ -56675,10 +57105,6 @@ AST_DECLARATION_AFTER_STATEMENT!$AST_DECLARATION_AFTER_STATEMENT$ac_delim
|
|||
GSM_INTERNAL!$GSM_INTERNAL$ac_delim
|
||||
KDEINIT!$KDEINIT$ac_delim
|
||||
KDEDIR!$KDEDIR$ac_delim
|
||||
NETSNMP_CONFIG!$NETSNMP_CONFIG$ac_delim
|
||||
PG_CONFIG!$PG_CONFIG$ac_delim
|
||||
PTLIB_CONFIG!$PTLIB_CONFIG$ac_delim
|
||||
PWLIBDIR!$PWLIBDIR$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
|
||||
|
@ -56720,6 +57146,10 @@ _ACEOF
|
|||
ac_delim='%!_!# '
|
||||
for ac_last_try in false false false false false :; do
|
||||
cat >conf$$subs.sed <<_ACEOF
|
||||
NETSNMP_CONFIG!$NETSNMP_CONFIG$ac_delim
|
||||
PG_CONFIG!$PG_CONFIG$ac_delim
|
||||
PTLIB_CONFIG!$PTLIB_CONFIG$ac_delim
|
||||
PWLIBDIR!$PWLIBDIR$ac_delim
|
||||
PWLIB_INCDIR!$PWLIB_INCDIR$ac_delim
|
||||
PWLIB_LIBDIR!$PWLIB_LIBDIR$ac_delim
|
||||
PWLIB_PLATFORM!$PWLIB_PLATFORM$ac_delim
|
||||
|
@ -56744,7 +57174,7 @@ CURL_CONFIG!$CURL_CONFIG$ac_delim
|
|||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 26; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
|
|
@ -193,6 +193,7 @@ AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
|
|||
AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux Library], [isdnnet])
|
||||
AST_EXT_LIB_SETUP([KDE], [KDE], [kde])
|
||||
AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
|
||||
AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
|
||||
AST_EXT_LIB_SETUP([MISDN], [mISDN User Library], [misdn])
|
||||
AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
|
||||
AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
|
||||
|
@ -980,6 +981,10 @@ fi
|
|||
|
||||
AC_LANG_POP
|
||||
|
||||
LUA_INCLUDE="-I/usr/include/lua5.1"
|
||||
LUA_LIB="-llua5.1"
|
||||
AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h])
|
||||
|
||||
AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
|
||||
|
||||
AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
|
||||
|
|
|
@ -409,6 +409,12 @@
|
|||
/* Define to indicate the ${LTDL_DESCRIP} library version */
|
||||
#undef HAVE_LTDL_VERSION
|
||||
|
||||
/* Define this to indicate the ${LUA_DESCRIP} library */
|
||||
#undef HAVE_LUA
|
||||
|
||||
/* Define to indicate the ${LUA_DESCRIP} library version */
|
||||
#undef HAVE_LUA_VERSION
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
|
|
|
@ -507,6 +507,20 @@ int ast_extension_match(const char *pattern, const char *extension);
|
|||
|
||||
int ast_extension_close(const char *pattern, const char *data, int needmore);
|
||||
|
||||
/*!
|
||||
* \brief Determine if one extension should match before another
|
||||
*
|
||||
* \param a extension to compare with b
|
||||
* \param b extension to compare with a
|
||||
*
|
||||
* Checks whether or extension a should match before extension b
|
||||
*
|
||||
* \retval 0 if the two extensions have equal matching priority
|
||||
* \retval 1 on a > b
|
||||
* \retval -1 on a < b
|
||||
*/
|
||||
int ast_extension_cmp(const char *a, const char *b);
|
||||
|
||||
/*!
|
||||
* \brief Launch a new extension (i.e. new stack)
|
||||
*
|
||||
|
|
|
@ -806,6 +806,11 @@ static int ext_cmp(const char *a, const char *b)
|
|||
return (ret > 0) ? 1 : -1;
|
||||
}
|
||||
|
||||
int ast_extension_cmp(const char *a, const char *b)
|
||||
{
|
||||
return ext_cmp(a, b);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \brief used ast_extension_{match|close}
|
||||
|
|
|
@ -99,6 +99,9 @@ KDEDIR=@KDEDIR@
|
|||
KDE_INCLUDE=@KDE_INCLUDE@
|
||||
KDE_LIB=@KDE_LIB@
|
||||
|
||||
LUA_INCLUDE=@LUA_INCLUDE@
|
||||
LUA_LIB=@LUA_LIB@
|
||||
|
||||
NBS_INCLUDE=@NBS_INCLUDE@
|
||||
NBS_LIB=@NBS_LIB@
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,81 @@
|
|||
#!/usr/bin/env lua
|
||||
--[[
|
||||
|
||||
This utility can be used to generate an extensions.conf file to match an
|
||||
existing extensions.lua file. As an argument it takes the patch of the
|
||||
extensions.lua file to read from, otherwise it uses
|
||||
/etc/asterisk/extensions.lua.
|
||||
|
||||
This script can also be used to automatically include extensions.lua in
|
||||
extensions.conf via a #exec as well.
|
||||
|
||||
#exec /usr/bin/build-extensions-conf.lua -c
|
||||
|
||||
--]]
|
||||
|
||||
usage = [[
|
||||
|
||||
Usage:
|
||||
]] .. arg[0] .. [[ [options] [extensions.lua path]
|
||||
|
||||
This utility can generate an extensions.conf file with all of the contexts in
|
||||
your extensions.lua file defined as including the Lua switch. This is useful
|
||||
if you want to use your extensions.lua file exclusively. By using this utility
|
||||
you dont't have to create each extension in extensions.conf manually.
|
||||
|
||||
The resulting extensions.conf file is printed to standard output.
|
||||
|
||||
--contexts-only, -c Don't print the [global] or [general] sections. This
|
||||
is useful for including the generated file into an
|
||||
existing extensions.conf via #include or #exec.
|
||||
|
||||
--help, -h Print this message.
|
||||
|
||||
]]
|
||||
|
||||
extensions_file = "/etc/asterisk/extensions.lua"
|
||||
|
||||
options = {}
|
||||
|
||||
for k, v in ipairs(arg) do
|
||||
if v:sub(1, 1) == "-" then
|
||||
if v == "-h" or v == "--help" then
|
||||
print("match")
|
||||
options["help"] = true
|
||||
elseif v == "-c" or v == "--contexts-only" then
|
||||
options["contexts-only"] = true
|
||||
end
|
||||
else
|
||||
options["extensions-file"] = v
|
||||
end
|
||||
end
|
||||
|
||||
if options["help"] then
|
||||
io.stderr:write(usage)
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
if options["extensions-file"] then
|
||||
extensions_file = options["extensions-file"]
|
||||
end
|
||||
|
||||
result, error_message = pcall(dofile, extensions_file)
|
||||
|
||||
if not result then
|
||||
io.stderr:write(error_message .. "\n")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
if not extensions then
|
||||
io.stderr:write("Error: extensions table not found in '" .. extensions_file .. "'\n")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
if not options["contexts-only"] then
|
||||
io.stdout:write("[general]\n\n[globals]\n\n")
|
||||
end
|
||||
|
||||
for context, extens in pairs(extensions) do
|
||||
io.stdout:write("[" .. tostring(context) .. "]\nswitch => Lua\n\n")
|
||||
end
|
||||
|
Reference in New Issue