mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 03:02:15 +00:00
Remove as much trailing whitespace as possible.
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
* at the top of the source tree.
|
||||
*/
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \author Matthew Nicholson <mnicholson@digium.com>
|
||||
@@ -155,7 +155,7 @@ static void lua_datastore_fixup(void *data, struct ast_channel *old_chan, struct
|
||||
static int lua_pbx_findapp(lua_State *L)
|
||||
{
|
||||
const char *app_name = luaL_checkstring(L, 2);
|
||||
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushstring(L, "name");
|
||||
@@ -196,7 +196,7 @@ static int lua_pbx_exec(lua_State *L)
|
||||
lua_getfield(L, 1, "name");
|
||||
app_name = ast_strdupa(lua_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
||||
if (!(app = pbx_findapp(app_name))) {
|
||||
lua_pushstring(L, "application '");
|
||||
lua_pushstring(L, app_name);
|
||||
@@ -204,16 +204,16 @@ static int lua_pbx_exec(lua_State *L)
|
||||
lua_concat(L, 3);
|
||||
return lua_error(L);
|
||||
}
|
||||
|
||||
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "channel");
|
||||
chan = lua_touserdata(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
||||
context = ast_strdupa(ast_channel_context(chan));
|
||||
exten = ast_strdupa(ast_channel_exten(chan));
|
||||
priority = ast_channel_priority(chan);
|
||||
|
||||
|
||||
lua_concat_args(L, 2, nargs);
|
||||
data = lua_tostring(L, -1);
|
||||
|
||||
@@ -266,20 +266,20 @@ static int lua_pbx_exec(lua_State *L)
|
||||
|
||||
/* goto detected - construct error message */
|
||||
lua_insert(L, -3);
|
||||
|
||||
lua_pushliteral(L, " changed from ");
|
||||
lua_insert(L, -3);
|
||||
|
||||
lua_pushliteral(L, " to ");
|
||||
lua_insert(L, -2);
|
||||
|
||||
lua_concat(L, 5);
|
||||
|
||||
ast_debug(2, "Goto detected: %s\n", lua_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
|
||||
/* let the lua engine know it needs to return control to the pbx */
|
||||
lua_pushinteger(L, LUA_GOTO_DETECTED);
|
||||
|
||||
lua_pushliteral(L, " changed from ");
|
||||
lua_insert(L, -3);
|
||||
|
||||
lua_pushliteral(L, " to ");
|
||||
lua_insert(L, -2);
|
||||
|
||||
lua_concat(L, 5);
|
||||
|
||||
ast_debug(2, "Goto detected: %s\n", lua_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
|
||||
/* let the lua engine know it needs to return control to the pbx */
|
||||
lua_pushinteger(L, LUA_GOTO_DETECTED);
|
||||
lua_error(L);
|
||||
|
||||
return 0;
|
||||
@@ -310,7 +310,7 @@ static int lua_get_variable_value(lua_State *L)
|
||||
lua_pushstring(L, "User probably used '.' instead of ':' for retrieving a channel variable value");
|
||||
return lua_error(L);
|
||||
}
|
||||
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "channel");
|
||||
chan = lua_touserdata(L, -1);
|
||||
lua_pop(L, 1);
|
||||
@@ -318,14 +318,14 @@ static int lua_get_variable_value(lua_State *L)
|
||||
lua_getfield(L, 1, "name");
|
||||
name = ast_strdupa(lua_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "autoservice");
|
||||
autoservice = lua_toboolean(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
if (autoservice)
|
||||
ast_autoservice_stop(chan);
|
||||
|
||||
|
||||
/* if this is a dialplan function then use ast_func_read(), otherwise
|
||||
* use pbx_retrieve_variable() */
|
||||
if (!ast_strlen_zero(name) && name[strlen(name) - 1] == ')') {
|
||||
@@ -333,7 +333,7 @@ static int lua_get_variable_value(lua_State *L)
|
||||
} else {
|
||||
pbx_retrieve_variable(chan, name, &value, workspace, LUA_BUF_SIZE, ast_channel_varshead(chan));
|
||||
}
|
||||
|
||||
|
||||
if (autoservice)
|
||||
ast_autoservice_start(chan);
|
||||
|
||||
@@ -349,7 +349,7 @@ static int lua_get_variable_value(lua_State *L)
|
||||
/*!
|
||||
* \brief [lua_CFunction] Used to set the value of a variable or dialplan
|
||||
* function (for access from lua, don't call directly)
|
||||
*
|
||||
*
|
||||
* This function is the 'set()' function in the following example as would be
|
||||
* seen in extensions.lua.
|
||||
*
|
||||
@@ -373,7 +373,7 @@ static int lua_set_variable_value(lua_State *L)
|
||||
lua_pop(L, 1);
|
||||
|
||||
value = luaL_checkstring(L, 2);
|
||||
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "channel");
|
||||
chan = lua_touserdata(L, -1);
|
||||
lua_pop(L, 1);
|
||||
@@ -386,7 +386,7 @@ static int lua_set_variable_value(lua_State *L)
|
||||
ast_autoservice_stop(chan);
|
||||
|
||||
pbx_builtin_setvar_helper(chan, name, value);
|
||||
|
||||
|
||||
if (autoservice)
|
||||
ast_autoservice_start(chan);
|
||||
|
||||
@@ -429,10 +429,10 @@ static void lua_push_variable_table(lua_State *L)
|
||||
|
||||
lua_insert(L, -2); /* move the table after the name */
|
||||
lua_setfield(L, -2, "name");
|
||||
|
||||
|
||||
lua_pushcfunction(L, &lua_get_variable_value);
|
||||
lua_setfield(L, -2, "get");
|
||||
|
||||
|
||||
lua_pushcfunction(L, &lua_set_variable_value);
|
||||
lua_setfield(L, -2, "set");
|
||||
}
|
||||
@@ -495,7 +495,7 @@ static void lua_create_variable_metatable(lua_State *L)
|
||||
|
||||
/*!
|
||||
* \brief Create the 'application' metatable, used to execute asterisk
|
||||
* applications from lua
|
||||
* applications from lua
|
||||
*
|
||||
* \param L the lua_State to use
|
||||
*/
|
||||
@@ -519,7 +519,7 @@ static void lua_create_autoservice_functions(lua_State *L)
|
||||
{
|
||||
lua_pushcfunction(L, &lua_autoservice_start);
|
||||
lua_setglobal(L, "autoservice_start");
|
||||
|
||||
|
||||
lua_pushcfunction(L, &lua_autoservice_stop);
|
||||
lua_setglobal(L, "autoservice_stop");
|
||||
|
||||
@@ -544,7 +544,7 @@ static void lua_create_hangup_function(lua_State *L)
|
||||
/*!
|
||||
* \brief [lua_CFunction] Return a lua 'variable' object (for access from lua, don't call
|
||||
* directly)
|
||||
*
|
||||
*
|
||||
* This function is called to lookup a variable construct a 'variable' object.
|
||||
* It would be called in the following example as would be seen in
|
||||
* extensions.lua.
|
||||
@@ -560,14 +560,14 @@ static int lua_get_variable(lua_State *L)
|
||||
char *value = NULL;
|
||||
char *workspace = ast_alloca(LUA_BUF_SIZE);
|
||||
workspace[0] = '\0';
|
||||
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "channel");
|
||||
chan = lua_touserdata(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_pushvalue(L, 2);
|
||||
lua_push_variable_table(L);
|
||||
|
||||
|
||||
/* if this is not a request for a dialplan funciton attempt to retrieve
|
||||
* the value of the variable */
|
||||
if (!ast_strlen_zero(name) && name[strlen(name) - 1] != ')') {
|
||||
@@ -579,13 +579,13 @@ static int lua_get_variable(lua_State *L)
|
||||
lua_setfield(L, -2, "value");
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief [lua_CFunction] Set the value of a channel variable or dialplan
|
||||
* function (for access from lua, don't call directly)
|
||||
*
|
||||
*
|
||||
* This function is called to set a variable or dialplan function. It would be
|
||||
* called in the following example as would be seen in extensions.lua.
|
||||
*
|
||||
@@ -612,7 +612,7 @@ static int lua_set_variable(lua_State *L)
|
||||
ast_autoservice_stop(chan);
|
||||
|
||||
pbx_builtin_setvar_helper(chan, name, value);
|
||||
|
||||
|
||||
if (autoservice)
|
||||
ast_autoservice_start(chan);
|
||||
|
||||
@@ -654,7 +654,7 @@ static void lua_concat_args(lua_State *L, int start, int nargs) {
|
||||
/*!
|
||||
* \brief [lua_CFunction] Create a 'variable' object for accessing a dialplan
|
||||
* function (for access from lua, don't call directly)
|
||||
*
|
||||
*
|
||||
* This function is called to create a 'variable' object to access a dialplan
|
||||
* function. It would be called in the following example as would be seen in
|
||||
* extensions.lua.
|
||||
@@ -823,7 +823,7 @@ static int lua_error_function(lua_State *L)
|
||||
|
||||
/*!
|
||||
* \brief Store the sort order of each context
|
||||
|
||||
|
||||
* In the event of an error, an error string will be pushed onto the lua stack.
|
||||
*
|
||||
* \retval 0 success
|
||||
@@ -900,7 +900,7 @@ static int lua_sort_extensions(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* remove the extensions table and the extensions_order table */
|
||||
lua_pop(L, 2);
|
||||
return 0;
|
||||
@@ -958,7 +958,7 @@ static int lua_register_switches(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* remove the extensions table */
|
||||
lua_pop(L, 1);
|
||||
return 0;
|
||||
@@ -1157,11 +1157,11 @@ static char *lua_read_extensions_file(lua_State *L, long *size, int *file_not_op
|
||||
*/
|
||||
static int lua_load_extensions(lua_State *L, struct ast_channel *chan)
|
||||
{
|
||||
|
||||
|
||||
/* store a pointer to this channel */
|
||||
lua_pushlightuserdata(L, chan);
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "channel");
|
||||
|
||||
|
||||
luaL_openlibs(L);
|
||||
|
||||
/* load and sort extensions */
|
||||
@@ -1220,10 +1220,10 @@ static int lua_reload_extensions(lua_State *L)
|
||||
|
||||
config_file_data = data;
|
||||
config_file_size = size;
|
||||
|
||||
|
||||
/* merge our new contexts */
|
||||
ast_merge_contexts_and_delete(&local_contexts, local_table, registrar);
|
||||
/* merge_contexts_and_delete will actually, at the correct moment,
|
||||
/* merge_contexts_and_delete will actually, at the correct moment,
|
||||
set the global dialplan pointers to your local_contexts and local_table.
|
||||
It then will free up the old tables itself. Just be sure not to
|
||||
hang onto the pointers. */
|
||||
@@ -1381,7 +1381,7 @@ static int matchmore(struct ast_channel *chan, const char *context, const char *
|
||||
ast_module_user_remove(u);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
res = lua_find_extension(L, context, exten, priority, &matchmore, 0);
|
||||
|
||||
if (!chan) lua_close(L);
|
||||
@@ -1399,7 +1399,7 @@ static int exec(struct ast_channel *chan, const char *context, const char *exten
|
||||
ast_log(LOG_ERROR, "Error adjusting use count, probably could not allocate memory\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
L = lua_get_state(chan);
|
||||
if (!L) {
|
||||
ast_module_user_remove(u);
|
||||
@@ -1425,10 +1425,10 @@ static int exec(struct ast_channel *chan, const char *context, const char *exten
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_update_registry(L, context, exten, priority);
|
||||
|
||||
|
||||
lua_pushstring(L, context);
|
||||
lua_pushstring(L, exten);
|
||||
|
||||
|
||||
res = lua_pcall(L, 2, 0, error_func);
|
||||
if (res) {
|
||||
if (res == LUA_ERRRUN) {
|
||||
@@ -1690,4 +1690,3 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Lua PBX Switch",
|
||||
.unload = unload_module,
|
||||
.reload = reload,
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user