[asterisk-commits] moy: branch moy/mfcr2 r175028 - in /team/moy/mfcr2: ./ apps/ channels/ config...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 11 23:24:07 CST 2009


Author: moy
Date: Wed Feb 11 23:24:07 2009
New Revision: 175028

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=175028
Log:
merged changes from trunk rev 175027

Modified:
    team/moy/mfcr2/   (props changed)
    team/moy/mfcr2/CHANGES
    team/moy/mfcr2/apps/app_chanspy.c
    team/moy/mfcr2/apps/app_dial.c
    team/moy/mfcr2/apps/app_dictate.c
    team/moy/mfcr2/apps/app_externalivr.c
    team/moy/mfcr2/apps/app_mixmonitor.c
    team/moy/mfcr2/apps/app_queue.c
    team/moy/mfcr2/apps/app_rpt.c
    team/moy/mfcr2/apps/app_stack.c
    team/moy/mfcr2/apps/app_voicemail.c
    team/moy/mfcr2/apps/app_waitforsilence.c
    team/moy/mfcr2/channels/chan_dahdi.c
    team/moy/mfcr2/channels/chan_iax2.c
    team/moy/mfcr2/channels/chan_sip.c
    team/moy/mfcr2/channels/iax2-parser.h
    team/moy/mfcr2/configs/extensions.conf.sample
    team/moy/mfcr2/configs/iax.conf.sample
    team/moy/mfcr2/configs/res_ldap.conf.sample
    team/moy/mfcr2/configure
    team/moy/mfcr2/configure.ac
    team/moy/mfcr2/include/asterisk/autoconfig.h.in
    team/moy/mfcr2/include/asterisk/channel.h
    team/moy/mfcr2/include/asterisk/compiler.h
    team/moy/mfcr2/include/asterisk/features.h
    team/moy/mfcr2/include/asterisk/optional_api.h
    team/moy/mfcr2/include/asterisk/sched.h
    team/moy/mfcr2/include/asterisk/slinfactory.h
    team/moy/mfcr2/main/audiohook.c
    team/moy/mfcr2/main/channel.c
    team/moy/mfcr2/main/features.c
    team/moy/mfcr2/main/file.c
    team/moy/mfcr2/main/jitterbuf.c
    team/moy/mfcr2/main/manager.c
    team/moy/mfcr2/main/pbx.c
    team/moy/mfcr2/main/sched.c
    team/moy/mfcr2/main/slinfactory.c
    team/moy/mfcr2/main/tcptls.c
    team/moy/mfcr2/main/xml.c
    team/moy/mfcr2/pbx/pbx_config.c
    team/moy/mfcr2/res/res_config_sqlite.c
    team/moy/mfcr2/res/res_jabber.c
    team/moy/mfcr2/res/res_musiconhold.c
    team/moy/mfcr2/res/snmp/agent.c

Propchange: team/moy/mfcr2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/moy/mfcr2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: team/moy/mfcr2/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/CHANGES?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/CHANGES (original)
+++ team/moy/mfcr2/CHANGES Wed Feb 11 23:24:07 2009
@@ -545,6 +545,7 @@
   * Added the srvlookup option to iax.conf
   * Added support for OSP.  The token is set and retrieved through the CHANNEL()
      dialplan function.
+  * Added immediate option to iax.conf
 
 XMPP Google Talk/Jingle changes
 -------------------------------

Modified: team/moy/mfcr2/apps/app_chanspy.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_chanspy.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_chanspy.c (original)
+++ team/moy/mfcr2/apps/app_chanspy.c Wed Feb 11 23:24:07 2009
@@ -611,19 +611,15 @@
 	ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
 	ast_channel_unlock(chan);
 
-	if (ast_test_flag(flags, OPTION_WHISPER)) {
-		ast_audiohook_lock(&csth.whisper_audiohook);
-		ast_audiohook_detach(&csth.whisper_audiohook);
-		ast_audiohook_unlock(&csth.whisper_audiohook);
-		ast_audiohook_destroy(&csth.whisper_audiohook);
-	}
-
-	if (ast_test_flag(flags, OPTION_BARGE)) {
-		ast_audiohook_lock(&csth.bridge_whisper_audiohook);
-		ast_audiohook_detach(&csth.bridge_whisper_audiohook);
-		ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
-		ast_audiohook_destroy(&csth.bridge_whisper_audiohook);
-	}
+	ast_audiohook_lock(&csth.whisper_audiohook);
+	ast_audiohook_detach(&csth.whisper_audiohook);
+	ast_audiohook_unlock(&csth.whisper_audiohook);
+	ast_audiohook_destroy(&csth.whisper_audiohook);
+	
+	ast_audiohook_lock(&csth.bridge_whisper_audiohook);
+	ast_audiohook_detach(&csth.bridge_whisper_audiohook);
+	ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
+	ast_audiohook_destroy(&csth.bridge_whisper_audiohook);
 
 	ast_audiohook_lock(&csth.spy_audiohook);
 	ast_audiohook_detach(&csth.spy_audiohook);
