[Freeswitch-svn] [commit] r1821 - in freeswitch/branches/mishehu: . conf scripts src src/include src/mod/applications/mod_conference src/mod/applications/mod_rss src/mod/codecs/mod_g711 src/mod/codecs/mod_g729 src/mod/codecs/mod_gsm src/mod/codecs/mod_ilbc src/mod/codecs/mod_l16 src/mod/codecs/mod_speex src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_exosip src/mod/endpoints/mod_iax src/mod/loggers/mod_cdr w32/vsnet

Freeswitch SVN mishehu at freeswitch.org
Mon Jul 10 18:42:23 EDT 2006


Author: mishehu
Date: Mon Jul 10 18:42:22 2006
New Revision: 1821

Added:
   freeswitch/branches/mishehu/scripts/fsxs.in
      - copied unchanged from r1820, /freeswitch/trunk/scripts/fsxs.in
   freeswitch/branches/mishehu/src/mod/applications/mod_conference/
      - copied from r1820, /freeswitch/trunk/src/mod/applications/mod_conference/
   freeswitch/branches/mishehu/src/mod/applications/mod_conference/mod_conference.c
      - copied unchanged from r1820, /freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/branches/mishehu/src/mod/applications/mod_conference/mod_conference.vcproj
      - copied unchanged from r1820, /freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.vcproj
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/README
Removed:
   freeswitch/branches/mishehu/fsxs.in
Modified:
   freeswitch/branches/mishehu/Makefile.am
   freeswitch/branches/mishehu/Makefile.in
   freeswitch/branches/mishehu/conf/freeswitch.xml
   freeswitch/branches/mishehu/modules.conf.in
   freeswitch/branches/mishehu/src/include/switch_core.h
   freeswitch/branches/mishehu/src/include/switch_loadable_module.h
   freeswitch/branches/mishehu/src/include/switch_module_interfaces.h
   freeswitch/branches/mishehu/src/include/switch_types.h
   freeswitch/branches/mishehu/src/mod/applications/mod_rss/mod_rss.c
   freeswitch/branches/mishehu/src/mod/codecs/mod_g711/mod_g711.c
   freeswitch/branches/mishehu/src/mod/codecs/mod_g729/mod_g729.c
   freeswitch/branches/mishehu/src/mod/codecs/mod_gsm/mod_gsm.c
   freeswitch/branches/mishehu/src/mod/codecs/mod_ilbc/mod_ilbc.c
   freeswitch/branches/mishehu/src/mod/codecs/mod_l16/mod_l16.c
   freeswitch/branches/mishehu/src/mod/codecs/mod_speex/mod_speex.c
   freeswitch/branches/mishehu/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/mishehu/src/mod/endpoints/mod_exosip/mod_exosip.c
   freeswitch/branches/mishehu/src/mod/endpoints/mod_iax/mod_iax.c
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.h
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.h
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.h
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.h
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.h
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mod_cdr.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.cpp
   freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.h
   freeswitch/branches/mishehu/src/switch.c
   freeswitch/branches/mishehu/src/switch_channel.c
   freeswitch/branches/mishehu/src/switch_core.c
   freeswitch/branches/mishehu/src/switch_loadable_module.c
   freeswitch/branches/mishehu/w32/vsnet/Freeswitch.sln

Log:
Added some documentation and filled in the descriptions at the top of all files.  Merged to trunk r1820.

Modified: freeswitch/branches/mishehu/Makefile.am
==============================================================================
--- freeswitch/branches/mishehu/Makefile.am	(original)
+++ freeswitch/branches/mishehu/Makefile.am	Mon Jul 10 18:42:22 2006
@@ -124,7 +124,7 @@
 src/include/switch_xml.h
 
 BUILT_SOURCES = version depends
-CLEANFILES = src/include/switch_version.h fsxs
+CLEANFILES = src/include/switch_version.h scripts/fsxs
 
 
 lib_LTLIBRARIES		= libfreeswitch.la
@@ -134,7 +134,7 @@
 nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h
 
 bin_PROGRAMS =	freeswitch
-bin_SCRIPTS = fsxs
+bin_SCRIPTS = scripts/fsxs
 freeswitch_SOURCES = 	src/switch.c\
 			src/include/switch_version.h
 freeswitch_CFLAGS = $(AM_CFLAGS)
@@ -234,7 +234,7 @@
 dox:
 	cd docs && doxygen $(PWD)/docs/Doxygen.conf
 
-fsxs: fsxs.in
+scripts/fsxs: scripts/fsxs.in
 	@echo creating fsxs
 	@sed -e "s, at MODULES_DIR\@,$(PREFIX)/mod," \
 	    -e "s, at LIB_DIR\@,$(PREFIX)/lib," \
@@ -253,7 +253,7 @@
 	    -e "s|@SOLINK\@|$(SOLINK)|" \
 	    -e "s|@LDFLAGS\@|-L$(PREFIX)/lib|" \
 	    -e "s|@LIBS\@|-lfreeswitch|" \
-	    fsxs.in > fsxs
+	    scripts/fsxs.in > scripts/fsxs
 
 eclean: clean
 	rm -f `find . -type f -name \*~`

Modified: freeswitch/branches/mishehu/Makefile.in
==============================================================================
--- freeswitch/branches/mishehu/Makefile.in	(original)
+++ freeswitch/branches/mishehu/Makefile.in	Mon Jul 10 18:42:22 2006
@@ -16,6 +16,7 @@
 
 
 
+
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -70,7 +71,7 @@
   esac;
 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
-	"$(DESTDIR)$(library_includedir)"
+	"$(DESTDIR)$(bindir)" "$(DESTDIR)$(library_includedir)"
 libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
 libfreeswitch_la_DEPENDENCIES =
@@ -95,6 +96,8 @@
 am_freeswitch_OBJECTS = freeswitch-switch.$(OBJEXT)
 freeswitch_OBJECTS = $(am_freeswitch_OBJECTS)
 freeswitch_DEPENDENCIES = ${top_builddir}/libfreeswitch.la
+binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(bin_SCRIPTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src/include
 depcomp = $(SHELL) $(top_srcdir)/build/config/depcomp
 am__depfiles_maybe = depfiles
@@ -339,12 +342,13 @@
 src/include/switch_xml.h
 
 BUILT_SOURCES = version depends
-CLEANFILES = src/include/switch_version.h
+CLEANFILES = src/include/switch_version.h scripts/fsxs
 lib_LTLIBRARIES = libfreeswitch.la
 libfreeswitch_la_CFLAGS = $(AM_CFLAGS) -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -std=c99 
 libfreeswitch_la_LDFLAGS = -version-info 1:0:0
 libfreeswitch_la_LIBADD = -lteletone -lresample -lsrtp -lsqlite3 -lspeakup
 nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h
+bin_SCRIPTS = scripts/fsxs
 freeswitch_SOURCES = src/switch.c\
 			src/include/switch_version.h
 
@@ -467,7 +471,26 @@
 freeswitch$(EXEEXT): $(freeswitch_OBJECTS) $(freeswitch_DEPENDENCIES) 
 	@rm -f freeswitch$(EXEEXT)
 	$(LINK) $(freeswitch_LDFLAGS) $(freeswitch_OBJECTS) $(freeswitch_LDADD) $(LIBS)
+install-binSCRIPTS: $(bin_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	@list='$(bin_SCRIPTS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f $$d$$p; then \
+	    f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+	    echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	    $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \
+	  else :; fi; \
+	done
 
+uninstall-binSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_SCRIPTS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
 
@@ -935,12 +958,12 @@
 check-am: all-am
 check: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) check-recursive
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS)
 install-binPROGRAMS: install-libLTLIBRARIES
 
 installdirs: installdirs-recursive
 installdirs-am:
-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(library_includedir)"; do \
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(library_includedir)"; do \
 	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
 	done
 install: $(BUILT_SOURCES)
@@ -994,7 +1017,8 @@
 
 install-data-am: install-library_includeHEADERS
 
-install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+install-exec-am: install-binPROGRAMS install-binSCRIPTS \
+	install-libLTLIBRARIES
 
 install-info: install-info-recursive
 
@@ -1022,8 +1046,9 @@
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS uninstall-info-am \
-	uninstall-libLTLIBRARIES uninstall-library_includeHEADERS
+uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
+	uninstall-info-am uninstall-libLTLIBRARIES \
+	uninstall-library_includeHEADERS
 
 uninstall-info: uninstall-info-recursive
 
@@ -1035,16 +1060,16 @@
 	distclean-generic distclean-hdr distclean-libtool \
 	distclean-recursive distclean-tags distcleancheck distdir \
 	distuninstallcheck dvi dvi-am html html-am info info-am \
-	install install-am install-binPROGRAMS install-data \
-	install-data-am install-exec install-exec-am install-info \
-	install-info-am install-libLTLIBRARIES \
+	install install-am install-binPROGRAMS install-binSCRIPTS \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-libLTLIBRARIES \
 	install-library_includeHEADERS install-man install-strip \
 	installcheck installcheck-am installdirs installdirs-am \
 	maintainer-clean maintainer-clean-generic \
 	maintainer-clean-recursive mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
 	pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
-	uninstall-binPROGRAMS uninstall-info-am \
+	uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-info-am \
 	uninstall-libLTLIBRARIES uninstall-library_includeHEADERS
 
 
@@ -1137,6 +1162,27 @@
 
 dox:
 	cd docs && doxygen $(PWD)/docs/Doxygen.conf
