[asterisk-commits] mmichelson: branch mmichelson/queue-reset r168940 - in /team/mmichelson/queue...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 16 15:46:49 CST 2009


Author: mmichelson
Date: Fri Jan 16 15:46:49 2009
New Revision: 168940

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168940
Log:
Resolve the conflict and reset automerge


Modified:
    team/mmichelson/queue-reset/   (props changed)
    team/mmichelson/queue-reset/CHANGES
    team/mmichelson/queue-reset/apps/app_meetme.c
    team/mmichelson/queue-reset/apps/app_voicemail.c
    team/mmichelson/queue-reset/build_tools/menuselect-deps.in
    team/mmichelson/queue-reset/cdr/cdr_adaptive_odbc.c
    team/mmichelson/queue-reset/cdr/cdr_odbc.c
    team/mmichelson/queue-reset/channels/chan_misdn.c
    team/mmichelson/queue-reset/channels/chan_sip.c
    team/mmichelson/queue-reset/configs/extconfig.conf.sample
    team/mmichelson/queue-reset/configs/sip.conf.sample
    team/mmichelson/queue-reset/configure
    team/mmichelson/queue-reset/configure.ac
    team/mmichelson/queue-reset/funcs/func_odbc.c
    team/mmichelson/queue-reset/include/asterisk/say.h
    team/mmichelson/queue-reset/include/asterisk/strings.h
    team/mmichelson/queue-reset/main/say.c
    team/mmichelson/queue-reset/makeopts.in
    team/mmichelson/queue-reset/res/ael/pval.c
    team/mmichelson/queue-reset/res/res_config_odbc.c
    team/mmichelson/queue-reset/res/res_odbc.c
    team/mmichelson/queue-reset/res/res_timing_timerfd.c

Propchange: team/mmichelson/queue-reset/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/mmichelson/queue-reset/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/mmichelson/queue-reset/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jan 16 15:46:49 2009
@@ -1,1 +1,1 @@
-/trunk:1-168666
+/trunk:1-168939

Modified: team/mmichelson/queue-reset/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/CHANGES?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/CHANGES (original)
+++ team/mmichelson/queue-reset/CHANGES Fri Jan 16 15:46:49 2009
@@ -40,7 +40,7 @@
    version received is different from the current SDP session version.  This
    option is required to interoperate with devices that have non-standard SDP
    session version implementations (observed with Microsoft OCS).  This option
-   is diabled by default.
+   is disabled by default.
  * The parsing of register => lines in sip.conf has been modified to allow a port
    to be present in the "user" portion. Please see the sip.conf.sample file for more
    information

Modified: team/mmichelson/queue-reset/apps/app_meetme.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/apps/app_meetme.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/apps/app_meetme.c (original)
+++ team/mmichelson/queue-reset/apps/app_meetme.c Fri Jan 16 15:46:49 2009
@@ -2187,10 +2187,12 @@
 		user->user_no = AST_LIST_LAST(&conf->userlist)->user_no + 1;
 
 	if (rt_schedule && conf->maxusers)
