[asterisk-commits] tilghman: trunk r114667 - /trunk/apps/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 25 15:20:12 CDT 2008


Author: tilghman
Date: Fri Apr 25 15:20:10 2008
New Revision: 114667

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114667
Log:
Whitespace changes only

Modified:
    trunk/apps/app_dial.c
    trunk/apps/app_externalivr.c
    trunk/apps/app_followme.c
    trunk/apps/app_minivm.c
    trunk/apps/app_parkandannounce.c
    trunk/apps/app_playback.c
    trunk/apps/app_queue.c
    trunk/apps/app_rpt.c
    trunk/apps/app_sms.c
    trunk/apps/app_speech_utils.c
    trunk/apps/app_waitforring.c
    trunk/apps/app_zapscan.c

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Fri Apr 25 15:20:10 2008
@@ -26,7 +26,7 @@
  */
 
 /*** MODULEINFO
-        <depend>chan_local</depend>
+	<depend>chan_local</depend>
  ***/
 
 
@@ -1934,9 +1934,9 @@
 		}
 		if (res != AST_PBX_NO_HANGUP_PEER) {
 			if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {		
-                        	replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
-                        	ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
-	                        ast_pbx_start(peer);
+				replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
+				ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
+				ast_pbx_start(peer);
 			} else {
 				if (!ast_check_hangup(chan))
 					chan->hangupcause = peer->hangupcause;

Modified: trunk/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_externalivr.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_externalivr.c (original)
+++ trunk/apps/app_externalivr.c Fri Apr 25 15:20:10 2008
@@ -87,8 +87,8 @@
 };
 
 static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, 
-              int eivr_events_fd, int eivr_commands_fd, int eivr_errors_fd, 
-              const char *args);
+	int eivr_events_fd, int eivr_commands_fd, int eivr_errors_fd, 
+	const char *args);
 
 int eivr_connect_socket(struct ast_channel *chan, const char *host, int port);
 

Modified: trunk/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_followme.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_followme.c (original)
+++ trunk/apps/app_followme.c Fri Apr 25 15:20:10 2008
@@ -29,7 +29,7 @@
  */
 
 /*** MODULEINFO
-        <depend>chan_local</depend>
+	<depend>chan_local</depend>
  ***/
 
 #include "asterisk.h"

Modified: trunk/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Fri Apr 25 15:20:10 2008
@@ -736,8 +736,9 @@
 		return;
 	}
 
-	for (var = vmu->chanvars ; var ; var = var->next)
-                pbx_builtin_setvar_helper(channel, var->name, var->value);
+	for (var = vmu->chanvars ; var ; var = var->next) {
+		pbx_builtin_setvar_helper(channel, var->name, var->value);
+	}
 
 	/* Prepare variables for substition in email body and subject */
 	pbx_builtin_setvar_helper(channel, "MVM_NAME", vmu->fullname);