@@ -833,22 +829,9 @@
 			 chanspy_ds_free(peer_chanspy_ds), prev = peer,
 		     peer_chanspy_ds = next_chanspy_ds ? next_chanspy_ds : 
 			 	next_channel(chan, prev, spec, exten, context, &chanspy_ds), next_chanspy_ds = NULL) {
-			const char *group;
 			int igrp = !mygroup;
-			char *groups[NUM_SPYGROUPS];
-			char *mygroups[NUM_SPYGROUPS];
-			int num_groups = 0;
-			char dup_group[512];
-			int num_mygroups = 0;
-			char *dup_mygroup;
-			int x;
-			int y;
+			int ienf = !myenforced;
 			char *s;
-			char *buffer;
-			char *end;
-			char *ext;
-			char *form_enforced;
-			int ienf = !myenforced;
 
 			peer = peer_chanspy_ds->chan;
 
@@ -877,7 +860,16 @@
 			}
 
 			if (mygroup) {
-				dup_mygroup = ast_strdupa(mygroup);
+				int num_groups = 0;
+				int num_mygroups = 0;
+				char dup_group[512];
+				char dup_mygroup[512];
+				char *groups[NUM_SPYGROUPS];
+				char *mygroups[NUM_SPYGROUPS];
+				const char *group;
+				int x;
+				int y;
+				ast_copy_string(dup_mygroup, mygroup, sizeof(dup_mygroup));
 				num_mygroups = ast_app_separate_args(dup_mygroup, ':', mygroups,
 					ARRAY_LEN(mygroups));
 
@@ -903,35 +895,28 @@
 			}
 
 			if (myenforced) {
-
-				/* We don't need to allocate more space than just the
-				length of (peer->name) for ext as we will cut the
-				channel name's ending before copying into ext */
-
-				ext = alloca(strlen(peer->name));
-
-				form_enforced = alloca(strlen(myenforced) + 3);
-
-				strcpy(form_enforced, ":");
-				strcat(form_enforced, myenforced);
-				strcat(form_enforced, ":");
-
-				buffer = ast_strdupa(peer->name);
-				
-				if ((end = strchr(buffer, '-'))) {
+				char ext[AST_CHANNEL_NAME + 3];
+				char buffer[512];
+				char *end;
+
+				snprintf(buffer, sizeof(buffer) - 1, ":%s:", myenforced);
+
+				ast_copy_string(ext + 1, peer->name, sizeof(ext) - 1);
+				if ((end = strchr(ext, '-'))) {
 					*end++ = ':';
 					*end = '\0';
 				}
 
-				strcpy(ext, ":");
-				strcat(ext, buffer);
-
-				if (strcasestr(form_enforced, ext))
+				ext[0] = ':';
+
+				if (strcasestr(buffer, ext)) {
 					ienf = 1;
-			}
-
-			if (!ienf)
+				}
+			}
+
+			if (!ienf) {
 				continue;
+			}
 
 			strcpy(peer_name, "spy-");
 			strncat(peer_name, peer->name, AST_NAME_STRLEN - 4 - 1);

Modified: team/moy/mfcr2/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_dial.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_dial.c (original)
+++ team/moy/mfcr2/apps/app_dial.c Wed Feb 11 23:24:07 2009
@@ -1593,6 +1593,10 @@
 		res = -1; /* reset default */
 	}
 
+	if (ast_test_flag64(&opts, OPT_DTMF_EXIT)) {
+		__ast_answer(chan, 0, 0);
+	}
+
 	if (continue_exec)
 		*continue_exec = 0;
 

Modified: team/moy/mfcr2/apps/app_dictate.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_dictate.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_dictate.c (original)
+++ team/moy/mfcr2/apps/app_dictate.c Wed Feb 11 23:24:07 2009
@@ -127,7 +127,9 @@
 		return -1;
 	}
 
-	ast_answer(chan);
+	if (chan->_state != AST_STATE_UP) {
+		ast_answer(chan);
+	}
 	ast_safe_sleep(chan, 200);
 	for (res = 0; !res;) {
 		if (ast_strlen_zero(filename)) {

Modified: team/moy/mfcr2/apps/app_externalivr.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_externalivr.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_externalivr.c (original)
+++ team/moy/mfcr2/apps/app_externalivr.c Wed Feb 11 23:24:07 2009
@@ -322,7 +322,7 @@
 
 static int app_exec(struct ast_channel *chan, void *data)
 {
-	struct ast_flags flags;
+	struct ast_flags flags = { 0, };
 	char *opts[0];
 	struct playlist_entry *entry;
 	int child_stdin[2] = { 0, 0 };

Modified: team/moy/mfcr2/apps/app_mixmonitor.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_mixmonitor.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_mixmonitor.c (original)
+++ team/moy/mfcr2/apps/app_mixmonitor.c Wed Feb 11 23:24:07 2009
@@ -138,7 +138,7 @@
 	char *post_process;
 	char *name;
 	unsigned int flags;
-	struct ast_channel *chan;
+	struct mixmonitor_ds *mixmonitor_ds;
 };
 
 enum {
@@ -164,6 +164,50 @@
 	AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME),
 });
 
+/* This structure is used as a means of making sure that our pointer to
+ * the channel we are monitoring remains valid. This is very similar to 
+ * what is used in app_chanspy.c.
+ */
+struct mixmonitor_ds {
+	struct ast_channel *chan;
+	/* These condition variables are used to be sure that the channel
+	 * hangup code completes before the mixmonitor thread attempts to
+	 * free this structure. The combination of a bookean flag and a
+	 * ast_cond_t ensure that no matter what order the threads run in,
+	 * we are guaranteed to never have the waiting thread block forever
+	 * in the case that the signaling thread runs first.
+	 */
+	unsigned int destruction_ok;
+	ast_cond_t destruction_condition;
+	ast_mutex_t lock;
+};
+
+static void mixmonitor_ds_destroy(void *data)
+{
+	struct mixmonitor_ds *mixmonitor_ds = data;
+
+	ast_mutex_lock(&mixmonitor_ds->lock);
+	mixmonitor_ds->chan = NULL;
+	mixmonitor_ds->destruction_ok = 1;
+	ast_cond_signal(&mixmonitor_ds->destruction_condition);
+	ast_mutex_unlock(&mixmonitor_ds->lock);
+}
+
+static void mixmonitor_ds_chan_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
+{
+	struct mixmonitor_ds *mixmonitor_ds = data;
+
+	ast_mutex_lock(&mixmonitor_ds->lock);
+	mixmonitor_ds->chan = new_chan;
+	ast_mutex_unlock(&mixmonitor_ds->lock);
+}
+
+static struct ast_datastore_info mixmonitor_ds_info = {
+	.type = "mixmonitor",
+	.destroy = mixmonitor_ds_destroy,
+	.chan_fixup = mixmonitor_ds_chan_fixup,
+};
+
 static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook) 
 {
 	struct ast_channel *peer = NULL;
@@ -205,7 +249,9 @@
 		if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR)))
 			continue;
 