-		if (user->user_no > conf->maxusers) {
+		if (conf->users >= conf->maxusers) {
 			/* Sorry, but this confernce has reached the participant limit! */	
 			if (!ast_streamfile(chan, "conf-full", chan->language))
 				ast_waitstream(chan, "");
+			ast_mutex_unlock(&conf->playlock);
+			user->user_no = 0;
 			goto outrun;
 		}
 

Modified: team/mmichelson/queue-reset/apps/app_voicemail.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/apps/app_voicemail.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/apps/app_voicemail.c (original)
+++ team/mmichelson/queue-reset/apps/app_voicemail.c Fri Jan 16 15:46:49 2009
@@ -47,10 +47,8 @@
 /*** MAKEOPTS
 <category name="MENUSELECT_OPTS_app_voicemail" displayname="Voicemail Build Options" positive_output="yes" remove_on_change="apps/app_voicemail.o apps/app_voicemail.so apps/app_directory.o apps/app_directory.so">
 	<member name="ODBC_STORAGE" displayname="Storage of Voicemail using ODBC">
-		<depend>odbc</depend>
+		<depend>generic_odbc</depend>
 		<depend>ltdl</depend>
-		<use>unixodbc</use>
-		<use>iodbc</use>
 		<conflict>IMAP_STORAGE</conflict>
 		<defaultenabled>no</defaultenabled>
 	</member>
@@ -7176,7 +7174,102 @@
 	return res;
 }
 
-/* Hebrew syntax */
+/* Version of vm_intro() designed to work for many languages.
+ *
+ * It is hoped that this function can prevent the proliferation of 
+ * language-specific vm_intro() functions and in time replace the language-
+ * specific functions which already exist.  An examination of the language-
+ * specific functions revealed that they all corrected the same deficiencies
+ * in vm_intro_en() (which was the default function). Namely:
+ *
+ *  1) The vm-Old and vm-INBOX sound files were overloaded.  The English 
+ *     wording of the voicemail greeting hides this problem.  For example,
+ *     vm-INBOX contains only the word "new".  This means that both of these
+ *     sequences produce valid utterances:
+ *      * vm-youhave digit/1 vm-INBOX vm-message (you have one new message)
+ *      * vm-press digit/1 vm-for vm-INBOX vm-messages (press 1 for new messages)
+ *     However, if we rerecord vm-INBOX to say "the new" (which is unavoidable
+ *     in many languages) the first utterance becomes "you have 1 the new message".
+ *  2) The function contains hardcoded rules for pluralizing the word "message".
+ *     These rules are correct for English, but not for many other languages.
+ *  3) No attempt is made to pluralize the adjectives ("old" and "new") as
+ *     required in many languages.
+ *  4) The gender of the word for "message" is not specified. This is a problem
+ *     because in many languages the gender of the number in phrases such
+ *     as "you have one new message" must match the gender of the word
+ *     meaning "message".
+ *
+ * Fixing these problems for each new language has meant duplication of effort.
+ * This new function solves the problems in the following general ways:
+ *  1) Add new sound files vm-new and vm-old.  These can be linked to vm-INBOX
+ *     and vm-Old respectively for those languages where it makes sense.
+ *  2) Call ast_say_counted_noun() to put the proper gender and number prefix
+ *     on vm-message.
+ *  3) Call ast_say_counted_adjective() to put the proper gender and number
+ *     prefix on vm-new and vm-old (none for English).
+ *  4) Pass the gender of the language's word for "message" as an agument to
+ *     this function which is can in turn pass on to the functions which 
+ *     say numbers and put endings on nounds and adjectives.
+ *
+ * All languages require these messages:
+ *  vm-youhave		"You have..."
+ *  vm-and		"and"
+ *  vm-no		"no" (in the sense of "none", as in "you have no messages")
+ *
+ * To use it for English, you will need these additional sound files:
+ *  vm-new		"new"
+ *  vm-message		"message", singular
+ *  vm-messages		"messages", plural
+ *
+ * If you use it for Russian and other slavic languages, you will need these additional sound files:
+ *
+ *  vm-newn		"novoye" (singular, neuter)
+ *  vm-newx		"novikh" (counting plural form, genative plural)
+ *  vm-message		"sobsheniye" (singular form)
+ *  vm-messagex1	"sobsheniya" (first counting plural form, genative singular)
+ *  vm-messagex2	"sobsheniy" (second counting plural form, genative plural)
+ *  digits/1n		"odno" (neuter singular for phrases such as "one message" or "thirty one messages")
+ *  digits/2n		"dva" (neuter singular)
+ */
+static int vm_intro_multilang(struct ast_channel *chan, struct vm_state *vms, const char message_gender[])
+{
+	int res;
+	int lastnum = 0;
+
+	res = ast_play_and_wait(chan, "vm-youhave");
+
+	if (!res && vms->newmessages) {
+		lastnum = vms->newmessages;
+
+		if (!(res = ast_say_number(chan, lastnum, AST_DIGIT_ANY, chan->language, message_gender))) {
+			res = ast_say_counted_adjective(chan, lastnum, "vm-new", message_gender);
+		}
+
+		if (!res && vms->oldmessages) {
+			res = ast_play_and_wait(chan, "vm-and");
+		}
+	}
+
+	if (!res && vms->oldmessages) {
+		lastnum = vms->oldmessages;
+
+		if (!(res = ast_say_number(chan, lastnum, AST_DIGIT_ANY, chan->language, message_gender))) {
+			res = ast_say_counted_adjective(chan, lastnum, "vm-old", message_gender);
+		}
+	}
+
+	if (!res) {
+		if (lastnum == 0) {
+			res = ast_play_and_wait(chan, "vm-no");
+		} else {
+			res = ast_say_counted_noun(chan, lastnum, "vm-message");
+		}
+	}
+
+	return res;
+}
+
+/* Default Hebrew syntax */
 static int vm_intro_he(struct ast_channel *chan, struct vm_state *vms)
 {
 	int res = 0;
@@ -7859,78 +7952,6 @@
 	return res;
 }
 
-static int get_lastdigits(int num)
-{
-	num %= 100;
-	return (num < 20) ? num : num % 10;
-}
-
-static int vm_intro_ru(struct ast_channel *chan,struct vm_state *vms)
-{
-	int res;
-	int lastnum = 0;
-	int dcnum;
-
-	res = ast_play_and_wait(chan, "vm-youhave");
-	if (!res && vms->newmessages) {
-		lastnum = get_lastdigits(vms->newmessages);
-		dcnum = vms->newmessages - lastnum;
-		if (dcnum)
-			res = say_and_wait(chan, dcnum, chan->language);
-		if (!res && lastnum) {
-			if (lastnum == 1) 
-				res = ast_play_and_wait(chan, "digits/odno");
-			else
-				res = say_and_wait(chan, lastnum, chan->language);
-		}
-
-		if (!res)
-			res = ast_play_and_wait(chan, (lastnum == 1) ? "vm-novoe" : "vm-novyh");
-
-		if (!res && vms->oldmessages)
-			res = ast_play_and_wait(chan, "vm-and");
-	}
-
-	if (!res && vms->oldmessages) {
-		lastnum = get_lastdigits(vms->oldmessages);
-		dcnum = vms->oldmessages - lastnum;
-		if (dcnum)
-			res = say_and_wait(chan, dcnum, chan->language);
-		if (!res && lastnum) {
-			if (lastnum == 1) 
-				res = ast_play_and_wait(chan, "digits/odno");
-			else
-				res = say_and_wait(chan, lastnum, chan->language);
-		}
-
-		if (!res)
-			res = ast_play_and_wait(chan, (lastnum == 1) ? "vm-staroe" : "vm-staryh");
-	}
-
-	if (!res && !vms->newmessages && !vms->oldmessages) {
-		lastnum = 0;
-		res = ast_play_and_wait(chan, "vm-no");
-	}
-
-	if (!res) {
-		switch (lastnum) {
-		case 1:
-			res = ast_play_and_wait(chan, "vm-soobshenie");
-			break;
-		case 2:
-		case 3:
-		case 4:
-			res = ast_play_and_wait(chan, "vm-soobsheniya");
-			break;
-		default:
-			res = ast_play_and_wait(chan, "vm-soobsheniy");
-			break;
-		}
-	}
-
-	return res;
-}
-
 /* CHINESE (Taiwan) syntax */
 static int vm_intro_tw(struct ast_channel *chan, struct vm_state *vms)
 {
@@ -7967,77 +7988,6 @@
 		if (!res)
 			res = ast_play_and_wait(chan, "vm-messages");
 	}
-	return res;
-}
-
-/* UKRAINIAN syntax */
-/* in ukrainian the syntax is different so we need the following files
- * --------------------------------------------------------
- * /digits/ua/1e 'odne'
- * vm-nove       'nove'
- * vm-stare      'stare'
- */
-static int vm_intro_ua(struct ast_channel *chan,struct vm_state *vms)
-{
-	int res;
-	int lastnum = 0;
-	int dcnum;
-
-	res = ast_play_and_wait(chan, "vm-youhave");
-	if (!res && vms->newmessages) {
-		lastnum = get_lastdigits(vms->newmessages);
-		dcnum = vms->newmessages - lastnum;
-		if (dcnum)
-			res = say_and_wait(chan, dcnum, chan->language);
-		if (!res && lastnum) {
-			if (lastnum == 1) 
-				res = ast_play_and_wait(chan, "digits/ua/1e");
-			else
-				res = say_and_wait(chan, lastnum, chan->language);
-		}
-
-		if (!res)
-			res = ast_play_and_wait(chan, (lastnum == 1) ? "vm-nove" : "vm-INBOX");
-
-		if (!res && vms->oldmessages)
-			res = ast_play_and_wait(chan, "vm-and");
-	}
-
-	if (!res && vms->oldmessages) {
-		lastnum = get_lastdigits(vms->oldmessages);
-		dcnum = vms->oldmessages - lastnum;
-		if (dcnum)
-			res = say_and_wait(chan, dcnum, chan->language);
-		if (!res && lastnum) {
-			if (lastnum == 1) 
-				res = ast_play_and_wait(chan, "digits/ua/1e");
-			else
-				res = say_and_wait(chan, lastnum, chan->language);
-		}
-
-		if (!res)
-			res = ast_play_and_wait(chan, (lastnum == 1) ? "vm-stare" : "vm-Old");
-	}
-
-	if (!res && !vms->newmessages && !vms->oldmessages) {
-		lastnum = 0;
-		res = ast_play_and_wait(chan, "vm-no");
-	}
-
-	if (!res) {
-		switch (lastnum) {
-		case 1:
-		case 2:
-		case 3:
-		case 4:
-			res = ast_play_and_wait(chan, "vm-message");
-			break;
-		default:
-			res = ast_play_and_wait(chan, "vm-messages");
-			break;
-		}
-	}
-
 	return res;
 }
 
