[asterisk-commits] mnicholson: branch 1.8 r317858 - /branches/1.8/pbx/pbx_lua.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 6 14:31:53 CDT 2011
Author: mnicholson
Date: Fri May 6 14:31:50 2011
New Revision: 317858
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=317858
Log:
pbx_lua autoservice fixes
Don't start an autoservice in pbx_lua if pbx_lua already started one and don't
stop one if we didn't start one. Also start and stop the autoservice when
transferring control from and to the pbx.
Modified:
branches/1.8/pbx/pbx_lua.c
Modified: branches/1.8/pbx/pbx_lua.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/pbx/pbx_lua.c?view=diff&rev=317858&r1=317857&r2=317858
==============================================================================
--- branches/1.8/pbx/pbx_lua.c (original)
+++ branches/1.8/pbx/pbx_lua.c Fri May 6 14:31:50 2011
@@ -656,6 +656,13 @@
struct ast_channel *chan;
int res;
+ lua_getfield(L, LUA_REGISTRYINDEX, "autoservice");
+ if (lua_toboolean(L, -1)) {
+ /* autoservice already running */
+ return 1;
+ }
+ lua_pop(L, 1);
+
lua_getfield(L, LUA_REGISTRYINDEX, "channel");
chan = lua_touserdata(L, -1);
lua_pop(L, 1);
@@ -686,6 +693,13 @@
{
struct ast_channel *chan;
int res;
+
+ lua_getfield(L, LUA_REGISTRYINDEX, "autoservice");
+ if (!lua_toboolean(L, -1)) {
+ /* no autoservice running */
+ return 1;
+ }
+ lua_pop(L, 1);
lua_getfield(L, LUA_REGISTRYINDEX, "channel");
chan = lua_touserdata(L, -1);
@@ -1278,7 +1292,13 @@
ast_module_user_remove(u);
return -1;
}
-
+
+ lua_getfield(L, LUA_REGISTRYINDEX, "autoservice");
+ if (lua_toboolean(L, -1)) {
+ ast_autoservice_start(chan);
+ }
+ lua_pop(L, 1);
+
lua_update_registry(L, context, exten, priority);
lua_pushstring(L, context);
@@ -1304,6 +1324,13 @@
lua_pop(L, 1);
}
lua_remove(L, error_func);
+
+ lua_getfield(L, LUA_REGISTRYINDEX, "autoservice");
+ if (lua_toboolean(L, -1)) {
+ ast_autoservice_stop(chan);
+ }
+ lua_pop(L, 1);
+
if (!chan) lua_close(L);
ast_module_user_remove(u);
return res;
More information about the asterisk-commits
mailing list