[asterisk-commits] murf: branch murf/bug_7638 r78994 - in /team/murf/bug_7638: ./ apps/ channels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 10 10:12:41 CDT 2007


Author: murf
Date: Fri Aug 10 10:12:40 2007
New Revision: 78994

URL: http://svn.digium.com/view/asterisk?view=rev&rev=78994
Log:
Merged revisions 78570,78590,78635,78637,78648-78649,78679,78683,78685-78686,78718,78747 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r78570 | file | 2007-08-08 07:52:13 -0600 (Wed, 08 Aug 2007) | 12 lines

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

........
r78569 | file | 2007-08-08 10:51:01 -0300 (Wed, 08 Aug 2007) | 4 lines

(closes issue #10335)
Reported by: adamgundy
Update sip.conf to include another scenario where directrtpsetup will fail.

........

................
r78590 | mmichelson | 2007-08-08 08:34:10 -0600 (Wed, 08 Aug 2007) | 12 lines

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

........
r78575 | mmichelson | 2007-08-08 09:26:36 -0500 (Wed, 08 Aug 2007) | 4 lines

Changing a bit of logic so that someone will NEVER exit the queue on timeout unless they have enabled the 'n' option.
This commit relates to issue #10320. Thanks to jfitzgibbon for detailing the idea behind this code change.


........

................
r78635 | mmichelson | 2007-08-08 12:34:16 -0600 (Wed, 08 Aug 2007) | 11 lines

Blocked revisions 78620 via svnmerge

........
r78620 | mmichelson | 2007-08-08 13:16:49 -0500 (Wed, 08 Aug 2007) | 4 lines

Fixed some compiler warnings so that compiling with dev-mode and IMAP storage would not have any errors.
This section of code may get changed again shortly since my change uncovers a rather silly bit of logic.


........

................
r78637 | file | 2007-08-08 13:03:46 -0600 (Wed, 08 Aug 2007) | 2 lines

Correct spelling. s/threaads/threads/

................
r78648 | qwell | 2007-08-08 13:30:33 -0600 (Wed, 08 Aug 2007) | 10 lines

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

........
r78646 | qwell | 2007-08-08 14:29:42 -0500 (Wed, 08 Aug 2007) | 2 lines

Fix mogs email address.

........

................
r78649 | file | 2007-08-08 13:30:52 -0600 (Wed, 08 Aug 2007) | 2 lines

Merge audiohooks branch into trunk. This is a new API for developers to listen and manipulate the audio going through a channel.

................
r78679 | file | 2007-08-08 14:49:07 -0600 (Wed, 08 Aug 2007) | 2 lines

HAVEL_SS7 should be HAVE_SS7. Reported by kwallace.

................
r78683 | file | 2007-08-08 15:44:58 -0600 (Wed, 08 Aug 2007) | 2 lines

Add support for using epoll instead of poll. This should increase scalability and is done in such a way that we should be able to add support for other poll() replacements.

................
r78685 | file | 2007-08-08 15:58:12 -0600 (Wed, 08 Aug 2007) | 2 lines

Minor fix for building under dev mode when byteswapping macro header files are not available.

................
r78686 | file | 2007-08-08 16:05:45 -0600 (Wed, 08 Aug 2007) | 2 lines

Regenerate configure script. This actually just updated the revision number... since my last merge changed it to an older number, while it was in fact generated from a much newer revision.

................
r78718 | russell | 2007-08-09 10:13:26 -0600 (Thu, 09 Aug 2007) | 15 lines

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

........
r78717 | russell | 2007-08-09 11:12:57 -0500 (Thu, 09 Aug 2007) | 7 lines

Fix a problem with the combination of the 'F' option to pass DTMF through a
conference and options that use DTMF to activate various features.  The problem
was that the BEGIN frame would be passed through, but the END frame would get
intercepted to activate a feature.  Then, the other conference members would hear
DTMF for forever, which they didn't seem to like very much.
(closes issue #10400, reported by stevefeinstein, fixed by me)

........

................
r78747 | russell | 2007-08-09 11:07:36 -0600 (Thu, 09 Aug 2007) | 4 lines

Fix a problem that I had introduced into MWI handling.  I had ignored
the mailbox context.  Now, all related MWI event dealings pay attention
to the context as well.

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

Added:
    team/murf/bug_7638/funcs/func_volume.c
      - copied unchanged from r78747, trunk/funcs/func_volume.c
    team/murf/bug_7638/include/asterisk/audiohook.h
      - copied unchanged from r78747, trunk/include/asterisk/audiohook.h
    team/murf/bug_7638/main/audiohook.c
      - copied unchanged from r78747, trunk/main/audiohook.c
    team/murf/bug_7638/res/ael/pval.c
      - copied unchanged from r78747, team/murf/bug_7638/main/pval.c
Removed:
    team/murf/bug_7638/include/asterisk/chanspy.h
    team/murf/bug_7638/main/pval.c
Modified:
    team/murf/bug_7638/   (props changed)
    team/murf/bug_7638/apps/app_chanspy.c
    team/murf/bug_7638/apps/app_dial.c
    team/murf/bug_7638/apps/app_meetme.c
    team/murf/bug_7638/apps/app_mixmonitor.c
    team/murf/bug_7638/apps/app_queue.c
    team/murf/bug_7638/apps/app_voicemail.c
    team/murf/bug_7638/channels/chan_agent.c
    team/murf/bug_7638/channels/chan_alsa.c
    team/murf/bug_7638/channels/chan_features.c
    team/murf/bug_7638/channels/chan_gtalk.c
    team/murf/bug_7638/channels/chan_h323.c
    team/murf/bug_7638/channels/chan_iax2.c
    team/murf/bug_7638/channels/chan_jingle.c
    team/murf/bug_7638/channels/chan_mgcp.c
    team/murf/bug_7638/channels/chan_misdn.c
    team/murf/bug_7638/channels/chan_nbs.c
    team/murf/bug_7638/channels/chan_oss.c
    team/murf/bug_7638/channels/chan_phone.c
    team/murf/bug_7638/channels/chan_sip.c
    team/murf/bug_7638/channels/chan_skinny.c
    team/murf/bug_7638/channels/chan_zap.c
    team/murf/bug_7638/configs/sip.conf.sample
    team/murf/bug_7638/configure
    team/murf/bug_7638/configure.ac
    team/murf/bug_7638/doc/jabber.txt
    team/murf/bug_7638/include/asterisk/autoconfig.h.in
    team/murf/bug_7638/include/asterisk/channel.h
    team/murf/bug_7638/include/asterisk/event_defs.h
    team/murf/bug_7638/include/asterisk/slinfactory.h
    team/murf/bug_7638/main/Makefile
    team/murf/bug_7638/main/channel.c
    team/murf/bug_7638/main/rtp.c
    team/murf/bug_7638/main/slinfactory.c
    team/murf/bug_7638/res/Makefile
    team/murf/bug_7638/utils/Makefile

Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

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

Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Aug 10 10:12:40 2007
@@ -1,1 +1,1 @@
-/trunk:1-78564
+/trunk:1-78748

Modified: team/murf/bug_7638/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_chanspy.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/apps/app_chanspy.c (original)
+++ team/murf/bug_7638/apps/app_chanspy.c Fri Aug 10 10:12:40 2007
@@ -40,7 +40,7 @@
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
-#include "asterisk/chanspy.h"
+#include "asterisk/audiohook.h"
 #include "asterisk/features.h"
 #include "asterisk/options.h"
 #include "asterisk/app.h"
@@ -166,7 +166,8 @@
 
 struct chanspy_translation_helper {
 	/* spy data */
-	struct ast_channel_spy spy;
+	struct ast_audiohook spy_audiohook;
+	struct ast_audiohook whisper_audiohook;
 	int fd;
 	int volfactor;
 };
@@ -185,15 +186,18 @@
 static int spy_generate(struct ast_channel *chan, void *data, int len, int samples) 
 {
 	struct chanspy_translation_helper *csth = data;
-	struct ast_frame *f;
+	struct ast_frame *f = NULL;
 		
-	if (csth->spy.status != CHANSPY_RUNNING)
+	ast_audiohook_lock(&csth->spy_audiohook);
+	if (csth->spy_audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING) {
 		/* Channel is already gone more than likely */
+		ast_audiohook_unlock(&csth->spy_audiohook);
 		return -1;
-
-	ast_mutex_lock(&csth->spy.lock);
-	f = ast_channel_spy_read_frame(&csth->spy, samples);
-	ast_mutex_unlock(&csth->spy.lock);
+	}
+
+	f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR);
+
+	ast_audiohook_unlock(&csth->spy_audiohook);
 		
 	if (!f)
 		return 0;
@@ -217,50 +221,19 @@
 	.generate = spy_generate, 
 };
 
-static int start_spying(struct ast_channel *chan, struct ast_channel *spychan, struct ast_channel_spy *spy) 
-{
-	int res;
-	struct ast_channel *peer;
+static int start_spying(struct ast_channel *chan, struct ast_channel *spychan, struct ast_audiohook *audiohook) 
+{
+	int res = 0;
+	struct ast_channel *peer = NULL;
 
 	ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan->name, chan->name);
 
-	ast_channel_lock(chan);
-	res = ast_channel_spy_add(chan, spy);
-	ast_channel_unlock(chan);
+	res = ast_audiohook_attach(chan, audiohook);
 
 	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
 		ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);	
 
 	return res;
-}
-
-/* Map 'volume' levels from -4 through +4 into
-   decibel (dB) settings for channel drivers
-*/
-static signed char volfactor_map[] = {
-	-24,
-	-18,
-	-12,
-	-6,
-	0,
-	6,
-	12,
-	18,
-	24,
-};
-
-/* attempt to set the desired gain adjustment via the channel driver;
-   if successful, clear it out of the csth structure so the
-   generator will not attempt to do the adjustment itself
-*/
-static void set_volume(struct ast_channel *chan, struct chanspy_translation_helper *csth)
-{
-	signed char volume_adjust = volfactor_map[csth->volfactor + 4];
-
-	if (!ast_channel_setoption(chan, AST_OPTION_TXGAIN, &volume_adjust, sizeof(volume_adjust), 0))
-		csth->volfactor = 0;
-	csth->spy.read_vol_adjustment = csth->volfactor;
-	csth->spy.write_vol_adjustment = csth->volfactor;
 }
 
 static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int *volfactor, int fd,
