[svn-commits] oej: branch oej/pinequeue-trunk r363632 - in /team/oej/pinequeue-trunk: ./ ap...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Apr 25 06:57:27 CDT 2012


Author: oej
Date: Wed Apr 25 06:57:22 2012
New Revision: 363632

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=363632
Log:
Merging to current trunk

Modified:
    team/oej/pinequeue-trunk/   (props changed)
    team/oej/pinequeue-trunk/CHANGES
    team/oej/pinequeue-trunk/apps/app_followme.c
    team/oej/pinequeue-trunk/apps/app_queue.c
    team/oej/pinequeue-trunk/configs/asterisk.conf.sample
    team/oej/pinequeue-trunk/include/asterisk/options.h
    team/oej/pinequeue-trunk/main/asterisk.c
    team/oej/pinequeue-trunk/main/channel.c
    team/oej/pinequeue-trunk/main/say.c

Propchange: team/oej/pinequeue-trunk/
------------------------------------------------------------------------------
    automerge = Is-there-life-off-net?

Propchange: team/oej/pinequeue-trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 25 06:57:22 2012
@@ -1,1 +1,1 @@
-/trunk:1-363506
+/trunk:1-363631

Modified: team/oej/pinequeue-trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/CHANGES?view=diff&rev=363632&r1=363631&r2=363632
==============================================================================
--- team/oej/pinequeue-trunk/CHANGES (original)
+++ team/oej/pinequeue-trunk/CHANGES Wed Apr 25 06:57:22 2012
@@ -27,6 +27,9 @@
    added to any log messages produced by those threads. Log messages can now be
    easily identified as involved with a certain call by looking at their call id.
    This feature can be disabled in logger.conf with the display_callids option.
+ * The minimum DTMF duration can now be configured in asterisk.conf
+   as "mindtmfduration". The default value is (as before) set to 80 ms.
+   (previously it was only available in source code)
 
 CLI Changes
 -------------------

Modified: team/oej/pinequeue-trunk/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/apps/app_followme.c?view=diff&rev=363632&r1=363631&r2=363632
==============================================================================
--- team/oej/pinequeue-trunk/apps/app_followme.c (original)
+++ team/oej/pinequeue-trunk/apps/app_followme.c Wed Apr 25 06:57:22 2012
@@ -130,7 +130,7 @@
 struct call_followme {
 	ast_mutex_t lock;
 	char name[AST_MAX_EXTENSION];	/*!< Name - FollowMeID */
-	char moh[AST_MAX_CONTEXT];	/*!< Music On Hold Class to be used */
+	char moh[MAX_MUSICCLASS];	/*!< Music On Hold Class to be used */
 	char context[AST_MAX_CONTEXT];  /*!< Context to dial from */
 	unsigned int active;		/*!< Profile is active (1), or disabled (0). */
 	int realtime;           /*!< Cached from realtime */

Modified: team/oej/pinequeue-trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/apps/app_queue.c?view=diff&rev=363632&r1=363631&r2=363632
==============================================================================
--- team/oej/pinequeue-trunk/apps/app_queue.c (original)
+++ team/oej/pinequeue-trunk/apps/app_queue.c Wed Apr 25 06:57:22 2012
@@ -1098,7 +1098,7 @@
 
 struct queue_ent {
 	struct call_queue *parent;             /*!< What queue is our parent */
-	char moh[80];                          /*!< Name of musiconhold to be used */
+	char moh[MAX_MUSICCLASS];              /*!< Name of musiconhold to be used */
 	char announce[PATH_MAX];               /*!< Announcement to play for member when call is answered */
 	char context[AST_MAX_CONTEXT];         /*!< Context when user exits queue */
 	char digits[AST_MAX_EXTENSION];        /*!< Digits entered while in queue */
@@ -1127,10 +1127,10 @@
 };
 
 struct member {
-	char interface[80];                  /*!< Technology/Location to dial to reach this member*/
+	char interface[AST_CHANNEL_NAME];    /*!< Technology/Location to dial to reach this member*/
 	char state_exten[AST_MAX_EXTENSION]; /*!< Extension to get state from (if using hint) */
 	char state_context[AST_MAX_CONTEXT]; /*!< Context to use when getting state (if using hint) */
-	char state_interface[80];            /*!< Technology/Location from which to read devicestate changes */
+	char state_interface[AST_CHANNEL_NAME]; /*!< Technology/Location from which to read devicestate changes */
 	char membername[80];                 /*!< Member name to use in queue logs */
 	int penalty;                         /*!< Are we a last resort? */
 	int calls;                           /*!< Number of calls serviced by this member */
@@ -1603,10 +1603,11 @@
 	}
 	ao2_iterator_destroy(&qiter);
 
-	if (found)
+	if (found) {
 		ast_debug(1, "Device '%s' changed to state '%d' (%s)\n", sc->dev, sc->state, ast_devstate2str(sc->state));
-	else
+	} else {
 		ast_debug(3, "Device '%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n", sc->dev, sc->state, ast_devstate2str(sc->state));
+	}
 
 	ast_free(sc);
 	return 0;
@@ -1752,12 +1753,12 @@
 
 static int compress_char(const char c)
 {
-	if (c < 32)
+	if (c < 32) {
 		return 0;
-	else if (c > 96)
+	} else if (c > 96) {
 		return c - 64;
-	else
-		return c - 32;
+	} 
+	return c - 32;
 }
 
 static int member_hash_fn(const void *obj, const int flags)
@@ -1829,11 +1830,12 @@
 	q->timeoutpriority = TIMEOUT_PRIORITY_APP;
 	q->autopausedelay = 0;
 	if (!q->members) {
-		if (q->strategy == QUEUE_STRATEGY_LINEAR || q->strategy == QUEUE_STRATEGY_RRORDERED)
+		if (q->strategy == QUEUE_STRATEGY_LINEAR || q->strategy == QUEUE_STRATEGY_RRORDERED) {
 			/* linear strategy depends on order, so we have to place all members in a single bucket */
 			q->members = ao2_container_alloc(1, member_hash_fn, member_cmp_fn);
-		else
+		} else {
 			q->members = ao2_container_alloc(37, member_hash_fn, member_cmp_fn);
+		}
 	}
 	q->found = 1;
 
@@ -1858,12 +1860,14 @@
 	}
 
 	for (i = 1; i < MAX_PERIODIC_ANNOUNCEMENTS; i++) {
-		if (q->sound_periodicannounce[i])
+		if (q->sound_periodicannounce[i]) {
 			ast_str_set(&q->sound_periodicannounce[i], 0, "%s", "");
-	}
-
-	while ((pr_iter = AST_LIST_REMOVE_HEAD(&q->rules,list)))
+		}
+	}
+
+	while ((pr_iter = AST_LIST_REMOVE_HEAD(&q->rules,list))) {
 		ast_free(pr_iter);
+	}
 }
 
 static void clear_queue(struct call_queue *q)
