[svn-commits] oej: branch oej/obproxy r164599 - in /team/oej/obproxy: ./ agi/ apps/ build_t...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 16 03:58:04 CST 2008


Author: oej
Date: Tue Dec 16 03:58:00 2008
New Revision: 164599

URL: http://svn.digium.com/view/asterisk?view=rev&rev=164599
Log:
Resetting automerge, resolving conflict

Added:
    team/oej/obproxy/channels/busy_tone.h
      - copied unchanged from r164350, branches/1.4/channels/busy_tone.h
    team/oej/obproxy/channels/ring_tone.h
      - copied unchanged from r164350, branches/1.4/channels/ring_tone.h
    team/oej/obproxy/pbx/ael/ael-test/ael-vtest25/
      - copied from r164350, branches/1.4/pbx/ael/ael-test/ael-vtest25/
    team/oej/obproxy/pbx/ael/ael-test/ael-vtest25/extensions.ael
      - copied unchanged from r164350, branches/1.4/pbx/ael/ael-test/ael-vtest25/extensions.ael
    team/oej/obproxy/pbx/ael/ael-test/ref.ael-vtest25
      - copied unchanged from r164350, branches/1.4/pbx/ael/ael-test/ref.ael-vtest25
Removed:
    team/oej/obproxy/acinclude.m4
    team/oej/obproxy/redhat/
Modified:
    team/oej/obproxy/   (props changed)
    team/oej/obproxy/agi/Makefile
    team/oej/obproxy/agi/eagi-sphinx-test.c
    team/oej/obproxy/agi/eagi-test.c
    team/oej/obproxy/apps/app_adsiprog.c
    team/oej/obproxy/apps/app_chanspy.c
    team/oej/obproxy/apps/app_directed_pickup.c
    team/oej/obproxy/apps/app_festival.c
    team/oej/obproxy/apps/app_meetme.c
    team/oej/obproxy/apps/app_rpt.c
    team/oej/obproxy/apps/app_sms.c
    team/oej/obproxy/bootstrap.sh
    team/oej/obproxy/build_tools/get_makeopts
    team/oej/obproxy/build_tools/get_moduleinfo
    team/oej/obproxy/channels/   (props changed)
    team/oej/obproxy/channels/Makefile
    team/oej/obproxy/channels/chan_agent.c
    team/oej/obproxy/channels/chan_alsa.c
    team/oej/obproxy/channels/chan_dahdi.c
    team/oej/obproxy/channels/chan_gtalk.c
    team/oej/obproxy/channels/chan_h323.c
    team/oej/obproxy/channels/chan_iax2.c
    team/oej/obproxy/channels/chan_local.c
    team/oej/obproxy/channels/chan_misdn.c
    team/oej/obproxy/channels/chan_oss.c
    team/oej/obproxy/channels/chan_phone.c
    team/oej/obproxy/channels/chan_sip.c
    team/oej/obproxy/channels/chan_skinny.c
    team/oej/obproxy/channels/chan_vpb.cc
    team/oej/obproxy/channels/misdn/   (props changed)
    team/oej/obproxy/channels/misdn/Makefile
    team/oej/obproxy/channels/misdn/isdn_lib.c
    team/oej/obproxy/channels/misdn/isdn_lib.h
    team/oej/obproxy/channels/misdn/isdn_lib_intern.h
    team/oej/obproxy/channels/misdn_config.c
    team/oej/obproxy/configure
    team/oej/obproxy/configure.ac
    team/oej/obproxy/pbx/Makefile
    team/oej/obproxy/pbx/ael/   (props changed)
    team/oej/obproxy/pbx/ael/ael-test/ref.ael-test6
    team/oej/obproxy/pbx/ael/ael.flex
    team/oej/obproxy/pbx/ael/ael.tab.c
    team/oej/obproxy/pbx/ael/ael.tab.h
    team/oej/obproxy/pbx/ael/ael.y
    team/oej/obproxy/pbx/ael/ael_lex.c
    team/oej/obproxy/pbx/pbx_ael.c
    team/oej/obproxy/pbx/pbx_config.c
    team/oej/obproxy/pbx/pbx_dundi.c
    team/oej/obproxy/pbx/pbx_spool.c

Propchange: team/oej/obproxy/
------------------------------------------------------------------------------
    automerge = http://www.codename-pineapple.org/

Modified: team/oej/obproxy/agi/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/agi/Makefile?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/agi/Makefile (original)
+++ team/oej/obproxy/agi/Makefile Tue Dec 16 03:58:00 2008
@@ -39,7 +39,7 @@
 
 clean:
 	rm -f *.so *.o look eagi-test eagi-sphinx-test
-	rm -f .*.o.d .*.oo.d *.s *.i
+	rm -f .*.d *.s *.i
 	rm -f strcompat.c
 
 ifneq ($(wildcard .*.d),)