@@ -280,49 +253,17 @@
 	ast_verb(2, "Spying on channel %s\n", name);
 
 	memset(&csth, 0, sizeof(csth));
-	ast_set_flag(&csth.spy, CHANSPY_FORMAT_AUDIO);
-	ast_set_flag(&csth.spy, CHANSPY_TRIGGER_NONE);
-	if (!ast_test_flag(flags, OPTION_READONLY))
-		ast_set_flag(&csth.spy, CHANSPY_MIXAUDIO);
-	csth.spy.type = "ChanSpy";
-	csth.spy.status = CHANSPY_RUNNING;
-	csth.spy.read_queue.format = AST_FORMAT_SLINEAR;
-	csth.spy.write_queue.format = AST_FORMAT_SLINEAR;
-	ast_mutex_init(&csth.spy.lock);
-	csth.volfactor = *volfactor;
-	set_volume(chan, &csth);
-	if (csth.volfactor) {
-		ast_set_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
-		csth.spy.read_vol_adjustment = csth.volfactor;
-		ast_set_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
-		csth.spy.write_vol_adjustment = csth.volfactor;
-	}
-	csth.fd = fd;
+
+	ast_audiohook_init(&csth.spy_audiohook, AST_AUDIOHOOK_TYPE_SPY, "ChanSpy");
 	