@@ -1925,8 +1929,9 @@
 
 	rule->time = penaltychangetime;
 
-	if ((minstr = strchr(maxstr,',')))
+	if ((minstr = strchr(maxstr,','))) {
 		*minstr++ = '\0';
+	}
 	
 	/* The last check will evaluate true if either no penalty change is indicated for a given rule
 	 * OR if a min penalty change is indicated but no max penalty change is */
@@ -1937,16 +1942,19 @@
 	rule->max_value = atoi(maxstr);
 
 	if (!ast_strlen_zero(minstr)) {
-		if (*minstr == '+' || *minstr == '-')
+		if (*minstr == '+' || *minstr == '-') {
 			rule->min_relative = 1;
+		}
 		rule->min_value = atoi(minstr);
-	} else /*there was no minimum specified, so assume this means no change*/
+	} else { /*there was no minimum specified, so assume this means no change*/
 		rule->min_relative = 1;
+	}
 
 	/*We have the rule made, now we need to insert it where it belongs*/
 	AST_LIST_TRAVERSE(&rule_lists, rl_iter, list){
-		if (strcasecmp(rl_iter->name, list_name))
+		if (strcasecmp(rl_iter->name, list_name)) {
 			continue;
+		}
 
 		AST_LIST_TRAVERSE_SAFE_BEGIN(&rl_iter->rules, rule_iter, list) {
 			if (rule->time < rule_iter->time) {
@@ -2019,8 +2027,9 @@
 		ast_string_field_set(q, context, val);
 	} else if (!strcasecmp(param, "timeout")) {
 		q->timeout = atoi(val);
-		if (q->timeout < 0)
+		if (q->timeout < 0) {
 			q->timeout = DEFAULT_TIMEOUT;
+		}
 	} else if (!strcasecmp(param, "ringinuse")) {
 		q->ringinuse = ast_true(val);
 	} else if (!strcasecmp(param, "setinterfacevar")) {
@@ -2080,21 +2089,23 @@
 			q->roundingseconds=0;
 		}
 	} else if (!strcasecmp(param, "announce-holdtime")) {
-		if (!strcasecmp(val, "once"))
+		if (!strcasecmp(val, "once")) {
 			q->announceholdtime = ANNOUNCEHOLDTIME_ONCE;
-		else if (ast_true(val))
+		} else if (ast_true(val)) {
 			q->announceholdtime = ANNOUNCEHOLDTIME_ALWAYS;
-		else
+		} else {
 			q->announceholdtime = 0;
+		}
 	} else if (!strcasecmp(param, "announce-position")) {
-		if (!strcasecmp(val, "limit"))
+		if (!strcasecmp(val, "limit")) {
 			q->announceposition = ANNOUNCEPOSITION_LIMIT;
-		else if (!strcasecmp(val, "more"))
+		} else if (!strcasecmp(val, "more")) {
 			q->announceposition = ANNOUNCEPOSITION_MORE_THAN;
-		else if (ast_true(val))
+		} else if (ast_true(val)) {
 			q->announceposition = ANNOUNCEPOSITION_YES;
-		else
+		} else {
 			q->announceposition = ANNOUNCEPOSITION_NO;
+		}
 	} else if (!strcasecmp(param, "announce-position-limit")) {
 		q->announcepositionlimit = atoi(val);
 	} else if (!strcasecmp(param, "periodic-announce")) {
@@ -2103,12 +2114,14 @@
 			unsigned int i = 0;
 
 			while ((s = strsep(&buf, ",|"))) {
-				if (!q->sound_periodicannounce[i])
+				if (!q->sound_periodicannounce[i]) {
 					q->sound_periodicannounce[i] = ast_str_create(16);
+				}
 				ast_str_set(&q->sound_periodicannounce[i], 0, "%s", s);
 				i++;
-				if (i == MAX_PERIODIC_ANNOUNCEMENTS)
+				if (i == MAX_PERIODIC_ANNOUNCEMENTS) {
 					break;
+				}
 			}
 			q->numperiodicannounce = i;
 		} else {
@@ -2123,8 +2136,9 @@
 		q->randomperiodicannounce = ast_true(val);
 	} else if (!strcasecmp(param, "retry")) {
 		q->retry = atoi(val);
-		if (q->retry <= 0)
+		if (q->retry <= 0) {
 			q->retry = DEFAULT_RETRY;
+		}
 	} else if (!strcasecmp(param, "wrapuptime")) {
 		q->wrapuptime = atoi(val);
 	} else if (!strcasecmp(param, "penaltymemberslimit")) {
@@ -2134,8 +2148,9 @@
 	} else if (!strcasecmp(param, "autofill")) {
 		q->autofill = ast_true(val);
 	} else if (!strcasecmp(param, "monitor-type")) {
-		if (!strcasecmp(val, "mixmonitor"))
+		if (!strcasecmp(val, "mixmonitor")) {
 			q->montype = 1;
+		}
 	} else if (!strcasecmp(param, "autopause")) {
 		q->autopause = autopause2int(val);
 	} else if (!strcasecmp(param, "autopausedelay")) {
@@ -2146,8 +2161,9 @@
 		q->autopauseunavail = ast_true(val);
 	} else if (!strcasecmp(param, "maxlen")) {
 		q->maxlen = atoi(val);
-		if (q->maxlen < 0)
+		if (q->maxlen < 0) {
 			q->maxlen = 0;
+		}
 	} else if (!strcasecmp(param, "servicelevel")) {
 		q->servicelevel= atoi(val);
 	} else if (!strcasecmp(param, "strategy")) {
@@ -2324,8 +2340,9 @@
 	free_members(q, 1);
 	ast_string_field_free_memory(q);
 	for (i = 0; i < MAX_PERIODIC_ANNOUNCEMENTS; i++) {
-		if (q->sound_periodicannounce[i])
+		if (q->sound_periodicannounce[i]) {
 			free(q->sound_periodicannounce[i]);
+		}
 	}
 	ao2_ref(q->members, -1);
 }
@@ -2375,11 +2392,10 @@
 				ao2_unlock(q);
 				queue_t_unref(q, "Queue is dead; can't return it");
 				return NULL;
-			} else {
-				ast_log(LOG_WARNING, "Static queue '%s' already exists. Not loading from realtime\n", q->name);
-				ao2_unlock(q);
-				return q;
-			}
+			} 
+			ast_log(LOG_WARNING, "Static queue '%s' already exists. Not loading from realtime\n", q->name);
+			ao2_unlock(q);
+			return q;
 		}
 	} else if (!member_config) {
 		/* Not found in the list, and it's not realtime ... */
@@ -2441,10 +2457,12 @@
 			ast_copy_string(tmpbuf, v->name, sizeof(tmpbuf));
 			tmp_name = tmpbuf;
 			tmp = tmpbuf;
-			while ((tmp = strchr(tmp, '_')))
+			while ((tmp = strchr(tmp, '_'))) {
 				*tmp++ = '-';
-		} else
+			}
+		} else {
 			tmp_name = v->name;
+		}
 
 		/* NULL values don't get returned from realtime; blank values should
 		 * still get set.  If someone doesn't want a value to be set, they
@@ -2556,11 +2574,13 @@
 {
 	int ret = -1;
 
-	if (ast_strlen_zero(mem->rt_uniqueid))
+	if (ast_strlen_zero(mem->rt_uniqueid)) {
  		return ret;
-
-	if ((ast_update_realtime("queue_members", "uniqueid", mem->rt_uniqueid, field, value, SENTINEL)) > 0)
+	}
+
+	if ((ast_update_realtime("queue_members", "uniqueid", mem->rt_uniqueid, field, value, SENTINEL)) > 0) {
 		ret = 0;
+	}
 
 	return ret;
 }
@@ -2584,8 +2604,9 @@
 	/* Temporarily set realtime  members dead so we can detect deleted ones.*/
 	mem_iter = ao2_iterator_init(q->members, 0);
 	while ((m = ao2_iterator_next(&mem_iter))) {
-		if (m->realtime)
+		if (m->realtime) {
 			m->dead = 1;
+		}
 		ao2_ref(m, -1);
 	}
 	ao2_iterator_destroy(&mem_iter);
