[svn-commits] branch oej/jitterbuffer r25434 - in /team/oej/jitterbuffer: ./ apps/ build_to...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon May 8 04:03:43 MST 2006


Author: oej
Date: Mon May  8 06:03:42 2006
New Revision: 25434

URL: http://svn.digium.com/view/asterisk?rev=25434&view=rev
Log:
reset automerge

Modified:
    team/oej/jitterbuffer/   (props changed)
    team/oej/jitterbuffer/apps/app_meetme.c
    team/oej/jitterbuffer/apps/app_voicemail.c
    team/oej/jitterbuffer/asterisk.c
    team/oej/jitterbuffer/build_tools/make_version
    team/oej/jitterbuffer/build_tools/menuselect.c
    team/oej/jitterbuffer/build_tools/menuselect.h
    team/oej/jitterbuffer/channels/misdn/isdn_lib.c
    team/oej/jitterbuffer/configs/func_odbc.conf.sample
    team/oej/jitterbuffer/file.c
    team/oej/jitterbuffer/frame.c
    team/oej/jitterbuffer/funcs/func_odbc.c
    team/oej/jitterbuffer/include/asterisk/pbx.h
    team/oej/jitterbuffer/pbx.c
    team/oej/jitterbuffer/pbx/pbx_dundi.c
    team/oej/jitterbuffer/say.c
    team/oej/jitterbuffer/static-http/ajamdemo.html
    team/oej/jitterbuffer/strcompat.c

Propchange: team/oej/jitterbuffer/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/jitterbuffer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/oej/jitterbuffer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/jitterbuffer/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon May  8 06:03:42 2006
@@ -1,1 +1,1 @@
-/trunk:1-25138
+/trunk:1-25414

Modified: team/oej/jitterbuffer/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/apps/app_meetme.c?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/apps/app_meetme.c (original)
+++ team/oej/jitterbuffer/apps/app_meetme.c Mon May  8 06:03:42 2006
@@ -1,4 +1,3 @@
-
 /*
  * Asterisk -- An open source telephony toolkit.
  *
@@ -2151,9 +2150,12 @@
 								break;
 							} else {
 								/* Pin invalid */
-								res = ast_streamfile(chan, "conf-invalidpin", chan->language);
-								if (!res)
-									ast_waitstream(chan, AST_DIGIT_ANY);
+								if (!ast_streamfile(chan, "conf-invalidpin", chan->language))
+									res = ast_waitstream(chan, AST_DIGIT_ANY);
+								else {
+									ast_log(LOG_WARNING, "Couldn't play invalid pin msg!\n");
+									break;
+								}
 								if (res < 0) {
 									AST_LIST_LOCK(&confs);
 									cnf->refcount--;

Modified: team/oej/jitterbuffer/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/apps/app_voicemail.c?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/apps/app_voicemail.c (original)
+++ team/oej/jitterbuffer/apps/app_voicemail.c Mon May  8 06:03:42 2006
@@ -37,6 +37,8 @@
  * 07-11-2005 : An issue with voicemail synchronization has been fixed by GDS Partners (www.gdspartners.com)
  *				 Stojan Sljivic <stojan.sljivic at gdspartners.com>
  *
+ * 12-04-2006 : Support for Polish added by DIR (www.dir.pl)
+ *				 Bartosz Supczinski <Bartosz.Supczinski at dir.pl>
  */
 
 #include <stdlib.h>
@@ -161,6 +163,7 @@
 	\arg \b fr - French
 	\arg \b it = Italian
 	\arg \b nl - Dutch
+	\arg \b pt - Polish
 	\arg \b pt - Portuguese
 	\arg \b gr - Greek
 	\arg \b no - Norwegian
@@ -179,6 +182,16 @@
 NB these are plural:
 \arg \b vm-INBOX	nieuwe (nl)
 \arg \b vm-Old		oude (nl)
+
+Polish uses:
+\arg \b vm-new-a	'new', feminine singular accusative
+\arg \b vm-new-e	'new', feminine plural accusative
+\arg \b vm-new-ych	'new', feminine plural genitive
+\arg \b vm-old-a	'old', feminine singular accusative
+\arg \b vm-old-e	'old', feminine plural accusative
+\arg \b vm-old-ych	'old', feminine plural genitive
+\arg \b digits/1-a	'one', not always same as 'digits/1'
+\arg \b digits/2-ie	'two', not always same as 'digits/2'
 
 Swedish uses:
 \arg \b vm-nytt		singular of 'new'
@@ -3688,10 +3701,12 @@
 #endif
 	if (the_zone)
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone);
-       else if(!strcasecmp(chan->language,"se"))       /* SWEDISH syntax */
-               res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' dB 'digits/at' k 'and' M", NULL);
-       else if(!strcasecmp(chan->language,"no"))       /* NORWEGIAN syntax */
-               res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
+	else if(!strcasecmp(chan->language,"pl"))	/* POLISH syntax */
+		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q HM", NULL);
+	else if(!strcasecmp(chan->language,"se"))       /* SWEDISH syntax */
+		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' dB 'digits/at' k 'and' M", NULL);
+	else if(!strcasecmp(chan->language,"no"))       /* NORWEGIAN syntax */
+		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
 	else if(!strcasecmp(chan->language,"de"))	/* GERMAN syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
 	else if (!strcasecmp(chan->language,"nl"))	/* DUTCH syntax */
@@ -3788,9 +3803,37 @@
 
 	ast_log(LOG_DEBUG, "VM-Duration: duration is: %d seconds converted to: %d minutes\n", durations, durationm);
 