Modified: team/oej/obproxy/agi/eagi-sphinx-test.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/agi/eagi-sphinx-test.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/agi/eagi-sphinx-test.c (original)
+++ team/oej/obproxy/agi/eagi-sphinx-test.c Tue Dec 16 03:58:00 2008
@@ -70,7 +70,9 @@
 	char *val;
 	/* Read environment */
 	for(;;) {
-		fgets(buf, sizeof(buf), stdin);
+		if (!fgets(buf, sizeof(buf), stdin)) {
+			return -1;
+		}
 		if (feof(stdin))
 			return -1;
 		buf[strlen(buf) - 1] = '\0';
@@ -121,7 +123,9 @@
 			return NULL;
 		}
 		if (FD_ISSET(STDIN_FILENO, &fds)) {
-			fgets(astresp, sizeof(astresp), stdin);
+			if (!fgets(astresp, sizeof(astresp), stdin)) {
+				return NULL;
+			}
 			if (feof(stdin)) {
 				fprintf(stderr, "Got hungup on apparently\n");
 				return NULL;
@@ -132,9 +136,10 @@
 		}
 		if (FD_ISSET(AUDIO_FILENO, &fds)) {
 			res = read(AUDIO_FILENO, audiobuf, sizeof(audiobuf));
-			if (res > 0) {
-				if (sphinx_sock > -1) 
-					write(sphinx_sock, audiobuf, res);
+			if ((res > 0) && (sphinx_sock > -1)) {
+				if (write(sphinx_sock, audiobuf, res) < 0) {
+					fprintf(stderr, "write() failed: %s\n", strerror(errno));
+				}
 			}
 		}
 		if ((sphinx_sock > -1) && FD_ISSET(sphinx_sock, &fds)) {

Modified: team/oej/obproxy/agi/eagi-test.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/agi/eagi-test.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/agi/eagi-test.c (original)
+++ team/oej/obproxy/agi/eagi-test.c Tue Dec 16 03:58:00 2008
@@ -24,7 +24,9 @@
 	char *val;
 	/* Read environment */
 	for(;;) {
-		fgets(buf, sizeof(buf), stdin);
+		if (!fgets(buf, sizeof(buf), stdin)) {
+			return -1;
+		}
 		if (feof(stdin))
 			return -1;
 		buf[strlen(buf) - 1] = '\0';
@@ -68,7 +70,9 @@
 			return NULL;
 		}
 		if (FD_ISSET(STDIN_FILENO, &fds)) {
-			fgets(astresp, sizeof(astresp), stdin);
+			if (!fgets(astresp, sizeof(astresp), stdin)) {
+				return NULL;
+			}
 			if (feof(stdin)) {
 				fprintf(stderr, "Got hungup on apparently\n");
 				return NULL;

Modified: team/oej/obproxy/apps/app_adsiprog.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/apps/app_adsiprog.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/apps/app_adsiprog.c (original)
+++ team/oej/obproxy/apps/app_adsiprog.c Tue Dec 16 03:58:00 2008
@@ -1364,7 +1364,9 @@
 	/* Create "main" as first subroutine */
 	getsubbyname(scr, "main", NULL, 0);
 	while(!feof(f)) {
-		fgets(buf, sizeof(buf), f);
+		if (!fgets(buf, sizeof(buf), f)) {
+			continue;
+		}
 		if (!feof(f)) {
 			lineno++;
 			/* Trim off trailing return */

Modified: team/oej/obproxy/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/apps/app_chanspy.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/apps/app_chanspy.c (original)
+++ team/oej/obproxy/apps/app_chanspy.c Tue Dec 16 03:58:00 2008
@@ -38,6 +38,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <ctype.h>
+#include <errno.h>
 
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
@@ -190,8 +191,11 @@
 		return -1;
 	}
 
-	if (csth->fd)
-		write(csth->fd, f->data, f->datalen);
+	if (csth->fd) {
+		if (write(csth->fd, f->data, f->datalen) < 0) {
+			ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+		}
+	}
 
 	ast_frfree(f);
 
@@ -555,7 +559,7 @@
 			int igrp = !mygroup;
 			char *groups[25];
 			int num_groups = 0;
-			char *dup_group;
+			char dup_group[512];
 			int x;
 			char *s;
 
@@ -587,7 +591,7 @@
 
 			if (mygroup) {
 				if ((group = pbx_builtin_getvar_helper(peer, "SPYGROUP"))) {
-					dup_group = ast_strdupa(group);
+					ast_copy_string(dup_group, group, sizeof(dup_group));
 					num_groups = ast_app_separate_args(dup_group, ':', groups,
 									   sizeof(groups) / sizeof(groups[0]));
 				}
@@ -674,6 +678,8 @@
 
 	ast_channel_setoption(chan, AST_OPTION_TXGAIN, &zero_volume, sizeof(zero_volume), 0);
 
+	ast_mutex_lock(&chanspy_ds.lock);
+	ast_mutex_unlock(&chanspy_ds.lock);
 	ast_mutex_destroy(&chanspy_ds.lock);
 
 	return res;

Modified: team/oej/obproxy/apps/app_directed_pickup.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/apps/app_directed_pickup.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/apps/app_directed_pickup.c (original)
+++ team/oej/obproxy/apps/app_directed_pickup.c Tue Dec 16 03:58:00 2008
@@ -83,7 +83,7 @@
 /* Helper function that determines whether a channel is capable of being picked up */
 static int can_pickup(struct ast_channel *chan)
 {
-	if (!chan->pbx && (chan->_state == AST_STATE_RINGING || chan->_state == AST_STATE_RING))
+	if (!chan->pbx && (chan->_state == AST_STATE_RINGING || chan->_state == AST_STATE_RING || chan->_state == AST_STATE_DOWN))
 		return 1;
 	else
 		return 0;

Modified: team/oej/obproxy/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/apps/app_festival.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/apps/app_festival.c (original)
+++ team/oej/obproxy/apps/app_festival.c Tue Dec 16 03:58:00 2008
@@ -45,6 +45,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <errno.h>
 
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
@@ -160,7 +161,9 @@
 	}
 #endif
 	
-	write(fd,waveform,length);
+	if (write(fd,waveform,length) < 0) {
+		ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+	}
 	close(fd);
 	exit(0);
 }
@@ -431,17 +434,25 @@
     				writecache=1;
     				strln=strlen((char *)data);
     				ast_log(LOG_DEBUG,"line length : %d\n",strln);
-    				write(fdesc,&strln,sizeof(int));
-    				write(fdesc,data,strln);
+    				if (write(fdesc,&strln,sizeof(int)) < 0) {
+					ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+				}
+    				if (write(fdesc,data,strln) < 0) {
+					ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+				}
 				seekpos=lseek(fdesc,0,SEEK_CUR);
 				ast_log(LOG_DEBUG,"Seek position : %d\n",seekpos);
     			}
     		} else {
-    			read(fdesc,&strln,sizeof(int));
+    			if (read(fdesc,&strln,sizeof(int)) != sizeof(int)) {
+				ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
+			}
     			ast_log(LOG_DEBUG,"Cache file exists, strln=%d, strlen=%d\n",strln,(int)strlen((char *)data));
     			if (strlen((char *)data)==strln) {
     				ast_log(LOG_DEBUG,"Size OK\n");
-    				read(fdesc,&bigstring,strln);
+    				if (read(fdesc,&bigstring,strln) != strln) {
+					ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
+				}
 	    			bigstring[strln] = 0;
 				if (strcmp(bigstring,data)==0) { 
 	    				readcache=1;
@@ -470,7 +481,9 @@
 	if (writecache==1) {
 		ast_log(LOG_DEBUG,"Writing result to cache...\n");
 		while ((strln=read(fd,buffer,16384))!=0) {
-			write(fdesc,buffer,strln);
+			if (write(fdesc,buffer,strln) < 0) {
+				ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+			}
 		}
 		close(fd);
 		close(fdesc);

Modified: team/oej/obproxy/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/apps/app_meetme.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/apps/app_meetme.c (original)
+++ team/oej/obproxy/apps/app_meetme.c Tue Dec 16 03:58:00 2008
@@ -64,6 +64,7 @@
 #include "asterisk/translate.h"
 #include "asterisk/ulaw.h"
 #include "asterisk/astobj.h"
+#include "asterisk/astobj2.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/dial.h"
 #include "asterisk/causes.h"
@@ -164,6 +165,8 @@
 	CONFFLAG_SLA_STATION = (1 << 26),
 	/*! This is a SLA trunk. (Only for use by the SLA applications.) */
 	CONFFLAG_SLA_TRUNK = (1 << 27),
+	/*! Do not write any audio to this channel until the state is up. */
+	CONFFLAG_NO_AUDIO_UNTIL_UP = (1 << 28),
 };
 
 enum {
@@ -316,6 +319,20 @@
 #define MAX_CONFNUM 80
 #define MAX_PIN     80
 
+enum announcetypes {
+	CONF_HASJOIN,
+	CONF_HASLEFT
+};
+
+struct announce_listitem {
+	AST_LIST_ENTRY(announce_listitem) entry;
+	char namerecloc[PATH_MAX];				/*!< Name Recorded file Location */
+	char language[MAX_LANGUAGE];
+	struct ast_channel *confchan;
+	int confusers;
+	enum announcetypes announcetype;
+};
+
 /*! \brief The MeetMe Conference object */
 struct ast_conference {
 	ast_mutex_t playlock;                   /*!< Conference specific lock (players) */
@@ -333,7 +350,7 @@
 	unsigned int isdynamic:1;               /*!< Created on the fly? */
 	unsigned int locked:1;                  /*!< Is the conference locked? */
 	pthread_t recordthread;                 /*!< thread for recording */
-	ast_mutex_t recordthreadlock;		/*!< control threads trying to start recordthread */
+	ast_mutex_t recordthreadlock;           /*!< control threads trying to start recordthread */
 	pthread_attr_t attr;                    /*!< thread attribute */
 	const char *recordingfilename;          /*!< Filename to record the Conference into */
 	const char *recordingformat;            /*!< Format to record the Conference in */
@@ -344,6 +361,13 @@
 	struct ast_trans_pvt *transpath[32];
 	AST_LIST_HEAD_NOLOCK(, ast_conf_user) userlist;
 	AST_LIST_ENTRY(ast_conference) list;
+	/* announce_thread related data */
+	pthread_t announcethread;
+	ast_mutex_t announcethreadlock;
+	unsigned int announcethread_stop:1;
+	ast_cond_t announcelist_addition;
+	AST_LIST_HEAD_NOLOCK(, announce_listitem) announcelist;
+	ast_mutex_t announcelistlock;
 };
 
 static AST_LIST_HEAD_STATIC(confs, ast_conference);
@@ -762,6 +786,8 @@
 	ast_mutex_init(&cnf->listenlock);
 	cnf->recordthread = AST_PTHREADT_NULL;
 	ast_mutex_init(&cnf->recordthreadlock);
+	cnf->announcethread = AST_PTHREADT_NULL;
+	ast_mutex_init(&cnf->announcethreadlock);
 	ast_copy_string(cnf->confno, confno, sizeof(cnf->confno));
 	ast_copy_string(cnf->pin, pin, sizeof(cnf->pin));
 	ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin));
@@ -1233,6 +1259,7 @@
 static int conf_free(struct ast_conference *conf)
 {
 	int x;
+	struct announce_listitem *item;
 	
 	AST_LIST_REMOVE(&confs, conf, list);
 
@@ -1254,6 +1281,20 @@
 		if (conf->transpath[x])
 			ast_translator_free_path(conf->transpath[x]);
 	}
+	if (conf->announcethread != AST_PTHREADT_NULL) {
+		ast_mutex_lock(&conf->announcelistlock);
+		conf->announcethread_stop = 1;
+		ast_softhangup(conf->chan, AST_SOFTHANGUP_EXPLICIT);
+		ast_cond_signal(&conf->announcelist_addition);
+		ast_mutex_unlock(&conf->announcelistlock);
+		pthread_join(conf->announcethread, NULL);
+	
+		while ((item = AST_LIST_REMOVE_HEAD(&conf->announcelist, entry))) {
+			ast_filedelete(item->namerecloc, NULL);
+			ao2_ref(item, -1);
+		}
+		ast_mutex_destroy(&conf->announcelistlock);
+	}
 	if (conf->origframe)
 		ast_frfree(conf->origframe);
 	if (conf->lchan)
@@ -1266,6 +1307,8 @@
 	ast_mutex_destroy(&conf->playlock);
 	ast_mutex_destroy(&conf->listenlock);
 	ast_mutex_destroy(&conf->recordthreadlock);
+	ast_mutex_destroy(&conf->announcethreadlock);
+
 	free(conf);
 
 	return 0;
@@ -1288,6 +1331,10 @@
 	struct sla_trunk_ref *trunk_ref, struct sla_station *station, int lock)
 {
 	struct sla_event *event;
+
+	if (sla.thread == AST_PTHREADT_NULL) {
+		return;
+	}
 
 	if (!(event = ast_calloc(1, sizeof(*event))))
 		return;
@@ -1370,6 +1417,81 @@
 	return res;
 }
 
+static const char *get_announce_filename(enum announcetypes type)
+{
+	switch (type) {
+	case CONF_HASLEFT:
+		return "conf-hasleft";
+		break;
+	case CONF_HASJOIN:
+		return "conf-hasjoin";
+		break;
+	default:
+		return "";
+	}
+}
+
+static void *announce_thread(void *data)
+{
+	struct announce_listitem *current;
+	struct ast_conference *conf = data;
+	int res;
+	char filename[PATH_MAX] = "";
+	AST_LIST_HEAD_NOLOCK(, announce_listitem) local_list;
+	AST_LIST_HEAD_INIT_NOLOCK(&local_list);
+
+	while (!conf->announcethread_stop) {
+		ast_mutex_lock(&conf->announcelistlock);
+		if (conf->announcethread_stop) {
+			ast_mutex_unlock(&conf->announcelistlock);
+			break;
+		}
+		if (AST_LIST_EMPTY(&conf->announcelist))
+			ast_cond_wait(&conf->announcelist_addition, &conf->announcelistlock);
+
+		AST_LIST_APPEND_LIST(&local_list, &conf->announcelist, entry);
+		AST_LIST_HEAD_INIT_NOLOCK(&conf->announcelist);
+
+		ast_mutex_unlock(&conf->announcelistlock);
+		if (conf->announcethread_stop) {
+			break;
+		}
+
+		for (res = 1; !conf->announcethread_stop && (current = AST_LIST_REMOVE_HEAD(&local_list, entry)); ao2_ref(current, -1)) {
+			ast_log(LOG_DEBUG, "About to play %s\n", current->namerecloc);
+			if (!ast_fileexists(current->namerecloc, NULL, NULL))
+				continue;
+			if ((current->confchan) && (current->confusers > 1) && !ast_check_hangup(current->confchan)) {
+				if (!ast_streamfile(current->confchan, current->namerecloc, current->language))
+					res = ast_waitstream(current->confchan, "");
+				if (!res) {
+					ast_copy_string(filename, get_announce_filename(current->announcetype), sizeof(filename));
+					if (!ast_streamfile(current->confchan, filename, current->language))
+						ast_waitstream(current->confchan, "");
+				}
+			}
+			if (current->announcetype == CONF_HASLEFT) {
+				ast_filedelete(current->namerecloc, NULL);
+			}
+		}
+	}
+
+	/* thread marked to stop, clean up */
+	while ((current = AST_LIST_REMOVE_HEAD(&local_list, entry))) {
+		ast_filedelete(current->namerecloc, NULL);
+		ao2_ref(current, -1);
+	}
+	return NULL;
+}
+
+static int can_write(struct ast_channel *chan, int confflags)
+{
+	if (!(confflags & CONFFLAG_NO_AUDIO_UNTIL_UP)) {
+		return 1;
+	}
+
+	return (chan->_state == AST_STATE_UP);
+}
 
 static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int confflags, char *optargs[])
 {
@@ -1462,6 +1584,14 @@
 	}
 	ast_mutex_unlock(&conf->recordthreadlock);
 
+	ast_mutex_lock(&conf->announcethreadlock);
+	if ((conf->announcethread == AST_PTHREADT_NULL) && !(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) {
+		ast_mutex_init(&conf->announcelistlock);
+		AST_LIST_HEAD_INIT_NOLOCK(&conf->announcelist);
+		ast_pthread_create_background(&conf->announcethread, NULL, announce_thread, conf);
+	}
+	ast_mutex_unlock(&conf->announcethreadlock);
+
 	time(&user->jointime);
 
 	if (conf->locked && (!(confflags & CONFFLAG_ADMIN))) {
@@ -1581,7 +1711,10 @@
 		}
 	}
 
-	ast_indicate(chan, -1);
+	if (!(confflags & CONFFLAG_NO_AUDIO_UNTIL_UP)) {
+		/* We're leaving this alone until the state gets changed to up */
+		ast_indicate(chan, -1);
+	}
 
 	if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
 		ast_log(LOG_WARNING, "Unable to set '%s' to write linear mode\n", chan->name);
@@ -1666,15 +1799,25 @@
 	ztc.chan = 0;	
 	ztc.confno = conf->zapconf;
 
-	ast_mutex_lock(&conf->playlock);
-
 	if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW)) && conf->users > 1) {
-		if (conf->chan && ast_fileexists(user->namerecloc, NULL, NULL)) {
-			if (!ast_streamfile(conf->chan, user->namerecloc, chan->language))
-				ast_waitstream(conf->chan, "");
-			if (!ast_streamfile(conf->chan, "conf-hasjoin", chan->language))
-				ast_waitstream(conf->chan, "");
-		}
+		struct announce_listitem *item;
+		if (!(item = ao2_alloc(sizeof(*item), NULL)))
+			return -1;
+		ast_copy_string(item->namerecloc, user->namerecloc, sizeof(item->namerecloc));
+		ast_copy_string(item->language, chan->language, sizeof(item->language));
+		item->confchan = conf->chan;
+		item->confusers = conf->users;
+		item->announcetype = CONF_HASJOIN;
+		ast_mutex_lock(&conf->announcelistlock);
+		ao2_ref(item, +1); /* add one more so we can determine when announce_thread is done playing it */
+		AST_LIST_INSERT_TAIL(&conf->announcelist, item, entry);
+		ast_cond_signal(&conf->announcelist_addition);
+		ast_mutex_unlock(&conf->announcelistlock);
+
+		while (!ast_check_hangup(conf->chan) && ao2_ref(item, 0) == 2 && !ast_safe_sleep(chan, 1000)) {
+			;
+		}
+		ao2_ref(item, -1);
 	}
 
 	if (confflags & CONFFLAG_WAITMARKED && !conf->markedusers)
@@ -1689,7 +1832,6 @@
 	if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
 		ast_log(LOG_WARNING, "Error setting conference\n");
 		close(fd);
-		ast_mutex_unlock(&conf->playlock);
 		goto outrun;
 	}
 	ast_log(LOG_DEBUG, "Placed channel %s in %s conf %d\n", chan->name, dahdi_chan_name, conf->zapconf);