+
+scripts/fsxs: scripts/fsxs.in
+	@echo creating fsxs
+	@sed -e "s, at MODULES_DIR\@,$(PREFIX)/mod," \
+	    -e "s, at LIB_DIR\@,$(PREFIX)/lib," \
+	    -e "s, at BIN_DIR\@,$(PREFIX)/bin," \
+	    -e "s, at INC_DIR\@,$(PREFIX)/include," \
+	    -e "s, at CFG_DIR\@,$(PREFIX)/conf," \
+	    -e "s, at DB_DIR\@,$(PREFIX)/db," \
+	    -e "s, at PREFIX\@,$(PREFIX)," \
+	    -e "s, at CC\@,$(CC)," \
+	    -e "s, at LD\@,$(CC)," \
+	    -e "s, at INSTALL\@,$(INSTALL)," \
+	    -e "s, at MKINSTALLDIRS\@,$(mkdir_p)," \
+	    \
+	    -e "s|@CFLAGS\@|$(CFLAGS) -fPIC $(shell $(APR_CONFIG) --cflags --cppflags)|" \
+	    -e "s|@INCLUDES\@|-I$(PREFIX)/include $(shell $(APR_CONFIG) --includes) $(shell $(APU_CONFIG) --includes)|" \
+	    -e "s|@SOLINK\@|$(SOLINK)|" \
+	    -e "s|@LDFLAGS\@|-L$(PREFIX)/lib|" \
+	    -e "s|@LIBS\@|-lfreeswitch|" \
+	    scripts/fsxs.in > scripts/fsxs
 
 eclean: clean
 	rm -f `find . -type f -name \*~`

Modified: freeswitch/branches/mishehu/conf/freeswitch.xml
==============================================================================
--- freeswitch/branches/mishehu/conf/freeswitch.xml	(original)
+++ freeswitch/branches/mishehu/conf/freeswitch.xml	Mon Jul 10 18:42:22 2006
@@ -1,13 +1,19 @@
 <?xml version="1.0"?>
 <document type="freeswitch/xml">
   <section name="configuration" description="Various Configuration">
+    <configuration name="switch.conf" description="Modules">
+      <settings>
+        <!--Most channels to allow at once -->
+        <param name="max-sessions" value="1000"/>
+      </settings>
+    </configuration>
     <configuration name="modules.conf" description="Modules">
       <modules>
         <!-- Loggers (I'd load these first) -->
         <load module="mod_console"/>
         <!-- <load module="mod_syslog"/> -->
 
-	<!-- XML Interfaces -->
+        <!-- XML Interfaces -->
         <!-- <load module="mod_xml_rpc"/> -->
         
         <!-- Event Handlers -->
@@ -59,6 +65,10 @@
         <!-- ASR /TTS -->
         <!-- <load module="mod_cepstral"/> -->
         <!-- <load module="mod_rss"/> -->
+
+        <!-- Conference Bridges -->
+        <!--<load module="mod_conference"/>-->
+
         </modules>
     </configuration>
   
@@ -68,7 +78,7 @@
         <!-- <param name="ip" value="1.2.3.4"> -->
         <param name="port" value="4569"/>
         <param name="dialplan" value="XML"/>
-        <param name="codec-prefs" value="PCMU,PCMA,speex,L16"/>
+        <param name="codec-prefs" value="PCMU at 20,PCMA,speex,L16"/>
         <param name="codec-master" value="us"/>
         <param name="codec-rates" value="8"/>
       </settings>
@@ -106,13 +116,15 @@
         <param name="port" value="5060"/>
         <param name="dialplan" value="XML"/>
         <param name="dtmf-duration" value="100"/>
-        <param name="codec-prefs" value="PCMU,PCMA"/>
-	<!-- Payload number to bind DTMF to-->
+        <!-- the @20 is optional number of ms you want to use.  Use it only
+        if you know the codec supports it -->
+        <param name="codec-prefs" value="PCMU at 20,PCMA at 20"/>
+        <!-- Payload number to bind DTMF to-->
         <param name="rfc2833-pt" value="101"/>
-	<!-- disable to trade async for more calls -->
-	<param name="use-rtp-timer" value="true"/>
-	<!-- auto sense NAT issues and adjust accordingly -->
-	<param name="use-rtp-auto-adjust" value="true"/>
+        <!-- disable to trade async for more calls -->
+        <param name="use-rtp-timer" value="true"/>
+        <!-- auto sense NAT issues and adjust accordingly -->
+        <param name="use-rtp-auto-adjust" value="true"/>
         <!-- pick one (default if not specified is 'guess'); -->
         <param name="rtp-ip" value="guess"/>
         <!-- <param name-"rtp-ip" value="10.0.0.1"/> -->
@@ -228,8 +240,8 @@
         <param name="message" value="Jingle all the way"/>
         <param name="rtp-ip" value="10.0.0.1"/>
         <param name="auto-login" value="true"/>
-	<!-- disable to trade async for more calls -->
-	<param name="use-rtp-timer" value="true"/>
+        <!-- disable to trade async for more calls -->
+        <param name="use-rtp-timer" value="true"/>
         <!-- or -->
         <!-- <param name="rtp-ip" value="my_lan_ip"/> -->
         <!-- <param name="ext-rtp-ip" value="stun:stun.server.com"/> -->
@@ -243,16 +255,16 @@
     </configuration>
     <configuration name="xml_rpc.conf" description="XML RPC">
       <settings>
-	<!-- The port where you want to run the http service (default 8080) -->
-	<param name="http-port" value="8080"/>
-	<!-- if all 3 of the following params exist all http traffic will require auth -->
+        <!-- The port where you want to run the http service (default 8080) -->
+        <param name="http-port" value="8080"/>
+        <!-- if all 3 of the following params exist all http traffic will require auth -->
         <param name="auth-realm" value="freeswitch"/>
         <param name="auth-user" value="freeswitch"/>
         <param name="auth-pass" value="works"/>
         <!-- The url to a gateway cgi that can generate xml similar to
         what's in this file only on-the-fly (leave it commented if you dont
         need it) -->
-	<!-- one or more |-delim of configuration|directory|dialplan -->
+        <!-- one or more |-delim of configuration|directory|dialplan -->
         <!-- <param name="gateway-url" value="http://www.server.com/gateway.cgi" bindings="configuration"/> -->
       </settings>
     </configuration>
@@ -265,6 +277,61 @@
       </feeds>
     </configuration>
 
+    <!-- None of these paths are real if you want any of these options
+    you need to really set them up -->
+    <configuration name="conference.conf" description="Audio Conference">
+      <!-- Profiles are collections of settings you can reference by name. -->
+
+      <profiles>
+        <profile name="default">
+          <!-- Sample Rate-->
+          <param name="rate" value="8000"/>
+          <!-- Number of milliseconds per frame -->
+          <param name="interval" value="20"/>
+          <!-- Energy level required for audio to be sent to the other users -->
+          <param name="energy-level" value="300"/>
+          <!-- TTS Engine to use -->
+          <!--<param name="tts-engine" value="cepstral"/>-->
+          <!-- TTS Voice to use -->
+          <!--<param name="tts-voice" value="david"/>-->
+
+          <!-- If TTS is enabled all audio-file params not beginning with '/'
+          will be considered text to say with TTS -->
+
+          <!-- File to play to acknowledge succees -->
+          <!--<param name="ack-sound" value="/soundfiles/beep.wav"/>-->
+          <!-- File to play to acknowledge failure -->
+          <!--<param name="nack-sound" value="/soundfiles/beeperr.wav"/>-->
+          <!-- File to play to acknowledge muted -->
+          <!--<param name="muted-sound" value="/soundfiles/muted.wav"/>-->
+          <!-- File to play to acknowledge unmuted -->
+          <!--<param name="unmuted-sound" value="/soundfiles/unmuted.wav"/>-->
+          <!-- File to play if you are alone in the conference -->
+          <!--<param name="alone-sound" value="/soundfiles/yactopitc.wav"/>-->
+          <!-- File to play when you join the conference -->
+          <!--<param name="enter-sound" value="/soundfiles/welcome.wav"/>-->
+          <!-- File to play when you leave the conference -->
+          <!--<param name="exit-sound" value="/soundfiles/exit.wav"/>-->
+          <!-- File to play when you ae ejected from the conference -->
+          <!--<param name="kicked-sound" value="/soundfiles/kicked.wav"/>-->
+          <!-- File to play when the conference is locked -->
+          <!--<param name="locked-sound" value="/soundfiles/locked.wav"/>-->
+          <!-- File to play to prompt for a pin -->
+          <!--<param name="pin-sound" value="/soundfiles/pin.wav"/>-->
+          <!-- File to play to when the pin is invalid -->
+          <!--<param name="bad-pin-sound" value="/soundfiles/invalid-pin.wav"/>-->
+          <!-- Conference pin -->
+          <!--<param name="pin" value="12345"/>-->
+          <!-- Default Caller ID Name for outbound calls -->
+          <param name="caller-id-name" value="FreeSWITCH"/>
+          <!-- Default Caller ID Number for outbound calls -->
+          <param name="caller-id-number" value="8777423583"/>
+        </profile>
+      </profiles>
+      <rooms>
+        <room name="freeswitch" profile="default"/>
+      </rooms>
+    </configuration>
   </section>
   <section name="dialplan" description="Regex/XML Dialplan">
     <!-- Valid fields in conditions:
@@ -274,18 +341,32 @@
 
     <!-- *NOTE* The special context name 'any' will match any context -->
     <context name="default">
-			<extension name="tollfree">
-      	<condition field="destination_number" expression="^(18[0{2}8{2}7{2}6{2}]\d{7})">
-					<action application="bridge" data="exosip/$1-freeswitch at voip.trxtel.com"/>
-				</condition>
-			</extension>
+      <extension name="tollfree">
+        <condition field="destination_number" expression="^(18[0{2}8{2}7{2}6{2}]\d{7})">
+          <action application="bridge" data="exosip/$1-freeswitch at voip.trxtel.com"/>
+        </condition>
+      </extension>
 
-			<extension name="devconf">
-				<condition field="destination_number" expression="^888$">
-					<action application="bridge" data="exosip/888 at 66.250.68.194"/>
-				</condition>
-			</extension>
+      <extension name="devconf">
+        <condition field="destination_number" expression="^888$">
+          <action application="bridge" data="exosip/888 at 66.250.68.194"/>
+        </condition>
+      </extension>
 
+      <!-- Enter an existing conference -->
+      <extension name="1000">
+        <condition field="destination_number" expression="^1000$">
+          <action application="conference" data="freeswitch"/>
+        </condition>
+      </extension>
+
+      <!-- Start a dynamic conference and call someone at the same time -->
+      <extension name="2000">
+        <condition field="destination_number" expression="^2000$">
+          <action application="conference" data="bridge:mydynaconf:exosip/1234 at 66.250.68.194"/>
+        </condition>
+      </extension>
+
       <!-- if the destination is an exact match on the extension name
       you do not need any regex in the condition -->
       <extension name="999">
