[asterisk-commits] oej: branch oej/videocaps r49133 - in /team/oej/videocaps: ./ agi/ apps/ buil...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 2 02:12:30 MST 2007


Author: oej
Date: Tue Jan  2 03:12:28 2007
New Revision: 49133

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49133
Log:
Reset automerge, resolve conflicts

Added:
    team/oej/videocaps/codecs/codec_g722.c
      - copied unchanged from r48967, trunk/codecs/codec_g722.c
    team/oej/videocaps/codecs/g722/
      - copied from r48967, trunk/codecs/g722/
    team/oej/videocaps/codecs/g722/Makefile
      - copied unchanged from r48967, trunk/codecs/g722/Makefile
    team/oej/videocaps/codecs/g722/g722.h
      - copied unchanged from r48967, trunk/codecs/g722/g722.h
    team/oej/videocaps/codecs/g722/g722_decode.c
      - copied unchanged from r48967, trunk/codecs/g722/g722_decode.c
    team/oej/videocaps/codecs/g722/g722_encode.c
      - copied unchanged from r48967, trunk/codecs/g722/g722_encode.c
    team/oej/videocaps/codecs/g722_slin_ex.h
      - copied unchanged from r48967, trunk/codecs/g722_slin_ex.h
    team/oej/videocaps/codecs/slin_g722_ex.h
      - copied unchanged from r48967, trunk/codecs/slin_g722_ex.h
Removed:
    team/oej/videocaps/build_tools/mkdep
Modified:
    team/oej/videocaps/   (props changed)
    team/oej/videocaps/CHANGES
    team/oej/videocaps/Makefile
    team/oej/videocaps/Makefile.moddir_rules
    team/oej/videocaps/Makefile.rules
    team/oej/videocaps/acinclude.m4
    team/oej/videocaps/agi/   (props changed)
    team/oej/videocaps/agi/Makefile
    team/oej/videocaps/apps/   (props changed)
    team/oej/videocaps/apps/app_chanspy.c
    team/oej/videocaps/apps/app_dial.c
    team/oej/videocaps/apps/app_dictate.c
    team/oej/videocaps/apps/app_directory.c
    team/oej/videocaps/apps/app_disa.c
    team/oej/videocaps/apps/app_dumpchan.c
    team/oej/videocaps/apps/app_externalivr.c
    team/oej/videocaps/apps/app_festival.c
    team/oej/videocaps/apps/app_ices.c
    team/oej/videocaps/apps/app_meetme.c
    team/oej/videocaps/apps/app_mixmonitor.c
    team/oej/videocaps/apps/app_mp3.c
    team/oej/videocaps/apps/app_nbscat.c
    team/oej/videocaps/apps/app_osplookup.c
    team/oej/videocaps/apps/app_page.c
    team/oej/videocaps/apps/app_queue.c
    team/oej/videocaps/apps/app_read.c
    team/oej/videocaps/apps/app_record.c
    team/oej/videocaps/apps/app_sms.c
    team/oej/videocaps/apps/app_voicemail.c
    team/oej/videocaps/apps/app_zapras.c
    team/oej/videocaps/build_tools/embed_modules.xml
    team/oej/videocaps/build_tools/prep_tarball
    team/oej/videocaps/cdr/   (props changed)
    team/oej/videocaps/cdr/cdr_sqlite.c
    team/oej/videocaps/channels/   (props changed)
    team/oej/videocaps/channels/Makefile
    team/oej/videocaps/channels/chan_agent.c
    team/oej/videocaps/channels/chan_alsa.c
    team/oej/videocaps/channels/chan_features.c
    team/oej/videocaps/channels/chan_gtalk.c
    team/oej/videocaps/channels/chan_iax2.c
    team/oej/videocaps/channels/chan_local.c
    team/oej/videocaps/channels/chan_mgcp.c
    team/oej/videocaps/channels/chan_misdn.c
    team/oej/videocaps/channels/chan_oss.c
    team/oej/videocaps/channels/chan_sip.c
    team/oej/videocaps/channels/chan_skinny.c
    team/oej/videocaps/channels/chan_zap.c
    team/oej/videocaps/channels/iax2-provision.c
    team/oej/videocaps/codecs/   (props changed)
    team/oej/videocaps/codecs/Makefile
    team/oej/videocaps/codecs/codec_zap.c
    team/oej/videocaps/codecs/gsm/   (props changed)
    team/oej/videocaps/codecs/gsm/Makefile
    team/oej/videocaps/codecs/ilbc/   (props changed)
    team/oej/videocaps/codecs/ilbc/Makefile
    team/oej/videocaps/codecs/lpc10/   (props changed)
    team/oej/videocaps/codecs/lpc10/Makefile
    team/oej/videocaps/configs/http.conf.sample
    team/oej/videocaps/configs/iax.conf.sample
    team/oej/videocaps/configs/manager.conf.sample
    team/oej/videocaps/configs/sip.conf.sample
    team/oej/videocaps/configure
    team/oej/videocaps/configure.ac
    team/oej/videocaps/contrib/utils/zones2indications.c
    team/oej/videocaps/doc/snmp.txt
    team/oej/videocaps/formats/   (props changed)
    team/oej/videocaps/funcs/   (props changed)
    team/oej/videocaps/funcs/func_callerid.c
    team/oej/videocaps/funcs/func_channel.c
    team/oej/videocaps/funcs/func_curl.c
    team/oej/videocaps/funcs/func_math.c
    team/oej/videocaps/funcs/func_odbc.c
    team/oej/videocaps/funcs/func_realtime.c
    team/oej/videocaps/funcs/func_strings.c
    team/oej/videocaps/include/asterisk.h
    team/oej/videocaps/include/asterisk/app.h
    team/oej/videocaps/include/asterisk/autoconfig.h.in
    team/oej/videocaps/include/asterisk/cdr.h
    team/oej/videocaps/include/asterisk/channel.h
    team/oej/videocaps/include/asterisk/cli.h
    team/oej/videocaps/include/asterisk/frame.h
    team/oej/videocaps/include/asterisk/fskmodem.h
    team/oej/videocaps/include/asterisk/http.h
    team/oej/videocaps/include/asterisk/indications.h
    team/oej/videocaps/include/asterisk/lock.h
    team/oej/videocaps/include/asterisk/pbx.h
    team/oej/videocaps/include/asterisk/rtp.h
    team/oej/videocaps/include/asterisk/strings.h
    team/oej/videocaps/include/asterisk/tdd.h
    team/oej/videocaps/include/asterisk/threadstorage.h
    team/oej/videocaps/include/asterisk/utils.h
    team/oej/videocaps/include/jitterbuf.h
    team/oej/videocaps/main/   (props changed)
    team/oej/videocaps/main/Makefile
    team/oej/videocaps/main/app.c
    team/oej/videocaps/main/asterisk.c
    team/oej/videocaps/main/callerid.c
    team/oej/videocaps/main/cdr.c
    team/oej/videocaps/main/channel.c
    team/oej/videocaps/main/cli.c
    team/oej/videocaps/main/db.c
    team/oej/videocaps/main/db1-ast/   (props changed)
    team/oej/videocaps/main/file.c
    team/oej/videocaps/main/frame.c
    team/oej/videocaps/main/fskmodem.c
    team/oej/videocaps/main/http.c
    team/oej/videocaps/main/indications.c
    team/oej/videocaps/main/jitterbuf.c
    team/oej/videocaps/main/logger.c
    team/oej/videocaps/main/manager.c
    team/oej/videocaps/main/pbx.c
    team/oej/videocaps/main/rtp.c
    team/oej/videocaps/main/stdtime/localtime.c
    team/oej/videocaps/main/tdd.c
    team/oej/videocaps/main/translate.c
    team/oej/videocaps/main/udptl.c
    team/oej/videocaps/main/utils.c
    team/oej/videocaps/pbx/   (props changed)
    team/oej/videocaps/pbx/pbx_config.c
    team/oej/videocaps/pbx/pbx_dundi.c
    team/oej/videocaps/redhat/asterisk.spec
    team/oej/videocaps/res/   (props changed)
    team/oej/videocaps/res/res_agi.c
    team/oej/videocaps/res/res_config_odbc.c
    team/oej/videocaps/res/res_config_pgsql.c
    team/oej/videocaps/res/res_convert.c
    team/oej/videocaps/res/res_crypto.c
    team/oej/videocaps/res/res_indications.c
    team/oej/videocaps/res/res_jabber.c
    team/oej/videocaps/res/res_limit.c
    team/oej/videocaps/res/res_monitor.c
    team/oej/videocaps/res/res_musiconhold.c
    team/oej/videocaps/res/res_odbc.c
    team/oej/videocaps/res/res_realtime.c
    team/oej/videocaps/res/res_smdi.c
    team/oej/videocaps/res/snmp/agent.c
    team/oej/videocaps/sounds/Makefile
    team/oej/videocaps/utils/   (props changed)
    team/oej/videocaps/utils/Makefile
    team/oej/videocaps/utils/ael_main.c
    team/oej/videocaps/utils/astman.c
    team/oej/videocaps/utils/smsq.c

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

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jan  2 03:12:28 2007
@@ -1,1 +1,1 @@
-/trunk:1-48258
+/trunk:1-48972