-	if (start_spying(spyee, chan, &csth.spy)) {
-		ast_mutex_destroy(&csth.spy.lock);
+	if (start_spying(spyee, chan, &csth.spy_audiohook)) {
+		ast_audiohook_destroy(&csth.spy_audiohook);
 		return 0;
 	}
 
 	if (ast_test_flag(flags, OPTION_WHISPER)) {
-		struct ast_filestream *beepstream;
-		int old_write_format = 0;
-
-		ast_channel_whisper_start(csth.spy.chan);
-		old_write_format = chan->writeformat;
-		if ((beepstream = ast_openstream_full(chan, "beep", chan->language, 1))) {
-			struct ast_frame *f;
-
-			while ((f = ast_readframe(beepstream))) {
-				ast_channel_whisper_feed(csth.spy.chan, f);
-				ast_frfree(f);
-			}
-
-			ast_closestream(beepstream);
-			chan->stream = NULL;
-		}
-		if (old_write_format)
-			ast_set_write_format(chan, old_write_format);
+		ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
+		start_spying(spyee, chan, &csth.whisper_audiohook);
 	}
 
 	if (ast_test_flag(flags, OPTION_PRIVATE))
@@ -344,21 +285,20 @@
 	   has arrived, since the spied-on channel could have gone away while
 	   we were waiting
 	*/
-	while ((res = ast_waitfor(chan, -1) > -1) &&
-	       csth.spy.status == CHANSPY_RUNNING &&
-	       csth.spy.chan) {
+	while ((res = ast_waitfor(chan, -1) > -1) && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
 		if (!(f = ast_read(chan)) || ast_check_hangup(chan)) {
 			running = -1;
 			break;
 		}
 
-		if (ast_test_flag(flags, OPTION_WHISPER) &&
-		    (f->frametype == AST_FRAME_VOICE)) {
-			ast_channel_whisper_feed(csth.spy.chan, f);
+		if (ast_test_flag(flags, OPTION_WHISPER) && f->frametype == AST_FRAME_VOICE) {
+			ast_audiohook_lock(&csth.whisper_audiohook);
+			ast_audiohook_write_frame(&csth.whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
+			ast_audiohook_unlock(&csth.whisper_audiohook);
 			ast_frfree(f);
 			continue;
 		}
-
+		
 		res = (f->frametype == AST_FRAME_DTMF) ? f->subclass : 0;
 		ast_frfree(f);
 		if (!res)
@@ -401,37 +341,25 @@
 			if (*volfactor > 4)
 				*volfactor = -4;
 			ast_verb(3, "Setting spy volume on %s to %d\n", chan->name, *volfactor);
-			csth.volfactor = *volfactor;
-			set_volume(chan, &csth);
-			if (csth.volfactor) {
-				ast_set_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
-				csth.spy.read_vol_adjustment = csth.volfactor;
-				ast_set_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
-				csth.spy.write_vol_adjustment = csth.volfactor;
-			} else {
-				ast_clear_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
-				ast_clear_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
-			}
-		}
-	}
-
-	if (ast_test_flag(flags, OPTION_WHISPER) && csth.spy.chan)
-		ast_channel_whisper_stop(csth.spy.chan);
+		}
+	}
 
 	if (ast_test_flag(flags, OPTION_PRIVATE))
 		ast_channel_stop_silence_generator(chan, silgen);
 	else
 		ast_deactivate_generator(chan);
 
-	csth.spy.status = CHANSPY_DONE;
-
-	/* If a channel still exists on our spy structure then we need to remove ourselves */
-	if (csth.spy.chan) {
-		ast_channel_lock(csth.spy.chan);
-		ast_channel_spy_remove(csth.spy.chan, &csth.spy);
-		ast_channel_unlock(csth.spy.chan);
-	}
-	ast_channel_spy_free(&csth.spy);
+	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);
+	}
+
+	ast_audiohook_lock(&csth.spy_audiohook);
+	ast_audiohook_detach(&csth.spy_audiohook);
+	ast_audiohook_unlock(&csth.spy_audiohook);
+	ast_audiohook_destroy(&csth.spy_audiohook);
 	
 	if (option_verbose >= 2)
 		ast_verbose(VERBOSE_PREFIX_2 "Done Spying on channel %s\n", name);

Modified: team/murf/bug_7638/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_dial.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/apps/app_dial.c (original)
+++ team/murf/bug_7638/apps/app_dial.c Fri Aug 10 10:12:40 2007
@@ -560,6 +560,9 @@
 	struct ast_channel *peer = NULL;
 	/* single is set if only one destination is enabled */
 	int single = outgoing && !outgoing->next && !ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK);
