Index: apps/app_stack.c
===================================================================
--- apps/app_stack.c	(revision 148806)
+++ apps/app_stack.c	(working copy)
@@ -36,6 +36,77 @@
 #include "asterisk/channel.h"
 #include "asterisk/agi.h"
 
+/*** DOCUMENTATION
+	<application name="Gosub" language="en_US">
+		<synopsis>
+			Jump to label, saving return address.
+		</synopsis>
+		<syntax>
+			<parameter name="context" />
+			<parameter name="exten" />
+			<parameter name="priority" required="true" argsep="()">
+				<argument name="args">
+					<variablelist>
+						<variable name="arg1" />
+						<variable name="arg2" />
+						<variable name="argN" />
+					</variablelist>
+				</argument>
+			</parameter>
+		</syntax>
+		<description>
+			<para>Gosub([[context,]exten,]priority[(arg1[,...][,argN])])</para>
+			<para>Jumps to the label specified, saving the return address.</para>
+		</description>
+	</application>
+	<application name="GosubIf" language="en_US">
+		<synopsis>
+	Conditionally jump to label, saving return address.
+		</synopsis>
+		<syntax argsep="?">
+			<parameter name="condition" required="true" />
+			<parameter name="label1" required="true" argsep="()">
+				<argument name="arg1" required="true" />
+				<argument name="argN" />
+			</parameter>
+			<parameter name="label2" argsep="()">
+				<argument name="arg1" required="true" />
+				<argument name="argN" />
+			</parameter>
+		</syntax>
+		<description>
+			<para>If the condition is true, then jump to <literal>label1</literal>. 
+			If false, jumps to <literal>label2</literal>, if specified.  In either 
+			case, a jump saves the return point in the dialplan, to be returned 
+			to with a <literal>Return()</literal>.
+			</para>
+		</description>
+	</application>
+	<application name="Return" language="en_US">
+		<synopsis>
+			Return from gosub routine.
+		</synopsis>
+		<syntax>
+			<parameter name="returnvalue" />
+		</syntax>
+		<description>
+			<para>Jumps to the last label on the stack, removing it. 
+			The <literal>return-value</literal>, if any, is saved in the channel 
+			variable <variable>GOSUB_RETVAL</variable>.
+			</para>
+		</description>
+	</application>
+	<application name="StackPop" language="en_US">
+		<synopsis>
+			Remove one address from gosub stack.
+		</synopsis>
+		<syntax />
+		<description>
+			<para>Removes last label on the stack, discarding it.</para>
+		</description>
+	</application>
+ ***/
+
 static int agi_loaded = 0;
 
 static const char *app_gosub = "Gosub";
@@ -43,27 +114,7 @@
 static const char *app_return = "Return";
 static const char *app_pop = "StackPop";
 
-static const char *gosub_synopsis = "Jump to label, saving return address";
-static const char *gosubif_synopsis = "Conditionally jump to label, saving return address";
-static const char *return_synopsis = "Return from gosub routine";
-static const char *pop_synopsis = "Remove one address from gosub stack";
 
-static const char *gosub_descrip =
-"  Gosub([[context,]exten,]priority[(arg1[,...][,argN])]):\n"
-"Jumps to the label specified, saving the return address.\n";
-static const char *gosubif_descrip =
-"  GosubIf(condition?labeliftrue[(arg1[,...])][:labeliffalse[(arg1[,...])]]):\n"
-"If the condition is true, then jump to labeliftrue.  If false, jumps to\n"
-"labeliffalse, if specified.  In either case, a jump saves the return point\n"
-"in the dialplan, to be returned to with a Return.\n";
-static const char *return_descrip =
-"  Return([return-value]):\n"
-"Jumps to the last label on the stack, removing it.  The return value, if\n"
-"any, is saved in the channel variable GOSUB_RETVAL.\n";
-static const char *pop_descrip =
-"  StackPop():\n"
-"Removes last label on the stack, discarding it.\n";
-
 static void gosub_free(void *data);
 
 static struct ast_datastore_info stack_info = {
@@ -534,10 +585,10 @@
 		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_register_application_xml(app_pop, pop_exec);
+	ast_register_application_xml(app_return, return_exec);
+	ast_register_application_xml(app_gosubif, gosubif_exec);
+	ast_register_application_xml(app_gosub, gosub_exec);
 	ast_custom_function_register(&local_function);
 
 	return 0;
Index: apps/app_talkdetect.c
===================================================================
--- apps/app_talkdetect.c	(revision 148806)
+++ apps/app_talkdetect.c	(working copy)
@@ -39,22 +39,43 @@
 #include "asterisk/dsp.h"
 #include "asterisk/app.h"
 
+/*** DOCUMENTATION
+	<application name="BackgroundDetect" language="en_US">
+		<synopsis>
+			Background a file with talk detect.
+		</synopsis>
+		<syntax>
+			<parameter name="filename" required="true" />
+			<parameter name="sil">
+				<note><para>Defaults to 1000</para></note>
+			</parameter>
+			<parameter name="min">
+				<note><para>Defaults to 100</para></note>
+			</parameter>
+			<parameter name="max">
+				<note><para>Defaults to infinity</para></note>
+			</parameter>
+			<parameter name="analysistime">
+				<note><para>Defaults to infinity</para></note>
+			</parameter>
+		</syntax>
+		<description>
+			<para>Plays back <literal>filename</literal>, waiting for interruption 
+			from a given digit (the digit must start the beginning of a valid 
+			extension, or it will be ignored).  During the playback of the file, 
+			audio is monitored in the receive direction, and if a period of 
+			non-silence which is greater than <literal>min</literal> ms yet less 
+			than <literal>max</literal> ms is followed by silence for at least 
+			<literal>sil</literal> ms, which occurs during the first 
+			<literal>analysistime</literal> ms, then the audio playback is aborted 
+			and processing jumps to the <literal>talk</literal> extension, if available.
+			</para>
+		</description>
+	</application>
+ ***/
+
 static char *app = "BackgroundDetect";
 
-static char *synopsis = "Background a file with talk detect";
-
-static char *descrip = 
-"  BackgroundDetect(<filename>[,<sil>[,<min>[,<max>[,<analysistime>]]]]):\n"
-"Plays back <filename>, waiting for interruption from a given digit (the digit\n"
-"must start the beginning of a valid extension, or it will be ignored).  During\n"
-"the playback of the file, audio is monitored in the receive direction, and if\n"
-"a period of non-silence which is greater than <min> ms yet less than <max> ms\n"
-"is followed by silence for at least <sil> ms, which occurs during the first\n"
-"<analysistime> ms, then the audio playback is aborted and processing jumps to\n"
-"the <talk> extension, if available.  If unspecified, <sil>, <min>, <max>, and\n"
-"<analysistime> default to 1000, 100, infinity, and infinity respectively.\n";
-
-
 static int background_detect_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
@@ -227,7 +248,7 @@
 
 static int load_module(void)
 {
-	return ast_register_application(app, background_detect_exec, synopsis, descrip);
+	return ast_register_application_xml(app, background_detect_exec);
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Playback with Talk Detection");