@@ -2635,9 +2656,9 @@
 			return res;
 		}
 	}
-	if (*reason == QUEUE_UNKNOWN && q->maxlen && (q->count >= q->maxlen))
+	if (*reason == QUEUE_UNKNOWN && q->maxlen && (q->count >= q->maxlen)) {
 		*reason = QUEUE_FULL;
-	else if (*reason == QUEUE_UNKNOWN) {
+	} else if (*reason == QUEUE_UNKNOWN) {
 		/* There's space for us, put us at the right position inside
 		 * the queue.
 		 * Take into account the priority of the calling user */
@@ -2668,8 +2689,9 @@
 			cur = cur->next;
 		}
 		/* No luck, join at the end of the queue */
-		if (!inserted)
+		if (!inserted) {
 			insert_entry(q, prev, qe, &pos);
+		}
 		ast_copy_string(qe->moh, q->moh, sizeof(qe->moh));
 		ast_copy_string(qe->announce, q->announce, sizeof(qe->announce));
 		ast_copy_string(qe->context, q->context, sizeof(qe->context));
@@ -2716,8 +2738,9 @@
 	ast_stopstream(chan);
 
 	res = ast_streamfile(chan, filename, ast_channel_language(chan));
-	if (!res)
+	if (!res) {
 		res = ast_waitstream(chan, AST_DIGIT_ANY);
+	}
 
 	ast_stopstream(chan);
 
@@ -2743,8 +2766,9 @@
 	}
 
 	/* If there's no context to goto, short-circuit */
