48 static char *
config =
"extensions.lua";
52 #define LUA_EXT_DATA_SIZE 256 54 #define LUA_EXT_DATA_SIZE 8192 56 #define LUA_BUF_SIZE 4096 61 #define LUA_GOTO_DETECTED 5 140 lua_pushlightuserdata(L, new_chan);
141 lua_setfield(L, LUA_REGISTRYINDEX,
"channel");
157 const char *
app_name = luaL_checkstring(L, 2);
161 lua_pushstring(L,
"name");
162 lua_pushstring(L, app_name);
165 luaL_getmetatable(L,
"application");
166 lua_setmetatable(L, -2);
188 int res, nargs = lua_gettop(L);
189 const char *data =
"";
196 lua_getfield(L, 1,
"name");
201 lua_pushstring(L,
"application '");
202 lua_pushstring(L, app_name);
203 lua_pushstring(L,
"' not found");
209 lua_getfield(L, LUA_REGISTRYINDEX,
"channel");
210 chan = lua_touserdata(L, -1);
218 data = lua_tostring(L, -1);
220 ast_verb(3,
"Executing [%s@%s:%d] %s(\"%s\", \"%s\")\n",
221 exten, context, priority,
226 lua_getfield(L, LUA_REGISTRYINDEX,
"autoservice");
227 autoservice = lua_toboolean(L, -1);
243 lua_pushinteger(L, res);
248 lua_pushstring(L, context);
250 lua_pushliteral(L,
"context");
252 lua_pushstring(L, exten);
254 lua_pushliteral(L,
"exten");
256 lua_pushinteger(L, priority);
258 lua_pushliteral(L,
"priority");
270 lua_pushliteral(L,
" changed from ");
273 lua_pushliteral(L,
" to ");
278 ast_debug(2,
"Goto detected: %s\n", lua_tostring(L, -1));
309 if (!lua_istable(L, 1)) {
310 lua_pushstring(L,
"User probably used '.' instead of ':' for retrieving a channel variable value");
314 lua_getfield(L, LUA_REGISTRYINDEX,
"channel");
315 chan = lua_touserdata(L, -1);
318 lua_getfield(L, 1,
"name");
322 lua_getfield(L, LUA_REGISTRYINDEX,
"autoservice");
323 autoservice = lua_toboolean(L, -1);
341 lua_pushstring(L, value);
366 if (!lua_istable(L, 1)) {
367 lua_pushstring(L,
"User probably used '.' instead of ':' for setting a channel variable");
371 lua_getfield(L, 1,
"name");
375 value = luaL_checkstring(L, 2);
377 lua_getfield(L, LUA_REGISTRYINDEX,
"channel");
378 chan = lua_touserdata(L, -1);
381 lua_getfield(L, LUA_REGISTRYINDEX,
"autoservice");
382 autoservice = lua_toboolean(L, -1);
406 lua_pushstring(L, context);
407 lua_setfield(L, LUA_REGISTRYINDEX,
"context");
409 lua_pushstring(L, exten);
410 lua_setfield(L, LUA_REGISTRYINDEX,
"exten");
412 lua_pushinteger(L, priority);
413 lua_setfield(L, LUA_REGISTRYINDEX,
"priority");
427 luaL_getmetatable(L,
"variable");
428 lua_setmetatable(L, -2);
431 lua_setfield(L, -2,
"name");
434 lua_setfield(L, -2,
"get");
437 lua_setfield(L, -2,
"set");
448 luaL_newmetatable(L,
"app");
450 lua_pushstring(L,
"__index");
454 lua_setmetatable(L, -2);
455 lua_setglobal(L,
"app");
466 luaL_newmetatable(L,
"channel_data");
468 lua_pushstring(L,
"__index");
472 lua_pushstring(L,
"__newindex");
476 lua_setmetatable(L, -2);
477 lua_setglobal(L,
"channel");
487 luaL_newmetatable(L,
"variable");
489 lua_pushstring(L,
"__call");
504 luaL_newmetatable(L,
"application");
506 lua_pushstring(L,
"__call");
521 lua_setglobal(L,
"autoservice_start");
524 lua_setglobal(L,
"autoservice_stop");
527 lua_setglobal(L,
"autoservice_status");
529 lua_pushboolean(L, 1);
530 lua_setfield(L, LUA_REGISTRYINDEX,
"autoservice");
541 lua_setglobal(L,
"check_hangup");
559 const char *
name = luaL_checkstring(L, 2);
564 lua_getfield(L, LUA_REGISTRYINDEX,
"channel");
565 chan = lua_touserdata(L, -1);
578 lua_pushstring(L, value);
579 lua_setfield(L, -2,
"value");
600 const char *
name = luaL_checkstring(L, 2);
601 const char *
value = luaL_checkstring(L, 3);
603 lua_getfield(L, LUA_REGISTRYINDEX,
"channel");
604 chan = lua_touserdata(L, -1);
607 lua_getfield(L, LUA_REGISTRYINDEX,
"autoservice");
608 autoservice = lua_toboolean(L, -1);
635 if (start <= nargs && !lua_isnil(L, start)) {
636 lua_pushvalue(L, start);
640 for (; i <= nargs; i++) {
641 if (lua_isnil(L, i)) {
642 lua_pushliteral(L,
",");
645 lua_pushliteral(L,
",");
651 lua_concat(L, concat);
672 int nargs = lua_gettop(L);
675 lua_getfield(L, 1,
"name");
676 lua_pushliteral(L,
"(");
678 lua_pushliteral(L,
")");
699 lua_getfield(L, LUA_REGISTRYINDEX,
"autoservice");
700 if (lua_toboolean(L, -1)) {
707 lua_getfield(L, LUA_REGISTRYINDEX,
"channel");
708 chan = lua_touserdata(L, -1);
713 lua_pushboolean(L, 1);
714 lua_setfield(L, LUA_REGISTRYINDEX,
"autoservice");
732 lua_getfield(L, LUA_REGISTRYINDEX,
"autoservice");
733 if (!lua_toboolean(L, -1)) {
740 lua_getfield(L, LUA_REGISTRYINDEX,
"channel");
741 chan = lua_touserdata(L, -1);
746 lua_pushboolean(L, 0);
747 lua_setfield(L, LUA_REGISTRYINDEX,
"autoservice");
762 lua_getfield(L, LUA_REGISTRYINDEX,
"autoservice");
777 lua_getfield(L, LUA_REGISTRYINDEX,
"channel");
778 chan = lua_touserdata(L, -1);
796 if (lua_isnumber(L, -1)) {
802 message_index = lua_gettop(L);
805 lua_pushliteral(L,
"\n");
807 lua_getglobal(L,
"debug");
808 if (!lua_istable(L, -1)) {
814 lua_getfield(L, -1,
"traceback");
815 if (!lua_isfunction(L, -1)) {
823 lua_pushvalue(L, message_index);
824 lua_remove(L, message_index);
826 lua_pushnumber(L, 2);
846 int extensions, extensions_order;
850 lua_setfield(L, LUA_REGISTRYINDEX,
"extensions_order");
851 lua_getfield(L, LUA_REGISTRYINDEX,
"extensions_order");
852 extensions_order = lua_gettop(L);
856 lua_getglobal(L,
"extensions");
857 extensions = lua_gettop(L);
858 if (lua_isnil(L, -1)) {
860 lua_pushstring(L,
"Unable to find 'extensions' table in extensions.lua\n");
868 for (lua_pushnil(L); lua_next(L, extensions); lua_pop(L, 1)) {
875 lua_pushvalue(L, context_name);
879 context_order = lua_gettop(L);
883 for (lua_pushnil(L); lua_next(L, context); lua_pop(L, 1)) {
884 int exten = lua_gettop(L) - 1;
885 #if LUA_VERSION_NUM < 502 886 lua_pushinteger(L, lua_objlen(L, context_order) + 1);
888 lua_pushinteger(L, lua_rawlen(L, context_order) + 1);
890 lua_pushvalue(L, exten);
891 lua_settable(L, context_order);
893 lua_settable(L, extensions_order);
898 lua_getglobal(L,
"table");
899 lua_getfield(L, -1,
"sort");
903 lua_pushvalue(L, context_name);
904 lua_gettable(L, extensions_order);
909 if (lua_pcall(L, 2, 0, 0)) {
940 lua_getglobal(L,
"extensions");
941 extensions = lua_gettop(L);
942 if (lua_isnil(L, -1)) {
944 lua_pushstring(L,
"Unable to find 'extensions' table in extensions.lua\n");
951 for (lua_pushnil(L); lua_next(L, extensions); lua_pop(L, 1)) {
954 const char *context_str = lua_tostring(L, context_name);
961 lua_pushstring(L,
"Failed to find or create context\n");
969 lua_pushstring(L,
"Unable to create switch for context\n");
998 lua_getglobal(L,
"hints");
999 hints = lua_gettop(L);
1000 if (lua_isnil(L, -1)) {
1009 for (lua_pushnil(L); lua_next(L, hints); lua_pop(L, 1)) {
1012 const char *context_str = lua_tostring(L, context_name);
1019 lua_pushstring(L,
"Failed to find or create context\n");
1024 for (lua_pushnil(L); lua_next(L, context); lua_pop(L, 1)) {
1025 const char *hint_value = lua_tostring(L, -1);
1026 const char *hint_name;
1034 lua_pushvalue(L, -2);
1035 if (!(hint_name = lua_tostring(L, -1))) {
1041 if (
ast_add_extension2(con, 0, hint_name,
PRIORITY_HINT,
NULL,
NULL, hint_value,
NULL,
NULL,
registrar,
NULL, 0)) {
1045 lua_pushstring(L,
"Error creating hint\n");
1069 const char *
a = luaL_checkstring(L, -2);
1070 const char *
b = luaL_checkstring(L, -1);
1073 lua_pushboolean(L, 1);
1075 lua_pushboolean(L, 0);
1099 if (!(f = fopen(path,
"r"))) {
1100 lua_pushstring(L,
"cannot open '");
1101 lua_pushstring(L, path);
1102 lua_pushstring(L,
"' for reading: ");
1103 lua_pushstring(L, strerror(
errno));
1106 *file_not_openable = 1;
1111 if (fseek(f, 0l, SEEK_END)) {
1113 lua_pushliteral(L,
"error determining the size of the config file");
1119 if (fseek(f, 0l, SEEK_SET)) {
1122 lua_pushliteral(L,
"error reading config file");
1129 lua_pushstring(L,
"not enough memory");
1133 if (fread(data,
sizeof(
char), *size, f) != *size) {
1136 lua_pushliteral(L,
"problem reading configuration file");
1142 error_func = lua_gettop(L);
1144 if (luaL_loadbuffer(L, data, *size,
"extensions.lua")
1145 || lua_pcall(L, 0, LUA_MULTRET, error_func)
1154 lua_remove(L, error_func);
1174 lua_pushlightuserdata(L, chan);
1175 lua_setfield(L, LUA_REGISTRYINDEX,
"channel");
1182 || lua_pcall(L, 0, LUA_MULTRET, 0)
1217 int file_not_openable = 0;
1222 if (file_not_openable) {
1243 local_contexts =
NULL;
1279 L = luaL_newstate();
1286 const char *
error = lua_tostring(L, -1);
1305 datastore->
data = luaL_newstate();
1306 if (!datastore->
data) {
1316 L = datastore->
data;
1319 const char *
error = lua_tostring(L, -1);
1331 return datastore->
data;
1341 ast_log(
LOG_ERROR,
"Error adjusting use count, probably could not allocate memory\n");
1353 if (!chan) lua_close(L);
1364 ast_log(
LOG_ERROR,
"Error adjusting use count, probably could not allocate memory\n");
1376 if (!chan) lua_close(L);
1387 ast_log(
LOG_ERROR,
"Error adjusting use count, probably could not allocate memory\n");
1399 if (!chan) lua_close(L);
1407 int res, error_func;
1411 ast_log(
LOG_ERROR,
"Error adjusting use count, probably could not allocate memory\n");
1422 error_func = lua_gettop(L);
1427 ast_log(
LOG_ERROR,
"Could not find extension %s in context %s\n", exten, context);
1428 if (!chan) lua_close(L);
1433 lua_getfield(L, LUA_REGISTRYINDEX,
"autoservice");
1434 if (lua_toboolean(L, -1)) {
1441 lua_pushstring(L, context);
1442 lua_pushstring(L, exten);
1444 res = lua_pcall(L, 2, 0, error_func);
1446 if (res == LUA_ERRRUN) {
1448 if (lua_isnumber(L, -1)) {
1449 res = lua_tointeger(L, -1);
1454 }
else if (lua_isstring(L, -1)) {
1455 const char *
error = lua_tostring(L, -1);
1458 }
else if (res == LUA_ERRERR) {
1460 ast_log(
LOG_ERROR,
"Error in the lua error handler (this is probably a bug in pbx_lua)\n");
1461 }
else if (res == LUA_ERRMEM) {
1467 lua_remove(L, error_func);
1469 lua_getfield(L, LUA_REGISTRYINDEX,
"autoservice");
1470 if (lua_toboolean(L, -1)) {
1475 if (!chan) lua_close(L);
1495 int context_table, context_order_table, i;
1497 ast_debug(2,
"Looking up %s@%s:%i\n", exten, context, priority);
1502 lua_getglobal(L,
"extensions");
1503 if (lua_isnil(L, -1)) {
1504 ast_log(
LOG_ERROR,
"Unable to find 'extensions' table in extensions.lua\n");
1510 lua_getfield(L, -1, context);
1511 if (lua_isnil(L, -1)) {
1519 context_table = lua_gettop(L);
1522 lua_getfield(L, LUA_REGISTRYINDEX,
"extensions_order");
1523 lua_getfield(L, -1, context);
1527 context_order_table = lua_gettop(L);
1530 #if LUA_VERSION_NUM < 502 1531 for (i = 1; i < lua_objlen(L, context_order_table) + 1; i++) {
1533 for (i = 1; i < lua_rawlen(L, context_order_table) + 1; i++) {
1535 int e_index_copy,
match = 0;
1538 lua_pushinteger(L, i);
1539 lua_gettable(L, context_order_table);
1543 lua_pushvalue(L, -1);
1544 e_index_copy = lua_gettop(L);
1546 if (!(e = lua_tostring(L, e_index_copy))) {
1552 if (!strcasecmp(e,
"include")) {
1585 lua_gettable(L, context_table);
1596 lua_getfield(L, context_table,
"include");
1597 if (lua_isnil(L, -1)) {
1603 lua_remove(L, context_order_table);
1604 lua_remove(L, context_table);
1607 for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)) {
1608 const char *
c = lua_tostring(L, -1);
1632 .description =
"Lua PBX Switch",
1645 lua_State *L = luaL_newstate();
1653 const char *
error = lua_tostring(L, -1);
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
hashtable functions for contexts
static int lua_autoservice_start(lua_State *L)
[lua_CFunction] Tell pbx_lua to maintain an autoservice on this channel (for access from lua...
static int lua_find_extension(lua_State *L, const char *context, const char *exten, int priority, ast_switch_f *func, int push_func)
Locate an extensions and optionally push the matching function on the stack.
static struct ast_hashtab * local_table
#define ast_channel_lock(chan)
int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len)
executes a read operation on a function
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
static int lua_get_variable_value(lua_State *L)
[lua_CFunction] Used to get the value of a variable or dialplan function (for access from lua...
int ast_hashtab_newsize_java(struct ast_hashtab *tab)
Create a prime number roughly 2x the current table size.
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
static void lua_create_application_metatable(lua_State *L)
Create the 'application' metatable, used to execute asterisk applications from lua.
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
static void lua_create_variable_metatable(lua_State *L)
Create the 'variable' metatable, used to retrieve channel variables.
#define LUA_EXT_DATA_SIZE
static void lua_state_destroy(void *data)
The destructor for lua_datastore.
static void lua_concat_args(lua_State *L, int start, int nargs)
Concatenate a list of lua function arguments into a comma separated string.
int ast_extension_cmp(const char *a, const char *b)
Determine if one extension should match before another.
Generic (perhaps overly so) hashtable implementation Hash Table support in Asterisk.
static int lua_autoservice_status(lua_State *L)
[lua_CFunction] Get the status of the autoservice flag (for access from lua, don't call directly) ...
int ast_context_add_switch2(struct ast_context *con, const char *sw, const char *data, int eval, const char *registrar)
Adds a switch (first param is a ast_context)
static int lua_autoservice_stop(lua_State *L)
[lua_CFunction] Tell pbx_lua to stop maintaning an autoservice on this channel (for access from lua...
Structure for a data store type.
void ast_unregister_switch(struct ast_switch *sw)
Unregister an alternative switch.
static void lua_create_app_table(lua_State *L)
Create the global 'app' table for executing applications.
static int matchmore(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
static char * lua_read_extensions_file(lua_State *L, long *size, int *file_not_openable)
Load the extensions.lua file in to a buffer and execute the file.
static int lua_sort_extensions(lua_State *L)
Store the sort order of each context.
#define ast_mutex_lock(a)
static void lua_push_variable_table(lua_State *L)
Push a 'variable' table on the stack for access the channel variable with the given name...
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
struct varshead * ast_channel_varshead(struct ast_channel *chan)
static int load_or_reload_lua_stuff(void)
#define ast_module_user_remove(user)
static struct ao2_container * hints
int ast_channel_priority(const struct ast_channel *chan)
#define ast_verb(level,...)
int ast_hashtab_resize_java(struct ast_hashtab *tab)
Determines if a table resize should occur using the Java algorithm (if the table load factor is 75% o...
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
static const char context_name[]
static int lua_check_hangup(lua_State *L)
[lua_CFunction] Check if this channel has been hungup or not (for access from lua, don't call directly)
#define ast_strlen_zero(foo)
static int lua_register_switches(lua_State *L)
Register dialplan switches for our pbx_lua contexs.
static ast_mutex_t config_file_lock
#define ast_debug(level,...)
Log a DEBUG message.
static int lua_extension_cmp(lua_State *L)
[lua_CFunction] Compare two extensions (for access from lua, don't call directly) ...
static int lua_get_variable(lua_State *L)
[lua_CFunction] Return a lua 'variable' object (for access from lua, don't call directly) ...
General Asterisk PBX channel definitions.
Asterisk file paths, configured in asterisk.conf.
static long config_file_size
static const struct ast_datastore_info lua_datastore
#define LUA_GOTO_DETECTED
static int lua_func_read(lua_State *L)
[lua_CFunction] Create a 'variable' object for accessing a dialplan function (for access from lua...
static struct ast_context * local_contexts
static int lua_pbx_findapp(lua_State *L)
[lua_CFunction] Find an app and return it in a lua table (for access from lua, don't call directly) ...
#define ast_strdupa(s)
duplicate a string in memory from the stack
static int unload_module(void)
#define ast_malloc(len)
A wrapper for malloc()
static char * config_file_data
static struct ast_switch lua_switch
int() ast_switch_f(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
All switch functions have the same interface, so define a type for them.
static int lua_load_extensions(lua_State *L, struct ast_channel *chan)
Load the extensions.lua file from the internal buffer.
#define ast_module_user_add(chan)
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
static void lua_create_hangup_function(lua_State *L)
Create the hangup check function.
struct ast_channel * chan
char * term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
Colorize a specified string by adding terminal color codes.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
static int load_module(void)
static void lua_create_autoservice_functions(lua_State *L)
Create the autoservice functions.
static int canmatch(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
const char * ast_config_AST_CONFIG_DIR
void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
Retrieve the value of a builtin variable or variable from the channel variable stack.
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar)
Merge the temporary contexts into a global contexts list and delete from the global list the ones tha...
static int lua_reload_extensions(lua_State *L)
Reload the extensions file and update the internal buffers if it loads correctly. ...
const char * app_name(struct ast_app *app)
static int exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
static int lua_set_variable(lua_State *L)
[lua_CFunction] Set the value of a channel variable or dialplan function (for access from lua...
#define ast_channel_unlock(chan)
static int lua_error_function(lua_State *L)
[lua_CFunction] Handle lua errors (for access from lua, don't call directly)
static int lua_register_hints(lua_State *L)
Register dialplan hints for our pbx_lua contexs.
int ast_extension_match(const char *pattern, const char *extension)
Determine if a given extension matches a given pattern (in NXX format)
unsigned int ast_hashtab_hash_contexts(const void *obj)
int ast_register_switch(struct ast_switch *sw)
Register an alternative dialplan switch.
Module could not be loaded properly.
int ast_extension_close(const char *pattern, const char *data, int needmore)
Module has failed to load, may be in an inconsistent state.
static void lua_datastore_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
The fixup function for the lua_datastore.
static void lua_free_extensions(void)
Free the internal extensions buffer.
Support for logging to various files, console and syslog Configuration in file logger.conf.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
static int lua_set_variable_value(lua_State *L)
[lua_CFunction] Used to set the value of a variable or dialplan function (for access from lua...
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
static int exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
int ast_add_extension2(struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar, const char *registrar_file, int registrar_line)
Add an extension to an extension context, this time with an ast_context *.
Standard Command Line Interface.
ast_app: A registered application
const char * ast_channel_name(const struct ast_channel *chan)
static void lua_create_channel_table(lua_State *L)
Create the global 'channel' table for accesing channel variables.
void ast_context_destroy(struct ast_context *con, const char *registrar)
Destroy a context (matches the specified context or ANY context if NULL)
const char * ast_channel_context(const struct ast_channel *chan)
Handy terminal functions for vt* terms.
int error(const char *format,...)
#define ast_datastore_alloc(info, uid)
#define ast_hashtab_create(initial_buckets, compare, resize, newsize, hash, do_locking)
static char context[AST_MAX_CONTEXT]
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
struct ast_app * pbx_findapp(const char *app)
Look up an application.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static lua_State * lua_get_state(struct ast_channel *chan)
Get the lua_State for this channel.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
static int lua_pbx_exec(lua_State *L)
[lua_CFunction] This function is part of the 'application' metatable and is used to execute applicati...
ast_context: An extension context - must remain in sync with fake_context
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define ast_mutex_unlock(a)
static void lua_update_registry(lua_State *L, const char *context, const char *exten, int priority)
Update the lua registry with the given context, exten, and priority.