@@ -294,30 +375,30 @@
       <!-- extensions starting with 4, all the numbers after 4 form a numeric filename
            continue=true means keep looking for more extensions to match
            *NOTE* The entire dialplan is parsed ONCE when the call starts 
-	   so any call info acquired after the various actions cannot
-	   be taken into consideration. 
+           so any call info acquired after the various actions cannot
+           be taken into consideration. 
 
-	   The first match will play a beep and the second one plays
-	   the desired file.  This is for demo purposes both actions
-	   could have been under the same <extension> tag as well.
-	   -->
+           The first match will play a beep and the second one plays
+           the desired file.  This is for demo purposes both actions
+           could have been under the same <extension> tag as well.
+           -->
       <extension name="playsound1" continue="true">
         <condition field="source" expression="mod_exosip"/>
         <condition field="destination_number" expression="^4(\d+)">
           <action application="playback" data="/var/sounds/beep.gsm"/>
-	</condition>
+        </condition>
       </extension>
       <extension name="playsound2">
         <condition field="source" expression="mod_exosip"/>
         <condition field="destination_number" expression="^4(\d+)">
           <action application="playback" data="/root/$1.raw"/>
-	</condition>
+        </condition>
       </extension>
       <!-- send everything with a certian RDNIS to Wanpipe ISDN -->
       <extension name="To PRI">
         <condition field="rdnis" expression="8881231234"/>
         <condition field="destination_number" expression="(.*)">
-	    <action application="bridge" data="wanpipe/a/a/$1"/>
+            <action application="bridge" data="wanpipe/a/a/$1"/>
         </condition>
       </extension>
       <!-- Call *MUST* originate from mod_iax and also be dialing ext 9999-->

Modified: freeswitch/branches/mishehu/modules.conf.in
==============================================================================
--- freeswitch/branches/mishehu/modules.conf.in	(original)
+++ freeswitch/branches/mishehu/modules.conf.in	Mon Jul 10 18:42:22 2006
@@ -1,6 +1,7 @@
 loggers/mod_console
 loggers/mod_syslog
 applications/mod_commands
+applications/mod_conference
 applications/mod_bridgecall
 applications/mod_echo
 applications/mod_ivrtest

Modified: freeswitch/branches/mishehu/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_core.h	(original)
+++ freeswitch/branches/mishehu/src/include/switch_core.h	Mon Jul 10 18:42:22 2006
@@ -117,6 +117,13 @@
 SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err);
 
 /*! 
+  \brief Set/Get Session Limit
+  \param new new value (if > 0)
+  \return the current session limit
+*/
+SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new);
+
+/*! 
   \brief Destroy the core
   \note to be called at application shutdown
 */
@@ -308,6 +315,11 @@
   \note if the session was located it will have a read lock obtained which will need to be released with switch_core_session_rwunlock()
 */
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(char *uuid_str);
+
+/*! 
+  \brief Hangup All Sessions
+*/
+SWITCH_DECLARE(void) switch_core_session_hupall(void);
 
 /*! 
   \brief Send a message to another session using it's uuid

Modified: freeswitch/branches/mishehu/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_loadable_module.h	(original)
+++ freeswitch/branches/mishehu/src/include/switch_loadable_module.h	Mon Jul 10 18:42:22 2006
@@ -171,10 +171,10 @@
   \param arraylen the max size in elements of the array
   \return the number of elements added to the array
  */
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, 
-													  switch_codec_interface_t **array, 
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, const switch_codec_implementation_t **array,
 													  int arraylen);
 
+
 /*!
   \brief Retrieve the list of loaded codecs into an array based on another array showing the sorted order
   \param array the array to populate
@@ -184,10 +184,8 @@
   \return the number of elements added to the array
   \note this function only considers codecs that are listed in the "prefs" array and ignores the rest.
 */
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_codec_interface_t **array,
-															 int arraylen, 
-															 char **prefs, 
-															 int preflen);
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array,
+															 int arraylen, char **prefs, int preflen);
 
 /*!
   \brief Execute a registered API command

Modified: freeswitch/branches/mishehu/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_module_interfaces.h	(original)
+++ freeswitch/branches/mishehu/src/include/switch_module_interfaces.h	Mon Jul 10 18:42:22 2006
@@ -444,6 +444,8 @@
 
 /*! \brief A table of settings and callbacks that define a paticular implementation of a codec */
 struct switch_codec_implementation {
+	/*! enumeration defining the type of the codec */
+	const switch_codec_type_t codec_type;
 	/*! the IANA code number */
 	switch_payload_t ianacode;
 	/*! the IANA code name */
@@ -497,8 +499,6 @@
 struct switch_codec_interface {
 	/*! the name of the interface */
 	const char *interface_name;
-	/*! enumeration defining the type of the codec */
-	const switch_codec_type_t codec_type;
 	/*! a list of codec implementations related to the codec */
 	const switch_codec_implementation_t *implementations;
 	const struct switch_codec_interface *next;

Modified: freeswitch/branches/mishehu/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_types.h	(original)
+++ freeswitch/branches/mishehu/src/include/switch_types.h	Mon Jul 10 18:42:22 2006
@@ -619,7 +619,8 @@
 	SWITCH_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103,
 	SWITCH_CAUSE_PROTOCOL_ERROR = 111,
 	SWITCH_CAUSE_INTERWORKING = 127,
-	SWITCH_CAUSE_CRASH = 500
+	SWITCH_CAUSE_CRASH = 500,
+	SWITCH_CAUSE_SYSTEM_SHUTDOWN = 501
 } switch_call_cause_t;
 
 

Modified: freeswitch/branches/mishehu/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/applications/mod_rss/mod_rss.c	(original)
+++ freeswitch/branches/mishehu/src/mod/applications/mod_rss/mod_rss.c	Mon Jul 10 18:42:22 2006
@@ -602,15 +602,17 @@
 						cont = 0;
 						continue;
 					}
-
-					status = switch_ivr_speak_text_handle(session,
-														  &sh,
-														  &speech_codec,
-														  timerp,
-														  on_dtmf,
-														  entries[dtb.index].description_txt,
-														  &dtb,
-														  sizeof(dtb));
+					
+					if (entries[dtb.index].description_txt) {
+						status = switch_ivr_speak_text_handle(session,
+															  &sh,
+															  &speech_codec,
+															  timerp,
+															  on_dtmf,
+															  entries[dtb.index].description_txt,
+															  &dtb,
+															  sizeof(dtb));
+					}
 					if (status == SWITCH_STATUS_BREAK) {
 						continue;
 					} else if (status != SWITCH_STATUS_SUCCESS) {

Modified: freeswitch/branches/mishehu/src/mod/codecs/mod_g711/mod_g711.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/codecs/mod_g711/mod_g711.c	(original)
+++ freeswitch/branches/mishehu/src/mod/codecs/mod_g711/mod_g711.c	Mon Jul 10 18:42:22 2006
@@ -190,6 +190,7 @@
 #if 0
 
 static const switch_codec_implementation_t g711u_8k_60ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 0,
 	/*.iananame */ "PCMU",
 	/*.samples_per_second */ 8000,
@@ -206,9 +207,10 @@
 	/*.decode */ switch_g711u_decode,
 	/*.destroy */ switch_g711u_destroy
 };
+#endif
 
-
 static const switch_codec_implementation_t g711u_8k_30ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 0,
 	/*.iananame */ "PCMU",
 	/*.samples_per_second */ 8000,
@@ -224,11 +226,11 @@
 	/*.encode */ switch_g711u_encode,
 	/*.decode */ switch_g711u_decode,
 	/*.destroy */ switch_g711u_destroy,
-	/*.next */ &g711u_8k_60ms_implementation
+	/*.next */ NULL
 };
-#endif
 
 static const switch_codec_implementation_t g711u_16k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 0,
 	/*.iananame */ "PCMU",
 	/*.samples_per_second */ 16000,
@@ -244,9 +246,11 @@
 	/*.encode */ switch_g711u_encode,
 	/*.decode */ switch_g711u_decode,
 	/*.destroy */ switch_g711u_destroy,
+	/*.next */ &g711u_8k_30ms_implementation
 };
 
 static const switch_codec_implementation_t g711u_8k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 0,
 	/*.iananame */ "PCMU",
 	/*.samples_per_second */ 8000,
@@ -267,6 +271,7 @@
 
 
 static const switch_codec_implementation_t g711a_8k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 8,
 	/*.iananame */ "PCMA",
 	/*.samples_per_second */ 8000,
@@ -287,13 +292,11 @@
 
 static const switch_codec_interface_t g711a_codec_interface = {
 	/*.interface_name */ "g711 alaw",
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.implementations */ &g711a_8k_implementation
 };
 
 static const switch_codec_interface_t g711u_codec_interface = {
 	/*.interface_name */ "g711 ulaw",
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.implementations */ &g711u_8k_implementation,
 	/*.next */ &g711a_codec_interface
 };

