[svn-commits] murf: branch murf/bug11210 r99859 - in /team/murf/bug11210: ./ apps/ build_to...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jan 23 07:22:40 CST 2008


Author: murf
Date: Wed Jan 23 07:22:39 2008
New Revision: 99859

URL: http://svn.digium.com/view/asterisk?view=rev&rev=99859
Log:
Merged revisions 99642,99644-99647,99653,99696,99700,99719,99758,99776,99778,99818,99839 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r99642 | russell | 2008-01-22 13:33:16 -0700 (Tue, 22 Jan 2008) | 3 lines

Change the Asterisk CLI startup commands feature to read commands to run from cli.conf
after a discussion on the -dev list.

................
r99644 | oej | 2008-01-22 13:35:10 -0700 (Tue, 22 Jan 2008) | 18 lines

Add a generic function to set the bridged call PVT unique id string
as a channel variable BRIDGEPVTCALLID

This is important for call tracing in log files and CDRs, so that
the SIP callID can be traced along servers.

The CHANNEL dialplan function won't work here, since the outbound
channel is gone when we need the Call-ID.

Other channel drivers may now implement the same function :-),
but this patch only supports chan_sip.so.

Inspired by (issue #11816)
Reported by: ctooley

Patch by oej


................
r99645 | russell | 2008-01-22 13:41:05 -0700 (Tue, 22 Jan 2008) | 2 lines

Make sure the command is not just present but is also configured to be executed

................
r99646 | tilghman | 2008-01-22 13:42:47 -0700 (Tue, 22 Jan 2008) | 10 lines

Merged revisions 99643 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r99643 | tilghman | 2008-01-22 14:34:55 -0600 (Tue, 22 Jan 2008) | 2 lines

Fix the defines for OS X (and Solaris, too)

........

................
r99647 | oej | 2008-01-22 13:44:56 -0700 (Tue, 22 Jan 2008) | 2 lines

Documentation updates for BRIDGEPVTCALLID

................
r99653 | oej | 2008-01-22 14:09:37 -0700 (Tue, 22 Jan 2008) | 12 lines

Merged revisions 99652 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r99652 | oej | 2008-01-22 21:56:09 +0100 (Tis, 22 Jan 2008) | 4 lines

Thanks to Russell's education I realize that BUFSIZ has changed since I learned the C language 
over 20 years ago... Resetting chan_sip to the size of BUFSIZ that I expected in my old 
head to avoid too heavy memory allocations on some systems.

........

................
r99696 | tilghman | 2008-01-22 15:33:20 -0700 (Tue, 22 Jan 2008) | 10 lines

Add res_config_ldap for realtime LDAP engine.
(closes issue #5768)
 Reported by: mguesdon
 Patches: 
       res_config_ldap-v0.7.tar.gz uploaded by mguesdon (license 121)
       res_ldap.conf.sample uploaded by suretec (license 70)
       asterisk-v3.1.4.ldif uploaded by suretec (license 70)
       asterisk-v3.1.4.schema uploaded by suretec (license 70)
 Tested by: oej, mguesdon, suretec, cthorner

................
r99700 | tilghman | 2008-01-22 17:10:45 -0700 (Tue, 22 Jan 2008) | 2 lines

Oops

................
r99719 | tilghman | 2008-01-22 18:06:27 -0700 (Tue, 22 Jan 2008) | 10 lines

Merged revisions 99718 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r99718 | tilghman | 2008-01-22 18:56:06 -0600 (Tue, 22 Jan 2008) | 2 lines

Just confirmed that all current platforms need this header file

........

................
r99758 | tilghman | 2008-01-22 20:57:31 -0700 (Tue, 22 Jan 2008) | 2 lines

Coding guidelines cleanup

................
r99776 | tilghman | 2008-01-22 21:25:33 -0700 (Tue, 22 Jan 2008) | 10 lines

Merged revisions 99775 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r99775 | tilghman | 2008-01-22 22:20:15 -0600 (Tue, 22 Jan 2008) | 2 lines

Oops, should have checked for a NULL obj, here, too

........

................
r99778 | tilghman | 2008-01-22 21:35:04 -0700 (Tue, 22 Jan 2008) | 16 lines

Merged revisions 99777 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r99777 | tilghman | 2008-01-22 22:31:51 -0600 (Tue, 22 Jan 2008) | 8 lines

When we reset the password via an external command, we should also reset the
password stored in the in-memory list, too (otherwise it doesn't really take
effect).
(closes issue #11809)
 Reported by: davetroy
 Patches: 
       fix_externpass.diff uploaded by davetroy (license 384)

........

................
r99818 | tilghman | 2008-01-22 22:29:28 -0700 (Tue, 22 Jan 2008) | 2 lines

Coding guidelines fixups

................
r99839 | oej | 2008-01-23 03:18:13 -0700 (Wed, 23 Jan 2008) | 3 lines

- Add a few comments to sip_xmit
- Make sure that we are aware of a pending INVITE even if we're using TCP

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

Added:
    team/murf/bug11210/configs/cli.conf.sample
      - copied unchanged from r99839, trunk/configs/cli.conf.sample
    team/murf/bug11210/configs/res_ldap.conf.sample
      - copied unchanged from r99839, trunk/configs/res_ldap.conf.sample
    team/murf/bug11210/contrib/scripts/asterisk.ldap-schema
      - copied unchanged from r99839, trunk/contrib/scripts/asterisk.ldap-schema
    team/murf/bug11210/contrib/scripts/asterisk.ldif
      - copied unchanged from r99839, trunk/contrib/scripts/asterisk.ldif
    team/murf/bug11210/doc/ldap.txt
      - copied unchanged from r99839, trunk/doc/ldap.txt
    team/murf/bug11210/res/res_config_ldap.c
      - copied unchanged from r99839, trunk/res/res_config_ldap.c
Modified:
    team/murf/bug11210/   (props changed)
    team/murf/bug11210/CHANGES
    team/murf/bug11210/apps/app_voicemail.c
    team/murf/bug11210/build_tools/menuselect-deps.in
    team/murf/bug11210/channels/chan_sip.c
    team/murf/bug11210/configure
    team/murf/bug11210/configure.ac
    team/murf/bug11210/doc/tex/channelvariables.tex
    team/murf/bug11210/include/asterisk/autoconfig.h.in
    team/murf/bug11210/include/asterisk/channel.h
    team/murf/bug11210/main/acl.c
    team/murf/bug11210/main/asterisk.c
    team/murf/bug11210/main/channel.c
    team/murf/bug11210/makeopts.in
    team/murf/bug11210/res/res_odbc.c

Change Statistics:
 0 files changed

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
    automerge = yes

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jan 23 07:22:39 2008
@@ -1,1 +1,1 @@
-/trunk:1-99615
+/trunk:1-99858

Modified: team/murf/bug11210/CHANGES
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/CHANGES?view=diff&rev=99859&r1=99858&r2=99859
==============================================================================
--- team/murf/bug11210/CHANGES (original)
+++ team/murf/bug11210/CHANGES Wed Jan 23 07:22:39 2008
@@ -66,6 +66,10 @@
      the existence of a dialplan target.
   * Added two new dialplan functions, TOUPPER and TOLOWER, which convert a string to
      upper and lower case, respectively.
+  * When bridging, Asterisk sets the BRIDGEPVTCALLID to the channel drivers unique
+     ID for the call (not the Asterisk call ID or unique ID), provided that the
+     channel driver supports this. For SIP, you get the SIP call-ID for the
+     bridged channel which you can store in the CDR with a custom field.
 
 CLI Changes
 -----------
@@ -80,8 +84,7 @@
   * New CLI commands "dialplan set extenpatternmatching true/false"
   * New CLI command: "core set chanvar" to set a channel variable from the CLI.
   * Added an easy way to execute Asterisk CLI commands at startup.  Any commands
-    listed in the startup_commands file in the Asterisk configuration directory
-    will get executed.
+    listed in the startup_commands section of cli.conf will get executed.
 
 SIP changes
 -----------
@@ -460,6 +463,8 @@
      to retrieve, create, update, and delete realtime information from a remote
      web server.  Note that this module requires func_curl.so to be loaded for
      backend functionality.
+  * Added a new module, res_config_ldap, which permits the use of an LDAP
+     server for realtime data access.
 
 Miscellaneous 
 -------------

Modified: team/murf/bug11210/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_voicemail.c?view=diff&rev=99859&r1=99858&r2=99859
==============================================================================
--- team/murf/bug11210/apps/app_voicemail.c (original)
+++ team/murf/bug11210/apps/app_voicemail.c Wed Jan 23 07:22:39 2008
@@ -157,7 +157,7 @@
 static int imap_retrieve_file (char *dir, int msgnum, const char *mailbox, char *context);
 static int imap_delete_old_greeting (char *dir, struct vm_state *vms);
 static void check_quota(struct vm_state *vms, char *mailbox);
-static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box);
+static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);
 struct vmstate {
 	struct vm_state *vms;
 	AST_LIST_ENTRY(vmstate) list;
@@ -443,7 +443,7 @@
 #define RETRIEVE(a,b,c,d) (imap_retrieve_file(a,b,c,d ))
 #define DISPOSE(a,b) (imap_remove_file(a,b))
 #define STORE(a,b,c,d,e,f,g,h,i) (imap_store_file(a,b,c,d,e,f,g,h,i))
-#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
+#define EXISTS(a,b,c,d) (ast_fileexists(c, NULL, d) > 0)
 #define RENAME(a,b,c,d,e,f,g,h) (rename_file(g,h));
 #define COPY(a,b,c,d,e,f,g,h) (copy_file(g,h));
 #define IMAP_DELETE(a,b,c,d) (vm_imap_delete(b,d))
@@ -452,7 +452,7 @@
 #define RETRIEVE(a,b,c,d)
 #define DISPOSE(a,b)
 #define STORE(a,b,c,d,e,f,g,h,i)
-#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
+#define EXISTS(a,b,c,d) (ast_fileexists(c, NULL, d) > 0)
 #define RENAME(a,b,c,d,e,f,g,h) (rename_file(g,h));
 #define COPY(a,b,c,d,e,f,g,h) (copy_file(g,h));
 #define DELETE(a,b,c) (vm_delete(c))
@@ -654,7 +654,7 @@
 static char emaildateformat[32] = "%A, %B %d, %Y at %r";
 
 /* Forward declarations - generic */
-static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box);
+static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);
 static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int msg, int option, signed char record_gain);
 static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, char *outgoing_context);
 static int play_record_review(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime,
@@ -711,31 +711,31 @@
 #endif
 	} else if (!strcasecmp(var, "delete") || !strcasecmp(var, "deletevoicemail")) {
 		ast_set2_flag(vmu, ast_true(value), VM_DELETE);	
-	} else if (!strcasecmp(var, "saycid")){
+	} else if (!strcasecmp(var, "saycid")) {
 		ast_set2_flag(vmu, ast_true(value), VM_SAYCID);	
-	} else if (!strcasecmp(var,"sendvoicemail")){
+	} else if (!strcasecmp(var, "sendvoicemail")) {
 		ast_set2_flag(vmu, ast_true(value), VM_SVMAIL);	
-	} else if (!strcasecmp(var, "review")){
+	} else if (!strcasecmp(var, "review")) {
 		ast_set2_flag(vmu, ast_true(value), VM_REVIEW);
-	} else if (!strcasecmp(var, "tempgreetwarn")){
+	} else if (!strcasecmp(var, "tempgreetwarn")) {
 		ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN);	