@@ -1710,8 +1852,6 @@
 			if (!(confflags & CONFFLAG_WAITMARKED) || ((confflags & CONFFLAG_MARKEDUSER) && (conf->markedusers >= 1)))
 				conf_play(chan, conf, ENTER);
 	}
-
-	ast_mutex_unlock(&conf->playlock);
 
 	conf_flush(fd, chan);
 
@@ -2220,7 +2360,7 @@
 						}
 						if (conf->transframe[index]) {
  							if (conf->transframe[index]->frametype != AST_FRAME_NULL) {
-	 							if (ast_write(chan, conf->transframe[index]))
+	 							if (can_write(chan, confflags) && ast_write(chan, conf->transframe[index]))
 									ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name);
 							}
 						} else {
@@ -2232,7 +2372,7 @@
 bailoutandtrynormal:					
 						if (user->listen.actual)
 							ast_frame_adjust_volume(&fr, user->listen.actual);
-						if (ast_write(chan, &fr) < 0) {
+						if (can_write(chan, confflags) && ast_write(chan, &fr) < 0) {
 							ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name);
 						}
 					}
@@ -2260,22 +2400,26 @@
 
 	reset_volumes(user);
 
-	AST_LIST_LOCK(&confs);
 	if (!(confflags & CONFFLAG_QUIET) && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN))
 		conf_play(chan, conf, LEAVE);
 