Modified: freeswitch/branches/mishehu/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/codecs/mod_g729/mod_g729.c	(original)
+++ freeswitch/branches/mishehu/src/mod/codecs/mod_g729/mod_g729.c	Mon Jul 10 18:42:22 2006
@@ -219,6 +219,7 @@
 /* Registration */ 
 
 static const switch_codec_implementation_t g729_10ms_8k_implementation = { 
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 	/*.ianacode */ 18, 
 	/*.iananame */ "G729", 
 	/*.samples_per_second */ 8000, 
@@ -237,6 +238,7 @@
 };
 
 static const switch_codec_implementation_t g729_8k_implementation = { 
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 	/*.ianacode */ 18, 
 	/*.iananame */ "G729", 
 	/*.samples_per_second */ 8000, 
@@ -258,7 +260,6 @@
 
 static const switch_codec_interface_t g729_codec_interface = { 
 	/*.interface_name */ "g729", 
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 	/*.implementations */ &g729_8k_implementation, 
 };
 

Modified: freeswitch/branches/mishehu/src/mod/codecs/mod_gsm/mod_gsm.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/codecs/mod_gsm/mod_gsm.c	(original)
+++ freeswitch/branches/mishehu/src/mod/codecs/mod_gsm/mod_gsm.c	Mon Jul 10 18:42:22 2006
@@ -133,6 +133,7 @@
 
 /* Registration */ 
 static const switch_codec_implementation_t gsm_8k_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 3, 
 		/*.iananame */ "gsm", 
 		/*.samples_per_second */ 8000, 
@@ -151,7 +152,6 @@
 };
 static const switch_codec_interface_t gsm_codec_interface = { 
 		/*.interface_name */ "gsm", 
-		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.implementations */ &gsm_8k_implementation, 
 };
 static switch_loadable_module_interface_t gsm_module_interface = { 

Modified: freeswitch/branches/mishehu/src/mod/codecs/mod_ilbc/mod_ilbc.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/codecs/mod_ilbc/mod_ilbc.c	(original)
+++ freeswitch/branches/mishehu/src/mod/codecs/mod_ilbc/mod_ilbc.c	Mon Jul 10 18:42:22 2006
@@ -186,6 +186,7 @@
 /* Registration */ 
 
 static const switch_codec_implementation_t ilbc_8k_30ms_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 97, 
 		/*.iananame */ "iLBC", 
 		/*.samples_per_second */ 8000, 
@@ -204,6 +205,7 @@
 };
 
 static const switch_codec_implementation_t ilbc_8k_20ms_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 97, 
 		/*.iananame */ "iLBC", 
 		/*.samples_per_second */ 8000, 
@@ -225,6 +227,7 @@
 
 
 static const switch_codec_implementation_t ilbc_102_8k_30ms_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 102, 
 		/*.iananame */ "iLBC", 
 		/*.samples_per_second */ 8000, 
@@ -243,6 +246,7 @@
 };
 
 static const switch_codec_implementation_t ilbc_102_8k_20ms_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 102, 
 		/*.iananame */ "iLBC102", 
 		/*.samples_per_second */ 8000, 
@@ -263,6 +267,7 @@
 
 
 static const switch_codec_implementation_t ilbc_8k_20ms_nonext_implementation = { 
+		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.ianacode */ 97, 
 		/*.iananame */ "iLBC20ms",
 		/*.samples_per_second */ 8000, 
@@ -283,20 +288,17 @@
 
 static const switch_codec_interface_t ilbc_20ms_codec_interface = { 
 		/*.interface_name */ "ilbc", 
-		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.implementations */ &ilbc_8k_20ms_nonext_implementation
 };
 
 static const switch_codec_interface_t ilbc_102_codec_interface = { 
 		/*.interface_name */ "ilbc", 
-		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.implementations */ &ilbc_102_8k_20ms_implementation, 
 		/*.next*/ &ilbc_20ms_codec_interface
 };
 
 static const switch_codec_interface_t ilbc_codec_interface = { 
 		/*.interface_name */ "ilbc", 
-		/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
 		/*.implementations */ &ilbc_8k_20ms_implementation, 
 		/*.next*/ &ilbc_102_codec_interface
 };

Modified: freeswitch/branches/mishehu/src/mod/codecs/mod_l16/mod_l16.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/codecs/mod_l16/mod_l16.c	(original)
+++ freeswitch/branches/mishehu/src/mod/codecs/mod_l16/mod_l16.c	Mon Jul 10 18:42:22 2006
@@ -90,6 +90,7 @@
 }
 
 static const switch_codec_implementation_t raw_32k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second = */ 32000,
@@ -108,6 +109,7 @@
 };
 
 static const switch_codec_implementation_t raw_22k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second = */ 22050,
@@ -127,6 +129,7 @@
 };
 
 static const switch_codec_implementation_t raw_16k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second = */ 16000,
@@ -146,6 +149,7 @@
 };
 
 static const switch_codec_implementation_t raw_8k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second = */ 8000,
@@ -166,6 +170,7 @@
 
 
 static const switch_codec_implementation_t raw_8k_30ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second */ 8000,
@@ -186,6 +191,7 @@
 
 
 static const switch_codec_implementation_t raw_8k_60ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second */ 8000,
@@ -205,6 +211,7 @@
 };
 
 static const switch_codec_implementation_t raw_8k_120ms_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 10,
 	/*.iananame */ "L16",
 	/*.samples_per_second */ 8000,
@@ -226,7 +233,6 @@
 
 static const switch_codec_interface_t raw_codec_interface = {
 	/*.interface_name */ "raw signed linear (16 bit)",
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.implementations */ &raw_8k_120ms_implementation
 };
 

Modified: freeswitch/branches/mishehu/src/mod/codecs/mod_speex/mod_speex.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/codecs/mod_speex/mod_speex.c	(original)
+++ freeswitch/branches/mishehu/src/mod/codecs/mod_speex/mod_speex.c	Mon Jul 10 18:42:22 2006
@@ -268,6 +268,7 @@
 
 /* Registration */
 static const switch_codec_implementation_t speex_32k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 98,
 	/*.iananame */ "speex",
 	/*.samples_per_second */ 32000,
@@ -286,6 +287,7 @@
 };
 
 static const switch_codec_implementation_t speex_16k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 98,
 	/*.iananame */ "speex",
 	/*.samples_per_second */ 16000,