-	if (ast_strlen_zero(qe->context))
+	if (ast_strlen_zero(qe->context)) {
 		return 0;
+	}
 
 	/* If the extension is bad, then reset the digits to blank */
 	if (!ast_canmatch_extension(qe->chan, qe->context, qe->digits, 1,
@@ -2771,12 +2795,14 @@
 
 	/* Let minannouncefrequency seconds pass between the start of each position announcement */
 	time(&now);
-	if ((now - qe->last_pos) < qe->parent->minannouncefrequency)
+	if ((now - qe->last_pos) < qe->parent->minannouncefrequency) {
 		return 0;
+	}
 
 	/* If either our position has changed, or we are over the freq timer, say position */
-	if ((qe->last_pos_said == qe->pos) && ((now - qe->last_pos) < qe->parent->announcefrequency))
+	if ((qe->last_pos_said == qe->pos) && ((now - qe->last_pos) < qe->parent->announcefrequency)) {
 		return 0;
+	}
 
 	/* Commented out by old Olle patch */
 	/* if (ringing) { */
@@ -2788,45 +2814,52 @@
 	if (qe->parent->announceposition == ANNOUNCEPOSITION_YES ||
 		qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN ||
 		(qe->parent->announceposition == ANNOUNCEPOSITION_LIMIT &&
-		qe->pos <= qe->parent->announcepositionlimit))
+		qe->pos <= qe->parent->announcepositionlimit)) {
 			announceposition = 1;
+	}
 
 
 	if (announceposition == 1) {
 		/* Say we're next, if we are */
 		if (qe->pos == 1) {
 			res = play_file(qe->chan, qe->parent->sound_next, ringing, NULL);
-			if (res)
+			if (res) {
 				goto playout;
-			else
-				goto posout;
+			}
+			goto posout;
 		} else {
 			if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){
 				/* More than Case*/
 			  res = play_file(qe->chan, qe->parent->queue_quantity1, ringing, NULL);
-				if (res)
+				if (res) {
 					goto playout;
+				}
 				res = ast_say_number(qe->chan, qe->parent->announcepositionlimit, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL); /* Needs gender */
-				if (res)
+				if (res) {
 					goto playout;
+				}
 			} else {
 				/* Normal Case */
 				res = play_file(qe->chan, qe->parent->sound_thereare, ringing, NULL);
-				if (res)
+				if (res) {
 					goto playout;
+				}
 				res = ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL); /* Needs gender */
-				if (res)
+				if (res) {
 					goto playout;
+				}
 			}
 			if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){
 				/* More than Case*/
 				res = play_file(qe->chan, qe->parent->queue_quantity2, ringing, NULL);
-				if (res)
+				if (res) {
 					goto playout;
+				}
 			} else {
 				res = play_file(qe->chan, qe->parent->sound_calls, ringing, NULL);
-				if (res)
+				if (res) {
 					goto playout;
+				}
 			}
 		}
 	}
@@ -2849,32 +2882,38 @@
         ((qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE && !qe->last_pos) ||
         !(qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE))) {
 		res = play_file(qe->chan, qe->parent->sound_holdtime,ringing,NULL);
-		if (res)
+		if (res) {
 			goto playout;
+		}
 
 		if (avgholdmins >= 1) {
 			res = ast_say_number(qe->chan, avgholdmins, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL);
-			if (res)
+			if (res) {
 				goto playout;
+			}
 
 			if (avgholdmins == 1) {
 				res = play_file(qe->chan, qe->parent->sound_minute, ringing, NULL);
-				if (res)
+				if (res) {
 					goto playout;
+				}
 			} else {
 				res = play_file(qe->chan, qe->parent->sound_minutes, ringing, NULL);
-				if (res)
+				if (res) {
 					goto playout;
+				}
 			}
 		}
 		if (avgholdsecs >= 1) {
 			res = ast_say_number(qe->chan, avgholdsecs, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL);
-			if (res)
+			if (res) {
 				goto playout;
+			}
 
 			res = play_file(qe->chan, qe->parent->sound_seconds, ringing, NULL);
-			if (res)
+			if (res) {
 				goto playout;
+			}
 		}
 	} else if (qe->parent->announceholdtime && !qe->parent->announceposition) {
 		say_thanks = 0;
@@ -2890,8 +2929,9 @@
 	}
 playout:
 
-	if (res > 0  && !valid_exit(qe, res)) /* in other words, ignore any play_file problems... */
+	if ((res > 0 && !valid_exit(qe, res))) {
 		res = 0;
+	}
 
 	/* Set our last_pos indicators */
 	qe->last_pos = now;
@@ -2957,13 +2997,15 @@
 				ast_channel_name(qe->chan), q->name,  q->count, qe->pos, ast_channel_uniqueid(qe->chan));
 			ast_debug(1, "Queue '%s' Leave, Channel '%s'\n", q->name, ast_channel_name(qe->chan));
 			/* Take us out of the queue */
-			if (prev)
+			if (prev) {
 				prev->next = current->next;
-			else
+			} else {
 				q->head = current->next;
+			}
 			/* Free penalty rules */