-	if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) {
-		if (ast_fileexists(user->namerecloc, NULL, NULL)) {
-			if ((conf->chan) && (conf->users > 1)) {
-				if (!ast_streamfile(conf->chan, user->namerecloc, chan->language))
-					ast_waitstream(conf->chan, "");
-				if (!ast_streamfile(conf->chan, "conf-hasleft", chan->language))
-					ast_waitstream(conf->chan, "");
-			}
-			ast_filedelete(user->namerecloc, NULL);
-		}
-	}
-	AST_LIST_UNLOCK(&confs);
+	if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW)) && conf->users > 1) {
+		struct announce_listitem *item;
+		if (!(item = ao2_alloc(sizeof(*item), NULL)))
+			return -1;
+		ast_copy_string(item->namerecloc, user->namerecloc, sizeof(item->namerecloc));
+		ast_copy_string(item->language, chan->language, sizeof(item->language));
+		item->confchan = conf->chan;
+		item->confusers = conf->users;
+		item->announcetype = CONF_HASLEFT;
+		ast_mutex_lock(&conf->announcelistlock);
+		AST_LIST_INSERT_TAIL(&conf->announcelist, item, entry);
+		ast_cond_signal(&conf->announcelist_addition);
+		ast_mutex_unlock(&conf->announcelistlock);
+	} else if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW)) && conf->users == 1) {
+		/* Last person is leaving, so no reason to try and announce, but should delete the name recording */
+		ast_filedelete(user->namerecloc, NULL);
+	}
 
  outrun:
 	AST_LIST_LOCK(&confs);
