summaryrefslogtreecommitdiff
path: root/apps/app_stack.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2008-11-02 23:34:39 +0000
committerKevin P. Fleming <kpfleming@digium.com>2008-11-02 23:34:39 +0000
commita67790c6f53e4b002556eca8438dbd56994ea056 (patch)
treec51cd50dd6e0906faa8d5bd7a24965e5db876fba /apps/app_stack.c
parent585899dbc088d30647b482183b7821f6a14aa5aa (diff)
instead of trying to forcibly load res_agi when app_stack is loaded (even if the administrator didn't want it loaded), use GCC weak symbols to determine whether it was loaded already or not; if it was loaded, then use it.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153709 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_stack.c')
-rw-r--r--apps/app_stack.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/app_stack.c b/apps/app_stack.c
index 714eaae2c..3f73e13d6 100644
--- a/apps/app_stack.c
+++ b/apps/app_stack.c
@@ -26,7 +26,7 @@
*/
/*** MODULEINFO
- <depend>res_agi</depend>
+ <use>res_agi</use>
***/
#include "asterisk.h"
@@ -38,6 +38,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/manager.h"
#include "asterisk/channel.h"
+
+/* usage of AGI is optional, so indicate that to the header file */
+#define ASTERISK_AGI_OPTIONAL
#include "asterisk/agi.h"
/*** DOCUMENTATION
@@ -104,7 +107,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
</description>
</application>
***/
-static int agi_loaded = 0;
static const char *app_gosub = "Gosub";
static const char *app_gosubif = "GosubIf";
@@ -537,7 +539,7 @@ static int unload_module(void)
{
struct ast_context *con;
- if (agi_loaded) {
+ if (ast_agi_unregister) {
ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
if ((con = ast_context_find("app_stack_gosub_virtual_context"))) {
@@ -559,15 +561,10 @@ static int load_module(void)
{
struct ast_context *con;
- if (!ast_module_check("res_agi.so")) {
- if (ast_load_resource("res_agi.so") == AST_MODULE_LOAD_SUCCESS) {
- agi_loaded = 1;
- }
- } else {
- agi_loaded = 1;
- }
-
- if (agi_loaded) {
+ /* usage of AGI is optional, so check to see if the ast_agi_register()
+ function is available; if so, use it.
+ */
+ if (ast_agi_register) {
con = ast_context_find_or_create(NULL, NULL, "app_stack_gosub_virtual_context", "app_stack");
if (!con) {
ast_log(LOG_ERROR, "Virtual context 'app_stack_gosub_virtual_context' does not exist and unable to create\n");