[asterisk-commits] branch oej/sipregister r26096 - in /team/oej/sipregister: ./ apps/ build_tool...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 9 07:48:37 MST 2006


Author: oej
Date: Tue May  9 09:48:37 2006
New Revision: 26096

URL: http://svn.digium.com/view/asterisk?rev=26096&view=rev
Log:
Reset automerge

Modified:
    team/oej/sipregister/   (props changed)
    team/oej/sipregister/Makefile
    team/oej/sipregister/app.c
    team/oej/sipregister/apps/app_chanspy.c
    team/oej/sipregister/apps/app_dial.c
    team/oej/sipregister/apps/app_festival.c
    team/oej/sipregister/apps/app_queue.c
    team/oej/sipregister/apps/app_voicemail.c
    team/oej/sipregister/build_tools/Makefile
    team/oej/sipregister/build_tools/menuselect.c
    team/oej/sipregister/build_tools/menuselect.h
    team/oej/sipregister/build_tools/menuselect_curses.c
    team/oej/sipregister/build_tools/prep_moduledeps
    team/oej/sipregister/channel.c
    team/oej/sipregister/channels/chan_agent.c
    team/oej/sipregister/channels/chan_iax2.c
    team/oej/sipregister/channels/chan_oss.c
    team/oej/sipregister/channels/chan_sip.c
    team/oej/sipregister/cli.c
    team/oej/sipregister/configs/sip.conf.sample
    team/oej/sipregister/configure.ac
    team/oej/sipregister/include/   (props changed)
    team/oej/sipregister/include/asterisk/ael_structs.h
    team/oej/sipregister/include/asterisk/app.h
    team/oej/sipregister/include/asterisk/channel.h
    team/oej/sipregister/include/asterisk/frame.h
    team/oej/sipregister/include/asterisk/rtp.h
    team/oej/sipregister/indications.c
    team/oej/sipregister/makeopts.in
    team/oej/sipregister/manager.c
    team/oej/sipregister/mxml/   (props changed)
    team/oej/sipregister/pbx.c
    team/oej/sipregister/pbx/ael/   (props changed)
    team/oej/sipregister/res/res_monitor.c
    team/oej/sipregister/rtp.c
    team/oej/sipregister/say.c
    team/oej/sipregister/utils/Makefile

Propchange: team/oej/sipregister/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

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

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

Propchange: team/oej/sipregister/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue May  9 09:48:37 2006
@@ -19,9 +19,4 @@
 config.status
 config.log
 makeopts.xml
-install-sh
-configure
-mkinstalldirs
 autom4te.cache
-missing
-aclocal.m4

Propchange: team/oej/sipregister/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue May  9 09:48:37 2006
@@ -1,1 +1,1 @@
-/trunk:1-25550
+/trunk:1-26093

Modified: team/oej/sipregister/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/Makefile?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/Makefile (original)
+++ team/oej/sipregister/Makefile Tue May  9 09:48:37 2006
@@ -365,9 +365,9 @@
 endif
 
 ifeq ($(OSARCH),Linux)
-  LIBS+=-ldl -lpthread -lncurses -lm -lresolv  #-lnjamd
+  LIBS+=-ldl -lpthread $(EDITLINE_LIBS) -lm -lresolv  #-lnjamd
 else
-  LIBS+=-lncurses -lm
+  LIBS+=$(EDITLINE_LIBS) -lm
 endif
 
 ifeq ($(OSARCH),Darwin)
@@ -395,22 +395,23 @@
 endif
 
 ifeq ($(OSARCH),NetBSD)
-  LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib -lncurses
+  LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIBS)
 endif
 
 ifeq ($(OSARCH),OpenBSD)
-  LIBS+=-lcrypto -lpthread -lm -lncurses
+  LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIBS)
 endif
 
 ifeq ($(OSARCH),SunOS)
   LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
   OBJS+=strcompat.o
+  MENUSELECT_OBJS+=strcompat.o
   ASTLINK=
   SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
 endif
 
 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
-  CFLAGS+=$(ASTCFLAGS) $(TOPDIR_CFLAGS)
+  CFLAGS+=$(TOPDIR_CFLAGS) $(ASTCFLAGS)
 endif
 
 # This is used when generating the doxygen documentation
@@ -431,12 +432,12 @@
 	@echo " +               make install                +"  
 	@echo " +-------------------------------------------+"  
 
-all: include/autoconfig.h menuselect.makeopts cleantest depend asterisk subdirs
+all: config.status menuselect.makeopts cleantest depend asterisk subdirs
 
 configure:
 	- at ./bootstrap.sh
 
-include/autoconfig.h: configure
+config.status: configure
 	@CFLAGS="" ./configure
 	@echo "****"
 	@echo "**** The configure script was just executed, so 'make' needs to be"
@@ -482,10 +483,10 @@
 endif
 
 ast_expr2.c:
-	bison -d --name-prefix=ast_yy ast_expr2.y -o ast_expr2.c
+	bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
 
 ast_expr2f.c:
-	flex --full ast_expr2.fl
+	flex -o $@ --full ast_expr2.fl
 
 testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
 	gcc -g -c -DSTANDALONE ast_expr2f.c
@@ -528,7 +529,7 @@
 	rm -f $@.tmp
 
 stdtime/libtime.a:
-	CFLAGS="$(ASTCFLAGS) $(MOD_SUBDIR_CFLAGS)" $(MAKE) -C stdtime libtime.a
+	CFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C stdtime libtime.a
 
 asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
 	build_tools/make_build_h > include/asterisk/build.h.tmp
@@ -543,16 +544,16 @@
 	$(CC) $(AUDIO_LIBS) -o muted muted.o
 
 subdirs: 
-	for x in $(MOD_SUBDIRS); do CFLAGS="$(ASTCFLAGS) $(MOD_SUBDIR_CFLAGS)" $(MAKE) -C $$x || exit 1 ; done
-	CFLAGS="$(ASTCFLAGS) $(OTHER_SUBDIR_CFLAGS)" $(MAKE) -C utils
-	CFLAGS="$(ASTCFLAGS) $(OTHER_SUBDIR_CFLAGS)" $(MAKE) -C agi
+	@for x in $(MOD_SUBDIRS); do CFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C $$x || exit 1 ; done
+	@CFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C utils
+	@CFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C agi
 
 clean-depend:
-	for x in $(SUBDIRS); do $(MAKE) -C $$x clean-depend || exit 1 ; done
+	@for x in $(SUBDIRS); do $(MAKE) -C $$x clean-depend || exit 1 ; done
 	rm -f .depend .tags-depend
 
 clean: clean-depend
-	for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
+	@for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
 	rm -f *.o *.so asterisk
 	rm -f defaults.h
 	rm -f include/asterisk/build.h
@@ -708,7 +709,7 @@
 	if [ -f mpg123-0.59r/mpg123 ]; then $(MAKE) -C mpg123-0.59r install; fi
 
 install-subdirs:
-	for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
+	@for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
 
 NEWMODS=$(notdir $(wildcard */*.so))
 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
@@ -914,7 +915,7 @@
 valgrind: dont-optimize
 
 depend: include/asterisk/version.h .depend defaults.h 
-	for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
+	@for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
 
 .depend: include/asterisk/version.h defaults.h
 	build_tools/mkdep $(CFLAGS) $(wildcard *.c)
@@ -999,7 +1000,7 @@
 menuselect: build_tools/menuselect makeopts.xml
 	- at build_tools/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
 
-build_tools/menuselect: build_tools/menuselect.c build_tools/menuselect_curses.c build_tools/menuselect.h mxml/libmxml.a include/autoconfig.h
+build_tools/menuselect: build_tools/menuselect.c build_tools/menuselect_curses.c build_tools/menuselect.h include/autoconfig.h mxml/libmxml.a $(MENUSELECT_OBJS)
 	$(MAKE) -C build_tools menuselect
 
 mxml/libmxml.a:

Modified: team/oej/sipregister/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/app.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/app.c (original)
+++ team/oej/sipregister/app.c Tue May  9 09:48:37 2006
@@ -142,86 +142,6 @@
 		fto = to = 1000000000;
 	res = ast_readstring_full(c, s, maxlen, to, fto, "#", audiofd, ctrlfd);
 	return res;
-}
-
-int ast_app_getvoice(struct ast_channel *c, char *dest, char *dstfmt, char *prompt, int silence, int maxsec)
-{
-	int res;
-	struct ast_filestream *writer;
-	int rfmt;
-	int totalms=0, total;
-	
-	struct ast_frame *f;
-	struct ast_dsp *sildet;
-	/* Play prompt if requested */
-	if (prompt) {
-		res = ast_stream_and_wait(c, prompt, c->language, "");
-		if (res < 0)
-			return res;
-	}
-	rfmt = c->readformat;
-	res = ast_set_read_format(c, AST_FORMAT_SLINEAR);
-	if (res < 0) {
-		ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
-		return -1;
-	}
-	sildet = ast_dsp_new();
-	if (!sildet) {
-		ast_log(LOG_WARNING, "Unable to create silence detector :(\n");
-		return -1;
-	}
-	writer = ast_writefile(dest, dstfmt, "Voice file", 0, 0, 0666);
-	if (!writer) {
-		ast_log(LOG_WARNING, "Unable to open file '%s' in format '%s' for writing\n", dest, dstfmt);
-		ast_dsp_free(sildet);
-		return -1;
-	}
-	for(;;) {
-		if ((res = ast_waitfor(c, 2000)) < 0) {
-			ast_log(LOG_NOTICE, "Waitfor failed while recording file '%s' format '%s'\n", dest, dstfmt);
-			break;
-		}
-		if (res) {
-			f = ast_read(c);
-			if (!f) {
-				ast_log(LOG_NOTICE, "Hungup while recording file '%s' format '%s'\n", dest, dstfmt);
-				break;
-			}
-			if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
-				/* Ended happily with DTMF */
-				ast_frfree(f);
-				break;
-			} else if (f->frametype == AST_FRAME_VOICE) {
-				ast_dsp_silence(sildet, f, &total); 
-				if (total > silence) {
-					/* Ended happily with silence */
-					ast_frfree(f);
-					break;
-				}
-				totalms += f->samples / 8;
-				if (totalms > maxsec * 1000) {
-					/* Ended happily with too much stuff */
-					ast_log(LOG_NOTICE, "Constraining voice on '%s' to %d seconds\n", c->name, maxsec);
-					ast_frfree(f);
-					break;
-				}
-				res = ast_writestream(writer, f);
-				if (res < 0) {
-					ast_log(LOG_WARNING, "Failed to write to stream at %s!\n", dest);
-					ast_frfree(f);
-					break;
-				}
-					
-			}
-			ast_frfree(f);
-		}
-	}
-	res = ast_set_read_format(c, rfmt);
-	if (res)
-		ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", c->name);
-	ast_dsp_free(sildet);
-	ast_closestream(writer);
-	return 0;
 }
 
 static int (*ast_has_voicemail_func)(const char *mailbox, const char *folder) = NULL;