@@ -2778,12 +2779,12 @@
 */
 static int vm_lock_path(const char *path)
 {
-        switch (ast_lock_path(path)) {
-        case AST_LOCK_TIMEOUT:
-                return -1;
-        default:
-                return 0;
-        }
+	switch (ast_lock_path(path)) {
+	case AST_LOCK_TIMEOUT:
+		return -1;
+	default:
+		return 0;
+	}
 }
 
 /*! \brief Access counter file, lock directory, read and possibly write it again changed 

Modified: trunk/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_parkandannounce.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_parkandannounce.c (original)
+++ trunk/apps/app_parkandannounce.c Fri Apr 25 15:20:10 2008
@@ -129,7 +129,7 @@
 			ast_verb(4, "Channel %s was answered.\n", dchan->name);
 		} else {
 			ast_verb(4, "Channel %s was never answered.\n", dchan->name);
-        			ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name);
+			ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name);
 			ast_hangup(dchan);
 			return -1;
 		}

Modified: trunk/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_playback.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_playback.c (original)
+++ trunk/apps/app_playback.c Fri Apr 25 15:20:10 2008
@@ -75,16 +75,16 @@
 	int i = 0;
 	say_api_buf[i++] = arg;
 
-        say_api_buf[i++] = ast_say_number_full;
-        say_api_buf[i++] = ast_say_enumeration_full;
-        say_api_buf[i++] = ast_say_digit_str_full;
-        say_api_buf[i++] = ast_say_character_str_full;
-        say_api_buf[i++] = ast_say_phonetic_str_full;
-        say_api_buf[i++] = ast_say_datetime;
-        say_api_buf[i++] = ast_say_time;
-        say_api_buf[i++] = ast_say_date;
-        say_api_buf[i++] = ast_say_datetime_from_now;
-        say_api_buf[i++] = ast_say_date_with_format;
+	say_api_buf[i++] = ast_say_number_full;
+	say_api_buf[i++] = ast_say_enumeration_full;
+	say_api_buf[i++] = ast_say_digit_str_full;
+	say_api_buf[i++] = ast_say_character_str_full;
+	say_api_buf[i++] = ast_say_phonetic_str_full;
+	say_api_buf[i++] = ast_say_datetime;
+	say_api_buf[i++] = ast_say_time;
+	say_api_buf[i++] = ast_say_date;
+	say_api_buf[i++] = ast_say_datetime_from_now;
+	say_api_buf[i++] = ast_say_date_with_format;
 }
 
 static void restore_say_mode(void *arg)
@@ -92,16 +92,16 @@
 	int i = 0;
 	say_api_buf[i++] = arg;
 
-        ast_say_number_full = say_api_buf[i++];
-        ast_say_enumeration_full = say_api_buf[i++];
-        ast_say_digit_str_full = say_api_buf[i++];
-        ast_say_character_str_full = say_api_buf[i++];
-        ast_say_phonetic_str_full = say_api_buf[i++];
-        ast_say_datetime = say_api_buf[i++];
-        ast_say_time = say_api_buf[i++];
-        ast_say_date = say_api_buf[i++];
-        ast_say_datetime_from_now = say_api_buf[i++];
-        ast_say_date_with_format = say_api_buf[i++];
+	ast_say_number_full = say_api_buf[i++];
+	ast_say_enumeration_full = say_api_buf[i++];
+	ast_say_digit_str_full = say_api_buf[i++];
+	ast_say_character_str_full = say_api_buf[i++];
+	ast_say_phonetic_str_full = say_api_buf[i++];
+	ast_say_datetime = say_api_buf[i++];
+	ast_say_time = say_api_buf[i++];
+	ast_say_date = say_api_buf[i++];
+	ast_say_datetime_from_now = say_api_buf[i++];
+	ast_say_date_with_format = say_api_buf[i++];
 }
 
 /* 
@@ -111,25 +111,25 @@
  * parameter.
  */
 typedef struct {
-        struct ast_channel *chan;
-        const char *ints;
-        const char *language;
-        int audiofd;
-        int ctrlfd;
+	struct ast_channel *chan;
+	const char *ints;
+	const char *language;
+	int audiofd;
+	int ctrlfd;
 } say_args_t;
 
 static int s_streamwait3(const say_args_t *a, const char *fn)
 {
-        int res = ast_streamfile(a->chan, fn, a->language);
-        if (res) {
-                ast_log(LOG_WARNING, "Unable to play message %s\n", fn);
-                return res;
-        }
-        res = (a->audiofd  > -1 && a->ctrlfd > -1) ?
-                ast_waitstream_full(a->chan, a->ints, a->audiofd, a->ctrlfd) :
-                ast_waitstream(a->chan, a->ints);
-        ast_stopstream(a->chan);
-        return res;  
+	int res = ast_streamfile(a->chan, fn, a->language);
+	if (res) {
+		ast_log(LOG_WARNING, "Unable to play message %s\n", fn);
+		return res;
+	}
+	res = (a->audiofd  > -1 && a->ctrlfd > -1) ?
+	ast_waitstream_full(a->chan, a->ints, a->audiofd, a->ctrlfd) :
+	ast_waitstream(a->chan, a->ints);
+	ast_stopstream(a->chan);
+	return res;  
 }
 
 /*
@@ -247,11 +247,11 @@
 }
 
 static int say_full(struct ast_channel *chan, const char *string,
-        const char *ints, const char *lang, const char *options,
-        int audiofd, int ctrlfd)
-{
-        say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
-        return do_say(&a, string, options, 0);
+	const char *ints, const char *lang, const char *options,
+	int audiofd, int ctrlfd)
+{
+	say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
+	return do_say(&a, string, options, 0);
 }
 
 static int say_number_full(struct ast_channel *chan, int num,
@@ -259,9 +259,9 @@
 	int audiofd, int ctrlfd)
 {
 	char buf[64];
-        say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
+	say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
 	snprintf(buf, sizeof(buf), "num:%d", num);
-        return do_say(&a, buf, options, 0);
+	return do_say(&a, buf, options, 0);
 }
 
 static int say_enumeration_full(struct ast_channel *chan, int num,
@@ -269,9 +269,9 @@
 	int audiofd, int ctrlfd)
 {
 	char buf[64];
-        say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
+	say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
 	snprintf(buf, sizeof(buf), "enum:%d", num);
-        return do_say(&a, buf, options, 0);
+	return do_say(&a, buf, options, 0);
 }
 
 static int say_date_generic(struct ast_channel *chan, time_t t,
@@ -280,7 +280,7 @@
 	char buf[128];
 	struct ast_tm tm;
 	struct timeval tv = { t, 0 };
-        say_args_t a = { chan, ints, lang, -1, -1 };
+	say_args_t a = { chan, ints, lang, -1, -1 };
 	if (format == NULL)
 		format = "";
 
@@ -296,7 +296,7 @@
 		tm.tm_sec,
 		tm.tm_wday,
 		tm.tm_yday);
-        return do_say(&a, buf, NULL, 0);
+	return do_say(&a, buf, NULL, 0);
 }
 
 static int say_date_with_format(struct ast_channel *chan, time_t t,
@@ -515,7 +515,7 @@
 		}
 	}
 
-        ast_cli_register_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry));
 	return ast_register_application(app, playback_exec, synopsis, descrip);
 }
 

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Fri Apr 25 15:20:10 2008
@@ -57,7 +57,7 @@
  */
 
 /*** MODULEINFO
-        <depend>res_monitor</depend>
+	<depend>res_monitor</depend>
  ***/
 
 #include "asterisk.h"
