[asterisk-commits] branch oej/siptransfer r17992 - in /team/oej/siptransfer: ./ apps/ channels/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Apr 6 12:46:59 MST 2006


Author: oej
Date: Thu Apr  6 14:46:42 2006
New Revision: 17992

URL: http://svn.digium.com/view/asterisk?rev=17992&view=rev
Log:
Update to trunk, resolve conflict

Modified:
    team/oej/siptransfer/   (props changed)
    team/oej/siptransfer/Makefile
    team/oej/siptransfer/apps/app_cdr.c
    team/oej/siptransfer/apps/app_dial.c
    team/oej/siptransfer/apps/app_directed_pickup.c
    team/oej/siptransfer/apps/app_record.c
    team/oej/siptransfer/cdr.c
    team/oej/siptransfer/channel.c
    team/oej/siptransfer/channels/chan_sip.c
    team/oej/siptransfer/channels/chan_skinny.c
    team/oej/siptransfer/config.c
    team/oej/siptransfer/configs/extensions.conf.sample
    team/oej/siptransfer/configs/iax.conf.sample
    team/oej/siptransfer/configs/meetme.conf.sample
    team/oej/siptransfer/configs/mgcp.conf.sample
    team/oej/siptransfer/configs/queues.conf.sample
    team/oej/siptransfer/configs/sip.conf.sample
    team/oej/siptransfer/configs/skinny.conf.sample
    team/oej/siptransfer/configs/voicemail.conf.sample
    team/oej/siptransfer/file.c
    team/oej/siptransfer/formats/Makefile
    team/oej/siptransfer/http.c
    team/oej/siptransfer/include/asterisk/module.h
    team/oej/siptransfer/loader.c
    team/oej/siptransfer/pbx.c
    team/oej/siptransfer/pbx/pbx_config.c
    team/oej/siptransfer/res/res_agi.c
    team/oej/siptransfer/res/res_monitor.c
    team/oej/siptransfer/sched.c

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

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

Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Apr  6 14:46:42 2006
@@ -1,1 +1,1 @@
-/trunk:1-17742
+/trunk:1-17987

Modified: team/oej/siptransfer/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/Makefile?rev=17992&r1=17991&r2=17992&view=diff
==============================================================================
--- team/oej/siptransfer/Makefile (original)
+++ team/oej/siptransfer/Makefile Thu Apr  6 14:46:42 2006
@@ -15,23 +15,33 @@
 
 # Create OPTIONS variable
 OPTIONS=
+
 # If cross compiling, define these to suit
-# CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
-# CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
-# CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
+#CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
+#CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
+#CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
+#CROSS_ARCH=Linux
+#CROSS_PROC=arm
+#SUB_PROC=xscale # or maverick
+
+# Pentium Pro Optimize
+#PROC=i686
+
+# Pentium & VIA processors optimize
+#PROC=i586
+
+#PROC=k6
+#PROC=ppc
+
 CC=$(CROSS_COMPILE)gcc
 HOST_CC=gcc
-# CROSS_ARCH=Linux
-# CROSS_PROC=arm
-# SUB_PROC=xscale # or maverick
 
 ifeq ($(CROSS_COMPILE),)
   OSARCH=$(shell uname -s)
-  OSREV=$(shell uname -r)
-  MARCH=$(shell uname -m)
+  PROC?=$(shell uname -m)
 else
   OSARCH=$(CROSS_ARCH)
-  OSREV=$(CROSS_REV)
+  PROC=$(CROSS_PROC)
 endif
 
 PWD=$(shell pwd)
@@ -40,13 +50,13 @@
 MAKETOPLEVEL?=$(MAKELEVEL)
 
 ifneq ($(findstring dont-optimize,$(MAKECMDGOALS)),dont-optimize)
-######### More GSM codec optimization
-######### Uncomment to enable MMXTM optimizations for x86 architecture CPU's
-######### which support MMX instructions.  This should be newer pentiums,
-######### ppro's, etc, as well as the AMD K6 and K7.  
+# More GSM codec optimization
+# Uncomment to enable MMXTM optimizations for x86 architecture CPU's
+# which support MMX instructions.  This should be newer pentiums,
+# ppro's, etc, as well as the AMD K6 and K7.  
 #K6OPT  = -DK6OPT
 
-#Tell gcc to optimize the code
+# Tell gcc to optimize the code
 OPTIMIZE+=-O6
 else
   # Stack backtraces, while useful for debugging, are incompatible with optimizations
@@ -55,14 +65,13 @@
   endif
 endif
 
-#Overwite config files on "make samples"
+# Overwite config files on "make samples"
 OVERWRITE=y
 
-#Include debug and macro symbols in the executables (-g) and profiling info (-pg)
+# Include debug and macro symbols in the executables (-g) and profiling info (-pg)
 DEBUG=-g3 #-pg
 
-#Set NOCRYPTO to yes if you do not want to have crypto support or 
-#dependencies
+# Set NOCRYPTO to yes if you do not want to have crypto support or dependencies
 #NOCRYPTO=yes
 
 # If you are running a radio application, define RADIO_RELAX so that the DTMF
@@ -71,14 +80,11 @@
 
 # If you don't have a lot of memory (e.g. embedded Asterisk), define LOW_MEMORY
 # to reduce the size of certain static buffers
-
 #ifneq ($(CROSS_COMPILE),)
 #OPTIONS += -DLOW_MEMORY
 #endif
 
-#
 # Asterisk SMDI integration
-#
 WITH_SMDI = 1
 
 # Optional debugging parameters
@@ -102,7 +108,7 @@
 # Files are copied here temporarily during the install process
 # For example, make DESTDIR=/tmp/asterisk woud put things in
 # /tmp/asterisk/etc/asterisk
-# XXX watch out, put no spaces or comments after the value
+# !!! Watch out, put no spaces or comments after the value !!!
 DESTDIR?=
 #DESTDIR?=/tmp/asterisk
 