@@ -2581,7 +2725,7 @@
 	if (args.options) {
 		ast_app_parse_options(meetme_opts, &confflags, optargs, args.options);
 		dynamic = ast_test_flag(&confflags, CONFFLAG_DYNAMIC | CONFFLAG_DYNAMICPIN);
-		if (ast_test_flag(&confflags, CONFFLAG_DYNAMICPIN) && !args.pin)
+		if (ast_test_flag(&confflags, CONFFLAG_DYNAMICPIN) && ast_strlen_zero(args.pin))
 			strcpy(the_pin, "q");
 
 		empty = ast_test_flag(&confflags, CONFFLAG_EMPTY | CONFFLAG_EMPTYNOPIN);
@@ -3265,6 +3409,12 @@
 	ast_cond_t *cond;
 };
 
+static void answer_trunk_chan(struct ast_channel *chan)
+{
+	ast_answer(chan);
+	ast_indicate(chan, -1);
+}
+
 static void *run_station(void *data)
 {
 	struct sla_station *station;
@@ -3287,7 +3437,7 @@
 	snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk_ref->trunk->name);
 	ast_set_flag(&conf_flags, 
 		CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF | CONFFLAG_SLA_STATION);
-	ast_answer(trunk_ref->chan);
+	answer_trunk_chan(trunk_ref->chan);
 	conf = build_conf(conf_name, "", "", 0, 0, 1);
 	if (conf) {
 		conf_run(trunk_ref->chan, conf, conf_flags.flags, NULL);
@@ -3460,7 +3610,7 @@
 			/* Track the channel that answered this trunk */
 			s_trunk_ref->chan = ast_dial_answered(ringing_station->station->dial);
 			/* Actually answer the trunk */
-			ast_answer(ringing_trunk->trunk->chan);
+			answer_trunk_chan(ringing_trunk->trunk->chan);
 			sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL);
 			/* Now, start a thread that will connect this station to the trunk.  The rest of
 			 * the code here sets up the thread and ensures that it is able to save the arguments
@@ -4218,7 +4368,7 @@
 		ast_mutex_unlock(&sla.lock);
 
 		if (ringing_trunk) {
-			ast_answer(ringing_trunk->trunk->chan);
+			answer_trunk_chan(ringing_trunk->trunk->chan);
 			sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL);
 
 			free(ringing_trunk);
@@ -4369,7 +4519,7 @@
 		return 0;
 	}
 	ast_set_flag(&conf_flags, 
-		CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_MARKEDUSER | CONFFLAG_PASS_DTMF);
+		CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_MARKEDUSER | CONFFLAG_PASS_DTMF | CONFFLAG_NO_AUDIO_UNTIL_UP);
 	ast_indicate(chan, AST_CONTROL_RINGING);
 	conf_run(chan, conf, conf_flags.flags, NULL);
 	dispose_conf(conf);

Modified: team/oej/obproxy/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/apps/app_rpt.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/apps/app_rpt.c (original)
+++ team/oej/obproxy/apps/app_rpt.c Tue Dec 16 03:58:00 2008
@@ -273,7 +273,9 @@
 #include <sys/time.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
+#ifdef HAVE_SYS_IO_H
 #include <sys/io.h>
+#endif
 #include <sys/vfs.h>
 #include <math.h>
 #include <netinet/in.h>
@@ -2901,7 +2903,7 @@
 
 static void *rpt_tele_thread(void *this)
 {
-DAHDI_CONFINFO ci;  /* conference info */
+struct dahdi_confinfo ci;  /* conference info */
 int	res = 0,haslink,hastx,hasremote,imdone = 0, unkeys_queued, x;
 struct	rpt_tele *mytele = (struct rpt_tele *)this;
 struct  rpt_tele *tlist;