Modified: team/oej/sipregister/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/apps/app_chanspy.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/apps/app_chanspy.c (original)
+++ team/oej/sipregister/apps/app_chanspy.c Tue May  9 09:48:37 2006
@@ -56,7 +56,7 @@
 #define ALL_DONE(u, ret) LOCAL_USER_REMOVE(u); return ret;
 #define get_volfactor(x) x ? ((x > 0) ? (1 << x) : ((1 << abs(x)) * -1)) : 0
 
-static const char *synopsis = "Listen to the audio of an active channel";
+static const char *tdesc = "Listen to the audio of an active channel";
 static const char *app = "ChanSpy";
 static const char *desc = 
 "  ChanSpy([chanprefix][|options]): This application is used to listen to the\n"
@@ -584,12 +584,12 @@
 static int load_module(void *mod)
 {
 	__mod_desc = mod;
-	return ast_register_application(app, chanspy_exec, synopsis, desc);
+	return ast_register_application(app, chanspy_exec, tdesc, desc);
 }
 
 static const char *description(void)
 {
-	return (char *) synopsis;
+	return (char *) tdesc;
 }
 
 static const char *key(void)

Modified: team/oej/sipregister/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/apps/app_dial.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/apps/app_dial.c (original)
+++ team/oej/sipregister/apps/app_dial.c Tue May  9 09:48:37 2006
@@ -482,7 +482,7 @@
 					ast_clear_flag(o, DIAL_STILLGOING);	
 					HANDLE_CAUSE(cause, in);
 				} else {
-					ast_rtp_make_compatible(c, in);
+					ast_rtp_make_compatible(c, in, single);
 					if (c->cid.cid_num)
 						free(c->cid.cid_num);
 					c->cid.cid_num = NULL;
@@ -550,6 +550,8 @@
 							       OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
 							       OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
 							       DIAL_NOFORWARDHTML);
+						/* Setup early media if appropriate */
+						ast_rtp_early_media(in, peer);
 					}
 					/* If call has been answered, then the eventual hangup is likely to be normal hangup */
 					in->hangupcause = AST_CAUSE_NORMAL_CLEARING;
@@ -576,6 +578,9 @@
 				case AST_CONTROL_RINGING:
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "%s is ringing\n", c->name);
+					/* Setup early media if appropriate */
+					if (single)
+						ast_rtp_early_media(in, c);
 					if (!(*sentringing) && !ast_test_flag(outgoing, OPT_MUSICBACK)) {
 						ast_indicate(in, AST_CONTROL_RINGING);
 						(*sentringing)++;
@@ -584,6 +589,9 @@
 				case AST_CONTROL_PROGRESS:
 					if (option_verbose > 2)
 						ast_verbose (VERBOSE_PREFIX_3 "%s is making progress passing it to %s\n", c->name, in->name);
+					/* Setup early media if appropriate */
+					if (single)
+						ast_rtp_early_media(in, c);
 					if (!ast_test_flag(outgoing, OPT_RINGBACK))
 						ast_indicate(in, AST_CONTROL_PROGRESS);
 					break;
@@ -595,6 +603,8 @@
 				case AST_CONTROL_PROCEEDING:
 					if (option_verbose > 2)
 						ast_verbose (VERBOSE_PREFIX_3 "%s is proceeding passing it to %s\n", c->name, in->name);
+					if (single)
+						ast_rtp_early_media(in, c);
 					if (!ast_test_flag(outgoing, OPT_RINGBACK))
 						ast_indicate(in, AST_CONTROL_PROCEEDING);
 					break;
@@ -1056,7 +1066,7 @@
 		}
 
 		/* Setup outgoing SDP to match incoming one */
-		ast_rtp_make_compatible(tmp->chan, chan);
+		ast_rtp_make_compatible(tmp->chan, chan, !outgoing && !rest);
 		
 		/* Inherit specially named variables from parent channel */
 		ast_channel_inherit_variables(chan, tmp->chan);
@@ -1550,6 +1560,7 @@
 		sentringing = 0;
 		ast_indicate(chan, -1);
 	}
+	ast_rtp_early_media(chan, NULL);
 	hanguptree(outgoing, NULL);
 	pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
 	if (option_debug)

Modified: team/oej/sipregister/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/apps/app_festival.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/apps/app_festival.c (original)
+++ team/oej/sipregister/apps/app_festival.c Tue May  9 09:48:37 2006
@@ -305,6 +305,7 @@
 	char *data;	
 	char *intstr;
 	struct ast_config *cfg;
+	char *newfestivalcommand;
 
 	if (ast_strlen_zero(vdata)) {
 		ast_log(LOG_WARNING, "festival requires an argument (text)\n");
@@ -337,6 +338,22 @@
 	}
 	if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
 		festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