Modified: team/oej/videocaps/CHANGES
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/CHANGES?view=diff&rev=49133&r1=49132&r2=49133
==============================================================================
--- team/oej/videocaps/CHANGES (original)
+++ team/oej/videocaps/CHANGES Tue Jan  2 03:12:28 2007
@@ -63,3 +63,5 @@
      does not count paused queue members as unavailable.
   * Added maxfiles option to options section of asterisk.conf which allows you to specify
      what Asterisk should set as the maximum number of open files when it loads.
+  * Added the jittertargetextra configuration option.
+  * Added the URI redirect option for the built-in HTTP server

Modified: team/oej/videocaps/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/Makefile?view=diff&rev=49133&r1=49132&r2=49133
==============================================================================
--- team/oej/videocaps/Makefile (original)
+++ team/oej/videocaps/Makefile Tue Jan  2 03:12:28 2007
@@ -58,6 +58,7 @@
 export SOLINK
 export STRIP
 export DOWNLOAD
+export OSARCH
 
 # even though we could use '-include makeopts' here, use a wildcard
 # lookup anyway, so that make won't try to build makeopts if it doesn't
@@ -181,6 +182,8 @@
 
 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
 
+ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
+
 ifeq ($(AST_DEVMODE),yes)
   ASTCFLAGS+=-Werror -Wunused
 endif
@@ -237,10 +240,6 @@
 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
-SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
-MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
-OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
-SUBDIRS_DEPEND:=$(OTHER_SUBDIRS_DEPEND) $(MOD_SUBDIRS_DEPEND)
 SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
 MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
 MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
@@ -304,7 +303,7 @@
 	@$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
 	@$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
 