@@ -3362,6 +3364,7 @@
 		{
 			res = set_ic706(myrpt);
 		}
+#ifdef HAVE_IOPERM
 		else if(!strcmp(myrpt->remote, remote_rig_rbi))
 		{
 			if (ioperm(myrpt->p.iobase,1,1) == -1)
@@ -3372,6 +3375,7 @@
 			}
 			else res = setrbi(myrpt);
 		}
+#endif
 		else if(!strcmp(myrpt->remote, remote_rig_kenwood))
 		{
 			res = setkenwood(myrpt);
@@ -4157,7 +4161,7 @@
 
 static void *rpt_call(void *this)
 {
-DAHDI_CONFINFO ci;  /* conference info */
+struct dahdi_confinfo ci;  /* conference info */
 struct	rpt *myrpt = (struct rpt *)this;
 int	res;
 int stopped,congstarted,dialtimer,lastcidx,aborted;
@@ -4467,7 +4471,7 @@
 	struct rpt_link *l;
 	int reconnects = 0;
 	int i,n;
-	DAHDI_CONFINFO ci;  /* conference info */
+	struct dahdi_confinfo ci;  /* conference info */
 
 	val = node_lookup(myrpt,node);
 	if (!val){
@@ -8759,7 +8763,7 @@
 int ms = MSWAIT,i,lasttx=0,val,remrx=0,identqueued,othertelemqueued;
 int tailmessagequeued,ctqueued,dtmfed;
 struct ast_channel *who;
-DAHDI_CONFINFO ci;  /* conference info */
+struct dahdi_confinfo ci;  /* conference info */
 time_t	t;
 struct rpt_link *l,*m;
 struct rpt_tele *telem;
@@ -10564,8 +10568,8 @@
 	struct ast_channel *who;
 	struct ast_channel *cs[20];
 	struct	rpt_link *l;
-	DAHDI_CONFINFO ci;  /* conference info */
-	DAHDI_PARAMS par;
+	struct dahdi_confinfo ci;  /* conference info */
+	struct dahdi_params par;
 	int ms,elap,nullfd;
 	time_t t,last_timeout_warning;
 	struct	dahdi_radio_param z;
@@ -10987,6 +10991,7 @@
 		}		
 		rpt_mutex_lock(&myrpt->lock);
 	}
+#ifdef HAVE_IOPERM
 	if ((!strcmp(myrpt->remote, remote_rig_rbi)) &&
 	  (ioperm(myrpt->p.iobase,1,1) == -1))
 	{
@@ -10994,6 +10999,7 @@
 		ast_log(LOG_WARNING, "Cant get io permission on IO port %x hex\n",myrpt->p.iobase);
 		return -1;
 	}
+#endif
 	myrpt->remoteon = 1;
 #ifdef	OLD_ASTERISK
 	LOCAL_USER_ADD(u);

Modified: team/oej/obproxy/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/apps/app_sms.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/apps/app_sms.c (original)
+++ team/oej/obproxy/apps/app_sms.c Tue Dec 16 03:58:00 2008
@@ -662,7 +662,9 @@
 					*p++ = h->ud[n];
 			*p++ = '\n';
 			*p = 0;
-			write (o, line, strlen (line));
+			if (write (o, line, strlen (line)) < 0) {
+				ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+			}
 			close (o);
 		}
 		*h->oa = *h->da = h->udl = 0;

Modified: team/oej/obproxy/bootstrap.sh
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/bootstrap.sh?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/bootstrap.sh (original)
+++ team/oej/obproxy/bootstrap.sh Tue Dec 16 03:58:00 2008
@@ -32,7 +32,7 @@
 
 echo "Generating the configure script ..."
 
-aclocal${MY_AM_VER} 2>/dev/null
+aclocal${MY_AM_VER} -I autoconf
 autoconf${MY_AC_VER}
 autoheader${MY_AC_VER}
 automake${MY_AM_VER} --add-missing --copy 2>/dev/null