+	} else { /* This else parses the festivalcommand that we're sent from the config file for \n's, etc */
+		int i, j;
+		newfestivalcommand = alloca(strlen(festivalcommand) + 1);
+
+		for (i = 0, j = 0; i < strlen(festivalcommand); i++) {
+			if (festivalcommand[i] == '\\' && festivalcommand[i + 1] == 'n') {
+				newfestivalcommand[j++] = '\n';
+				i++;
+			} else if (festivalcommand[i] == '\\') {
+				newfestivalcommand[j++] = festivalcommand[i + 1];
+				i++;
+			} else
+				newfestivalcommand[j++] = festivalcommand[i];
+		}
+		newfestivalcommand[j] = '\0';
+		festivalcommand = newfestivalcommand;
 	}
 	
 	if (!(data = ast_strdupa(vdata))) {

Modified: team/oej/sipregister/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/apps/app_queue.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/apps/app_queue.c (original)
+++ team/oej/sipregister/apps/app_queue.c Tue May  9 09:48:37 2006
@@ -93,12 +93,14 @@
 #include "asterisk/devicestate.h"
 #include "asterisk/stringfields.h"
 
-#define QUEUE_STRATEGY_RINGALL		0
-#define QUEUE_STRATEGY_ROUNDROBIN	1
-#define QUEUE_STRATEGY_LEASTRECENT	2
-#define QUEUE_STRATEGY_FEWESTCALLS	3
-#define QUEUE_STRATEGY_RANDOM		4
-#define QUEUE_STRATEGY_RRMEMORY		5
+enum {
+	QUEUE_STRATEGY_RINGALL = 0,
+	QUEUE_STRATEGY_ROUNDROBIN,
+	QUEUE_STRATEGY_LEASTRECENT,
+	QUEUE_STRATEGY_FEWESTCALLS,
+	QUEUE_STRATEGY_RANDOM,
+	QUEUE_STRATEGY_RRMEMORY
+};
 
 static struct strategy {
 	int strategy;
@@ -732,7 +734,7 @@
 		if (q->strategy < 0) {
 			ast_log(LOG_WARNING, "'%s' isn't a valid strategy for queue '%s', using ringall instead\n",
 				val, q->name);
-			q->strategy = 0;
+			q->strategy = QUEUE_STRATEGY_RINGALL;
 		}
 	} else if (!strcasecmp(param, "joinempty")) {
 		if (!strcasecmp(val, "strict"))
@@ -1526,7 +1528,7 @@
 				ast_log(LOG_DEBUG, "Nobody left to try ringing in queue\n");
 			break;
 		}
-		if (!qe->parent->strategy) {
+		if (qe->parent->strategy == QUEUE_STRATEGY_RINGALL) {
 			struct callattempt *cur;
 			/* Ring everyone who shares this best metric (for ringall) */
 			for (cur = outgoing; cur; cur = cur->q_next) {
@@ -1686,7 +1688,7 @@
 				numlines++;
 			}
 			if (pos > 1 /* found */ || !stillgoing /* nobody listening */ ||
-					 qe->parent->strategy /* ring would not be delivered */)
+					 (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) /* ring would not be delivered */)
 				break;
 			/* On "ringall" strategy we only move to the next penalty level
 			   when *all* ringing phones are done in the current penalty level */
@@ -1784,7 +1786,7 @@
 							if (in->cdr)
 								ast_cdr_busy(in->cdr);
 							do_hang(o);
-							if (qe->parent->strategy) {
+							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
 									*to = orig;
 								ring_one(qe, outgoing, &numbusies);
@@ -1797,7 +1799,7 @@
 							if (in->cdr)
 								ast_cdr_busy(in->cdr);
 							do_hang(o);
-							if (qe->parent->strategy) {
+							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
 									*to = orig;
 								ring_one(qe, outgoing, &numbusies);
@@ -1824,7 +1826,7 @@
 					ast_frfree(f);
 				} else {
 					do_hang(o);
-					if (qe->parent->strategy) {
+					if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 						if (qe->parent->timeoutrestart)
 							*to = orig;
 						ring_one(qe, outgoing, &numbusies);
@@ -1925,7 +1927,7 @@
 		if (option_debug)
 			ast_log(LOG_DEBUG, "There are %d available members.\n", avl);
 	
-		if (qe->parent->strategy == 1) {
+		if (qe->parent->strategy == QUEUE_STRATEGY_RINGALL) {
 			if (option_debug)
 				ast_log(LOG_DEBUG, "Even though there are %d available members, the strategy is ringall so only the head call is allowed in!\n", avl);
 			avl = 1;

Modified: team/oej/sipregister/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/apps/app_voicemail.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/apps/app_voicemail.c (original)
+++ team/oej/sipregister/apps/app_voicemail.c Tue May  9 09:48:37 2006
@@ -586,6 +586,7 @@
 					apply_option(retval, tmp->name, tmp->value);
 				tmp = tmp->next;
 			} 
+			ast_variables_destroy(var);
 		} else { 
 			if (!ivm) 
 				free(retval);
@@ -2047,7 +2048,7 @@
 			odbc_release_obj(obj);
 			goto yuck;
 		}
-		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir LIKE '%%%s/%s/%s'", odbc_table, context, tmp, "INBOX");
+		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir = '%s%s/%s/%s'", odbc_table, VM_SPOOL_DIR, context, tmp, "INBOX");
 		res = SQLPrepare(stmt, sql, SQL_NTS);
 		if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
 			ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
@@ -2085,7 +2086,7 @@
 			odbc_release_obj(obj);
 			goto yuck;
 		}
-		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir like '%%%s/%s/%s'", odbc_table, context, tmp, "Old");
+		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir = '%s%s/%s/%s'", odbc_table, VM_SPOOL_DIR, context, tmp, "Old");
 		res = SQLPrepare(stmt, sql, SQL_NTS);
 		if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
 			ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
@@ -2158,7 +2159,7 @@
 			odbc_release_obj(obj);
                         goto yuck;
                 }
-		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir like '%%%s/%s/%s'", odbc_table, context, tmp, "INBOX");
+		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir = '%s%s/%s/%s'", odbc_table, VM_SPOOL_DIR, context, tmp, "INBOX");
                 res = SQLPrepare(stmt, sql, SQL_NTS);
                 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {  
                         ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
@@ -2235,7 +2236,7 @@
 		context++;
 	} else
 		context = "default";
-	snprintf(fn, sizeof(fn), "%s/%s/%s/%s", VM_SPOOL_DIR, context, tmp, folder);
+	snprintf(fn, sizeof(fn), "%s%s/%s/%s", VM_SPOOL_DIR, context, tmp, folder);
 	dir = opendir(fn);
 	if (!dir)
 		return 0;
@@ -2293,7 +2294,7 @@
 	} else
 		context = "default";
 	if (newmsgs) {
-		snprintf(fn, sizeof(fn), "%s/%s/%s/INBOX", VM_SPOOL_DIR, context, tmp);
+		snprintf(fn, sizeof(fn), "%s%s/%s/INBOX", VM_SPOOL_DIR, context, tmp);
 		dir = opendir(fn);
 		if (dir) {
 			while ((de = readdir(dir))) {
@@ -2306,7 +2307,7 @@
 		}
 	}
 	if (oldmsgs) {
-		snprintf(fn, sizeof(fn), "%s/%s/%s/Old", VM_SPOOL_DIR, context, tmp);
+		snprintf(fn, sizeof(fn), "%s%s/%s/Old", VM_SPOOL_DIR, context, tmp);
 		dir = opendir(fn);
 		if (dir) {
 			while ((de = readdir(dir))) {
@@ -3359,7 +3360,11 @@
 	snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
 
 	if (!ast_strlen_zero(vmu->attachfmt)) {
-		fmt = vmu->attachfmt;
+		if (strstr(fmt, vmu->attachfmt)) {
+			fmt = vmu->attachfmt;
+		} else {
+			ast_log(LOG_WARNING, "Attachment format '%s' is not one of the recorded formats '%s'.  Falling back to default format for '%s@%s'.\n", vmu->attachfmt, fmt, vmu->mailbox, vmu->context);
+		}
 	}
 
 	/* Attach only the first format */

Modified: team/oej/sipregister/build_tools/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/build_tools/Makefile?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/build_tools/Makefile (original)
+++ team/oej/sipregister/build_tools/Makefile Tue May  9 09:48:37 2006
@@ -1,6 +1,10 @@
 MENUSELECT_OBJS=menuselect.o menuselect_curses.o
 MENUSELECT_CFLAGS=-g -c -D_GNU_SOURCE -I../ -I../include/
 MENUSELECT_LIBS=../mxml/libmxml.a
+
+ifeq ($(OSARCH),SunOS)
+  MENUSELECT_OBJS+=../strcompat.o
+endif
 
 ifneq ($(NCURSES_LIB),)
   MENUSELECT_LIBS+=$(NCURSES_LIB)
@@ -11,7 +15,7 @@
 endif
 
 menuselect: $(MENUSELECT_OBJS)
-	$(CC) -g -o $@ ../strcompat.o $(MENUSELECT_OBJS) $(MENUSELECT_LIBS)
+	$(CC) -g -o $@ $(MENUSELECT_OBJS) $(MENUSELECT_LIBS)
 
 menuselect.o: menuselect.c menuselect.h
 	$(CC) -o $@ $(MENUSELECT_CFLAGS) $<

Modified: team/oej/sipregister/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/build_tools/menuselect.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/build_tools/menuselect.c (original)
+++ team/oej/sipregister/build_tools/menuselect.c Tue May  9 09:48:37 2006
@@ -206,6 +206,7 @@
 				return -1;
 			
 			mem->name = mxmlElementGetAttr(cur2, "name");
+			mem->displayname = mxmlElementGetAttr(cur2, "displayname");
 		
 			if (!cat->positive_output)
 				mem->enabled = 1;

Modified: team/oej/sipregister/build_tools/menuselect.h
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/build_tools/menuselect.h?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/build_tools/menuselect.h (original)
+++ team/oej/sipregister/build_tools/menuselect.h Tue May  9 09:48:37 2006
@@ -37,6 +37,8 @@
 struct member {
 	/*! What will be sent to the makeopts file */
 	const char *name;
+	/*! Display name if known */
+	const char *displayname;
 	/*! Default setting */
 	const char *defaultenabled;
 	/*! This module is currently selected */

Modified: team/oej/sipregister/build_tools/menuselect_curses.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/build_tools/menuselect_curses.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/build_tools/menuselect_curses.c (original)
+++ team/oej/sipregister/build_tools/menuselect_curses.c Tue May  9 09:48:37 2006
@@ -128,6 +128,7 @@
 	int j = 0;
 	struct member *mem;
 	char buf[64];
+	char *desc = NULL;
 
 	wclear(menu);
 
@@ -142,11 +143,17 @@
 			snprintf(buf, sizeof(buf), "XXX %d.%s %s", i, i < 10 ? " " : "", mem->name);
 		else
 			snprintf(buf, sizeof(buf), "[%s] %d.%s %s", mem->enabled ? "*" : " ", i, i < 10 ? " " : "", mem->name);
+		if (curopt + 1== i)
+			desc = mem->displayname;
 		waddstr(menu, buf);
 		if (i == end)
 			break;
 	}
 
+	if (desc) {
+		wmove(menu, end - start + 2, max_x / 2 - 16);
+		waddstr(menu, desc);
+	}
 	wmove(menu, curopt - start, max_x / 2 - 9);
 
 	wrefresh(menu);
@@ -157,7 +164,7 @@
 	struct category *cat;
 	int i = 0;
 	int start = 0;
-	int end = max_y - TITLE_HEIGHT - 2;
+	int end = max_y - TITLE_HEIGHT - 6;
 	int c;
 	int curopt = 0;
 	int maxopt;

Modified: team/oej/sipregister/build_tools/prep_moduledeps
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/build_tools/prep_moduledeps?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/build_tools/prep_moduledeps (original)
+++ team/oej/sipregister/build_tools/prep_moduledeps Tue May  9 09:48:37 2006
@@ -1,4 +1,30 @@
 #!/bin/sh
+
+get_description() {
+	x=${1}
+	TDESC=`cat $x | grep -e *tdesc | cut -f 2 -d '"'`
+	if [ "$TDESC" = "" ]; then
+		TDESC=`cat $x | grep -A 2 -e *description | grep -e '\"'  | cut -f 2 -d '"'` 
+	fi
+	if [ "$TDESC" = "" ]; then
+		TDESC=`cat $x | grep -e MODULE_DESCRIPTION | grep -v return | cut -f 2 -d '"'`
+	fi
+	if [ "$TDESC" = "" ]; then
+		TDESC=`cat $x | grep -e tdesc\\\[\\\] | cut -f 2 -d '"'`
+	fi
+	if [ "$TDESC" = "" ]; then
+		TDESC=`cat $x | grep -e desc\\\[\\\] | grep -v description | cut -f 2 -d '"'`
+	fi
+	if [ "$TDESC" = "" ]; then
+		TDESC=`cat $x | grep -e *desc | grep -v descrip | cut -f 2 -d '"'`
+	fi
+	if [ "$TDESC" = "" ]; then
+		TDESC=`cat $x | grep -e *dtext | grep static | cut -f 2 -d '"'`
+	fi
+	if [ "$TDESC" = "" ]; then
+		TDESC=`cat $x | grep -A 2 -e *synopsis | grep -e '\"'  | cut -f 2 -d '"'` 
+	fi
+}
 
 process_dir() {
 	dir=${1}
@@ -10,7 +36,9 @@
 	for file in ${dir}/${prefix}*.c
 	do
 		fname=${file##${dir}/}
-		echo -e "\t\t<member name=\"${fname%%.c}.so\">"
+		get_description ${file}
+		desc=${TDESC}
+		echo -e "\t\t<member name=\"${fname%%.c}.so\" displayname=\"${desc}\">"
 		awk -f build_tools/get_moduledeps ${file}
 		echo -e "\t\t</member>"
 	done

Modified: team/oej/sipregister/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/channel.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/channel.c (original)
+++ team/oej/sipregister/channel.c Tue May  9 09:48:37 2006
@@ -738,10 +738,25 @@
 }
 
 /*! \brief Queue a control frame */
-int ast_queue_control(struct ast_channel *chan, int control)
+int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
 {
 	struct ast_frame f = { AST_FRAME_CONTROL, };
+
 	f.subclass = control;
+
+	return ast_queue_frame(chan, &f);
+}
+
+/*! \brief Queue a control frame with payload */
+int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control,
+			   const void *data, size_t datalen)
+{
+	struct ast_frame f = { AST_FRAME_CONTROL, };
+
+	f.subclass = control;
+	f.data = (void *) data;
+	f.datalen = datalen;
+
 	return ast_queue_frame(chan, &f);
 }
 
@@ -1904,6 +1919,7 @@
 		chan->readq = f->next;
 		f->next = NULL;
 		/* Interpret hangup and return NULL */
+		/* XXX why not the same for frames from the channel ? */
 		if (f->frametype == AST_FRAME_CONTROL && f->subclass == AST_CONTROL_HANGUP) {
 			ast_frfree(f);
 			f = NULL;
@@ -1978,6 +1994,7 @@
 					queue_frame_to_spies(chan, f, SPY_READ);
 				
 				if (chan->monitor && chan->monitor->read_stream ) {
+					/* XXX what does this do ? */
 #ifndef MONITOR_CONSTANT_DELAY
 					int jump = chan->outsmpl - chan->insmpl - 4 * f->samples;
 					if (jump >= 0) {
@@ -2186,8 +2203,7 @@
 
 	if (chan->tech->send_digit)
 		res = chan->tech->send_digit(chan, digit);
-	if (!(chan->tech->send_digit && chan->tech->send_digit_begin) ||
-	    res) {
+	if (res) {
 		/*
 		 * Device does not support DTMF tones, lets fake
 		 * it by doing our own generation. (PM2002)

Modified: team/oej/sipregister/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/channels/chan_agent.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/channels/chan_agent.c (original)
+++ team/oej/sipregister/channels/chan_agent.c Tue May  9 09:48:37 2006
@@ -1602,7 +1602,10 @@
 				}
 				online_agents++;
 			} else if (!ast_strlen_zero(p->loginchan)) {
-				snprintf(location, sizeof(location) - 20, "available at '%s'", p->loginchan);
+				if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0 || !(p->lastdisc.tv_sec)) 
+					snprintf(location, sizeof(location) - 20, "available at '%s'", p->loginchan);
+				else 
+					snprintf(location, sizeof(location) - 20, "wrapping up at '%s'", p->loginchan);
 				talkingto[0] = '\0';
 				online_agents++;
 				if (p->acknowledged)

Modified: team/oej/sipregister/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/channels/chan_iax2.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/channels/chan_iax2.c (original)
+++ team/oej/sipregister/channels/chan_iax2.c Tue May  9 09:48:37 2006
@@ -775,38 +775,36 @@
 static ast_mutex_t iaxsl[IAX_MAX_CALLS];
 static struct timeval lastused[IAX_MAX_CALLS];
 
-
+static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
+static int expire_registry(void *data);
+static int iax2_answer(struct ast_channel *c);
+static int iax2_call(struct ast_channel *c, char *dest, int timeout);
+static int iax2_devicestate(void *data);
+static int iax2_digit(struct ast_channel *c, char digit);
+static int iax2_do_register(struct iax2_registry *reg);
+static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan);
+static int iax2_hangup(struct ast_channel *c);
+static int iax2_indicate(struct ast_channel *c, int condition);
+static int iax2_poke_peer(struct iax2_peer *peer, int heldcall);
+static int iax2_provision(struct sockaddr_in *end, int sockfd, char *dest, const char *template, int force);
+static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final);
+static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen);
+static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img);
+static int iax2_sendtext(struct ast_channel *c, const char *text);
+static int iax2_setoption(struct ast_channel *c, int option, void *data, int datalen);
+static int iax2_transfer(struct ast_channel *c, const char *dest);
+static int iax2_write(struct ast_channel *c, struct ast_frame *f);
 static int send_command(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
+static int send_command_final(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
+static int send_command_immediate(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
 static int send_command_locked(unsigned short callno, char, int, unsigned int, const unsigned char *, int, int);
-static int send_command_immediate(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
-static int send_command_final(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
 static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int);
+static struct ast_channel *iax2_request(const char *type, int format, void *data, int *cause);
+static struct ast_frame *iax2_read(struct ast_channel *c);
 static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, int temponly);
 static struct iax2_user *build_user(const char *name, struct ast_variable *v, int temponly);
 static void destroy_user(struct iax2_user *user);
-static int expire_registry(void *data);
-static int iax2_write(struct ast_channel *c, struct ast_frame *f);
-static int iax2_do_register(struct iax2_registry *reg);
 static void prune_peers(void);
-static int iax2_poke_peer(struct iax2_peer *peer, int heldcall);
-static int iax2_provision(struct sockaddr_in *end, int sockfd, char *dest, const char *template, int force);
-
-static struct ast_channel *iax2_request(const char *type, int format, void *data, int *cause);
-static int iax2_devicestate(void *data);
-static int iax2_digit(struct ast_channel *c, char digit);
-static int iax2_sendtext(struct ast_channel *c, const char *text);
-static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img);
-static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen);
-static int iax2_call(struct ast_channel *c, char *dest, int timeout);
-static int iax2_hangup(struct ast_channel *c);
-static int iax2_answer(struct ast_channel *c);
-static struct ast_frame *iax2_read(struct ast_channel *c);
-static int iax2_write(struct ast_channel *c, struct ast_frame *f);
-static int iax2_indicate(struct ast_channel *c, int condition);
-static int iax2_setoption(struct ast_channel *c, int option, void *data, int datalen);
-static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
-static int iax2_transfer(struct ast_channel *c, const char *dest);
-static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan);
 
 static const struct ast_channel_tech iax2_tech = {
 	.type = "IAX2",
@@ -1562,8 +1560,6 @@
 	}
 	ast_mutex_unlock(&waresl.lock);
 }
-
-static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final);
 
 static int __do_deliver(void *data)
 {
@@ -3518,9 +3514,6 @@
 	return send_command_locked(callno, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1);
 }
 	
-
-static int iax2_write(struct ast_channel *c, struct ast_frame *f);
-
 static int iax2_getpeertrunk(struct sockaddr_in sin)
 {
 	struct iax2_peer *peer = NULL;
@@ -4262,8 +4255,6 @@
 	}
 	return res;
 }
-
-
 
 static int iax2_show_users(int fd, int argc, char *argv[])
 {

Modified: team/oej/sipregister/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/channels/chan_oss.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/channels/chan_oss.c (original)
+++ team/oej/sipregister/channels/chan_oss.c Tue May  9 09:48:37 2006
@@ -375,10 +375,11 @@
 static int oss_write(struct ast_channel *chan, struct ast_frame *f);
 static int oss_indicate(struct ast_channel *chan, int cond);
 static int oss_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
+static char tdesc[] = "OSS Console Channel Driver";
 
 static const struct ast_channel_tech oss_tech = {
 	.type =	"Console",
-	.description =	"OSS Console Channel Driver",
+	.description =	tdesc,
 	.capabilities =	AST_FORMAT_SLINEAR,
 	.requester = oss_request,
 	.send_digit = oss_digit,

Modified: team/oej/sipregister/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/channels/chan_sip.c?rev=26096&r1=26095&r2=26096&view=diff
==============================================================================
--- team/oej/sipregister/channels/chan_sip.c (original)
+++ team/oej/sipregister/channels/chan_sip.c Tue May  9 09:48:37 2006
@@ -204,7 +204,7 @@
 
 #define	INITIAL_CSEQ		101	/*!< our initial sip sequence number */
 
-static const char desc[] = "Session Initiation Protocol (SIP)";
+static const char tdesc[] = "Session Initiation Protocol (SIP)";
 static const char config[] = "sip.conf";
 static const char notify_config[] = "sip_notify.conf";
 static int usecnt = 0;
@@ -1176,8 +1176,7 @@
 void initialize_initreq(struct sip_pvt *p, struct sip_request *req)
 {
 	if (p->initreq.headers) {
-		ast_log(LOG_WARNING, "Initializing already initialized SIP dialog??? %s\n", p->callid);
-		return;
+		ast_log(LOG_DEBUG, "Initializing already initialized SIP dialog %s (presumably reinvite)\n", p->callid);
 	}
 	/* Use this as the basis */
 	copy_request(&p->initreq, req);
@@ -5277,7 +5276,7 @@
 	other end knows and replace the current call with this new call */
 	if (p->options && p->options->replaces && !ast_strlen_zero(p->options->replaces)) {
 		add_header(&req, "Replaces", p->options->replaces);
-		add_header(&req, "Required", "replaces");
+		add_header(&req, "Require", "replaces");
 	}
 
 	if (p->options && !ast_strlen_zero(p->options->distinctive_ring)) {
@@ -6852,11 +6851,13 @@
 	return 0;
 }
 
-/*! \brief Find out what extension the call is for */
+/*! \brief Find out who the call is for 
+	We use the INVITE uri to find out
+*/
 static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
 {
 	char tmp[256] = "", *uri, *a;
-	char tmpf[256], *from;
+	char tmpf[256] = "", *from;
 	struct sip_request *req;
 	int localdomain = TRUE;
 	char *colon;
@@ -6864,38 +6865,47 @@
 	req = oreq;
 	if (!req)
 		req = &p->initreq;
+
+	/* Find the request URI */
 	if (req->rlPart2)
 		ast_copy_string(tmp, req->rlPart2, sizeof(tmp));
 	uri = get_in_brackets(tmp);
 	
-	ast_copy_string(tmpf, get_header(req, "From"), sizeof(tmpf));
-	if (pedanticsipchecking) {
+	if (pedanticsipchecking)
 		ast_uri_decode(tmp);
-		ast_uri_decode(tmpf);
-	}
-
-	from = get_in_brackets(tmpf);
-	
+
 	if (strncmp(uri, "sip:", 4)) {
 		ast_log(LOG_WARNING, "Huh?  Not a SIP header (%s)?\n", uri);
 		return -1;
 	}
 	uri += 4;
+
+	/* Now find the From: caller ID and name */
+	ast_copy_string(tmpf, get_header(req, "From"), sizeof(tmpf));
+	if (!ast_strlen_zero(tmpf)) {
+		if (pedanticsipchecking)
+			ast_uri_decode(tmpf);
+		from = get_in_brackets(tmpf);
+	} else {
+		from = NULL;
+	}
+	
 	if (!ast_strlen_zero(from)) {
 		if (strncmp(from, "sip:", 4)) {
 			ast_log(LOG_WARNING, "Huh?  Not a SIP header (%s)?\n", from);
 			return -1;
 		}
 		from += 4;
-	} else
-		from = NULL;
-
-	if (pedanticsipchecking) {
-		ast_uri_decode(uri);
-		ast_uri_decode(from);
-	}
-
-	/* Skip any options */
+		if ((a = strchr(from, ';')))
+			*a = '\0';
+		if ((a = strchr(from, '@'))) {
+			*a = '\0';
+			ast_string_field_set(p, fromdomain, a + 1);
+		} else
+			ast_string_field_set(p, fromdomain, from);
+	}
+
+	/* Skip any options and find the domain */
 	if ((a = strchr(uri, ';')))
 		*a = '\0';
 
@@ -6931,15 +6941,6 @@
 			ast_string_field_set(p, context, domain_context);
 	}
 
-	if (from) {

[... 4566 lines stripped ...]


More information about the asterisk-commits mailing list