+#ifdef HAVE_EPOLL
+	struct chanlist *epollo;
+#endif
 	
 	if (single) {
 		/* Turn off hold music, etc */
@@ -567,7 +570,11 @@
 		/* If we are calling a single channel, make them compatible for in-band tone purpose */
 		ast_channel_make_compatible(outgoing->chan, in);
 	}
-	
+
+#ifdef HAVE_EPOLL
+	for (epollo = outgoing; epollo; epollo = epollo->next)
+		ast_poll_channel_add(in, epollo->chan);
+#endif	
 	
 	while (*to && !peer) {
 		struct chanlist *o;
@@ -814,6 +821,11 @@
 		
 	}
 
+#ifdef HAVE_EPOLL
+	for (epollo = outgoing; epollo; epollo = epollo->next)
+		ast_poll_channel_del(in, epollo->chan);
+#endif
+
 	return peer;
 }
 

Modified: team/murf/bug_7638/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_meetme.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/apps/app_meetme.c (original)
+++ team/murf/bug_7638/apps/app_meetme.c Fri Aug 10 10:12:40 2007
@@ -230,8 +230,7 @@
 "      'D' -- dynamically add conference, prompting for a PIN\n"
 "      'e' -- select an empty conference\n"
 "      'E' -- select an empty pinless conference\n"
-"      'F' -- Pass DTMF through the conference.  DTMF used to activate any\n"
-"             conference features will not be passed through.\n"
+"      'F' -- Pass DTMF through the conference.\n"
 "      'i' -- announce user join/leave with review\n"
 "      'I' -- announce user join/leave without review\n"
 "      'l' -- set listen only mode (Listen only, no talking)\n"
@@ -2002,6 +2001,9 @@
 				} else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT)) {
 					char tmp[2];
 
+					if (confflags & CONFFLAG_PASS_DTMF)
+						conf_queue_dtmf(conf, user, f);
+
 					tmp[0] = f->subclass;
 					tmp[1] = '\0';
 					if (!ast_goto_if_exists(chan, exitcontext, tmp, 1)) {
@@ -2020,10 +2022,14 @@
 					
 					pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", exitkey);
 						
+					if (confflags & CONFFLAG_PASS_DTMF)
+						conf_queue_dtmf(conf, user, f);
 					ret = 0;
 					ast_frfree(f);
 					break;
 				} else if (((f->frametype == AST_FRAME_DTMF) && (f->subclass == '*') && (confflags & CONFFLAG_STARMENU)) || ((f->frametype == AST_FRAME_DTMF) && menu_active)) {
+					if (confflags & CONFFLAG_PASS_DTMF)
+						conf_queue_dtmf(conf, user, f);
 					if (ioctl(fd, ZT_SETCONF, &ztc_empty)) {
 						ast_log(LOG_WARNING, "Error setting conference\n");
 						close(fd);

Modified: team/murf/bug_7638/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_mixmonitor.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/apps/app_mixmonitor.c (original)
+++ team/murf/bug_7638/apps/app_mixmonitor.c Fri Aug 10 10:12:40 2007
@@ -45,7 +45,7 @@
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
-#include "asterisk/chanspy.h"
+#include "asterisk/audiohook.h"
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
 #include "asterisk/lock.h"
@@ -93,7 +93,7 @@
 static const char *mixmonitor_spy_type = "MixMonitor";
 
 struct mixmonitor {
-	struct ast_channel_spy spy;
+	struct ast_audiohook audiohook;
 	char *filename;
 	char *post_process;
 	char *name;
@@ -123,17 +123,15 @@
 	AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME),
 });
 
-static int startmon(struct ast_channel *chan, struct ast_channel_spy *spy) 
-{
-	struct ast_channel *peer;
-	int res;
+static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook) 
+{
+	struct ast_channel *peer = NULL;
+	int res = 0;
 
 	if (!chan)
 		return -1;
 
-	ast_channel_lock(chan);
-	res = ast_channel_spy_add(chan, spy);
-	ast_channel_unlock(chan);
+	ast_audiohook_attach(chan, audiohook);
 
 	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
 		ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);	
@@ -146,7 +144,6 @@
 static void *mixmonitor_thread(void *obj) 
 {
 	struct mixmonitor *mixmonitor = obj;
-	struct ast_frame *f = NULL;
 	struct ast_filestream *fs = NULL;
 	unsigned int oflags;
 	char *ext;
@@ -155,59 +152,48 @@
 	if (option_verbose > 1)
 		ast_verbose(VERBOSE_PREFIX_2 "Begin MixMonitor Recording %s\n", mixmonitor->name);
 	
-	ast_mutex_lock(&mixmonitor->spy.lock);
-
-	while (mixmonitor->spy.chan) {
-		struct ast_frame *next;
-		int write;
-
-		ast_channel_spy_trigger_wait(&mixmonitor->spy);
-		
-		if (!mixmonitor->spy.chan || mixmonitor->spy.status != CHANSPY_RUNNING)
+	ast_audiohook_lock(&mixmonitor->audiohook);
+
+	while (mixmonitor->audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
+		struct ast_frame *fr = NULL;
+
+		ast_audiohook_trigger_wait(&mixmonitor->audiohook);
+
+		if (mixmonitor->audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING)
 			break;
-		
-		while (1) {
-			if (!(f = ast_channel_spy_read_frame(&mixmonitor->spy, SAMPLES_PER_FRAME)))
-				break;
-
-			write = (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED) ||
-				 ast_bridged_channel(mixmonitor->spy.chan));
-
-			/* it is possible for ast_channel_spy_read_frame() to return a chain
-			   of frames if a queue flush was necessary, so process them
-			*/
-			for (; f; f = next) {
-				next = AST_LIST_NEXT(f, frame_list);
-				if (write && errflag == 0) {
-					if (!fs) {
-						/* Determine creation flags and filename plus extension for filestream */
-						oflags = O_CREAT | O_WRONLY;
-						oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC;
-
-						if ((ext = strrchr(mixmonitor->filename, '.')))
-							*(ext++) = '\0';
-						else
-							ext = "raw";
-
-						/* Move onto actually creating the filestream */
-						if (!(fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0644))) {
-							ast_log(LOG_ERROR, "Cannot open %s.%s\n", mixmonitor->filename, ext);
-							errflag = 1;
-						}
-
-					}
-					if (fs)
-						ast_writestream(fs, f);
-				}
-				ast_frame_free(f, 0);
+
+		if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR)))
+			continue;
+
+		/* Initialize the file if not already done so */
+		if (!fs && !errflag) {
+			oflags = O_CREAT | O_WRONLY;
+			oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC;
+
+			if ((ext = strrchr(mixmonitor->filename, '.')))
+				*(ext++) = '\0';
+			else
+				ext = "raw";
+
+			if (!(fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0644))) {
+				ast_log(LOG_ERROR, "Cannot open %s.%s\n", mixmonitor->filename, ext);
+				errflag = 1;
 			}
 		}