@@ -135,7 +135,7 @@
 #define DEFAULT_TIMEOUT		15
 #define RECHECK			1		/*!< Recheck every second to see we we're at the top yet */
 #define MAX_PERIODIC_ANNOUNCEMENTS 10           /*!< The maximum periodic announcements we can have */
-#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15       /*!< The minimum number of seconds between position announcements
+#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15       /*!< The minimum number of seconds between position announcements \
                                                      The default value of 15 provides backwards compatibility */
 #define MAX_QUEUE_BUCKETS 53
 
@@ -581,7 +581,7 @@
 {
 	char interfacevar[256]="";
 	float sl = 0;
-        
+
 	if (qe->parent->setqueuevar) {
 		sl = 0;
 		if (qe->parent->callscompleted > 0) 
@@ -1904,10 +1904,11 @@
 
 	/* Don't restart music on hold if we're about to exit the caller from the queue */
 	if (!res) {
-                if (ringing)
-                        ast_indicate(qe->chan, AST_CONTROL_RINGING);
-                else
-                        ast_moh_start(qe->chan, qe->moh, NULL);
+		if (ringing) {
+			ast_indicate(qe->chan, AST_CONTROL_RINGING);
+		} else {
+			ast_moh_start(qe->chan, qe->moh, NULL);
+		}
 	}
 	return res;
 }
@@ -3113,12 +3114,12 @@
 		case 'H':
 			ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT);
 			break;
-                case 'k':
-                        ast_set_flag(&(bridge_config.features_callee), AST_FEATURE_PARKCALL);
-                        break;
-                case 'K':
-                        ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL);
-                        break;
+		case 'k':
+			ast_set_flag(&(bridge_config.features_callee), AST_FEATURE_PARKCALL);
+			break;
+		case 'K':
+			ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL);
+			break;
 		case 'n':
 			if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_LINEAR)
 				(*tries)++;
@@ -4643,8 +4644,8 @@
 		.name = data,	
 	};
 
-	char interfacevar[256]="";
-        float sl = 0;
+	char interfacevar[256] = "";
+	float sl = 0;
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
@@ -4653,24 +4654,26 @@
 
 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) {
 		ao2_lock(q);
-        	if (q->setqueuevar) {
-		        sl = 0;
+		if (q->setqueuevar) {
+			sl = 0;
 			res = 0;
 
-		        if (q->callscompleted > 0)
-		                sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
-
-		        snprintf(interfacevar, sizeof(interfacevar),
-                		"QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f",
-		                q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->callscompleted, q->callsabandoned,  q->servicelevel, sl);
-
-		        pbx_builtin_setvar_multiple(chan, interfacevar);
-	        }
+			if (q->callscompleted > 0) {
+				sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
+			}
+
+			snprintf(interfacevar, sizeof(interfacevar),
+				"QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f",
+				q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->callscompleted, q->callsabandoned,  q->servicelevel, sl);
+
+			pbx_builtin_setvar_multiple(chan, interfacevar);
+		}
 
 		ao2_unlock(q);
 		queue_unref(q);
-	} else
+	} else {
 		ast_log(LOG_WARNING, "queue %s was not found\n", data);
+	}
 
 	snprintf(buf, len, "%d", res);
 
