[asterisk-commits] pcadach: branch pcadach/chan_h323-live r42420 - in /team/pcadach/chan_h323-li...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Sep 7 22:17:58 MST 2006


Author: pcadach
Date: Fri Sep  8 00:17:58 2006
New Revision: 42420

URL: http://svn.digium.com/view/asterisk?rev=42420&view=rev
Log:
Merged revisions 42259,42261-42264,42283-42284,42298,42311,42324,42338,42356,42373-42374,42388-42389,42403 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r42259 | mogorman | 2006-09-07 22:14:53 +0600 (Чтв, 07 Сен 2006) | 3 lines

patch to fix several things wrong with voicemail
imap storage.

................
r42261 | file | 2006-09-07 22:33:02 +0600 (Чтв, 07 Сен 2006) | 10 lines

Merged revisions 42260 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r42260 | file | 2006-09-07 12:30:44 -0400 (Thu, 07 Sep 2006) | 2 lines

Let's use the same thing we use in other places to calculate our time for ast_cond_timedwait (issue #7697 reported by bn999)

........

................
r42262 | file | 2006-09-07 22:40:15 +0600 (Чтв, 07 Сен 2006) | 2 lines

Set the variable even if the caller disconnects (issue #7896 reported by jsmith)

................
r42263 | kpfleming | 2006-09-07 22:42:04 +0600 (Чтв, 07 Сен 2006) | 2 lines

minor wording fix

................
r42264 | file | 2006-09-07 22:51:11 +0600 (Чтв, 07 Сен 2006) | 2 lines

Convert some warnings into debug messages since they can exist under perfectly normal circumstances that the user shouldn't care about (issue #7894 reported by stephen_dredge)

................
r42283 | mogorman | 2006-09-07 23:05:51 +0600 (Чтв, 07 Сен 2006) | 2 lines

protect curhst and curusr

................
r42284 | file | 2006-09-07 23:09:55 +0600 (Чтв, 07 Сен 2006) | 2 lines

Use lower case 'x' instead of a UTF-8 character (issue #7888 reported by flefoll)

................
r42298 | file | 2006-09-08 00:54:36 +0600 (Птн, 08 Сен 2006) | 2 lines

Minor cleanup and make sure the tmp variable is clean

................
r42311 | file | 2006-09-08 01:50:59 +0600 (Птн, 08 Сен 2006) | 2 lines

Code cleaning/updates/potential bug fixes

................
r42324 | mattf | 2006-09-08 02:05:37 +0600 (Птн, 08 Сен 2006) | 2 lines

Make sure we give a little warning about the echotraining option

................
r42338 | file | 2006-09-08 03:11:07 +0600 (Птн, 08 Сен 2006) | 2 lines

Use flags instead of variables on the private structure for things

................
r42356 | tilghman | 2006-09-08 05:15:43 +0600 (Птн, 08 Сен 2006) | 10 lines

Merged revisions 42355 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r42355 | tilghman | 2006-09-07 18:12:29 -0500 (Thu, 07 Sep 2006) | 2 lines

Format vulnerability fix - allowing the user to specify a format is not a good idea (Bug 7811)

........

................
r42373 | file | 2006-09-08 08:00:45 +0600 (Птн, 08 Сен 2006) | 2 lines

Destroy msg_cfg after it's used, not before (issue #7618 reported by wvolz with minor mods)

................
r42374 | file | 2006-09-08 08:54:45 +0600 (Птн, 08 Сен 2006) | 2 lines

whentohangup is already in seconds, just need to convert to milliseconds

................
r42388 | file | 2006-09-08 09:46:33 +0600 (Птн, 08 Сен 2006) | 2 lines

Formatting fixes for chan_alsa (issue #7807 reported by Mithraen with more mods done by myself)

................
r42389 | file | 2006-09-08 09:51:26 +0600 (Птн, 08 Сен 2006) | 2 lines

Formatting fixes for chan_oss (issue #7808 reported by Mithraen)

................
r42403 | file | 2006-09-08 10:38:43 +0600 (Птн, 08 Сен 2006) | 9 lines

Blocked revisions 42402 via svnmerge

........
r42402 | file | 2006-09-08 00:37:07 -0400 (Fri, 08 Sep 2006) | 2 lines

Use ast_best_codec to set the read/write format

........

................

Modified:
    team/pcadach/chan_h323-live/   (props changed)
    team/pcadach/chan_h323-live/apps/app_read.c
    team/pcadach/chan_h323-live/apps/app_record.c
    team/pcadach/chan_h323-live/apps/app_voicemail.c
    team/pcadach/chan_h323-live/build_tools/cflags.xml
    team/pcadach/chan_h323-live/channels/chan_alsa.c
    team/pcadach/chan_h323-live/channels/chan_local.c
    team/pcadach/chan_h323-live/channels/chan_oss.c
    team/pcadach/chan_h323-live/channels/chan_sip.c
    team/pcadach/chan_h323-live/configs/zapata.conf.sample
    team/pcadach/chan_h323-live/main/cdr.c
    team/pcadach/chan_h323-live/main/channel.c

Propchange: team/pcadach/chan_h323-live/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/pcadach/chan_h323-live/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/pcadach/chan_h323-live/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/pcadach/chan_h323-live/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Sep  8 00:17:58 2006
@@ -1,1 +1,1 @@
-/trunk:1-42257
+/trunk:1-42419

Modified: team/pcadach/chan_h323-live/apps/app_read.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/apps/app_read.c?rev=42420&r1=42419&r2=42420&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/apps/app_read.c (original)
+++ team/pcadach/chan_h323-live/apps/app_read.c Fri Sep  8 00:17:58 2006
@@ -88,11 +88,9 @@
 {
 	int res = 0;
 	struct ast_module_user *u;
-	char tmp[256];
-	int maxdigits=255;
-	int tries = 1;
-	int to = 0;
-	int x = 0;
+	char tmp[256] = "";
+	int maxdigits = 255;
+	int tries = 1, to = 0, x = 0;
 	char *argcopy = NULL;
 	struct tone_zone_sound *ts;
 	struct ast_flags flags = {0};
@@ -207,6 +205,7 @@
 				}
 				res = 0;
 			} else {
+				pbx_builtin_setvar_helper(chan, arglist.variable, tmp);
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_3 "User disconnected\n");
 			}

Modified: team/pcadach/chan_h323-live/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/apps/app_record.c?rev=42420&r1=42419&r2=42420&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/apps/app_record.c (original)
+++ team/pcadach/chan_h323-live/apps/app_record.c Fri Sep  8 00:17:58 2006
@@ -43,6 +43,7 @@
 #include "asterisk/dsp.h"
 #include "asterisk/utils.h"
 #include "asterisk/options.h"
+#include "asterisk/app.h"
 
 
 static char *app = "Record";
@@ -179,8 +180,34 @@
 	/* these are to allow the use of the %d in the config file for a wild card of sort to
 	  create a new file with the inputed name scheme */
 	if (percentflag) {
+		AST_DECLARE_APP_ARGS(fname,
+			AST_APP_ARG(piece)[100];
+		);
+		char *tmp2 = ast_strdupa(filename);
+		char countstring[15];
+		int i;
+
+		/* Separate each piece out by the format specifier */
+		AST_NONSTANDARD_APP_ARGS(fname, tmp2, '%');
 		do {
-			snprintf(tmp, sizeof(tmp), filename, count);
+			int tmplen;
+			/* First piece has no leading percent, so it's copied verbatim */
+			ast_copy_string(tmp, fname.piece[0], sizeof(tmp));
+			tmplen = strlen(tmp);
+			for (i = 1; i < fname.argc; i++) {
+				if (fname.piece[i][0] == 'd') {
+					/* Substitute the count */
+					snprintf(countstring, sizeof(countstring), "%d", count);
+					ast_copy_string(tmp + tmplen, countstring, sizeof(tmp) - tmplen);
+					tmplen += strlen(countstring);
+				} else if (tmplen + 2 < sizeof(tmp)) {
+					/* Unknown format specifier - just copy it verbatim */
+					tmp[tmplen++] = '%';
+					tmp[tmplen++] = fname.piece[i][0];
+				}
+				/* Copy the remaining portion of the piece */
+				ast_copy_string(tmp + tmplen, &(fname.piece[i][1]), sizeof(tmp) - tmplen);
+			}
 			count++;
 		} while ( ast_fileexists(tmp, ext, chan->language) != -1 );
 		pbx_builtin_setvar_helper(chan, "RECORDED_FILE", tmp);

Modified: team/pcadach/chan_h323-live/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/apps/app_voicemail.c?rev=42420&r1=42419&r2=42420&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/apps/app_voicemail.c (original)
+++ team/pcadach/chan_h323-live/apps/app_voicemail.c Fri Sep  8 00:17:58 2006
@@ -89,6 +89,7 @@
 #endif
 
 #ifdef IMAP_STORAGE
+AST_MUTEX_DEFINE_STATIC(curhstusr_lock);
 static char *curhst = NIL;	/* currently connected host */
 static char *curusr = NIL;	/* current login user */
 
@@ -562,7 +563,7 @@
 		ast_copy_string(vmu->zonetag, value, sizeof(vmu->zonetag));
 #ifdef IMAP_STORAGE
 	} else if (!strcasecmp(var, "imapuser")) {
-		strncpy(vmu->imapuser, value, sizeof(vmu->imapuser) - 1);
+		ast_copy_string(vmu->imapuser, value, sizeof(vmu->imapuser));
 #endif
 	} else if (!strcasecmp(var, "delete") || !strcasecmp(var, "deletevoicemail")) {
 		ast_set2_flag(vmu, ast_true(value), VM_DELETE);	
@@ -1651,8 +1652,7 @@
 
 
 #endif
-static int
-inbuf(struct baseio *bio, FILE *fi)
+static int inbuf(struct baseio *bio, FILE *fi)
 {
 	int l;
 
@@ -1673,8 +1673,7 @@
 	return 1;
 }
 
-static int 
-inchar(struct baseio *bio, FILE *fi)
+static int inchar(struct baseio *bio, FILE *fi)
 {
 	if (bio->iocp>=bio->iolen) {
 		if (!inbuf(bio, fi))
@@ -1684,8 +1683,7 @@
 	return bio->iobuf[bio->iocp++];
 }
 
-static int
-ochar(struct baseio *bio, int c, FILE *so)
+static int ochar(struct baseio *bio, int c, FILE *so)
 {
 	if (bio->linelength>=BASELINELEN) {
 		if (fputs(eol,so)==EOF)
@@ -1924,7 +1922,7 @@
 		fprintf(p, "X-Asterisk-VM-Caller-ID-Num: %s\n", cidnum);
 		fprintf(p, "X-Asterisk-VM-Caller-ID-Name: %s\n", cidname);
 		fprintf(p, "X-Asterisk-VM-Duration: %d\n", duration);
-		if (category != NULL)
+		if (!ast_strlen_zero(category))
 			fprintf(p, "X-Asterisk-VM-Category: %s\n", category);
 		fprintf(p, "X-Asterisk-VM-Orig-date: %s\n", date);
 		fprintf(p, "X-Asterisk-VM-Orig-time: %ld\n", (long)time(NULL));
@@ -2376,7 +2374,7 @@
  		return 0;
  	if (strchr(mailbox, ',')) {
  		int tmpnew, tmpold;
- 		strncpy(tmp, mailbox, sizeof(tmp) - 1);
+		ast_copy_string(tmp, mailbox, sizeof(tmp));
  		mb = tmp;
  		ret = 0;
  		while((cur = strsep(&mb, ", "))) {
@@ -2393,8 +2391,7 @@
  		}
  		return 0;
  	}
- 
- 	strncpy(tmp, mailbox, sizeof(tmp) - 1);
+	ast_copy_string(tmp, mailbox, sizeof(tmp));
  	context = strchr(tmp, '@');
  	if (context) {
  		*context = '\0';
@@ -2408,7 +2405,7 @@
  	/* We have to get the user before we can open the stream! */
  	/*ast_log (LOG_DEBUG,"Before find_user, context is %s and mailbox is %s\n",context,mailbox); */
  	vmu = find_user(NULL, context, mailboxnc);
- 	if (vmu == NULL) {
+ 	if (!vmu) {
 		ast_log (LOG_ERROR,"Couldn't find mailbox %s in context %s\n",mailboxnc,context);
  		return -1;
  	} else {
@@ -2421,10 +2418,10 @@
  
  	/* check if someone is accessing this box right now... */
  	vms_p = get_vm_state_by_imapuser(vmu->imapuser,1);
- 	if (vms_p == NULL) {
+ 	if (!vms_p) {
  		vms_p = get_vm_state_by_mailbox(mailboxnc,1);
  	}
- 	if (vms_p != NULL) {
+ 	if (vms_p) {
 		if(option_debug > 2)
 			ast_log (LOG_DEBUG,"Returning before search - user is logged in\n");
  		*newmsgs = vms_p->newmessages;
@@ -2434,29 +2431,29 @@
  
  	/* add one if not there... */
  	vms_p = get_vm_state_by_imapuser(vmu->imapuser,0);
- 	if (vms_p == NULL) {
+ 	if (!vms_p) {
  		vms_p = get_vm_state_by_mailbox(mailboxnc,0);
  	}
  
- 	if (vms_p == NULL) {
+ 	if (!vms_p) {
 		if(option_debug > 2)
 			ast_log (LOG_DEBUG,"Adding new vmstate for %s\n",vmu->imapuser);
  		vms_p = (struct vm_state *)malloc(sizeof(struct vm_state));
  		strcpy(vms_p->imapuser,vmu->imapuser);
- 		strcpy(vms_p->username,mailboxnc); /* save for access from interactive entry point */
+ 		ast_copy_string(vms_p->username, mailboxnc, sizeof(vms_p->username)); /* save for access from interactive entry point */
  		vms_p->mailstream = NIL; /* save for access from interactive entry point */
 		if(option_debug > 2)
 			ast_log (LOG_DEBUG,"Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
  		vms_p->updated = 1;
  		vms_p->interactive = 0;
  		/* set mailbox to INBOX! */
- 		strncpy(vms_p->curbox, mbox(0), sizeof(vms_p->curbox) - 1);
+		ast_copy_string(vms_p->curbox, mbox(0), sizeof(vms_p->curbox));
  		init_vm_state(vms_p);
  		vmstate_insert(vms_p);
  	}
- 	if (vms_p->mailstream == NULL)
+ 	if (!vms_p->mailstream)
  		ret = init_mailstream(vms_p);
- 	if (vms_p->mailstream == NULL) {
+ 	if (!vms_p->mailstream) {
 		ast_log (LOG_ERROR,"Houston we have a problem - IMAP mailstream is NULL\n");
  		return -1;
  	}
@@ -2508,6 +2505,7 @@
 /* copy message only used by file storage */
 static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt)
 {
+	
 	char fromdir[256], todir[256], frompath[256], topath[256];
 	const char *frombox = mbox(imbox);
 	int recipmsgnum;
@@ -2869,7 +2867,7 @@
 		/* Is ext a mailbox? */
 		/* must open stream for this user to get info! */
 		vms = get_vm_state_by_mailbox(ext,0);
-		if (vms != NULL) {
+		if (vms) {
 			if(option_debug > 2)
 				ast_log(LOG_DEBUG, "Using vm_state, interactive set to %d.\n",vms->interactive);
 			newmsgs = vms->newmessages++;
@@ -3933,7 +3931,6 @@
 		if (!cmd) {
 			AST_LIST_TRAVERSE_SAFE_BEGIN(&extensions, vmtmp, list) {
 #ifdef IMAP_STORAGE
- 				/* NEED TO CHANGE username to mailbox!! - JAR */
  				/* Need to get message content */
 				if(option_debug > 2)
 	 				ast_log (LOG_DEBUG,"Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n",vms->curmsg, vms->msgArray[vms->curmsg]);
@@ -3945,13 +3942,13 @@
  				/* This will only work for new messages... */
 				header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
  				/* empty string means no valid header */
- 				if (header_content == "" || header_content == NULL) {
+ 				if (ast_strlen(header_content)) {
  					ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[vms->curmsg]);
  					return -1;
  				}
  				/* Get header info needed by sendmail */
  				temp = get_header_by_tag(header_content, "X-Asterisk-VM-Duration:");
- 				if (temp != NULL)
+ 				if (temp)
  					duration = atoi(temp);
  				else
  					duration = 0;
@@ -4317,7 +4314,7 @@
 	/* This will only work for new messages... */
 	header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
 	/* empty string means no valid header */
-	if (header_content == "" || header_content == NULL) {
+	if (ast_strlen(header_content)) {
 		ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[vms->curmsg]);
 		return -1;
 	}
@@ -4343,35 +4340,35 @@
 	/* Get info from headers!!  */
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:");
 
-	if (temp != NULL)
+	if (temp)
 		strcpy(cid,temp); 
 	else 
 		cid[0] = '\0';
 
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:");
 
-	if (temp != NULL)
+	if (temp)
 		strcpy(context,temp); 
 	else
 		context[0] = '\0';
 
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Orig-time:");
 
-	if (temp != NULL)
+	if (temp)
 		strcpy(origtime,temp);
 	else
 		origtime[0] = '\0';
 
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Duration:");
 
-	if (temp != NULL)
+	if (temp)
 		strcpy(duration,temp);
 	else
 		duration[0] = '\0';
 	
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Category:");
 	
-	if (temp != NULL)
+	if (temp)
 		strcpy(category,temp);
 	else
 		category[0] = '\0';
@@ -4381,9 +4378,7 @@
 	if (res == '1')
 		res = 0;
 
-
-	/* What is the category thing?  JAR */
-	if ((!res) && category[0] != '\0' && category != NULL) {
+	if ((!res) && !ast_strlen_zero(category)) {
 		res = play_message_category(chan, category);
 	}
 
@@ -4518,26 +4513,12 @@
 
 	strcpy(vms->imapuser,vmu->imapuser);
 	if (box == 1) {
-		strncpy(vms->curbox, mbox(0), sizeof(vms->curbox) - 1);
+		ast_copy_string(vms->curbox, mbox(0), sizeof(vms->curbox));
 		sprintf(vms->vmbox, "vm-%s", mbox(1));
 	} else {
-		strncpy(vms->curbox, mbox(box), sizeof(vms->curbox) - 1);
+		ast_copy_string(vms->curbox, mbox(box), sizeof(vms->curbox));
 		snprintf(vms->vmbox, sizeof(vms->vmbox), "vm-%s", vms->curbox);
 	}
-
-	/* No need to do another search! */
-	/*
-	if (vms->interactive == 1)  {
-		strncpy(vms->curbox, mbox(box), sizeof(vms->curbox) - 1);
-		snprintf(vms->vmbox, sizeof(vms->vmbox), "vm-%s", vms->curbox);
-		if (box == 0) {
-			vms->lastmsg = vms->newmessages - 1;
-		} else if (box == 1) {
-			vms->lastmsg = vms->oldmessages - 1;
-		}
-		return 0;
-	}
-	*/
 
 	if(option_debug > 2)
 		ast_log(LOG_DEBUG,"Before init_mailstream, user is %s\n",vmu->imapuser);
@@ -6957,35 +6938,34 @@
 #ifdef IMAP_STORAGE
 		/* IMAP server address */
 		if ((imap_server = ast_variable_retrieve(cfg, "general", "imapserver"))) {
-			strncpy(imapserver,imap_server,sizeof(imapserver) - 1);
+			ast_copy_string(imapserver, imap_server, sizeof(imapserver));
 		} else {
 			strcpy(imapserver,"localhost");
 		}
 		/* IMAP server port */
 		if ((imap_port = ast_variable_retrieve(cfg, "general", "imapport"))) {
-			strncpy(imapport,imap_port,sizeof(imapport) - 1);
+			ast_copy_string(imapport, imap_port, sizeof(imapport));
 		} else {
 			strcpy(imapport,"143");
 		}
 		/* IMAP server flags */
 		if ((imap_flags = ast_variable_retrieve(cfg, "general", "imapflags"))) {
-			strncpy(imapflags,imap_flags,sizeof(imapflags) - 1);
+			ast_copy_string(imapflags, imap_flags, sizeof(imapflags));
 		}
 		/* IMAP server master username */
 		if ((auth_user = ast_variable_retrieve(cfg, "general", "authuser"))) {
-			strncpy(authuser,auth_user,sizeof(authuser) - 1);
+			ast_copy_string(authuser, auth_user, sizeof(authuser));
 		}
 		/* IMAP server master password */
 		if ((auth_password = ast_variable_retrieve(cfg, "general", "authpassword"))) {
-			strncpy(authpassword,auth_password,sizeof(authpassword) - 1);
+			ast_copy_string(authpassword, auth_password, sizeof(authpassword));
 		}
 		/* Expunge on exit */
 		if ((expunge_on_hangup = ast_variable_retrieve(cfg, "general", "expungeonhangup"))) {
-			if (strcmp(expunge_on_hangup,"no") == 0 || strcmp(expunge_on_hangup,"No") == 0) {
+			if(!ast_false(expunge_on_hangup))
 				expungeonhangup = 0;
-			} else {
+			else
 				expungeonhangup = 1;
-			}
 		} else {
 			expungeonhangup = 1;
 		}
@@ -7467,7 +7447,7 @@
 	/* This will only work for new messages... */
 	header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
 	/* empty string means no valid header */
-	if (header_content == "" || header_content == NULL) {
+	if (ast_strlen_zero(header_content)) {
 		ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[vms->curmsg]);
 		return -1;
 	}
@@ -7475,7 +7455,7 @@
 	/* Get info from headers!!  */
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:");
 	
-	if (temp != NULL)
+	if (temp)
 		strcpy(cidS,temp);
 	else
 		cidS[0] = '\0';
@@ -7483,7 +7463,7 @@
 	cid = &cidS[0];
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:");
 	
-	if (temp != NULL)
+	if (temp)
 		strcpy(contextS,temp);
 	else
 		contextS[0] = '\0';
@@ -7491,7 +7471,7 @@
 	context = &contextS[0];
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Orig-time:");
 	
-	if (temp != NULL)
+	if (temp)
 		strcpy(origtimeS,temp);
 	else
 		origtimeS[0] = '\0';
@@ -7524,7 +7504,6 @@
 	context = ast_variable_retrieve(msg_cfg, "message", "context");
 	if (!strncasecmp("macro",context,5)) /* Macro names in contexts are useless for our needs */
 		context = ast_variable_retrieve(msg_cfg, "message","macrocontext");
-	ast_config_destroy(msg_cfg);
 #endif
 	switch (option) {
 	case 3:
@@ -7548,8 +7527,10 @@
 				if (num) {
 					/* Dial the CID number */
 					res = dialout(chan, vmu, num, vmu->callback);
-					if (res)
+					if (res) {
+						ast_config_destroy(msg_cfg);
 						return 9;
+					}
 				} else {
 					res = '2';
 				}
@@ -7559,13 +7540,16 @@
 				/* Want to enter a different number, can only do this if there's a dialout context for this user */
 				if (!ast_strlen_zero(vmu->dialout)) {
 					res = dialout(chan, vmu, NULL, vmu->dialout);
-					if (res)
+					if (res) {
+						ast_config_destroy(msg_cfg);
 						return 9;
+					}
 				} else {
 					if (option_verbose > 2)
 						ast_verbose( VERBOSE_PREFIX_3 "Caller can not specify callback number - no dialout context available\n");
 					res = ast_play_and_wait(chan, "vm-sorry");
 				}
+				ast_config_destroy(msg_cfg);
 				return res;
 			case '*':
 				res = 't';
@@ -7633,6 +7617,7 @@
 				ast_verbose(VERBOSE_PREFIX_3 "No CID number available, no reply sent\n");
 			if (!res)
 				res = ast_play_and_wait(chan, "vm-nonumber");
+			ast_config_destroy(msg_cfg);
 			return res;
 		} else {
 			if (find_user(NULL, vmu->context, num)) {
@@ -7645,10 +7630,10 @@
 				
 				memset(&leave_options, 0, sizeof(leave_options));
 				leave_options.record_gain = record_gain;
-				/* Changed to mailbox instead of num - JAR */
 				res = leave_voicemail(chan, mailbox, &leave_options);
 				if (!res)
 					res = 't';
+				ast_config_destroy(msg_cfg);
 				return res;
 			} else {
 				/* Sender has no mailbox, can't reply */
@@ -7656,6 +7641,7 @@
 					ast_verbose( VERBOSE_PREFIX_3 "No mailbox number '%s' in context '%s', no reply sent\n", num, vmu->context);
 				ast_play_and_wait(chan, "vm-nobox");
 				res = 't';
+				ast_config_destroy(msg_cfg);
 				return res;
 			}
 		} 
@@ -7877,22 +7863,21 @@
 	
 	
 	
-	if (vms == NULL) {
+	if (!vms) {
 		ast_log (LOG_ERROR,"vm_state is NULL!\n");
 		return -1;
 	}
 	if(option_debug > 2)
 		ast_log (LOG_DEBUG,"vm_state user is:%s\n",vms->imapuser);
-	if (vms->mailstream == NIL || vms->mailstream == NULL) {
+	if (vms->mailstream == NIL || !vms->mailstream) {
 		ast_log (LOG_DEBUG,"mailstream not set.\n");
 	} else {
 		stream = vms->mailstream;
 		/* return 0; */
 	}
-	
+	ast_mutex_lock(&curhstusr_lock);
 	curusr = cpystr (vms->imapuser);
 	curhst = cpystr (mylocalhost ());
-	
 	/* debug = T;  user wants protocol telemetry? */
 	debug = NIL;  /* NO protocol telemetry? */
 	if (strlen(authuser) > 0) {
@@ -7902,6 +7887,7 @@
 	}
 	if(option_debug > 2)
 		ast_log (LOG_DEBUG,"Before mail_open, curusr: %s, mbox:%s\n",curusr,mbox);
+	ast_mutex_unlock(&curhstusr_lock);
 	vms->mailstream = mail_open (stream, mbox, debug ? OP_DEBUG : NIL);
 	if (vms->mailstream == NIL) {
 		return -1;
@@ -7932,7 +7918,7 @@
 	user = get_user_by_mailbox(mailbox);
 	
 	vms = get_vm_state_by_imapuser(user,2);
-	if (vms != NULL) {
+	if (vms) {
 		if(option_debug > 2)
 			ast_log (LOG_DEBUG, "saving mailbox message number %lu as message %d. Interactive set to %d\n",number,vms->vmArrayIndex,vms->interactive);
 		vms->msgArray[vms->vmArrayIndex++] = number;
@@ -8147,47 +8133,36 @@
 
 void mm_list(MAILSTREAM * stream, int delim, char *mailbox, long attributes)
 {
-	ast_log (LOG_NOTICE,"****** Entering callback\n");
-	putchar (' ');
-	if (delimiter) {
-		putchar (delimiter);
+	if (delimiter)
 		delimiter = delim;
-		ast_log (LOG_NOTICE,"Delimiter set to %c\n",delim);
-	} else {
-		fputs ("NIL", stdout);
-	}
-	putchar (' ');
-	fputs (mailbox, stdout);
+	if (option_debug > 4) {
+		ast_log(LOG_DEBUG, "Delimiter set to %c and mailbox %s\n",delim, mailbox);
 	if (attributes & LATT_NOINFERIORS)
-		fputs (", no inferiors", stdout);
+		ast_log(LOG_DEBUG, "no inferiors\n");
 	if (attributes & LATT_NOSELECT)
-		fputs (", no select", stdout);
+		ast_log(LOG_DEBUG, "no select\n");
 	if (attributes & LATT_MARKED)
-		fputs (", marked", stdout);
+		ast_log(LOG_DEBUG, "marked\n");
 	if (attributes & LATT_UNMARKED)
-		fputs (", unmarked", stdout);
-	putchar ('\n');
+		ast_log(LOG_DEBUG, "unmarked\n");
+	}
 }
 
 
 void mm_lsub(MAILSTREAM * stream, int delimiter, char *mailbox, long attributes)
 {
-	putchar (' ');
-	if (delimiter)
-		putchar (delimiter);
-	else
-		fputs ("NIL", stdout);
-	putchar (' ');
-	fputs (mailbox, stdout);
+
+	if (option_debug > 4) {
+		ast_log(LOG_DEBUG, "Delimiter set to %c and mailbox %s\n",delimiter, mailbox);
 	if (attributes & LATT_NOINFERIORS)
-		fputs (", no inferiors", stdout);
+		ast_log(LOG_DEBUG, "no inferiors\n");
 	if (attributes & LATT_NOSELECT)
-		fputs (", no select", stdout);
+		ast_log(LOG_DEBUG, "no select\n");
 	if (attributes & LATT_MARKED)
-		fputs (", marked", stdout);
+		ast_log(LOG_DEBUG, "marked\n");
 	if (attributes & LATT_UNMARKED)
-		fputs (", unmarked", stdout);
-	putchar ('\n');
+		ast_log(LOG_DEBUG, "unmarked\n");
+	}
 }
 
 
@@ -8237,6 +8212,7 @@
 	char tmp[MAILTMPLEN];
 	if(option_debug > 3)
 		ast_log(LOG_DEBUG, "Entering callback mm_login\n");
+	ast_mutex_lock(&curhstusr_lock);
 	if (curhst)
 		fs_give ((void **) &curhst);
 	curhst = (char *) fs_get (1 + strlen (mb->host));
@@ -8250,7 +8226,7 @@
 	}
 	if (curusr)
 		fs_give ((void **) &curusr);
-	
+	ast_mutex_unlock(&curhstusr_lock);
 	/* strcpy (pwd, getpass (tmp));*/
 	/* We should only do this when necessary */
 	if (strlen(authpassword) > 0) {
@@ -8290,7 +8266,7 @@
 	unsigned long usage = 0;
 	unsigned long limit = 0;
 	
-	while (pquota != NULL) {
+	while (pquota) {
 		usage = pquota->usage;
 		limit = pquota->limit;
 		pquota = pquota->next;
@@ -8299,7 +8275,7 @@
 	mailbox = stream->mailbox;
 	user = get_user_by_mailbox(mailbox);
 	vms = get_vm_state_by_imapuser(user,2);
-	if (vms != NULL) {
+	if (vms) {
 		if(option_debug > 2)
 			ast_log (LOG_DEBUG, "User %s usage is %lu, limit is %lu\n",user,usage,limit);
 		vms->quota_usage = usage;
@@ -8315,15 +8291,18 @@
 	int taglen;
 	char *eol_pnt;
 
-	if (header == NULL || tag == NULL) return NULL;
+	if (!header || !tag)
+		return NULL;
 
 	taglen = strlen(tag) + 1;
-	if (taglen < 1) return NULL;
+	if (taglen < 1)
+		return NULL;
 
 	start = strstr(header, tag);
-	if (start == NULL) return NULL;
-
-	strncpy(temp,start+taglen,sizeof(temp)-1);
+	if (!start)
+		return NULL;
+
+	ast_copy_string(temp, start+taglen, sizeof(temp));
 	eol_pnt = strchr(temp,'\n');
 	*eol_pnt = '\0';
 	return temp;
@@ -8334,18 +8313,19 @@
 	char *start, *quote;
 	char *eol_pnt;
 
-	if (mailbox == NULL) return NULL;
+	if (!mailbox)
+		return NULL;
 
 	start = strstr(mailbox,"user=");
-	if (start == NULL) return NULL;
-
-	/* strncpy(temp,start+1,sizeof(temp)-1); */
+	if (!start)
+		return NULL;
+
 	strcpy(temp,start+5);
 
 	quote = strchr(temp,'\"');
-	if (quote == NULL) {  /* if username is not in quotes */
+	if (!quote) {  /* if username is not in quotes */
 		eol_pnt = strchr(temp,'/');
-		if (eol_pnt == NULL) {
+		if (!eol_pnt) {
 			eol_pnt = strchr(temp,'}');
 		}
 		*eol_pnt = '\0';
@@ -8363,9 +8343,9 @@
 
 	vlist = vmstates;
 	while (vlist) {
-		if (vlist->vms != NULL) {
-			if (vlist->vms->imapuser != NULL) {
-				if (strcmp(vlist->vms->imapuser,user) == 0) {
+		if (vlist->vms) {
+			if (vlist->vms->imapuser) {
+				if (!strcmp(vlist->vms->imapuser,user)) {
 					if (interactive == 2) {
 						return vlist->vms;
 					} else if (vlist->vms->interactive == interactive) {
@@ -8395,11 +8375,11 @@
 	if(option_debug > 2) 
 		ast_log(LOG_DEBUG, "Mailbox set to %s\n",mailbox);
 	while (vlist) {
-		if (vlist->vms != NULL) {
-			if (vlist->vms->username != NULL) {
+		if (vlist->vms) {
+			if (vlist->vms->username) {
 				if(option_debug > 2)
 					ast_log(LOG_DEBUG, "	comparing mailbox %s (i=%d) to vmstate mailbox %s (i=%d)\n",mailbox,interactive,vlist->vms->username,vlist->vms->interactive);
-				if (strcmp(vlist->vms->username,mailbox) == 0 && vlist->vms->interactive == interactive) {
+				if (!strcmp(vlist->vms->username,mailbox) && vlist->vms->interactive == interactive) {
 					if(option_debug > 2)
 						ast_log(LOG_DEBUG, "	Found it!\n");
 					return vlist->vms;
@@ -8429,12 +8409,11 @@
 	   We can compare the username to find the duplicate */
 	if (vms->interactive == 1) {
 		altvms = get_vm_state_by_mailbox(vms->username,0);
-		if (altvms != NULL) {
+		if (altvms) {
 			if(option_debug > 2)
 				ast_log(LOG_DEBUG, "Duplicate mailbox %s, copying message info...\n",vms->username);
 			vms->newmessages = altvms->newmessages;
 			vms->oldmessages = altvms->oldmessages;
-			/* JAR - START HERE - this copy may not be right */
 			if(option_debug > 2)
 				ast_log(LOG_DEBUG, "check_msgArray before memcpy\n");
 			check_msgArray(vms);
@@ -8455,7 +8434,7 @@
 	}
 
 	v = (struct vmstate *)malloc(sizeof(struct vmstate));
-	if (v == NULL) {
+	if (!v) {
 		ast_log(LOG_ERROR, "Out of memory\n");
 	}
 	if(option_debug > 2)
@@ -8476,7 +8455,7 @@
 	   back to the persistent state (to make update immediate) */
 	if (vms->interactive == 1) {
 		altvms = vms->persist_vms;
-		if (altvms != NULL) {
+		if (altvms) {
 			if(option_debug > 2)
 				ast_log(LOG_DEBUG, "Duplicate mailbox %s, copying message info...\n",vms->username);
 			altvms->newmessages = vms->newmessages;
@@ -8501,7 +8480,7 @@
 		vl = vc;
 		vc = vc->next;
 	}
-	if (vf == NULL) {
+	if (!vf) {
 		ast_log(LOG_ERROR, "No vmstate found for user:%s, mailbox %s\n",vms->imapuser,vms->username);
 	} else {
 		free(vf);
@@ -8518,7 +8497,7 @@
 	mailbox = stream->mailbox;
 	user = get_user_by_mailbox(mailbox);
 	vms = get_vm_state_by_imapuser(user, 0);
-	if (vms != NULL) {
+	if (vms) {
 		if(option_debug > 2)
 			ast_log (LOG_DEBUG, "User %s mailbox set for update.\n",user);
 		vms->updated = 2; /* set updated flag since mailbox changed */
@@ -8564,7 +8543,8 @@
 	unsigned long newlen;
 	char filename[256];
 	
-	if (body == NULL || body == NIL) return -1;
+	if (!body || body == NIL)
+		return -1;
 	display_body (body, NIL, (long) 0);
 	body_content = mail_fetchbody (vms->mailstream, vms->msgArray[vms->curmsg], section, &len);
 	if (body_content != NIL) {

Modified: team/pcadach/chan_h323-live/build_tools/cflags.xml
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/build_tools/cflags.xml?rev=42420&r1=42419&r2=42420&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/build_tools/cflags.xml (original)
+++ team/pcadach/chan_h323-live/build_tools/cflags.xml Fri Sep  8 00:17:58 2006
@@ -9,7 +9,7 @@
 		</member>
 		<member name="DO_CRASH" displayname="Crash on fatal errors">
 		</member>
-		<member name="DONT_OPTIMIZE" displayname="Disable Optimizations from the Compiler">
+		<member name="DONT_OPTIMIZE" displayname="Disable Optimizations by the Compiler">
 		</member>
 		<member name="DUMP_SCHEDULER" displayname="Dump Scheduler Contents for Debugging">
 		</member>

Modified: team/pcadach/chan_h323-live/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/chan_alsa.c?rev=42420&r1=42419&r2=42420&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/chan_alsa.c (original)
+++ team/pcadach/chan_h323-live/channels/chan_alsa.c Fri Sep  8 00:17:58 2006
@@ -73,8 +73,7 @@
 #endif
 
 /*! Global jitterbuffer configuration - by default, jb is disabled */
-static struct ast_jb_conf default_jbconf =
-{
+static struct ast_jb_conf default_jbconf = {
 	.flags = 0,
 	.max_size = -1,
 	.resync_threshold = -1,
@@ -90,7 +89,7 @@
 
 /* Lets use 160 sample frames, just like GSM.  */
 #define FRAME_SIZE 160
-#define PERIOD_FRAMES 80 /* 80 Frames, at 2 bytes each */
+#define PERIOD_FRAMES 80		/* 80 Frames, at 2 bytes each */
 
 /* When you set the frame size, you have to come up with
    the right buffer format as well. */
@@ -129,9 +128,9 @@
 static char exten[AST_MAX_EXTENSION] = "s";
 static char mohinterpret[MAX_MUSICCLASS];
 
-static int hookstate=0;
-
-static short silence[FRAME_SIZE] = {0, };
+static int hookstate = 0;
+
+static short silence[FRAME_SIZE] = { 0, };
 
 struct sound {
 	int ind;
@@ -143,11 +142,11 @@
 };
 
 static struct sound sounds[] = {
-	{ AST_CONTROL_RINGING, ringtone, sizeof(ringtone)/2, 16000, 32000, 1 },
-	{ AST_CONTROL_BUSY, busy, sizeof(busy)/2, 4000, 4000, 1 },
-	{ AST_CONTROL_CONGESTION, busy, sizeof(busy)/2, 2000, 2000, 1 },
-	{ AST_CONTROL_RING, ring10, sizeof(ring10)/2, 16000, 32000, 1 },
-	{ AST_CONTROL_ANSWER, answer, sizeof(answer)/2, 2200, 0, 0 },
+	{AST_CONTROL_RINGING, ringtone, sizeof(ringtone) / 2, 16000, 32000, 1},
+	{AST_CONTROL_BUSY, busy, sizeof(busy) / 2, 4000, 4000, 1},
+	{AST_CONTROL_CONGESTION, busy, sizeof(busy) / 2, 2000, 2000, 1},
+	{AST_CONTROL_RING, ring10, sizeof(ring10) / 2, 16000, 32000, 1},
+	{AST_CONTROL_ANSWER, answer, sizeof(answer) / 2, 2200, 0, 0},
 };
 
 /* Sound command pipe */
@@ -163,7 +162,7 @@
 	snd_pcm_t *card;
 #endif
 	snd_pcm_t *icard, *ocard;
-	
+
 } alsa;
 
 /* Number of buffers...  Each is FRAMESIZE/8 ms long.  For example
@@ -182,9 +181,9 @@
 
 static int cursound = -1;
 static int sampsent = 0;
-static int silencelen=0;
-static int offset=0;
-static int nosound=0;
+static int silencelen = 0;
+static int offset = 0;
+static int nosound = 0;
 
 /* ZZ */
 static struct ast_channel *alsa_request(const char *type, int format, void *data, int *cause);
@@ -219,63 +218,60 @@
 	short myframe[FRAME_SIZE];
 	int total = FRAME_SIZE;
 	short *frame = NULL;
-	int amt=0;
-	int res;
-	int myoff;
+	int amt = 0, res, myoff;
 	snd_pcm_state_t state;
 
-	if (cursound > -1) {
-		res = total;
-		if (sampsent < sounds[cursound].samplen) {
-			myoff=0;
-			while(total) {
-				amt = total;
-				if (amt > (sounds[cursound].datalen - offset)) 
-					amt = sounds[cursound].datalen - offset;
-				memcpy(myframe + myoff, sounds[cursound].data + offset, amt * 2);
-				total -= amt;
-				offset += amt;
-				sampsent += amt;
-				myoff += amt;
-				if (offset >= sounds[cursound].datalen)
-					offset = 0;
+	if (cursound == -1)
+		return 0;
+	
+	res = total;
+	if (sampsent < sounds[cursound].samplen) {
+		myoff = 0;
+		while (total) {
+			amt = total;
+			if (amt > (sounds[cursound].datalen - offset))
+				amt = sounds[cursound].datalen - offset;
+			memcpy(myframe + myoff, sounds[cursound].data + offset, amt * 2);
+			total -= amt;
+			offset += amt;
+			sampsent += amt;
+			myoff += amt;
+			if (offset >= sounds[cursound].datalen)
+				offset = 0;
+		}
+		/* Set it up for silence */
+		if (sampsent >= sounds[cursound].samplen)
+			silencelen = sounds[cursound].silencelen;
+		frame = myframe;
+	} else {
+		if (silencelen > 0) {
+			frame = silence;
+			silencelen -= res;
+		} else {
+			if (sounds[cursound].repeat) {
+				/* Start over */
+				sampsent = 0;
+				offset = 0;
+			} else {
+				cursound = -1;
+				nosound = 0;
 			}
-			/* Set it up for silence */
-			if (sampsent >= sounds[cursound].samplen) 
-				silencelen = sounds[cursound].silencelen;
-			frame = myframe;
-		} else {
-			if (silencelen > 0) {
-				frame = silence;
-				silencelen -= res;
-			} else {
-				if (sounds[cursound].repeat) {
-					/* Start over */
-					sampsent = 0;
-					offset = 0;
-				} else {
-					cursound = -1;
-					nosound = 0;
-				}
 			return 0;
-			}
-		}
-		
-		if (res == 0 || !frame) {
-			return 0;
-		}
+		}
+	}
+	
+	if (res == 0 || !frame)
+		return 0;
+
 #ifdef ALSA_MONITOR
-		alsa_monitor_write((char *)frame, res * 2);
-#endif		
-		state = snd_pcm_state(alsa.ocard);
-		if (state == SND_PCM_STATE_XRUN) {
-			snd_pcm_prepare(alsa.ocard);
-		}
-		res = snd_pcm_writei(alsa.ocard, frame, res);
-		if (res > 0)
-			return 0;
+	alsa_monitor_write((char *) frame, res * 2);
+#endif
+	state = snd_pcm_state(alsa.ocard);
+	if (state == SND_PCM_STATE_XRUN)
+		snd_pcm_prepare(alsa.ocard);
+	res = snd_pcm_writei(alsa.ocard, frame, res);
+	if (res > 0)
 		return 0;
-	}
 	return 0;
 }
 
@@ -283,9 +279,9 @@
 {
 	fd_set rfds;
 	fd_set wfds;
-	int max;
-	int res;
-	for(;;) {
+	int max, res;
+
+	for (;;) {
 		FD_ZERO(&rfds);
 		FD_ZERO(&wfds);
 		max = sndcmd[0];
@@ -313,7 +309,7 @@
 			snd_pcm_state_t state;
 			short buf[FRAME_SIZE];
 			int r;
-			
+
 			state = snd_pcm_state(alsa.ocard);
 			if (state == SND_PCM_STATE_XRUN) {
 				snd_pcm_prepare(alsa.ocard);
@@ -330,9 +326,9 @@
 			} else if (r < 0) {
 				ast_log(LOG_ERROR, "Read error: %s\n", snd_strerror(r));
 			} else
-				alsa_monitor_read((char *)buf, r * 2);
-		}		
-#endif		
+				alsa_monitor_read((char *) buf, r * 2);
+		}
+#endif
 		if (FD_ISSET(sndcmd[0], &rfds)) {
 			read(sndcmd[0], &cursound, sizeof(cursound));
 			silencelen = 0;
@@ -370,121 +366,102 @@
 	if (err < 0) {
 		ast_log(LOG_ERROR, "snd_pcm_open failed: %s\n", snd_strerror(err));
 		return NULL;
-	} else {
+	} else
 		ast_log(LOG_DEBUG, "Opening device %s in %s mode\n", dev, (stream == SND_PCM_STREAM_CAPTURE) ? "read" : "write");
-	}
 
 	snd_pcm_hw_params_alloca(&hwparams);
 	snd_pcm_hw_params_any(handle, hwparams);
 
 	err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "set_access failed: %s\n", snd_strerror(err));
-	}
 
 	err = snd_pcm_hw_params_set_format(handle, hwparams, format);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "set_format failed: %s\n", snd_strerror(err));
-	}
 
 	err = snd_pcm_hw_params_set_channels(handle, hwparams, 1);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "set_channels failed: %s\n", snd_strerror(err));
-	}
 
 	direction = 0;
 	err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &rate, &direction);
-	if (rate != DESIRED_RATE) {
+	if (rate != DESIRED_RATE)
 		ast_log(LOG_WARNING, "Rate not correct, requested %d, got %d\n", DESIRED_RATE, rate);
-	}
 
 	direction = 0;
 	err = snd_pcm_hw_params_set_period_size_near(handle, hwparams, &period_size, &direction);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "period_size(%ld frames) is bad: %s\n", period_size, snd_strerror(err));
-	} else {
+	else
 		ast_log(LOG_DEBUG, "Period size is %d\n", err);
-	}
-
-	buffer_size = 4096 * 2; /* period_size * 16; */
+
+	buffer_size = 4096 * 2;		/* period_size * 16; */
 	err = snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, &buffer_size);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_WARNING, "Problem setting buffer size of %ld: %s\n", buffer_size, snd_strerror(err));
-	} else {
+	else
 		ast_log(LOG_DEBUG, "Buffer size is set to %d frames\n", err);
-	}
 
 #if 0
 	direction = 0;
 	err = snd_pcm_hw_params_set_periods_min(handle, hwparams, &per_min, &direction);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "periods_min: %s\n", snd_strerror(err));
-	}
 
 	err = snd_pcm_hw_params_set_periods_max(handle, hwparams, &per_max, 0);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "periods_max: %s\n", snd_strerror(err));
-	}
 #endif
 
 	err = snd_pcm_hw_params(handle, hwparams);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "Couldn't set the new hw params: %s\n", snd_strerror(err));
-	}
 
 	snd_pcm_sw_params_alloca(&swparams);
 	snd_pcm_sw_params_current(handle, swparams);
 
 #if 1
-	if (stream == SND_PCM_STREAM_PLAYBACK) {
+	if (stream == SND_PCM_STREAM_PLAYBACK)
 		start_threshold = period_size;
-	} else {
+	else
 		start_threshold = 1;
-	}
 
 	err = snd_pcm_sw_params_set_start_threshold(handle, swparams, start_threshold);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "start threshold: %s\n", snd_strerror(err));
-	}
 #endif
 
 #if 1
-	if (stream == SND_PCM_STREAM_PLAYBACK) {
+	if (stream == SND_PCM_STREAM_PLAYBACK)
 		stop_threshold = buffer_size;
-	} else {
+	else
 		stop_threshold = buffer_size;
-	}
+
 	err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, stop_threshold);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "stop threshold: %s\n", snd_strerror(err));
-	}
 #endif
 #if 0
 	err = snd_pcm_sw_params_set_xfer_align(handle, swparams, PERIOD_FRAMES);
-	if (err < 0) {
+	if (err < 0)
 		ast_log(LOG_ERROR, "Unable to set xfer alignment: %s\n", snd_strerror(err));
-	}
 #endif
 
 #if 0
 	err = snd_pcm_sw_params_set_silence_threshold(handle, swparams, silencethreshold);
-	if (err < 0) {
+	if (err < 0)

[... 2174 lines stripped ...]


More information about the asterisk-commits mailing list