-		if (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED) || ast_bridged_channel(mixmonitor->chan)) {
+		ast_mutex_lock(&mixmonitor->mixmonitor_ds->lock);
+		if (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED) || (mixmonitor->mixmonitor_ds->chan && ast_bridged_channel(mixmonitor->mixmonitor_ds->chan))) {
+			ast_mutex_unlock(&mixmonitor->mixmonitor_ds->lock);
 			/* Initialize the file if not already done so */
 			if (!fs && !errflag) {
 				oflags = O_CREAT | O_WRONLY;
@@ -225,6 +271,8 @@
 			/* Write out frame */
 			if (fs)
 				ast_writestream(fs, fr);
+		} else {
+			ast_mutex_unlock(&mixmonitor->mixmonitor_ds->lock);
 		}
 
 		/* All done! free it. */
@@ -246,10 +294,46 @@
 		ast_safe_system(mixmonitor->post_process);
 	}
 
+	ast_mutex_lock(&mixmonitor->mixmonitor_ds->lock);
+	if (!mixmonitor->mixmonitor_ds->destruction_ok) {
+		ast_cond_wait(&mixmonitor->mixmonitor_ds->destruction_condition, &mixmonitor->mixmonitor_ds->lock);
+	}
+	ast_mutex_unlock(&mixmonitor->mixmonitor_ds->lock);
+	ast_mutex_destroy(&mixmonitor->mixmonitor_ds->lock);
+	ast_cond_destroy(&mixmonitor->mixmonitor_ds->destruction_condition);
+	ast_free(mixmonitor->mixmonitor_ds);
 	ast_free(mixmonitor);
 
-
 	return NULL;
+}
+
+static int setup_mixmonitor_ds(struct mixmonitor *mixmonitor, struct ast_channel *chan)
+{
+	struct ast_datastore *datastore = NULL;
+	struct mixmonitor_ds *mixmonitor_ds;
+
+	if (!(mixmonitor_ds = ast_calloc(1, sizeof(*mixmonitor_ds)))) {
+		return -1;
+	}
+	
+	ast_mutex_init(&mixmonitor_ds->lock);
+	ast_cond_init(&mixmonitor_ds->destruction_condition, NULL);
+
+	if (!(datastore = ast_datastore_alloc(&mixmonitor_ds_info, NULL))) {
+		ast_free(mixmonitor_ds);
+		return -1;
+	}
+
+	/* No need to lock mixmonitor_ds since this is still operating in the channel's thread */
+	mixmonitor_ds->chan = chan;
+	datastore->data = mixmonitor_ds;
+
+	ast_channel_lock(chan);
+	ast_channel_datastore_add(chan, datastore);
+	ast_channel_unlock(chan);
+
+	mixmonitor->mixmonitor_ds = mixmonitor_ds;
+	return 0;
 }
 
 static void launch_monitor_thread(struct ast_channel *chan, const char *filename, unsigned int flags,
@@ -285,7 +369,9 @@
 
 	/* Copy over flags and channel name */
 	mixmonitor->flags = flags;
-	mixmonitor->chan = chan;
+	if (setup_mixmonitor_ds(mixmonitor, chan)) {
+		return;
+	}
 	mixmonitor->name = (char *) mixmonitor + sizeof(*mixmonitor);
 	strcpy(mixmonitor->name, chan->name);
 	if (!ast_strlen_zero(postprocess2)) {
@@ -318,7 +404,6 @@
 	}
 
 	ast_pthread_create_detached_background(&thread, NULL, mixmonitor_thread, mixmonitor);
-
 }
 
 static int mixmonitor_exec(struct ast_channel *chan, void *data)

Modified: team/moy/mfcr2/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_queue.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_queue.c (original)
+++ team/moy/mfcr2/apps/app_queue.c Wed Feb 11 23:24:07 2009
@@ -2012,6 +2012,7 @@
 static int say_position(struct queue_ent *qe, int ringing)
 {
 	int res = 0, avgholdmins, avgholdsecs, announceposition = 0;
+	int say_thanks = 1;
 	time_t now;
 
 	/* Let minannouncefrequency seconds pass between the start of each position announcement */
@@ -2120,15 +2121,16 @@
 			if (res)
 				goto playout;
 		}
-
+	} else if (qe->parent->announceholdtime && !qe->parent->announceposition) {
+		say_thanks = 0;
 	}
 
 posout:
-	if (announceposition == 1){
-		if (qe->parent->announceposition) {
-			ast_verb(3, "Told %s in %s their queue position (which was %d)\n",
-				qe->chan->name, qe->parent->name, qe->pos);
-		}
+	if (qe->parent->announceposition) {
+		ast_verb(3, "Told %s in %s their queue position (which was %d)\n",
+			qe->chan->name, qe->parent->name, qe->pos);
+	}
+	if (say_thanks) {
 		res = play_file(qe->chan, qe->parent->sound_thanks);
 	}
 playout:
@@ -2453,7 +2455,7 @@
 		ast_verb(3, "Couldn't call %s\n", tmp->interface);
 		do_hang(tmp);
 		(*busies)++;
-		update_status(qe->parent, tmp->member, ast_device_state(tmp->member->interface));
+		update_status(qe->parent, tmp->member, ast_device_state(tmp->member->state_interface));
 		return 0;
 	} else if (qe->parent->eventwhencalled) {
 		char vars[2048];
@@ -2479,7 +2481,7 @@
 		ast_verb(3, "Called %s\n", tmp->interface);
 	}
 