@@ -4865,7 +4868,7 @@
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(queuename);
 		AST_APP_ARG(interface);
-        );
+	);
 	/* Make sure the returned value on error is NULL. */
 	buf[0] = '\0';
 

Modified: trunk/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_rpt.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_rpt.c (original)
+++ trunk/apps/app_rpt.c Fri Apr 25 15:20:10 2008
@@ -202,7 +202,7 @@
 enum {REM_MODE_FM, REM_MODE_USB, REM_MODE_LSB, REM_MODE_AM};
 
 enum {HF_SCAN_OFF, HF_SCAN_DOWN_SLOW, HF_SCAN_DOWN_QUICK,
-      HF_SCAN_DOWN_FAST, HF_SCAN_UP_SLOW, HF_SCAN_UP_QUICK, HF_SCAN_UP_FAST};
+	HF_SCAN_DOWN_FAST, HF_SCAN_UP_SLOW, HF_SCAN_UP_QUICK, HF_SCAN_UP_FAST};
 
 #include "asterisk.h"
 

Modified: trunk/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sms.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_sms.c (original)
+++ trunk/apps/app_sms.c Fri Apr 25 15:20:10 2008
@@ -260,8 +260,9 @@
 	if (*s == '+')
 		*d++ = *s++;
 	while (*s) {
-  		if (isdigit(*s))
-     			*d++ = *s;
+  		if (isdigit(*s)) {
+			*d++ = *s;
+		}
 		s++;
 	}
 	*d = 0;