-			while ((pr_iter = AST_LIST_REMOVE_HEAD(&qe->qe_rules, list)))
+			while ((pr_iter = AST_LIST_REMOVE_HEAD(&qe->qe_rules, list))) {
 				ast_free(pr_iter);
+			}
 			snprintf(posstr, sizeof(posstr), "%d", qe->pos);
 			pbx_builtin_setvar_helper(qe->chan, "QUEUEPOSITION", posstr);
 		} else {
@@ -3019,8 +3061,9 @@
 		/* If someone else answered the call we should indicate this in the CANCEL */
 		/* Hangup any existing lines we have open */
 		if (outgoing->chan && (outgoing->chan != exception)) {
-			if (exception || cancel_answered_elsewhere)
+			if (exception || cancel_answered_elsewhere) {
 				ast_set_flag(ast_channel_flags(outgoing->chan), AST_FLAG_ANSWERED_ELSEWHERE);
+			}
 			ast_hangup(outgoing->chan);
 		}
 		oo = outgoing;
@@ -3147,8 +3190,9 @@
 		for (i = 0, j = 10; (i < len - 1) && (j < len - 1); i++, j++) {
 			vars[j] = tmp[i];
 
-			if (tmp[i + 1] == '\0')
+			if (tmp[i + 1] == '\0') {
 				break;
+			}
 			if (tmp[i] == '\n') {
 				vars[j++] = '\r';
 				vars[j++] = '\n';
@@ -3157,8 +3201,9 @@
 				j += 9;
 			}
 		}
-		if (j > len - 3)
+		if (j > len - 3) {
 			j = len - 3;
+		}
 		vars[j++] = '\r';
 		vars[j++] = '\n';
 		vars[j] = '\0';
@@ -3244,10 +3289,11 @@
 	}
 
 	ast_copy_string(tech, tmp->interface, sizeof(tech));
-	if ((location = strchr(tech, '/')))
+	if ((location = strchr(tech, '/'))) {
 		*location++ = '\0';
-	else
+	} else {
 		location = "";
+	}
 
 	/* Request the peer */
 	tmp->chan = ast_request(tech, ast_channel_nativeformats(qe->chan), qe->chan, location, &status);
@@ -3500,8 +3546,17 @@
 	time(&now);
 
 	/* Check to see if it is time to announce */
-	if ((now - qe->last_periodic_announce_time) < qe->parent->periodicannouncefrequency)
+	if ((now - qe->last_periodic_announce_time) < qe->parent->periodicannouncefrequency) {
 		return 0;
+	}
+
+	if (!background_prompts) {
+		if (ringing) {
+			ast_indicate(qe->chan,-1);
+		} else {
+			ast_moh_stop(qe->chan);
+		}
+	}
 
 	ast_verb(3, "Playing periodic announcement\n");
 	
@@ -3515,26 +3570,25 @@
 	/* play the announcement */
 	res = play_file(qe->chan, ast_str_buffer(qe->parent->sound_periodicannounce[qe->last_periodic_announce_sound]),ringing, qe->moh);
 
-	/*	if (res > 0 && !valid_exit(qe, res))
-		res = 0;
-	*/
 	/* we no longer check for valid_exit(), as we simply
 	   start the playback and let the autoservice thread
 	   keep it going */
 
 	/* Resume Music on Hold if the caller is going to stay in the queue */
 	if (!res) {
-		if (ringing)
+		if (ringing) {
 			ast_indicate(qe->chan, AST_CONTROL_RINGING);
-		else
+		} else {
 			ast_moh_start(qe->chan, qe->moh, NULL);
+		}
 	}
 
 	/* update last_periodic_announce_time */
-	if (qe->parent->relativeperiodicannounce)
+	if (qe->parent->relativeperiodicannounce) {
 		time(&qe->last_periodic_announce_time);
-	else
+	} else {
 		qe->last_periodic_announce_time = now;
+	}
 
 	/* Update the current periodic announcement to the next announcement */
 	if (!qe->parent->randomperiodicannounce) {
@@ -3676,8 +3730,9 @@
 	starttime = (long) time(NULL);
 #ifdef HAVE_EPOLL
 	for (epollo = outgoing; epollo; epollo = epollo->q_next) {
-		if (epollo->chan)
+		if (epollo->chan) {
 			ast_poll_channel_add(in, epollo->chan);
+		}
 	}
 #endif
 	
@@ -3701,10 +3756,11 @@
 						if (pos < AST_MAX_WATCHERS) {
 							watchers[pos++] = o->chan;
 						}
-						if (!start)
+						if (!start) {
 							start = o;
-						else
+						} else {
 							prev->call_next = o;
+						}
 						prev = o;
 					}
 				}
@@ -3909,15 +3965,17 @@
 							break;
 						case AST_CONTROL_BUSY:
 							ast_verb(3, "%s is busy\n", ochan_name);
-							if (ast_channel_cdr(in))
+							if (ast_channel_cdr(in)) {
 								ast_cdr_busy(ast_channel_cdr(in));
+							}
 							do_hang(o);
 							endtime = (long) time(NULL);
 							endtime -= starttime;
 							rna(endtime * 1000, qe, on, membername, qe->parent->autopausebusy);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