-$(SUBDIRS): depend makeopts.embed_rules
+$(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
 
 # ensure that all module subdirectories are processed before 'main' during
 # a parallel build, since if there are modules selected to be embedded the
@@ -346,19 +345,13 @@
 	fi
 	@rm -f $@.tmp
 
-$(SUBDIRS_CLEAN_DEPEND):
-	@$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
-
 $(SUBDIRS_CLEAN):
 	@$(MAKE) --no-print-directory -C $(@:-clean=) clean
 
-clean-depend: $(SUBDIRS_CLEAN_DEPEND)
-
-clean: $(SUBDIRS_CLEAN) clean-depend
+clean: $(SUBDIRS_CLEAN)
 	rm -f defaults.h
 	rm -f include/asterisk/build.h
 	rm -f include/asterisk/version.h
-	rm -f .depend
 	@$(MAKE) -C menuselect clean
 	cp -f .cleancount .lastclean
 
@@ -402,7 +395,6 @@
 			grep ^C update.out | cut -b4- ; \
 		fi ; \
 		rm -f update.out; \
-		$(MAKE) clean-depend; \
 	else \
 		echo "Not under version control";  \
 	fi
@@ -634,14 +626,6 @@
 		echo "We could not install init scripts for your operating system."; \
 	fi
 
-$(MOD_SUBDIRS_DEPEND):
-	@ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
-
-$(OTHER_SUBDIRS_DEPEND):
-	@ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
-
-depend: include/asterisk/version.h include/asterisk/buildopts.h include/asterisk/build.h defaults.h $(SUBDIRS_DEPEND)
-
 sounds:
 	$(MAKE) -C sounds all
 
@@ -695,10 +679,10 @@
 	- at menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
-	@unset CC LD AR RANLIB && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
+	@env -i && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
 
 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml build_tools/embed_modules.xml
 	@echo "Generating input for menuselect ..."
 	@build_tools/prep_moduledeps > $@
 
-.PHONY: menuselect main sounds clean clean-depend dist-clean distclean all prereqs depend cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_CLEAN_DEPEND) $(SUBDIRS_DEPEND) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)
+.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)

Modified: team/oej/videocaps/Makefile.moddir_rules
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/Makefile.moddir_rules?view=diff&rev=49133&r1=49132&r2=49133
==============================================================================
--- team/oej/videocaps/Makefile.moddir_rules (original)
+++ team/oej/videocaps/Makefile.moddir_rules Tue Jan  2 03:12:28 2007
@@ -40,7 +40,7 @@
 modules.link: $(addsuffix .o,$(filter $(EMBEDDED_MODS),$(C_MODS)))
 modules.link: $(addsuffix .oo,$(filter $(EMBEDDED_MODS),$(CC_MODS)))
 
-.PHONY: clean clean-depend depend uninstall _all
+.PHONY: clean uninstall _all
 
 ifneq ($(LOADABLE_MODS),)
 _all: $(LOADABLE_MODS:%=%.so)
@@ -67,11 +67,9 @@
 	@for file in $(patsubst %,$(SUBDIR)/%,$(filter %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
 	@for file in $(patsubst %,$(SUBDIR)/%,$(filter-out %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
 
-clean-depend::
-	rm -f .depend
-
-clean:: clean-depend
+clean::
 	rm -f *.so *.o *.oo
+	rm -f .*.o.d .*.oo.d
 	rm -f modules.link
 
 install:: all
@@ -79,11 +77,6 @@
 
 uninstall::
 
-ifneq ($(wildcard .depend),)
-  include .depend
+ifneq ($(wildcard .*.d),)
+   include .*.d
 endif
-
-depend: .depend
-
-.depend:
-	../build_tools/mkdep $(ASTCFLAGS) `ls *.c *.cc 2> /dev/null`

Modified: team/oej/videocaps/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/Makefile.rules?view=diff&rev=49133&r1=49132&r2=49133
==============================================================================
--- team/oej/videocaps/Makefile.rules (original)
+++ team/oej/videocaps/Makefile.rules Tue Jan  2 03:12:28 2007
@@ -38,11 +38,19 @@
 
 %.o: %.c
 	$(ECHO_PREFIX) echo "   [CC] $< -> $@"
+ifeq ($(AST_DEVMODE),yes)
+	$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+else
 	$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS)
+endif
 
 %.oo: %.cc
 	$(ECHO_PREFIX) echo "   [CXX] $< -> $@"
+ifeq ($(AST_DEVMODE),yes)
+	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+else
 	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(ASTCFLAGS)
+endif
 
 %.c: %.y
 	$(ECHO_PREFIX) echo "   [BISON] $< -> $@"

Modified: team/oej/videocaps/acinclude.m4
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/acinclude.m4?view=diff&rev=49133&r1=49132&r2=49133
==============================================================================
--- team/oej/videocaps/acinclude.m4 (original)
+++ team/oej/videocaps/acinclude.m4 Tue Jan  2 03:12:28 2007
@@ -50,10 +50,10 @@
 		if test ${err} = "0" ; then AC_MSG_RESULT(fail) ; fi
 		AC_MSG_RESULT()
 		eval "a=\${${i}_OPTION}"
-		AC_MSG_NOTICE(***)
-		AC_MSG_NOTICE(*** The $i installation appears to be missing or broken.)
-		AC_MSG_NOTICE(*** Either correct the installation, or run configure)
-		AC_MSG_NOTICE(*** including --without-${a}.)
+		AC_MSG_NOTICE([***])
+		AC_MSG_NOTICE([*** The $i installation appears to be missing or broken.])
+		AC_MSG_NOTICE([*** Either correct the installation, or run configure])
+		AC_MSG_NOTICE([*** including --without-${a}.])
 		err=1
 	done
 	if test $err = 1 ; then exit 1; fi

Propchange: team/oej/videocaps/agi/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan  2 03:12:28 2007
@@ -1,4 +1,4 @@
 eagi-test
 eagi-sphinx-test
-.depend
+*.d
 strcompat.c

Modified: team/oej/videocaps/agi/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/agi/Makefile?view=diff&rev=49133&r1=49132&r2=49133
==============================================================================
--- team/oej/videocaps/agi/Makefile (original)
+++ team/oej/videocaps/agi/Makefile Tue Jan  2 03:12:28 2007
@@ -11,7 +11,7 @@
 # the GNU General Public License
 #
 
-.PHONY: clean clean-depend all depend uninstall
+.PHONY: clean all uninstall
 
 AGIS=agi-test.agi eagi-test eagi-sphinx-test jukebox.agi
 
@@ -37,18 +37,11 @@
 uninstall:
 	for x in $(AGIS); do rm -f $(DESTDIR)$(AGI_DIR)/$$x ; done
 
-clean-depend:
-	rm -f .depend
-
-clean: clean-depend
+clean:
 	rm -f *.so *.o look eagi-test eagi-sphinx-test
+	rm -f .*.o.d .*.oo.d
 	rm -f strcompat.c
 
-ifneq ($(wildcard .depend),)
-  include .depend
+ifneq ($(wildcard .*.d),)
+   include .*.d
 endif
-
-depend: .depend
-
-.depend:
-	../build_tools/mkdep $(CFLAGS) `ls *.c`

Propchange: team/oej/videocaps/apps/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan  2 03:12:28 2007
@@ -1,4 +1,4 @@
-.depend
+*.d
 *.a
 *.so
 modules.link

Modified: team/oej/videocaps/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_chanspy.c?view=diff&rev=49133&r1=49132&r2=49133
==============================================================================
--- team/oej/videocaps/apps/app_chanspy.c (original)
+++ team/oej/videocaps/apps/app_chanspy.c Tue Jan  2 03:12:28 2007
@@ -617,7 +617,7 @@
 		char filename[512];
 
 		snprintf(filename, sizeof(filename), "%s/%s.%d.raw", ast_config_AST_MONITOR_DIR, recbase, (int) time(NULL));
-		if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644)) <= 0) {
+		if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, AST_FILE_MODE)) <= 0) {
 			ast_log(LOG_WARNING, "Cannot open '%s' for recording\n", filename);
 			fd = 0;
 		}