@@ -8081,11 +8031,11 @@
 	} else if (!strcasecmp(chan->language, "no")) {	/* NORWEGIAN syntax */
 		return vm_intro_no(chan, vms);
 	} else if (!strcasecmp(chan->language, "ru")) { /* RUSSIAN syntax */
-		return vm_intro_ru(chan, vms);
+		return vm_intro_multilang(chan, vms, "n");
 	} else if (!strcasecmp(chan->language, "tw")) { /* CHINESE (Taiwan) syntax */
 		return vm_intro_tw(chan, vms);
 	} else if (!strcasecmp(chan->language, "ua")) { /* UKRAINIAN syntax */
-		return vm_intro_ua(chan, vms);
+		return vm_intro_multilang(chan, vms, "n");
 	} else if (!strcasecmp(chan->language, "he")) { /* HEBREW syntax */
 		 return vm_intro_he(chan, vms);
 	} else {					/* Default to ENGLISH */

Modified: team/mmichelson/queue-reset/build_tools/menuselect-deps.in
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/build_tools/menuselect-deps.in?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/build_tools/menuselect-deps.in (original)
+++ team/mmichelson/queue-reset/build_tools/menuselect-deps.in Fri Jan 16 15:46:49 2009
@@ -3,6 +3,7 @@
 CURL=@PBX_CURL@
 DAHDI=@PBX_DAHDI@
 FREETDS=@PBX_FREETDS@
+GENERIC_ODBC=@PBX_GENERIC_ODBC@
 GMIME=@PBX_GMIME@
 GNU_LD=@GNU_LD@
 GSM=@PBX_GSM@
@@ -24,7 +25,6 @@
 NBS=@PBX_NBS@
 NETSNMP=@PBX_NETSNMP@
 NEWT=@PBX_NEWT@
-ODBC=@PBX_ODBC@
 OGG=@PBX_OGG@
 OPENH323=@PBX_OPENH323@
 OSPTK=@PBX_OSPTK@

Modified: team/mmichelson/queue-reset/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/cdr/cdr_adaptive_odbc.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/cdr/cdr_adaptive_odbc.c (original)
+++ team/mmichelson/queue-reset/cdr/cdr_adaptive_odbc.c Fri Jan 16 15:46:49 2009
@@ -25,9 +25,8 @@
  */
 
 /*** MODULEINFO
-	<depend>odbc</depend>
-	<use>unixodbc</use>
-	<use>iodbc</use>
+	<depend>generic_odbc</depend>
+	<depend>ltdl</depend>
  ***/
 
 #include "asterisk.h"

Modified: team/mmichelson/queue-reset/cdr/cdr_odbc.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/cdr/cdr_odbc.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/cdr/cdr_odbc.c (original)
+++ team/mmichelson/queue-reset/cdr/cdr_odbc.c Fri Jan 16 15:46:49 2009
@@ -29,10 +29,8 @@
  */
 
 /*** MODULEINFO
-	<depend>odbc</depend>
+	<depend>generic_odbc</depend>
 	<depend>ltdl</depend>
-	<use>unixodbc</use>
-	<use>iodbc</use>
  ***/
 
 #include "asterisk.h"

Modified: team/mmichelson/queue-reset/channels/chan_misdn.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/channels/chan_misdn.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/channels/chan_misdn.c (original)
+++ team/mmichelson/queue-reset/channels/chan_misdn.c Fri Jan 16 15:46:49 2009
@@ -5493,7 +5493,7 @@
 		}
 
 		if (strlen(args.arg[0]) >= sizeof(ch->bc->fac_out.u.CDeflection.DeflectedToNumber)) {
-			ast_log(LOG_WARNING, "Facility: Number argument too long (up to %d digits are allowed). Ignoring.\n", sizeof(ch->bc->fac_out.u.CDeflection.DeflectedToNumber));
+			ast_log(LOG_WARNING, "Facility: Number argument too long (up to %ld digits are allowed). Ignoring.\n", sizeof(ch->bc->fac_out.u.CDeflection.DeflectedToNumber));
 			return 0;
 		}
 		ch->bc->fac_out.Function = Fac_CD;