-	} else if (!strcasecmp(var, "operator")){
+	} else if (!strcasecmp(var, "operator")) {
 		ast_set2_flag(vmu, ast_true(value), VM_OPERATOR);	
-	} else if (!strcasecmp(var, "envelope")){
+	} else if (!strcasecmp(var, "envelope")) {
 		ast_set2_flag(vmu, ast_true(value), VM_ENVELOPE);	
-	} else if (!strcasecmp(var, "moveheard")){
+	} else if (!strcasecmp(var, "moveheard")) {
 		ast_set2_flag(vmu, ast_true(value), VM_MOVEHEARD);
-	} else if (!strcasecmp(var, "sayduration")){
+	} else if (!strcasecmp(var, "sayduration")) {
 		ast_set2_flag(vmu, ast_true(value), VM_SAYDURATION);	
-	} else if (!strcasecmp(var, "saydurationm")){
+	} else if (!strcasecmp(var, "saydurationm")) {
 		if (sscanf(value, "%d", &x) == 1) {
 			vmu->saydurationm = x;
 		} else {
 			ast_log(LOG_WARNING, "Invalid min duration for say duration\n");
 		}
-	} else if (!strcasecmp(var, "forcename")){
+	} else if (!strcasecmp(var, "forcename")) {
 		ast_set2_flag(vmu, ast_true(value), VM_FORCENAME);	
-	} else if (!strcasecmp(var, "forcegreetings")){
+	} else if (!strcasecmp(var, "forcegreetings")) {
 		ast_set2_flag(vmu, ast_true(value), VM_FORCEGREET);	
 	} else if (!strcasecmp(var, "callback")) {
 		ast_copy_string(vmu->callback, value, sizeof(vmu->callback));
@@ -892,7 +892,7 @@
 static struct ast_vm_user *find_user(struct ast_vm_user *ivm, const char *context, const char *mailbox)
 {
 	/* This function could be made to generate one from a database, too */
-	struct ast_vm_user *vmu=NULL, *cur;
+	struct ast_vm_user *vmu = NULL, *cur;
 	AST_LIST_LOCK(&users);
 
 	if (!context && !ast_test_flag((&globalflags), VM_SEARCH))
@@ -938,11 +938,11 @@
 
 static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
 {
-	struct ast_config   *cfg=NULL;
-	struct ast_variable *var=NULL;
-	struct ast_category *cat=NULL;
-	char *category=NULL, *value=NULL, *new=NULL;
-	const char *tmp=NULL;
+	struct ast_config *cfg = NULL;
+	struct ast_variable *var = NULL;
+	struct ast_category *cat = NULL;
+	char *category = NULL, *value = NULL, *new = NULL;
+	const char *tmp = NULL;
 	struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
 	if (!change_password_realtime(vmu, newpassword))
 		return;
@@ -955,13 +955,13 @@
 					ast_log(LOG_WARNING, "We could not find the mailbox.\n");
 					break;
 				}
-				value = strstr(tmp,",");
+				value = strstr(tmp, ",");
 				if (!value) {
 					ast_log(LOG_WARNING, "variable has bad format.\n");
 					break;
 				}
-				new = alloca((strlen(value)+strlen(newpassword)+1));
-				sprintf(new,"%s%s", newpassword, value);
+				new = alloca(strlen(value) + strlen(newpassword) + 1);
+				sprintf(new, "%s%s", newpassword, value);
 				if (!(cat = ast_category_get(cfg, category))) {
 					ast_log(LOG_WARNING, "Failed to get category structure.\n");
 					break;
@@ -987,7 +987,7 @@
 					ast_debug(3, "looks like we need to make vmsecret!\n");
 					var = ast_variable_new("vmsecret", newpassword, "");
 				} 
-				new = alloca(strlen(newpassword)+1);
+				new = alloca(strlen(newpassword) + 1);
 				sprintf(new, "%s", newpassword);
 				if (!(cat = ast_category_get(cfg, category))) {
 					ast_debug(4, "failed to get category!\n");
@@ -1009,9 +1009,12 @@
 static void vm_change_password_shell(struct ast_vm_user *vmu, char *newpassword)
 {
 	char buf[255];
-	snprintf(buf,255,"%s %s %s %s",ext_pass_cmd,vmu->context,vmu->mailbox,newpassword);
-	if (!ast_safe_system(buf))
+	snprintf(buf, sizeof(buf), "%s %s %s %s", ext_pass_cmd, vmu->context, vmu->mailbox, newpassword);
+	if (!ast_safe_system(buf)) {
 		ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
+		/* Reset the password in memory, too */
+		reset_user_pw(vmu->context, vmu->mailbox, newpassword);
+	}
 }
 
 static int make_dir(char *dest, int len, const char *context, const char *ext, const char *folder)
@@ -1040,13 +1043,13 @@
 
 	messageNum = vms->msgArray[msgnum];
 	if (messageNum == 0) {
-		ast_log(LOG_WARNING, "msgnum %d, mailbox message %lu is zero.\n",msgnum,messageNum);
+		ast_log(LOG_WARNING, "msgnum %d, mailbox message %lu is zero.\n", msgnum, messageNum);
 		return;
 	}
-	ast_debug(3, "deleting msgnum %d, which is mailbox message %lu\n",msgnum,messageNum);
+	ast_debug(3, "deleting msgnum %d, which is mailbox message %lu\n", msgnum, messageNum);
 	/* delete message */
-	snprintf (arg, sizeof(arg), "%lu",messageNum);
-	mail_setflag (vms->mailstream,arg,"\\DELETED");
+	snprintf(arg, sizeof(arg), "%lu", messageNum);
+	mail_setflag(vms->mailstream, arg, "\\DELETED");
 }
 
 #endif
@@ -1125,13 +1128,13 @@
 {
 	int x = 0;
 	int res;
-	int fd=-1;
+	int fd = -1;
 	size_t fdlen = 0;
 	void *fdm = MAP_FAILED;
-	SQLSMALLINT colcount=0;
+	SQLSMALLINT colcount = 0;
 	SQLHSTMT stmt;
 	char sql[PATH_MAX];
-	char fmt[80]="";
+	char fmt[80] = "";
 	char *c;
 	char coltitle[256];
 	SQLSMALLINT collen;
@@ -1140,7 +1143,7 @@
 	SQLSMALLINT nullable;
 	SQLULEN colsize;
 	SQLLEN colsize2;
-	FILE *f=NULL;
+	FILE *f = NULL;
 	char rowdata[80];
 	char fn[PATH_MAX];
 	char full_fn[PATH_MAX];
@@ -1157,7 +1160,7 @@
 			*c = '\0';
 		if (!strcasecmp(fmt, "wav49"))
 			strcpy(fmt, "WAV");
-		snprintf(msgnums, sizeof(msgnums),"%d", msgnum);
+		snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
 		if (msgnum > -1)
 			make_file(fn, sizeof(fn), dir, msgnum);
 		else
@@ -1170,7 +1173,7 @@
 		}
 		
 		snprintf(full_fn, sizeof(full_fn), "%s.%s", fn, fmt);
-		snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE dir=? AND msgnum=?",odbc_table);
+		snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE dir=? AND msgnum=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt) {
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1205,7 +1208,7 @@
 		}
 		if (f) 
 			fprintf(f, "[message]\n");
-		for (x=0;x<colcount;x++) {
+		for (x = 0; x < colcount; x++) {
 			rowdata[0] = '\0';
 			collen = sizeof(coltitle);
 			res = SQLDescribeCol(stmt, x + 1, (unsigned char *)coltitle, sizeof(coltitle), &collen, 
@@ -1221,7 +1224,7 @@
 				res = SQLGetData(stmt, x + 1, SQL_BINARY, rowdata, 0, &colsize2);
 				fdlen = colsize2;
 				if (fd > -1) {
-					char tmp[1]="";
+					char tmp[1] = "";
 					lseek(fd, fdlen - 1, SEEK_SET);
 					if (write(fd, tmp, 1) != 1) {
 						close(fd);
@@ -1306,7 +1309,7 @@
 	struct odbc_obj *obj;
 	obj = ast_odbc_request_obj(odbc_database, 0);
 	if (obj) {
-		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=?",odbc_table);
+		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt) {
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1352,7 +1355,7 @@
 	obj = ast_odbc_request_obj(odbc_database, 0);
 	if (obj) {
 		snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
-		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=? AND msgnum=?",odbc_table);
+		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=? AND msgnum=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt) {
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1400,7 +1403,7 @@
 	obj = ast_odbc_request_obj(odbc_database, 0);
 	if (obj) {
 		snprintf(msgnums, sizeof(msgnums), "%d", smsg);
-		snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE dir=? AND msgnum=?",odbc_table);
+		snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE dir=? AND msgnum=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt)
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1427,7 +1430,7 @@
 	if (obj) {
 		snprintf(msgnums, sizeof(msgnums), "%d", smsg);
 		snprintf(msgnumd, sizeof(msgnumd), "%d", dmsg);
-		snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording, mailboxuser, mailboxcontext) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording,?,? FROM %s WHERE dir=? AND msgnum=?",odbc_table,odbc_table);
+		snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording, mailboxuser, mailboxcontext) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording,?,? FROM %s WHERE dir=? AND msgnum=?", odbc_table, odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt)
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s] (You probably don't have MySQL 4.1 or later installed)\n\n", sql);
@@ -1452,11 +1455,11 @@
 	char msgnums[20];
 	char fn[PATH_MAX];
 	char full_fn[PATH_MAX];
-	char fmt[80]="";
+	char fmt[80] = "";
 	char *c;
-	const char *context="", *macrocontext="", *callerid="", *origtime="", *duration="";
+	const char *context = "", *macrocontext = "", *callerid = "", *origtime = "", *duration = "";
 	const char *category = "";
-	struct ast_config *cfg=NULL;
+	struct ast_config *cfg = NULL;
 	struct odbc_obj *obj;
 	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
 
@@ -1469,7 +1472,7 @@
 			*c = '\0';
 		if (!strcasecmp(fmt, "wav49"))
 			strcpy(fmt, "WAV");
-		snprintf(msgnums, sizeof(msgnums),"%d", msgnum);
+		snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
 		if (msgnum > -1)
 			make_file(fn, sizeof(fn), dir, msgnum);
 		else
@@ -1500,7 +1503,7 @@
 		fdlen = lseek(fd, 0, SEEK_END);
 		lseek(fd, 0, SEEK_SET);
 		printf("Length is %zd\n", fdlen);
-		fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED,fd, 0);
+		fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
 		if (fdm == MAP_FAILED) {
 			ast_log(LOG_WARNING, "Memory map failed!\n");
 			ast_odbc_release_obj(obj);
@@ -1513,9 +1516,9 @@
 			goto yuck;
 		}
 		if (!ast_strlen_zero(category)) 
-			snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)",odbc_table); 
+			snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)", odbc_table);
 		else
-			snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)",odbc_table);
+			snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)", odbc_table);
 		res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
 		if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
 			ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
@@ -1572,7 +1575,7 @@
 	if (obj) {
 		snprintf(msgnums, sizeof(msgnums), "%d", smsg);
 		snprintf(msgnumd, sizeof(msgnumd), "%d", dmsg);
-		snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=?",odbc_table);
+		snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt)
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1613,7 +1616,7 @@
 {
 	char stxt[PATH_MAX];
 	char dtxt[PATH_MAX];
-	ast_filerename(sfn,dfn,NULL);
+	ast_filerename(sfn, dfn, NULL);
 	snprintf(stxt, sizeof(stxt), "%s.txt", sfn);
 	snprintf(dtxt, sizeof(dtxt), "%s.txt", dfn);
 	if (ast_check_realtime("voicemail_data")) {
@@ -1675,7 +1678,7 @@
 static void copy_file(char *frompath, char *topath)
 {
 	char frompath2[PATH_MAX], topath2[PATH_MAX];
-	struct ast_variable *tmp,*var = NULL;
+	struct ast_variable *tmp, *var = NULL;
 	const char *origmailbox = NULL, *context = NULL, *macrocontext = NULL, *exten = NULL, *priority = NULL, *callerchan = NULL, *callerid = NULL, *origdate = NULL, *origtime = NULL, *category = NULL, *duration = NULL;
 	ast_filecopy(frompath, topath, NULL);
 	snprintf(frompath2, sizeof(frompath2), "%s.txt", frompath);
@@ -1752,7 +1755,7 @@
 	char *txt;
 	int txtsize = 0;
 
-	txtsize = (strlen(file) + 5)*sizeof(char);
+	txtsize = (strlen(file) + 5) * sizeof(char);
 	txt = alloca(txtsize);
 	/* Sprintf here would safe because we alloca'd exactly the right length,
 	 * but trying to eliminate all sprintf's anyhow
@@ -1773,7 +1776,7 @@
 	if (bio->ateof)
 		return 0;
 
-	if ((l = fread(bio->iobuf,1,BASEMAXINLINE,fi)) <= 0) {
+	if ((l = fread(bio->iobuf, 1, BASEMAXINLINE, fi)) <= 0) {
 		if (ferror(fi))
 			return -1;
 
@@ -1781,15 +1784,15 @@
 		return 0;
 	}
 
-	bio->iolen= l;
-	bio->iocp= 0;
+	bio->iolen = l;
+	bio->iocp = 0;
 
 	return 1;
 }
 
 static int inchar(struct baseio *bio, FILE *fi)
 {
-	if (bio->iocp>=bio->iolen) {
+	if (bio->iocp >= bio->iolen) {
 		if (!inbuf(bio, fi))
 			return EOF;
 	}
@@ -1800,13 +1803,13 @@
 static int ochar(struct baseio *bio, int c, FILE *so)
 {
 	if (bio->linelength >= BASELINELEN) {
-		if (fputs(eol,so) == EOF)
+		if (fputs(eol, so) == EOF)
 			return -1;
 
 		bio->linelength= 0;
 	}
 
-	if (putc(((unsigned char)c),so) == EOF)
+	if (putc(((unsigned char)c), so) == EOF)
 		return -1;
 
 	bio->linelength++;
@@ -1820,7 +1823,7 @@
 		'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
 		'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0',
 		'1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
-	int i,hiteof= 0;
+	int i, hiteof = 0;
 	FILE *fi;
 	struct baseio bio;
 
@@ -1832,42 +1835,42 @@
 		return -1;
 	}
 
-	while (!hiteof){
+	while (!hiteof) {
 		unsigned char igroup[3], ogroup[4];
-		int c,n;
-
-		igroup[0]= igroup[1]= igroup[2]= 0;
-
-		for (n= 0;n<3;n++) {
+		int c, n;
+
+		igroup[0] = igroup[1] = igroup[2] = 0;
+
+		for (n = 0; n < 3; n++) {
 			if ((c = inchar(&bio, fi)) == EOF) {
-				hiteof= 1;
+				hiteof = 1;
 				break;
 			}
 
-			igroup[n]= (unsigned char)c;
-		}
-
-		if (n> 0) {
-			ogroup[0]= dtable[igroup[0]>>2];
-			ogroup[1]= dtable[((igroup[0]&3)<<4) | (igroup[1]>>4)];
-			ogroup[2]= dtable[((igroup[1]&0xF)<<2) | (igroup[2]>>6)];
-			ogroup[3]= dtable[igroup[2]&0x3F];
-
-			if (n<3) {
-				ogroup[3]= '=';
-
-				if (n<2)
-					ogroup[2]= '=';
-			}
-
-			for (i= 0;i<4;i++)
+			igroup[n] = (unsigned char)c;
+		}
+
+		if (n > 0) {
+			ogroup[0] = dtable[igroup[0] >> 2];
+			ogroup[1] = dtable[((igroup[0] & 3) << 4) | (igroup[1] >> 4)];
+			ogroup[2] = dtable[((igroup[1] & 0xF) << 2) | (igroup[2] >> 6)];
+			ogroup[3] = dtable[igroup[2] & 0x3F];
+
+			if (n < 3) {
+				ogroup[3] = '=';
+
+				if (n < 2)
+					ogroup[2] = '=';
+			}
+
+			for (i = 0; i < 4; i++)
 				ochar(&bio, ogroup[i], so);
 		}
 	}
 
 	fclose(fi);
 	
-	if (fputs(eol,so)==EOF)
+	if (fputs(eol, so) == EOF)
 		return 0;
 
 	return 1;
@@ -1966,7 +1969,7 @@
 #define ENDL "\n"
 #endif
 
-	gethostname(host, sizeof(host)-1);
+	gethostname(host, sizeof(host) - 1);
 
 	if (strchr(srcemail, '@'))
 		ast_copy_string(who, srcemail, sizeof(who));
@@ -1988,7 +1991,7 @@
 		struct ast_channel *ast;
 		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
 			char *passdata;
-			int vmlen = strlen(fromstring)*3 + 200;
+			int vmlen = strlen(fromstring) * 3 + 200;
 			passdata = alloca(vmlen);
 			memset(passdata, 0, vmlen);
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
@@ -2061,7 +2064,7 @@
 		struct ast_channel *ast;
 		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
 			char *passdata;
-			int vmlen = strlen(emailbody)*3 + 200;
+			int vmlen = strlen(emailbody) * 3 + 200;
 			passdata = alloca(vmlen);
 			memset(passdata, 0, vmlen);
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
@@ -2070,7 +2073,7 @@
 			ast_channel_free(ast);
 		} else
 			ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
-	} else if (msgnum > -1){
+	} else if (msgnum > -1) {
 		fprintf(p, "Dear %s:" ENDL ENDL "\tJust wanted to let you know you were just left a %s long message (number %d)" ENDL
 
 		"in mailbox %s from %s, on %s so you might" ENDL
@@ -2124,7 +2127,7 @@
 
 static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, char *cidnum, char *cidname, char *attach, char *format, int duration, int attach_user_voicemail, struct ast_channel *chan, const char *category)
 {
-	FILE *p=NULL;
+	FILE *p = NULL;
 	char tmp[80] = "/tmp/astmail-XXXXXX";
 	char tmp2[256];
 
@@ -2165,7 +2168,7 @@
 		ast_log(LOG_WARNING, "Unable to launch '%s' (can't create temporary file)\n", mailcmd);
 		return -1;
 	}
-	gethostname(host, sizeof(host)-1);
+	gethostname(host, sizeof(host) - 1);
 	if (strchr(srcemail, '@'))
 		ast_copy_string(who, srcemail, sizeof(who));
 	else 
@@ -2178,7 +2181,7 @@
 		struct ast_channel *ast;
 		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
 			char *passdata;
-			int vmlen = strlen(fromstring)*3 + 200;
+			int vmlen = strlen(fromstring) * 3 + 200;
 			passdata = alloca(vmlen);
 			memset(passdata, 0, vmlen);
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
@@ -2307,7 +2310,7 @@
 		"Cust5",
 		"Deleted",
 	};
-	return (id >= 0 && id < (sizeof(msgs)/sizeof(msgs[0]))) ? msgs[id] : "Unknown";
+	return (id >= 0 && id < (sizeof(msgs) / sizeof(msgs[0]))) ? msgs[id] : "Unknown";
 }
 #ifdef IMAP_STORAGE
 static int folder_int(const char *folder)
@@ -2504,7 +2507,7 @@
 	char fn[PATH_MAX];
 	char mailbox[256];
 	char *stringp;
-	FILE *p=NULL;
+	FILE *p = NULL;
 	char tmp[80] = "/tmp/astmail-XXXXXX";
 	long len;
 	void *buf;
@@ -2555,8 +2558,8 @@
 	/* read mail file to memory */		
 	len = ftell(p);
 	rewind(p);
-	if (!(buf = ast_malloc(len+1))) {
-		ast_log(LOG_ERROR, "Can't allocate %ld bytes to read message\n", len+1);
+	if (!(buf = ast_malloc(len + 1))) {
+		ast_log(LOG_ERROR, "Can't allocate %ld bytes to read message\n", len + 1);
 		fclose(p);
 		if (tempcopy)
 			*(vmu->email) = '\0';
@@ -2595,30 +2598,30 @@
 		return 0;
 
 	/* 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); */
+	/* ast_log(LOG_DEBUG, "Before find_user, context is %s and mailbox is %s\n", context, mailbox); */
 	vmu = find_user(&vmus, context, mailbox);
 	if (!vmu) {
-		ast_log (LOG_ERROR,"Couldn't find mailbox %s in context %s\n",mailbox,context);
+		ast_log(LOG_ERROR, "Couldn't find mailbox %s in context %s\n", mailbox, context);
 		return -1;
 	} else {
 		/* No IMAP account available */
 		if (vmu->imapuser[0] == '\0') {
-			ast_log (LOG_WARNING,"IMAP user not set for mailbox %s\n",vmu->mailbox);
+			ast_log(LOG_WARNING, "IMAP user not set for mailbox %s\n", vmu->mailbox);
 			return -1;
 		}
 	}
 	
 	/* No IMAP account available */
 	if (vmu->imapuser[0] == '\0') {
-		ast_log (LOG_WARNING,"IMAP user not set for mailbox %s\n",vmu->mailbox);
+		ast_log(LOG_WARNING, "IMAP user not set for mailbox %s\n", vmu->mailbox);
 		free_user(vmu);
 		return -1;
  	}
 
 	/* check if someone is accessing this box right now... */
-	vms_p = get_vm_state_by_imapuser(vmu->imapuser,1);
+	vms_p = get_vm_state_by_imapuser(vmu->imapuser, 1);
 	if (!vms_p) {
-		vms_p = get_vm_state_by_mailbox(mailbox,1);
+		vms_p = get_vm_state_by_mailbox(mailbox, 1);
 	}
 	if (vms_p) {
 		ast_debug(3, "Returning before search - user is logged in\n");
@@ -2631,20 +2634,20 @@
 	}
 
 	/* add one if not there... */
-	vms_p = get_vm_state_by_imapuser(vmu->imapuser,0);
+	vms_p = get_vm_state_by_imapuser(vmu->imapuser, 0);
 	if (!vms_p) {
-		vms_p = get_vm_state_by_mailbox(mailbox,0);
+		vms_p = get_vm_state_by_mailbox(mailbox, 0);
 	}
 
 	if (!vms_p) {
-		ast_debug(3,"Adding new vmstate for %s\n",vmu->imapuser);
+		ast_debug(3, "Adding new vmstate for %s\n", vmu->imapuser);
 		if (!(vms_p = ast_calloc(1, sizeof(*vms_p)))) {
 			return -1;
 		}
-		ast_copy_string(vms_p->imapuser,vmu->imapuser, sizeof(vms_p->imapuser));
+		ast_copy_string(vms_p->imapuser, vmu->imapuser, sizeof(vms_p->imapuser));
 		ast_copy_string(vms_p->username, mailbox, sizeof(vms_p->username)); /* save for access from interactive entry point */
 		vms_p->mailstream = NIL; /* save for access from interactive entry point */
-		ast_debug(3, "Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
+		ast_debug(3, "Copied %s to %s\n", vmu->imapuser, vms_p->imapuser);
 		vms_p->updated = 1;
 		/* set mailbox to INBOX! */
 		ast_copy_string(vms_p->curbox, mbox(fold), sizeof(vms_p->curbox));
@@ -2653,7 +2656,7 @@
 	}
 	ret = init_mailstream(vms_p, fold);
 	if (!vms_p->mailstream) {
-		ast_log (LOG_ERROR,"Houston we have a problem - IMAP mailstream is NULL\n");
+		ast_log(LOG_ERROR, "Houston we have a problem - IMAP mailstream is NULL\n");
 		return -1;
 	}
 	if (ret == 0) {
@@ -2701,7 +2704,7 @@
 	if (oldmsgs)
 		*oldmsgs = 0;
 
-	ast_debug(3,"Mailbox is set to %s\n",mailbox_context);
+	ast_debug(3, "Mailbox is set to %s\n", mailbox_context);
 	/* If no mailbox, return immediately */
 	if (ast_strlen_zero(mailbox_context))
 		return 0;
@@ -3196,10 +3199,10 @@
 		/* must open stream for this user to get info! */
 		res = inboxcount(ext_context, &newmsgs, &oldmsgs);
 		if (res < 0) {
-			ast_log(LOG_NOTICE,"Can not leave voicemail, unable to count messages\n");
+			ast_log(LOG_NOTICE, "Can not leave voicemail, unable to count messages\n");
 			return -1;
 		}
-		if (!(vms = get_vm_state_by_mailbox(ext,0))) {
+		if (!(vms = get_vm_state_by_mailbox(ext, 0))) {
 		/*It is possible under certain circumstances that inboxcount did not create a vm_state when it was needed. This is a catchall which will
 		 * rarely be used*/
 			if (!(vms = ast_calloc(1, sizeof(*vms)))) {
@@ -3210,17 +3213,17 @@
 			ast_copy_string(vms->username, ext, sizeof(vms->username));
 			vms->mailstream = NIL;
 			ast_debug(3, "Copied %s to %s\n", vmu->imapuser, vms->imapuser);
-			vms->updated=1;
+			vms->updated = 1;
 			ast_copy_string(vms->curbox, mbox(0), sizeof(vms->curbox));
 			init_vm_state(vms);
 			vmstate_insert(vms);
-			vms = get_vm_state_by_mailbox(ext,0);
+			vms = get_vm_state_by_mailbox(ext, 0);
 		}
 		vms->newmessages++;
 		
 		/* here is a big difference! We add one to it later */
 		msgnum = newmsgs + oldmsgs;
-		ast_debug(3, "Messagecount set to %d\n",msgnum);
+		ast_debug(3, "Messagecount set to %d\n", msgnum);
 		snprintf(fn, sizeof(fn), "%s/imap/msg%s%04d", VM_SPOOL_DIR, vmu->mailbox, msgnum);
 		/* set variable for compatibility */
 		pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", "IMAP_STORAGE");
@@ -3317,7 +3320,7 @@
 			if (duration < vmminsecs) {
 				fclose(txt);
 				if (option_verbose > 2) 
-					ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminsecs);
+					ast_verbose(VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminsecs);
 				ast_filedelete(tmptxtfile, NULL);
 				unlink(tmptxtfile);
 				if (ast_check_realtime("voicemail_data")) {
@@ -3422,7 +3425,7 @@
 {
 	/* we know max messages, so stop process when number is hit */
 
-	int x,dest;
+	int x, dest;
 	char sfn[PATH_MAX];
 	char dfn[PATH_MAX];
 
@@ -3466,8 +3469,8 @@
 	if (box == 1) return 10;
 	/* get the real IMAP message number for this message */
 	snprintf(sequence, sizeof(sequence), "%ld", vms->msgArray[msg]);
-	ast_debug(3, "Copying sequence %s to mailbox %s\n",sequence,mbox(box));
-	res = mail_copy(vms->mailstream,sequence,(char *) mbox(box));
+	ast_debug(3, "Copying sequence %s to mailbox %s\n", sequence, mbox(box));
+	res = mail_copy(vms->mailstream, sequence, (char *)mbox(box));
 	if (res == 1) return 0;
 	return 1;
 #else
@@ -3524,7 +3527,7 @@
 static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	int x;
 	char num[5];
 
@@ -3599,7 +3602,7 @@
 #endif
 
 	bytes = 0;
-	for (x=0;x<5;x++) {
+	for (x = 0; x < 5; x++) {
 		snprintf(num, sizeof(num), "%d", x);
 		bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 12 + x, mbox(x), mbox(x), num, 1);
 	}
@@ -3670,13 +3673,13 @@
 static void adsi_login(struct ast_channel *chan)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
 	int x;
 	if (!ast_adsi_available(chan))
 		return;
 
-	for (x=0;x<8;x++)
+	for (x = 0; x < 8; x++)
 		keys[x] = 0;
 	/* Set one key for next */
 	keys[3] = ADSI_KEY_APPS + 3;
@@ -3696,13 +3699,13 @@
 static void adsi_password(struct ast_channel *chan)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
 	int x;
 	if (!ast_adsi_available(chan))
 		return;
 
-	for (x=0;x<8;x++)
+	for (x = 0; x < 8; x++)
 		keys[x] = 0;
 	/* Set one key for next */
 	keys[3] = ADSI_KEY_APPS + 3;
@@ -3718,14 +3721,14 @@
 static void adsi_folders(struct ast_channel *chan, int start, char *label)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
-	int x,y;
+	int x, y;
 
 	if (!ast_adsi_available(chan))
 		return;
 
-	for (x=0;x<5;x++) {
+	for (x = 0; x < 5; x++) {
 		y = ADSI_KEY_APPS + 12 + start + x;
 		if (y > ADSI_KEY_APPS + 12 + 4)
 			y = 0;
@@ -3746,15 +3749,15 @@
 
 static void adsi_message(struct ast_channel *chan, struct vm_state *vms)
 {
-	int bytes=0;
+	int bytes = 0;
 	unsigned char buf[256]; 
 	char buf1[256], buf2[256];
 	char fn2[PATH_MAX];
 
-	char cid[256]="";
+	char cid[256] = "";
 	char *val;
 	char *name, *num;
-	char datetime[21]="";
+	char datetime[21] = "";
 	FILE *f;
 
 	unsigned char keys[8];
@@ -3771,7 +3774,7 @@
 		while (!feof(f)) {	
 			fgets((char *)buf, sizeof(buf), f);
 			if (!feof(f)) {
-				char *stringp=NULL;
+				char *stringp = NULL;
 				stringp = (char *)buf;
 				strsep(&stringp, "=");
 				val = strsep(&stringp, "=");
@@ -3786,7 +3789,7 @@
 		fclose(f);
 	}
 	/* New meaning for keys */
-	for (x=0;x<5;x++)
+	for (x = 0; x < 5; x++)
 		keys[x] = ADSI_KEY_SKT | (ADSI_KEY_APPS + 6 + x);
 	keys[6] = 0x0;
 	keys[7] = 0x0;
@@ -3839,7 +3842,7 @@
 
 static void adsi_delete(struct ast_channel *chan, struct vm_state *vms)
 {
-	int bytes=0;
+	int bytes = 0;
 	unsigned char buf[256];
 	unsigned char keys[8];
 
@@ -3849,7 +3852,7 @@
 		return;
 
 	/* New meaning for keys */
-	for (x=0;x<5;x++)
+	for (x = 0; x < 5; x++)
 		keys[x] = ADSI_KEY_SKT | (ADSI_KEY_APPS + 6 + x);
 
 	keys[6] = 0x0;
@@ -3886,7 +3889,7 @@
 {
 	unsigned char buf[256] = "";
 	char buf1[256] = "", buf2[256] = "";
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
 	int x;
 
@@ -3914,7 +3917,7 @@
 	bytes += ast_adsi_display(buf + bytes, ADSI_COMM_PAGE, 2, ADSI_JUST_LEFT, 0, buf2, "");
 	bytes += ast_adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1);
 
-	for (x=0;x<6;x++)
+	for (x = 0; x < 6; x++)
 		keys[x] = ADSI_KEY_SKT | (ADSI_KEY_APPS + x);
 	keys[6] = 0;
 	keys[7] = 0;
@@ -3933,7 +3936,7 @@
 {
 	unsigned char buf[256] = "";
 	char buf1[256] = "", buf2[256] = "";
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
 	int x;
 
@@ -3943,7 +3946,7 @@
 		return;
 
 	/* Original command keys */
-	for (x=0;x<6;x++)
+	for (x = 0; x < 6; x++)
 		keys[x] = ADSI_KEY_SKT | (ADSI_KEY_APPS + x);
 
 	keys[6] = 0;
@@ -3975,7 +3978,7 @@
 static void adsi_clear(struct ast_channel *chan)
 {
 	char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	if (!ast_adsi_available(chan))
 		return;
 	bytes += ast_adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1);
@@ -3988,7 +3991,7 @@
 static void adsi_goodbye(struct ast_channel *chan)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 
 	if (!ast_adsi_available(chan))
 		return;
@@ -4013,7 +4016,7 @@
 	d = ast_play_and_wait(chan, "vm-press");	/* "Press" */
 	if (d)
 		return d;
-	for (x = start; x< 5; x++) {	/* For all folders */
+	for (x = start; x < 5; x++) {	/* For all folders */
 		if ((d = ast_say_number(chan, x, AST_DIGIT_ANY, chan->language, NULL)))
 			return d;
 		d = ast_play_and_wait(chan, "vm-for");	/* "for" */
@@ -4095,7 +4098,7 @@
 
 				*duration += prepend_duration;
 				msg_cat = ast_category_get(msg_cfg, "message");
-				snprintf(duration_str, 11, "%ld", *duration);
+				snprintf(duration_str, sizeof(duration_str), "%ld", *duration);
 				if (!ast_variable_update(msg_cat, "duration", duration_str, NULL, 0)) {
 					config_text_file_save(textfile, msg_cfg, "app_voicemail");
 					STORE(curdir, vmu->mailbox, context, curmsg, chan, vmu, vmfmts, *duration, vms);
@@ -4113,13 +4116,13 @@
 			cmd = '*';
 			break;
 		default: 
-			cmd = ast_play_and_wait(chan,"vm-forwardoptions");

[... 2111 lines stripped ...]



More information about the svn-commits mailing list