@@ -153,16 +159,7 @@
 # Define this to use files larger than 2GB (useful for sound files longer than 37 hours and logfiles)
 ASTCFLAGS+=-D_FILE_OFFSET_BITS=64
 
-# Pentium Pro Optimize
-#PROC=i686
-
-# Pentium & VIA processors optimize
-#PROC=i586
-
-#PROC=k6
-#PROC=ppc
-
-#Uncomment this to use the older DSP routines
+# Uncomment this to use the older DSP routines
 #ASTCFLAGS+=-DOLD_DSP_ROUTINES
 
 # Determine by a grep 'DocumentRoot' of your httpd.conf file
@@ -185,12 +182,6 @@
 endif
 
 ifeq ($(OSARCH),Linux)
-  ifeq ($(CROSS_COMPILE),)
-    PROC?=$(shell uname -m)
-  else
-    PROC=$(CROSS_PROC)
-  endif
-
   ifeq ($(PROC),x86_64)
     # You must have GCC 3.4 to use k8, otherwise use athlon
     PROC=k8
@@ -244,7 +235,6 @@
 ASTOBJ=-o asterisk
 
 ifeq ($(findstring BSD,$(OSARCH)),BSD)
-  PROC=$(shell uname -m)
   ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
 endif
 
@@ -312,7 +302,6 @@
   ASTLINK=
   LIBS+=-lpthread -lncurses -lm -lresolv
   ASTSBINDIR=$(MODULES_DIR)
-  PROC=$(shell uname -m)
 endif
 
 ifndef WITHOUT_ZAPTEL
@@ -399,12 +388,12 @@
   ASTLINK=-Wl,-dynamic
   SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
   # Mac on Intel CoreDuo does not need poll compatibility layer
-  ifneq ($(MARCH),i386)
+  ifneq ($(PROC),i386)
     OBJS+=poll.o
     ASTCFLAGS+=-DPOLLCOMPAT
   endif
 else
-#These are used for all but Darwin
+# These are used for all but Darwin
   ASTLINK=-Wl,-E 
   SOLINK=-shared -Xlinker -x
   ifeq ($(findstring BSD,$(OSARCH)),BSD)
@@ -967,11 +956,9 @@
 	@echo " +            $(MAKE) uninstall-all             +"  
 	@echo " +-------------------------------------------+"  
 
-
 uninstall-all: _uninstall
 	rm -rf $(DESTDIR)$(ASTLIBDIR)
 	rm -rf $(DESTDIR)$(ASTVARLIBDIR)
 	rm -rf $(DESTDIR)$(ASTSPOOLDIR)
 	rm -rf $(DESTDIR)$(ASTETCDIR)
 	rm -rf $(DESTDIR)$(ASTLOGDIR)
-

Modified: team/oej/siptransfer/apps/app_cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_cdr.c?rev=17992&r1=17991&r2=17992&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_cdr.c (original)
+++ team/oej/siptransfer/apps/app_cdr.c Thu Apr  6 14:46:42 2006
@@ -28,6 +28,8 @@
 #include <sys/types.h>
 #include <stdlib.h>
 
+#define STATIC_MODULE
+
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -35,9 +37,6 @@
 #include "asterisk/channel.h"
 #include "asterisk/module.h"
 #include "asterisk/pbx.h"
-
-
-static char *tdesc = "Tell Asterisk to not maintain a CDR for the current call";
 
 static char *nocdr_descrip = 
 "  NoCDR(): This application will tell Asterisk not to maintain a CDR for the\n"
@@ -64,7 +63,7 @@
 	return 0;
 }
 
-int unload_module(void)
+STATIC_MODULE int unload_module(void)
 {
 	int res;
 
@@ -75,24 +74,26 @@
 	return res;
 }
 
-int load_module(void)
+STATIC_MODULE int load_module(void)
 {
 	return ast_register_application(nocdr_app, nocdr_exec, nocdr_synopsis, nocdr_descrip);
 }
 
-char *description(void)
+STATIC_MODULE char *description(void)
 {
-	return tdesc;
+	return "Tell Asterisk to not maintain a CDR for the current call";
 }
 
-int usecount(void)
+STATIC_MODULE int usecount(void)
 {
 	int res;
 	STANDARD_USECOUNT(res);
 	return res;
 }
 
-char *key()
+STATIC_MODULE char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }
+
+STD_MOD(MOD_1, NULL, NULL, NULL);

Modified: team/oej/siptransfer/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_dial.c?rev=17992&r1=17991&r2=17992&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_dial.c (original)
+++ team/oej/siptransfer/apps/app_dial.c Thu Apr  6 14:46:42 2006
@@ -35,6 +35,7 @@
 #include <sys/signal.h>
 #include <netinet/in.h>
 
+#define STATIC_MODULE
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -1719,7 +1720,7 @@
 
 }
 
-int unload_module(void)
+STATIC_MODULE int unload_module(void)
 {
 	int res;
 
@@ -1731,7 +1732,7 @@
 	return res;
 }
 
-int load_module(void)
+STATIC_MODULE int load_module(void)
 {
 	int res;
 
@@ -1741,19 +1742,21 @@
 	return res;
 }
 
-char *description(void)
+STATIC_MODULE char *description(void)
 {
 	return tdesc;
 }
 
-int usecount(void)
+STATIC_MODULE int usecount(void)
 {
 	int res;
 	STANDARD_USECOUNT(res);
 	return res;
 }
 
-char *key()
+STATIC_MODULE char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }
+
+STD_MOD(MOD_1, NULL, NULL, NULL);

Modified: team/oej/siptransfer/apps/app_directed_pickup.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_directed_pickup.c?rev=17992&r1=17991&r2=17992&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_directed_pickup.c (original)
+++ team/oej/siptransfer/apps/app_directed_pickup.c Thu Apr  6 14:46:42 2006
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2005, Joshua Colp
  *