Modified: team/oej/obproxy/build_tools/get_makeopts
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/build_tools/get_makeopts?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/build_tools/get_makeopts (original)
+++ team/oej/obproxy/build_tools/get_makeopts Tue Dec 16 03:58:00 2008
@@ -1,3 +1,3 @@
 /\/\*\*\* MAKEOPTS/ {printit=1; next}
 /\*\*\*\// {if (printit) exit}
-// {if (printit) print}
+/.*/ {if (printit) print}

Modified: team/oej/obproxy/build_tools/get_moduleinfo
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/build_tools/get_moduleinfo?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/build_tools/get_moduleinfo (original)
+++ team/oej/obproxy/build_tools/get_moduleinfo Tue Dec 16 03:58:00 2008
@@ -1,3 +1,3 @@
 /\/\*\*\* MODULEINFO/ {printit=1; next}
 /\*\*\*\// {if (printit) exit}
-// {if (printit) print}
+/.*/ {if (printit) print}

Propchange: team/oej/obproxy/channels/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Dec 16 03:58:00 2008
@@ -1,12 +1,11 @@
 *.a
 *.d
 *.i
+*.ii
 *.oo
 *.makeopts
 *.moduleinfo
 *.s
 *.so
-busy.h
 gentone
 modules.link
-ringtone.h

Modified: team/oej/obproxy/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/channels/Makefile?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/channels/Makefile (original)
+++ team/oej/obproxy/channels/Makefile Tue Dec 16 03:58:00 2008
@@ -66,7 +66,7 @@
 include $(ASTTOPDIR)/Makefile.moddir_rules
 
 clean::
-	rm -f busy.h ringtone.h gentone
+	rm -f gentone
 	$(MAKE) -C misdn clean
 
 ifneq ($(wildcard h323/Makefile.ast),)
@@ -94,17 +94,13 @@
 	$(CMD_PREFIX) $(HOST_CC) $(STATIC_BUILD) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $^ $(LIBS)
 gentone: LIBS+=-lm
 
-busy.h: gentone
-	./gentone busy 480 620
+busy_tone.h:
+	./gentone busy_tone 480 620
 
-ringtone.h: gentone
-	./gentone ringtone 440 480
-
-chan_oss.o: busy.h ringtone.h
+ring_tone.h:
+	./gentone ring_tone 440 480
 
 $(if $(filter chan_iax2,$(EMBEDDED_MODS)),modules.link,chan_iax2.so): iax2-parser.o iax2-provision.o
-
-chan_alsa.o: busy.h ringtone.h
 
 ifeq ($(OSARCH),linux-gnu)
 chan_h323.so: chan_h323.o h323/libchanh323.a h323/Makefile.ast

Modified: team/oej/obproxy/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/channels/chan_agent.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/channels/chan_agent.c (original)
+++ team/oej/obproxy/channels/chan_agent.c Tue Dec 16 03:58:00 2008
@@ -666,9 +666,15 @@
 	struct agent_pvt *p = ast->tech_pvt;
 	int res = -1;
 	ast_mutex_lock(&p->lock);
-	if (p->chan)
-		res = p->chan->tech->indicate ? p->chan->tech->indicate(p->chan, condition, data, datalen) : -1;
-	else
+	if (p->chan && !ast_check_hangup(p->chan)) {
+		while (ast_channel_trylock(p->chan)) {
+			ast_channel_unlock(ast);
+			usleep(1);
+			ast_channel_lock(ast);
+		}
+  		res = p->chan->tech->indicate ? p->chan->tech->indicate(p->chan, condition, data, datalen) : -1;
+		ast_channel_unlock(p->chan);
+	} else
 		res = 0;
 	ast_mutex_unlock(&p->lock);
 	return res;
@@ -729,7 +735,8 @@
 		ast_mutex_unlock(&p->lock);
 		return res;
 	}
-	ast_verbose( VERBOSE_PREFIX_3 "agent_call, call to agent '%s' call on '%s'\n", p->agent, p->chan->name);
+	if (option_verbose > 2)
+		ast_verbose(VERBOSE_PREFIX_3 "agent_call, call to agent '%s' call on '%s'\n", p->agent, p->chan->name);
 	if (option_debug > 2)
 		ast_log(LOG_DEBUG, "Playing beep, lang '%s'\n", p->chan->language);
 	res = ast_streamfile(p->chan, beep, p->chan->language);
@@ -1029,7 +1036,7 @@
 	}
 #endif	
 	if (p->pending)
-		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/P%s-%d", p->agent, ast_random() & 0xffff);
+		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/P%s-%d", p->agent, (int) ast_random() & 0xffff);
 	else
 		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/%s", p->agent);
 	if (!tmp) {
@@ -2044,6 +2051,8 @@
 					tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTACKCALL");
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTACKCALL=%s, setting ackcall to: %d for Agent '%s'.\n",tmpoptions,p->ackcall,p->agent);
+				} else {
+					p->ackcall = ackcall;
 				}
 				if (pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF") && strlen(pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF"))) {
 					p->autologoff = atoi(pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF"));
@@ -2052,6 +2061,8 @@
 					tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF");
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTAUTOLOGOFF=%s, setting autologff to: %d for Agent '%s'.\n",tmpoptions,p->autologoff,p->agent);
+				} else {
+					p->autologoff = autologoff;
 				}
 				if (pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME") && strlen(pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME"))) {
 					p->wrapuptime = atoi(pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME"));
@@ -2060,6 +2071,8 @@
 					tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME");
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTWRAPUPTIME=%s, setting wrapuptime to: %d for Agent '%s'.\n",tmpoptions,p->wrapuptime,p->agent);
+				} else {
+					p->wrapuptime = wrapuptime;
 				}
 				ast_channel_unlock(chan);
 				unlock_channel = 0;
@@ -2447,7 +2460,9 @@
 				p->wrapuptime = 0;
 		}
 
