[asterisk-commits] russell: branch group/addons-merge-1.6.2 r204386 - in /team/group/addons-merg...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 30 08:18:06 CDT 2009


Author: russell
Date: Tue Jun 30 08:18:02 2009
New Revision: 204386

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=204386
Log:
Create addons directory, add a module

Added:
    team/group/addons-merge-1.6.2/README-addons.txt   (with props)
    team/group/addons-merge-1.6.2/addons/
    team/group/addons-merge-1.6.2/addons/app_saycountpl.c   (with props)
Modified:
    team/group/addons-merge-1.6.2/Makefile

Modified: team/group/addons-merge-1.6.2/Makefile
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/addons-merge-1.6.2/Makefile?view=diff&rev=204386&r1=204385&r2=204386
==============================================================================
--- team/group/addons-merge-1.6.2/Makefile (original)
+++ team/group/addons-merge-1.6.2/Makefile Tue Jun 30 08:18:02 2009
@@ -293,7 +293,7 @@
 #	value directly to ASTCFLAGS
 ASTCFLAGS+=$(MALLOC_DEBUG)$(OPTIONS)
 
-MOD_SUBDIRS:=channels pbx apps codecs formats cdr bridges funcs tests main res $(LOCAL_MOD_SUBDIRS)
+MOD_SUBDIRS:=channels pbx apps codecs formats cdr bridges funcs tests main res addons $(LOCAL_MOD_SUBDIRS)
 OTHER_SUBDIRS:=utils agi
 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)

Added: team/group/addons-merge-1.6.2/README-addons.txt
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/addons-merge-1.6.2/README-addons.txt?view=auto&rev=204386
==============================================================================
--- team/group/addons-merge-1.6.2/README-addons.txt (added)
+++ team/group/addons-merge-1.6.2/README-addons.txt Tue Jun 30 08:18:02 2009
@@ -1,0 +1,1 @@
+TODO: explain addons licensing issues...

Propchange: team/group/addons-merge-1.6.2/README-addons.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/addons-merge-1.6.2/README-addons.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/addons-merge-1.6.2/README-addons.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/group/addons-merge-1.6.2/addons/app_saycountpl.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/addons-merge-1.6.2/addons/app_saycountpl.c?view=auto&rev=204386
==============================================================================
--- team/group/addons-merge-1.6.2/addons/app_saycountpl.c (added)
+++ team/group/addons-merge-1.6.2/addons/app_saycountpl.c Tue Jun 30 08:18:02 2009
@@ -1,0 +1,112 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * saycountpl application
+ * 
+ * Copyright (C) 2004, Andy Powell & TAAN Softworks Corp. 
+ *
+ */
+
+#include <asterisk.h>
+#include <asterisk/file.h>
+#include <asterisk/logger.h>
+#include <asterisk/channel.h>
+#include <asterisk/pbx.h>
+#include <asterisk/module.h>
+#include <asterisk/lock.h>
+#include <asterisk/app.h>
+
+/*** DOCUMENTATION
+	<application name="SayCountPL" language="en_US">
+		<synopsis>
+			Say Polish counting words.
+		</synopsis>
+		<syntax>
+			<parameter name="word1" required="true" />
+			<parameter name="word2" required="true" />
+			<parameter name="word5" required="true" />
+			<parameter name="number" required="true" />
+		</syntax>
+		<description>
+			<para>Polish grammar has some funny rules for counting words. for example 1 zloty,
+			2 zlote, 5 zlotych. This application will take the words for 1, 2-4 and 5 and
+			decide based on grammar rules which one to use with the number you pass to it.</para>
+			<para>Example: SayCountPL(zloty,zlote,zlotych,122) will give: zlote</para>
+		</description>
+	</application>
+
+ ***/
+static char *app = "SayCountPL";
+
+static int saywords(struct ast_channel *chan, char *word1, char *word2, char *word5, int num)
+{
+	/* Put this in a separate proc because it's bound to change */
+	int d = 0;
+
+	if (num > 0) {
+		if (num % 1000 == 1) {
+			ast_streamfile(chan, word1, chan->language);
+			d = ast_waitstream(chan,"");
+		} else if (((num % 10) >= 2) && ((num % 10) <= 4 ) && ((num % 100) < 10 || (num % 100) > 20)) {
+			ast_streamfile(chan, word2, chan->language);
+			d = ast_waitstream(chan, "");
+		} else {
+			ast_streamfile(chan, word5, chan->language);
+			d = ast_waitstream(chan, "");
+		}
+	}
+
+	return d;
+}
+
+
+static int sayword_exec(struct ast_channel *chan, void *data)
+{
+	int res = 0;
+	char *s;
+	int inum;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(word1);
+		AST_APP_ARG(word2);
+		AST_APP_ARG(word5);
+		AST_APP_ARG(num);
+	);
+
+	if (!data) {
+		ast_log(LOG_WARNING, "SayCountPL requires 4 arguments: word-1,word-2,word-5,number\n");
+		return -1;
+	}
+
+	s = ast_strdupa(data);
+
+	AST_STANDARD_APP_ARGS(args, s);
+
+	/* Check to see if params passed */
+	if (!args.word1 || !args.word2 || !args.word5 || !args.num) {
+		ast_log(LOG_WARNING, "SayCountPL requires 4 arguments: word-1,word-2,word-3,number\n");
+		return -1;
+	}
+
+	if (sscanf(args.num, "%d", &inum) != 1) {
+		ast_log(LOG_WARNING, "'%s' is not a valid number\n", args.num);
+		return -1;
+	}
+
+	/* do the saying part (after a bit of maths) */
+
+	res = saywords(chan, args.word1, args.word2, args.word5, inum);
+
+	return res;
+}
+
+static int unload_module(void)
+{
+	return ast_unregister_application(app);
+}
+
+static int load_module(void)
+{
+	return ast_register_application_xml(app, sayword_exec);
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Say polish counting words");

Propchange: team/group/addons-merge-1.6.2/addons/app_saycountpl.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/addons-merge-1.6.2/addons/app_saycountpl.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/addons-merge-1.6.2/addons/app_saycountpl.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list