-	if((!res)&&(durationm>=minduration)) {
-		res = ast_say_number(chan, durationm, AST_DIGIT_ANY, chan->language, (char *) NULL);
-		res = wait_file2(chan, vms, "vm-minutes");
+	if ((!res) && (durationm >= minduration)) {
+		res = wait_file2(chan, vms, "vm-duration");
+
+		/* POLISH syntax */
+		if (!strcasecmp(chan->language, "pl")) {
+			div_t num = div(durationm, 10);
+
+			if (durationm == 1) {
+				res = ast_play_and_wait(chan, "digits/1z");
+				res = res ? res : ast_play_and_wait(chan, "vm-minute-ta");
+			} else if (num.rem > 1 && num.rem < 5 && num.quot != 1) {
+				if (num.rem == 2) {
+					if (!num.quot) {
+						res = ast_play_and_wait(chan, "digits/2-ie");
+					} else {
+						res = say_and_wait(chan, durationm - 2 , chan->language);
+						res = res ? res : ast_play_and_wait(chan, "digits/2-ie");
+					}
+				} else {
+					res = say_and_wait(chan, durationm, chan->language);
+				}
+				res = res ? res : ast_play_and_wait(chan, "vm-minute-ty");
+			} else {
+				res = say_and_wait(chan, durationm, chan->language);
+				res = res ? res : ast_play_and_wait(chan, "vm-minute-t");
+			}
+		/* DEFAULT syntax */
+		} else {
+			res = ast_say_number(chan, durationm, AST_DIGIT_ANY, chan->language, NULL);
+			res = wait_file2(chan, vms, "vm-minutes");
+		}
 	}
 	return res;
 }
@@ -3810,21 +3853,45 @@
 	else if (vms->curmsg == vms->lastmsg)
 		res = wait_file2(chan, vms, "vm-last");		/* "last" */
 	if (!res) {
-               if (!strcasecmp(chan->language, "se")) {             /* SWEDISH syntax */
-                       res = wait_file2(chan, vms, "vm-meddelandet");  /* "message" */
-               }
-               else {
-                       res = wait_file2(chan, vms, "vm-message");      /* "message" */
-               }
-		if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
+		/* POLISH syntax */
+		if (!strcasecmp(chan->language, "pl")) { 
+			if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
+				int ten, one;
+				char nextmsg[256];
+				ten = (vms->curmsg + 1) / 10;
+				one = (vms->curmsg + 1) % 10;
+				
+				if (vms->curmsg < 20) {
+					snprintf(nextmsg, sizeof(nextmsg), "digits/n-%d", vms->curmsg + 1);
+					res = wait_file2(chan, vms, nextmsg);
+				} else {
+					snprintf(nextmsg, sizeof(nextmsg), "digits/n-%d", ten * 10);
+					res = wait_file2(chan, vms, nextmsg);
+					if (one > 0) {
+						if (!res) {
+							snprintf(nextmsg, sizeof(nextmsg), "digits/n-%d", one);
+							res = wait_file2(chan, vms, nextmsg);
+						}
+					}
+				}
+			}
 			if (!res)
-				res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, (char *) NULL);
+				res = wait_file2(chan, vms, "vm-message");
+		} else {
+			if (!strcasecmp(chan->language, "se")) /* SWEDISH syntax */
+				res = wait_file2(chan, vms, "vm-meddelandet");  /* "message" */
+			else /* DEFAULT syntax */
+				res = wait_file2(chan, vms, "vm-message");
+			if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
+				if (!res)
+					res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, NULL);
+			}
 		}
 	}
 
 	/* Retrieve info from VM attribute file */
 	make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg);
-	snprintf(filename,sizeof(filename), "%s.txt", vms->fn2);
+	snprintf(filename, sizeof(filename), "%s.txt", vms->fn2);
 	RETRIEVE(vms->curdir, vms->curmsg);
 	msg_cfg = ast_config_load(filename);
 	if (!msg_cfg) {
@@ -3980,14 +4047,26 @@
 
 	if (!strcasecmp(mbox, "vm-INBOX") || !strcasecmp(mbox, "vm-Old")){
 		cmd = ast_play_and_wait(chan, buf); /* "NEA / PALIA" */
-		if (cmd)
-		return cmd;
-		return ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */
+		return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */
 	} else {
 		cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */
-	  	if (cmd)
-			return cmd;
-	  	return ast_play_and_wait(chan, mbox); /* friends/family/work... -> "FILWN"/"OIKOGENIAS"/"DOULEIAS"*/
+	  	return cmd ? cmd : ast_play_and_wait(chan, mbox); /* friends/family/work... -> "FILWN"/"OIKOGENIAS"/"DOULEIAS"*/
+	}
+}
+
+static int vm_play_folder_name_pl(struct ast_channel *chan, char *mbox)
+{
+	int cmd;
+
+	if (!strcasecmp(mbox, "vm-INBOX") || !strcasecmp(mbox, "vm-Old")) {
+		if (!strcasecmp(mbox, "vm-INBOX"))
+			cmd = ast_play_and_wait(chan, "vm-new-e");
+		else
+			cmd = ast_play_and_wait(chan, "vm-old-e");
+		return cmd ? cmd : ast_play_and_wait(chan, "vm-messages");
+	} else {
+		cmd = ast_play_and_wait(chan, "vm-messages");
+	  	return cmd ? cmd : ast_play_and_wait(chan, mbox);
 	}
 }
 