-	}
-
-	ast_mutex_unlock(&mixmonitor->spy.lock);
-
-	ast_channel_spy_free(&mixmonitor->spy);
-	
+
+		/* Write out frame */
+		if (fs)
+			ast_writestream(fs, fr);
+
+		/* All done! free it. */
+		ast_frame_free(fr, 0);
+
+	}
+
+	ast_audiohook_detach(&mixmonitor->audiohook);
+	ast_audiohook_unlock(&mixmonitor->audiohook);
+	ast_audiohook_destroy(&mixmonitor->audiohook);
+
 	if (option_verbose > 1)
 		ast_verbose(VERBOSE_PREFIX_2 "End MixMonitor Recording %s\n", mixmonitor->name);
 
@@ -270,27 +256,17 @@
 	strcpy(mixmonitor->filename, filename);
 
 	/* Setup the actual spy before creating our thread */
-	ast_set_flag(&mixmonitor->spy, CHANSPY_FORMAT_AUDIO);
-	ast_set_flag(&mixmonitor->spy, CHANSPY_MIXAUDIO);
-	mixmonitor->spy.type = mixmonitor_spy_type;
-	mixmonitor->spy.status = CHANSPY_RUNNING;
-	mixmonitor->spy.read_queue.format = AST_FORMAT_SLINEAR;
-	mixmonitor->spy.write_queue.format = AST_FORMAT_SLINEAR;
-	if (readvol) {
-		ast_set_flag(&mixmonitor->spy, CHANSPY_READ_VOLADJUST);
-		mixmonitor->spy.read_vol_adjustment = readvol;
-	}
-	if (writevol) {
-		ast_set_flag(&mixmonitor->spy, CHANSPY_WRITE_VOLADJUST);
-		mixmonitor->spy.write_vol_adjustment = writevol;
-	}
-	ast_mutex_init(&mixmonitor->spy.lock);
-
-	if (startmon(chan, &mixmonitor->spy)) {
+	if (ast_audiohook_init(&mixmonitor->audiohook, AST_AUDIOHOOK_TYPE_SPY, mixmonitor_spy_type)) {
+		free(mixmonitor);
+		return;
+	}
+
+	ast_set_flag(&mixmonitor->audiohook, AST_AUDIOHOOK_TRIGGER_WRITE);
+
+	if (startmon(chan, &mixmonitor->audiohook)) {
 		ast_log(LOG_WARNING, "Unable to add '%s' spy to channel '%s'\n",
-			mixmonitor->spy.type, chan->name);
-		/* Since we couldn't add ourselves - bail out! */
-		ast_mutex_destroy(&mixmonitor->spy.lock);
+			mixmonitor_spy_type, chan->name);
+		ast_audiohook_destroy(&mixmonitor->audiohook);
 		ast_free(mixmonitor);
 		return;
 	}
@@ -382,9 +358,7 @@
 
 static int stop_mixmonitor_exec(struct ast_channel *chan, void *data)
 {
-	ast_channel_lock(chan);
-	ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
-	ast_channel_unlock(chan);
+	ast_audiohook_detach_source(chan, mixmonitor_spy_type);
 	return 0;
 }
 
@@ -400,12 +374,13 @@
 		return RESULT_SUCCESS;
 	}
 
-	if (!strcasecmp(argv[1], "start"))
+	if (!strcasecmp(argv[1], "start")) {
 		mixmonitor_exec(chan, argv[3]);
-	else if (!strcasecmp(argv[1], "stop"))
-		ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
-
-	ast_channel_unlock(chan);
+		ast_channel_unlock(chan);
+	} else {
+		ast_channel_unlock(chan);
+		ast_audiohook_detach_source(chan, mixmonitor_spy_type);
+	}
 
 	return RESULT_SUCCESS;
 }

Modified: team/murf/bug_7638/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_queue.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/apps/app_queue.c (original)
+++ team/murf/bug_7638/apps/app_queue.c Fri Aug 10 10:12:40 2007
@@ -2456,7 +2456,7 @@
 		qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, vars_len) : "");
 }
 