-		if (ast_true(ackcall_s))
+		if (!strcasecmp(ackcall_s, "always"))
+			p->ackcall = 2;
+		else if (ast_true(ackcall_s))
 			p->ackcall = 1;
 		else
 			p->ackcall = 0;

Modified: team/oej/obproxy/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/channels/chan_alsa.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/channels/chan_alsa.c (original)
+++ team/oej/obproxy/channels/chan_alsa.c Tue Dec 16 03:58:00 2008
@@ -63,8 +63,8 @@
 #include "asterisk/abstract_jb.h"
 #include "asterisk/musiconhold.h"
 
-#include "busy.h"
-#include "ringtone.h"
+#include "busy_tone.h"
+#include "ring_tone.h"
 #include "ring10.h"
 #include "answer.h"
 
@@ -327,7 +327,9 @@
 		}
 #endif
 		if (FD_ISSET(sndcmd[0], &rfds)) {
-			read(sndcmd[0], &cursound, sizeof(cursound));
+			if (read(sndcmd[0], &cursound, sizeof(cursound)) < 0) {
+				ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
+			}
 			silencelen = 0;
 			offset = 0;
 			sampsent = 0;
@@ -532,7 +534,9 @@
 			ast_queue_frame(alsa.owner, &f);
 			ast_mutex_unlock(&alsa.owner->lock);
 		}
-		write(sndcmd[1], &res, sizeof(res));
+		if (write(sndcmd[1], &res, sizeof(res)) < 0) {
+			ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+		}
 	}
 	snd_pcm_prepare(alsa.icard);
 	snd_pcm_start(alsa.icard);
@@ -543,10 +547,12 @@
 static void answer_sound(void)
 {
 	int res;
+
 	nosound = 1;
 	res = 4;
-	write(sndcmd[1], &res, sizeof(res));
-
+	if (write(sndcmd[1], &res, sizeof(res)) < 0) {
+		ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+	}
 }
 
 static int alsa_answer(struct ast_channel *c)
@@ -576,7 +582,9 @@
 		if (!autoanswer) {
 			/* Congestion noise */
 			res = 2;
-			write(sndcmd[1], &res, sizeof(res));
+			if (write(sndcmd[1], &res, sizeof(res)) < 0) {
+				ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+			}
 		}
 	}
 	snd_pcm_drop(alsa.icard);
@@ -770,8 +778,11 @@
 		res = -1;
 	}
 
-	if (res > -1)
-		write(sndcmd[1], &res, sizeof(res));
+	if (res > -1) {
+		if (write(sndcmd[1], &res, sizeof(res)) < 0) {
+			ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+		}
+	}
 
 	ast_mutex_unlock(&alsalock);
 

Modified: team/oej/obproxy/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/oej/obproxy/channels/chan_dahdi.c?view=diff&rev=164599&r1=164598&r2=164599
==============================================================================
--- team/oej/obproxy/channels/chan_dahdi.c (original)
+++ team/oej/obproxy/channels/chan_dahdi.c Tue Dec 16 03:58:00 2008
@@ -240,6 +240,11 @@
 /*! \brief This is the thread for the monitor which checks for input on the channels
    which are not currently in use. */
 static pthread_t monitor_thread = AST_PTHREADT_NULL;
+static ast_cond_t ss_thread_complete;
+AST_MUTEX_DEFINE_STATIC(ss_thread_lock);
+AST_MUTEX_DEFINE_STATIC(restart_lock);
+static int ss_thread_count = 0;
+static int num_restart_pending = 0;
 
 static int restart_monitor(void);
 
@@ -419,6 +424,8 @@
 	struct dahdi_pvt *master;				/*!< Master to us (we follow their conferencing) */
 	int inconference;				/*!< If our real should be in the conference */
 	
+	int buf_no;					/*!< Number of buffers */
+	int buf_policy;				/*!< Buffer policy */
 	int sig;					/*!< Signalling style */
 	int radio;					/*!< radio type */
 	int outsigmod;					/*!< Outbound Signalling style (modifier) */
@@ -468,6 +475,7 @@
 	unsigned int priexclusive:1;
 	unsigned int pulse:1;
 	unsigned int pulsedial:1;			/*!< whether a pulse dial phone is detected */
+	unsigned int restartpending:1;		/*!< flag to ensure counted only once for restart */
 	unsigned int restrictcid:1;			/*!< Whether restrict the callerid -> only send ANI */
 	unsigned int threewaycalling:1;
 	unsigned int transfer:1;
@@ -648,7 +656,10 @@
 
 			.polarityonanswerdelay = 600,
 
-			.sendcalleridafter = DEFAULT_CIDRINGS
+			.sendcalleridafter = DEFAULT_CIDRINGS,
+
+			.buf_policy = DAHDI_POLICY_IMMEDIATE,
+			.buf_no = numbufs
 		},
 		.timing = {
 			.prewinktime = -1,
@@ -746,7 +757,8 @@
 		}
 	} while (res);
 	/* Then break the poll */
-	pthread_kill(pri->master, SIGURG);
+	if (pri->master != AST_PTHREADT_NULL)
+		pthread_kill(pri->master, SIGURG);
 	return 0;
 }
 #endif
@@ -782,11 +794,11 @@
 static int dahdi_get_index(struct ast_channel *ast, struct dahdi_pvt *p, int nullok)
 {
 	int res;
-	if (p->subs[0].owner == ast)
+	if (p->subs[SUB_REAL].owner == ast)
 		res = 0;
-	else if (p->subs[1].owner == ast)
+	else if (p->subs[SUB_CALLWAIT].owner == ast)
 		res = 1;
-	else if (p->subs[2].owner == ast)

[... 15731 lines stripped ...]



More information about the svn-commits mailing list