- * Joshua Colp <jcolp at asterlink.com>
+ * Joshua Colp <jcolp at digium.com>
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact

Modified: team/oej/siptransfer/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_record.c?rev=17992&r1=17991&r2=17992&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_record.c (original)
+++ team/oej/siptransfer/apps/app_record.c Thu Apr  6 14:46:42 2006
@@ -28,6 +28,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+
+#define	STATIC_MODULE
 
 #include "asterisk.h"
 
@@ -341,7 +343,7 @@
 	return res;
 }
 
-int unload_module(void)
+STATIC_MODULE int unload_module(void)
 {
 	int res;
 
@@ -352,24 +354,26 @@
 	return res;	
 }
 
-int load_module(void)
+STATIC_MODULE int load_module(void)
 {
 	return ast_register_application(app, record_exec, synopsis, descrip);
 }
 
-char *description(void)
+STATIC_MODULE char *description(void)
 {
 	return tdesc;
 }
 
-int usecount(void)
+STATIC_MODULE int usecount(void)
 {
 	int res;
 	STANDARD_USECOUNT(res);
 	return res;
 }
 
-char *key()
+STATIC_MODULE char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }
+
+STD_MOD(MOD_1, NULL, NULL, NULL);

Modified: team/oej/siptransfer/cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/cdr.c?rev=17992&r1=17991&r2=17992&view=diff
==============================================================================
--- team/oej/siptransfer/cdr.c (original)
+++ team/oej/siptransfer/cdr.c Thu Apr  6 14:46:42 2006
@@ -167,11 +167,10 @@
 */
 struct ast_cdr *ast_cdr_dup(struct ast_cdr *cdr) 
 {
-	struct ast_cdr *newcdr;
-
-	if (!(newcdr = ast_cdr_alloc())) {
+	struct ast_cdr *newcdr = ast_cdr_alloc();
+
+	if (!newcdr)
 		return NULL;
-	}
 
 	memcpy(newcdr, cdr, sizeof(*newcdr));
 	/* The varshead is unusable, volatile even, after the memcpy so we take care of that here */
@@ -184,31 +183,38 @@
 
 static const char *ast_cdr_getvar_internal(struct ast_cdr *cdr, const char *name, int recur) 
 {
-	struct ast_var_t *variables;
-	struct varshead *headp;
-
 	if (ast_strlen_zero(name))
 		return NULL;
 
-	while (cdr) {
-		headp = &cdr->varshead;
+	for (; cdr; cdr = recur ? cdr->next : NULL) {
+		struct ast_var_t *variables;
+		struct varshead *headp = &cdr->varshead;
 		AST_LIST_TRAVERSE(headp, variables, entries) {
 			if (!strcasecmp(name, ast_var_name(variables)))
 				return ast_var_value(variables);
 		}
-		if (!recur)
-			break;
-		cdr = cdr->next;
 	}
 
 	return NULL;
+}
+
+static void cdr_get_tv(struct timeval tv, const char *fmt, char *buf, int bufsize)
+{
+	if (fmt == NULL) {	/* raw mode */
+		snprintf(buf, bufsize, "%ld.%06ld", (long)tv.tv_sec, (long)tv.tv_usec);
+	} else {  
+		time_t t = tv.tv_sec;
+		if (t) {
+			struct tm tm;
+			localtime_r(&t, &tm);
+			strftime(buf, bufsize, fmt, &tm);
+		}
+	}
 }
 
 /*! CDR channel variable retrieval */
 void ast_cdr_getvar(struct ast_cdr *cdr, const char *name, char **ret, char *workspace, int workspacelen, int recur, int raw) 
 {
-	struct tm tm;
-	time_t t;
 	const char *fmt = "%Y-%m-%d %T";
 	const char *varbuf;
 
@@ -232,37 +238,13 @@
 		ast_copy_string(workspace, cdr->lastapp, workspacelen);
 	else if (!strcasecmp(name, "lastdata"))
 		ast_copy_string(workspace, cdr->lastdata, workspacelen);
-	else if (!strcasecmp(name, "start")) {
-		if (raw) {
-			snprintf(workspace, workspacelen, "%ld.%06ld", (long)cdr->start.tv_sec, (long)cdr->start.tv_usec);
-		} else {
-			t = cdr->start.tv_sec;
-			if (t) {
-				localtime_r(&t, &tm);
-				strftime(workspace, workspacelen, fmt, &tm);
-			}
-		}
-	} else if (!strcasecmp(name, "answer")) {
-		if (raw) {
-			snprintf(workspace, workspacelen, "%ld.%06ld", (long)cdr->answer.tv_sec, (long)cdr->answer.tv_usec);
-		} else {
-			t = cdr->answer.tv_sec;
-			if (t) {
-				localtime_r(&t, &tm);
-				strftime(workspace, workspacelen, fmt, &tm);
-			}
-		}
-	} else if (!strcasecmp(name, "end")) {
-		if (raw) {
-			snprintf(workspace, workspacelen, "%ld.%06ld", (long)cdr->end.tv_sec, (long)cdr->end.tv_usec);
-		} else {
-			t = cdr->end.tv_sec;
-			if (t) {
-				localtime_r(&t, &tm);
-				strftime(workspace, workspacelen, fmt, &tm);
-			}
-		}
-	} else if (!strcasecmp(name, "duration"))
+	else if (!strcasecmp(name, "start"))
+		cdr_get_tv(cdr->start, raw ? NULL : fmt, workspace, workspacelen);
+	else if (!strcasecmp(name, "answer"))
+		cdr_get_tv(cdr->answer, raw ? NULL : fmt, workspace, workspacelen);
+	else if (!strcasecmp(name, "end"))
+		cdr_get_tv(cdr->end, raw ? NULL : fmt, workspace, workspacelen);
+	else if (!strcasecmp(name, "duration"))
 		snprintf(workspace, workspacelen, "%ld", cdr->duration);
 	else if (!strcasecmp(name, "billsec"))
 		snprintf(workspace, workspacelen, "%ld", cdr->billsec);
@@ -317,7 +299,7 @@
 		return -1;
 	}
 
-	while (cdr) {
+	for (; cdr; cdr = recur ? cdr->next : NULL) {
 		headp = &cdr->varshead;
 		AST_LIST_TRAVERSE_SAFE_BEGIN(headp, newvariable, entries) {
 			if (!strcasecmp(ast_var_name(newvariable), name)) {
@@ -333,12 +315,6 @@
 			newvariable = ast_var_assign(name, value);
 			AST_LIST_INSERT_HEAD(headp, newvariable, entries);
 		}
-
-		if (!recur) {
-			break;
-		}
-
-		cdr = cdr->next;
 	}
 
 	return 0;
@@ -413,33 +389,36 @@
 
 void ast_cdr_free_vars(struct ast_cdr *cdr, int recur)
 {
-	struct varshead *headp;
-	struct ast_var_t *vardata;
 
 	/* clear variables */
+	for (; cdr; cdr = recur ? cdr->next : NULL) {
+		struct ast_var_t *vardata;
+		struct varshead *headp = &cdr->varshead;
+		while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
+			ast_var_delete(vardata);
+	}
+}
+
+/*! \brief  print a warning if cdr already posted */
+static void check_post(struct ast_cdr *cdr)
+{
+	if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
+		ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", S_OR(cdr->channel, "<unknown>"));
+}
+
+/*! \brief  print a warning if cdr already started */
+static void check_start(struct ast_cdr *cdr)
+{
+	if (!ast_tvzero(cdr->start))
+		ast_log(LOG_WARNING, "CDR on channel '%s' already started\n", S_OR(cdr->channel, "<unknown>"));
+}
+
+void ast_cdr_free(struct ast_cdr *cdr)
+{
+
 	while (cdr) {
-		headp = &cdr->varshead;
-		while (!AST_LIST_EMPTY(headp)) {
-			vardata = AST_LIST_REMOVE_HEAD(headp, entries);
-			ast_var_delete(vardata);
-		}
-
-		if (!recur) {
-			break;
-		}
-
-		cdr = cdr->next;
-	}
-}
-
-void ast_cdr_free(struct ast_cdr *cdr)
-{
-	char *chan;
-	struct ast_cdr *next; 
-
-	while (cdr) {
-		next = cdr->next;
-		chan = S_OR(cdr->channel, "<unknown>");
+		struct ast_cdr *next = cdr->next;
+		char *chan = S_OR(cdr->channel, "<unknown>");
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_POSTED) && !ast_test_flag(cdr, AST_CDR_FLAG_POST_DISABLED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' not posted\n", chan);
 		if (ast_tvzero(cdr->end))
@@ -462,64 +441,48 @@
 {
 	char *chan; 
 
-	while (cdr) {
+	for (; cdr; cdr = cdr->next) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
 			chan = S_OR(cdr->channel, "<unknown>");
-			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
-				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
-			if (!ast_tvzero(cdr->start))
-				ast_log(LOG_WARNING, "CDR on channel '%s' already started\n", chan);
+			check_post(cdr);
+			check_start(cdr);
 			cdr->start = ast_tvnow();
 		}
-		cdr = cdr->next;
 	}
 }
 
 void ast_cdr_answer(struct ast_cdr *cdr)
 {
-	char *chan; 
-
-	while (cdr) {
-		chan = S_OR(cdr->channel, "<unknown>");
-		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
-			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+
+	for (; cdr; cdr = cdr->next) {
+		check_post(cdr);
 		if (cdr->disposition < AST_CDR_ANSWERED)
 			cdr->disposition = AST_CDR_ANSWERED;
 		if (ast_tvzero(cdr->answer))
 			cdr->answer = ast_tvnow();
-		cdr = cdr->next;
 	}
 }
 
 void ast_cdr_busy(struct ast_cdr *cdr)
 {
-	char *chan; 
-
-	while (cdr) {
+
+	for (; cdr; cdr = cdr->next) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = S_OR(cdr->channel, "<unknown>");
-			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
-				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+			check_post(cdr);
 			if (cdr->disposition < AST_CDR_BUSY)
 				cdr->disposition = AST_CDR_BUSY;
 		}
-		cdr = cdr->next;
 	}
 }
 
 void ast_cdr_failed(struct ast_cdr *cdr)
 {
-	char *chan; 
-
-	while (cdr) {
-		chan = S_OR(cdr->channel, "<unknown>");
-		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
-			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+	for (; cdr; cdr = cdr->next) {
+		check_post(cdr);
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
 			if (cdr->disposition < AST_CDR_FAILED)
 				cdr->disposition = AST_CDR_FAILED;
 		}
-		cdr = cdr->next;
 	}
 }
 
@@ -527,7 +490,7 @@
 {
 	int res = 0;
 
-	while (cdr) {
+	for (; cdr; cdr = cdr->next) {
 		switch(cause) {
 		case AST_CAUSE_BUSY:
 			ast_cdr_busy(cdr);
@@ -544,34 +507,25 @@
 			res = -1;
 			ast_log(LOG_WARNING, "Cause not handled\n");
 		}
-		cdr = cdr->next;
 	}
 	return res;
 }
 
 void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chann)
 {
-	char *chan; 
-
-	while (cdr) {
-		chan = S_OR(cdr->channel, "<unknown>");
-		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
-			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+	for (; cdr; cdr = cdr->next) {
+		check_post(cdr);
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
 			ast_copy_string(cdr->dstchannel, chann, sizeof(cdr->dstchannel));
-		cdr = cdr->next;
 	}
 }
 
 void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data)
 {
-	char *chan; 
-
-	while (cdr) {
+
+	for (; cdr; cdr = cdr->next) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = S_OR(cdr->channel, "<unknown>");
-			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
-				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+			check_post(cdr);
 			if (!app)
 				app = "";
 			ast_copy_string(cdr->lastapp, app, sizeof(cdr->lastapp));
@@ -579,19 +533,17 @@
 				data = "";
 			ast_copy_string(cdr->lastdata, data, sizeof(cdr->lastdata));
 		}
-		cdr = cdr->next;
 	}
 }
 
 int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *c)
 {
 	char tmp[AST_MAX_EXTENSION] = "";
-	char *num;
-
-	while (cdr) {
+
+	for (; cdr; cdr = cdr->next) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
 			/* Grab source from ANI or normal Caller*ID */
-			num = c->cid.cid_ani ? c->cid.cid_ani : c->cid.cid_num;
+			char *num = c->cid.cid_ani ? c->cid.cid_ani : c->cid.cid_num; /* XXX ast_strlen_zero ? */
 			
 			if (c->cid.cid_name && num)
 				snprintf(tmp, sizeof(tmp), "\"%s\" <%s>", c->cid.cid_name, num);
@@ -602,7 +554,6 @@
 			ast_copy_string(cdr->clid, tmp, sizeof(cdr->clid));
 			ast_copy_string(cdr->src, num ? num : "", sizeof(cdr->src));
 		}
-		cdr = cdr->next;
 	}
 
 	return 0;
@@ -615,7 +566,7 @@
 	char *num;
 	char tmp[AST_MAX_EXTENSION] = "";
 
-	while (cdr) {
+	for ( ; cdr ; cdr = cdr->next) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
 			chan = S_OR(cdr->channel, "<unknown>");
 			if (!ast_strlen_zero(cdr->channel)) 
@@ -642,23 +593,18 @@
 			/* Unique call identifier */
 			ast_copy_string(cdr->uniqueid, c->uniqueid, sizeof(cdr->uniqueid));
 		}
-		cdr = cdr->next;
 	}
 	return 0;
 }
 
 void ast_cdr_end(struct ast_cdr *cdr)
 {
-	char *chan;
-
-	while (cdr) {
-		chan = S_OR(cdr->channel, "<unknown>");
-		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
-			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+	for ( ; cdr ; cdr = cdr->next) {
+		check_post(cdr);
 		if (ast_tvzero(cdr->end))
 			cdr->end = ast_tvnow();
 		if (ast_tvzero(cdr->start)) {
-			ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", chan);
+			ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", S_OR(cdr->channel, "<unknown>"));
 			cdr->disposition = AST_CDR_FAILED;
 		} else
 			cdr->duration = cdr->end.tv_sec - cdr->start.tv_sec;
@@ -666,7 +612,6 @@
 			cdr->billsec = cdr->end.tv_sec - cdr->answer.tv_sec;
 		else
 			cdr->billsec = 0;
-		cdr = cdr->next;
 	}
 }
 
@@ -704,10 +649,9 @@
 	struct ast_cdr *cdr = chan->cdr;
 
 	ast_string_field_set(chan, accountcode, account);
-	while (cdr) {
+	for ( ; cdr ; cdr = cdr->next) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
 			ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
-		cdr = cdr->next;
 	}
 	return 0;
 }
@@ -715,13 +659,10 @@
 int ast_cdr_setamaflags(struct ast_channel *chan, const char *flag)
 {
 	struct ast_cdr *cdr;
-	int newflag;
-
-	newflag = ast_cdr_amaflags2int(flag);
+	int newflag = ast_cdr_amaflags2int(flag);
 	if (newflag) {
-		for (cdr = chan->cdr; cdr; cdr = cdr->next) {
+		for (cdr = chan->cdr; cdr; cdr = cdr->next)
 			cdr->amaflags = newflag;
-		}
 	}
 
 	return 0;
@@ -731,10 +672,9 @@
 {
 	struct ast_cdr *cdr = chan->cdr;
 
-	while (cdr) {
+	for ( ; cdr ; cdr = cdr->next) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) 
 			ast_copy_string(cdr->userfield, userfield, sizeof(cdr->userfield));
-		cdr = cdr->next;
 	}
 
 	return 0;
@@ -744,13 +684,11 @@
 {
 	struct ast_cdr *cdr = chan->cdr;
 
-	while (cdr) {
+	for ( ; cdr ; cdr = cdr->next) {
 		int len = strlen(cdr->userfield);
 
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
 			strncpy(cdr->userfield+len, userfield, sizeof(cdr->userfield) - len - 1);
-
-		cdr = cdr->next;
 	}
 
 	return 0;
@@ -762,7 +700,7 @@
 	char *num;
 	char tmp[AST_MAX_EXTENSION] = "";
 
-	while (cdr) {
+	for ( ; cdr ; cdr = cdr->next) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
 			num = c->cid.cid_ani ? c->cid.cid_ani : c->cid.cid_num;
 			
@@ -777,11 +715,10 @@
 
 			/* Copy account code et-al */	
 			ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
-			/* Destination information */
+			/* Destination information */ /* XXX privilege macro* ? */
 			ast_copy_string(cdr->dst, S_OR(c->macroexten, c->exten), sizeof(cdr->dst));
 			ast_copy_string(cdr->dcontext, S_OR(c->macrocontext, c->context), sizeof(cdr->dcontext));
 		}
-		cdr = cdr->next;
 	}
 
 	return 0;
@@ -805,10 +742,9 @@
 	char *chan;
 	struct ast_cdr_beitem *i;
 
-	while (cdr) {
+	for ( ; cdr ; cdr = cdr->next) {
 		chan = S_OR(cdr->channel, "<unknown>");
-		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
-			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+		check_post(cdr);
 		if (ast_tvzero(cdr->end))
 			ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n", chan);
 		if (ast_tvzero(cdr->start))
@@ -819,7 +755,6 @@
 			i->be(cdr);
 		}
 		AST_LIST_UNLOCK(&be_list);
-		cdr = cdr->next;
 	}
 }
 
@@ -831,7 +766,7 @@
 	if (_flags)
 		ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
 
-	while (cdr) {
+	for ( ; cdr ; cdr = cdr->next) {
 		/* Detach if post is requested */
 		if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
 			if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
@@ -857,8 +792,6 @@
 			ast_cdr_start(cdr);
 			cdr->disposition = AST_CDR_NOANSWER;
 		}
-			
-		cdr = cdr->next;
 	}
 }
 
@@ -891,9 +824,8 @@
 static int init_batch(void)
 {
 	/* This is the single meta-batch used to keep track of all CDRs during the entire life of the program */
-	if (!(batch = ast_malloc(sizeof(*batch)))) {
+	if (!(batch = ast_malloc(sizeof(*batch))))
 		return -1;
-	}
 
 	reset_batch();
 
@@ -999,7 +931,7 @@
 	if (option_debug)
 		ast_log(LOG_DEBUG, "CDR detaching from this thread\n");
 
-	/* we'll need a new tail for every CDR */	
+	/* we'll need a new tail for every CDR */
 	if (!(newtail = ast_calloc(1, sizeof(*newtail)))) {
 		post_cdr(cdr);
 		ast_cdr_free(cdr);

Modified: team/oej/siptransfer/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channel.c?rev=17992&r1=17991&r2=17992&view=diff
==============================================================================
--- team/oej/siptransfer/channel.c (original)
+++ team/oej/siptransfer/channel.c Thu Apr  6 14:46:42 2006
@@ -194,8 +194,8 @@
 		return -1;
 	}
 	AST_LIST_TRAVERSE(&backends, cl, list) {
-		ast_cli(fd, FORMAT, cl->tech->type, cl->tech->description, 
-			(cl->tech->devicestate) ? "yes" : "no", 
+		ast_cli(fd, FORMAT, cl->tech->type, cl->tech->description,
+			(cl->tech->devicestate) ? "yes" : "no",
 			(cl->tech->indicate) ? "yes" : "no",
 			(cl->tech->transfer) ? "yes" : "no");
 		count_chan++;
@@ -231,7 +231,7 @@
 		ast_cli(fd, "\n%s is not a registered channel driver.\n", argv[2]);
 		AST_LIST_UNLOCK(&channels);
 		return RESULT_FAILURE;
-	} 
+	}
 
 	ast_cli(fd,
 		"-- Info about channel driver: %s --\n"
@@ -281,15 +281,15 @@
 	return ret;
 }
 
-static char show_channeltypes_usage[] = 
+static char show_channeltypes_usage[] =
 "Usage: show channeltypes\n"
 "       Shows available channel types registered in your Asterisk server.\n";
 
-static char show_channeltype_usage[] = 
+static char show_channeltype_usage[] =
 "Usage: show channeltype <name>\n"
 "	Show details about the specified channel type, <name>.\n";
 
-static struct ast_cli_entry cli_show_channeltypes = 
+static struct ast_cli_entry cli_show_channeltypes =
 	{ { "show", "channeltypes", NULL }, show_channeltypes, "Show available channel types", show_channeltypes_usage };
 
 static struct ast_cli_entry cli_show_channeltype =
@@ -298,22 +298,15 @@
 /*! \brief Checks to see if a channel is needing hang up */
 int ast_check_hangup(struct ast_channel *chan)
 {
-	time_t	myt;
-
-	/* if soft hangup flag, return true */
-	if (chan->_softhangup) 
+	if (chan->_softhangup)		/* yes if soft hangup flag set */
 		return 1;
-	/* if no technology private data, return true */
-	if (!chan->tech_pvt) 
+	if (!chan->tech_pvt)		/* yes if no technology private data */
 		return 1;
-	/* if no hangup scheduled, just return here */
-	if (!chan->whentohangup) 
+	if (!chan->whentohangup)	/* no if no hangup scheduled */
 		return 0;
-	time(&myt); /* get current time */
-	/* return, if not yet */
-	if (chan->whentohangup > myt) 
+	if (chan->whentohangup > time(NULL)) 	/* no if hangup time has not come yet. */
 		return 0;
-	chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
+	chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT;	/* record event */
 	return 1;
 }
 
@@ -366,15 +359,8 @@
 /*! \brief Set when to hangup channel */
 void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset)
 {
-	time_t	myt;
-	struct ast_frame fr = { AST_FRAME_NULL, };
-
-	time(&myt);
-	if (offset)
-		chan->whentohangup = myt + offset;
-	else
-		chan->whentohangup = 0;
-	ast_queue_frame(chan, &fr);
+	chan->whentohangup = offset ? time(NULL) + offset : 0;
+	ast_queue_frame(chan, &ast_null_frame);
 	return;
 }
 
@@ -384,12 +370,9 @@
 	time_t whentohangup;
 
 	if (chan->whentohangup == 0) {
-		if (offset == 0)
-			return (0);
-		else
-			return (-1);
-	} else { 
-		if (offset == 0)
+		return (offset == 0) ? 0 : -1;
+	} else {
+		if (offset == 0)	/* XXX why is this special ? */
 			return (1);
 		else {
 			whentohangup = offset + time (NULL);
@@ -486,9 +469,10 @@
 {
 	int x;
 
-	for (x=0; x < sizeof(causes) / sizeof(causes[0]); x++) 
+	for (x=0; x < sizeof(causes) / sizeof(causes[0]); x++) {
 		if (causes[x].cause == cause)
 			return causes[x].desc;
+	}
 
 	return "Unknown";
 }
@@ -548,7 +532,7 @@
 	/* This just our opinion, expressed in code.  We are asked to choose
 	   the best codec to use, given no information */
 	int x;
-	static int prefs[] = 
+	static int prefs[] =
 	{
 		/*! Okay, ulaw is used by all telephony equipment, so start with it */
 		AST_FORMAT_ULAW,
@@ -596,8 +580,7 @@
 	struct ast_channel *tmp;
 	int x;
 	int flags;
-	struct varshead *headp;        
-	        
+	struct varshead *headp;
 
 	/* If shutting down, don't allocate any new channels */
 	if (shutting_down) {
@@ -605,9 +588,8 @@
 		return NULL;
 	}
 
-	if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
+	if (!(tmp = ast_calloc(1, sizeof(*tmp))))
 		return NULL;
-	}
 
 	if (!(tmp->sched = sched_context_create())) {
 		ast_log(LOG_WARNING, "Channel allocation failed: Unable to create schedule context\n");
@@ -647,8 +629,7 @@
 			flags = fcntl(tmp->alertpipe[1], F_GETFL);
 			fcntl(tmp->alertpipe[1], F_SETFL, flags | O_NONBLOCK);
 		}
-	} else 
-		/* Make sure we've got it done right if they don't */
+	} else	/* Make sure we've got it done right if they don't */
 		tmp->alertpipe[0] = tmp->alertpipe[1] = -1;
 
 	/* Always watch the alertpipe */
@@ -783,8 +764,8 @@
 }
 
 /*!
- * \brief Helper function to find channels. 
- * 
+ * \brief Helper function to find channels.
+ *
  * It supports these modes:
  *
  * prev != NULL : get channel next in list after prev
@@ -792,10 +773,10 @@
  * name != NULL && namelen != 0 : get channel whose name starts with prefix
  * exten != NULL : get channel whose exten or macroexten matches
  * context != NULL && exten != NULL : get channel whose context or macrocontext
- *                                    
+ *
  * It returns with the channel's lock held. If getting the individual lock fails,
  * unlock and retry quickly up to 10 times, then give up.
- * 
+ *
  * \note XXX Note that this code has cost O(N) because of the need to verify
  * that the object is still on the global list.
  *
@@ -986,7 +967,7 @@
 		ast_translator_free_path(chan->readtrans);
 	if (chan->writetrans)
 		ast_translator_free_path(chan->writetrans);
-	if (chan->pbx) 
+	if (chan->pbx)
 		ast_log(LOG_WARNING, "PBX may not have been terminated properly on '%s'\n", chan->name);
 	free_cid(&chan->cid);
 	ast_mutex_destroy(&chan->lock);
@@ -1130,7 +1111,7 @@
 	}
 }
 
-static void detach_spies(struct ast_channel *chan) 
+static void detach_spies(struct ast_channel *chan)
 {
 	struct ast_channel_spy *spy;
 
@@ -1155,17 +1136,15 @@
 /*! \brief Softly hangup a channel, don't lock */
 int ast_softhangup_nolock(struct ast_channel *chan, int cause)
 {
-	int res = 0;
-	struct ast_frame f = { AST_FRAME_NULL };
 	if (option_debug)
 		ast_log(LOG_DEBUG, "Soft-Hanging up channel '%s'\n", chan->name);
 	/* Inform channel driver that we need to be hung up, if it cares */
 	chan->_softhangup |= cause;
-	ast_queue_frame(chan, &f);
+	ast_queue_frame(chan, &ast_null_frame);
 	/* Interrupt any poll call or such */
 	if (ast_test_flag(chan, AST_FLAG_BLOCKING))
 		pthread_kill(chan->blocker, SIGURG);
-	return res;
+	return 0;
 }
 
 /*! \brief Softly hangup a channel, lock */