-static int try_calling(struct queue_ent *qe, const char *options, char *announceoverride, const char *url, int *go_on, const char *agi, const char *macro, const char *gosub, int ringing)
+static int try_calling(struct queue_ent *qe, const char *options, char *announceoverride, const char *url, int *tries, int *noption, const char *agi, const char *macro, const char *gosub, int ringing)
 {
 	struct member *cur;
 	struct callattempt *outgoing = NULL; /* the list of calls we are building */
@@ -2494,7 +2494,6 @@
 	char vars[2048];
 	int forwardsallowed = 1;
 	int callcompletedinsl;
-	int noption = 0;
 
 	memset(&bridge_config, 0, sizeof(bridge_config));
 	time(&now);
@@ -2524,18 +2523,15 @@
 			break;
 		case 'n':
 			if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY)
-				(*go_on)++;
+				(*tries)++;
 			else
-				*go_on = qe->parent->membercount;
-			noption = 1;
+				*tries = qe->parent->membercount;
+			*noption = 1;
 			break;
 		case 'i':
 			forwardsallowed = 0;
 			break;
 		}
-
-	if(!noption)
-		*go_on = -1;
 
 	/* Hold the lock while we setup the outgoing calls */
 	if (use_weight)
@@ -3505,7 +3501,8 @@
 	int max_penalty;
 	enum queue_result reason = QUEUE_UNKNOWN;
 	/* whether to exit Queue application after the timeout hits */