@@ -600,8 +601,9 @@
 }
 
 /*! \brief unpacks bytes (8 bit encoding) at i, len l septets, 
-      and places in udh and ud setting udhl and udl. udh not used 
-      if udhi not set */
+ *  and places in udh and ud setting udhl and udl. udh not used 
+ *  if udhi not set.
+ */
 static void unpacksms8(unsigned char *i, unsigned char l, unsigned char *udh, int *udhl, unsigned short *ud, int *udl, char udhi)
 {
 	unsigned short *o = ud;

Modified: trunk/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_speech_utils.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_speech_utils.c (original)
+++ trunk/apps/app_speech_utils.c Fri Apr 25 15:20:10 2008
@@ -137,8 +137,9 @@
 	char *tmp = NULL;
 	int nbest_num = 0, wanted_num = 0, i = 0;
 
-	if (!result)
+	if (!result) {
 		return NULL;
+	}
 
 	if ((tmp = strchr(result_num, '/'))) {
 		*tmp++ = '\0';
@@ -167,8 +168,9 @@
 	struct ast_speech *speech = find_speech(chan);
 	char tmp[128] = "";
 
-	if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
-		return -1;
+	if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
+		return -1;
+	}
 	
 	snprintf(tmp, sizeof(tmp), "%d", result->score);
 	
@@ -178,65 +180,69 @@
 }
 
 static struct ast_custom_function speech_score_function = {
-        .name = "SPEECH_SCORE",
-        .synopsis = "Gets the confidence score of a result.",
-        .syntax = "SPEECH_SCORE([nbest number/]result number)",
-        .desc =
-        "Gets the confidence score of a result.\n",
-        .read = speech_score,
-        .write = NULL,
+	.name = "SPEECH_SCORE",
+	.synopsis = "Gets the confidence score of a result.",
+	.syntax = "SPEECH_SCORE([nbest number/]result number)",
+	.desc =
+	"Gets the confidence score of a result.\n",
+	.read = speech_score,
+	.write = NULL,
 };
 
 /*! \brief SPEECH_TEXT() Dialplan Function */
 static int speech_text(struct ast_channel *chan, const char *cmd, char *data,
 			char *buf, size_t len)
 {
-        struct ast_speech_result *result = NULL;
-        struct ast_speech *speech = find_speech(chan);
-
-	if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
-                return -1;
-
-	if (result->text != NULL)
+	struct ast_speech_result *result = NULL;
+	struct ast_speech *speech = find_speech(chan);
+
+	if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
+		return -1;
+	}
+
+	if (result->text != NULL) {
 		ast_copy_string(buf, result->text, len);
-
-        return 0;
+	}
+
+	return 0;
 }
 
 static struct ast_custom_function speech_text_function = {
-        .name = "SPEECH_TEXT",
-        .synopsis = "Gets the recognized text of a result.",
-        .syntax = "SPEECH_TEXT([nbest number/]result number)",
-        .desc =
-        "Gets the recognized text of a result.\n",
-        .read = speech_text,
-        .write = NULL,
+	.name = "SPEECH_TEXT",
+	.synopsis = "Gets the recognized text of a result.",
+	.syntax = "SPEECH_TEXT([nbest number/]result number)",
+	.desc =
+	"Gets the recognized text of a result.\n",
+	.read = speech_text,
+	.write = NULL,
 };
 
 /*! \brief SPEECH_GRAMMAR() Dialplan Function */
 static int speech_grammar(struct ast_channel *chan, const char *cmd, char *data,
 			char *buf, size_t len)
 {
-        struct ast_speech_result *result = NULL;
-        struct ast_speech *speech = find_speech(chan);
-
-	if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
-                return -1;
-
-	if (result->grammar != NULL)
+	struct ast_speech_result *result = NULL;
+	struct ast_speech *speech = find_speech(chan);
+
+	if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
+		return -1;
+	}
+
+	if (result->grammar != NULL) {
 		ast_copy_string(buf, result->grammar, len);
-
-        return 0;
+	}
+
+	return 0;
 }
 
 static struct ast_custom_function speech_grammar_function = {
-        .name = "SPEECH_GRAMMAR",
-        .synopsis = "Gets the matched grammar of a result if available.",
-        .syntax = "SPEECH_GRAMMAR([nbest number/]result number)",
-        .desc =
-        "Gets the matched grammar of a result if available.\n",
-        .read = speech_grammar,
-        .write = NULL,
+	.name = "SPEECH_GRAMMAR",
+	.synopsis = "Gets the matched grammar of a result if available.",
+	.syntax = "SPEECH_GRAMMAR([nbest number/]result number)",
+	.desc =
+	"Gets the matched grammar of a result if available.\n",
+	.read = speech_grammar,
+	.write = NULL,
 };
 
 /*! \brief SPEECH_ENGINE() Dialplan Function */
@@ -244,8 +250,9 @@
 {
 	struct ast_speech *speech = find_speech(chan);
 
-	if (data == NULL || speech == NULL)
-		return -1;
+	if (data == NULL || speech == NULL) {
+		return -1;
+	}
 
 	ast_speech_change(speech, data, value);
 
@@ -329,16 +336,16 @@
 }
 
 static struct ast_custom_function speech_function = {
-        .name = "SPEECH",
-        .synopsis = "Gets information about speech recognition results.",
-        .syntax = "SPEECH(argument)",
-        .desc =
+	.name = "SPEECH",
+	.synopsis = "Gets information about speech recognition results.",
+	.syntax = "SPEECH(argument)",
+	.desc =
 	"Gets information about speech recognition results.\n"
 	"status:   Returns 1 upon speech object existing, or 0 if not\n"
 	"spoke:  Returns 1 if spoker spoke, or 0 if not\n"
 	"results:  Returns number of results that were recognized\n",
-        .read = speech_read,
-        .write = NULL,
+	.read = speech_read,
+	.write = NULL,
 };
 
 