@@ -1339,7 +1318,7 @@
 	detach_spies(chan);		/* get rid of spies */
 
 	if (chan->masq) {
-		if (ast_do_masquerade(chan)) 
+		if (ast_do_masquerade(chan))
 			ast_log(LOG_WARNING, "Failed to perform masquerade\n");
 	}
 
@@ -1348,7 +1327,7 @@
 		ast_mutex_unlock(&chan->lock);
 		return 0;
 	}
-	/* If this channel is one which will be masqueraded into something, 
+	/* If this channel is one which will be masqueraded into something,
 	   mark it as a zombie already, so we know to free it later */
 	if (chan->masqr) {
 		ast_set_flag(chan, AST_FLAG_ZOMBIE);
@@ -1365,13 +1344,13 @@
 		chan->sched = NULL;
 	}
 	
-	if (chan->generatordata)	/* Clear any tone stuff remaining */ 
+	if (chan->generatordata)	/* Clear any tone stuff remaining */
 		chan->generator->release(chan, chan->generatordata);
 	chan->generatordata = NULL;
 	chan->generator = NULL;
-	if (chan->cdr) {		/* End the CDR if it hasn't already */ 
+	if (chan->cdr) {		/* End the CDR if it hasn't already */
 		ast_cdr_end(chan->cdr);
-		ast_cdr_detach(chan->cdr);	/* Post and Free the CDR */ 
+		ast_cdr_detach(chan->cdr);	/* Post and Free the CDR */
 		chan->cdr = NULL;
 	}
 	if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
@@ -1391,13 +1370,13 @@
 	}
 			
 	ast_mutex_unlock(&chan->lock);