Modified: team/mmichelson/queue-reset/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/channels/chan_sip.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/channels/chan_sip.c (original)
+++ team/mmichelson/queue-reset/channels/chan_sip.c Fri Jan 16 15:46:49 2009
@@ -6875,7 +6875,7 @@
 	if (hostname)
 		*hostname++ = '\0';
 	if (ast_strlen_zero(username) || ast_strlen_zero(hostname)) {
-		ast_log(LOG_WARNING, "Format for registration is [transport://]user[:secret[:authuser]]@host[:port][/contact][~expiry] at line %d\n", lineno);
+		ast_log(LOG_WARNING, "Format for registration is [transport://]user[:secret[:authuser]]@domain[:port][/extension][~expiry] at line %d\n", lineno);
 		return -1;
 	}
 
@@ -8055,11 +8055,13 @@
 		return -1;
 	}
 
+	if (sip_cfg.compactheaders) {
+		var = find_alias(var, var);
+	}
+
 	ast_str_append(&req->data, 0, "%s: %s\r\n", var, value);
 	req->header[req->headers] = req->data->str + req->len;
 
-	if (sip_cfg.compactheaders)
-		var = find_alias(var, var);
 	req->len += strlen(req->header[req->headers]);
 	req->headers++;
 
@@ -8085,10 +8087,6 @@
 	if (!req->lines)
 		/* Add extra empty return */
 		req->len += ast_str_append(&req->data, 0, "\r\n");
