[asterisk-commits] tzafrir: branch tzafrir/docs r120866 - /team/tzafrir/docs/apps/app_dial.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 6 11:14:49 CDT 2008


Author: tzafrir
Date: Fri Jun  6 11:14:49 2008
New Revision: 120866

URL: http://svn.digium.com/view/asterisk?view=rev&rev=120866
Log:
introduce AST_APPLICATION_INFO and AST_REGISTER_APP: 

AST_APPLICATION_INFO: 
  provides all the strings related to an application in one place. 

AST_REGISTER_APP:
  a wrapper for ast_regester_app() when AST_APPLICATION_INFO has been
  used.

They are included in apps/app_dial.c to keep everything compact for now.


Modified:
    team/tzafrir/docs/apps/app_dial.c

Modified: team/tzafrir/docs/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/tzafrir/docs/apps/app_dial.c?view=diff&rev=120866&r1=120865&r2=120866
==============================================================================
--- team/tzafrir/docs/apps/app_dial.c (original)
+++ team/tzafrir/docs/apps/app_dial.c Fri Jun  6 11:14:49 2008
@@ -62,11 +62,18 @@
 #include "asterisk/global_datastores.h"
 #include "asterisk/dsp.h"
 
-static char *app = "Dial";
-
-static char *synopsis = "Place a call and connect to the current channel";
-
-static char *descrip =
+#define AST_APPLICATION_INFO(name, name_str, syn_str, desc_str) \
+	static char *name = name_str; \
+	static char *app_synopsis_ ## name = syn_str; \
+	static char *app_description_ ## name = desc_str;
+
+#define AST_REGISTER_APPLICATION(name, func) \
+	ast_register_application(name, func, app_synopsis_ ##name, \
+			app_description_ ##name);
+
+
+AST_APPLICATION_INFO(app, "Dial",
+"Place a call and connect to the current channel",
 "  Dial(Technology/resource[&Tech2/resource2...][,timeout][,options][,URL]):\n"
 "This application will place calls to one or more specified channels. As soon\n"
 "as one of the requested channels answers, the originating channel will be\n"
@@ -216,12 +223,12 @@
 "    x    - Allow the called party to enable recording of the call by sending\n"
 "           the DTMF sequence defined for one-touch automixmonitor in features.conf\n"
 "    X    - Allow the calling party to enable recording of the call by sending\n"
-"           the DTMF sequence defined for one-touch automixmonitor in features.conf\n";
+"           the DTMF sequence defined for one-touch automixmonitor in features.conf\n"
+);
 
 /* 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 *rdescrip =
+AST_APPLICATION_INFO(rapp, "RetryDial",
+"Place a call, retrying on failure allowing optional exit extension.",
 "  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"
 "the 'announce' file will be played. Then, it will wait 'sleep' number of\n"
@@ -232,7 +239,8 @@
 "extension exists in either the context defined in ${EXITCONTEXT} or the current\n"
 "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";
+"to the Dial application.\n"
+);
 
 enum {
 	OPT_ANNOUNCE =          (1 << 0),
@@ -2116,8 +2124,8 @@
 	else
 		ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free_ptr, "app_dial");
 
-	res = ast_register_application(app, dial_exec, synopsis, descrip);
-	res |= ast_register_application(rapp, retrydial_exec, rsynopsis, rdescrip);
+	res = AST_REGISTER_APPLICATION(app, dial_exec);
+	res |= AST_REGISTER_APPLICATION(rapp, retrydial_exec);
 
 	return res;
 }




More information about the asterisk-commits mailing list