@@ -3997,16 +4076,14 @@
 
 	if (!strcasecmp(chan->language, "it") || !strcasecmp(chan->language, "es") || !strcasecmp(chan->language, "fr") || !strcasecmp(chan->language, "pt")) { /* Italian, Spanish, French or Portuguese syntax */
 		cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages */
-		if (cmd)
-			return cmd;
-		return ast_play_and_wait(chan, mbox);
+		return cmd ? cmd : ast_play_and_wait(chan, mbox);
 	} else if (!strcasecmp(chan->language, "gr")){
 		return vm_play_folder_name_gr(chan, mbox);
+	} else if (!strcasecmp(chan->language, "pl")){
+		return vm_play_folder_name_pl(chan, mbox);
 	} else {  /* Default English */
 		cmd = ast_play_and_wait(chan, mbox);
-		if (cmd)
-			return cmd;
-		return ast_play_and_wait(chan, "vm-messages"); /* "messages */
+		return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages */
 	}
 }
 
@@ -4138,6 +4215,77 @@
 	return res ? -1 : 0;
 }
 
+/* POLISH syntax */
+static int vm_intro_pl(struct ast_channel *chan, struct vm_state *vms)
+{
+	/* Introduce messages they have */
+	int res;
+	div_t num;
+
+	if (!vms->oldmessages && !vms->newmessages) {
+		res = ast_play_and_wait(chan, "vm-no");
+		res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		return res;
+	} else {
+		res = ast_play_and_wait(chan, "vm-youhave");
+	}
+
+	if (vms->newmessages) {
+		num = div(vms->newmessages, 10);
+		if (vms->newmessages == 1) {
+			res = ast_play_and_wait(chan, "digits/1-a");
+			res = res ? res : ast_play_and_wait(chan, "vm-new-a");
+			res = res ? res : ast_play_and_wait(chan, "vm-message");
+		} else if (num.rem > 1 && num.rem < 5 && num.quot != 1) {
+			if (num.rem == 2) {
+				if (!num.quot) {
+					res = ast_play_and_wait(chan, "digits/2-ie");
+				} else {
+					res = say_and_wait(chan, vms->newmessages - 2 , chan->language);
+					res = res ? res : ast_play_and_wait(chan, "digits/2-ie");
+				}
+			} else {
+				res = say_and_wait(chan, vms->newmessages, chan->language);
+			}
+			res = res ? res : ast_play_and_wait(chan, "vm-new-e");
+			res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		} else {
+			res = say_and_wait(chan, vms->newmessages, chan->language);
+			res = res ? res : ast_play_and_wait(chan, "vm-new-ych");
+			res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		}
+		if (!res && vms->oldmessages)
+			res = ast_play_and_wait(chan, "vm-and");
+	}
+	if (!res && vms->oldmessages) {
+		num = div(vms->oldmessages, 10);
+		if (vms->oldmessages == 1) {
+			res = ast_play_and_wait(chan, "digits/1-a");
+			res = res ? res : ast_play_and_wait(chan, "vm-old-a");
+			res = res ? res : ast_play_and_wait(chan, "vm-message");
+		} else if (num.rem > 1 && num.rem < 5 && num.quot != 1) {
+			if (num.rem == 2) {
+				if (!num.quot) {
+					res = ast_play_and_wait(chan, "digits/2-ie");
+				} else {
+					res = say_and_wait(chan, vms->oldmessages - 2 , chan->language);
+					res = res ? res : ast_play_and_wait(chan, "digits/2-ie");
+				}
+			} else {
+				res = say_and_wait(chan, vms->oldmessages, chan->language);
+			}
+			res = res ? res : ast_play_and_wait(chan, "vm-old-e");
+			res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		} else {
+			res = say_and_wait(chan, vms->oldmessages, chan->language);
+			res = res ? res : ast_play_and_wait(chan, "vm-old-ych");
+			res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		}
+	}
+
+	return res;
+}
+
 /* SWEDISH syntax */
 static int vm_intro_se(struct ast_channel *chan, struct vm_state *vms)
 {
@@ -4647,6 +4795,8 @@
 		return vm_intro_cz(chan, vms);
 	} else if (!strcasecmp(chan->language, "gr")) {	/* GREEK syntax */
 		return vm_intro_gr(chan, vms);
+	} else if (!strcasecmp(chan->language, "pl")) {	/* POLISH syntax */
+		return vm_intro_pl(chan, vms);
 	} else if (!strcasecmp(chan->language, "se")) {	/* SWEDISH syntax */
 		return vm_intro_se(chan, vms);
 	} else if (!strcasecmp(chan->language, "no")) {	/* NORWEGIAN syntax */

Modified: team/oej/jitterbuffer/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/asterisk.c?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/asterisk.c (original)
+++ team/oej/jitterbuffer/asterisk.c Mon May  8 06:03:42 2006
@@ -2529,6 +2529,7 @@
 			fclose(f);
 		} else
 			ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno));
+		ast_mainpid = getpid();
 	}
 
 	/* Test recursive mutex locking. */

Modified: team/oej/jitterbuffer/build_tools/make_version
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/build_tools/make_version?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/build_tools/make_version (original)
+++ team/oej/jitterbuffer/build_tools/make_version Mon May  8 06:03:42 2006
@@ -3,7 +3,7 @@
 if [ -f ${1}/.version ]; then
 	cat ${1}.version
 elif [ -f ${1}/.svnrevision ]; then