@@ -305,6 +307,7 @@
 };
 
 static const switch_codec_implementation_t speex_8k_implementation = {
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 98,
 	/*.iananame */ "speex",
 	/*.samples_per_second */ 8000,
@@ -325,7 +328,6 @@
 
 static const switch_codec_interface_t speex_codec_interface = {
 	/*.interface_name */ "speex",
-	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.implementations */ &speex_8k_implementation
 };
 

Modified: freeswitch/branches/mishehu/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/mishehu/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Mon Jul 10 18:42:22 2006
@@ -113,7 +113,7 @@
 	switch_caller_profile_t *caller_profile;
 	unsigned short samprate;
 	switch_mutex_t *mutex;
-	switch_codec_interface_t *codecs[SWITCH_MAX_CODECS];
+	const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
 	unsigned int num_codecs;
 	int codec_index;
 	switch_rtp_t *rtp_session;
@@ -440,16 +440,16 @@
 	if (force || !switch_test_flag(tech_pvt, TFLAG_CODEC_READY)) {
 		if (tech_pvt->codec_index < 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't have my codec yet here's one\n");
-			tech_pvt->codec_name = lame(tech_pvt->codecs[0]->implementations->iananame);
-			tech_pvt->codec_num = tech_pvt->codecs[0]->implementations->ianacode;
+			tech_pvt->codec_name = lame(tech_pvt->codecs[0]->iananame);
+			tech_pvt->codec_num = tech_pvt->codecs[0]->ianacode;
 			tech_pvt->codec_index = 0;
 					
-			payloads[0].name = lame(tech_pvt->codecs[0]->implementations->iananame);
-			payloads[0].id = tech_pvt->codecs[0]->implementations->ianacode;
+			payloads[0].name = lame(tech_pvt->codecs[0]->iananame);
+			payloads[0].id = tech_pvt->codecs[0]->ianacode;
 			
 		} else {
-			payloads[0].name = lame(tech_pvt->codecs[tech_pvt->codec_index]->implementations->iananame);
-			payloads[0].id = tech_pvt->codecs[tech_pvt->codec_index]->implementations->ianacode;
+			payloads[0].name = lame(tech_pvt->codecs[tech_pvt->codec_index]->iananame);
+			payloads[0].id = tech_pvt->codecs[tech_pvt->codec_index]->ianacode;
 		}
 
 				
@@ -1546,22 +1546,22 @@
 				for(x = 0; x < len; x++) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name, payloads[x].id);
 					for(y = 0; y < tech_pvt->num_codecs; y++) {
-						char *name = tech_pvt->codecs[y]->implementations->iananame;
+						char *name = tech_pvt->codecs[y]->iananame;
 
 						if (!strncasecmp(name, "ilbc", 4)) {
 							name = "ilbc";
 						}
-						if (tech_pvt->codecs[y]->implementations->ianacode > 96) {
+						if (tech_pvt->codecs[y]->ianacode > 96) {
 							match = strcasecmp(name, payloads[x].name) ? 0 : 1;
 						} else {
-							match = (payloads[x].id == tech_pvt->codecs[y]->implementations->ianacode) ? 1 : 0;
+							match = (payloads[x].id == tech_pvt->codecs[y]->ianacode) ? 1 : 0;
 						}
 						
 						if (match) {
 							tech_pvt->codec_index = y;
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n", y, payloads[x].name, payloads[x].id);
-							tech_pvt->codec_name = tech_pvt->codecs[y]->implementations->iananame;
-							tech_pvt->codec_num = tech_pvt->codecs[y]->implementations->ianacode;
+							tech_pvt->codec_name = tech_pvt->codecs[y]->iananame;
+							tech_pvt->codec_num = tech_pvt->codecs[y]->ianacode;
 							if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
 								do_describe(tech_pvt, 0);
 							}

Modified: freeswitch/branches/mishehu/src/mod/endpoints/mod_exosip/mod_exosip.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/endpoints/mod_exosip/mod_exosip.c	(original)
+++ freeswitch/branches/mishehu/src/mod/endpoints/mod_exosip/mod_exosip.c	Mon Jul 10 18:42:22 2006
@@ -138,7 +138,7 @@
 	int ssrc;
 	switch_time_t last_read;
 	char *realm;
-	switch_codec_interface_t *codecs[SWITCH_MAX_CODECS];
+	const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
 	int num_codecs;
 	switch_payload_t te;
 	switch_mutex_t *flag_mutex;
@@ -173,7 +173,13 @@
 static switch_status_t exosip_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
 										switch_io_flag_t flags, int stream_id);
 static int config_exosip(int reload);
-static switch_status_t parse_sdp_media(struct private_object *tech_pvt, sdp_media_t * media, char **dname, char **drate, char **dpayload);
+static switch_status_t parse_sdp_media(struct private_object *tech_pvt,
+									   sdp_media_t * media,
+									   char **dname,
+									   char **drate,
+									   char **dpayload,
+									   const switch_codec_implementation_t **impp);
+
 static switch_status_t exosip_kill_channel(switch_core_session_t *session, int sig);
 static switch_status_t activate_rtp(struct private_object *tech_pvt);
 static void deactivate_rtp(struct private_object *tech_pvt);
@@ -356,7 +362,7 @@
 			static const switch_codec_implementation_t *imp;
 
 			for (i = 0; i < tech_pvt->num_codecs; i++) {
-				imp = tech_pvt->codecs[i]->implementations;
+				imp = tech_pvt->codecs[i];
 
 				while(NULL != imp) {
 					uint32_t sps = imp->samples_per_second;
@@ -1178,6 +1184,7 @@
 		char *displayname, *username;
 		osip_header_t *tedious;
 		char *val;
+		const switch_codec_implementation_t *imp = NULL;
 
 		switch_core_session_add_stream(session, NULL);
 		if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
@@ -1310,10 +1317,10 @@
 
 		if (tech_pvt->num_codecs > 0) {
 			int i;
-			static const switch_codec_implementation_t *imp;
+			static const switch_codec_implementation_t *imp = NULL;
 
 			for (i = 0; i < tech_pvt->num_codecs; i++) {
-				for (imp = tech_pvt->codecs[i]->implementations; imp; imp = imp->next) {
+				for (imp = tech_pvt->codecs[i]; imp; imp = imp->next) {
 					sdp_add_codec(tech_pvt->sdp_config, tech_pvt->codecs[i]->codec_type, imp->ianacode, imp->iananame,
 								  imp->samples_per_second, 0);
 
@@ -1336,18 +1343,20 @@
 			if (audio_tab[0] == NULL && video_tab[0] == NULL && t38_tab[0] == NULL && app_tab[0] == NULL) {
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Got no compatible codecs!\n");
-				break;
+				goto done;
 			}
 			for (pos = 0; audio_tab[pos] != NULL; pos++) {
 				osip_rfc3264_complete_answer(tech_pvt->sdp_config, remote_sdp, tech_pvt->local_sdp, audio_tab[pos],
 											 mline);
-				if (parse_sdp_media(tech_pvt, audio_tab[pos], &dname, &drate, &dpayload) == SWITCH_STATUS_SUCCESS) {
-					tech_pvt->payload_num = atoi(dpayload);
-					break;
+				if (parse_sdp_media(tech_pvt, audio_tab[pos], &dname, &drate, &dpayload, &imp) == SWITCH_STATUS_SUCCESS) {
+					tech_pvt->payload_num = atoi(dpayload);					
+					goto done;
 				}
 			}
 			mline++;
 		}
+	done:
+
 		free(remote_sdp_str);
 		sdp_message_o_origin_set(tech_pvt->local_sdp, "FreeSWITCH", "0", "0", "IN", "IP4", ip);
 								 
@@ -1379,6 +1388,12 @@
 		{
 			int rate = atoi(drate);
 			int ms = globals.codec_ms;
+
+
+			if (imp) {
+				ms = imp->microseconds_per_frame / 1000;
+			}
+
 			if (!strcasecmp(dname, "ilbc")) {
 				ms = 30;
 			}
@@ -1485,13 +1500,19 @@
 
 }
 
-static switch_status_t parse_sdp_media(struct private_object *tech_pvt, sdp_media_t * media, char **dname, char **drate, char **dpayload)
+static switch_status_t parse_sdp_media(struct private_object *tech_pvt,
+									   sdp_media_t * media,
+									   char **dname,
+									   char **drate,
+									   char **dpayload,
+									   const switch_codec_implementation_t **impp)
 {
 	int pos = 0;
 	sdp_attribute_t *attr = NULL;
 	char *name, *payload, *rate;
 	switch_status_t status = SWITCH_STATUS_GENERR;
 	char workspace[512];
+	const switch_codec_implementation_t *imp = NULL;
 
 	while (osip_list_eol(media->a_attributes, pos) == 0) {
 		attr = (sdp_attribute_t *) osip_list_get(media->a_attributes, pos);
@@ -1521,11 +1542,9 @@
 			}
 
 			for(i = 0; !match && i < tech_pvt->num_codecs; i++) {
-				const switch_codec_implementation_t *imp;
-				
-				
-				for (imp = tech_pvt->codecs[i]->implementations; imp; imp = imp->next) {
 
+				for (imp = tech_pvt->codecs[i]; imp; imp = imp->next) {
+
 					if (pt < 97) {
 						match = (pt == imp->ianacode) ? 1 : 0;
 					} else {
@@ -1543,9 +1562,10 @@
 				*dname = strdup(name);
 				*drate = strdup(rate);
 				*dpayload = strdup(payload);
+				*impp = imp;
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Found negotiated codec Payload: %s Name: %s Rate: %s\n",
 								  *dpayload, *dname, *drate);	
-				break;
+				return SWITCH_STATUS_SUCCESS;
 			}
 
 		}
@@ -1652,8 +1672,8 @@
 	struct private_object *tech_pvt;
 	char *dpayload = NULL, *dname = NULL, *drate = NULL;
 	switch_channel_t *channel;
+	const switch_codec_implementation_t *imp = NULL;
 
-
 	if ((tech_pvt = get_pvt_by_call_id(event->cid)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cannot answer nonexistant call [%d]!\n", event->cid);
 		return;
@@ -1684,20 +1704,23 @@
 	snprintf(tech_pvt->remote_sdp_audio_ip, 50, conn->c_addr);
 
 	/* Grab codec elements */
-	if (parse_sdp_media(tech_pvt, remote_med, &dname, &drate, &dpayload) == SWITCH_STATUS_SUCCESS) {
+	if (parse_sdp_media(tech_pvt, remote_med, &dname, &drate, &dpayload, &imp) == SWITCH_STATUS_SUCCESS) {
 		tech_pvt->payload_num = atoi(dpayload);
 	}
 
 	/* Assign them thar IDs */
 	tech_pvt->did = event->did;
 	tech_pvt->tid = event->tid;
-
-
 	{
 		int rate = atoi(drate);
 		int ms = globals.codec_ms;
+
 		if (!strcasecmp(dname, "ilbc")) {
 			ms = 30;
+		}
+
+		if (imp) {
+			ms = imp->microseconds_per_frame / 1000;
 		}
 
 		if (switch_core_codec_init(&tech_pvt->read_codec,

Modified: freeswitch/branches/mishehu/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/endpoints/mod_iax/mod_iax.c	(original)
+++ freeswitch/branches/mishehu/src/mod/endpoints/mod_iax/mod_iax.c	Mon Jul 10 18:42:22 2006
@@ -213,10 +213,11 @@
 	//int rate = 8000;
 	//int codec_ms = 20;
 	switch_channel_t *channel;
-	switch_codec_interface_t *codecs[SWITCH_MAX_CODECS];
+	const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
 	int num_codecs = 0;
 	unsigned int local_cap = 0, mixed_cap = 0, chosen = 0, leading = 0;
 	int x, srate = 8000;
+	uint32_t interval = 0;
 
 	if (globals.codec_string) {
 		if ((num_codecs = switch_loadable_module_get_codecs_sorted(codecs,
@@ -235,7 +236,7 @@
 
 	for (x = 0; x < num_codecs; x++) {
 		static const switch_codec_implementation_t *imp;
-		for (imp = codecs[x]->implementations; imp; imp = imp->next) {
+		for (imp = codecs[x]; imp; imp = imp->next) {
 			unsigned int codec = iana2ast(imp->ianacode);
 		
 			if (io == IAX_QUERY) {
@@ -251,7 +252,7 @@
 		mixed_cap = local_cap;
 	}
 
-	leading = iana2ast(codecs[0]->implementations->ianacode);
+	leading = iana2ast(codecs[0]->ianacode);
 	if (io == IAX_QUERY) {
 		chosen = leading;
 		*format = chosen;
@@ -263,7 +264,7 @@
 		return SWITCH_STATUS_SUCCESS;
 	} else if (switch_test_flag(&globals, GFLAG_MY_CODEC_PREFS) && (leading & mixed_cap)) {
 		chosen = leading;
-		dname = codecs[0]->implementations->iananame;
+		dname = codecs[0]->iananame;
 	} else {
 		unsigned int prefs[32];
 		int len = 0;
@@ -288,9 +289,10 @@
 					chosen = prefs[x];
 					for (z = 0; z < num_codecs; z++) {
 						static const switch_codec_implementation_t *imp;
-						for (imp = codecs[z]->implementations; imp; imp = imp->next) {
+						for (imp = codecs[z]; imp; imp = imp->next) {
 							if (prefs[x] == iana2ast(imp->ianacode)) {
 								dname = imp->iananame;
+								interval = imp->microseconds_per_frame / 1000;
 								break;
 							}
 						}
@@ -303,10 +305,11 @@
 				chosen = *format;
 				for (x = 0; x < num_codecs; x++) {
 					static const switch_codec_implementation_t *imp;
-					for (imp = codecs[x]->implementations; imp; imp = imp->next) {
+					for (imp = codecs[x]; imp; imp = imp->next) {
 						unsigned int cap = iana2ast(imp->ianacode);
 						if (cap == chosen) {
 							dname = imp->iananame;
+							interval = imp->microseconds_per_frame / 1000;
 							break;
 						}
 					}
@@ -314,11 +317,12 @@
 			} else {			/* c'mon there has to be SOMETHING... */
 				for (x = 0; x < num_codecs; x++) {
 					static const switch_codec_implementation_t *imp;
-					for (imp = codecs[x]->implementations; imp; imp = imp->next) {
+					for (imp = codecs[x]; imp; imp = imp->next) {
 						unsigned int cap = iana2ast(imp->ianacode);
 						if (cap & mixed_cap) {
 							chosen = cap;
 							dname = imp->iananame;
+							interval = imp->microseconds_per_frame / 1000;
 							break;
 						}
 					}
@@ -366,7 +370,7 @@
 	if (switch_core_codec_init(&tech_pvt->read_codec,
 							   dname,
 							   srate,
-							   0,
+							   interval,
 							   1,
 							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
@@ -376,7 +380,7 @@
 		if (switch_core_codec_init(&tech_pvt->write_codec,
 								   dname,
 								   srate,
-								   0,
+								   interval,
 								   1,
 								   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 								   NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {

Added: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/README
==============================================================================
--- (empty file)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/README	Mon Jul 10 18:42:22 2006
@@ -0,0 +1,96 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: We don't need any documentation, do we?
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* README
+*
+*/
+
+mod_cdr has been written in C++ using class inheritence and virtual methods, and registers all classes that
+have been built in at load time.  It then calls up the connect() method on each particular object and if successful at initializing the object, it adds it to a data structure that contains 1 instance of every sucessfully configured and connected object.  This means that at any time after loading, it will only try to create objects that are functional, skipping any that are built in but are not desired for use at the current time.
+
+In order to use mod_cdr, you must uncomment this line in the freeswitch.xml configuration file located in the conf directory:  <load module="mod_cdr"/> in the <modules> section.  Then below this section, you need to uncomment this section <configuration name="mod_cdr.conf" description="CDR Configuration"> and input the per class configurations.  All class specific configurations go within this parent section as a subsection.
+
+There are currently the following types of loggers:
+
+Class: 		CsvCDR, located in csvcdr.h and csvcdr.cpp
+Description:	This is the standard CSV output class.  It has a default list of CDR elements that it always
+		logs, and the user can specify channel variables to be logged in a fixed order (chanvars_fixed) starting after the last default value to be logged.  Additionally, the user can specify additional channel variables to be logged after the fixed order channel variables as key=value pairs.
+Configuration:	Section name: <csvcdr>
+		<param name="path" value=""/>  value is the location to put the files (required)         <param name="size_limit" value=""/> value is the size limit of the output file, default value of 10MB (optional)
+		<param name="chanvars_fixed" value=""/> value is a comma separated list of fixed channel variables to log.  This cannot be a wildcard (*).  (optional)
+		<param name="chanvars_supp" value=""/>  value is a comma separated list of supplemental channel variables to log.  It can be a wildcard (*).  (optional)
+		<param name="repeat_fixed_in_supp" value=""/> value is a 0 for no, 1 for yes, and is for the case that you might want any fixed channel variables to be repeated in the supplemental list.
+		
+Class:		AnthmCDR, located in anthmcdr.h and anthmcdr.cpp
+Description:	This is the Perl Data Dumper output class.  It writes each record to an individual text file
+		containing all the information.  It does not distinguish between fixed and supplemental channel variables.  If you are running freeswitch in a high volume environment, it is important to note that these individual files are small,  often times between 750 and 1500 bytes.  It is therefore recommended to use a partition with small cluster sizes or (on systems supporting) on reiserfs or reiser4 filesystems which are both excellent handlers of large numbers of small files.
+Configuration:	Section name: <anthmcdr>
+		<param name="path" value=""/>  value is the path where you want the output files (required)
+		<param name="chanvars" value=""/> value is a comma separated list of channel variables to log.  It can accept a wildcard (*) (optional)
+
+Class:		MysqlCDR, located in mysqlcdr.h and mysqlcdr.cpp
+Description:	This class logs the call detail record to a MySQL 4.1.x or greater database using prepared
+		statements.  This class is a little more complex than the prior two in that the fixed channel variables are treated as additional columns on the main freeswitchcdr database table for improved normalization of the database.  As such, you need to specify the format of each fixed channel variable as well.  If you do not specify, it will default to a varchar column type, and will not execute if the table schema does not match.  Therefore it is very important to make sure that any fixed channel variables you log exist as columns on the table.  The supplemental channel variables are stored in a separate table using a key / value pair linking to the callid of the call.
+Configuration:	Section: <mysqlcdr>
+		<param name="hostname" value=""/> value is the hostname or IP of the MySQL server (required)
+		<param name="username" value=""/> value is the username to connect to the MySQL server with (required)
+		<param name="password" value=""/> value is the password to use to authenticate to the MySQL server with (required)
+		<param name="dbname" value=""/> value is the name of the database to connect to (required)
+		<param name="chanvars_fixed" value=""/> Is a comma separated list of key=type pairs.  Types are x for decimal, s for string (varchar), d for double, i for integer, t for tiny.  If no type is provided, it defaults that column to string (varchar).  It cannot accept wildcards (*).  (optional)
+		<param name="chanvars_supp" value=""/> value is a comma separated list of supplemental channel variables to log.  Can be a wildcard (*) (optional)
+		<param name="chanvars_supp_repeat_fixed" value=""/> value is 0 for no, 1 for yes, and determines whether or not to repeat any of the fixed channel variables as key / value pairs in the chanvars table.
+
+FAQ:
+
+Q: Why C++?
+A: Why not?  It works well in this design.
+
+Q: Why is there a distinction between fixed and supplemental channel variables?
+A: There is a distinction so that a level of uniformity can be maintain on those loggers that require uniformity.  For example, if you expect that channel variable FOO will always been at a specific location on a CSV row, then it is required that it be a fixed channel variable.  The fixed means that it is a fixed position, and needs to be logged even if it is blank.  Supplemental channel variables, on the other hand, are more dynamic, and will only log those channel variables that actually exist on that given leg of the call.  That means that if you supply a wildcard, it will simply iterate all the channel variables.  If you do not want to repeat the fixed channel variables in the supplemental channel variables, it will then remove the fixed channel variables from the data structure holding the supplemental channel variables even before the process_record() method is called up.
+
+Q: What would an example configuration look like?
+A: Here is an excerpt from the freeswitch XML configuration file:
+
+	<configuration name="mod_cdr.conf" description="CDR Configuration">
+		<anthmcdr>
+			<param name="path" value="/work/temp/anthmcdr"/>
+			<param name="chanvars" value="username,accountcode"/>
+			<param name="chanvars_fixed" value="*"/>
+		</anthmcdr>
+		<csvcdr>
+			<param name="path" value="/work/temp/csvcdr"/>
+			<param name="size_limit" value="25"/>
+			<param name="chanvars_fixed" value="username"/>
+			<param name="chanvars_supp" value="*"/>
+			<param name="repeat_fixed_in_supp" value="0"/>
+		</csvcdr>
+		<mysqlcdr>
+			<param name="hostname" value="10.0.0.1"/>
+			<param name="username" value="test"/>
+			<param name="password" value="test"/>
+			<param name="dbname" value="testing"/>
+			<param name="chanvars_fixed" value="username=s,The_Kow=t"/>
+			<!-- This previous line logs username as a varchar, and The_Kow as a tiny -->
+			<param name="chanvars_supp" value="*"/>
+			<param name="chanvars_supp_repeat_fixed" value="0"/>
+		</mysqlcdr>
+	</configuration>

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.cpp	Mon Jul 10 18:42:22 2006
@@ -1,3 +1,32 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This C++ source file describes the AnthmCDR class which handles formatting a CDR out to
+* individual text files in a Perl Data Dumper format.  It is named in honor of Anthony Minnesale, as he
+* was the initial requester of this format.
+*
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* anthmcdr.cpp
+*
+*/
+
 #include <switch.h>
 #include "anthmcdr.h"
 

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/anthmcdr.h	Mon Jul 10 18:42:22 2006
@@ -1,8 +1,34 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This C++ header file describes the AnthmCDR class which handles formatting a CDR out to
+* individual text files in a Perl Data Dumper format.  It is named in honor of Anthony Minnesale, as he
+* was the initial requester of this format.
+*
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* anthmcdr.h
+*
+*/
+
 #include "baseregistry.h"
 #include <switch.h>
-// #include <sys/types.h>
-// #include <sys/stat.h>
-// #include <fcntl.h>
 #include <iostream>
 #include <fstream>
 #include <list>

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.cpp	Mon Jul 10 18:42:22 2006
@@ -1,3 +1,31 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This C++ source file describes the BaseCDR class that all other CDR classes inherit from.
+* It handles the bulk of the processing of data from the switch_channel_t objects.
+*
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* basecdr.cpp
+*
+*/
+
 #include "basecdr.h"
 #include <iostream>
 #include <cstring>
@@ -128,12 +156,8 @@
 					strncpy(lastdata,newchannel->callerextension->last_application->application_data,strlen(newchannel->callerextension->last_application->application_data));
 			}
 		
-		amaflags=0; // For future use I guess?  I don't see anything in the docs about this
-		/*
-		strncpy(accountcode," ",1); // Also for future use I guess?
-		strncpy(uniqueid," ",1);  // I don't see any of the user stuff in the docs yet
-		strncpy(userfield," ",1); // So we can't add these yet
-		*/
+		amaflags=0;
+		
 		switch_console_printf(SWITCH_CHANNEL_LOG, "BaseCDR::BaseCDR(switch_mod_cdr_newchannel*) - Processing completed.\n");
 	}
 }
@@ -197,7 +221,7 @@
 {
 	bool fixed = 1;
 	std::string tempstring, tempstring2;
-	switch_mod_cdr_sql_types sql_type;
+	switch_mod_cdr_sql_types_t sql_type;
 	parse_channel_variables_xconfig(unparsed,chanvarlist,fixed);
 	std::list<std::string> tempchanvarlist; // = chanvarlist;
 	std::list<std::string>::iterator iEnd, iItr;

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/basecdr.h	Mon Jul 10 18:42:22 2006
@@ -1,15 +1,32 @@
-//
-// C++ Interface: %{MODULE}
-//
-// Description: 
-//
-//
-// Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-// BaseRegistry and BaseRegistration classes and AUTO_REGISTER_BASECDR provided by David Terrell  
-// from his blog posting http://meat.net/2006/03/cpp-runtime-class-registration/
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Description: This header describes the switch_mod_cdr_newchannel_t struct, the BaseCDR base class that all
+* CDR loggers will inherit from, and the switch_mod_cdr_sql_types_t enum for use with the SQL type loggers
+* (i.e. MySQL).  This is part of the mod_cdr module for Freeswitch by Anthony Minnesale and friends.
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* basecdr.h
+*
+*/
+
 #ifndef BASECDR
 #define BASECDR
 
@@ -34,7 +51,7 @@
 	bool originate;
 };
 
-enum switch_mod_cdr_sql_types { CDR_INTEGER,CDR_STRING,CDR_DECIMAL,CDR_DOUBLE,CDR_TINY };
+enum switch_mod_cdr_sql_types_t { CDR_INTEGER,CDR_STRING,CDR_DECIMAL,CDR_DOUBLE,CDR_TINY };
 
 class BaseCDR {
 	public:

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.cpp	Mon Jul 10 18:42:22 2006
@@ -1,3 +1,34 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Description: This C++ source describes the BaseRegistry and BaseRegistration classes that implement
+* the factory routine with the aid of the templated base_factory() function.
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* BaseRegistry and BaseRegistration classes and AUTO_REGISTER_BASECDR macro provided in part by David 
+* Terrell from his blog posting http://meat.net/2006/03/cpp-runtime-class-registration/  Much thanks to him 
+* for his help.
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* baseregistry.cpp
+*
+*/
+
 #include "baseregistry.h"
 
 BaseRegistry& BaseRegistry::get()

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/baseregistry.h	Mon Jul 10 18:42:22 2006
@@ -1,3 +1,34 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Description: This C++ header describes the BaseRegistry and BaseRegistration classes that implement
+* the factory routine with the aid of the templated base_factory() function.
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* BaseRegistry and BaseRegistration classes and AUTO_REGISTER_BASECDR macro provided in part by David 
+* Terrell from his blog posting http://meat.net/2006/03/cpp-runtime-class-registration/  Much thanks to him 
+* for his help.
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* baseregistry.h
+*
+*/
+
 #include "basecdr.h"
 #include <iostream>
 

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.cpp	Mon Jul 10 18:42:22 2006
@@ -1,6 +1,33 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This C++ source file describes the CDRContainer singleton object used by mod_cdr to control
+* the creation, processing, and destruction of various CDR logger objects.
+*
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* cdrcontainer.cpp
+*
+*/
+
 #include "cdrcontainer.h"
 #include "baseregistry.h"
-// #include <switch.h>
 
 CDRContainer::CDRContainer()
 {

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/cdrcontainer.h	Mon Jul 10 18:42:22 2006
@@ -1,14 +1,30 @@
-//
-// C++ Interface: %{MODULE}
-//
-// Description: 
-//
-//
-// Author: Yossi Neiman <REMOVED FOR THE SPAMBOTS>, (C) 2006
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This C++ header file describes the CDRContainer singleton object used by mod_cdr to control
+* the creation, processing, and destruction of various CDR logger objects.
+*
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* cdrcontainer.h
+*
+*/
 
 #ifndef CDRCONTAINER
 #define CDRCONTAINER
@@ -23,8 +39,6 @@
 /*
 The CDRContainer Class will serve as a central receptacle for all CDR methods.  CDRContainer::CDRContainer() will initialize the system, and CDRContainer::add_cdr() will add a new object of each CDR type to a queue for "later processing" by the other thread.
 CDRContainer::process_records() will iterate thru the queue and commit the records to the respective backends.
-
-Need to rethink the temporary dumping of data to file in the event of failure to commit to the backend.  I forgot what I was intending to do initially to capture the failure.
 */
 
 #ifdef __cplusplus

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.cpp	Mon Jul 10 18:42:22 2006
@@ -1,3 +1,33 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This C++ source file describes the CsvCDR class that handles processing CDRs to a CSV format.
+* This is the standard CSV module, and has a list of predefined variables to log out which can be
+* added to, but never have the default ones removed.  If you want to use one that allows you to explicity
+* set all data variables to be logged and in what order, then this is not the class you want to use, and
+* one will be coming in the future to do just that.
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* csvcdr.cpp
+*
+*/
+
 #include <switch.h>
 #include "csvcdr.h"
 

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/csvcdr.h	Mon Jul 10 18:42:22 2006
@@ -1,8 +1,35 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This C++ header file describes the CsvCDR class that handles processing CDRs to a CSV format.
+* This is the standard CSV module, and has a list of predefined variables to log out which can be
+* added to, but never have the default ones removed.  If you want to use one that allows you to explicity
+* set all data variables to be logged and in what order, then this is not the class you want to use, and
+* one will be coming in the future to do just that.
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* csvcdr.h
+*
+*/
+
 #include "baseregistry.h"
 #include <switch.h>
-// #include <sys/types.h>
-// #include <sys/stat.h>
-// #include <fcntl.h>
 #include <iostream>
 #include <fstream>
 #include <list>

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mod_cdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mod_cdr.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mod_cdr.cpp	Mon Jul 10 18:42:22 2006
@@ -1,3 +1,32 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This source file describes the most basic portions of the CDR module.  These are the functions
+* and structures that the Freeswitch core looks for when opening up the DSO file to create the load, shutdown
+* and runtime threads as necessary.
+*
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* mod_cdr.cpp
+*
+*/
+
 #include "cdrcontainer.h"
 #include <switch.h>
 #include <sys/types.h>

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.cpp	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.cpp	Mon Jul 10 18:42:22 2006
@@ -1,3 +1,31 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This C++ source file describes the MysqlCDR class which handles formatting a CDR out to
+* a MySQL 4.1.x or greater server using prepared statements.
+*
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* mysqlcdr.cpp
+*
+*/
+
 #include <mysql.h>
 #include <switch.h>
 #include <cstring>
@@ -44,7 +72,7 @@
 bool MysqlCDR::repeat_fixed_in_supp = 0;
 std::list<std::string> MysqlCDR::chanvars_fixed_list;
 std::list<std::string> MysqlCDR::chanvars_supp_list;
-std::vector<switch_mod_cdr_sql_types> MysqlCDR::chanvars_fixed_types;
+std::vector<switch_mod_cdr_sql_types_t> MysqlCDR::chanvars_fixed_types;
 bool MysqlCDR::activated = 0;
 char* MysqlCDR::sql_query = 0;
 std::string MysqlCDR::tmp_sql_query;

Modified: freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.h	(original)
+++ freeswitch/branches/mishehu/src/mod/loggers/mod_cdr/mysqlcdr.h	Mon Jul 10 18:42:22 2006
@@ -1,3 +1,31 @@
+/*
+* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+*
+* Copyright 2006, Author: Yossi Neiman, president of Cartis Solutions, Inc. 
+* <freeswitch AT cartissolutions.com>
+*
+* Description: This C++ header file describes the MysqlCDR class which handles formatting a CDR out to
+* a MySQL 4.1.x or greater server using prepared statements.
+*
+*
+* Version: MPL 1.1
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License
+*
+* The Core API is the FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application by
+* Anthony Minnesale II <anthmct at yahoo.com>
+*
+* mysqlcdr.h
+*
+*/
+
 #include "baseregistry.h"
 #include <list>
 #include <sstream>
@@ -30,7 +58,7 @@
 		static bool connectionstate;
 		static bool logchanvars;
 		static std::list<std::string> chanvars_fixed_list;
-		static std::vector<switch_mod_cdr_sql_types> chanvars_fixed_types;
+		static std::vector<switch_mod_cdr_sql_types_t> chanvars_fixed_types;
 		static std::list<std::string> chanvars_supp_list; // The supplemental list
 		static bool repeat_fixed_in_supp;
 		static char hostname[255];

Modified: freeswitch/branches/mishehu/src/switch.c
==============================================================================
--- freeswitch/branches/mishehu/src/switch.c	(original)
+++ freeswitch/branches/mishehu/src/switch.c	Mon Jul 10 18:42:22 2006
@@ -188,7 +188,7 @@
 #define __CP "DISABLED"
 #endif
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "freeswitch Version %s Started. Crash Protection [%s]\n\n", SWITCH_VERSION_FULL, __CP);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "freeswitch Version %s Started. Crash Protection [%s] Max Sessions[%u]\n\n", SWITCH_VERSION_FULL, __CP, switch_core_session_limit(0));
 	snprintf(path, sizeof(path), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, pfile);
 
 	if (bg) {
@@ -217,6 +217,8 @@
 		switch_event_fire(&event);
 	}
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n");
+	switch_core_session_hupall();
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
 	switch_loadable_module_shutdown();
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Tearing down environment.\n");

Modified: freeswitch/branches/mishehu/src/switch_channel.c
==============================================================================
--- freeswitch/branches/mishehu/src/switch_channel.c	(original)
+++ freeswitch/branches/mishehu/src/switch_channel.c	Mon Jul 10 18:42:22 2006
@@ -83,6 +83,7 @@
 	{ "PROTOCOL_ERROR", SWITCH_CAUSE_PROTOCOL_ERROR },
 	{ "INTERWORKING", SWITCH_CAUSE_INTERWORKING },
 	{ "CRASH", SWITCH_CAUSE_CRASH },
+	{ "SYSTEM_SHUTDOWN", SWITCH_CAUSE_SYSTEM_SHUTDOWN },
 	{ NULL, 0 }
 };
 
@@ -846,6 +847,10 @@
 
 	if (channel->state >= CS_HANGUP) {
 		return SWITCH_STATUS_FALSE;
+	}
+
+	if (switch_channel_test_flag(channel, CF_ANSWERED)) {
+		return SWITCH_STATUS_SUCCESS;
 	}
 
 	msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;

Modified: freeswitch/branches/mishehu/src/switch_core.c
==============================================================================
--- freeswitch/branches/mishehu/src/switch_core.c	(original)
+++ freeswitch/branches/mishehu/src/switch_core.c	Mon Jul 10 18:42:22 2006
@@ -85,6 +85,7 @@
 	uint32_t session_id;
 	apr_pool_t *memory_pool;
 	switch_hash_t *session_table;
+	switch_mutex_t *session_table_mutex;
 #ifdef CRASH_PROT
 	switch_hash_t *stack_table;
 #endif
@@ -93,6 +94,8 @@
 	const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS];
     int state_handler_index;
 	FILE *console;
+	uint32_t session_count;
+	uint32_t session_limit;
 	switch_queue_t *sql_queue;
 };
 
@@ -246,6 +249,8 @@
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(char *uuid_str)
 {
 	switch_core_session_t *session;
+
+	switch_mutex_lock(runtime.session_table_mutex);
 	if ((session = switch_core_hash_find(runtime.session_table, uuid_str))) {
 		/* Acquire a read lock on the session */
 		if (switch_thread_rwlock_tryrdlock(session->rwlock) != SWITCH_STATUS_SUCCESS) {
@@ -253,16 +258,41 @@
 			session = NULL;
 		}
 	}
+	switch_mutex_unlock(runtime.session_table_mutex);
 
 	/* if its not NULL, now it's up to you to rwunlock this */
 	return session;
 }
 
+SWITCH_DECLARE(void) switch_core_session_hupall(void)
+{
+	switch_hash_index_t *hi;
+	void *val;
+	switch_core_session_t *session;
+	switch_channel_t *channel;
+
+	switch_mutex_lock(runtime.session_table_mutex);
+	for (hi = switch_hash_first(runtime.memory_pool, runtime.session_table); hi; hi = switch_hash_next(hi)) {
+        switch_hash_this(hi, NULL, NULL, &val);
+		if (val) {
+			session = (switch_core_session_t *) val;
+			channel = switch_core_session_get_channel(session);
+			switch_channel_hangup(channel, SWITCH_CAUSE_SYSTEM_SHUTDOWN);
+		}
+	}
+	switch_mutex_unlock(runtime.session_table_mutex);
+
+	while(runtime.session_count) {
+		switch_yield(1000);
+	}
+}
+
 SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(char *uuid_str, switch_core_session_message_t *message)
 {
 	switch_core_session_t *session = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
+	switch_mutex_lock(runtime.session_table_mutex);
 	if ((session = switch_core_hash_find(runtime.session_table, uuid_str)) != 0) {
 		/* Acquire a read lock on the session or forget it the channel is dead */
 		if (switch_thread_rwlock_tryrdlock(session->rwlock) == SWITCH_STATUS_SUCCESS) {
@@ -272,6 +302,7 @@
 			switch_thread_rwlock_unlock(session->rwlock);
 		}
 	}
+	switch_mutex_unlock(runtime.session_table_mutex);
 
 	return status;
 }
@@ -281,6 +312,7 @@
 	switch_core_session_t *session = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
+	switch_mutex_lock(runtime.session_table_mutex);
 	if ((session = switch_core_hash_find(runtime.session_table, uuid_str)) != 0) {
 		/* Acquire a read lock on the session or forget it the channel is dead */
 		if (switch_thread_rwlock_tryrdlock(session->rwlock) == SWITCH_STATUS_SUCCESS) {
@@ -290,6 +322,7 @@
 			switch_thread_rwlock_unlock(session->rwlock);
 		}
 	}
+	switch_mutex_unlock(runtime.session_table_mutex);
 
 	return status;
 }
@@ -2344,6 +2377,9 @@
 	apr_pool_destroy(pool);
 	pool = NULL;
 
+	switch_mutex_lock(runtime.session_table_mutex);
+	runtime.session_count--;
+	switch_mutex_unlock(runtime.session_table_mutex);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_hash_init(switch_hash_t **hash, switch_memory_pool_t *pool)
@@ -2434,18 +2470,21 @@
 {
 	switch_core_session_t *session = obj;
 	session->thread = thread;
-	session->id = runtime.session_id++;
-
 	snprintf(session->name, sizeof(session->name), "%u", session->id);
-
+	switch_mutex_lock(runtime.session_table_mutex);
+	session->id = runtime.session_id++;
 	switch_core_hash_insert(runtime.session_table, session->uuid_str, session);
+	switch_mutex_unlock(runtime.session_table_mutex);
+
 	switch_core_session_run(session);
 	
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session %u (%s) Locked, Waiting on external entities\n", session->id, switch_channel_get_name(session->channel));
 	switch_core_session_write_lock(session);
 	switch_core_session_rwunlock(session);
 
+	switch_mutex_lock(runtime.session_table_mutex);
 	switch_core_hash_delete(runtime.session_table, session->uuid_str);
+	switch_mutex_unlock(runtime.session_table_mutex);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Session %u (%s) Ended\n", session->id, switch_channel_get_name(session->channel));
 	switch_core_session_destroy(&session);
 	return NULL;
@@ -2503,9 +2542,19 @@
 	switch_memory_pool_t *usepool;
 	switch_core_session_t *session;
 	switch_uuid_t uuid;
+	uint32_t count = 0;
 
 	assert(endpoint_interface != NULL);
 
+	switch_mutex_lock(runtime.session_table_mutex);
+	count = runtime.session_count;
+	switch_mutex_unlock(runtime.session_table_mutex);
+
+	if ((count + 1) > runtime.session_limit) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Limit!\n");
+		return NULL;
+	}
+
 	if (pool) {
 		usepool = pool;
 	} else if (switch_core_new_memory_pool(&usepool) != SWITCH_STATUS_SUCCESS) {
@@ -2551,6 +2600,9 @@
 	switch_thread_cond_create(&session->cond, session->pool);
 	switch_thread_rwlock_create(&session->rwlock, session->pool);
 
+	switch_mutex_lock(runtime.session_table_mutex);
+	runtime.session_count++;
+	switch_mutex_unlock(runtime.session_table_mutex);
 	return session;
 }
 
@@ -2806,10 +2858,22 @@
 #endif
 }
 
+
+SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new)
+{
+	if (new) {
+		runtime.session_limit = new;
+	}
+	
+	return runtime.session_limit;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err)
 {
 	memset(&runtime, 0, sizeof(runtime));
-	
+	runtime.session_limit = 1000;
+	switch_xml_t xml = NULL, cfg = NULL;
+
 	switch_core_set_globals();
 
 	/* INIT APR and Create the pool context */
@@ -2830,6 +2894,23 @@
 		return SWITCH_STATUS_MEMERR;
 	}
 
+
+	if ((xml = switch_xml_open_cfg("switch.conf", &cfg, NULL))) {
+		switch_xml_t settings, param;
+		
+		if ((settings = switch_xml_child(cfg, "settings"))) {
+			for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+				char *var = (char *) switch_xml_attr_soft(param, "name");
+				char *val = (char *) switch_xml_attr_soft(param, "value");
+				
+				if (!strcasecmp(var, "max-sessions")) {
+					runtime.session_limit = atoi(val);
+				}
+			}
+		}
+		switch_xml_free(xml);
+	}
+
 	*err = NULL;
 
 	if(console) {
@@ -2909,6 +2990,7 @@
 	runtime.session_id = 1;
 
 	switch_core_hash_init(&runtime.session_table, runtime.memory_pool);
+	switch_mutex_init(&runtime.session_table_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
 #ifdef CRASH_PROT
 	switch_core_hash_init(&runtime.stack_table, runtime.memory_pool);
 #endif

Modified: freeswitch/branches/mishehu/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/mishehu/src/switch_loadable_module.c	(original)
+++ freeswitch/branches/mishehu/src/switch_loadable_module.c	Mon Jul 10 18:42:22 2006
@@ -633,16 +633,18 @@
 	return switch_core_hash_find(loadable_modules.directory_hash, name);
 }
 
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, switch_codec_interface_t **array,
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, const switch_codec_implementation_t **array,
 													  int arraylen)
 {
 	switch_hash_index_t *hi;
 	void *val;
+	switch_codec_interface_t *codec_interface;
 	int i = 0;
 
 	for (hi = switch_hash_first(pool, loadable_modules.codec_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, NULL, NULL, &val);
-		array[i++] = val;
+		codec_interface = (switch_codec_interface_t *) val;
+		array[i++] = codec_interface->implementations;
 		if (i > arraylen) {
 			break;
 		}
@@ -652,20 +654,44 @@
 
 }
 
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_codec_interface_t **array,
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array,
 															 int arraylen, char **prefs, int preflen)
 {
 	int x, i = 0;
 	switch_codec_interface_t *codec_interface;
+	const switch_codec_implementation_t *imp;
 
-	for (x = 0; x < preflen; x++) {
-		if ((codec_interface = switch_loadable_module_get_codec_interface(prefs[x])) != 0 ) {
-			array[i++] = codec_interface;
-			if (i > arraylen) {
-				break;
+    for (x = 0; x < preflen; x++) {
+        char *name, *p, buf[128];
+        uint32_t interval = 0, len = 0;
+
+        name = prefs[x];
+        if ((p = strchr(name, '@'))) {
+            p++;
+            len = p-name;
+
+            if (len > sizeof(buf)) {
+                len = sizeof(buf);
+            }
+            switch_copy_string(buf, name, len);
+            *(buf + len) = '\0';
+            interval = atoi(p);
+            name = buf;
+        }
+
+        if ((codec_interface = switch_loadable_module_get_codec_interface(name)) != 0 ) {
+			for (imp = codec_interface->implementations; imp; imp = imp->next) {
+				if (!interval) {
+					array[i++] = imp;
+				} else if ((imp->microseconds_per_frame / 1000) == interval) {
+					array[i++] = imp;
+				}
 			}
-		}
-	}
+            if (i > arraylen) {
+                break;
+            }
+        }
+    }
 
 	return i;
 }

Modified: freeswitch/branches/mishehu/w32/vsnet/Freeswitch.sln
==============================================================================
--- freeswitch/branches/mishehu/w32/vsnet/Freeswitch.sln	(original)
+++ freeswitch/branches/mishehu/w32/vsnet/Freeswitch.sln	Mon Jul 10 18:42:22 2006
@@ -208,6 +208,11 @@
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_conference", "..\..\src\mod\applications\mod_conference\mod_conference.vcproj", "{C24FB505-05D7-4319-8485-7540B44C8603}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -354,6 +359,10 @@
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.Build.0 = Debug|Win32
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.ActiveCfg = Release|Win32
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.Build.0 = Release|Win32
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.Build.0 = Debug|Win32
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.ActiveCfg = Release|Win32
+		{C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -376,6 +385,7 @@
 		{0E2C6395-13B9-46E5-9264-8859D346018D} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{FE3540C5-3303-46E0-A69E-D92F775687F1} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}



More information about the Freeswitch-svn mailing list