[asterisk-commits] tilghman: branch 1.6.0 r120603 - in /branches/1.6.0: ./ apps/ main/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 5 11:01:33 CDT 2008
Author: tilghman
Date: Thu Jun 5 11:01:32 2008
New Revision: 120603
URL: http://svn.digium.com/view/asterisk?view=rev&rev=120603
Log:
Merged revisions 120602 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r120602 | tilghman | 2008-06-05 10:58:11 -0500 (Thu, 05 Jun 2008) | 4 lines
Conditionally load the AGI command gosub, depending on whether or not res_agi
has been loaded, fix a return value in the loader, and ensure that the help
workhorse header does not print on load.
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/apps/app_stack.c
branches/1.6.0/main/loader.c
branches/1.6.0/res/res_agi.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_stack.c?view=diff&rev=120603&r1=120602&r2=120603
==============================================================================
--- branches/1.6.0/apps/app_stack.c (original)
+++ branches/1.6.0/apps/app_stack.c Thu Jun 5 11:01:32 2008
@@ -36,6 +36,8 @@
#include "asterisk/channel.h"
#include "asterisk/agi.h"
+static int agi_loaded = 0;
+
static const char *app_gosub = "Gosub";
static const char *app_gosubif = "GosubIf";
static const char *app_return = "Return";
@@ -487,12 +489,15 @@
{
struct ast_context *con;
- if ((con = ast_context_find("app_stack_gosub_virtual_context"))) {
- ast_context_remove_extension2(con, "s", 1, NULL);
- ast_context_destroy(con, "app_stack"); /* leave nothing behind */
- }
-
- ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
+ if (agi_loaded) {
+ ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
+
+ if ((con = ast_context_find("app_stack_gosub_virtual_context"))) {
+ ast_context_remove_extension2(con, "s", 1, NULL);
+ ast_context_destroy(con, "app_stack"); /* leave nothing behind */
+ }
+ }
+
ast_unregister_application(app_return);
ast_unregister_application(app_pop);
ast_unregister_application(app_gosubif);
@@ -505,19 +510,31 @@
static int load_module(void)
{
struct ast_context *con;
- con = ast_context_find_or_create(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");
- return AST_MODULE_LOAD_DECLINE;
+
+ if (!ast_module_check("res_agi.so")) {
+ if (ast_load_resource("res_agi.so") == AST_MODULE_LOAD_SUCCESS) {
+ agi_loaded = 1;
+ }
} else {
- ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free_ptr, "app_stack");
+ agi_loaded = 1;
+ }
+
+ if (agi_loaded) {
+ con = ast_context_find_or_create(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");
+ return AST_MODULE_LOAD_DECLINE;
+ } else {
+ ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free_ptr, "app_stack");
+ }
+
+ ast_agi_register(ast_module_info->self, &gosub_agi_command);
}
ast_register_application(app_pop, pop_exec, pop_synopsis, pop_descrip);
ast_register_application(app_return, return_exec, return_synopsis, return_descrip);
ast_register_application(app_gosubif, gosubif_exec, gosubif_synopsis, gosubif_descrip);
ast_register_application(app_gosub, gosub_exec, gosub_synopsis, gosub_descrip);
- ast_agi_register(ast_module_info->self, &gosub_agi_command);
ast_custom_function_register(&local_function);
return 0;
Modified: branches/1.6.0/main/loader.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/loader.c?view=diff&rev=120603&r1=120602&r2=120603
==============================================================================
--- branches/1.6.0/main/loader.c (original)
+++ branches/1.6.0/main/loader.c Thu Jun 5 11:01:32 2008
@@ -722,11 +722,12 @@
int ast_load_resource(const char *resource_name)
{
+ int res;
AST_LIST_LOCK(&module_list);
- load_resource(resource_name, 0);
+ res = load_resource(resource_name, 0);
AST_LIST_UNLOCK(&module_list);
- return 0;
+ return res;
}
struct load_order_entry {
Modified: branches/1.6.0/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_agi.c?view=diff&rev=120603&r1=120602&r2=120603
==============================================================================
--- branches/1.6.0/res/res_agi.c (original)
+++ branches/1.6.0/res/res_agi.c Thu Jun 5 11:01:32 2008
@@ -2740,7 +2740,6 @@
" When called with a topic as an argument, displays usage\n"
" information on the given command. If called without a\n"
" topic, it provides a list of AGI commands.\n";
- break;
case CLI_GENERATE:
return NULL;
}
More information about the asterisk-commits
mailing list