-	echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}.svnrevision`
+	echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision`
 elif [ -d .svn ]; then
     PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/asterisk/:: | sed -e 's:/: :g'`
     BRANCH=0

Modified: team/oej/jitterbuffer/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/build_tools/menuselect.c?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/build_tools/menuselect.c (original)
+++ team/oej/jitterbuffer/build_tools/menuselect.c Mon May  8 06:03:42 2006
@@ -72,46 +72,34 @@
 };
 
 /*! The list of trees from makeopts.xml files */
-AST_LIST_HEAD_NOLOCK_STATIC(trees, tree);
-
-const char * const makeopts_files[] = {
+static AST_LIST_HEAD_NOLOCK_STATIC(trees, tree);
+
+static const char * const makeopts_files[] = {
 	"makeopts.xml"
 };
 
-char *output_makeopts = OUTPUT_MAKEOPTS_DEFAULT;
+static char *output_makeopts = OUTPUT_MAKEOPTS_DEFAULT;
 
 /*! This is set to 1 if menuselect.makeopts pre-existed the execution of this app */
-int existing_config = 0;
+static int existing_config = 0;
 
 /*! This is set when the --check-deps argument is provided. */
-int check_deps = 0;
+static int check_deps = 0;
 
 /*! Force a clean of the source tree */
-int force_clean = 0;
-
-int add_category(struct category *cat);
-int add_member(struct member *mem, struct category *cat);
-int parse_makeopts_xml(const char *makeopts_xml);
-int process_deps(void);
-int build_member_list(void);
-void mark_as_present(const char *member, const char *category);
-int parse_existing_config(const char *infile);
-int generate_makeopts_file(void);
-void free_member_list(void);
-void free_trees(void);
-
-/*! \brief a wrapper for calloc() that generates an error message if the allocation fails */
-static inline void *my_calloc(size_t num, size_t len)
-{
-	void *tmp;
-
-	tmp = calloc(num, len);
-	
-	if (!tmp)
-		fprintf(stderr, "Memory allocation error!\n");
-
-	return tmp;
-}
+static int force_clean = 0;
+
+static int add_category(struct category *cat);
+static int add_member(struct member *mem, struct category *cat);
+static int parse_makeopts_xml(const char *makeopts_xml);
+static int process_deps(void);
+static int build_member_list(void);
+static void mark_as_present(const char *member, const char *category);
+static void process_prev_failed_deps(char *buf);
+static int parse_existing_config(const char *infile);
+static int generate_makeopts_file(void);
+static void free_member_list(void);
+static void free_trees(void);
 
 /*! \brief return a pointer to the first non-whitespace character */
 static inline char *skip_blanks(char *str)
@@ -126,7 +114,7 @@
 }
 
 /*! \brief Add a category to the category list, ensuring that there are no duplicates */
-int add_category(struct category *cat)
+static int add_category(struct category *cat)
 {
 	struct category *tmp;
 
@@ -142,7 +130,7 @@
 }
 
 /*! \brief Add a member to the member list of a category, ensuring that there are no duplicates */
-int add_member(struct member *mem, struct category *cat)
+static int add_member(struct member *mem, struct category *cat)
 {
 	struct member *tmp;
 
@@ -158,7 +146,7 @@
 }
 
 /*! \brief Parse an input makeopts file */
-int parse_makeopts_xml(const char *makeopts_xml)
+static int parse_makeopts_xml(const char *makeopts_xml)
 {
 	FILE *f;
 	struct category *cat;
@@ -177,7 +165,7 @@
 		return -1;
 	}
 
-	if (!(tree = my_calloc(1, sizeof(*tree)))) {
+	if (!(tree = calloc(1, sizeof(*tree)))) {
 		fclose(f);
 		return -1;
 	}
@@ -195,7 +183,7 @@
 	     cur;
 	     cur = mxmlFindElement(cur, menu, "category", NULL, NULL, MXML_DESCEND))
 	{
-		if (!(cat = my_calloc(1, sizeof(*cat))))
+		if (!(cat = calloc(1, sizeof(*cat))))
 			return -1;
 
 		cat->name = mxmlElementGetAttr(cur, "name");
@@ -214,29 +202,23 @@
 		     cur2;
 		     cur2 = mxmlFindElement(cur2, cur, "member", NULL, NULL, MXML_DESCEND))
 		{
-			if (!(mem = my_calloc(1, sizeof(*mem))))
+			if (!(mem = calloc(1, sizeof(*mem))))
 				return -1;
 			
+			mem->name = mxmlElementGetAttr(cur2, "name");
+		
 			if (!cat->positive_output)
-				mem->enabled = 1; /* Enabled by default */
-
-			mem->name = mxmlElementGetAttr(cur2, "name");
-			
+				mem->enabled = 1;
+	
 			cur3 = mxmlFindElement(cur2, cur2, "defaultenabled", NULL, NULL, MXML_DESCEND);
-			if (cur3 && cur3->child) {
-				if (!strcasecmp("no", cur3->child->value.opaque))
-					mem->enabled = 0;
-				else if (!strcasecmp("yes", cur3->child->value.opaque))
-					mem->enabled = 1;
-				else
-					fprintf(stderr, "Invalid value '%s' for <defaultenabled> !\n", cur3->child->value.opaque);
-			}
+			if (cur3 && cur3->child)
+				mem->defaultenabled = cur3->child->value.opaque;
 			
 			for (cur3 = mxmlFindElement(cur2, cur2, "depend", NULL, NULL, MXML_DESCEND);
 			     cur3 && cur3->child;
 			     cur3 = mxmlFindElement(cur3, cur2, "depend", NULL, NULL, MXML_DESCEND))
 			{
-				if (!(dep = my_calloc(1, sizeof(*dep))))
+				if (!(dep = calloc(1, sizeof(*dep))))
 					return -1;
 				if (!strlen_zero(cur3->child->value.opaque)) {
 					dep->name = cur3->child->value.opaque;
@@ -249,7 +231,7 @@
 			     cur3 && cur3->child;
 			     cur3 = mxmlFindElement(cur3, cur2, "conflict", NULL, NULL, MXML_DESCEND))
 			{
-				if (!(cnf = my_calloc(1, sizeof(*cnf))))
+				if (!(cnf = calloc(1, sizeof(*cnf))))
 					return -1;
 				if (!strlen_zero(cur3->child->value.opaque)) {
 					cnf->name = cur3->child->value.opaque;
@@ -269,7 +251,7 @@
 }
 
 /*! \brief Process dependencies against the input dependencies file */
-int process_deps(void)
+static int process_deps(void)
 {
 	struct category *cat;
 	struct member *mem;
@@ -297,7 +279,7 @@
 		strsep(&p, "=");
 		if (!p)
 			continue;
-		if (!(dep_file = my_calloc(1, sizeof(*dep_file))))
+		if (!(dep_file = calloc(1, sizeof(*dep_file))))
 			break;
 		strncpy(dep_file->name, buf, sizeof(dep_file->name) - 1);
 		dep_file->met = atoi(p);
@@ -321,20 +303,6 @@
 				if (mem->depsfailed)
 					break; /* This dependency is not met, so we can stop now */
 			}
-			if (mem->depsfailed) {
-				if (check_deps && existing_config && mem->enabled) {
-					/* Config already existed, but this module was not disabled.
-					 * However, according to our current list of dependencies that
-					 * have been met, this can not be built. */
-					res = -1;
-					fprintf(stderr, "\nThe existing menuselect.makeopts did not specify that %s should not be built\n", mem->name);
-					fprintf(stderr, "However, menuselect-deps indicates that dependencies for this module have not\n");
-					fprintf(stderr, "been met.  So, either remove the existing menuselect.makeopts file, or run\n");
-					fprintf(stderr, "'make menuselect' to generate a file that is correct.\n\n");
-					goto deps_file_free;
-				}
-				mem->enabled = 0; /* Automatically disable it if dependencies not met */
-			}
 		}
 	}
 
@@ -353,24 +321,8 @@
 				if (mem->conflictsfailed)
 					break; /* This conflict was found, so we can stop now */
 			}
-			if (mem->conflictsfailed) {
-				if (check_deps && existing_config && mem->enabled) {
-					/* Config already existed, but this module was not disabled.
-					 * However, according to our current list of conflicts that
-					 * exist, this can not be built. */
-					res = -1;
-					fprintf(stderr, "\nThe existing menuselect.makeopts did not specify that %s should not be built\n", mem->name);
-					fprintf(stderr, "However, menuselect-deps indicates that conflicts for this module exist.\n");
-					fprintf(stderr, "So, either remove the existing menuselect.makeopts file, or run\n");
-					fprintf(stderr, "'make menuselect' to generate a file that is correct.\n\n");
-					goto deps_file_free;
-				}
-				mem->enabled = 0; /* Automatically disable it if conflicts exist */
-			}
-		}
-	}
-
-deps_file_free:
+		}
+	}
 
 	/* Free the dependency list we built from the file */
 	while ((dep_file = AST_LIST_REMOVE_HEAD(&deps_file, list)))
@@ -380,7 +332,7 @@
 }
 
 /*! \brief Iterate through all of the input makeopts files and call the parse function on them */
-int build_member_list(void)
+static int build_member_list(void)
 {
 	int i;
 	int res = -1;
@@ -396,7 +348,7 @@
 }
 
 /*! \brief Given the string representation of a member and category, mark it as present in a given input file */
-void mark_as_present(const char *member, const char *category)
+static void mark_as_present(const char *member, const char *category)
 {
 	struct category *cat;
 	struct member *mem;
@@ -437,8 +389,45 @@
 	}
 }
 
+/*! \brief Process a previously failed dependency
+ *
+ * If a module was previously disabled because of a failed dependency
+ * or a conflict, and not because the user selected it to be that way,
+ * then it needs to be re-enabled by default if the problem is no longer present.
+ */
+static void process_prev_failed_deps(char *buf)
+{
+	const char *cat_name, *mem_name;
+	struct category *cat;
+	struct member *mem;
+
+	cat_name = strsep(&buf, "=");
+	mem_name = strsep(&buf, "\n");
+
+	if (!cat_name || !mem_name)
+		return;
+
+	AST_LIST_TRAVERSE(&categories, cat, list) {
+		if (strcasecmp(cat->name, cat_name))
+			continue;
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			if (strcasecmp(mem->name, mem_name))
+				continue;
+
+			if (!mem->depsfailed && !mem->conflictsfailed)
+				mem->enabled = 1;			
+	
+			break;
+		}
+		break;	
+	}
+
+	if (!cat || !mem)
+		fprintf(stderr, "Unable to find '%s' in category '%s'\n", mem_name, cat_name);
+}
+
 /*! \brief Parse an existing output makeopts file and enable members previously selected */
-int parse_existing_config(const char *infile)
+static int parse_existing_config(const char *infile)
 {
 	FILE *f;
 	char buf[2048];
@@ -474,13 +463,18 @@
 			fprintf(stderr, "Invalid string in '%s' at line '%d'!\n", output_makeopts, lineno);
 			continue;
 		}
-
+		
 		parse = skip_blanks(parse);
+	
+		if (!strcasecmp(category, "MENUSELECT_DEPSFAILED")) {
+			process_prev_failed_deps(parse);
+			continue;
+		}
+	
 		while ((member = strsep(&parse, " \n"))) {
 			member = skip_blanks(member);
 			if (strlen_zero(member))
 				continue;
-
 			mark_as_present(member, category);
 		}
 	}
@@ -491,7 +485,7 @@
 }
 
 /*! \brief Create the output makeopts file that results from the user's selections */
-int generate_makeopts_file(void)
+static int generate_makeopts_file(void)
 {
 	FILE *f;
 	struct category *cat;
@@ -513,6 +507,14 @@
 		fprintf(f, "\n");
 	}
 
+	/* Output which members were disabled because of failed dependencies or conflicts */
+	AST_LIST_TRAVERSE(&categories, cat, list) {
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			if (mem->depsfailed || mem->conflictsfailed)
+				fprintf(f, "MENUSELECT_DEPSFAILED=%s=%s\n", cat->name, mem->name);
+		}
+	}
+
 	fclose(f);
 
 	return 0;
@@ -520,7 +522,7 @@
 
 #ifdef MENUSELECT_DEBUG
 /*! \brief Print out all of the information contained in our tree */
-void dump_member_list(void)
+static void dump_member_list(void)
 {
 	struct category *cat;
 	struct member *mem;
@@ -545,7 +547,7 @@
 #endif
 
 /*! \brief Free all categories and their members */
-void free_member_list(void)
+static void free_member_list(void)
 {
 	struct category *cat;
 	struct member *mem;
@@ -565,7 +567,7 @@
 }
 
 /*! \brief Free all of the XML trees */
-void free_trees(void)
+static void free_trees(void)
 {
 	struct tree *tree;
 
@@ -608,6 +610,52 @@
 	return count;		
 }
 
+/*! \brief Make sure an existing menuselect.makeopts disabled everything it should have */
+static int sanity_check(void)
+{
+	struct category *cat;
+	struct member *mem;
+
+	AST_LIST_TRAVERSE(&categories, cat, list) {
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			if ((mem->depsfailed || mem->conflictsfailed) && mem->enabled) {
+				fprintf(stderr, "\n***********************************************************\n"
+				                "  The existing menuselect.makeopts file did not specify    \n"
+				                "  that '%s' should not be included.  However, either some  \n"
+				                "  dependencies for this module were not found or a         \n"
+				                "  conflict exists.                                         \n"
+				                "                                                           \n"
+				                "  Either run 'make menuselect' or remove the existing      \n"
+				                "  menuselect.makeopts file to resolve this issue.          \n"
+						"***********************************************************\n\n", mem->name);
+				return -1;
+			}
+		}
+	}
+}
+
+/* \brief Set the forced default values if they exist */
+static void process_defaults(void)
+{
+	struct category *cat;
+	struct member *mem;
+
+	AST_LIST_TRAVERSE(&categories, cat, list) {
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			if (!mem->defaultenabled)
+				continue;
+			
+			if (!strcasecmp(mem->defaultenabled, "yes"))
+				mem->enabled = 1;
+			else if (!strcasecmp(mem->defaultenabled, "no"))
+				mem->enabled = 0;
+			else
+				fprintf(stderr, "Invalid defaultenabled value for '%s' in category '%s'\n", mem->name, cat->name);	
+		}
+	}
+
+}
+
 int main(int argc, char *argv[])
 {
 	int res = 0;
@@ -616,7 +664,10 @@
 	/* Parse the input XML files to build the list of available options */
 	if ((res = build_member_list()))
 		exit(res);
-
+	
+	/* Process module dependencies */
+	res = process_deps();
+	
 	/* The --check-deps option is used to ask this application to check to
 	 * see if that an existing menuselect.makeopts file contails all of the
 	 * modules that have dependencies that have not been met.  If this
@@ -629,16 +680,19 @@
 			res = parse_existing_config(argv[x]);
 			if (!res && !strcasecmp(argv[x], OUTPUT_MAKEOPTS_DEFAULT))
 				existing_config = 1;
-		}
-	}
-
-	/* Process module dependencies */
-	res = process_deps();
+			res = 0;
+		}
+	}
 
 #ifdef MENUSELECT_DEBUG
 	/* Dump the list produced by parsing the various input files */
 	dump_member_list();
 #endif
+
+	if (!existing_config)
+		process_defaults();
+	else if (check_deps)
+		res = sanity_check();
 
 	/* Run the menu to let the user enable/disable options */
 	if (!check_deps && !res)
@@ -664,6 +718,9 @@
 		res = -1;
 	}
 
+	/* In some cases, such as modifying the CFLAGS for the build,
+	 * a "make clean" needs to be forced.  Removing the .lastclean 
+	 * file does this. */
 	if (force_clean)
 		unlink(".lastclean");
 

Modified: team/oej/jitterbuffer/build_tools/menuselect.h
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/build_tools/menuselect.h?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/build_tools/menuselect.h (original)
+++ team/oej/jitterbuffer/build_tools/menuselect.h Mon May  8 06:03:42 2006
@@ -19,7 +19,7 @@
 /*!
  * \file
  *
- * \brief defaults for menuselect
+ * \brief public data structures and defaults for menuselect
  *
  */
 
@@ -37,6 +37,8 @@
 struct member {
 	/*! What will be sent to the makeopts file */
 	const char *name;
+	/*! Default setting */
+	const char *defaultenabled;
 	/*! This module is currently selected */
 	int enabled;
 	/*! This module has failed dependencies */

Modified: team/oej/jitterbuffer/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channels/misdn/isdn_lib.c?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/channels/misdn/isdn_lib.c (original)
+++ team/oej/jitterbuffer/channels/misdn/isdn_lib.c Mon May  8 06:03:42 2006
@@ -2358,6 +2358,8 @@
 					/* I think we should send CC_RELEASE_CR, but am not sure*/
 					empty_chan_in_stack(stack, bc->channel);
 					empty_bc(bc);
+					bc_state_change(bc,BCHAN_CLEANED);
+
 					cb_log(-1, stack->port, "GOT IGNORE SETUP\n");
 
 					

Modified: team/oej/jitterbuffer/configs/func_odbc.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/configs/func_odbc.conf.sample?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/configs/func_odbc.conf.sample (original)
+++ team/oej/jitterbuffer/configs/func_odbc.conf.sample Mon May  8 06:03:42 2006
@@ -34,4 +34,5 @@
 dsn=mysql1
 read=SELECT location FROM presence WHERE id='${SQL_ESC(${ARG1})}'
 write=UPDATE presence SET location='${SQL_ESC(${VAL1})}' WHERE id='${SQL_ESC(${ARG1})}'
+;prefix=OFFICE		; Changes this function from ODBC_PRESENCE to OFFICE_PRESENCE
 

Modified: team/oej/jitterbuffer/file.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/file.c?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/file.c (original)
+++ team/oej/jitterbuffer/file.c Mon May  8 06:03:42 2006
@@ -1056,6 +1056,7 @@
 					return -1;
 				case AST_CONTROL_RINGING:
 				case AST_CONTROL_ANSWER:
+				case AST_CONTROL_VIDUPDATE:
 					/* Unimportant */
 					break;
 				default:

Modified: team/oej/jitterbuffer/frame.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/frame.c?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/frame.c (original)
+++ team/oej/jitterbuffer/frame.c Mon May  8 06:03:42 2006
@@ -304,17 +304,17 @@
 struct ast_frame *ast_frisolate(struct ast_frame *fr)
 {
 	struct ast_frame *out;
+	void *newdata;
+	
 	if (!(fr->mallocd & AST_MALLOCD_HDR)) {
 		/* Allocate a new header if needed */
-		if (!(out = ast_frame_header_new())) {
+		if (!(out = ast_frame_header_new()))
 			return NULL;
-		}
 		out->frametype = fr->frametype;
 		out->subclass = fr->subclass;
 		out->datalen = fr->datalen;
 		out->samples = fr->samples;
 		out->offset = fr->offset;
-		out->src = NULL;
 		out->data = fr->data;
 #ifdef AST_JB
 		/* Copy the timing data */
@@ -326,25 +326,29 @@
 			out->seqno = fr->seqno;
 		}
 #endif /* AST_JB */
-	} else {
+	} else
 		out = fr;
-	}
+	
 	if (!(fr->mallocd & AST_MALLOCD_SRC)) {
 		if (fr->src)
 			out->src = strdup(fr->src);
 	} else
 		out->src = fr->src;
+	
 	if (!(fr->mallocd & AST_MALLOCD_DATA))  {
-		if (!(out->data = ast_malloc(fr->datalen + AST_FRIENDLY_OFFSET))) {
+		if (!(newdata = ast_malloc(fr->datalen + AST_FRIENDLY_OFFSET))) {
 			free(out);
 			return NULL;
 		}
-		out->data += AST_FRIENDLY_OFFSET;
+		newdata += AST_FRIENDLY_OFFSET;
 		out->offset = AST_FRIENDLY_OFFSET;
 		out->datalen = fr->datalen;
-		memcpy(out->data, fr->data, fr->datalen);
-	}
+		memcpy(newdata, fr->data, fr->datalen);
+		out->data = newdata;
+	}
+
 	out->mallocd = AST_MALLOCD_HDR | AST_MALLOCD_SRC | AST_MALLOCD_DATA;
+	
 	return out;
 }
 

Modified: team/oej/jitterbuffer/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/funcs/func_odbc.c?rev=25434&r1=25433&r2=25434&view=diff
==============================================================================
--- team/oej/jitterbuffer/funcs/func_odbc.c (original)
+++ team/oej/jitterbuffer/funcs/func_odbc.c Mon May  8 06:03:42 2006
@@ -47,23 +47,21 @@
 #include "asterisk/module.h"
 #include "asterisk/config.h"
 #include "asterisk/res_odbc.h"
+#include "asterisk/app.h"
 
 static char *tdesc = "ODBC lookups";
 
 static char *config = "func_odbc.conf";
 
 struct acf_odbc_query {
-	char name[30];
+	AST_LIST_ENTRY(acf_odbc_query) list;
 	char dsn[30];
 	char sql_read[2048];
 	char sql_write[2048];
 	struct ast_custom_function *acf;
-	unsigned int deleteme:1;
-	struct acf_odbc_query *next;
 };
 
-static struct acf_odbc_query *queries = NULL;
-AST_MUTEX_DEFINE_STATIC(query_lock);
+AST_LIST_HEAD_STATIC(queries, acf_odbc_query);
 
 #ifdef NEEDTRACE
 static void acf_odbc_error(SQLHSTMT stmt, int res)
@@ -95,16 +93,16 @@
 	char *tracefile = "/tmp/odbc.trace";
 #endif
 
-	ast_mutex_lock(&query_lock);
-	for (query=queries; query; query = query->next) {
-		if (!strcasecmp(query->name, cmd + 5)) {
+	AST_LIST_LOCK(&queries);
+	AST_LIST_TRAVERSE(&queries, query, list) {
+		if (!strcmp(query->acf->name, cmd)) {
 			break;
 		}
 	}
 
 	if (!query) {
 		ast_log(LOG_ERROR, "No such function '%s'\n", cmd);
-		ast_mutex_unlock(&query_lock);
+		AST_LIST_UNLOCK(&queries);
 		return -1;
 	}
 
@@ -112,7 +110,7 @@
 
 	if (!obj) {
 		ast_log(LOG_ERROR, "No such DSN registered (or out of connections): %s (check res_odbc.conf)\n", query->dsn);
-		ast_mutex_unlock(&query_lock);
+		AST_LIST_UNLOCK(&queries);
 		return -1;
 	}
 
@@ -121,7 +119,7 @@
 
 	if (!s || !t) {
 		ast_log(LOG_ERROR, "Out of memory\n");
-		ast_mutex_unlock(&query_lock);
+		AST_LIST_UNLOCK(&queries);
 		return -1;
 	}
 
@@ -171,7 +169,7 @@
 	pbx_builtin_setvar_helper(chan, "VALUE", pbx_builtin_getvar_helper(ast, "VALUE"));
 
 	ast_channel_free(ast);
-	ast_mutex_unlock(&query_lock);
+	AST_LIST_UNLOCK(&queries);
 
 retry_write:
 #ifdef NEEDTRACE
@@ -242,7 +240,7 @@
 	struct odbc_obj *obj;
 	struct acf_odbc_query *query;
 	char *arg, sql[2048] = "", varname[15];
-	int count=0, res, x;
+	int count=0, res, x, buflen = 0;
 	SQLHSTMT stmt;
 	SQLSMALLINT colcount=0;
 	SQLINTEGER indicator;
@@ -251,16 +249,16 @@
 	char *tracefile = "/tmp/odbc.trace";
 #endif
 
-	ast_mutex_lock(&query_lock);
-	for (query=queries; query; query = query->next) {
-		if (!strcasecmp(query->name, cmd + 5)) {
+	AST_LIST_LOCK(&queries);
+	AST_LIST_TRAVERSE(&queries, query, list) {
+		if (!strcmp(query->acf->name, cmd)) {
 			break;
 		}
 	}
 
 	if (!query) {
 		ast_log(LOG_ERROR, "No such function '%s'\n", cmd);
-		ast_mutex_unlock(&query_lock);
+		AST_LIST_UNLOCK(&queries);
 		return -1;
 	}
 
@@ -268,7 +266,7 @@
 
 	if (!obj) {
 		ast_log(LOG_ERROR, "No such DSN registered (or out of connections): %s (check res_odbc.conf)\n", query->dsn);
-		ast_mutex_unlock(&query_lock);
+		AST_LIST_UNLOCK(&queries);
 		return -1;
 	}
 
@@ -292,7 +290,7 @@
 		pbx_builtin_setvar_helper(chan, varname, NULL);
 	}
 
-	ast_mutex_unlock(&query_lock);
+	AST_LIST_UNLOCK(&queries);
 
 	res = SQLAllocHandle (SQL_HANDLE_STMT, obj->con, &stmt);
 	if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
@@ -336,7 +334,7 @@
 	}
 
 	for (x = 0; x < colcount; x++) {
-		int buflen, coldatalen;
+		int i;
 		char coldata[256];
 
 		buflen = strlen(buf);
@@ -352,12 +350,24 @@
 			return -1;
 		}
 
-		strncat(buf + buflen, coldata, len - buflen);
-		coldatalen = strlen(coldata);
-		strncat(buf + buflen + coldatalen, ",", len - buflen - coldatalen);
+		/* Copy data, encoding '\' and ',' for the argument parser */
+		for (i = 0; i < sizeof(coldata); i++) {
+			if (coldata[i] == '\\' || coldata[i] == ',') {
+				buf[buflen++] = '\\';
+			}
+			buf[buflen++] = coldata[i];
+
+			if (buflen >= len - 2)
+				break;
+
+			if (coldata[i] == '\0')
+				break;
+		}
+
+		buf[buflen - 1] = ',';
 	}
 	/* Trim trailing comma */
-	buf[strlen(buf) - 1] = '\0';
+	buf[buflen - 1] = '\0';
 
 acf_out:
 	SQLFreeHandle(SQL_HANDLE_STMT, stmt);
@@ -400,11 +410,9 @@
 		return -1;
 	}
 
-	*query = calloc(1, sizeof(struct acf_odbc_query));
+	*query = ast_calloc(1, sizeof(struct acf_odbc_query));
 	if (! (*query))
 		return -1;
-
-	ast_copy_string((*query)->name, catg, sizeof((*query)->name));
 
 	if ((tmp = ast_variable_retrieve(cfg, catg, "dsn"))) {
 		ast_copy_string((*query)->dsn, tmp, sizeof((*query)->dsn));
@@ -420,54 +428,80 @@
 		ast_copy_string((*query)->sql_write, tmp, sizeof((*query)->sql_write));
 	}
 
-	(*query)->acf = calloc(1, sizeof(struct ast_custom_function));
-	if ((*query)->acf) {
+	(*query)->acf = ast_calloc(1, sizeof(struct ast_custom_function));
+	if (! (*query)->acf) {
+		free(*query);
+		return -1;
+	}
+
+	if ((tmp = ast_variable_retrieve(cfg, catg, "prefix")) && !ast_strlen_zero(tmp)) {
+		asprintf((char **)&((*query)->acf->name), "%s_%s", tmp, catg);
+	} else {
 		asprintf((char **)&((*query)->acf->name), "ODBC_%s", catg);
-		asprintf((char **)&((*query)->acf->syntax), "ODBC_%s(<arg1>[...[,<argN>]])", catg);
-		(*query)->acf->synopsis = "Runs the referenced query with the specified arguments";
-		if (!ast_strlen_zero((*query)->sql_read) && !ast_strlen_zero((*query)->sql_write)) {
-			asprintf((char **)&((*query)->acf->desc),
-						"Runs the following query, as defined in func_odbc.conf, performing\n"
-					   	"substitution of the arguments into the query as specified by ${ARG1},\n"
-						"${ARG2}, ... ${ARGn}.  When setting the function, the values are provided\n"
-						"either in whole as ${VALUE} or parsed as ${VAL1}, ${VAL2}, ... ${VALn}.\n"
-						"\nRead:\n%s\n\nWrite:\n%s\n",
-						(*query)->sql_read,

[... 767 lines stripped ...]


More information about the svn-commits mailing list