-	update_status(qe->parent, tmp->member, ast_device_state(tmp->member->interface));
+	update_status(qe->parent, tmp->member, ast_device_state(tmp->member->state_interface));
 	return 1;
 }
 
@@ -2664,7 +2666,7 @@
 }
 
 /*! \brief RNA == Ring No Answer. Common code that is executed when we try a queue member and they don't answer. */
-static void rna(int rnatime, struct queue_ent *qe, char *interface, char *membername)
+static void rna(int rnatime, struct queue_ent *qe, char *interface, char *membername, int pause)
 {
 	ast_verb(3, "Nobody picked up in %d ms\n", rnatime);
 	if (qe->parent->eventwhencalled) {
@@ -2687,7 +2689,7 @@
 						qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
 	}
 	ast_queue_log(qe->parent->name, qe->chan->uniqueid, membername, "RINGNOANSWER", "%d", rnatime);
-	if (qe->parent->autopause) {
+	if (qe->parent->autopause && pause) {
 		if (!set_member_paused(qe->parent->name, interface, "Auto-Pause", 1)) {
 			ast_verb(3, "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n", interface, qe->parent->name);
 		} else {
@@ -2866,7 +2868,7 @@
 							do_hang(o);
 							endtime = (long) time(NULL);
 							endtime -= starttime;
-							rna(endtime*1000, qe, on, membername);
+							rna(endtime * 1000, qe, on, membername, 0);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
 									*to = orig;
@@ -2880,7 +2882,7 @@
 								ast_cdr_busy(in->cdr);
 							endtime = (long) time(NULL);
 							endtime -= starttime;
-							rna(endtime*1000, qe, on, membername);
+							rna(endtime * 1000, qe, on, membername, 0);
 							do_hang(o);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
@@ -2902,7 +2904,7 @@
 					ast_frfree(f);
 				} else {
 					endtime = (long) time(NULL) - starttime;
-					rna(endtime * 1000, qe, on, membername);
+					rna(endtime * 1000, qe, on, membername, 1);
 					do_hang(o);
 					if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 						if (qe->parent->timeoutrestart)
@@ -2942,7 +2944,7 @@
 		}
 		if (!*to) {
 			for (o = start; o; o = o->call_next)
-				rna(orig, qe, o->interface, o->member->membername);
+				rna(orig, qe, o->interface, o->member->membername, 1);
 		}
 	}
 
@@ -5722,7 +5724,7 @@
 			while ((cur = ao2_iterator_next(&mem_iter))) {
 				if (cur->dynamic)
 					q->membercount++;
-				cur->status = ast_device_state(cur->interface);
+				cur->status = ast_device_state(cur->state_interface);
 				ao2_ref(cur, -1);
 			}
 			ao2_unlock(q);

Modified: team/moy/mfcr2/apps/app_rpt.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_rpt.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_rpt.c (original)
+++ team/moy/mfcr2/apps/app_rpt.c Wed Feb 11 23:24:07 2009
@@ -318,6 +318,7 @@
 
 #include <signal.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
@@ -599,8 +600,8 @@
 	int	mode;
 	struct rpt_link mylink;
 	char param[TELEPARAMSIZE];
-	int	submode;
-	unsigned int parrot;
+	intptr_t submode;
+	uintptr_t  parrot;
 	pthread_t threadid;
 } ;
 
@@ -4971,7 +4972,7 @@
 
 	    case PARROT: /* Repeat stuff */
 
-		sprintf(mystr,PARROTFILE,myrpt->name,mytele->parrot);
+		sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
 		if (ast_fileexists(mystr,NULL,mychannel->language) <= 0)
 		{
 			imdone = 1;
@@ -4979,14 +4980,14 @@
 			break;
 		}
 		wait_interval(myrpt, DLY_PARROT, mychannel);
-		sprintf(mystr,PARROTFILE,myrpt->name,mytele->parrot);
+		sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
 		res = ast_streamfile(mychannel, mystr, mychannel->language);
 		if (!res) 
 			res = ast_waitstream(mychannel, "");
 		else
 			 ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
 		ast_stopstream(mychannel);
-		sprintf(mystr,PARROTFILE,myrpt->name,mytele->parrot);
+		sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
 		strcat(mystr,".wav");
 		unlink(mystr);			
 		imdone = 1;
@@ -5254,7 +5255,7 @@
 	memset((char *)tele,0,sizeof(struct rpt_tele));
 	tele->rpt = myrpt;
 	tele->mode = mode;
-	if (mode == PARROT) tele->parrot = (unsigned int) data;
+	if (mode == PARROT) tele->parrot = (uintptr_t) data;
 	else mylink = (struct rpt_link *) data;
 	rpt_mutex_lock(&myrpt->lock);
 	if((mode == CONNFAIL) || (mode == REMDISC) || (mode == CONNECTED) ||
@@ -5268,7 +5269,7 @@
 		strncpy(tele->param, (char *) data, TELEPARAMSIZE - 1);
 		tele->param[TELEPARAMSIZE - 1] = 0;
 	}
-	if (mode == REMXXX) tele->submode = (int) data;
+	if (mode == REMXXX) tele->submode = (intptr_t) data;
 	insque((struct qelem *)tele, (struct qelem *)myrpt->tele.next);
 	rpt_mutex_unlock(&myrpt->lock);
         pthread_attr_init(&attr);
@@ -6375,6 +6376,7 @@
 static int function_cop(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
 {
 	char string[16];
+	int res;
 
 	int i, r;
 
@@ -6383,7 +6385,7 @@
 	
 	switch(myatoi(param)){
 		case 1: /* System reset */
-			system("killall -9 asterisk");
+			res = system("killall -9 asterisk");
 			return DC_COMPLETE;
 
 		case 2:
@@ -9636,7 +9638,8 @@
 static int function_remote(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
 {
 	char *s,*s1,*s2;
-	int i,j,p,r,ht,k,l,ls2,m,d,offset,offsave, modesave, defmode;
+	int i,j,r,ht,k,l,ls2,m,d,offset,offsave, modesave, defmode=0;
+	intptr_t p;
 	char multimode = 0;
 	char oc,*cp,*cp1,*cp2;
 	char tmp[20], freq[20] = "", savestr[20] = "";
@@ -11988,7 +11991,7 @@
 				ast_closestream(myrpt->parrotstream);
 			myrpt->parrotstream = NULL;
 			myrpt->parrotstate = 2;
-			rpt_telemetry(myrpt,PARROT,(struct rpt_link *) myrpt->parrotcnt++); 
+			rpt_telemetry(myrpt,PARROT,(void *) ((intptr_t)myrpt->parrotcnt++)); 
 		}			
 		if (myrpt->cmdAction.state == CMD_STATE_READY)
 		{ /* there is a command waiting to be processed */
@@ -13661,7 +13664,7 @@
 			donodelog(myrpt,str);
 		}
 		if (!phone_mode) send_newkey(chan);
-		return AST_PBX_KEEPALIVE;
+		return 0;
 	}
 	/* well, then it is a remote */
 	rpt_mutex_lock(&myrpt->lock);

Modified: team/moy/mfcr2/apps/app_stack.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_stack.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_stack.c (original)
+++ team/moy/mfcr2/apps/app_stack.c Wed Feb 11 23:24:07 2009
@@ -596,16 +596,16 @@
 		int res;
 
 		ast_debug(1, "Trying gosub with arguments '%s'\n", gosub_args);
-		ast_copy_string(chan->context, "app_stack_gosub_virtual_context", sizeof(chan->context));
-		ast_copy_string(chan->exten, "s", sizeof(chan->exten));
-		chan->priority = 0;
 
 		if ((res = pbx_exec(chan, theapp, gosub_args)) == 0) {
 			struct ast_pbx *pbx = chan->pbx;
+			struct ast_pbx_args args;
+			memset(&args, 0, sizeof(args));
+			args.no_hangup_chan = 1;
 			/* Suppress warning about PBX already existing */
 			chan->pbx = NULL;
 			ast_agi_send(agi->fd, chan, "100 result=0 Trying...\n");
-			ast_pbx_run(chan);
+			ast_pbx_run_args(chan, &args);
 			ast_agi_send(agi->fd, chan, "200 result=0 Gosub complete\n");
 			if (chan->pbx) {
 				ast_free(chan->pbx);
@@ -638,13 +638,8 @@
 
 static int unload_module(void)
 {
-	struct ast_context *con;
-
-	if (ast_agi_unregister(ast_module_info->self, &gosub_agi_command) == 1) {
-		if ((con = ast_context_find("app_stack_gosub_virtual_context"))) {
-			ast_context_remove_extension2(con, "s", 1, NULL, 0);
-			ast_context_destroy(con, "app_stack"); /* leave nothing behind */
-		}
+	if (ast_agi_unregister) {
+		 ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
 	}
 
 	ast_unregister_application(app_return);
@@ -659,15 +654,8 @@
 
 static int load_module(void)
 {
-	struct ast_context *con;
-
-	if (ast_agi_register(ast_module_info->self, &gosub_agi_command) == 1) {
-		if (!(con = ast_context_find_or_create(NULL, NULL, "app_stack_gosub_virtual_context", "app_stack"))) {
-			ast_log(LOG_ERROR, "Virtual context 'app_stack_gosub_virtual_context' does not exist and unable to create\n");
-			return AST_MODULE_LOAD_DECLINE;
-		} else {
-			ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free_ptr, "app_stack");
-		}
+	if (ast_agi_register) {
+		 ast_agi_register(ast_module_info->self, &gosub_agi_command);
 	}
 
 	ast_register_application_xml(app_pop, pop_exec);

Modified: team/moy/mfcr2/apps/app_voicemail.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_voicemail.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_voicemail.c (original)
+++ team/moy/mfcr2/apps/app_voicemail.c Wed Feb 11 23:24:07 2009
@@ -574,6 +574,7 @@
 #ifdef IMAP_STORAGE
 	char imapuser[80];               /*!< IMAP server login */
 	char imappassword[80];           /*!< IMAP server password if authpassword not defined */
+	char imapvmshareid[80];          /*!< Shared mailbox ID to use rather than the dialed one */
 #endif
 	double volgain;                  /*!< Volume gain for voicemails sent via email */
 	AST_LIST_ENTRY(ast_vm_user) list;
@@ -882,6 +883,8 @@
 		ast_copy_string(vmu->imapuser, value, sizeof(vmu->imapuser));
 	} else if (!strcasecmp(var, "imappassword") || !strcasecmp(var, "imapsecret")) {
 		ast_copy_string(vmu->imappassword, value, sizeof(vmu->imappassword));
+	} else if (!strcasecmp(var, "imapvmshareid")) {
+		ast_copy_string(vmu->imapvmshareid, value, sizeof(vmu->imapvmshareid));
 #endif
 	} else if (!strcasecmp(var, "delete") || !strcasecmp(var, "deletevoicemail")) {
 		ast_set2_flag(vmu, ast_true(value), VM_DELETE);	
@@ -1114,6 +1117,8 @@
 			ast_copy_string(retval->imapuser, var->value, sizeof(retval->imapuser));
 		} else if (!strcasecmp(var->name, "imappassword") || !strcasecmp(var->name, "imapsecret")) {
 			ast_copy_string(retval->imappassword, var->value, sizeof(retval->imappassword));
+		} else if (!strcasecmp(var->name, "imapvmshareid")) {
+			ast_copy_string(retval->imapvmshareid, var->value, sizeof(retval->imapvmshareid));
 #endif
 		} else
 			apply_option(retval, var->name, var->value);
@@ -1775,7 +1780,7 @@
 	if (ret == 0) {
 		ast_mutex_lock(&vms_p->lock);
 		pgm = mail_newsearchpgm ();
-		hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)mailbox);
+		hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)(!ast_strlen_zero(vmu->imapvmshareid) ? vmu->imapvmshareid : mailbox));
 		pgm->header = hdr;
 		if (fold != 1) {
 			pgm->unseen = 1;
@@ -2222,7 +2227,7 @@
 	pgm = mail_newsearchpgm();
 
 	/* Check IMAP folder for Asterisk messages only... */
-	hdr = mail_newsearchheader("X-Asterisk-VM-Extension", vmu->mailbox);
+	hdr = mail_newsearchheader("X-Asterisk-VM-Extension", (!ast_strlen_zero(vmu->imapvmshareid) ? vmu->imapvmshareid : vmu->mailbox));
 	pgm->header = hdr;
 	pgm->deleted = 0;
 	pgm->undeleted = 1;
@@ -4104,8 +4109,12 @@
 		/* fprintf(p, "X-Asterisk-VM-Orig-Mailbox: %s" ENDL, ext); */
 		fprintf(p, "X-Asterisk-VM-Server-Name: %s" ENDL, fromstring);
 		fprintf(p, "X-Asterisk-VM-Context: %s" ENDL, context);
+#ifdef IMAP_STORAGE
+		fprintf(p, "X-Asterisk-VM-Extension: %s" ENDL, (!ast_strlen_zero(vmu->imapvmshareid) ? vmu->imapvmshareid : mailbox));
+#else
 		fprintf(p, "X-Asterisk-VM-Extension: %s" ENDL, mailbox);
-                /* flag added for Urgent */
+#endif
+		/* flag added for Urgent */
 		fprintf(p, "X-Asterisk-VM-Flag: %s" ENDL, flag);
 		fprintf(p, "X-Asterisk-VM-Priority: %d" ENDL, chan->priority);
 		fprintf(p, "X-Asterisk-VM-Caller-channel: %s" ENDL, chan->name);
@@ -5379,9 +5388,12 @@
 	
 	ast_debug(3, "Copying sequence %s to mailbox %s\n", sequence, mbox(box));
 	ast_mutex_lock(&vms->lock);
+	/* if save to Old folder, put in INBOX as read */
 	if (box == OLD_FOLDER) {
 		mail_setflag(vms->mailstream, sequence, "\\Seen");
+		mail_clearflag(vms->mailstream, sequence, "\\Unseen");
 	} else if (box == NEW_FOLDER) {
+		mail_setflag(vms->mailstream, sequence, "\\Unseen");
 		mail_clearflag(vms->mailstream, sequence, "\\Seen");
 	}
 	if (!strcasecmp(mbox(NEW_FOLDER), vms->curbox) && (box == NEW_FOLDER || box == OLD_FOLDER)) {

Modified: team/moy/mfcr2/apps/app_waitforsilence.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/apps/app_waitforsilence.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/apps/app_waitforsilence.c (original)
+++ team/moy/mfcr2/apps/app_waitforsilence.c Wed Feb 11 23:24:07 2009
@@ -210,7 +210,9 @@
 	int iterations = 1, i;
 	time_t waitstart;
 
-	res = ast_answer(chan); /* Answer the channel */
+	if (chan->_state != AST_STATE_UP) {
+		res = ast_answer(chan); /* Answer the channel */
+	}
 
 	if (!data || ( (sscanf(data, "%d,%d,%d", &timereqd, &iterations, &timeout) != 3) &&
 		(sscanf(data, "%d,%d", &timereqd, &iterations) != 2) &&

Modified: team/moy/mfcr2/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/team/moy/mfcr2/channels/chan_dahdi.c?view=diff&rev=175028&r1=175027&r2=175028
==============================================================================
--- team/moy/mfcr2/channels/chan_dahdi.c (original)
+++ team/moy/mfcr2/channels/chan_dahdi.c Wed Feb 11 23:24:07 2009
@@ -1395,7 +1395,7 @@
 
 struct dahdi_pvt *round_robin[32];
 
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 static inline int pri_grab(struct dahdi_pvt *pvt, struct dahdi_pri *pri)
 {
 	int res;
@@ -1411,14 +1411,16 @@
 		pthread_kill(pri->master, SIGURG);
 	return 0;
 }
-#endif
-
-#ifdef HAVE_SS7
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_SS7)
 static inline void ss7_rel(struct dahdi_ss7 *ss7)
 {
 	ast_mutex_unlock(&ss7->lock);
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static inline int ss7_grab(struct dahdi_pvt *pvt, struct dahdi_ss7 *pri)
 {
 	int res;
@@ -1434,7 +1436,7 @@
 		pthread_kill(pri->master, SIGURG);
 	return 0;
 }
-#endif
+#endif	/* defined(HAVE_SS7) */
 #define NUM_CADENCE_MAX 25
 static int num_cadence = 4;
 static int user_has_defined_cadences = 0;
@@ -2053,21 +2055,21 @@
 	chan_pvt->subs[sub_num].dfd = -1;
 }
 
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 static void dahdi_close_pri_fd(struct dahdi_pri *pri, int fd_num)
 {
 	dahdi_close(pri->fds[fd_num]);
 	pri->fds[fd_num] = -1;
 }
-#endif
-
-#ifdef HAVE_SS7
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_SS7)
 static void dahdi_close_ss7_fd(struct dahdi_ss7 *ss7, int fd_num)
 {
 	dahdi_close(ss7->fds[fd_num]);
 	ss7->fds[fd_num] = -1;
 }
-#endif
+#endif	/* defined(HAVE_SS7) */
 
 static int dahdi_setlinear(int dfd, int linear)
 {
@@ -2998,17 +3000,19 @@
 	return 0;
 }
 
-#ifdef HAVE_SS7
+#if defined(HAVE_SS7)
 static unsigned char cid_pres2ss7pres(int cid_pres)
 {
 	 return (cid_pres >> 5) & 0x03;
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static unsigned char cid_pres2ss7screen(int cid_pres)
 {
 	return cid_pres & 0x03;
 }
-#endif
+#endif	/* defined(HAVE_SS7) */
 
 static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
 {
@@ -3857,7 +3861,7 @@
 	ast_mutex_unlock(&iflock);
 }
 
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 static char *dahdi_send_keypad_facility_app = "DAHDISendKeypadFacility";
 
 static int dahdi_send_keypad_facility_exec(struct ast_channel *chan, void *data)
@@ -3899,9 +3903,10 @@
 
 	return 0;
 }
-
-#ifdef HAVE_PRI_PROG_W_CAUSE
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
+#if defined(HAVE_PRI_PROG_W_CAUSE)
 static char *dahdi_send_callrerouting_facility_app = "DAHDISendCallreroutingFacility";
 
 static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, void *data)
@@ -3973,9 +3978,10 @@
 
 	return res;
 }
-
-#endif
-
+#endif	/* defined(HAVE_PRI_PROG_W_CAUSE) */
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_is_up(struct dahdi_pri *pri)
 {
 	int x;
@@ -3985,7 +3991,9 @@
 	}
 	return 0;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_assign_bearer(struct dahdi_pvt *crv, struct dahdi_pri *pri, struct dahdi_pvt *bearer)
 {
 	bearer->owner = &inuse;
@@ -3998,7 +4006,9 @@
 	crv->pri = pri;
 	return 0;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static char *pri_order(int level)
 {
 	switch (level) {
@@ -4014,7 +4024,9 @@
 		return "<Unknown>";
 	}
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /* Returns fd of the active dchan */
 static int pri_active_dchan_fd(struct dahdi_pri *pri)
 {
@@ -4027,7 +4039,9 @@
 
 	return pri->fds[x];
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_find_dchan(struct dahdi_pri *pri)
 {
 	int oldslot = -1;
@@ -4056,7 +4070,7 @@
 	pri->pri = pri->dchans[newslot];
 	return 0;
 }
-#endif
+#endif	/* defined(HAVE_PRI) */
 
 static int dahdi_hangup(struct ast_channel *ast)
 {
@@ -9330,7 +9344,7 @@
 	return 0;
 }
 
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 static int pri_resolve_span(int *span, int channel, int offset, struct dahdi_spaninfo *si)
 {
 	int x;
@@ -9376,7 +9390,9 @@
 	}
 	return 0;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_create_trunkgroup(int trunkgroup, int *channels)
 {
 	struct dahdi_spaninfo si;
@@ -9439,7 +9455,9 @@
 	}
 	return 0;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_create_spanmap(int span, int trunkgroup, int logicalspan)
 {
 	if (pris[span].mastertrunkgroup) {
@@ -9450,11 +9468,9 @@
 	pris[span].prilogicalspan = logicalspan;
 	return 0;
 }
-
-#endif
-
-#ifdef HAVE_SS7
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_SS7)
 static unsigned int parse_pointcode(const char *pcstring)
 {
 	unsigned int code1, code2, code3;
@@ -9468,7 +9484,9 @@
 
 	return 0;
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static struct dahdi_ss7 * ss7_resolve_linkset(int linkset)
 {
 	if ((linkset < 0) || (linkset >= NUM_SPANS))
@@ -9476,7 +9494,7 @@
 	else
 		return &linksets[linkset - 1];
 }
-#endif /* HAVE_SS7 */
+#endif	/* defined(HAVE_SS7) */
 
 #ifdef HAVE_OPENR2
 static void dahdi_r2_destroy_links(void)
@@ -10085,7 +10103,7 @@
 		tmp->cid_ton = 0;
 		ast_copy_string(tmp->cid_name, conf->chan.cid_name, sizeof(tmp->cid_name));
 		ast_copy_string(tmp->mailbox, conf->chan.mailbox, sizeof(tmp->mailbox));
-		if (!ast_strlen_zero(tmp->mailbox)) {
+		if (channel != CHAN_PSEUDO && !ast_strlen_zero(tmp->mailbox)) {
 			char *mailbox, *context;
 			mailbox = context = ast_strdupa(tmp->mailbox);
 			strsep(&context, "@");
@@ -10372,8 +10390,7 @@
 	return p;
 }
 
-
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 static int pri_find_empty_chan(struct dahdi_pri *pri, int backwards)
 {
 	int x;
@@ -10398,7 +10415,7 @@
 	}
 	return -1;
 }
-#endif
+#endif	/* defined(HAVE_PRI) */
 
 static struct ast_channel *dahdi_request(const char *type, int format, void *data, int *cause)
 {
@@ -10658,10 +10675,9 @@
 {
 	return ioctl(dfd, DAHDI_SETLAW, &law);
 }
-#endif
-
-#ifdef HAVE_SS7
-
+#endif	/* defined(HAVE_PRI) || defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static int ss7_find_cic(struct dahdi_ss7 *linkset, int cic, unsigned int dpc)
 {
 	int i;
@@ -10674,7 +10690,9 @@
 	}
 	return winner;
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static void ss7_handle_cqm(struct dahdi_ss7 *linkset, int startcic, int endcic, unsigned int dpc)
 {
 	unsigned char status[32];
@@ -10706,7 +10724,9 @@
 		ast_log(LOG_WARNING, "Could not find any equipped circuits within CQM CICs\n");
 
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static inline void ss7_hangup_cics(struct dahdi_ss7 *linkset, int startcic, int endcic, unsigned int dpc)
 {
 	int i;
@@ -10720,7 +10740,9 @@
 		}
 	}
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static inline void ss7_block_cics(struct dahdi_ss7 *linkset, int startcic, int endcic, unsigned int dpc, unsigned char state[], int block)
 {
 	int i;
@@ -10735,7 +10757,9 @@
 		}
 	}
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static void ss7_inservice(struct dahdi_ss7 *linkset, int startcic, int endcic, unsigned int dpc)
 {
 	int i;
@@ -10745,7 +10769,9 @@
 			linkset->pvts[i]->inservice = 1;
 	}
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static void ss7_reset_linkset(struct dahdi_ss7 *linkset)
 {
 	int i, startcic = -1, endcic, dpc;
@@ -10773,7 +10799,9 @@
 		}
 	}
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static void dahdi_loopback(struct dahdi_pvt *p, int enable)
 {
 	if (p->loopedback != enable) {
@@ -10784,7 +10812,9 @@
 		p->loopedback = enable;
 	}
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 /* XXX: This function is assumed to be called with the private channel lock and linkset lock held */
 static void ss7_start_call(struct dahdi_pvt *p, struct dahdi_ss7 *linkset)
 {
@@ -10901,7 +10931,9 @@
 	ast_mutex_lock(&p->lock);
 	ast_mutex_lock(&linkset->lock);
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static void ss7_apply_plan_to_number(char *buf, size_t size, const struct dahdi_ss7 *ss7, const char *number, const unsigned nai)
 {
 	switch (nai) {
@@ -10922,11 +10954,16 @@
 		break;
 	}
 }
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static int ss7_pres_scr2cid_pres(char presentation_ind, char screening_ind)
 {
 	return ((presentation_ind & 0x3) << 5) | (screening_ind & 0x3);
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static void *ss7_linkset(void *data)
 {
 	int res, i;
@@ -11455,7 +11492,9 @@
 
 	return 0;
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static void dahdi_ss7_message(struct ss7 *ss7, char *s)
 {
 #if 0
@@ -11470,7 +11509,9 @@
 	ast_verbose("%s", s);
 #endif
 }
-
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
 static void dahdi_ss7_error(struct ss7 *ss7, char *s)
 {
 #if 0
@@ -11484,10 +11525,9 @@
 	ast_log(LOG_ERROR, "%s", s);
 #endif
 }
-
-#endif /* HAVE_SS7 */
-
-#ifdef HAVE_OPENR2
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_OPENR2)
 static void *mfcr2_monitor(void *data)
 {
 	struct dahdi_mfcr2 *mfcr2 = data;
@@ -11559,9 +11599,9 @@
 	ast_log(LOG_NOTICE, "Quitting MFC/R2 monitor thread\n");
 	return 0;
 }
-#endif
-
-#ifdef HAVE_PRI
+#endif /* HAVE_OPENR2 */
+
+#if defined(HAVE_PRI)
 static struct dahdi_pvt *pri_find_crv(struct dahdi_pri *pri, int crv)
 {
 	struct dahdi_pvt *p;
@@ -11573,8 +11613,9 @@
 	}
 	return NULL;
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_find_principle(struct dahdi_pri *pri, int channel)
 {
 	int x;
@@ -11601,7 +11642,9 @@
 
 	return principle;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_fixup_principle(struct dahdi_pri *pri, int principle, q931_call *c)
 {
 	int x;
@@ -11684,7 +11727,9 @@
 	ast_log(LOG_WARNING, "Call specified, but not found?\n");
 	return -1;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static void *do_idle_thread(void *vchan)
 {
 	struct ast_channel *chan = vchan;
@@ -11732,7 +11777,9 @@
 	ast_hangup(chan);
 	return NULL;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 #ifndef PRI_RESTART
 #error "Upgrade your libpri"
 #endif
@@ -11774,7 +11821,9 @@
 
 	ast_mutex_unlock(&pridebugfdlock);
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static void dahdi_pri_error(struct pri *pri, char *s)
 {
 	int x, y;
@@ -11813,7 +11862,9 @@
 
 	ast_mutex_unlock(&pridebugfdlock);
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_check_restart(struct dahdi_pri *pri)
 {
 	do {
@@ -11832,7 +11883,9 @@
 	}
 	return 0;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_hangup_all(struct dahdi_pvt *p, struct dahdi_pri *pri)
 {
 	int x;
@@ -11856,7 +11909,9 @@
 	ast_mutex_lock(&pri->lock);
 	return 0;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static char * redirectingreason2str(int redirectingreason)
 {
 	switch (redirectingreason) {
@@ -11872,7 +11927,9 @@
 		return "NOREDIRECT";
 	}
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static void apply_plan_to_number(char *buf, size_t size, const struct dahdi_pri *pri, const char *number, const int plan)
 {
 	if (pri->dialplan == -2) { /* autodetect the TON but leave the number untouched */
@@ -11900,8 +11957,9 @@
 		break;
 	}
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static void *pri_dchannel(void *vpri)
 {
 	struct dahdi_pri *pri = vpri;
@@ -13010,7 +13068,9 @@
 	/* Never reached */
 	return NULL;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int start_pri(struct dahdi_pri *pri)
 {
 	int res, x;
@@ -13110,7 +13170,9 @@
 	}
 	return 0;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)

[... 4401 lines stripped ...]



More information about the asterisk-commits mailing list