-								if (qe->parent->timeoutrestart)
+								if (qe->parent->timeoutrestart) {
 									*to = orig;
+								}
 								/* Have enough time for a queue member to answer? */
 								if (*to > 500) {
 									ring_one(qe, outgoing, &numbusies);
@@ -3928,15 +3986,17 @@
 							break;
 						case AST_CONTROL_CONGESTION:
 							ast_verb(3, "%s is circuit-busy\n", ochan_name);
-							if (ast_channel_cdr(in))
+							if (ast_channel_cdr(in)) {
 								ast_cdr_busy(ast_channel_cdr(in));
+							}
 							endtime = (long) time(NULL);
 							endtime -= starttime;
 							rna(endtime * 1000, qe, on, membername, qe->parent->autopauseunavail);
 							do_hang(o);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
-								if (qe->parent->timeoutrestart)
+								if (qe->parent->timeoutrestart) {
 									*to = orig;
+								}
 								if (*to > 500) {
 									ring_one(qe, outgoing, &numbusies);
 									starttime = (long) time(NULL);
@@ -4007,8 +4067,9 @@
 					rna(endtime * 1000, qe, on, membername, 1);
 					do_hang(o);
 					if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
-						if (qe->parent->timeoutrestart)
+						if (qe->parent->timeoutrestart) {
 							*to = orig;
+						}
 						if (*to > 500) {
 							ring_one(qe, outgoing, &numbusies);
 							starttime = (long) time(NULL);
@@ -4051,15 +4112,17 @@
 			ast_frfree(f);
 		}
 		if (!*to) {
-			for (o = start; o; o = o->call_next)
+			for (o = start; o; o = o->call_next) {
 				rna(orig, qe, o->interface, o->member->membername, 1);
+			}
 		}
 	}
 
 #ifdef HAVE_EPOLL
 	for (epollo = outgoing; epollo; epollo = epollo->q_next) {
-		if (epollo->chan)
+		if (epollo->chan) {
 			ast_poll_channel_del(in, epollo->chan);
+		}
 	}
 #endif
 
@@ -4093,8 +4156,9 @@
 	ast_debug(1, "There %s %d available %s.\n", avl != 1 ? "are" : "is", avl, avl != 1 ? "members" : "member");
 
 	while ((idx < avl) && (ch) && (ch != qe)) {
-		if (!ch->pending)
+		if (!ch->pending) {
 			idx++;
+		}
 		ch = ch->next;			
 	}
 
@@ -4126,12 +4190,15 @@
 	int min_penalty = qe->pr->min_relative ? qe->min_penalty + qe->pr->min_value : qe->pr->min_value;
 	char max_penalty_str[20], min_penalty_str[20]; 
 	/* a relative change to the penalty could put it below 0 */
-	if (max_penalty < 0)
+	if (max_penalty < 0) {
 		max_penalty = 0;
-	if (min_penalty < 0)
+	}
+	if (min_penalty < 0) {
 		min_penalty = 0;
-	if (min_penalty > max_penalty)
+	}
+	if (min_penalty > max_penalty) {
 		min_penalty = max_penalty;
+	}
 	snprintf(max_penalty_str, sizeof(max_penalty_str), "%d", max_penalty);
 	snprintf(min_penalty_str, sizeof(min_penalty_str), "%d", min_penalty);
 	pbx_builtin_setvar_helper(qe->chan, "QUEUE_MAX_PENALTY", max_penalty_str);
@@ -4159,8 +4226,9 @@
 	/* This is the holding pen for callers 2 through maxlen */
 	for (;;) {
 
-		if (is_our_turn(qe))
+		if (is_our_turn(qe)) {
 			break;
+		}
 
 		/* If we have timed out, break out */
 		if (qe->expire && (time(NULL) >= qe->expire)) {
@@ -4208,10 +4276,11 @@
 		
 		/* Wait a second before checking again */
 		if ((res = ast_waitfordigit(qe->chan, RECHECK * 1000))) {
-			if (res > 0 && !valid_exit(qe, res))
+			if (res > 0 && !valid_exit(qe, res)) {
 				res = 0;
-			else
+			} else {
 				break;
+			}
 		}
 		
 		/* If we have timed out, break out */
@@ -4259,8 +4328,9 @@
 	}	
 	ao2_lock(q);
 	q->callscompleted++;
-	if (callcompletedinsl)
+	if (callcompletedinsl) {
 		q->callscompletedinsl++;
+	}
 	/* Calculate talktime using the same exponential average as holdtime code*/
 	oldtalktime = q->talktime;
 	q->talktime = (((oldtalktime << 2) - oldtalktime) + newtalktime) >> 2;
@@ -4301,9 +4371,10 @@
 		if (pos < qe->linpos) {
 			tmp->metric = 1000 + pos;
 		} else {
-			if (pos > qe->linpos)
+			if (pos > qe->linpos) {
 				/* Indicate there is another priority */
 				qe->linwrapped = 1;
+			}
 			tmp->metric = pos;
 		}
 		tmp->metric += mem->penalty * 1000000 * usepenalty;
@@ -4313,9 +4384,10 @@
 		if (pos < q->rrpos) {
 			tmp->metric = 1000 + pos;
 		} else {
-			if (pos > q->rrpos)
+			if (pos > q->rrpos) {
 				/* Indicate there is another priority */
 				q->wrapped = 1;
+			}
 			tmp->metric = pos;
 		}
 		tmp->metric += mem->penalty * 1000000 * usepenalty;
@@ -4332,10 +4404,11 @@
 		tmp->metric += mem->penalty * 1000000 * usepenalty;
 		break;
 	case QUEUE_STRATEGY_LEASTRECENT:
-		if (!mem->lastcall)
+		if (!mem->lastcall) {
 			tmp->metric = 0;
-		else
+		} else {
 			tmp->metric = 1000000 - (time(NULL) - mem->lastcall);
+		}
 		tmp->metric += mem->penalty * 1000000 * usepenalty;
 		break;
 	default:
@@ -4358,8 +4431,9 @@
 {
 	const char *reason = NULL;	/* silence dumb compilers */
 
-	if (!qe->parent->eventwhencalled)
+	if (!qe->parent->eventwhencalled) {
 		return;
+	}
 
 	switch (rsn) {
 	case CALLER:

Modified: team/oej/pinequeue-trunk/configs/asterisk.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/configs/asterisk.conf.sample?view=diff&rev=363632&r1=363631&r2=363632
==============================================================================
--- team/oej/pinequeue-trunk/configs/asterisk.conf.sample (original)
+++ team/oej/pinequeue-trunk/configs/asterisk.conf.sample Wed Apr 25 06:57:22 2012
@@ -34,6 +34,9 @@
 ;autosystemname = yes		; Automatically set systemname to hostname,
 				; uses 'localhost' on failure, or systemname if
 				; set.
+;mindtmfduration = 80		; Set minimum DTMF duration in ms (default 80 ms)
+				; If we get shorter DTMF messages, these will be
+				; changed to the minimum duration
 ;maxcalls = 10			; Maximum amount of calls allowed.
 ;maxload = 0.9			; Asterisk stops accepting new calls if the
 				; load average exceed this limit.

Modified: team/oej/pinequeue-trunk/include/asterisk/options.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/include/asterisk/options.h?view=diff&rev=363632&r1=363631&r2=363632
==============================================================================
--- team/oej/pinequeue-trunk/include/asterisk/options.h (original)
+++ team/oej/pinequeue-trunk/include/asterisk/options.h Wed Apr 25 06:57:22 2012
@@ -157,6 +157,7 @@
 extern int option_maxfiles;		/*!< Max number of open file handles (files, sockets) */
 extern int option_debug;		/*!< Debugging */
 extern int option_maxcalls;		/*!< Maximum number of simultaneous channels */
+extern unsigned int option_dtmfminduration;	/*!< Minimum duration of DTMF (channel.c) in ms */
 extern double option_maxload;
 #if defined(HAVE_SYSINFO)
 extern long option_minmemfree;		/*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */

Modified: team/oej/pinequeue-trunk/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/main/asterisk.c?view=diff&rev=363632&r1=363631&r2=363632
==============================================================================
--- team/oej/pinequeue-trunk/main/asterisk.c (original)
+++ team/oej/pinequeue-trunk/main/asterisk.c Wed Apr 25 06:57:22 2012
@@ -157,6 +157,10 @@
 #define AST_MAX_CONNECTS 128
 #define NUM_MSGS 64
 
+/*! Default minimum DTMF digit length - 80ms */
+#define AST_MIN_DTMF_DURATION 80
+
+
 /*! \brief Welcome message when starting a CLI interface */
 #define WELCOME_MESSAGE \
     ast_verbose("Asterisk %s, Copyright (C) 1999 - 2012 Digium, Inc. and others.\n" \
@@ -182,6 +186,7 @@
 double option_maxload;				/*!< Max load avg on system */
 int option_maxcalls;				/*!< Max number of active calls */
 int option_maxfiles;				/*!< Max number of open file handles (files, sockets) */
+unsigned int option_dtmfminduration;		/*!< Minimum duration of DTMF. */
 #if defined(HAVE_SYSINFO)
 long option_minmemfree;				/*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
 #endif
@@ -487,6 +492,7 @@
 	ast_cli(a->fd, "  Internal timing:             %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING) ? "Enabled" : "Disabled");
 	ast_cli(a->fd, "  Transmit silence during rec: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) ? "Enabled" : "Disabled");
 	ast_cli(a->fd, "  Generic PLC:                 %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC) ? "Enabled" : "Disabled");
+	ast_cli(a->fd, "  Min DTMF duration::          %u\n", option_dtmfminduration);
 
 	ast_cli(a->fd, "\n* Subsystems\n");
 	ast_cli(a->fd, "  -------------\n");
@@ -3057,6 +3063,9 @@
 		unsigned int keydir:1;
 	} found = { 0, 0 };
 
+	/* Set default value */
+	option_dtmfminduration = AST_MIN_DTMF_DURATION;
+
 	if (ast_opt_override_config) {
 		cfg = ast_config_load2(ast_config_AST_CONFIG_FILE, "" /* core, can't reload */, config_flags);
 		if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
@@ -3193,6 +3202,10 @@
 		/* Enable internal timing */
 		} else if (!strcasecmp(v->name, "internal_timing")) {
 			ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INTERNAL_TIMING);
+		} else if (!strcasecmp(v->name, "mindtmfduration")) {
+			if (sscanf(v->value, "%30u", &option_dtmfminduration) != 1) {
+				option_dtmfminduration = AST_MIN_DTMF_DURATION;
+			}
 		} else if (!strcasecmp(v->name, "maxcalls")) {
 			if ((sscanf(v->value, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
 				option_maxcalls = 0;

Modified: team/oej/pinequeue-trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/main/channel.c?view=diff&rev=363632&r1=363631&r2=363632
==============================================================================
--- team/oej/pinequeue-trunk/main/channel.c (original)
+++ team/oej/pinequeue-trunk/main/channel.c Wed Apr 25 06:57:22 2012
@@ -103,9 +103,6 @@
 /*! Default amount of time to use when emulating a digit as a begin and end
  *  100ms */
 #define AST_DEFAULT_EMULATE_DTMF_DURATION 100
-
-/*! Minimum allowed digit length - 80ms */
-#define AST_MIN_DTMF_DURATION 80
 
 /*! Minimum amount of time between the end of the last digit and the beginning
  *  of a new one - 45ms */
@@ -3869,10 +3866,10 @@
 					ast_channel_dtmf_digit_to_emulate_set(chan, f->subclass.integer);
 					ast_channel_dtmf_tv_set(chan, &tv);
 					if (f->len) {
-						if (f->len > AST_MIN_DTMF_DURATION)
+						if (f->len > option_dtmfminduration)
 							ast_channel_emulate_dtmf_duration_set(chan, f->len);
 						else
-							ast_channel_emulate_dtmf_duration_set(chan, AST_MIN_DTMF_DURATION);
+							ast_channel_emulate_dtmf_duration_set(chan, option_dtmfminduration);
 					} else
 						ast_channel_emulate_dtmf_duration_set(chan, AST_DEFAULT_EMULATE_DTMF_DURATION);
 					ast_log(LOG_DTMF, "DTMF begin emulation of '%c' with duration %u queued on %s\n", f->subclass.integer, ast_channel_emulate_dtmf_duration(chan), ast_channel_name(chan));
@@ -3896,31 +3893,31 @@
 
 					/* detect tones that were received on
 					 * the wire with durations shorter than
-					 * AST_MIN_DTMF_DURATION and set f->len
+					 * option_dtmfminduration and set f->len
 					 * to the actual duration of the DTMF
 					 * frames on the wire.  This will cause
 					 * dtmf emulation to be triggered later
 					 * on.
 					 */
-					if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_DURATION) {
+					if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) < option_dtmfminduration) {
 						f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
 						ast_log(LOG_DTMF, "DTMF end '%c' detected to have actual duration %ld on the wire, emulation will be triggered on %s\n", f->subclass.integer, f->len, ast_channel_name(chan));
 					}
 				} else if (!f->len) {
 					ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
-					f->len = AST_MIN_DTMF_DURATION;
+					f->len = option_dtmfminduration;
 				}
-				if (f->len < AST_MIN_DTMF_DURATION && !ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY)) {
-					ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %d, emulating on %s\n", f->subclass.integer, f->len, AST_MIN_DTMF_DURATION, ast_channel_name(chan));
+				if (f->len < option_dtmfminduration && !ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY)) {
+					ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %d, emulating on %s\n", f->subclass.integer, f->len, option_dtmfminduration, ast_channel_name(chan));
 					ast_set_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
 					ast_channel_dtmf_digit_to_emulate_set(chan, f->subclass.integer);
-					ast_channel_emulate_dtmf_duration_set(chan, AST_MIN_DTMF_DURATION - f->len);
+					ast_channel_emulate_dtmf_duration_set(chan, option_dtmfminduration - f->len);
 					ast_frfree(f);
 					f = &ast_null_frame;
 				} else {
 					ast_log(LOG_DTMF, "DTMF end passthrough '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
-					if (f->len < AST_MIN_DTMF_DURATION) {
-						f->len = AST_MIN_DTMF_DURATION;
+					if (f->len < option_dtmfminduration) {
+						f->len = option_dtmfminduration;
 					}
 					ast_channel_dtmf_tv_set(chan, &now);
 				}

Modified: team/oej/pinequeue-trunk/main/say.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/main/say.c?view=diff&rev=363632&r1=363631&r2=363632
==============================================================================
--- team/oej/pinequeue-trunk/main/say.c (original)
+++ team/oej/pinequeue-trunk/main/say.c Wed Apr 25 06:57:22 2012
@@ -7848,8 +7848,9 @@
 	char* s = 0;
 	const char* remaining = fn;
 
-	if (!num)
+	if (!num) {
 		return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);
+	}
 
 
 	ast_translate_number_ka(num, fn, 512);
@@ -7869,8 +7870,9 @@
 		ast_free(new_string);
 
 		remaining = s + 1;  /* position just after the found space char. */
-		while (*remaining == ' ')  /* skip multiple spaces */
+		while (*remaining == ' ') {  /* skip multiple spaces */
 			remaining++;
+		}
 	}
 
 
@@ -7911,14 +7913,16 @@
 	int res = 0;
 	ast_localtime(&when, &tm, NULL);
 
-	if (!res)
+	if (!res) {
 		res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
+	}
 
 	if (!res) {
 		snprintf(fn, sizeof(fn), "digits/tslis %d", tm.tm_wday);
 		res = ast_streamfile(chan, fn, lang);
-		if (!res)
+		if (!res) {
 			res = ast_waitstream(chan, ints);
+		}
 	}
 
 	if (!res) {
@@ -7931,8 +7935,9 @@
 	if (!res) {
 		snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
 		res = ast_streamfile(chan, fn, lang);
-		if (!res)
+		if (!res) {
 			res = ast_waitstream(chan, ints);
+		}
 	}
 	return res;
 
@@ -7979,8 +7984,9 @@
 
 	ast_localtime(&when, &tm, NULL);
 	res = ast_say_date(chan, t, ints, lang);
-	if (!res)
+	if (!res) {
 		ast_say_time(chan, t, ints, lang);
+	}
 	return res;
 
 }
@@ -8003,8 +8009,9 @@
 	daydiff = now.tm_yday - tm.tm_yday;
 	if ((daydiff < 0) || (daydiff > 6)) {
 		/* Day of month and month */
-		if (!res)
+		if (!res) {
 			res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
+		}
 		if (!res) {
 			snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
 			res = wait_file(chan, ints, fn, lang);
@@ -8017,8 +8024,9 @@
 			res = wait_file(chan, ints, fn, lang);
 		}
 	} /* Otherwise, it was today */
-	if (!res)
+	if (!res) {
 		res = ast_say_time(chan, t, ints, lang);
+	}
 
 	return res;
 }




More information about the svn-commits mailing list