-	int go_on = 0;
+	int tries = 0;
+	int noption = 0;
 	char *parse;
 	int makeannouncement = 0;
 	AST_DECLARE_APP_ARGS(args,
@@ -3633,14 +3630,14 @@
 					goto stop;
 
 			/* Try calling all queue members for 'timeout' seconds */
-			res = try_calling(&qe, args.options, args.announceoverride, args.url, &go_on, args.agi, args.macro, args.gosub, ringing);
+			res = try_calling(&qe, args.options, args.announceoverride, args.url, &tries, &noption, args.agi, args.macro, args.gosub, ringing);
 			if (res)
 				goto stop;
 
 			stat = get_member_status(qe.parent, qe.max_penalty);
 
 			/* exit after 'timeout' cycle if 'n' option enabled */
-			if (go_on >= qe.parent->membercount) {
+			if (noption && tries >= qe.parent->membercount) {
 				ast_verb(3, "Exiting on time-out cycle\n");
 				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
 				record_abandoned(&qe);

Modified: team/murf/bug_7638/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_voicemail.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/apps/app_voicemail.c (original)
+++ team/murf/bug_7638/apps/app_voicemail.c Fri Aug 10 10:12:40 2007
@@ -3997,15 +3997,17 @@
 static void queue_mwi_event(const char *mbox, int new, int old)
 {
 	struct ast_event *event;
-	char *mailbox;
+	char *mailbox, *context;
 
 	/* Strip off @default */
-	mailbox = ast_strdupa(mbox);
-	if (strstr(mailbox, "@default"))
-		mailbox = strsep(&mailbox, "@");
+	context = mailbox = ast_strdupa(mbox);
+	strsep(&context, "@");
+	if (ast_strlen_zero(context))
+		context = "default";
 
 	if (!(event = ast_event_new(AST_EVENT_MWI,
 			AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+			AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
 			AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, new,
 			AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, old,
 			AST_EVENT_IE_END))) {
@@ -4014,6 +4016,7 @@
 
 	ast_event_queue_and_cache(event,
 		AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR,
+		AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR,
 		AST_EVENT_IE_END);
 }
 

Modified: team/murf/bug_7638/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_agent.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/channels/chan_agent.c (original)
+++ team/murf/bug_7638/channels/chan_agent.c Fri Aug 10 10:12:40 2007
@@ -207,9 +207,9 @@
 	if (p->chan) { \
 		for (x=0;x<AST_MAX_FDS;x++) {\
 			if (x != AST_TIMING_FD) \
-				ast->fds[x] = p->chan->fds[x]; \
+				ast_channel_set_fd(ast, x, p->chan->fds[x]); \
 		} \
-		ast->fds[AST_AGENT_FD] = p->chan->fds[AST_TIMING_FD]; \
+		ast_channel_set_fd(ast, AST_AGENT_FD, p->chan->fds[AST_TIMING_FD]); \
 	} \
 } while(0)
 

Modified: team/murf/bug_7638/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_alsa.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/channels/chan_alsa.c (original)
+++ team/murf/bug_7638/channels/chan_alsa.c Fri Aug 10 10:12:40 2007
@@ -789,7 +789,7 @@
 		return NULL;
 
 	tmp->tech = &alsa_tech;
-	tmp->fds[0] = readdev;
+	ast_channel_set_fd(tmp, 0, readdev);
 	tmp->nativeformats = AST_FORMAT_SLINEAR;
 	tmp->readformat = AST_FORMAT_SLINEAR;
 	tmp->writeformat = AST_FORMAT_SLINEAR;

Modified: team/murf/bug_7638/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_features.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/channels/chan_features.c (original)
+++ team/murf/bug_7638/channels/chan_features.c Fri Aug 10 10:12:40 2007
@@ -171,8 +171,8 @@
 	p->subs[index].owner->timingfd = p->subs[index].timingfdbackup;
 	p->subs[index].owner->alertpipe[0] = p->subs[index].alertpipebackup[0];
 	p->subs[index].owner->alertpipe[1] = p->subs[index].alertpipebackup[1];
-	p->subs[index].owner->fds[AST_ALERT_FD] = p->subs[index].alertpipebackup[0];
-	p->subs[index].owner->fds[AST_TIMING_FD] = p->subs[index].timingfdbackup;
+	ast_channel_set_fd(p->subs[index].owner, AST_ALERT_FD, p->subs[index].alertpipebackup[0]);
+	ast_channel_set_fd(p->subs[index].owner, AST_TIMING_FD, p->subs[index].timingfdbackup);
 }
 
 static void update_features(struct feature_pvt *p, int index)
@@ -181,9 +181,9 @@
 	if (p->subs[index].owner) {
 		for (x=0; x<AST_MAX_FDS; x++) {
 			if (index) 
-				p->subs[index].owner->fds[x] = -1;
+				ast_channel_set_fd(p->subs[index].owner, x, -1);
 			else
-				p->subs[index].owner->fds[x] = p->subchan->fds[x];
+				ast_channel_set_fd(p->subs[index].owner, x, p->subchan->fds[x]);
 		}
 		if (!index) {
 			/* Copy timings from master channel */

Modified: team/murf/bug_7638/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_gtalk.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/channels/chan_gtalk.c (original)
+++ team/murf/bug_7638/channels/chan_gtalk.c Fri Aug 10 10:12:40 2007
@@ -934,13 +934,13 @@
 
 	if (i->rtp) {
 		ast_rtp_setstun(i->rtp, 1);
-		tmp->fds[0] = ast_rtp_fd(i->rtp);
-		tmp->fds[1] = ast_rtcp_fd(i->rtp);
+		ast_channel_set_fd(tmp, 0, ast_rtp_fd(i->rtp));
+		ast_channel_set_fd(tmp, 1, ast_rtcp_fd(i->rtp));
 	}
 	if (i->vrtp) {
 		ast_rtp_setstun(i->rtp, 1);
-		tmp->fds[2] = ast_rtp_fd(i->vrtp);
-		tmp->fds[3] = ast_rtcp_fd(i->vrtp);
+		ast_channel_set_fd(tmp, 2, ast_rtp_fd(i->vrtp));
+		ast_channel_set_fd(tmp, 3, ast_rtcp_fd(i->vrtp));
 	}
 	if (state == AST_STATE_RING)
 		tmp->rings = 1;

Modified: team/murf/bug_7638/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_h323.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/channels/chan_h323.c (original)
+++ team/murf/bug_7638/channels/chan_h323.c Fri Aug 10 10:12:40 2007
@@ -396,8 +396,8 @@
 	if (pvt->update_rtp_info > 0) {
 		if (pvt->rtp) {
 			ast_jb_configure(c, &global_jbconf);
-			c->fds[0] = ast_rtp_fd(pvt->rtp);
-			c->fds[1] = ast_rtcp_fd(pvt->rtp);
+			ast_channel_set_fd(c, 0, ast_rtp_fd(pvt->rtp));
+			ast_channel_set_fd(c, 1, ast_rtcp_fd(pvt->rtp));
 			ast_queue_frame(pvt->owner, &ast_null_frame);	/* Tell Asterisk to apply changes */
 		}
 		pvt->update_rtp_info = -1;
@@ -995,8 +995,8 @@
 
 	if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
 		ast_jb_configure(pvt->owner, &global_jbconf);
-		pvt->owner->fds[0] = ast_rtp_fd(pvt->rtp);
-		pvt->owner->fds[1] = ast_rtcp_fd(pvt->rtp);
+		ast_channel_set_fd(pvt->owner, 0, ast_rtp_fd(pvt->rtp));
+		ast_channel_set_fd(pvt->owner, 1, ast_rtcp_fd(pvt->rtp));
 		ast_queue_frame(pvt->owner, &ast_null_frame);	/* Tell Asterisk to apply changes */
 		ast_channel_unlock(pvt->owner);
 	} else
@@ -1040,18 +1040,18 @@
 		ch->readformat = fmt;
 		ch->rawreadformat = fmt;
 #if 0
-		ch->fds[0] = ast_rtp_fd(pvt->rtp);
-		ch->fds[1] = ast_rtcp_fd(pvt->rtp);
+		ast_channel_set_fd(ch, 0, ast_rtp_fd(pvt->rtp));
+		ast_channel_set_fd(ch, 1, ast_rtcp_fd(pvt->rtp));
 #endif
 #ifdef VIDEO_SUPPORT
 		if (pvt->vrtp) {
-			ch->fds[2] = ast_rtp_fd(pvt->vrtp);
-			ch->fds[3] = ast_rtcp_fd(pvt->vrtp);
+			ast_channel_set_fd(ch, 2, ast_rtp_fd(pvt->vrtp));
+			ast_channel_set_fd(ch, 3, ast_rtcp_fd(pvt->vrtp));
 		}
 #endif
 #ifdef T38_SUPPORT
 		if (pvt->udptl) {
-			ch->fds[4] = ast_udptl_fd(pvt->udptl);
+			ast_channel_set_fd(ch, 4, ast_udptl_fd(pvt->udptl));
 		}
 #endif
 		if (state == AST_STATE_RING) {

Modified: team/murf/bug_7638/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_iax2.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/channels/chan_iax2.c (original)
+++ team/murf/bug_7638/channels/chan_iax2.c Fri Aug 10 10:12:40 2007
@@ -6054,9 +6054,16 @@
 		if (!ast_strlen_zero(p->mailbox)) {
 			struct ast_event *event;
 			int new, old;
+			char *mailbox, *context;
+
+			context = mailbox = ast_strdupa(p->mailbox);
+			strsep(&context, "@");
+			if (ast_strlen_zero(context))
+				context = "default";
 
 			event = ast_event_get_cached(AST_EVENT_MWI,
-				AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, p->mailbox,
+				AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+				AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
 				AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
 				AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
 				AST_EVENT_IE_END);
@@ -8948,7 +8955,7 @@
 	}
 	ast_pthread_create_background(&schedthreadid, NULL, sched_thread, NULL);
 	ast_pthread_create_background(&netthreadid, NULL, network_thread, NULL);
-	ast_verb(2, "%d helper threaads started\n", threadcount);
+	ast_verb(2, "%d helper threads started\n", threadcount);
 	return 0;
 }
 
@@ -9315,8 +9322,14 @@
 		ast_free_ha(oldha);
 
 	if (!ast_strlen_zero(peer->mailbox)) {
+		char *mailbox, *context;
+		mailbox = ast_strdupa(peer->mailbox);
+		strsep(&context, "@");
+		if (ast_strlen_zero(context))
+			context = "default";
 		peer->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, NULL,
-			AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, peer->mailbox,
+			AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+			AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
 			AST_EVENT_IE_END);
 	}
 

Modified: team/murf/bug_7638/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_jingle.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/channels/chan_jingle.c (original)
+++ team/murf/bug_7638/channels/chan_jingle.c Fri Aug 10 10:12:40 2007
@@ -795,12 +795,12 @@
 	fmt = ast_best_codec(tmp->nativeformats);
 
 	if (i->rtp) {
-		tmp->fds[0] = ast_rtp_fd(i->rtp);
-		tmp->fds[1] = ast_rtcp_fd(i->rtp);
+		ast_channel_set_fd(tmp, 0, ast_rtp_fd(i->rtp));
+		ast_channel_set_fd(tmp, 1, ast_rtcp_fd(i->rtp));
 	}
 	if (i->vrtp) {
-		tmp->fds[2] = ast_rtp_fd(i->vrtp);
-		tmp->fds[3] = ast_rtcp_fd(i->vrtp);
+		ast_channel_set_fd(tmp, 2, ast_rtp_fd(i->vrtp));
+		ast_channel_set_fd(tmp, 3, ast_rtcp_fd(i->vrtp));
 	}
 	if (state == AST_STATE_RING)
 		tmp->rings = 1;

Modified: team/murf/bug_7638/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_mgcp.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/channels/chan_mgcp.c (original)
+++ team/murf/bug_7638/channels/chan_mgcp.c Fri Aug 10 10:12:40 2007
@@ -468,9 +468,16 @@
 {
 	int new_msgs;
 	struct ast_event *event;
+	char *mailbox, *context;
+
+	context = mailbox = ast_strdupa(p->mailbox);
+	strsep(&context, "@");
+	if (ast_strlen_zero(context))
+		context = "default";
 
 	event = ast_event_get_cached(AST_EVENT_MWI,
-		AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, p->mailbox,
+		AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+		AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
 		AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
 		AST_EVENT_IE_END);
 
@@ -1456,7 +1463,7 @@
 		fmt = ast_best_codec(tmp->nativeformats);
 		ast_string_field_build(tmp, name, "MGCP/%s@%s-%d", i->name, i->parent->name, sub->id);
 		if (sub->rtp)
-			tmp->fds[0] = ast_rtp_fd(sub->rtp);
+			ast_channel_set_fd(tmp, 0, ast_rtp_fd(sub->rtp));
 		if (i->dtmfmode & (MGCP_DTMF_INBAND | MGCP_DTMF_HYBRID)) {
 			i->dsp = ast_dsp_new();
 			ast_dsp_set_features(i->dsp,DSP_FEATURE_DTMF_DETECT);
@@ -2588,7 +2595,7 @@
 	/* Allocate the RTP now */
 	sub->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr);
 	if (sub->rtp && sub->owner)
-		sub->owner->fds[0] = ast_rtp_fd(sub->rtp);
+		ast_channel_set_fd(sub->owner, 0, ast_rtp_fd(sub->rtp));
 	if (sub->rtp)
 		ast_rtp_setnat(sub->rtp, sub->nat);
 #if 0
@@ -3692,8 +3699,14 @@
 					ast_copy_string(e->musicclass, musicclass, sizeof(e->musicclass));
 					ast_copy_string(e->mailbox, mailbox, sizeof(e->mailbox));
 					if (!ast_strlen_zero(e->mailbox)) {
+						char *mailbox, *context;
+						context = mailbox = ast_strdupa(e->mailbox);
+						strsep(&context, "@");
+						if (ast_strlen_zero(context))
+							context = "default";
 						e->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, NULL,
-							AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, e->mailbox,
+							AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+							AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
 							AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
 							AST_EVENT_IE_END);
 					}

Modified: team/murf/bug_7638/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/channels/chan_misdn.c?view=diff&rev=78994&r1=78993&r2=78994
==============================================================================
--- team/murf/bug_7638/channels/chan_misdn.c (original)
+++ team/murf/bug_7638/channels/chan_misdn.c Fri Aug 10 10:12:40 2007
@@ -3220,7 +3220,7 @@
 		if (pipe(chlist->pipe) < 0)
 			ast_log(LOG_ERROR, "Pipe failed\n");
 
-		tmp->fds[0] = chlist->pipe[0];
+		ast_channel_set_fd(tmp, 0, chlist->pipe[0]);
 
 		if (state == AST_STATE_RING)
 			tmp->rings = 1;

Modified: team/murf/bug_7638/channels/chan_nbs.c

[... 1869 lines stripped ...]



More information about the asterisk-commits mailing list