[asterisk-commits] bkruse: branch group/appdocsxml r128333 - in /team/group/appdocsxml: ./ apps/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jul 5 18:04:36 CDT 2008


Author: bkruse
Date: Sat Jul  5 18:04:36 2008
New Revision: 128333

URL: http://svn.digium.com/view/asterisk?view=rev&rev=128333
Log:
Updated the Todo List

XML Documented Retry Dial

Updated the asterisk-conf.tex to update the
documentation_language variable (which will
probably be changed later on.)

Parsing asterisk.conf for the documentation_language var

Modified:
    team/group/appdocsxml/Makefile
    team/group/appdocsxml/TODO_appdocsxml
    team/group/appdocsxml/apps/app_dial.c
    team/group/appdocsxml/doc/tex/asterisk-conf.tex
    team/group/appdocsxml/main/pbx.c

Modified: team/group/appdocsxml/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/Makefile?view=diff&rev=128333&r1=128332&r2=128333
==============================================================================
--- team/group/appdocsxml/Makefile (original)
+++ team/group/appdocsxml/Makefile Sat Jul  5 18:04:36 2008
@@ -698,6 +698,7 @@
 		echo ";runuser = asterisk ; The user to run as" ; \
 		echo ";rungroup = asterisk ; The group to run as" ; \
 		echo "dahdichanname = yes ; Set channel name as DAHDI" ; \
+		echo "documentation_language = en ; Set the Language you want Documentation displayed in" ; \
 		echo "" ; \
 		echo "; Changing the following lines may compromise your security." ; \
 		echo ";[files]" ; \

Modified: team/group/appdocsxml/TODO_appdocsxml
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/TODO_appdocsxml?view=diff&rev=128333&r1=128332&r2=128333
==============================================================================
--- team/group/appdocsxml/TODO_appdocsxml (original)
+++ team/group/appdocsxml/TODO_appdocsxml Sat Jul  5 18:04:36 2008
@@ -16,6 +16,9 @@
 So far mvanbaak added an example in apps/app_dial.c of 
 an XML tree of the Dial application.
 
+(Added RetryDial as well)
+
+Multiple Language Support :D
 
 **** Todo ****
 

Modified: team/group/appdocsxml/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_dial.c?view=diff&rev=128333&r1=128332&r2=128333
==============================================================================
--- team/group/appdocsxml/apps/app_dial.c (original)
+++ team/group/appdocsxml/apps/app_dial.c Sat Jul  5 18:04:36 2008
@@ -374,6 +374,48 @@
 			The optional URL will be sent to the called party if the channel supports it.
 		</option>
 	</application>
+
+	<application name="RetryDial">
+		<synopsis>
+			(THIS SHOULD BE SOME SPANISH !!!!!!!!!!!!!!!)
+			Place a call, retrying on failure allowing an optional exit extension.
+		</synopsis>
+		<description>
+		    RetryDial(announce,sleep,retries,dialargs):
+		    This application will attempt to place a call using the normal Dial application.
+		    If no channel can be reached, the 'announce' file will be played.
+		    Then, it will wait 'sleep' number of seconds before retrying the call.
+		    After 'retries' number of attempts, the calling channel will continue at the next priority in the dialplan. 
+		    If the 'retries' setting is set to 0, this application will retry endlessly.
+		    While waiting to retry a call, a 1 digit extension may be dialed. If that
+		    extension exists in either the context defined in ${EXITCONTEXT} or the current
+		    one, The call will jump to that extension immediately.
+		    The 'dialargs' are specified in the same format that arguments are provided
+		    to the Dial application.
+		</description>
+	</application>
+
+	<application name="RetryDial" language="es">
+		<synopsis>
+			(THIS SHOULD BE SOME SPANISH !!!!!!!!!!!!!!!)
+			Place a call, retrying on failure allowing an optional exit extension.
+		</synopsis>
+		<description>
+		    RetryDial(announce,sleep,retries,dialargs):
+		    This application will attempt to place a call using the normal Dial application.
+		    If no channel can be reached, the 'announce' file will be played.
+		    Then, it will wait 'sleep' number of seconds before retrying the call.
+		    After 'retries' number of attempts, the calling channel will continue at the next priority in the dialplan. 
+		    If the 'retries' setting is set to 0, this application will retry endlessly.
+		    While waiting to retry a call, a 1 digit extension may be dialed. If that
+		    extension exists in either the context defined in ${EXITCONTEXT} or the current
+		    one, The call will jump to that extension immediately.
+		    The 'dialargs' are specified in the same format that arguments are provided
+		    to the Dial application.
+		</description>
+	</application>
+
+
  ***/
 
 static char *app = "Dial";
@@ -536,7 +578,8 @@
 
 /* RetryDial App by Anthony Minessale II <anthmct at yahoo.com> Jan/2005 */
 static char *rapp = "RetryDial";
-static char *rsynopsis = "Place a call, retrying on failure allowing optional exit extension.";
+/*
+static char *rsynopsis = "Place a call, retrying on failure an allowing optional exit extension.";
 static char *rdescrip =
 "  RetryDial(announce,sleep,retries,dialargs): This application will attempt to\n"
 "place a call using the normal Dial application. If no channel can be reached,\n"
@@ -549,7 +592,7 @@
 "one, The call will jump to that extension immediately.\n"
 "  The 'dialargs' are specified in the same format that arguments are provided\n"
 "to the Dial application.\n";
-
+*/
 enum {
 	OPT_ANNOUNCE =          (1 << 0),
 	OPT_RESETCDR =          (1 << 1),
@@ -2458,7 +2501,7 @@
 		ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free_ptr, "app_dial");
 
 	res = ast_register_application_xml(app, dial_exec);