@@ -701,7 +701,7 @@
 		char filename[512];
 
 		snprintf(filename, sizeof(filename), "%s/%s.%d.raw", ast_config_AST_MONITOR_DIR, recbase, (int) time(NULL));
-		if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644)) <= 0) {
+		if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, AST_FILE_MODE)) <= 0) {
 			ast_log(LOG_WARNING, "Cannot open '%s' for recording\n", filename);
 			fd = 0;
 		}

Modified: team/oej/videocaps/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_dial.c?view=diff&rev=49133&r1=49132&r2=49133
==============================================================================
--- team/oej/videocaps/apps/app_dial.c (original)
+++ team/oej/videocaps/apps/app_dial.c Tue Jan  2 03:12:28 2007
@@ -288,22 +288,21 @@
 	AST_APP_OPTION('K', OPT_CALLER_PARK),
 });
 
-/* We define a custom "local user" structure because we
-   use it not only for keeping track of what is in use but
-   also for keeping track of who we're dialing. */
-
-struct dial_localuser {
+/*
+ * The list of active channels
+ */
+struct chanlist {
+	struct chanlist *next;
 	struct ast_channel *chan;
 	unsigned int flags;
 	int forwards;
-	struct dial_localuser *next;
 };
 
 
-static void hanguptree(struct dial_localuser *outgoing, struct ast_channel *exception)
+static void hanguptree(struct chanlist *outgoing, struct ast_channel *exception)
 {
 	/* Hang up a tree of stuff */
-	struct dial_localuser *oo;
+	struct chanlist *oo;
 	while (outgoing) {
 		/* Hangup any existing lines we have open */
 		if (outgoing->chan && (outgoing->chan != exception))
@@ -425,7 +424,7 @@
  * XXX this code is highly suspicious, as it essentially overwrites
  * the outgoing channel without properly deleting it.
  */
-static void do_forward(struct dial_localuser *o,
+static void do_forward(struct chanlist *o,
 	struct cause_args *num, struct ast_flags *peerflags, int single)
 {
 	char tmpchan[256];
@@ -527,7 +526,7 @@
 };
 
 static struct ast_channel *wait_for_answer(struct ast_channel *in,
-	struct dial_localuser *outgoing, int *to, struct ast_flags *peerflags,
+	struct chanlist *outgoing, int *to, struct ast_flags *peerflags,
 	struct privacy_args *pa,
 	const struct cause_args *num_in, int priority_jump, int *result)
 {
@@ -547,7 +546,7 @@
 	
 	
 	while (*to && !peer) {
-		struct dial_localuser *o;
+		struct chanlist *o;
 		int pos = 0;	/* how many channels do we handle */
 		int numlines = prestart;
 		struct ast_channel *winner;
@@ -1062,12 +1061,123 @@
 	}
 }
 
+/*! \brief returns 1 if successful, 0 or <0 if the caller should 'goto out' */
+static int setup_privacy_args(struct privacy_args *pa,
+	struct ast_flags *opts, char *opt_args[], struct ast_channel *chan)
+{
+	char callerid[60];
+	int res;
+	char *l;
+
+	if (!ast_strlen_zero(chan->cid.cid_num)) {
+		l = ast_strdupa(chan->cid.cid_num);
+		ast_shrink_phone_number(l);
+		if (ast_test_flag(opts, OPT_PRIVACY) ) {
+			if (option_verbose > 2)
+				ast_verbose(VERBOSE_PREFIX_3  "Privacy DB is '%s', clid is '%s'\n",
+					     opt_args[OPT_ARG_PRIVACY], l);
+			pa->privdb_val = ast_privacy_check(opt_args[OPT_ARG_PRIVACY], l);
+		} else {
+			if (option_verbose > 2)
+				ast_verbose(VERBOSE_PREFIX_3  "Privacy Screening, clid is '%s'\n", l);
+			pa->privdb_val = AST_PRIVACY_UNKNOWN;
+		}
+	} else {
+		char *tnam, *tn2;
+
+		tnam = ast_strdupa(chan->name);
+		/* clean the channel name so slashes don't try to end up in disk file name */
+		for (tn2 = tnam; *tn2; tn2++) {
+			if (*tn2=='/')	/* any other chars to be afraid of? */
+				*tn2 = '=';
+		}
+		if (option_verbose > 2)
+			ast_verbose(VERBOSE_PREFIX_3  "Privacy-- callerid is empty\n");
+
+		snprintf(callerid, sizeof(callerid), "NOCALLERID_%s%s", chan->exten, tnam);
+		l = callerid;
+		pa->privdb_val = AST_PRIVACY_UNKNOWN;
+	}
+	
+	ast_copy_string(pa->privcid,l,sizeof(pa->privcid));
+
+	if( strncmp(pa->privcid,"NOCALLERID",10) != 0 && ast_test_flag(opts, OPT_SCREEN_NOCLID) ) { /* if callerid is set, and ast_test_flag(&opts, OPT_SCREEN_NOCLID) is set also */  
+		if (option_verbose > 2)
+			ast_verbose( VERBOSE_PREFIX_3  "CallerID set (%s); N option set; Screening should be off\n", pa->privcid);
+		pa->privdb_val = AST_PRIVACY_ALLOW;
+	} else if (ast_test_flag(opts, OPT_SCREEN_NOCLID) && strncmp(pa->privcid,"NOCALLERID",10) == 0 ) {
+		if (option_verbose > 2)
+			ast_verbose( VERBOSE_PREFIX_3  "CallerID blank; N option set; Screening should happen; dbval is %d\n", pa->privdb_val);
+	}
+	
+	if (pa->privdb_val == AST_PRIVACY_DENY ) {
+		ast_copy_string(pa->status, "NOANSWER", sizeof(pa->status));
+		if (option_verbose > 2)
+			ast_verbose( VERBOSE_PREFIX_3  "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
+		return 0;
+	} else if (pa->privdb_val == AST_PRIVACY_KILL ) {
+		ast_copy_string(pa->status, "DONTCALL", sizeof(pa->status));
+		if (ast_opt_priority_jumping || ast_test_flag(opts, OPT_PRIORITY_JUMP)) {
+			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+		}
+		return 0; /* Is this right? */
+	} else if (pa->privdb_val == AST_PRIVACY_TORTURE ) {
+		ast_copy_string(pa->status, "TORTURE", sizeof(pa->status));
+		if (ast_opt_priority_jumping || ast_test_flag(opts, OPT_PRIORITY_JUMP)) {
+			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
+		}
+		return 0; /* is this right??? */
+	} else if (pa->privdb_val == AST_PRIVACY_UNKNOWN ) {
+		/* Get the user's intro, store it in priv-callerintros/$CID, 
+		   unless it is already there-- this should be done before the 
+		   call is actually dialed  */
+
+		/* make sure the priv-callerintros dir actually exists */
+		snprintf(pa->privintro, sizeof(pa->privintro), "%s/sounds/priv-callerintros", ast_config_AST_DATA_DIR);
+		if (mkdir(pa->privintro, 0755) && errno != EEXIST) {
+			ast_log(LOG_WARNING, "privacy: can't create directory priv-callerintros: %s\n", strerror(errno));
+			return -1;
+		}
+
+		snprintf(pa->privintro,sizeof(pa->privintro), "priv-callerintros/%s", pa->privcid);
+		if (ast_fileexists(pa->privintro,NULL,NULL ) > 0 && strncmp(pa->privcid,"NOCALLERID",10) != 0) {
+			/* the DELUX version of this code would allow this caller the
+			   option to hear and retape their previously recorded intro.
+			*/
+		} else {
+			int duration; /* for feedback from play_and_wait */
+			/* the file doesn't exist yet. Let the caller submit his
+			   vocal intro for posterity */
+			/* priv-recordintro script:
+
+			   "At the tone, please say your name:"
+
+			*/
+			res = ast_play_and_record(chan, "priv-recordintro", pa->privintro, 4, "gsm", &duration, 128, 2000, 0);  /* NOTE: I've reduced the total time to 4 sec */
+									/* don't think we'll need a lock removed, we took care of
+									   conflicts by naming the pa.privintro file */
+			if (res == -1) {
+				/* Delete the file regardless since they hung up during recording */
+				ast_filedelete(pa->privintro, NULL);
+				if (ast_fileexists(pa->privintro,NULL,NULL ) > 0 )
+					ast_log(LOG_NOTICE,"privacy: ast_filedelete didn't do its job on %s\n", pa->privintro);
+				else if (option_verbose > 2)
+					ast_verbose( VERBOSE_PREFIX_3 "Successfully deleted %s intro file\n", pa->privintro);
+				return -1;
+			}
+			if (!ast_streamfile(chan, "vm-dialout", chan->language) )
+				ast_waitstream(chan, "");
+		}
+	}
+	return 1;	/* success */
+}
+
 static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags)
 {
 	int res = -1;	/* default: error */
 	struct ast_module_user *u;
 	char *rest, *cur;	/* scan the list of destinations */
-	struct dial_localuser *outgoing = NULL;	/* list of destinations */
+	struct chanlist *outgoing = NULL;	/* list of destinations */
 	struct ast_channel *peer;
 	int to;	/* timeout */
 	struct cause_args num = { chan, 0, 0, 0 };
@@ -1149,118 +1259,12 @@
 		ast_cdr_reset(chan->cdr, NULL);
 	if (ast_test_flag(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY]))
 		opt_args[OPT_ARG_PRIVACY] = ast_strdupa(chan->exten);
+
 	if (ast_test_flag(&opts, OPT_PRIVACY) || ast_test_flag(&opts, OPT_SCREENING)) {
-		char callerid[60];
-		char *l = chan->cid.cid_num;	/* XXX watch out, we are overwriting it */
-		if (!ast_strlen_zero(l)) {
-			ast_shrink_phone_number(l);
-			if( ast_test_flag(&opts, OPT_PRIVACY) ) {
-				if (option_verbose > 2)
-					ast_verbose(VERBOSE_PREFIX_3  "Privacy DB is '%s', clid is '%s'\n",
-						     opt_args[OPT_ARG_PRIVACY], l);
-				pa.privdb_val = ast_privacy_check(opt_args[OPT_ARG_PRIVACY], l);
-			}
-			else {
-				if (option_verbose > 2)
-					ast_verbose(VERBOSE_PREFIX_3  "Privacy Screening, clid is '%s'\n", l);
-				pa.privdb_val = AST_PRIVACY_UNKNOWN;
-			}
-		} else {
-			char *tnam, *tn2;
-
-			tnam = ast_strdupa(chan->name);
-			/* clean the channel name so slashes don't try to end up in disk file name */
-			for(tn2 = tnam; *tn2; tn2++) {
-				if( *tn2=='/')
-					*tn2 = '=';  /* any other chars to be afraid of? */
-			}
-			if (option_verbose > 2)
-				ast_verbose(VERBOSE_PREFIX_3  "Privacy-- callerid is empty\n");
-
-			snprintf(callerid, sizeof(callerid), "NOCALLERID_%s%s", chan->exten, tnam);
-			l = callerid;
-			pa.privdb_val = AST_PRIVACY_UNKNOWN;
-		}
-		
-		ast_copy_string(pa.privcid,l,sizeof(pa.privcid));
-
-		if( strncmp(pa.privcid,"NOCALLERID",10) != 0 && ast_test_flag(&opts, OPT_SCREEN_NOCLID) ) { /* if callerid is set, and ast_test_flag(&opts, OPT_SCREEN_NOCLID) is set also */  
-			if (option_verbose > 2)
-				ast_verbose( VERBOSE_PREFIX_3  "CallerID set (%s); N option set; Screening should be off\n", pa.privcid);
-			pa.privdb_val = AST_PRIVACY_ALLOW;
-		}
-		else if(ast_test_flag(&opts, OPT_SCREEN_NOCLID) && strncmp(pa.privcid,"NOCALLERID",10) == 0 ) {
-			if (option_verbose > 2)
-				ast_verbose( VERBOSE_PREFIX_3  "CallerID blank; N option set; Screening should happen; dbval is %d\n", pa.privdb_val);
-		}
-		
-		if(pa.privdb_val == AST_PRIVACY_DENY ) {
-			ast_copy_string(pa.status, "NOANSWER", sizeof(pa.status));
-			if (option_verbose > 2)
-				ast_verbose( VERBOSE_PREFIX_3  "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
-			res=0;
+		res = setup_privacy_args(&pa, &opts, opt_args, chan);
+		if (res <= 0)
 			goto out;
-		}
-		else if(pa.privdb_val == AST_PRIVACY_KILL ) {
-			ast_copy_string(pa.status, "DONTCALL", sizeof(pa.status));
-			if (ast_opt_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
-				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
-			}
-			res = 0;
-			goto out; /* Is this right? */
-		}
-		else if(pa.privdb_val == AST_PRIVACY_TORTURE ) {
-			ast_copy_string(pa.status, "TORTURE", sizeof(pa.status));
-			if (ast_opt_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
-				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
-			}
-			res = 0;
-			goto out; /* is this right??? */
-		}
-		else if(pa.privdb_val == AST_PRIVACY_UNKNOWN ) {
-			/* Get the user's intro, store it in priv-callerintros/$CID, 
-			   unless it is already there-- this should be done before the 
-			   call is actually dialed  */
-
-			/* make sure the priv-callerintros dir actually exists */
-			snprintf(pa.privintro, sizeof(pa.privintro), "%s/sounds/priv-callerintros", ast_config_AST_DATA_DIR);
-			if (mkdir(pa.privintro, 0755) && errno != EEXIST) {
-				ast_log(LOG_WARNING, "privacy: can't create directory priv-callerintros: %s\n", strerror(errno));
-				res = -1;
-				goto out;
-			}
-
-			snprintf(pa.privintro,sizeof(pa.privintro), "priv-callerintros/%s", pa.privcid);
-			if( ast_fileexists(pa.privintro,NULL,NULL ) > 0 && strncmp(pa.privcid,"NOCALLERID",10) != 0) {
-				/* the DELUX version of this code would allow this caller the
-				   option to hear and retape their previously recorded intro.
-				*/
-			}
-			else {
-				int duration; /* for feedback from play_and_wait */
-				/* the file doesn't exist yet. Let the caller submit his
-				   vocal intro for posterity */
-				/* priv-recordintro script:
-
-				   "At the tone, please say your name:"
-
-				*/
-				res = ast_play_and_record(chan, "priv-recordintro", pa.privintro, 4, "gsm", &duration, 128, 2000, 0);  /* NOTE: I've reduced the total time to 4 sec */
-										/* don't think we'll need a lock removed, we took care of
-										   conflicts by naming the pa.privintro file */
-				if (res == -1) {
-					/* Delete the file regardless since they hung up during recording */
-                                        ast_filedelete(pa.privintro, NULL);
-                                        if( ast_fileexists(pa.privintro,NULL,NULL ) > 0 )
-                                                ast_log(LOG_NOTICE,"privacy: ast_filedelete didn't do its job on %s\n", pa.privintro);
-                                        else if (option_verbose > 2)
-                                                ast_verbose( VERBOSE_PREFIX_3 "Successfully deleted %s intro file\n", pa.privintro);
-					goto out;
-				}
-                                if( !ast_streamfile(chan, "vm-dialout", chan->language) )
-                                        ast_waitstream(chan, "");
-			}
-		}
+		res = -1;	/* reset default */
 	}
 
 	/* If a channel group has been specified, get it for use when we create peer channels */
@@ -1270,7 +1274,8 @@
 	/* loop through the list of dial destinations */
 	rest = args.peers;
 	while ((cur = strsep(&rest, "&")) ) {
-		struct dial_localuser *tmp;
+		struct chanlist *tmp;
+		struct ast_channel *tc;	/* channel for this destination */
 		/* Get a technology/[device:]number pair */
 		char *number = cur;
 		char *tech = strsep(&number, "/");
@@ -1291,109 +1296,110 @@
 		}
 		ast_copy_string(numsubst, number, sizeof(numsubst));
 		/* Request the peer */
-		tmp->chan = ast_request(tech, chan->nativeformats, numsubst, &cause);
-		if (!tmp->chan) {
+		tc = ast_request(tech, chan->nativeformats, numsubst, &cause);
+		if (!tc) {
 			/* If we can't, just go on to the next call */
-			ast_log(LOG_WARNING, "Unable to create channel of type '%s' (cause %d - %s)\n", tech, cause, ast_cause2str(cause));
+			ast_log(LOG_WARNING, "Unable to create channel of type '%s' (cause %d - %s)\n",
+				    tech, cause, ast_cause2str(cause));
 			handle_cause(cause, &num);
 			if (!rest)	/* we are on the last destination */
 				chan->hangupcause = cause;
+			free(tmp);
 			continue;
 		}
-		ast_set_capabilities(tmp->chan, &chan->channelcaps);
-		pbx_builtin_setvar_helper(tmp->chan, "DIALEDPEERNUMBER", numsubst);
-		if (!ast_strlen_zero(tmp->chan->call_forward)) {
+		ast_set_capabilities(tc, &chan->channelcaps);
+		pbx_builtin_setvar_helper(tc, "DIALEDPEERNUMBER", numsubst);
+		if (!ast_strlen_zero(tc->call_forward)) {
 			char tmpchan[256];
 			char *stuff;
 			char *tech;
-			ast_copy_string(tmpchan, tmp->chan->call_forward, sizeof(tmpchan));
+			ast_copy_string(tmpchan, tc->call_forward, sizeof(tmpchan));
 			if ((stuff = strchr(tmpchan, '/'))) {
 				*stuff++ = '\0';
 				tech = tmpchan;
 			} else {
-				snprintf(tmpchan, sizeof(tmpchan), "%s@%s", tmp->chan->call_forward, tmp->chan->context);
+				snprintf(tmpchan, sizeof(tmpchan), "%s@%s", tc->call_forward, tc->context);
 				stuff = tmpchan;
 				tech = "Local";
 			}
 			tmp->forwards++;
 			if (tmp->forwards < AST_MAX_FORWARDS) {
 				if (option_verbose > 2)
-					ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", chan->name, tech, stuff, tmp->chan->name);
-				ast_hangup(tmp->chan);
-				/* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
+					ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n",
+					chan->name, tech, stuff, tc->name);
+				ast_hangup(tc);
+				/* If we have been told to ignore forwards, just set this channel to null
+				 * and continue processing extensions normally */
 				if (ast_test_flag(&opts, OPT_IGNORE_FORWARDING)) {
-					tmp->chan = NULL;
+					tc = NULL;
 					cause = AST_CAUSE_BUSY;
 					if (option_verbose > 2)
-						ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented.\n", chan->name, tech, stuff);
+						ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented.\n",
+							chan->name, tech, stuff);
 				} else {
-					tmp->chan = ast_request(tech, chan->nativeformats, stuff, &cause);
+					tc = ast_request(tech, chan->nativeformats, stuff, &cause);
 				}
-				if (!tmp->chan)
+				if (!tc)
 					ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
 				else {
-					ast_channel_inherit_variables(chan, tmp->chan);
+					ast_channel_inherit_variables(chan, tc);
 					ast_set_capabilities(tmp->chan, &chan->channelcaps);
 				}
 			} else {
 				if (option_verbose > 2)
-					ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", tmp->chan->name);
-				ast_hangup(tmp->chan);
-				tmp->chan = NULL;
+					ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", tc->name);
+				ast_hangup(tc);
+				tc = NULL;
 				cause = AST_CAUSE_CONGESTION;
 			}
-			if (!tmp->chan) {
+			if (!tc) {
 				handle_cause(cause, &num);
+				free(tmp);
 				continue;
 			}
 		}
 
 		/* Setup outgoing SDP to match incoming one */
-		ast_rtp_make_compatible(tmp->chan, chan, !outgoing && !rest);
+		ast_rtp_make_compatible(tc, chan, !outgoing && !rest);
 		
 		/* Inherit specially named variables from parent channel */
-		ast_channel_inherit_variables(chan, tmp->chan);
-
-		tmp->chan->appl = "AppDial";
-		tmp->chan->data = "(Outgoing Line)";
-		tmp->chan->whentohangup = 0;
-
-		S_REPLACE(tmp->chan->cid.cid_num, ast_strdup(chan->cid.cid_num));
-		S_REPLACE(tmp->chan->cid.cid_name, ast_strdup(chan->cid.cid_name));
-		S_REPLACE(tmp->chan->cid.cid_ani, ast_strdup(chan->cid.cid_ani));
-		S_REPLACE(tmp->chan->cid.cid_rdnis, ast_strdup(chan->cid.cid_rdnis));
+		ast_channel_inherit_variables(chan, tc);
+
+		tc->appl = "AppDial";
+		tc->data = "(Outgoing Line)";
+		tc->whentohangup = 0;
+
+		S_REPLACE(tc->cid.cid_num, ast_strdup(chan->cid.cid_num));
+		S_REPLACE(tc->cid.cid_name, ast_strdup(chan->cid.cid_name));
+		S_REPLACE(tc->cid.cid_ani, ast_strdup(chan->cid.cid_ani));
+		S_REPLACE(tc->cid.cid_rdnis, ast_strdup(chan->cid.cid_rdnis));
 		
 		/* Copy language from incoming to outgoing */
-		ast_string_field_set(tmp->chan, language, chan->language);
-		ast_string_field_set(tmp->chan, accountcode, chan->accountcode);
-		tmp->chan->cdrflags = chan->cdrflags;
-		if (ast_strlen_zero(tmp->chan->musicclass))
-			ast_string_field_set(tmp->chan, musicclass, chan->musicclass);
-		/* Pass callingpres setting */
-		tmp->chan->cid.cid_pres = chan->cid.cid_pres;
-		/* Pass type of number */
-		tmp->chan->cid.cid_ton = chan->cid.cid_ton;
-		/* Pass type of tns */
-		tmp->chan->cid.cid_tns = chan->cid.cid_tns;
-		/* Presense of ADSI CPE on outgoing channel follows ours */
-		tmp->chan->adsicpe = chan->adsicpe;
-		/* Pass the transfer capability */
-		tmp->chan->transfercapability = chan->transfercapability;
+		ast_string_field_set(tc, language, chan->language);
+		ast_string_field_set(tc, accountcode, chan->accountcode);
+		tc->cdrflags = chan->cdrflags;
+		if (ast_strlen_zero(tc->musicclass))
+			ast_string_field_set(tc, musicclass, chan->musicclass);
+		/* Pass callingpres, type of number, tns, ADSI CPE, transfer capability */
+		tc->cid.cid_pres = chan->cid.cid_pres;
+		tc->cid.cid_ton = chan->cid.cid_ton;
+		tc->cid.cid_tns = chan->cid.cid_tns;
+		tc->adsicpe = chan->adsicpe;
+		tc->transfercapability = chan->transfercapability;
 
 		/* If we have an outbound group, set this peer channel to it */
 		if (outbound_group)
-			ast_app_group_set_channel(tmp->chan, outbound_group);
+			ast_app_group_set_channel(tc, outbound_group);
 
 		/* Inherit context and extension */
-		ast_copy_string(tmp->chan->dialcontext, chan->context, sizeof(tmp->chan->dialcontext));
-		ast_copy_string(tmp->chan->exten, chan->exten, sizeof(tmp->chan->exten));
-
-		/* Place the call, but don't wait on the answer */
-		res = ast_call(tmp->chan, numsubst, 0);
+		ast_copy_string(tc->dialcontext, chan->context, sizeof(tc->dialcontext));
+		ast_copy_string(tc->exten, chan->exten, sizeof(tc->exten));
+
+		res = ast_call(tc, numsubst, 0);	/* Place the call, but don't wait on the answer */
 
 		/* Save the info in cdr's that we called them */
 		if (chan->cdr)
-			ast_cdr_setdestchan(chan->cdr, tmp->chan->name);
+			ast_cdr_setdestchan(chan->cdr, tc->name);
 
 		/* check the results of ast_call */
 		if (res) {
@@ -1402,20 +1408,22 @@
 				ast_log(LOG_DEBUG, "ast call on peer returned %d\n", res);
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Couldn't call %s\n", numsubst);
-			ast_hangup(tmp->chan);
-			tmp->chan = NULL;
+			ast_hangup(tc);
+			tc = NULL;
+			free(tmp);
 			continue;
 		} else {
-			senddialevent(chan, tmp->chan);
+			senddialevent(chan, tc);
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
 			if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID))
-				ast_set_callerid(tmp->chan, S_OR(chan->macroexten, chan->exten), get_cid_name(cidname, sizeof(cidname), chan), NULL);
+				ast_set_callerid(tc, S_OR(chan->macroexten, chan->exten), get_cid_name(cidname, sizeof(cidname), chan), NULL);
 		}
 		/* Put them in the list of outgoing thingies...  We're ready now. 
 		   XXX If we're forcibly removed, these outgoing calls won't get
 		   hung up XXX */
 		ast_set_flag(tmp, DIAL_STILLGOING);	
+		tmp->chan = tc;
 		tmp->next = outgoing;
 		outgoing = tmp;

[... 26903 lines stripped ...]


More information about the asterisk-commits mailing list