@@ -645,14 +652,14 @@
 			if (!strlen(dtmf)) {
 				if (chan->stream == NULL) {
 					if (speech->processing_sound != NULL) {
-						if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
+						if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {
 							speech_streamfile(chan, speech->processing_sound, chan->language);
 						}
 					}
 				} else if (chan->streamid == -1 && chan->timingfunc == NULL) {
 					ast_stopstream(chan);
 					if (speech->processing_sound != NULL) {
-						if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
+						if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {
 							speech_streamfile(chan, speech->processing_sound, chan->language);
 						}
 					}

Modified: trunk/apps/app_waitforring.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_waitforring.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_waitforring.c (original)
+++ trunk/apps/app_waitforring.c Fri Apr 25 15:20:10 2008
@@ -53,12 +53,12 @@
 	int ms;
 
 	if (!data || (sscanf(data, "%lg", &s) != 1)) {
-                ast_log(LOG_WARNING, "WaitForRing requires an argument (minimum seconds)\n");
+		ast_log(LOG_WARNING, "WaitForRing requires an argument (minimum seconds)\n");
 		return 0;
 	}
 
-	ms = s*1000.0;
-	while(ms > 0) {
+	ms = s * 1000.0;
+	while (ms > 0) {
 		ms = ast_waitfor(chan, ms);
 		if (ms < 0) {
 			res = ms;

Modified: trunk/apps/app_zapscan.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_zapscan.c?view=diff&rev=114667&r1=114666&r2=114667
==============================================================================
--- trunk/apps/app_zapscan.c (original)
+++ trunk/apps/app_zapscan.c Fri Apr 25 15:20:10 2008
@@ -66,21 +66,22 @@
 static struct ast_channel *get_zap_channel_locked(int num) {
 	char name[80];
 	
-	snprintf(name,sizeof(name),"Zap/%d-1",num);
+	snprintf(name, sizeof(name), "Zap/%d-1", num);
 	return ast_get_channel_by_name_locked(name);
 }
 
 static int careful_write(int fd, unsigned char *data, int len)
 {
 	int res;
-	while(len) {
+	while (len) {
 		res = write(fd, data, len);
 		if (res < 1) {
 			if (errno != EAGAIN) {
 				ast_log(LOG_WARNING, "Failed to write audio data to conference: %s\n", strerror(errno));
 				return -1;
-			} else
+			} else {
 				return 0;
+			}
 		}
 		len -= res;
 		data += res;
@@ -104,7 +105,7 @@
 	int origfd;
 	int ret = -1;
 	char input[4];
-	int ic=0;
+	int ic = 0;
 	
 	ZT_BUFFERINFO bi;
 	char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
@@ -136,7 +137,7 @@
 		if (flags < 0) {
 			ast_log(LOG_WARNING, "Unable to get flags: %s\n", strerror(errno));
 			close(fd);
-                        goto outrun;
+			goto outrun;
 		}
 		if (fcntl(fd, F_SETFL, flags | O_NONBLOCK)) {
 			ast_log(LOG_WARNING, "Unable to set flags: %s\n", strerror(errno));
@@ -154,7 +155,7 @@
 			close(fd);
 			goto outrun;
 		}
-                nfds = 1;
+		nfds = 1;
 	} else {
 		/* XXX Make sure we're not running on a pseudo channel XXX */
 		fd = chan->fds[0];
@@ -162,118 +163,119 @@
 	}
 	memset(&ztc, 0, sizeof(ztc));
 	/* Check to see if we're in a conference... */
-        ztc.chan = 0;
-        if (ioctl(fd, ZT_GETCONF, &ztc)) {
-			ast_log(LOG_WARNING, "Error getting conference\n");
-			close(fd);
-			goto outrun;
-        }
-        if (ztc.confmode) {
-			/* Whoa, already in a conference...  Retry... */
-			if (!retryzap) {
-				ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n");
-				retryzap = 1;
+	ztc.chan = 0;
+	if (ioctl(fd, ZT_GETCONF, &ztc)) {
+		ast_log(LOG_WARNING, "Error getting conference\n");
+		close(fd);
+		goto outrun;
+	}
+	if (ztc.confmode) {
+		/* Whoa, already in a conference...  Retry... */
+		if (!retryzap) {
+			ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n");
+			retryzap = 1;
+			goto zapretry;
+		}
+	}
+	memset(&ztc, 0, sizeof(ztc));
+	/* Add us to the conference */
+	ztc.chan = 0;
+	ztc.confno = confno;
+	ztc.confmode = ZT_CONF_MONITORBOTH;
+
+	if (ioctl(fd, ZT_SETCONF, &ztc)) {
+		ast_log(LOG_WARNING, "Error setting conference\n");
+		close(fd);
+		goto outrun;
+	}
+	ast_debug(1, "Placed channel %s in ZAP channel %d monitor\n", chan->name, confno);
+
+	for (;;) {
+		outfd = -1;
+		ms = -1;
+		c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms);
+		if (c) {
+			if (c->fds[0] != origfd) {
+				if (retryzap) {
+					/* Kill old pseudo */
+					close(fd);
+				}
+				ast_debug(1, "Ooh, something swapped out under us, starting over\n");
+				retryzap = 0;
 				goto zapretry;
 			}
-        }
-        memset(&ztc, 0, sizeof(ztc));
-        /* Add us to the conference */
-        ztc.chan = 0;
-        ztc.confno = confno;
-        ztc.confmode = ZT_CONF_MONITORBOTH;
-		
-        if (ioctl(fd, ZT_SETCONF, &ztc)) {
-                ast_log(LOG_WARNING, "Error setting conference\n");
-                close(fd);
-                goto outrun;
-        }
-	ast_debug(1, "Placed channel %s in ZAP channel %d monitor\n", chan->name, confno);
-		
-        for(;;) {
-			outfd = -1;
-			ms = -1;
-			c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms);
-			if (c) {
-				if (c->fds[0] != origfd) {
-					if (retryzap) {
-						/* Kill old pseudo */
-						close(fd);
+			f = ast_read(c);
+			if (!f) {
+				break;
+			}
+			if (f->frametype == AST_FRAME_DTMF) {
+				if (f->subclass == '#') {
+					ret = 0;
+					break;
+				} else if (f->subclass == '*') {
+					ret = -1;
+					break;
+				} else {
+					input[ic++] = f->subclass;
+				}
+				if (ic == 3) {
+					input[ic++] = '\0';
+					ic = 0;
+					ret = atoi(input);
+					ast_verb(3, "Zapscan: change channel to %d\n", ret);
+					break;
+				}
+			}
+
+			if (fd != chan->fds[0]) {
+				if (f->frametype == AST_FRAME_VOICE) {
+					if (f->subclass == AST_FORMAT_ULAW) {
+						/* Carefully write */
+						careful_write(fd, f->data, f->datalen);
+					} else {
+						ast_log(LOG_WARNING, "Huh?  Got a non-ulaw (%d) frame in the conference\n", f->subclass);
 					}
-					ast_debug(1, "Ooh, something swapped out under us, starting over\n");
-					retryzap = 0;
-                                goto zapretry;
-				}
-				f = ast_read(c);
-				if (!f)
-					break;
-				if(f->frametype == AST_FRAME_DTMF) {
-					if(f->subclass == '#') {
-						ret = 0;
-						break;
-					}
-					else if (f->subclass == '*') {
-						ret = -1;
-						break;
-						
-					}
-					else {
-						input[ic++] = f->subclass;
-					}
-					if(ic == 3) {
-						input[ic++] = '\0';
-						ic=0;
-						ret = atoi(input);
-						ast_verb(3, "Zapscan: change channel to %d\n",ret);
-						break;
-					}
-				}
-				
-				if (fd != chan->fds[0]) {
-					if (f->frametype == AST_FRAME_VOICE) {
-						if (f->subclass == AST_FORMAT_ULAW) {
-							/* Carefully write */
-                                                careful_write(fd, f->data, f->datalen);
-						} else
-							ast_log(LOG_WARNING, "Huh?  Got a non-ulaw (%d) frame in the conference\n", f->subclass);
-					}
-				}
-				ast_frfree(f);
-			} else if (outfd > -1) {
-				res = read(outfd, buf, CONF_SIZE);
-				if (res > 0) {
-					memset(&fr, 0, sizeof(fr));
-					fr.frametype = AST_FRAME_VOICE;
-					fr.subclass = AST_FORMAT_ULAW;
-					fr.datalen = res;
-					fr.samples = res;
-					fr.data = buf;
-					fr.offset = AST_FRIENDLY_OFFSET;
-					if (ast_write(chan, &fr) < 0) {
-						ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno));
-						/* break; */
-					}
-				} else
-					ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno));
-			}
-        }
-	if (f)
+				}
+			}
+			ast_frfree(f);
+		} else if (outfd > -1) {
+			res = read(outfd, buf, CONF_SIZE);
+			if (res > 0) {
+				memset(&fr, 0, sizeof(fr));
+				fr.frametype = AST_FRAME_VOICE;
+				fr.subclass = AST_FORMAT_ULAW;
+				fr.datalen = res;
+				fr.samples = res;
+				fr.data = buf;
+				fr.offset = AST_FRIENDLY_OFFSET;
+				if (ast_write(chan, &fr) < 0) {
+					ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno));
+					/* break; */
+				}
+			} else {
+				ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno));
+			}
+		}
+	}
+	if (f) {
 		ast_frfree(f);
-        if (fd != chan->fds[0])
-			close(fd);
-        else {
-			/* Take out of conference */
-			/* Add us to the conference */
-			ztc.chan = 0;
-			ztc.confno = 0;
-			ztc.confmode = 0;
-			if (ioctl(fd, ZT_SETCONF, &ztc)) {
-				ast_log(LOG_WARNING, "Error setting conference\n");
-                }
-        }
-		
+	}
+	if (fd != chan->fds[0]) {
+		close(fd);
+	} else {
+		/* Take out of conference */
+		/* Add us to the conference */
+		ztc.chan = 0;
+		ztc.confno = 0;
+		ztc.confmode = 0;
+		if (ioctl(fd, ZT_SETCONF, &ztc)) {
+			ast_log(LOG_WARNING, "Error setting conference\n");
+		}
+	}
+
  outrun:
-		
-        return ret;
+
+	return ret;
 }
 
 static int conf_exec(struct ast_channel *chan, void *data)
@@ -282,16 +284,16 @@
 	int confflags = 0;
 	int confno = 0;
 	char confstr[80] = "", *tmp = NULL;
-	struct ast_channel *tempchan = NULL, *lastchan = NULL,*ichan = NULL;
+	struct ast_channel *tempchan = NULL, *lastchan = NULL, *ichan = NULL;
 	struct ast_frame *f;
 	char *desired_group;
-	int input=0,search_group=0;
-		
+	int input = 0, search_group = 0;
+
 	if (chan->_state != AST_STATE_UP)
 		ast_answer(chan);
-	
+
 	desired_group = ast_strdupa(data);
-	if(!ast_strlen_zero(desired_group)) {
+	if (!ast_strlen_zero(desired_group)) {
 		ast_verb(3, "Scanning for group %s\n", desired_group);
 		search_group = 1;
 	}
@@ -299,7 +301,7 @@
 	for (;;) {
 		if (ast_waitfor(chan, 100) < 0)
 			break;
-		
+
 		f = ast_read(chan);
 		if (!f)
 			break;
@@ -313,15 +315,16 @@
 			ichan = get_zap_channel_locked(input);
 			input = 0;
 		}
-		
+
 		tempchan = ichan ? ichan : ast_channel_walk_locked(tempchan);
-		
-		if ( !tempchan && !lastchan )
+
+		if (!tempchan && !lastchan) {
 			break;
-		
+		}
+
 		if (tempchan && search_group) {
 			const char *mygroup;
-			if((mygroup = pbx_builtin_getvar_helper(tempchan, "GROUP")) && (!strcmp(mygroup, desired_group))) {
+			if ((mygroup = pbx_builtin_getvar_helper(tempchan, "GROUP")) && (!strcmp(mygroup, desired_group))) {
 				ast_verb(3, "Found Matching Channel %s in group %s\n", tempchan->name, desired_group);
 			} else {
 				ast_channel_unlock(tempchan);
@@ -329,21 +332,24 @@
 				continue;
 			}
 		}
-		if (tempchan && (!strcmp(tempchan->tech->type, "Zap")) && (tempchan != chan) ) {
+		if (tempchan && (!strcmp(tempchan->tech->type, "Zap")) && (tempchan != chan)) {
 			ast_verb(3, "Zap channel %s is in-use, monitoring...\n", tempchan->name);
 			ast_copy_string(confstr, tempchan->name, sizeof(confstr));
 			ast_channel_unlock(tempchan);
-			if ((tmp = strchr(confstr,'-'))) {
+			if ((tmp = strchr(confstr, '-'))) {
 				*tmp = '\0';
 			}
-			confno = atoi(strchr(confstr,'/') + 1);
+			confno = atoi(strchr(confstr, '/') + 1);
 			ast_stopstream(chan);
 			ast_say_number(chan, confno, AST_DIGIT_ANY, chan->language, (char *) NULL);
 			res = conf_run(chan, confno, confflags);
-			if (res<0) break;
+			if (res < 0) {
+				break;
+			}
 			input = res;
-		} else if (tempchan)
+		} else if (tempchan) {
 			ast_channel_unlock(tempchan);
+		}
 		lastchan = tempchan;
 	}
 	return res;




More information about the asterisk-commits mailing list