-	if (req->len >= sizeof(req->data->str) - 4) {
-		ast_log(LOG_WARNING, "Out of space, can't add anymore\n");
-		return -1;
-	}
 	req->line[req->lines] = req->data->str + req->len;
 	ast_str_append(&req->data, 0, "%s", line);
 	req->len += strlen(req->line[req->lines]);

Modified: team/mmichelson/queue-reset/configs/extconfig.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/configs/extconfig.conf.sample?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/configs/extconfig.conf.sample (original)
+++ team/mmichelson/queue-reset/configs/extconfig.conf.sample Fri Jan 16 15:46:49 2009
@@ -56,6 +56,7 @@
 ;sipregs => odbc,asterisk
 ;voicemail => odbc,asterisk
 ;extensions => odbc,asterisk
+;meetme => mysql,conferences
 ;queues => odbc,asterisk
 ;queue_members => odbc,asterisk
 ;musiconhold => mysql,asterisk

Modified: team/mmichelson/queue-reset/configs/sip.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/configs/sip.conf.sample?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/configs/sip.conf.sample (original)
+++ team/mmichelson/queue-reset/configs/sip.conf.sample Fri Jan 16 15:46:49 2009
@@ -413,16 +413,20 @@
 ;----------------------------------------- OUTBOUND SIP REGISTRATIONS  ------------------------
 ; Asterisk can register as a SIP user agent to a SIP proxy (provider)
 ; Format for the register statement is:
-;       register => [transport://]user[:secret[:authuser]]@host[:port][/extension][~expiry]
+;       register => [transport://]user[:secret[:authuser]]@domain[:port][/extension][~expiry]
 ;
 ; 
+;
+; domain is either 
+;	- domain in DNS
+; 	- host name in DNS
+;	- the name of a peer defined below or in realtime
+; The domain is where you register your username, so your SIP uri you are registering to 
+; is username at domain
 ;
 ; If no extension is given, the 's' extension is used. The extension needs to
 ; be defined in extensions.conf to be able to accept calls from this SIP proxy
 ; (provider).
-;
-; host is either a host name defined in DNS or the name of a section defined
-; below.
 ;
 ; A similar effect can be achieved by adding a "callbackextension" option in a peer section.
 ; this is equivalent to having the following line in the general section:

Modified: team/mmichelson/queue-reset/configure.ac
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/configure.ac?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/configure.ac (original)
+++ team/mmichelson/queue-reset/configure.ac Fri Jan 16 15:46:49 2009
@@ -1319,12 +1319,6 @@
 
 AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
 
-PBX_ODBC=0
-if test "$PBX_IODBC" = "1" -o "$PBX_UNIXODBC" = "1"; then
-   PBX_ODBC=1
-fi
-AC_SUBST(PBX_ODBC)
-
 AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
 
 # Non-glibc platforms require libexecinfo for backtrace support
@@ -1682,6 +1676,25 @@
    fi
 fi
 
+# build a GENERIC_ODBC result based on the presence of either UnixODBC (preferred)
+# or iODBC
+
+PBX_GENERIC_ODBC=0
+
+if test "${PBX_UNIXODBC}" = 1; then
+   PBX_GENERIC_ODBC=1
+   GENERIC_ODBC_LIB="${UNIXODBC_LIB}"
+   GENERIC_ODBC_INCLUDE="${UNIXODBC_INCLUDE}"
+elif test "${PBX_IODBC}" = 1; then
+   PBX_GENERIC_ODBC=1
+   GENERIC_ODBC_LIB="${IODBC_LIB}"
+   GENERIC_ODBC_INCLUDE="${IODBC_INCLUDE}"
+fi
+
+AC_SUBST([GENERIC_ODBC_LIB])
+AC_SUBST([GENERIC_ODBC_INCLUDE])
+AC_SUBST([PBX_GENERIC_ODBC])
+
 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
 AST_CHECK_MANDATORY
 

Modified: team/mmichelson/queue-reset/funcs/func_odbc.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/funcs/func_odbc.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/funcs/func_odbc.c (original)
+++ team/mmichelson/queue-reset/funcs/func_odbc.c Fri Jan 16 15:46:49 2009
@@ -27,11 +27,7 @@
  */
 
 /*** MODULEINFO
-	<depend>odbc</depend>
-	<depend>ltdl</depend>
 	<depend>res_odbc</depend>
-	<use>unixodbc</use>
-	<use>iodbc</use>
  ***/
 
 #define USE_ODBC

Modified: team/mmichelson/queue-reset/include/asterisk/say.h
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/include/asterisk/say.h?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/include/asterisk/say.h (original)
+++ team/mmichelson/queue-reset/include/asterisk/say.h Fri Jan 16 15:46:49 2009
@@ -163,6 +163,10 @@
 
 SAY_EXTERN int (* ast_say_date_with_format)(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezone) SAY_INIT(ast_say_date_with_format);
 
+int ast_say_counted_noun(struct ast_channel *chan, int num, const char *noun);
+
+int ast_say_counted_adjective(struct ast_channel *chan, int num, const char *adjective, const char *gender);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/mmichelson/queue-reset/include/asterisk/strings.h
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/include/asterisk/strings.h?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/include/asterisk/strings.h (original)
+++ team/mmichelson/queue-reset/include/asterisk/strings.h Fri Jan 16 15:46:49 2009
@@ -765,17 +765,18 @@
 #include <sqlext.h>
 #include <sqltypes.h>
 
-AST_INLINE_API(SQLRETURN ast_str_SQLGetData(struct ast_str **buf, size_t maxlen, SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, SQLLEN *StrLen_or_Ind),
+AST_INLINE_API(SQLRETURN ast_str_SQLGetData(struct ast_str **buf, int pmaxlen, SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, SQLLEN *StrLen_or_Ind),
 {
 	SQLRETURN res;
-	if (maxlen == 0) {
+	size_t maxlen;
+	if (pmaxlen == 0) {
 		if (SQLGetData(StatementHandle, ColumnNumber, TargetType, (*buf)->__AST_STR_STR, 0, StrLen_or_Ind) == SQL_SUCCESS_WITH_INFO) {
 			ast_str_make_space(buf, *StrLen_or_Ind + 1);
 		}
-		maxlen = (*buf)->__AST_STR_LEN;
-	} else if (maxlen > 0) {
-		ast_str_make_space(buf, maxlen);
-	}
+	} else if (pmaxlen > 0) {
+		ast_str_make_space(buf, pmaxlen);
+	}
+	maxlen = (*buf)->__AST_STR_LEN;
 	res = SQLGetData(StatementHandle, ColumnNumber, TargetType, (*buf)->__AST_STR_STR, maxlen, StrLen_or_Ind);
 	(*buf)->__AST_STR_USED = *StrLen_or_Ind;
 	return res;

Modified: team/mmichelson/queue-reset/main/say.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/main/say.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/main/say.c (original)
+++ team/mmichelson/queue-reset/main/say.c Fri Jan 16 15:46:49 2009
@@ -50,6 +50,7 @@
 #include "asterisk/lock.h"
 #include "asterisk/localtime.h"
 #include "asterisk/utils.h"
+#include "asterisk/app.h"
 
 /* Forward declaration */
 static int wait_file(struct ast_channel *chan, const char *ints, const char *file, const char *lang);
@@ -7754,6 +7755,114 @@
 	return res;
 }
 
+/* In English, we use the plural for everything but one. For example:
+ *  1 degree
+ *  2 degrees
+ *  5 degrees
+ * The filename for the plural form is generated by appending "s". Note that
+ * purpose is to generate a unique filename, not to implement irregular 
+ * declensions. Thus:
+ *  1 man
+ *  2 mans (the "mans" soundfile will of course say "men")
+ */
+static const char *counted_noun_ending_en(int num)
+{
+	if (num == 1 || num == -1) {
+		return "";
+	} else {
+		return "s";
+	}
+}
+
+/* Counting of objects in slavic languages such as Russian and Ukrainian the
+ * rules are more complicated. There are two plural forms used in counting.
+ * They are the genative singular which we represent with the suffix "x1" and 
+ * the genative plural which we represent with the suffix "x2". The base names
+ * of the soundfiles remain in English. For example:
+ *  1 degree (soudfile says "gradus")
+ *  2 degreex1 (soundfile says "gradusa")
+ *  5 degreex2 (soundfile says "gradusov")
+ */
+static const char *counted_noun_ending_slavic(int num)
+{
+    	if (num < 0) {
+	    num *= -1;
+	}
+	num %= 100;			/* never pay attention to more than two digits */
+	if (num >= 20) {		/* for numbers 20 and above, pay attention to only last digit */
+	    num %= 10;
+	}
+	if (num == 1) {			/* singular */
+	    return "";
+	}
+	if (num > 0 && num < 5) {	/* 2--5 get genative singular */
+	    return "x1";
+	} else {			/* 5--19 get genative plural */
+	    return "x2";
+	}
+}
+
+int ast_say_counted_noun(struct ast_channel *chan, int num, const char noun[])
+{
+	char *temp;
+	int temp_len;
+	const char *ending;
+	if (!strcasecmp(chan->language, "ru")) {		/* Russian */
+		ending = counted_noun_ending_slavic(num);
+	} else if(!strcasecmp(chan->language, "ua")) {		/* Ukrainian */
+		ending = counted_noun_ending_slavic(num);
+	} else if(!strcasecmp(chan->language, "ua")) {		/* Polish */
+		ending = counted_noun_ending_slavic(num);
+	} else {						/* English and default */
+		ending = counted_noun_ending_en(num);
+	}
+	temp = alloca((temp_len = (strlen(noun) + strlen(ending) + 1)));
+	snprintf(temp, temp_len, "%s%s", noun, ending);
+	return ast_play_and_wait(chan, temp);
+}
+
+/*
+ * In slavic languages such as Russian and Ukrainian the rules for declining
+ * adjectives are simpler than those for nouns.  When counting we use only
+ * the singular (to which we give no suffix) and the genative plural (which
+ * we represent by adding an "x").  Oh, an in the singular gender matters
+ * so we append the supplied gender suffix ("m", "f", "n").
+ */
+static const char *counted_adjective_ending_ru(int num, const char gender[])
+{
+    	if (num < 0) {
+	    num *= -1;
+	}
+	num %= 100;		/* never pay attention to more than two digits */
+	if (num >= 20) {	/* at 20 and beyond only the last digit matters */
+	    num %= 10;
+	}
+	if (num == 1) {
+	    return gender ? gender : "";
+	} else {		/* all other numbers get the genative plural */
+	    return "x";
+	}
+}
+
+int ast_say_counted_adjective(struct ast_channel *chan, int num, const char adjective[], const char gender[])
+{
+	char *temp;
+	int temp_len;
+	const char *ending;
+	if (!strcasecmp(chan->language, "ru")) {			/* Russian */
+		ending = counted_adjective_ending_ru(num, gender);
+	} else if (!strcasecmp(chan->language, "ua")) {			/* Ukrainian */
+		ending = counted_adjective_ending_ru(num, gender);
+	} else if (!strcasecmp(chan->language, "pl")) {			/* Polish */
+		ending = counted_adjective_ending_ru(num, gender);
+	} else {							/* English and default */
+		ending = "";
+	}
+	temp = alloca((temp_len = (strlen(adjective) + strlen(ending) + 1)));
+	snprintf(temp, temp_len, "%s%s", adjective, ending);
+	return ast_play_and_wait(chan, temp);
+}
+
 
 
 /*

Modified: team/mmichelson/queue-reset/makeopts.in
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/makeopts.in?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/makeopts.in (original)
+++ team/mmichelson/queue-reset/makeopts.in Fri Jan 16 15:46:49 2009
@@ -85,6 +85,9 @@
 FREETDS_INCLUDE=@FREETDS_INCLUDE@
 FREETDS_LIB=@FREETDS_LIB@
 
+GENERIC_ODBC_INCLUDE=@GENERIC_ODBC_INCLUDE@
+GENERIC_ODBC_LIB=@GENERIC_ODBC_LIB@
+
 GMIME_INCLUDE=@GMIME_INCLUDE@
 GMIME_LIB=@GMIME_LIB@
 

Modified: team/mmichelson/queue-reset/res/ael/pval.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/res/ael/pval.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/res/ael/pval.c (original)
+++ team/mmichelson/queue-reset/res/ael/pval.c Fri Jan 16 15:46:49 2009
@@ -745,6 +745,7 @@
 				while ( *p && *p != ']' ) {
 					*r++ = *p++;
 				}
+				*r++ = ']';
 				if ( *p != ']') {
 					ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The extension pattern '%s' is missing a closing bracket \n",
 							here->filename, here->startline, here->endline, pattern);

Modified: team/mmichelson/queue-reset/res/res_config_odbc.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/res/res_config_odbc.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/res/res_config_odbc.c (original)
+++ team/mmichelson/queue-reset/res/res_config_odbc.c Fri Jan 16 15:46:49 2009
@@ -29,11 +29,7 @@
  */
 
 /*** MODULEINFO
-	<depend>odbc</depend>
-	<depend>ltdl</depend>
 	<depend>res_odbc</depend>
-	<use>unixodbc</use>
-	<use>iodbc</use>
  ***/
 
 #include "asterisk.h"

Modified: team/mmichelson/queue-reset/res/res_odbc.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/res/res_odbc.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/res/res_odbc.c (original)
+++ team/mmichelson/queue-reset/res/res_odbc.c Fri Jan 16 15:46:49 2009
@@ -30,10 +30,8 @@
  */
 
 /*** MODULEINFO
-	<depend>odbc</depend>
+	<depend>generic_odbc</depend>
 	<depend>ltdl</depend>
-	<use>unixodbc</use>
-	<use>iodbc</use>
  ***/
 
 #include "asterisk.h"

Modified: team/mmichelson/queue-reset/res/res_timing_timerfd.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/queue-reset/res/res_timing_timerfd.c?view=diff&rev=168940&r1=168939&r2=168940
==============================================================================
--- team/mmichelson/queue-reset/res/res_timing_timerfd.c (original)
+++ team/mmichelson/queue-reset/res/res_timing_timerfd.c Fri Jan 16 15:46:49 2009
@@ -131,13 +131,21 @@
 
 static int timerfd_timer_set_rate(int handle, unsigned int rate)
 {
-	struct itimerspec itspec;
-	itspec.it_value.tv_sec = 0;
-	itspec.it_value.tv_nsec = rate ? (long) (1000000000 / rate) : 0L;
-	itspec.it_interval.tv_sec = itspec.it_value.tv_sec;
-	itspec.it_interval.tv_nsec = itspec.it_value.tv_nsec;
-
-	return timerfd_settime(handle, 0, &itspec, NULL);
+	struct timerfd_timer *our_timer, find_helper = {
+		.handle = handle,
+	};
+
+	if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
+		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
+		return -1;
+	}
+
+	our_timer->saved_timer.it_value.tv_sec = 0;
+	our_timer->saved_timer.it_value.tv_nsec = rate ? (long) (1000000000 / rate) : 0L;
+	our_timer->saved_timer.it_interval.tv_sec = our_timer->saved_timer.it_value.tv_sec;
+	our_timer->saved_timer.it_interval.tv_nsec = our_timer->saved_timer.it_value.tv_nsec;
+
+	return timerfd_settime(handle, 0, &our_timer->saved_timer, NULL);
 }
 
 static void timerfd_timer_ack(int handle, unsigned int quantity)




More information about the asterisk-commits mailing list