-	manager_event(EVENT_FLAG_CALL, "Hangup", 
+	manager_event(EVENT_FLAG_CALL, "Hangup",
 			"Channel: %s\r\n"
 			"Uniqueid: %s\r\n"
 			"Cause: %d\r\n"
 			"Cause-txt: %s\r\n",
-			chan->name, 
-			chan->uniqueid, 
+			chan->name,
+			chan->uniqueid,
 			chan->hangupcause,
 			ast_cause2str(chan->hangupcause)
 			);
@@ -1438,7 +1417,7 @@
 {
 	ast_mutex_lock(&chan->lock);
 	if (chan->generatordata) {
-		if (chan->generator && chan->generator->release) 
+		if (chan->generator && chan->generator->release)
 			chan->generator->release(chan, chan->generatordata);
 		chan->generatordata = NULL;
 		chan->generator = NULL;
@@ -1504,7 +1483,7 @@
 }
 
 /*! \brief Wait for x amount of time on a file descriptor to have input.  */
-struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int nfds, 
+struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int nfds,
 	int *exception, int *outfd, int *ms)
 {
 	struct timeval start = { 0 , 0 };
@@ -1586,7 +1565,7 @@
 		max += ast_add_fd(&pfds[max], fds[x]);
 	}
 
-	if (*ms > 0) 
+	if (*ms > 0)
 		start = ast_tvnow();
 	
 	if (sizeof(int) == 4) {	/* XXX fix timeout > 600000 on linux x86-32 */
@@ -1604,7 +1583,8 @@
 	for (x=0; x<n; x++)
 		ast_clear_flag(c[x], AST_FLAG_BLOCKING);
 	if (res < 0) { /* Simulate a timeout if we were interrupted */
-		*ms = (errno != EINTR) ? -1 : 0;
+		if (errno != EINTR)
+			*ms = -1;
 		return NULL;
 	}
 	if (whentohangup) {   /* if we have a timeout, check who expired */
@@ -1675,19 +1655,19 @@
 	int result = 0;
 
 	/* Stop if we're a zombie or need a soft hangup */
-	if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c)) 
+	if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
 		return -1;
 
 	/* Wait for a digit, no more than ms milliseconds total. */
 	while(ms && !result) {
 		ms = ast_waitfor(c, ms);
 		if (ms < 0) /* Error */
-			result = -1; 
+			result = -1;
 		else if (ms > 0) {
 			/* Read something */
 			f = ast_read(c);
 			if (f) {
-				if (f->frametype == AST_FRAME_DTMF) 
+				if (f->frametype == AST_FRAME_DTMF)
 					result = f->subclass;
 				ast_frfree(f);
 			} else
@@ -1723,13 +1703,13 @@
 	int res;
 
 	/* Stop if we're a zombie or need a soft hangup */
-	if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c)) 
+	if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
 		return -1;
 	/* Wait for a digit, no more than ms milliseconds total. */
 	while(ms) {
 		errno = 0;
 		rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms);
-		if ((!rchan) && (outfd < 0) && (ms)) { 
+		if ((!rchan) && (outfd < 0) && (ms)) {
 			if (errno == 0 || errno == EINTR)
 				continue;
 			ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
@@ -1823,7 +1803,7 @@
 		blah = -1;
 		/* IF we can't get event, assume it's an expired as-per the old interface */
 		res = ioctl(chan->timingfd, ZT_GETEVENT, &blah);
-		if (res) 
+		if (res)
 			blah = ZT_EVENT_TIMER_EXPIRED;
 
 		if (blah == ZT_EVENT_TIMER_PING) {
@@ -1884,7 +1864,7 @@
 	} else {
 		chan->blocker = pthread_self();
 		if (ast_test_flag(chan, AST_FLAG_EXCEPTION)) {
-			if (chan->tech->exception) 
+			if (chan->tech->exception)
 				f = chan->tech->exception(chan);
 			else {
 				ast_log(LOG_WARNING, "Exception flag set on '%s', but no exception handler\n", chan->name);
@@ -2039,7 +2019,7 @@
 int ast_internal_timing_enabled(struct ast_channel *chan)
 {
 	int ret = ast_opt_internal_timing && chan->timingfd > -1;
-	if (option_debug > 3) 
+	if (option_debug > 3)
 		ast_log(LOG_DEBUG, "Internal timing is %s (option_internal_timing=%d chan->timingfd=%d)\n", ret? "enabled": "disabled", ast_opt_internal_timing, chan->timingfd);
 	return ret;
 }
@@ -2152,7 +2132,7 @@
 {
 	int res = 0;
 	/* Stop if we're a zombie or need a soft hangup */
-	if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) 
+	if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan))
 		return -1;
 	CHECK_BLOCKING(chan);
 	if (chan->tech->send_text)
@@ -2517,7 +2497,7 @@
 			if (oh->priority)	
 				chan->priority = oh->priority;
 		}
-		if (chan->_state == AST_STATE_UP) 
+		if (chan->_state == AST_STATE_UP)
 			state = AST_CONTROL_ANSWER;
 	}
 	if (outstate)
@@ -2607,29 +2587,29 @@
 	return NULL;
 }
 
-int ast_call(struct ast_channel *chan, char *addr, int timeout) 
-{
-	/* Place an outgoing call, but don't wait any longer than timeout ms before returning. 
-	   If the remote end does not answer within the timeout, then do NOT hang up, but 
+int ast_call(struct ast_channel *chan, char *addr, int timeout)
+{
+	/* Place an outgoing call, but don't wait any longer than timeout ms before returning.
+	   If the remote end does not answer within the timeout, then do NOT hang up, but
 	   return anyway.  */
 	int res = -1;
 	/* Stop if we're a zombie or need a soft hangup */
 	ast_mutex_lock(&chan->lock);
-	if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) 
+	if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan))
 		if (chan->tech->call)
 			res = chan->tech->call(chan, addr, timeout);
 	ast_mutex_unlock(&chan->lock);
 	return res;
 }
 
-/*! 
+/*!
   \brief Transfer a call to dest, if the channel supports transfer
 
-  Called by: 
+  Called by:
     \arg app_transfer
     \arg the manager interface
 */
-int ast_transfer(struct ast_channel *chan, char *dest) 
+int ast_transfer(struct ast_channel *chan, char *dest)
 {
 	int res = -1;
 
@@ -2655,7 +2635,7 @@
 
 	/* XXX Merge with full version? XXX */
 	/* Stop if we're a zombie or need a soft hangup */
-	if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c)) 
+	if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
 		return -1;
 	if (!len)
 		return -1;
@@ -2694,7 +2674,7 @@
 	int d;
 
 	/* Stop if we're a zombie or need a soft hangup */
-	if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c)) 
+	if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
 		return -1;
 	if (!len)

[... 3021 lines stripped ...]


More information about the asterisk-commits mailing list