-	res |= ast_register_application(rapp, retrydial_exec, rsynopsis, rdescrip);
+	res |= ast_register_application_xml(rapp, retrydial_exec);
 
 	return res;
 }

Modified: team/group/appdocsxml/doc/tex/asterisk-conf.tex
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/doc/tex/asterisk-conf.tex?view=diff&rev=128333&r1=128332&r2=128333
==============================================================================
--- team/group/appdocsxml/doc/tex/asterisk-conf.tex (original)
+++ team/group/appdocsxml/doc/tex/asterisk-conf.tex Sat Jul  5 18:04:36 2008
@@ -82,6 +82,9 @@
 ; Enable internal timing support (-I)
 internal_timing = yes | no
 
+; Language Options
+documentation_language = en | es | ru
+
 ; These options have no command line equivalent
 
 ; Cache record() files in another directory until completion

Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=128333&r1=128332&r2=128333
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Sat Jul  5 18:04:36 2008
@@ -68,6 +68,8 @@
 #include "asterisk/indications.h"
 #include "asterisk/taskprocessor.h"
 
+#define AST_MODULE "pbx"
+
 /*!
  * \note I M P O R T A N T :
  *
@@ -285,6 +287,10 @@
 
 	int priority;				/*!< Priority associated with this exception */
 };
+
+#ifdef XML_DOCUMENTATION
+char documentation_language[80];
+#endif
 
 static int pbx_builtin_answer(struct ast_channel *, void *);
 static int pbx_builtin_goto(struct ast_channel *, void *);
@@ -4329,7 +4335,6 @@
 static int ast_load_documentation(void) {
 
 	FILE *xmldoc;
-	mxml_node_t *node;
 
 	/* For now, I just throw away cdata */
 	xmldoc = fopen(FILE_XML_DOC, "r");
@@ -4341,9 +4346,11 @@
 
 	documentation_tree = mxmlLoadFile(NULL, xmldoc, MXML_OPAQUE_CALLBACK);
 
+	if(!documentation_tree) {
+		ast_log(LOG_ERROR, "Parsing Problem with Documentation Tree\n");
+	}
+
 	fclose(xmldoc);
-
-	node = mxmlFindElement(documentation_tree, documentation_tree, "application", "name", "Dial", MXML_DESCEND);
 
 	/* Ok, let's now process it. */
 	/* Check for errors in loading the doc */
@@ -4358,12 +4365,12 @@
 	char tmps[80];
 	char *strapp;
 	int length, res;
-	mxml_node_t *node, *desc, *syn;
-
-	node = desc = syn = NULL;
+	mxml_node_t *node, *lang_node, *desc, *syn;
+
+	node = desc = syn = lang_node = NULL;
 
 	/* XXX If we do not have documentation, should we still register the application? */
-	if (!documentation_tree) {
+	if(!documentation_tree) {
 		ast_log(LOG_WARNING, "Cannot get description or synopsis for application, loading XML documentation failed.\n");
 		return -1;
 	}
@@ -4388,17 +4395,26 @@
 	strapp = ast_strdup(app);
 	node = mxmlFindElement(documentation_tree, documentation_tree, "application", "name", strapp, MXML_DESCEND);
 
-	if (!node) {
-		ast_log(LOG_WARNING, "Cannot find application documentation for app: '%s'\n", app);
+	if(!node) {
+		ast_log(LOG_WARNING, "Cannot find Application Documentation for app: '%s'\n", app);
 		return -1;
 	}
 
-	syn = mxmlFindElement(node, documentation_tree, "synopsis", NULL, NULL, MXML_DESCEND);
-	desc = mxmlFindElement(node, documentation_tree, "description", NULL, NULL, MXML_DESCEND);
+
+	lang_node = mxmlFindElement(node, documentation_tree, "application", "language", documentation_language, MXML_DESCEND);	
+
+	/* Could not find language, use the default one without a language */
+	if(!lang_node) 
+		lang_node = node;
+
+	syn = mxmlFindElement(lang_node, documentation_tree, "synopsis", NULL, NULL, MXML_DESCEND);
+	desc = mxmlFindElement(lang_node, documentation_tree, "description", NULL, NULL, MXML_DESCEND);
     
-	if (!syn || !desc || !syn->child || !desc->child) {
+	if(!syn || !desc || !syn->child || !desc->child) {
+
 		ast_log(LOG_WARNING, "Cannot find Application description or synopsis for app: '%s'\n", app);
 		return -1;
+
 	}
 
 	strcpy(tmp->name, app);
@@ -8155,6 +8171,21 @@
 	__ast_custom_function_register(&exception_function, NULL);
 
 	#ifdef XML_DOCUMENTATION
+	snprintf(documentation_language, sizeof(documentation_language), "en");
+	struct ast_config *cfg = NULL;
+	struct ast_variable *var = NULL;
+	struct ast_flags cnfflags = { 0 };
+	if(!(cfg = ast_config_load("asterisk.conf", cnfflags))) {
+		ast_log(LOG_ERROR, "No asterisk.conf? That cannot be good.\n");
+	}
+	
+	for(var = ast_variable_browse(cfg, "options"); var; var = var->next) {
+		if(!strcasecmp(var->name, "documentation_language")) {
+			if(!ast_strlen_zero(var->value)) {
+				snprintf(documentation_language, sizeof(documentation_language), var->value);
+			}
+		}	
+	}
 	/* Load Documentation XML Blob */
 	ast_load_documentation();
 	#endif




More information about the asterisk-commits mailing list