[Freeswitch-svn] [commit] r3814 - in freeswitch/branches/knhor/trunk: . conf libs/libsndfile libs/srtp/include libs/srtp/srtp libs/win32/apr-iconv libs/win32/apr-util src src/include src/mod/applications/mod_conference src/mod/dialplans/mod_dialplan_xml src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_sofia src/mod/event_handlers/mod_event_socket src/mod/event_handlers/mod_xmpp_event src/mod/languages/mod_spidermonkey src/mod/languages/mod_spidermonkey_etpan src/mod/say/mod_say_en src/mod/xml_int/mod_xml_curl src/mod/xml_int/mod_xml_rpc

Freeswitch SVN knhor at freeswitch.org
Sat Dec 23 00:27:45 EST 2006


Author: knhor
Date: Sat Dec 23 00:27:43 2006
New Revision: 3814

Modified:
   freeswitch/branches/knhor/trunk/   (props changed)
   freeswitch/branches/knhor/trunk/conf/freeswitch.xml
   freeswitch/branches/knhor/trunk/libs/libsndfile/configure   (props changed)
   freeswitch/branches/knhor/trunk/libs/libsndfile/install-sh   (props changed)
   freeswitch/branches/knhor/trunk/libs/srtp/include/srtp.h
   freeswitch/branches/knhor/trunk/libs/srtp/srtp/srtp.c
   freeswitch/branches/knhor/trunk/libs/win32/apr-iconv/libapriconv.vcproj
   freeswitch/branches/knhor/trunk/libs/win32/apr-util/libaprutil.vcproj
   freeswitch/branches/knhor/trunk/modules.conf.in
   freeswitch/branches/knhor/trunk/src/include/switch_apr.h
   freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/branches/knhor/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
   freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
   freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj
   freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c
   freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c
   freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj
   freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj
   freeswitch/branches/knhor/trunk/src/switch_ivr.c
   freeswitch/branches/knhor/trunk/src/switch_rtp.c

Log:
Merged revisions 3793-3813 via svnmerge from trunk. copy mod_conference.c from trunk since it was really out of wack.


Modified: freeswitch/branches/knhor/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/branches/knhor/trunk/conf/freeswitch.xml	(original)
+++ freeswitch/branches/knhor/trunk/conf/freeswitch.xml	Sat Dec 23 00:27:43 2006
@@ -485,6 +485,19 @@
 
     <!-- *NOTE* The special context name 'any' will match any context -->
     <context name="default">
+      <extension name="556"> <!-- demo phrases -->
+        <condition field="destination_number" expression="^556$">
+          <action application="answer"/>
+          <action application="sleep" data="1000"/>
+          <action application="phrase" data="spell,${caller_id_name}"/>
+          <action application="phrase" data="spell-phonetic,${caller_id_name}"/>
+          <action application="phrase" data="timespec,12:45:15"/>
+          <action application="phrase" data="saydate,0"/>
+          <action application="phrase" data="msgcount,130"/>
+          <!--<action application="phrase" data="timeleft,3:30"/>-->
+	</condition>
+      </extension>
+
       <extension name="tollfree">
 	<condition field="destination_number" expression="^(18(0{2}|8{2}|7{2}|6{2})\d{7})$">
 	  <action application="enum" data="$1"/>
@@ -647,9 +660,29 @@
 	    <!--<action function="speak-text" data="you have $1 messages"/>-->
 	  </input>
 	</macro>
-	<macro name="timeleft">
+	<macro name="saydate">
+	  <input pattern="(.*)">
+	    <action function="say" data="$1" method="pronounced" type="current_date_time"/>
+	  </input>
+	</macro>
+	<macro name="timespec">
+	  <input pattern="(.*)">
+	    <action function="say" data="$1" method="pronounced" type="time_measurement"/>
+	  </input>
+	</macro>
+	<macro name="spell">
+	  <input pattern="(.*)">
+	    <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	  </input>
+	</macro>
+	<macro name="spell-phonetic">
+	  <input pattern="(.*)">
+	    <action function="say" data="$1" method="pronounced" type="name_phonetic"/>
+	  </input>
+	</macro>
+	<macro name="tts-timeleft">
 	  <input pattern="(\d+):(\d+)">
-	    <action function="speak-text" data="You have $1 minutes, $2 seconds remaining"/>
+	    <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
 	  </input>
 	</macro>
       </language>

Modified: freeswitch/branches/knhor/trunk/libs/srtp/include/srtp.h
==============================================================================
--- freeswitch/branches/knhor/trunk/libs/srtp/include/srtp.h	(original)
+++ freeswitch/branches/knhor/trunk/libs/srtp/include/srtp.h	Sat Dec 23 00:27:43 2006
@@ -51,7 +51,6 @@
 #endif
 
 #ifdef _MSC_VER
-#pragma pack(4)
 #pragma warning(disable:4214)
 #endif
 
@@ -895,6 +894,10 @@
  * is not identical)
  */
  
+#ifdef _MSC_VER
+#pragma pack(push, r1, 1)
+#endif
+
 #ifndef WORDS_BIGENDIAN
 
 typedef struct {
@@ -904,9 +907,9 @@
   unsigned version:2;	/* protocol version       */
   unsigned pt:7;	/* payload type           */
   unsigned m:1;		/* marker bit             */
-  uint16_t seq;		/* sequence number        */
-  uint32_t ts;		/* timestamp              */
-  uint32_t ssrc;	/* synchronization source */
+  unsigned seq:16;		/* sequence number        */
+  unsigned ts:32;		/* timestamp              */
+  unsigned ssrc:32;	/* synchronization source */
 } srtp_hdr_t;
 
 #else /*  BIG_ENDIAN */
@@ -918,9 +921,9 @@
   unsigned cc:4;	/* CSRC count             */
   unsigned m:1;		/* marker bit             */
   unsigned pt:7;	/* payload type           */
-  uint16_t seq;		/* sequence number        */
-  uint32_t ts;		/* timestamp              */
-  uint32_t ssrc;	/* synchronization source */
+  unsigned seq:16;		/* sequence number        */
+  unsigned ts:32;		/* timestamp              */
+  unsigned ssrc:32;	/* synchronization source */
 } srtp_hdr_t;
 
 #endif
@@ -945,8 +948,8 @@
   unsigned p:1;		/* padding flag           */
   unsigned version:2;	/* protocol version       */
   unsigned pt:8;		/* payload type           */
-  uint16_t len;			/* length                 */
-  uint32_t ssrc;	       	/* synchronization source */
+  unsigned len:16;			/* length                 */
+  unsigned ssrc:32;	       	/* synchronization source */
 } srtcp_hdr_t;
 
 typedef struct {
@@ -964,8 +967,8 @@
   unsigned p:1;		/* padding flag           */
   unsigned rc:5;		/* reception report count */
   unsigned pt:8;		/* payload type           */
-  uint16_t len;			/* length                 */
-  uint32_t ssrc;	       	/* synchronization source */
+  unsigned len:16;			/* length                 */
+  unsigned ssrc:32;	       	/* synchronization source */
 } srtcp_hdr_t;
 
 typedef struct {
@@ -973,7 +976,7 @@
   unsigned int p:1;        /* padding flag                         */
   unsigned int count:5;    /* varies by packet type                */
   unsigned int pt:8;       /* payload type                         */
-  uint16_t length;         /* len of uint32s of packet less header */
+  unsigned length:16;         /* len of uint32s of packet less header */
 } rtcp_common_t;
 
 typedef struct {
@@ -992,7 +995,7 @@
 #define SRTCP_INDEX_MASK 0x7fffffff
 
 #ifdef _MSC_VER
-#pragma pack()
+#pragma pack(pop, r1)
 #endif
 
 #ifdef __cplusplus

Modified: freeswitch/branches/knhor/trunk/libs/srtp/srtp/srtp.c
==============================================================================
--- freeswitch/branches/knhor/trunk/libs/srtp/srtp/srtp.c	(original)
+++ freeswitch/branches/knhor/trunk/libs/srtp/srtp/srtp.c	Sat Dec 23 00:27:43 2006
@@ -684,7 +684,7 @@
     * estimate the packet index using the start of the replay window   
     * and the sequence number from the header
     */
-   delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
+   delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs((uint16_t)hdr->seq));
    status = rdbx_check(&stream->rtp_rdbx, delta);
    if (status)
      return status;  /* we've been asked to reuse an index */
@@ -842,7 +842,7 @@
       est = (xtd_seq_num_t) make64(0,ntohs(hdr->seq));
       delta = low32(est);
 #else
-      est = (xtd_seq_num_t) ntohs(hdr->seq);
+      est = (xtd_seq_num_t) ntohs((uint16_t)hdr->seq);
       delta = (int)est;
 #endif
     } else {
@@ -856,7 +856,7 @@
   } else {
   
     /* estimate packet index from seq. num. in header */
-    delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
+    delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs((uint16_t)hdr->seq));
     
     /* check replay database */
     status = rdbx_check(&stream->rtp_rdbx, delta);

Modified: freeswitch/branches/knhor/trunk/libs/win32/apr-iconv/libapriconv.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/libs/win32/apr-iconv/libapriconv.vcproj	(original)
+++ freeswitch/branches/knhor/trunk/libs/win32/apr-iconv/libapriconv.vcproj	Sat Dec 23 00:27:43 2006
@@ -48,7 +48,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+				AdditionalIncludeDirectories="&quot;..\..\apr-iconv-1.1.1\include&quot;;..\..\apr\include"
 				PreprocessorDefinitions="_DEBUG;API_DECLARE_EXPORT;WIN32;_WINDOWS"
 				RuntimeLibrary="3"
 				PrecompiledHeaderFile=".\Debug/libapriconv.pch"
@@ -147,7 +147,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+				AdditionalIncludeDirectories="&quot;..\..\apr-iconv-1.1.1\include&quot;;..\..\apr\include"
 				PreprocessorDefinitions="NDEBUG;API_DECLARE_EXPORT;WIN32;_WINDOWS"
 				StringPooling="true"
 				RuntimeLibrary="2"

Modified: freeswitch/branches/knhor/trunk/libs/win32/apr-util/libaprutil.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/libs/win32/apr-util/libaprutil.vcproj	(original)
+++ freeswitch/branches/knhor/trunk/libs/win32/apr-util/libaprutil.vcproj	Sat Dec 23 00:27:43 2006
@@ -49,7 +49,7 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions="/EHsc "
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\apr-util\include,..\..\apr-util\include/private,..\..\apr-util\dbm/sdbm,..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+				AdditionalIncludeDirectories="&quot;..\..\apr-util\include&quot;;&quot;..\..\apr-util\include/private&quot;;&quot;..\..\apr-util\dbm/sdbm&quot;;&quot;..\..\apr-iconv-1.1.1\include&quot;;..\..\apr\include"
 				PreprocessorDefinitions="_DEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS"
 				RuntimeLibrary="3"
 				PrecompiledHeaderFile=".\Debug/libaprutil.pch"
@@ -149,7 +149,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\apr-util\include,..\..\apr-util\include/private,..\..\apr-util\dbm/sdbm,..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+				AdditionalIncludeDirectories="&quot;..\..\apr-util\include&quot;;&quot;..\..\apr-util\include/private&quot;;&quot;..\..\apr-util\dbm/sdbm&quot;;&quot;..\..\apr-iconv-1.1.1\include&quot;;..\..\apr\include"
 				PreprocessorDefinitions="NDEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS"
 				StringPooling="true"
 				RuntimeLibrary="2"

Modified: freeswitch/branches/knhor/trunk/modules.conf.in
==============================================================================
--- freeswitch/branches/knhor/trunk/modules.conf.in	(original)
+++ freeswitch/branches/knhor/trunk/modules.conf.in	Sat Dec 23 00:27:43 2006
@@ -44,5 +44,6 @@
 #languages/mod_spidermonkey_teletone
 #languages/mod_spidermonkey_core_db
 #languages/mod_spidermonkey_odbc
+#languages/mod_spidermonkey_etpan
 timers/mod_softtimer
 #xml_int/mod_xml_rpc

Modified: freeswitch/branches/knhor/trunk/src/include/switch_apr.h
==============================================================================
--- freeswitch/branches/knhor/trunk/src/include/switch_apr.h	(original)
+++ freeswitch/branches/knhor/trunk/src/include/switch_apr.h	Sat Dec 23 00:27:43 2006
@@ -262,6 +262,9 @@
 #define switch_thread_data_set apr_thread_data_set
 #define switch_thread_data_get apr_thread_data_get
 #define switch_thread_self apr_os_thread_current
+#define switch_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
+                                     + (apr_time_t)(usec))
+
 
 /**
  * Put the active calling thread to sleep until signaled to wake up. Each

Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c	Sat Dec 23 00:27:43 2006
@@ -9,7 +9,7 @@
  * 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,
+ * 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.
@@ -48,14 +48,14 @@
 #define CONF_CHAT_PROTO "conf"
 
 #ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
+#define MIN(a, b) ((a)<(b)?(a):(b))
 #endif
 
 /* this doesn't work correctly yet, don't bother trying! */
 //#define OPTION_IVR_MENU_SUPPORT */
 
 typedef enum {
-	FILE_STOP_CURRENT,
+	FILE_STOP_CURRENT, 
 	FILE_STOP_ALL
 } file_stop_t;
 
@@ -72,20 +72,20 @@
 } globals;
 
 typedef enum {
-	CALLER_CONTROL_MUTE,
-	CALLER_CONTROL_DEAF_MUTE,
-	CALLER_CONTROL_ENERGY_UP,
-	CALLER_CONTROL_ENERGY_EQU_CONF,
-	CALLER_CONTROL_ENERGEY_DN,
-	CALLER_CONTROL_VOL_TALK_UP,
-	CALLER_CONTROL_VOL_TALK_ZERO,
-	CALLER_CONTROL_VOL_TALK_DN,
-	CALLER_CONTROL_VOL_LISTEN_UP,
-	CALLER_CONTROL_VOL_LISTEN_ZERO,
-	CALLER_CONTROL_VOL_LISTEN_DN,
-	CALLER_CONTROL_HANGUP,
-	CALLER_CONTROL_MENU,
-	CALLER_CONTROL_DIAL,
+	CALLER_CONTROL_MUTE, 
+	CALLER_CONTROL_DEAF_MUTE, 
+	CALLER_CONTROL_ENERGY_UP, 
+	CALLER_CONTROL_ENERGY_EQU_CONF, 
+	CALLER_CONTROL_ENERGEY_DN, 
+	CALLER_CONTROL_VOL_TALK_UP, 
+	CALLER_CONTROL_VOL_TALK_ZERO, 
+	CALLER_CONTROL_VOL_TALK_DN, 
+	CALLER_CONTROL_VOL_LISTEN_UP, 
+	CALLER_CONTROL_VOL_LISTEN_ZERO, 
+	CALLER_CONTROL_VOL_LISTEN_DN, 
+	CALLER_CONTROL_HANGUP, 
+	CALLER_CONTROL_MENU, 
+	CALLER_CONTROL_DIAL, 
 } caller_control_t;
 
 /* forward declaration for conference_obj and caller_control */
@@ -110,30 +110,30 @@
 } caller_control_menu_info_t;
 
 typedef enum {
-	MFLAG_RUNNING = (1 << 0),
-	MFLAG_CAN_SPEAK = (1 << 1),
-	MFLAG_CAN_HEAR = (1 << 2),
-	MFLAG_KICKED = (1 << 3),
-	MFLAG_ITHREAD = (1 << 4),
+	MFLAG_RUNNING = (1 << 0), 
+	MFLAG_CAN_SPEAK = (1 << 1), 
+	MFLAG_CAN_HEAR = (1 << 2), 
+	MFLAG_KICKED = (1 << 3), 
+	MFLAG_ITHREAD = (1 << 4), 
 	MFLAG_NOCHANNEL = (1 << 5)
 } member_flag_t;
 
 typedef enum {
-	CFLAG_RUNNING = (1 << 0),
-	CFLAG_DYNAMIC = (1 << 1),
-	CFLAG_ENFORCE_MIN = (1 << 2),
-	CFLAG_DESTRUCT = (1 << 3),
-	CFLAG_LOCKED = (1 << 4),
+	CFLAG_RUNNING = (1 << 0), 
+	CFLAG_DYNAMIC = (1 << 1), 
+	CFLAG_ENFORCE_MIN = (1 << 2), 
+	CFLAG_DESTRUCT = (1 << 3), 
+	CFLAG_LOCKED = (1 << 4), 
 	CFLAG_ANSWERED = (1 << 5)
 } conf_flag_t;
 
 typedef enum {
-	RFLAG_CAN_SPEAK = (1 << 0),
+	RFLAG_CAN_SPEAK = (1 << 0), 
 	RFLAG_CAN_HEAR = (1 << 1)
 } relation_flag_t;
 
 typedef enum {
-	NODE_TYPE_FILE,
+	NODE_TYPE_FILE, 
 	NODE_TYPE_SPEECH
 } node_type_t;
 
@@ -243,14 +243,21 @@
 	switch_memory_pool_t *pool;
 } conference_record_t;
 
+typedef enum {
+	CONF_API_SUB_ARGS_SPLIT, 
+	CONF_API_SUB_MEMBER_TARGET, 
+	CONF_API_SUB_ARGS_AS_ONE
+} conference_fntype_t;
+
 /* API command parser */
 typedef struct api_command {
 	char *pname;
 	void *pfnapicmd;
-	int  fntype;
+	conference_fntype_t fntype;
 	char *psyntax;
 } api_command_t;
 
+
 /* Function Prototypes */
 static uint32_t next_member_id(void);
 static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member);
@@ -263,16 +270,16 @@
 static void conference_loop_output(conference_member_t *member);
 static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop);
 static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel);
-static switch_status_t conference_say(conference_obj_t *conference, char *text, uint32_t leadin);
+static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin);
 static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim);
 static switch_status_t conf_api_main(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream);
 static switch_status_t audio_bridge_on_ring(switch_core_session_t *session);
-static switch_status_t conference_outcall(conference_obj_t *conference,
-										  switch_core_session_t *session,
-										  char *bridgeto,
-										  uint32_t timeout,
-										  char *flags,
-										  char *cid_name,
+static switch_status_t conference_outcall(conference_obj_t *conference, 
+										  switch_core_session_t *session, 
+										  char *bridgeto, 
+										  uint32_t timeout, 
+										  char *flags, 
+										  char *cid_name, 
 										  char *cid_num);
 static void conference_function(switch_core_session_t *session, char *data);
 static void launch_conference_thread(conference_obj_t *conference);
@@ -285,26 +292,26 @@
 static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint);
 static void launch_conference_record_thread(conference_obj_t *conference, char *path);
 
-typedef int (*conf_api_args_cmd_t)(conference_obj_t*, switch_stream_handle_t*, int, char**);
-typedef int (*conf_api_member_cmd_t)(conference_member_t*, switch_stream_handle_t*, void*);
-typedef int (*conf_api_text_cmd_t)(conference_obj_t*, switch_stream_handle_t*, char*);
+typedef switch_status_t (*conf_api_args_cmd_t)(conference_obj_t*, switch_stream_handle_t*, int, char**);
+typedef switch_status_t (*conf_api_member_cmd_t)(conference_member_t*, switch_stream_handle_t*, void*);
+typedef switch_status_t (*conf_api_text_cmd_t)(conference_obj_t*, switch_stream_handle_t*, const char*);
 
-static void conference_member_itterator(conference_obj_t *conference,
-										switch_stream_handle_t *stream,
-										conf_api_member_cmd_t pfncallback,
+static void conference_member_itterator(conference_obj_t *conference, 
+										switch_stream_handle_t *stream, 
+										conf_api_member_cmd_t pfncallback, 
 										void *data);
-static int conf_api_sub_mute(conference_member_t *member,
-										switch_stream_handle_t *stream,
-										void *data);
-static int conf_api_sub_unmute(conference_member_t *member,
-										switch_stream_handle_t *stream,
-										void *data);
-static int conf_api_sub_deaf(conference_member_t *member,
-										switch_stream_handle_t *stream,
-										void *data);
-static int conf_api_sub_undeaf(conference_member_t *member,
-										switch_stream_handle_t *stream,
-										void *data);
+static switch_status_t conf_api_sub_mute(conference_member_t *member, 
+                                         switch_stream_handle_t *stream, 
+                                         void *data);
+static switch_status_t conf_api_sub_unmute(conference_member_t *member, 
+                                           switch_stream_handle_t *stream, 
+                                           void *data);
+static switch_status_t conf_api_sub_deaf(conference_member_t *member, 
+                                         switch_stream_handle_t *stream, 
+                                         void *data);
+static switch_status_t conf_api_sub_undeaf(conference_member_t *member, 
+                                           switch_stream_handle_t *stream, 
+                                           void *data);
 
 /* Return a Distinct ID # */
 static uint32_t next_member_id(void)
@@ -323,7 +330,7 @@
 {
 	conference_relationship_t *rel = NULL;
 
-	if(member != NULL && other_member != NULL) {
+	if (member != NULL && other_member != NULL) {
 		conference_relationship_t *global = NULL;
 
 		switch_mutex_lock(member->flag_mutex);
@@ -360,37 +367,39 @@
 {
 	conference_member_t *member = NULL;
 
-	if (conference != NULL && id != 0) {
-		for(member = conference->members; member; member = member->next) {
+    assert(conference != NULL);
+    assert(id != 0);
 
-			if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
-				continue;
-			}
+    for(member = conference->members; member; member = member->next) {
+        
+        if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
+            continue;
+        }
+        
+        if (member->id == id) {
+            break;
+        }
+    }
+	
 
-			if (member->id == id) {
-				break;
-			}
-		}
-	}
-
 	return member;
 }
 
 /* stop the specified recording */
-static int conference_record_stop(conference_obj_t *conference, char *path)
+static switch_status_t conference_record_stop(conference_obj_t *conference, char *path)
 {
 	conference_member_t *member = NULL;
 	int count = 0;
 
-	if (conference != NULL) {
-		for(member = conference->members; member; member = member->next) {
-			if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) {
-				switch_clear_flag_locked(member, MFLAG_RUNNING);
-				count++;
-			}
-		}
-	}
+	assert (conference != NULL);
 
+    for(member = conference->members; member; member = member->next) {
+        if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) {
+            switch_clear_flag_locked(member, MFLAG_RUNNING);
+            count++;
+        }
+    }
+
 	return count;
 }
 
@@ -442,64 +451,64 @@
 static switch_status_t conference_add_member(conference_obj_t *conference, conference_member_t *member)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_event_t *event;
 
-	if(conference != NULL && member != NULL) {
-		switch_event_t *event;
+    assert(conference != NULL);
+    assert(member != NULL);
 
-		switch_mutex_lock(conference->mutex);
-		switch_mutex_lock(conference->member_mutex);
-		switch_mutex_lock(member->audio_in_mutex);
-		switch_mutex_lock(member->audio_out_mutex);
-		switch_mutex_lock(member->flag_mutex);
-		member->conference = member->last_conference = conference;
-		member->next = conference->members;
-		member->energy_level = conference->energy_level;
-		conference->members = member;
+    switch_mutex_lock(conference->mutex);
+    switch_mutex_lock(conference->member_mutex);
+    switch_mutex_lock(member->audio_in_mutex);
+    switch_mutex_lock(member->audio_out_mutex);
+    switch_mutex_lock(member->flag_mutex);
+    member->conference = member->last_conference = conference;
+    member->next = conference->members;
+    member->energy_level = conference->energy_level;
+    conference->members = member;
 
 
-		if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
-			conference->count++;
-			if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
-				switch_event_fire(&event);
-			}
+    if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
+        conference->count++;
+        if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+            switch_event_fire(&event);
+        }
 
 
-			if (conference->enter_sound) {
-				conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session));
-			}
+        if (conference->enter_sound) {
+            conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session));
+        }
 
-			if (conference->count == 1 && conference->alone_sound) {
-				conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
-			}
+        if (conference->count == 1 && conference->alone_sound) {
+            conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
+        }
 
-			if (conference->min && conference->count >= conference->min) {
-				switch_set_flag(conference, CFLAG_ENFORCE_MIN);	
-			}
+        if (conference->min && conference->count >= conference->min) {
+            switch_set_flag(conference, CFLAG_ENFORCE_MIN);	
+        }
 
-			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_t *channel = switch_core_session_get_channel(member->session);
-				switch_channel_event_set_data(channel, event);
+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+            switch_channel_t *channel = switch_core_session_get_channel(member->session);
+            switch_channel_event_set_data(channel, event);
 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "add-member");
-				switch_event_fire(&event);
-			}
-		}
-		switch_mutex_unlock(member->flag_mutex);
-		switch_mutex_unlock(member->audio_out_mutex);
-		switch_mutex_unlock(member->audio_in_mutex);
-		switch_mutex_unlock(conference->member_mutex);
-		switch_mutex_unlock(conference->mutex);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "add-member");
+            switch_event_fire(&event);
+        }
+    }
+    switch_mutex_unlock(member->flag_mutex);
+    switch_mutex_unlock(member->audio_out_mutex);
+    switch_mutex_unlock(member->audio_in_mutex);
+    switch_mutex_unlock(conference->member_mutex);
+    switch_mutex_unlock(conference->mutex);
+    status = SWITCH_STATUS_SUCCESS;
+	
 
-		status = SWITCH_STATUS_SUCCESS;
-	}
-
 	return status;
 }
 
@@ -507,95 +516,99 @@
 static switch_status_t conference_del_member(conference_obj_t *conference, conference_member_t *member)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
+    conference_member_t *imember, *last = NULL;
+    switch_event_t *event;
 
-	if(conference != NULL && member != NULL ) {
-		conference_member_t *imember, *last = NULL;
-		switch_event_t *event;
+    assert(conference != NULL);
+    assert(member != NULL);
+    
 
-		switch_mutex_lock(conference->mutex);
-		switch_mutex_lock(conference->member_mutex);
-		switch_mutex_lock(member->audio_in_mutex);
-		switch_mutex_lock(member->audio_out_mutex);
-		switch_mutex_lock(member->flag_mutex);
 
-		for (imember = conference->members; imember; imember = imember->next) {
-			if (imember == member ) {
-				if (last) {
-					last->next = imember->next;
-				} else {
-					conference->members = imember->next;
-				}
-				break;
-			}
-			last = imember;
-		}
 
-		/* Close Unused Handles */
-		if (member->fnode) {
-			conference_file_node_t *fnode, *cur;
-			switch_memory_pool_t *pool;
+    switch_mutex_lock(conference->mutex);
+    switch_mutex_lock(conference->member_mutex);
+    switch_mutex_lock(member->audio_in_mutex);
+    switch_mutex_lock(member->audio_out_mutex);
+    switch_mutex_lock(member->flag_mutex);
 
-			fnode = member->fnode;
-			while(fnode) {
-				cur = fnode;
-				fnode = fnode->next;
+    for (imember = conference->members; imember; imember = imember->next) {
+        if (imember == member ) {
+            if (last) {
+                last->next = imember->next;
+            } else {
+                conference->members = imember->next;
+            }
+            break;
+        }
+        last = imember;
+    }
 
-				if (cur->type == NODE_TYPE_SPEECH) {
-					switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
-					switch_core_speech_close(&cur->sh, &flags);
-				} else {
-					switch_core_file_close(&cur->fh);
-				}
+    /* Close Unused Handles */
+    if (member->fnode) {
+        conference_file_node_t *fnode, *cur;
+        switch_memory_pool_t *pool;
 
-				pool = cur->pool;
-				switch_core_destroy_memory_pool(&pool);
-			}
-		}
+        fnode = member->fnode;
+        while(fnode) {
+            cur = fnode;
+            fnode = fnode->next;
 
-		member->conference = NULL;
+            if (cur->type == NODE_TYPE_SPEECH) {
+                switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+                switch_core_speech_close(&cur->sh, &flags);
+            } else {
+                switch_core_file_close(&cur->fh);
+            }
 
-		if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
-			conference->count--;
-			if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
-				switch_event_fire(&event);
-			}
+            pool = cur->pool;
+            switch_core_destroy_memory_pool(&pool);
+        }
+    }
 
-			if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min) 
-				|| (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) {
-					switch_set_flag(conference, CFLAG_DESTRUCT);
-			} else { 
-				if (conference->exit_sound) {
-					conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session));
-				}
-				if (conference->count == 1 && conference->alone_sound) {
-					conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
-				} 
-			}
+    member->conference = NULL;
 
-			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_t *channel = switch_core_session_get_channel(member->session);
-				switch_channel_event_set_data(channel, event);
+    if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
+        conference->count--;
+        if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+            switch_event_fire(&event);
+        }
 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "del-member");
-				switch_event_fire(&event);
-			}
-		}
-		switch_mutex_unlock(member->flag_mutex);
-		switch_mutex_unlock(member->audio_out_mutex);
-		switch_mutex_unlock(member->audio_in_mutex);
-		switch_mutex_unlock(conference->member_mutex);
-		switch_mutex_unlock(conference->mutex);
+        if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min) 
+            || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) {
+            switch_set_flag(conference, CFLAG_DESTRUCT);
+        } else { 
+            if (conference->exit_sound) {
+                conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session));
+            }
+            if (conference->count == 1 && conference->alone_sound) {
+                conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
+            } 
+        }
 
-		status = SWITCH_STATUS_SUCCESS;
-	}
+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+            switch_channel_t *channel = switch_core_session_get_channel(member->session);
+            switch_channel_event_set_data(channel, event);
 
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "del-member");
+            switch_event_fire(&event);
+        }
+    }
+
+    switch_mutex_unlock(member->flag_mutex);
+    switch_mutex_unlock(member->audio_out_mutex);
+    switch_mutex_unlock(member->audio_in_mutex);
+    switch_mutex_unlock(conference->member_mutex);
+    switch_mutex_unlock(conference->mutex);
+    status = SWITCH_STATUS_SUCCESS;
+	
+
 	return status;
 }
 
@@ -655,9 +668,9 @@
 					int len = (int) imember->read;
 
 					imember->mux_resampler->from_len = switch_short_to_float(bptr, imember->mux_resampler->from, (int) len / 2);
-					imember->mux_resampler->to_len = switch_resample_process(imember->mux_resampler, imember->mux_resampler->from,
-																		 imember->mux_resampler->from_len, imember->mux_resampler->to,
-																		 imember->mux_resampler->to_size, 0);
+					imember->mux_resampler->to_len = switch_resample_process(imember->mux_resampler, imember->mux_resampler->from, 
+                                                                             imember->mux_resampler->from_len, imember->mux_resampler->to, 
+                                                                             imember->mux_resampler->to_size, 0);
 					switch_float_to_short(imember->mux_resampler->to, out, len);
 					len = imember->mux_resampler->to_len * 2;
 					switch_buffer_write(imember->resample_buffer, out, len);
@@ -683,10 +696,10 @@
 					switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
 					uint32_t rate = conference->rate;
 
-					if (switch_core_speech_read_tts(&conference->fnode->sh,
-													file_frame,
-													&file_data_len,
-													&rate,
+					if (switch_core_speech_read_tts(&conference->fnode->sh, 
+													file_frame, 
+													&file_data_len, 
+													&rate, 
 													&flags) == SWITCH_STATUS_SUCCESS) {
 						file_sample_len = file_data_len / 2;
 					} else {
@@ -1166,13 +1179,13 @@
 	if (member != NULL && data != NULL) {
 		caller_control_menu_ctx_t *menu_ctx = (caller_control_menu_ctx_t *)data;
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "conference_loop_fn_menu handler '%s'\n",menu_ctx->name);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "conference_loop_fn_menu handler '%s'\n", menu_ctx->name);
 		if (menu_ctx->menu_stack != NULL && menu_ctx->xml_ctx != NULL) {
-			switch_ivr_menu_execute(member->session,menu_ctx->menu_stack,menu_ctx->name,member);
+			switch_ivr_menu_execute(member->session, menu_ctx->menu_stack, menu_ctx->name, member);
 		} else {
-			if(menu_ctx->menu_stack == NULL)
+			if (menu_ctx->menu_stack == NULL)
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "conference_loop_fn_menu handler NULL menu_stack\n");
-			if(menu_ctx->xml_ctx == NULL)
+			if (menu_ctx->xml_ctx == NULL)
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "conference_loop_fn_menu handler NULL xml_ctx\n");
 		}
 	}
@@ -1187,10 +1200,10 @@
 		int argc = 0;
 
 		if (lbuf != NULL) {
-			memset(argv,0,sizeof(argv));
+			memset(argv, 0, sizeof(argv));
 			argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dial argc %u 1 '%s' 2 '%s' 3 '%s' 4 '%s'\n",
-				argc,argv[0],argv[1],argv[2],argv[3]);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dial argc %u 1 '%s' 2 '%s' 3 '%s' 4 '%s'\n", 
+                              argc, argv[0], argv[1], argv[2], argv[3]);
 			if (argc >= 4) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "executing conference outcall\n");
 				conference_outcall(member->conference, NULL, argv[0], atoi(argv[1]), NULL, argv[3], argv[2]);
@@ -1203,6 +1216,7 @@
 	}
 }
 
+
 /* marshall frames from the call leg to the conference thread for muxing to other call legs */
 static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj)
 {
@@ -1211,11 +1225,11 @@
 	switch_status_t status;
 	switch_frame_t *read_frame = NULL;
 	switch_codec_t *read_codec;
-	uint32_t hangover = 40,
-		hangunder = 15,
-		hangover_hits = 0,
-		hangunder_hits = 0,
-		energy_level = 0,
+	uint32_t hangover = 40, 
+		hangunder = 15, 
+		hangover_hits = 0, 
+		hangunder_hits = 0, 
+		energy_level = 0, 
 		diff_level = 400;
 	uint8_t talking = 0;
 
@@ -1311,8 +1325,8 @@
 				int len = (int) read_frame->datalen;;
 
 				member->read_resampler->from_len = switch_short_to_float(bptr, member->read_resampler->from, (int) len / 2);
-				member->read_resampler->to_len = switch_resample_process(member->read_resampler, member->read_resampler->from,
-																		 member->read_resampler->from_len, member->read_resampler->to,
+				member->read_resampler->to_len = switch_resample_process(member->read_resampler, member->read_resampler->from, 
+																		 member->read_resampler->from_len, member->read_resampler->to, 
 																		 member->read_resampler->to_size, 0);
 				switch_float_to_short(member->read_resampler->to, read_frame->data, len);
 				len = member->read_resampler->to_len * 2;
@@ -1352,22 +1366,22 @@
 }
 
 static caller_control_fn_table_t ccfntbl[] = {
-	{"mute",		"0",	CALLER_CONTROL_MUTE,		conference_loop_fn_mute_toggle},
-	{"deaf mute",		"*",	CALLER_CONTROL_DEAF_MUTE,	conference_loop_fn_deafmute_toggle},
-	{"energy up",		"9",	CALLER_CONTROL_ENERGY_UP,	conference_loop_fn_energy_up},
-	{"energy equ",		"8",	CALLER_CONTROL_ENERGY_EQU_CONF,	conference_loop_fn_energy_equ_conf},
-	{"energy dn",		"7",	CALLER_CONTROL_ENERGEY_DN,	conference_loop_fn_energy_dn},
-	{"vol talk up",		"3",	CALLER_CONTROL_VOL_TALK_UP,	conference_loop_fn_volume_talk_up},
-	{"vol talk zero",	"2",	CALLER_CONTROL_VOL_TALK_ZERO,	conference_loop_fn_volume_talk_zero},
-	{"vol talk dn",		"1",	CALLER_CONTROL_VOL_TALK_DN,	conference_loop_fn_volume_talk_dn},
-	{"vol listen up",	"6",	CALLER_CONTROL_VOL_LISTEN_UP,	conference_loop_fn_volume_listen_up},
-	{"vol listen zero",	"5",	CALLER_CONTROL_VOL_LISTEN_ZERO,	conference_loop_fn_volume_listen_zero},
-	{"vol listen dn",	"4",	CALLER_CONTROL_VOL_LISTEN_DN,	conference_loop_fn_volume_listen_dn},
-	{"hangup",		"#",	CALLER_CONTROL_HANGUP,		conference_loop_fn_hangup},
+	{"mute", 		"0", 	CALLER_CONTROL_MUTE, 		conference_loop_fn_mute_toggle}, 
+	{"deaf mute", 		"*", 	CALLER_CONTROL_DEAF_MUTE, 	conference_loop_fn_deafmute_toggle}, 
+	{"energy up", 		"9", 	CALLER_CONTROL_ENERGY_UP, 	conference_loop_fn_energy_up}, 
+	{"energy equ", 		"8", 	CALLER_CONTROL_ENERGY_EQU_CONF, 	conference_loop_fn_energy_equ_conf}, 
+	{"energy dn", 		"7", 	CALLER_CONTROL_ENERGEY_DN, 	conference_loop_fn_energy_dn}, 
+	{"vol talk up", 		"3", 	CALLER_CONTROL_VOL_TALK_UP, 	conference_loop_fn_volume_talk_up}, 
+	{"vol talk zero", 	"2", 	CALLER_CONTROL_VOL_TALK_ZERO, 	conference_loop_fn_volume_talk_zero}, 
+	{"vol talk dn", 		"1", 	CALLER_CONTROL_VOL_TALK_DN, 	conference_loop_fn_volume_talk_dn}, 
+	{"vol listen up", 	"6", 	CALLER_CONTROL_VOL_LISTEN_UP, 	conference_loop_fn_volume_listen_up}, 
+	{"vol listen zero", 	"5", 	CALLER_CONTROL_VOL_LISTEN_ZERO, 	conference_loop_fn_volume_listen_zero}, 
+	{"vol listen dn", 	"4", 	CALLER_CONTROL_VOL_LISTEN_DN, 	conference_loop_fn_volume_listen_dn}, 
+	{"hangup", 		"#", 	CALLER_CONTROL_HANGUP, 		conference_loop_fn_hangup}, 
 #ifdef OPTION_IVR_MENU_SUPPORT
-	{"menu",		NULL,	CALLER_CONTROL_MENU,		conference_loop_fn_menu},
+	{"menu", 		NULL, 	CALLER_CONTROL_MENU, 		conference_loop_fn_menu}, 
 #endif
-	{"dial",		NULL,	CALLER_CONTROL_DIAL,		conference_loop_fn_dial},
+	{"dial", 		NULL, 	CALLER_CONTROL_DIAL, 		conference_loop_fn_dial}, 
 };
 #define CCFNTBL_QTY (sizeof(ccfntbl)/sizeof(ccfntbl[0]))
 
@@ -1388,10 +1402,10 @@
 	assert(channel != NULL);
 	assert(member->conference != NULL);
 
-	if (switch_core_timer_init(&timer,
-							   member->conference->timer_name,
-							   member->conference->interval,
-							   samples,
+	if (switch_core_timer_init(&timer, 
+							   member->conference->timer_name, 
+							   member->conference->interval, 
+							   samples, 
 							   NULL) == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer %s success interval: %u  samples: %u\n", 
 						  member->conference->timer_name, member->conference->interval, samples);	
@@ -1412,11 +1426,11 @@
 	launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
 
 	/* build a digit stream object */
-	if (member->conference->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->conference->dtmf_parser,&member->digit_stream) != SWITCH_STATUS_SUCCESS) {
+	if (member->conference->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->conference->dtmf_parser, &member->digit_stream) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning Will Robinson, there is no digit parser stream object\n");
 	}
 
-	/* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed,		*/
+	/* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed, 		*/
 	/* you better not block this thread loop for more than the duration of member->conference->timer_name!	*/
 	while(switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(member, MFLAG_ITHREAD) && switch_channel_ready(channel)) {
 		char dtmf[128] = "";
@@ -1464,34 +1478,39 @@
 		if (switch_channel_has_dtmf(channel)) {
 			switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
 
-			if(member->conference->dtmf_parser != NULL) {
+			if (member->conference->dtmf_parser != NULL) {
 
 				for (digit = dtmf; *digit && caller_action == NULL; digit++) {
 					caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit);
 				}
 			}
-		/* otherwise, clock the parser so that it can handle digit timeout detection */
-		} else if(member->conference->dtmf_parser != NULL) {
+            /* otherwise, clock the parser so that it can handle digit timeout detection */
+		} else if (member->conference->dtmf_parser != NULL) {
 			caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, '\0');
 		}
 
 		/* if a caller action has been detected, handle it */
 		if (caller_action != NULL && caller_action->fndesc != NULL && caller_action->fndesc->handler != NULL) {
-			switch_channel_t *channel		= switch_core_session_get_channel(member->session);
-			switch_caller_profile_t *profile	= switch_channel_get_caller_profile(channel);
+			switch_channel_t *channel		 = switch_core_session_get_channel(member->session);
+			switch_caller_profile_t *profile	 = switch_channel_get_caller_profile(channel);
+            char *param = NULL;
 
-			switch_log_printf(SWITCH_CHANNEL_LOG,
-					SWITCH_LOG_INFO,
-					"executing caller control '%s' param '%s' on call '%u,%s,%s,%s'\n",
-					caller_action->fndesc->key,
-					(caller_action->fndesc->action != CALLER_CONTROL_MENU ? caller_action->data : ""),
-					member->id,
-					switch_channel_get_name(channel),
-					profile->caller_id_name,
-					profile->caller_id_number
-					);
-			caller_action->fndesc->handler(member,caller_action->data);
+            if (caller_action->fndesc->action != CALLER_CONTROL_MENU) {
+                param = caller_action->data;
+            }
 
+			switch_log_printf(SWITCH_CHANNEL_LOG, 
+                              SWITCH_LOG_INFO, 
+                              "executing caller control '%s' param '%s' on call '%u, %s, %s, %s'\n", 
+                              caller_action->fndesc->key, 
+                              param ? param : "none", 
+                              member->id, 
+                              switch_channel_get_name(channel), 
+                              profile->caller_id_name, 
+                              profile->caller_id_number
+                              );
+			caller_action->fndesc->handler(member, caller_action->data);
+
 			/* set up for next pass */
 			caller_action = NULL;
 		}
@@ -1528,10 +1547,10 @@
 						switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
 						uint32_t rate = member->conference->rate;
 
-						if (switch_core_speech_read_tts(&member->fnode->sh,
-														file_frame,
-														&file_data_len,
-														&rate,
+						if (switch_core_speech_read_tts(&member->fnode->sh, 
+														file_frame, 
+														&file_data_len, 
+														&rate, 
 														&flags) == SWITCH_STATUS_SUCCESS) {
 							file_sample_len = file_data_len / 2;
 						} else {
@@ -1598,8 +1617,8 @@
 	switch_clear_flag_locked(member, MFLAG_RUNNING);
 	switch_core_timer_destroy(&timer);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n",
-			switch_channel_cause2str(switch_channel_get_cause(channel)));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n", 
+                      switch_channel_cause2str(switch_channel_get_cause(channel)));
 
 	/* if it's an outbound channel, store the release cause in the conference struct, we might need it */
 	if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
@@ -1672,9 +1691,9 @@
 		goto end;
 	}
 
-	if (switch_core_file_open(&fh,
-							  rec->path,
-							  SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
+	if (switch_core_file_open(&fh, 
+							  rec->path, 
+							  SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, 
 							  rec->pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s]\n", rec->path);
 		goto end;
@@ -1709,7 +1728,7 @@
 	switch_core_file_close(&fh);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording Stopped\n");
 
-end:
+ end:
 
 	if (rec->pool) {
 		switch_memory_pool_t *pool = rec->pool;
@@ -1729,27 +1748,26 @@
 static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop)
 {
 	uint32_t count = 0;
+    conference_file_node_t *nptr;
 
-	if (conference != NULL) {
-		conference_file_node_t *nptr;
+    assert(conference != NULL);
 
-		switch_mutex_lock(conference->mutex);
+    switch_mutex_lock(conference->mutex);
 
-		if (stop == FILE_STOP_ALL) {
-			for (nptr = conference->fnode; nptr; nptr = nptr->next) {
-				nptr->done++;
-				count++;
-			}
-		} else {
-			if (conference->fnode) {
-				conference->fnode->done++;
-				count++;
-			}
-		}
+    if (stop == FILE_STOP_ALL) {
+        for (nptr = conference->fnode; nptr; nptr = nptr->next) {
+            nptr->done++;
+            count++;
+        }
+    } else {
+        if (conference->fnode) {
+            conference->fnode->done++;
+            count++;
+        }
+    }
+    
+    switch_mutex_unlock(conference->mutex);	
 
-		switch_mutex_unlock(conference->mutex);
-	}
-
 	return count;
 }
 
@@ -1784,1638 +1802,1694 @@
 /* Play a file in the conference room */
 static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel)
 {
-	switch_status_t status = SWITCH_STATUS_FALSE;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+    conference_file_node_t *fnode, *nptr;
+    switch_memory_pool_t *pool;
+    uint32_t count;
+    char *expanded = NULL;
 
-	if (conference != NULL && channel != NULL) {
-		conference_file_node_t *fnode, *nptr;
-		switch_memory_pool_t *pool;
-		uint32_t count;
-		char *expanded = NULL;
-		uint8_t frexp = 0;
+    assert(conference != NULL);
 
-		switch_mutex_lock(conference->mutex);
-		switch_mutex_lock(conference->member_mutex);
-		count = conference->count;
-		switch_mutex_unlock(conference->member_mutex);
-		switch_mutex_unlock(conference->mutex);	
+    switch_mutex_lock(conference->mutex);
+    switch_mutex_lock(conference->member_mutex);
+    count = conference->count;
+    switch_mutex_unlock(conference->member_mutex);
+    switch_mutex_unlock(conference->mutex);	
 
-		if (!count) {
-			status = SWITCH_STATUS_FALSE;
-			goto done;
-		}
+    if (!count) {
+        status = SWITCH_STATUS_FALSE;
+        goto done;
+    }
 
-		if (channel) {
-			if ((expanded = switch_channel_expand_variables(channel, file)) != file) {
-				file = expanded;
-				frexp = 1;
-			}
-		}
+    if (channel) {
+        if ((expanded = switch_channel_expand_variables(channel, file)) != file) {
+            file = expanded;
+        } else {
+            expanded = NULL;
+        }
+    }
 
-
+    if 
 #ifdef WIN32
-		if (*(file +1) != ':' && *file != '/') {
+        (*(file +1) != ':' && *file != '/')
 #else
-		if (*file != '/') {
+        (*file != '/')
 #endif
-			status = conference_say(conference, file, leadin);
-			goto done;
-		}
+            {
+                status = conference_say(conference, file, leadin);
+                goto done;
+            }
 
-		/* Setup a memory pool to use. */
-		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-			status = SWITCH_STATUS_MEMERR;
-			goto done;
-		}
+    /* Setup a memory pool to use. */
+    if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+        status = SWITCH_STATUS_MEMERR;
+        goto done;
+    }
 
-		/* Create a node object*/
-		if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
-			switch_core_destroy_memory_pool(&pool);
-			status = SWITCH_STATUS_MEMERR;
-			goto done;
-		}
+    /* Create a node object*/
+    if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+        switch_core_destroy_memory_pool(&pool);
+        status = SWITCH_STATUS_MEMERR;
+        goto done;
+    }
 
-		fnode->type = NODE_TYPE_FILE;
-		fnode->leadin = leadin;
+    fnode->type = NODE_TYPE_FILE;
+    fnode->leadin = leadin;
 
-		/* Open the file */
-		if (switch_core_file_open(&fnode->fh,
-								  file,
-								  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
-								  pool) != SWITCH_STATUS_SUCCESS) {
-			switch_core_destroy_memory_pool(&pool);
-			status = SWITCH_STATUS_NOTFOUND;
-			goto done;
-		}
+    /* Open the file */
+    if (switch_core_file_open(&fnode->fh, 
+                              file, 
+                              SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, 
+                              pool) != SWITCH_STATUS_SUCCESS) {
+        switch_core_destroy_memory_pool(&pool);
+        status = SWITCH_STATUS_NOTFOUND;
+        goto done;
+    }
 
-		fnode->pool = pool;
+    fnode->pool = pool;
 
-		/* Queue the node */
-		switch_mutex_lock(conference->mutex);
-		for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
+    /* Queue the node */
+    switch_mutex_lock(conference->mutex);
+    for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
 
-		if (nptr) {
-			nptr->next = fnode;
-		} else {
-			conference->fnode = fnode;
-		}
-		switch_mutex_unlock(conference->mutex);
+    if (nptr) {
+        nptr->next = fnode;
+    } else {
+        conference->fnode = fnode;
+    }
+    switch_mutex_unlock(conference->mutex);
 
-	    done:
+ done:
 
-	    if (frexp) {
-		switch_safe_free(expanded);
-	    }
-	}
 
-	return status;
+    switch_safe_free(expanded);
+
+	
+
+    return status;
 }
 
 /* Play a file in the conference room to a member */
 static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin)
 {
-	switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_status_t status = SWITCH_STATUS_FALSE;
 
-	if (member != NULL && file != NULL) {
-		conference_file_node_t *fnode, *nptr;
-		switch_memory_pool_t *pool;
+    if (member != NULL && file != NULL) {
+        conference_file_node_t *fnode, *nptr;
+        switch_memory_pool_t *pool;
 
-		if (*file != '/') {
-			return conference_member_say(member, file, leadin);
-		}
+        if (*file != '/') {
+            return conference_member_say(member, file, leadin);
+        }
 
-		/* Setup a memory pool to use. */
-		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-			return SWITCH_STATUS_MEMERR;
-		}
+        /* Setup a memory pool to use. */
+        if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+            return SWITCH_STATUS_MEMERR;
+        }
 
-		/* Create a node object*/
-		if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
-			switch_core_destroy_memory_pool(&pool);
-			return SWITCH_STATUS_MEMERR;
-		}
+        /* Create a node object*/
+        if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+            switch_core_destroy_memory_pool(&pool);
+            return SWITCH_STATUS_MEMERR;
+        }
 
-		fnode->type = NODE_TYPE_FILE;
-		fnode->leadin = leadin;
+        fnode->type = NODE_TYPE_FILE;
+        fnode->leadin = leadin;
 
-		/* Open the file */
-		if (switch_core_file_open(&fnode->fh,
-								  file,
-								  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
-								  pool) != SWITCH_STATUS_SUCCESS) {
-			switch_core_destroy_memory_pool(&pool);
-			return SWITCH_STATUS_NOTFOUND;
-		}
+        /* Open the file */
+        if (switch_core_file_open(&fnode->fh, 
+                                  file, 
+                                  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, 
+                                  pool) != SWITCH_STATUS_SUCCESS) {
+            switch_core_destroy_memory_pool(&pool);
+            return SWITCH_STATUS_NOTFOUND;
+        }
 
-		fnode->pool = pool;
+        fnode->pool = pool;
 
-		/* Queue the node */
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "queueing file '%s' for play\n",file);
-		switch_mutex_lock(member->flag_mutex);
-		for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
+        /* Queue the node */
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "queueing file '%s' for play\n", file);
+        switch_mutex_lock(member->flag_mutex);
+        for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
 
-		if (nptr) {
-			nptr->next = fnode;
-		} else {
-			member->fnode = fnode;
-		}
-		switch_mutex_unlock(member->flag_mutex);
+        if (nptr) {
+            nptr->next = fnode;
+        } else {
+            member->fnode = fnode;
+        }
+        switch_mutex_unlock(member->flag_mutex);
 
-		status = SWITCH_STATUS_SUCCESS;
-	}
+        status = SWITCH_STATUS_SUCCESS;
+    }
 
-	return status;
+    return status;
 }
 
 /* Say some thing with TTS in the conference room */
 static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin)
 {
-	switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_status_t status = SWITCH_STATUS_FALSE;
 
-	if (member != NULL && !switch_strlen_zero(text)) {
-		conference_obj_t *conference = (member != NULL ? member->conference : NULL);
-		conference_file_node_t *fnode, *nptr;
-		switch_memory_pool_t *pool;
-		switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+    if (member != NULL && !switch_strlen_zero(text)) {
+        conference_obj_t *conference = (member != NULL ? member->conference : NULL);
+        conference_file_node_t *fnode, *nptr;
+        switch_memory_pool_t *pool;
+        switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
 
-		if (conference == NULL) {
-			return SWITCH_STATUS_FALSE;
-		}
+        assert(conference != NULL);
+        
+        if (!(conference->tts_engine && conference->tts_voice)) {
+            return SWITCH_STATUS_SUCCESS;
+        }
 
-		if (!(conference->tts_engine && conference->tts_voice)) {
-			return SWITCH_STATUS_SUCCESS;
-		}
+        /* Setup a memory pool to use. */
+        if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+            return SWITCH_STATUS_MEMERR;
+        }
 
-		/* Setup a memory pool to use. */
-		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-			return SWITCH_STATUS_MEMERR;
-		}
+        /* Create a node object*/
+        if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+            switch_core_destroy_memory_pool(&pool);
+            return SWITCH_STATUS_MEMERR;
+        }
 
-		/* Create a node object*/
-		if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
-			switch_core_destroy_memory_pool(&pool);
-			return SWITCH_STATUS_MEMERR;
-		}
+        fnode->type = NODE_TYPE_SPEECH;
+        fnode->leadin = leadin;
 
-		fnode->type = NODE_TYPE_SPEECH;
-		fnode->leadin = leadin;
+        memset(&fnode->sh, 0, sizeof(fnode->sh));
+        if (switch_core_speech_open(&fnode->sh, 
+                                    conference->tts_engine, 
+                                    conference->tts_voice, 
+                                    conference->rate, 
+                                    &flags, 
+                                    conference->pool) != SWITCH_STATUS_SUCCESS) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
+            return SWITCH_STATUS_FALSE;
+        }
 
-		memset(&fnode->sh, 0, sizeof(fnode->sh));
-		if (switch_core_speech_open(&fnode->sh,
-									conference->tts_engine,
-									conference->tts_voice,
-									conference->rate,
-									&flags,
-									conference->pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
-			return SWITCH_STATUS_FALSE;
-		}
+        fnode->pool = pool;
 
-		fnode->pool = pool;
+        /* Queue the node */
+        switch_mutex_lock(member->flag_mutex);
+        for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
 
-		/* Queue the node */
-		switch_mutex_lock(member->flag_mutex);
-		for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
+        if (nptr) {
+            nptr->next = fnode;
+        } else {
+            member->fnode = fnode;
+        }
 
-		if (nptr) {
-			nptr->next = fnode;
-		} else {
-			member->fnode = fnode;
-		}
+        /* Begin Generation */
+        switch_sleep(200000);
+        switch_core_speech_feed_tts(&fnode->sh, text, &flags);
+        switch_mutex_unlock(member->flag_mutex);
 
-		/* Begin Generation */
-		switch_sleep(200000);
-		switch_core_speech_feed_tts(&fnode->sh, text, &flags);
-		switch_mutex_unlock(member->flag_mutex);
+        status = SWITCH_STATUS_SUCCESS;
+    }
 
-		status = SWITCH_STATUS_SUCCESS;
-	}
-
-	return status;
+    return status;
 }
 
 /* Say some thing with TTS in the conference room */
-static switch_status_t conference_say(conference_obj_t *conference, char *text, uint32_t leadin)
+static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin)
 {
-	switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_status_t status = SWITCH_STATUS_FALSE;
+    conference_file_node_t *fnode, *nptr;
+    switch_memory_pool_t *pool;
+    switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+    uint32_t count;
 
-	if (conference != NULL && !switch_strlen_zero(text)) {
-		conference_file_node_t *fnode, *nptr;
-		switch_memory_pool_t *pool;
-		switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
-		uint32_t count;
+    assert(conference != NULL);
 
-		switch_mutex_lock(conference->mutex);
-		switch_mutex_lock(conference->member_mutex);
-		count = conference->count;
-		if (!(conference->tts_engine && conference->tts_voice)) {
-			count = 0;
-		}
-		switch_mutex_unlock(conference->member_mutex);
-		switch_mutex_unlock(conference->mutex);	
+    if (switch_strlen_zero(text)) {
+        return SWITCH_STATUS_GENERR;
+    }
 
-		if (!count) {
-			return SWITCH_STATUS_FALSE;
-		}
 
-		/* Setup a memory pool to use. */
-		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-			return SWITCH_STATUS_MEMERR;
-		}
 
-		/* Create a node object*/
-		if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
-			switch_core_destroy_memory_pool(&pool);
-			return SWITCH_STATUS_MEMERR;
-		}
+    switch_mutex_lock(conference->mutex);
+    switch_mutex_lock(conference->member_mutex);
+    count = conference->count;
+    if (!(conference->tts_engine && conference->tts_voice)) {
+        count = 0;
+    }
+    switch_mutex_unlock(conference->member_mutex);
+    switch_mutex_unlock(conference->mutex);	
 
-		fnode->type = NODE_TYPE_SPEECH;
-		fnode->leadin = leadin;
+    if (!count) {
+        return SWITCH_STATUS_FALSE;
+    }
 
-		memset(&fnode->sh, 0, sizeof(fnode->sh));
-		if (switch_core_speech_open(&fnode->sh,
-									conference->tts_engine,
-									conference->tts_voice,
-									conference->rate,
-									&flags,
-									conference->pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
-			return SWITCH_STATUS_FALSE;
-		}
+    /* Setup a memory pool to use. */
+    if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+        return SWITCH_STATUS_MEMERR;
+    }
 
-		fnode->pool = pool;
+    /* Create a node object*/
+    if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+        switch_core_destroy_memory_pool(&pool);
+        return SWITCH_STATUS_MEMERR;
+    }
 
-		/* Queue the node */
-		switch_mutex_lock(conference->mutex);
-		for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
+    fnode->type = NODE_TYPE_SPEECH;
+    fnode->leadin = leadin;
 
-		if (nptr) {
-			nptr->next = fnode;
-		} else {
-			conference->fnode = fnode;
-		}
+    memset(&fnode->sh, 0, sizeof(fnode->sh));
+    if (switch_core_speech_open(&fnode->sh, 
+                                conference->tts_engine, 
+                                conference->tts_voice, 
+                                conference->rate, 
+                                &flags, 
+                                conference->pool) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
+        return SWITCH_STATUS_FALSE;
+    }
 
-		/* Begin Generation */
-		switch_sleep(200000);
-		switch_core_speech_feed_tts(&fnode->sh, text, &flags);
-		switch_mutex_unlock(conference->mutex);
+    fnode->pool = pool;
 
-		status = SWITCH_STATUS_SUCCESS;
-	}
+    /* Queue the node */
+    switch_mutex_lock(conference->mutex);
+    for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
 
-	return status;
+    if (nptr) {
+        nptr->next = fnode;
+    } else {
+        conference->fnode = fnode;
+    }
+
+    /* Begin Generation */
+    switch_sleep(200000);
+    switch_core_speech_feed_tts(&fnode->sh, (char *)text, &flags);
+    switch_mutex_unlock(conference->mutex);
+
+    status = SWITCH_STATUS_SUCCESS;
+
+    return status;
 }
 
 /* execute a callback for every member of the conference */
 static void conference_member_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data)
 {
-	conference_member_t *member = NULL;
+    conference_member_t *member = NULL;
 
-	if(conference != NULL && stream != NULL && pfncallback != NULL) {
-		switch_mutex_lock(conference->member_mutex);
+    assert(conference != NULL);
+    assert(stream != NULL);
+    assert(pfncallback != NULL);
 
-		for (member = conference->members; member; member = member->next) {
-			pfncallback(member,stream,data);
-		}
-		switch_mutex_unlock(conference->member_mutex);
-	}
+    switch_mutex_lock(conference->member_mutex);
+
+    for (member = conference->members; member; member = member->next) {
+        pfncallback(member, stream, data);
+    }
+
+    switch_mutex_unlock(conference->member_mutex);
+	
 }
 
 static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream)
 {
-	if (conference != NULL && stream != NULL) {
-		conference_member_t *member = NULL;
+    conference_member_t *member = NULL;
 
-		switch_mutex_lock(conference->member_mutex);
-//		stream->write_function(stream, "<pre>Current Callers:\n");
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-		for (member = conference->members; member; member = member->next) {
-			switch_channel_t *channel;
-			switch_caller_profile_t *profile;
+    switch_mutex_lock(conference->member_mutex);
+    //		stream->write_function(stream, "<pre>Current Callers:\n");
 
-			if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
-				continue;
-			}
-			channel = switch_core_session_get_channel(member->session);
-			profile = switch_channel_get_caller_profile(channel);
+    for (member = conference->members; member; member = member->next) {
+        switch_channel_t *channel;
+        switch_caller_profile_t *profile;
 
+        if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
+            continue;
+        }
+        channel = switch_core_session_get_channel(member->session);
+        profile = switch_channel_get_caller_profile(channel);
 
-			stream->write_function(stream, "%u) %s (%s)\n", 
-								member->id,
-								profile->caller_id_name,
-								profile->caller_id_number
-								);
 
-		}
-		switch_mutex_unlock(conference->member_mutex);
-	}
+        stream->write_function(stream, "%u) %s (%s)\n", 
+                               member->id, 
+                               profile->caller_id_name, 
+                               profile->caller_id_number
+                               );
+
+    }
+
+    switch_mutex_unlock(conference->member_mutex);
+	
 }
 
 static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim)
 {
-	if (conference != NULL && stream != NULL && delim != NULL) {
-		conference_member_t *member = NULL;
+    conference_member_t *member = NULL;
 
-		switch_mutex_lock(conference->member_mutex);
+    assert(conference != NULL);
+    assert(stream != NULL);
+    assert(delim != NULL);
 
-		for (member = conference->members; member; member = member->next) {
-			switch_channel_t *channel;
-			switch_caller_profile_t *profile;
-			char *uuid;
-			char *name;
-			uint32_t count = 0;
 
-			if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "continue\n");
-				continue;
-			}
+    switch_mutex_lock(conference->member_mutex);
 
-			uuid = switch_core_session_get_uuid(member->session);
-			channel = switch_core_session_get_channel(member->session);
-			profile = switch_channel_get_caller_profile(channel);
-			name = switch_channel_get_name(channel);
+    for (member = conference->members; member; member = member->next) {
+        switch_channel_t *channel;
+        switch_caller_profile_t *profile;
+        char *uuid;
+        char *name;
+        uint32_t count = 0;
 
+        if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "continue\n");
+            continue;
+        }
 
-			stream->write_function(stream, "%u%s%s%s%s%s%s%s%s%s", 
-								   member->id,delim,
-								   name,delim,
-								   uuid,delim,
-								   profile->caller_id_name,delim,
-								   profile->caller_id_number, delim);
+        uuid = switch_core_session_get_uuid(member->session);
+        channel = switch_core_session_get_channel(member->session);
+        profile = switch_channel_get_caller_profile(channel);
+        name = switch_channel_get_name(channel);
 
-			if (switch_test_flag(member, MFLAG_CAN_HEAR)) {
-				stream->write_function(stream, "hear");
-				count++;
-			}
 
-			if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
-				stream->write_function(stream, "%s%s", count ? "|" : "", "speak");
-				count++;
-			}
+        stream->write_function(stream, "%u%s%s%s%s%s%s%s%s%s", 
+                               member->id, delim, 
+                               name, delim, 
+                               uuid, delim, 
+                               profile->caller_id_name, delim, 
+                               profile->caller_id_number, delim);
 
-			stream->write_function(stream, "%s%d%s%d%s%d\n",
-								delim,
-								member->volume_in_level, delim,
-								member->volume_out_level, delim,
-								member->energy_level);
-		}
-		switch_mutex_unlock(conference->member_mutex);
-	}
+        if (switch_test_flag(member, MFLAG_CAN_HEAR)) {
+            stream->write_function(stream, "hear");
+            count++;
+        }
+
+        if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+            stream->write_function(stream, "%s%s", count ? "|" : "", "speak");
+            count++;
+        }
+
+        stream->write_function(stream, "%s%d%s%d%s%d\n", 
+                               delim, 
+                               member->volume_in_level, delim, 
+                               member->volume_out_level, delim, 
+                               member->energy_level);
+    }
+
+    switch_mutex_unlock(conference->member_mutex);
+	
 }
 
-static int conf_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (member != NULL) {
-		switch_event_t *event;
+    if (member != NULL) {
+        switch_event_t *event;
 
-		switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
-		if (member->conference->muted_sound) {
-			conference_member_play_file(member, member->conference->muted_sound, 0);
-		} else {
-			char msg[512];
+        switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
+        if (member->conference->muted_sound) {
+            conference_member_play_file(member, member->conference->muted_sound, 0);
+        } else {
+            char msg[512];
 
-			snprintf(msg, sizeof(msg), "Muted");
-			conference_member_say(member, msg, 0);
-		}
-		if(stream != NULL) {
-			stream->write_function(stream, "OK mute %u\n", member->id);
-		}
-		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
+            snprintf(msg, sizeof(msg), "Muted");
+            conference_member_say(member, msg, 0);
+        }
+        if (stream != NULL) {
+            stream->write_function(stream, "OK mute %u\n", member->id);
+        }
+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+            switch_channel_t *channel = switch_core_session_get_channel(member->session);
+            switch_channel_event_set_data(channel, event);
 
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "mute-member");
-			switch_event_fire(&event);
-		}
-	} else {
-		syntax_err = 1;
-	}
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "mute-member");
+            switch_event_fire(&event);
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_unmute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_unmute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (member != NULL) {
-		switch_event_t *event;
+    if (member != NULL) {
+        switch_event_t *event;
 
-		switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
-		if(stream != NULL) {
-			stream->write_function(stream, "OK unmute %u\n", member->id);
-		}
-		if (member->conference->unmuted_sound) {
-			conference_member_play_file(member, member->conference->unmuted_sound, 0);
-		} else {
-			char msg[512];
+        switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
+        if (stream != NULL) {
+            stream->write_function(stream, "OK unmute %u\n", member->id);
+        }
+        if (member->conference->unmuted_sound) {
+            conference_member_play_file(member, member->conference->unmuted_sound, 0);
+        } else {
+            char msg[512];
 
-			snprintf(msg, sizeof(msg), "Un-Muted");
-			conference_member_say(member, msg, 0);
-		}
-		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
+            snprintf(msg, sizeof(msg), "Un-Muted");
+            conference_member_say(member, msg, 0);
+        }
+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+            switch_channel_t *channel = switch_core_session_get_channel(member->session);
+            switch_channel_event_set_data(channel, event);
 
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unmute-member");
-			switch_event_fire(&event);
-		}
-	} else {
-		syntax_err = 1;
-	}
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unmute-member");
+            switch_event_fire(&event);
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_deaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_deaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (member != NULL) {
-		switch_event_t *event;
+    if (member != NULL) {
+        switch_event_t *event;
 
-		switch_clear_flag_locked(member, MFLAG_CAN_HEAR);
-		if(stream != NULL) {
-			stream->write_function(stream, "OK deaf %u\n", member->id);
-		}
-		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
+        switch_clear_flag_locked(member, MFLAG_CAN_HEAR);
+        if (stream != NULL) {
+            stream->write_function(stream, "OK deaf %u\n", member->id);
+        }
+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+            switch_channel_t *channel = switch_core_session_get_channel(member->session);
+            switch_channel_event_set_data(channel, event);
 
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "deaf-member");
-			switch_event_fire(&event);
-		}
-	} else {
-		syntax_err = 1;
-	}
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "deaf-member");
+            switch_event_fire(&event);
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_undeaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_undeaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (member != NULL) {
-		switch_event_t *event;
+    if (member != NULL) {
+        switch_event_t *event;
 
-		switch_set_flag_locked(member, MFLAG_CAN_HEAR);
-		if(stream != NULL) {
-			stream->write_function(stream, "OK undeaf %u\n", member->id);
-		}
-		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
+        switch_set_flag_locked(member, MFLAG_CAN_HEAR);
+        if (stream != NULL) {
+            stream->write_function(stream, "OK undeaf %u\n", member->id);
+        }
+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+            switch_channel_t *channel = switch_core_session_get_channel(member->session);
+            switch_channel_event_set_data(channel, event);
 
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "undeaf-member");
-			switch_event_fire(&event);
-		}
-	} else {
-		syntax_err = 1;
-	}
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "undeaf-member");
+            switch_event_fire(&event);
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_kick(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_kick(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (member != NULL) {
-		switch_event_t *event;
+    if (member != NULL) {
+        switch_event_t *event;
 
-		switch_mutex_lock(member->flag_mutex);
-		switch_clear_flag(member, MFLAG_RUNNING);
-		switch_set_flag(member, MFLAG_KICKED);
-		switch_mutex_unlock(member->flag_mutex);
-		switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
+        switch_mutex_lock(member->flag_mutex);
+        switch_clear_flag(member, MFLAG_RUNNING);
+        switch_set_flag(member, MFLAG_KICKED);
+        switch_mutex_unlock(member->flag_mutex);
+        switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
 
-		if(stream != NULL) {
-			stream->write_function(stream, "OK kicked %u\n", member->id);
-		}
+        if (stream != NULL) {
+            stream->write_function(stream, "OK kicked %u\n", member->id);
+        }
 
-		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+            switch_channel_t *channel = switch_core_session_get_channel(member->session);
+            switch_channel_event_set_data(channel, event);
 
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "kick-member");
-			switch_event_fire(&event);
-		}
-	} else {
-		syntax_err = 1;
-	}
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "kick-member");
+            switch_event_fire(&event);
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_energy(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_energy(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (member != NULL) {
-		switch_event_t *event;
+    if (member != NULL) {
+        switch_event_t *event;
 
-		if (data) {
-			switch_mutex_lock(member->flag_mutex);
-			member->energy_level = atoi((char *)data);
-			switch_mutex_unlock(member->flag_mutex);
-		}
+        if (data) {
+            switch_mutex_lock(member->flag_mutex);
+            member->energy_level = atoi((char *)data);
+            switch_mutex_unlock(member->flag_mutex);
+        }
 
-		if(stream != NULL) {
-			stream->write_function(stream, "Energy %u=%d\n", member->id, member->energy_level);
-		}
+        if (stream != NULL) {
+            stream->write_function(stream, "Energy %u = %d\n", member->id, member->energy_level);
+        }
 
-		if (data) {
-			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_t *channel = switch_core_session_get_channel(member->session);
-				switch_channel_event_set_data(channel, event);
+        if (data) {
+            if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+                switch_channel_t *channel = switch_core_session_get_channel(member->session);
+                switch_channel_event_set_data(channel, event);
 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
 
-				switch_event_fire(&event);
-			}
-		}
-	} else {
-		syntax_err = 1;
-	}
+                switch_event_fire(&event);
+            }
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_volume_in(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_volume_in(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (member != NULL) {
-		switch_event_t *event;
+    if (member != NULL) {
+        switch_event_t *event;
 
-		if (data) {
-			switch_mutex_lock(member->flag_mutex);
-			member->volume_in_level = atoi((char *)data);
-			switch_normalize_volume(member->volume_in_level);
-			switch_mutex_unlock(member->flag_mutex);
-		}
+        if (data) {
+            switch_mutex_lock(member->flag_mutex);
+            member->volume_in_level = atoi((char *)data);
+            switch_normalize_volume(member->volume_in_level);
+            switch_mutex_unlock(member->flag_mutex);
+        }
 
-		if(stream != NULL) {
-			stream->write_function(stream, "Volume IN %u=%d\n", member->id, member->volume_in_level);
-		}
-		if (data) {
-			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_t *channel = switch_core_session_get_channel(member->session);
-				switch_channel_event_set_data(channel, event);
+        if (stream != NULL) {
+            stream->write_function(stream, "Volume IN %u = %d\n", member->id, member->volume_in_level);
+        }
+        if (data) {
+            if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+                switch_channel_t *channel = switch_core_session_get_channel(member->session);
+                switch_channel_event_set_data(channel, event);
 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
 
-				switch_event_fire(&event);
-			}
-		}
-	} else {
-		syntax_err = 1;
-	}
+                switch_event_fire(&event);
+            }
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_volume_out(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_volume_out(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (member != NULL) {
-		switch_event_t *event;
+    if (member != NULL) {
+        switch_event_t *event;
 
-		if (data) {
-			switch_mutex_lock(member->flag_mutex);
-			member->volume_out_level = atoi((char *)data);
-			switch_normalize_volume(member->volume_out_level);
-			switch_mutex_unlock(member->flag_mutex);
-		}
+        if (data) {
+            switch_mutex_lock(member->flag_mutex);
+            member->volume_out_level = atoi((char *)data);
+            switch_normalize_volume(member->volume_out_level);
+            switch_mutex_unlock(member->flag_mutex);
+        }
 
-		if(stream != NULL) {
-			stream->write_function(stream, "Volume OUT %u=%d\n", member->id, member->volume_out_level);
-		}
+        if (stream != NULL) {
+            stream->write_function(stream, "Volume OUT %u = %d\n", member->id, member->volume_out_level);
+        }
 
-		if (data) {
-			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_t *channel = switch_core_session_get_channel(member->session);
-				switch_channel_event_set_data(channel, event);
+        if (data) {
+            if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+                switch_channel_t *channel = switch_core_session_get_channel(member->session);
+                switch_channel_event_set_data(channel, event);
 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
 
-				switch_event_fire(&event);
-			}
-		}
-	} else {
-		syntax_err = 1;
-	}
+                switch_event_fire(&event);
+            }
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_list(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	int syntax_err = 1;
+    int ret_status = SWITCH_STATUS_GENERR;
 
-	switch_hash_index_t *hi;
-	void *val;
-	char *d = ";";
-	int pretty = 0;
-	int argofs = (argc >= 2 && strcasecmp(argv[1],"list") == 0);	// detect being called from chat vs. api
+    switch_hash_index_t *hi;
+    void *val;
+    char *d = ";";
+    int pretty = 0;
+    int argofs = (argc >= 2 && strcasecmp(argv[1], "list") == 0);	// detect being called from chat vs. api
 
-	if (argv[1+argofs]) {
-		if (argv[2+argofs] && !strcasecmp(argv[1+argofs], "delim")) {
-			d = argv[2+argofs];
+    if (argv[1+argofs]) {
+        if (argv[2+argofs] && !strcasecmp(argv[1+argofs], "delim")) {
+            d = argv[2+argofs];
 
-			if (*d == '"') {
-				if (++d) {
-					char *p;
-					if ((p = strchr(d, '"'))) {
-						*p = '\0';
-					}
-				} else {
-					d = ";";
-				}
-			}
-		} else if (strcasecmp(argv[1+argofs], "pretty") == 0) {
-			pretty = 1;
-		}
-	}
+            if (*d == '"') {
+                if (++d) {
+                    char *p;
+                    if ((p = strchr(d, '"'))) {
+                        *p = '\0';
+                    }
+                } else {
+                    d = ";";
+                }
+            }
+        } else if (strcasecmp(argv[1+argofs], "pretty") == 0) {
+            pretty = 1;
+        }
+    }
 
-	if (conference == NULL) {
-		for (hi = switch_hash_first(globals.conference_pool, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
-			switch_hash_this(hi, NULL, NULL, &val);
-			conference = (conference_obj_t *) val;
+    if (conference == NULL) {
+        for (hi = switch_hash_first(globals.conference_pool, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
+            switch_hash_this(hi, NULL, NULL, &val);
+            conference = (conference_obj_t *) val;
 
-			stream->write_function(stream, "Conference %s (%u member%s)\n",
-											conference->name,
-											conference->count,
-											conference->count == 1 ? "" : "");
-			if (pretty) {
-				conference_list_pretty(conference, stream);
-			} else {
-				conference_list(conference, stream, d);
-			}
-		}
-	} else {
-		if (pretty) {
-			conference_list_pretty(conference, stream);
-		} else {
-			conference_list(conference, stream, d);
-		}
-	}
+            stream->write_function(stream, "Conference %s (%u member%s)\n", 
+                                   conference->name, 
+                                   conference->count, 
+                                   conference->count == 1 ? "" : "s");
+            if (pretty) {
+                conference_list_pretty(conference, stream);
+            } else {
+                conference_list(conference, stream, d);
+            }
+        }
+    } else {
+        if (pretty) {
+            conference_list_pretty(conference, stream);
+        } else {
+            conference_list(conference, stream, d);
+        }
+    }
 
-	syntax_err = 0;
+    ret_status = SWITCH_STATUS_SUCCESS;
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_play(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_play(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	int syntax_err = 1;
+    int ret_status = SWITCH_STATUS_GENERR;
+    switch_event_t *event;
 
-	if (conference != NULL && stream != NULL) {
-		switch_event_t *event;
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-		if (argc == 3) {
-			if (conference_play_file(conference, argv[2], 0, NULL) == SWITCH_STATUS_SUCCESS) {
-				stream->write_function(stream, "(play) Playing file %s\n", argv[2]);
-				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file");
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
-					switch_event_fire(&event);
-				}
-			} else {
-				stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
-			}
-			syntax_err = 0;
-		} else if (argc == 4) {
-			uint32_t id = atoi(argv[3]);
-			conference_member_t *member;
+    
+    if (argc == 3) {
+        if (conference_play_file(conference, argv[2], 0, NULL) == SWITCH_STATUS_SUCCESS) {
+            stream->write_function(stream, "(play) Playing file %s\n", argv[2]);
+            if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file");
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
+                switch_event_fire(&event);
+            }
+        } else {
+            stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
+        }
+        ret_status = SWITCH_STATUS_SUCCESS;
+    } else if (argc == 4) {
+        uint32_t id = atoi(argv[3]);
+        conference_member_t *member;
 
-			if ((member = conference_member_get(conference, id))) {
-				if (conference_member_play_file(member, argv[2], 0) == SWITCH_STATUS_SUCCESS) {
-					stream->write_function(stream, "(play) Playing file %s to member %u\n", argv[2], id);
-					if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member");
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
-						switch_event_fire(&event);
-					}
-				} else {
-					stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
-				}
-				syntax_err = 0;
-			} else {
-				stream->write_function(stream, "Member: %u not found.\n", id);
-			}
-		}
-	}
+        if ((member = conference_member_get(conference, id))) {
+            if (conference_member_play_file(member, argv[2], 0) == SWITCH_STATUS_SUCCESS) {
+                stream->write_function(stream, "(play) Playing file %s to member %u\n", argv[2], id);
+                if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member");
+                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
+                    switch_event_fire(&event);
+                }
+            } else {
+                stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
+            }
+            ret_status = SWITCH_STATUS_SUCCESS;
+        } else {
+            stream->write_function(stream, "Member: %u not found.\n", id);
+        }
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_say(conference_obj_t *conference, switch_stream_handle_t *stream, char *text)
+static switch_status_t conf_api_sub_say(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
 {
-	int syntax_err = 1;
+    int ret_status = SWITCH_STATUS_GENERR;
 
-	if (conference != NULL && stream != NULL) {
-		if (!switch_strlen_zero(text)) {
-			if (conference_say(conference, text, 0) == SWITCH_STATUS_SUCCESS) {
-				switch_event_t *event;
+    if (switch_strlen_zero(text)) {
+        stream->write_function(stream, "(say) Error! No text.");
+        return ret_status;
+    }
 
-				stream->write_function(stream, "(say) OK\n");
-				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text");
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", text);
-					switch_event_fire(&event);
-				}
-			} else {
-				stream->write_function(stream, "(say) Error!");
-			}
-			syntax_err = 0;
-		} else {
-			stream->write_function(stream, "(say) Error! No text.");
-		}
-	}
+    if (conference_say(conference, text, 0) == SWITCH_STATUS_SUCCESS) {
+        switch_event_t *event;
 
-	return syntax_err;
+        stream->write_function(stream, "(say) OK\n");
+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text");
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
+            switch_event_fire(&event);
+        }
+        ret_status = SWITCH_STATUS_SUCCESS;
+    } else {
+        stream->write_function(stream, "(say) Error!");
+    }
+
+    return ret_status;
 }
 
-static int conf_api_sub_saymember(conference_obj_t *conference, switch_stream_handle_t *stream, char *text)
+static switch_status_t conf_api_sub_saymember(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
 {
-	int syntax_err = 1;
+    int ret_status = SWITCH_STATUS_GENERR;
+    char *expanded = NULL;
+    char *start_text = NULL;
+    char *workspace = NULL;
+    uint32_t id = 0;
+    conference_member_t *member;
 
-	if (conference != NULL) {
-		if (!switch_strlen_zero(text)) {
-			char *name = strdup(text);
-			uint32_t id = 0;
-			conference_member_t *member;
+    if (switch_strlen_zero(text)) {
+        stream->write_function(stream, "(saymember) No Text!\n");
+        goto done;
+    }
 
-			if (!switch_strlen_zero(name)) {
-				text = strchr(name, ' ');
-				*name = '\0';
-				id = atoi(name);
-				free(name);
-			}
+    if (!(workspace = strdup(text))) {
+        stream->write_function(stream, "(saymember) Memory Error!\n");
+        goto done;
+    }
 
-			if (id != 0 && (member = conference_member_get(conference, id))) {
-				if (text && conference_member_say(member, text, 0) == SWITCH_STATUS_SUCCESS) {
-					switch_event_t *event;
+    if ((start_text = strchr(workspace, ' '))) {
+        *start_text++ = '\0';
+        text = start_text;
+    }
 
-					stream->write_function(stream, "(saymember) OK\n");
-					if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text-member");
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
-						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", text);
-						switch_event_fire(&event);
-					}
-				} else {
-					stream->write_function(stream, "(saymember) Error!");
-				}
-				syntax_err = 0;
-			} else {
-				stream->write_function(stream, "(saymember) Unknown Member %u!", id);
-			}
-		}
-	}
+    id = atoi(workspace);
 
-	return syntax_err;
+    if (!id || switch_strlen_zero(text)) {
+        stream->write_function(stream, "(saymember) No Text!\n");
+        goto done;
+    }
+
+    if (!(member = conference_member_get(conference, id))) {
+        stream->write_function(stream, "(saymember) Unknown Member %u!", id);
+        goto done;
+    }
+
+    if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(member->session), (char *)text)) != text) {
+        text = expanded;
+    } else {
+        expanded = NULL;
+    }
+
+    if (text && conference_member_say(member, (char *)text, 0) == SWITCH_STATUS_SUCCESS) {
+        switch_event_t *event;
+
+        stream->write_function(stream, "(saymember) OK\n");
+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text-member");
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
+            switch_event_fire(&event);
+        }
+        ret_status = SWITCH_STATUS_SUCCESS;
+    } else {
+        stream->write_function(stream, "(saymember) Error!");
+    }
+
+ done:    
+    switch_safe_free(workspace);
+    switch_safe_free(expanded);
+    return ret_status;
 }
 
-static int conf_api_sub_stop(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_stop(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	int syntax_err = 1;
+    int ret_status = SWITCH_STATUS_GENERR;
+    uint8_t current = 0, all = 0;
 
-	if (conference != NULL) {
-		uint8_t current = 0, all = 0;
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-		if (argc > 2) {
-			current = strcasecmp(argv[2], "current") ? 0 : 1;
-			all = strcasecmp(argv[2], "all") ? 0 : 1;
-		}
+    if (argc > 2) {
+        current = strcasecmp(argv[2], "current") ? 0 : 1;
+        all = strcasecmp(argv[2], "all") ? 0 : 1;
+    }
 
-		if (current || all) {
-			if (argc == 4) {
-				uint32_t id = atoi(argv[3]);
-				conference_member_t *member;
+    if (current || all) {
+        if (argc == 4) {
+            uint32_t id = atoi(argv[3]);
+            conference_member_t *member;
 
-				if ((member = conference_member_get(conference, id))) {
-					uint32_t stopped = conference_member_stop_file(member, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
-					stream->write_function(stream, "Stopped %u files.\n", stopped);
-				} else {
-					stream->write_function(stream, "Member: %u not found.\n", id);
-				}
-				syntax_err = 0;
-			} else {
-				uint32_t stopped = conference_stop_file(conference, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
-				stream->write_function(stream, "Stopped %u files.\n", stopped);
-				syntax_err = 0;
-			}
-		}
-	}
+            if ((member = conference_member_get(conference, id))) {
+                uint32_t stopped = conference_member_stop_file(member, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
+                stream->write_function(stream, "Stopped %u files.\n", stopped);
+            } else {
+                stream->write_function(stream, "Member: %u not found.\n", id);
+            }
+            ret_status = SWITCH_STATUS_SUCCESS;
+        } else {
+            uint32_t stopped = conference_stop_file(conference, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
+            stream->write_function(stream, "Stopped %u files.\n", stopped);
+            ret_status = SWITCH_STATUS_SUCCESS;
+        }
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_relate(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_relate(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	int syntax_err = 1;
+    int ret_status = SWITCH_STATUS_GENERR;
 
-	if (conference != NULL && stream != NULL) {
-		if (argc > 4) {
-			uint8_t nospeak = 0, nohear = 0, clear = 0;
-			nospeak = strstr(argv[4], "nospeak") ? 1 : 0;
-			nohear = strstr(argv[4], "nohear") ? 1 : 0;
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-			if (!strcasecmp(argv[4], "clear")) {
-				clear = 1;
-			}
+    if (argc > 4) {
+        uint8_t nospeak = 0, nohear = 0, clear = 0;
+        nospeak = strstr(argv[4], "nospeak") ? 1 : 0;
+        nohear = strstr(argv[4], "nohear") ? 1 : 0;
 
-			if (!(clear || nospeak || nohear)) { 
-				syntax_err = 1;
-				goto done;
-			}
-			syntax_err = 0;
+        if (!strcasecmp(argv[4], "clear")) {
+            clear = 1;
+        }
 
-			if (clear) {
-				conference_member_t *member = NULL;
-				uint32_t id = atoi(argv[2]);
-				uint32_t oid = atoi(argv[3]);
+        if (!(clear || nospeak || nohear)) { 
+            ret_status = SWITCH_STATUS_GENERR;
+            goto done;
+        }
+        ret_status = SWITCH_STATUS_SUCCESS;
 
-				switch_mutex_lock(conference->mutex);
-				switch_mutex_lock(conference->member_mutex);
-				if ((member = conference_member_get(conference, id))) {
-					member_del_relationship(member, oid);
-					stream->write_function(stream, "relationship %u->%u cleared.", id, oid);
-				} else {
-					stream->write_function(stream, "relationship %u->%u not found", id, oid);
-				}
-				switch_mutex_unlock(conference->member_mutex);
-				switch_mutex_unlock(conference->mutex);
-			} else if (nospeak || nohear) {
-				conference_member_t *member = NULL, *other_member = NULL;
-				uint32_t id = atoi(argv[2]);
-				uint32_t oid = atoi(argv[3]);
+        if (clear) {
+            conference_member_t *member = NULL;
+            uint32_t id = atoi(argv[2]);
+            uint32_t oid = atoi(argv[3]);
 
-				switch_mutex_lock(conference->mutex);
-				switch_mutex_lock(conference->member_mutex);
-				if ((member = conference_member_get(conference, id)) && (other_member = conference_member_get(conference, oid))) {
-					conference_relationship_t *rel = NULL;
-					if ((rel = member_get_relationship(member, other_member))) {
-						rel->flags = 0;
-					} else {
-						rel = member_add_relationship(member, oid);
-					}
+            switch_mutex_lock(conference->mutex);
+            switch_mutex_lock(conference->member_mutex);
+            if ((member = conference_member_get(conference, id))) {
+                member_del_relationship(member, oid);
+                stream->write_function(stream, "relationship %u->%u cleared.", id, oid);
+            } else {
+                stream->write_function(stream, "relationship %u->%u not found", id, oid);
+            }
+            switch_mutex_unlock(conference->member_mutex);
+            switch_mutex_unlock(conference->mutex);
+        } else if (nospeak || nohear) {
+            conference_member_t *member = NULL, *other_member = NULL;
+            uint32_t id = atoi(argv[2]);
+            uint32_t oid = atoi(argv[3]);
 
-					if (rel) {
-						switch_set_flag(rel, RFLAG_CAN_SPEAK | RFLAG_CAN_HEAR);
-						if (nospeak) {
-							switch_clear_flag(rel, RFLAG_CAN_SPEAK);
-						}
-						if (nohear) {
-							switch_clear_flag(rel, RFLAG_CAN_HEAR);
-						}
-						stream->write_function(stream, "ok %u->%u set\n", id, oid);
-					} else {
-						stream->write_function(stream, "error!\n");
-					}
-				} else {
-					stream->write_function(stream, "relationship %u->%u not found", id, oid);
-				}
-				switch_mutex_unlock(conference->member_mutex);
-				switch_mutex_unlock(conference->mutex);
-			}
-		}
-	}
+            switch_mutex_lock(conference->mutex);
+            switch_mutex_lock(conference->member_mutex);
+            if ((member = conference_member_get(conference, id)) && (other_member = conference_member_get(conference, oid))) {
+                conference_relationship_t *rel = NULL;
+                if ((rel = member_get_relationship(member, other_member))) {
+                    rel->flags = 0;
+                } else {
+                    rel = member_add_relationship(member, oid);
+                }
 
-done:
-	return syntax_err;
+                if (rel) {
+                    switch_set_flag(rel, RFLAG_CAN_SPEAK | RFLAG_CAN_HEAR);
+                    if (nospeak) {
+                        switch_clear_flag(rel, RFLAG_CAN_SPEAK);
+                    }
+                    if (nohear) {
+                        switch_clear_flag(rel, RFLAG_CAN_HEAR);
+                    }
+                    stream->write_function(stream, "ok %u->%u set\n", id, oid);
+                } else {
+                    stream->write_function(stream, "error!\n");
+                }
+            } else {
+                stream->write_function(stream, "relationship %u->%u not found", id, oid);
+            }
+            switch_mutex_unlock(conference->member_mutex);
+            switch_mutex_unlock(conference->mutex);
+        }
+    }
+
+ done:
+    return ret_status;
 }
 
-static int conf_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	if (conference != NULL && stream != NULL) {
-		switch_event_t *event;
+    switch_event_t *event;
 
-		switch_set_flag_locked(conference, CFLAG_LOCKED);
-		stream->write_function(stream, "OK %s locked\n", argv[0]);
-		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "lock");
-			switch_event_fire(&event);
-		}
-	}
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-	return 0;
+    switch_set_flag_locked(conference, CFLAG_LOCKED);
+    stream->write_function(stream, "OK %s locked\n", argv[0]);
+    if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "lock");
+        switch_event_fire(&event);
+    }
+
+    return 0;
 }
 
-static int conf_api_sub_unlock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_unlock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	if (conference != NULL && stream != NULL) {
-		switch_event_t *event;
+    switch_event_t *event;
 
-		switch_clear_flag_locked(conference, CFLAG_LOCKED);
-		stream->write_function(stream, "OK %s unlocked\n", argv[0]);
-		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
-			switch_event_fire(&event);
-		}
-	}
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-	return 0;
+    switch_clear_flag_locked(conference, CFLAG_LOCKED);
+    stream->write_function(stream, "OK %s unlocked\n", argv[0]);
+    if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
+        switch_event_fire(&event);
+    }
+	
+
+    return 0;
 }
 
-static int conf_api_sub_dial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (conference != NULL && stream != NULL) {
-		if (argc > 2) {
-			conference_outcall(conference, NULL, argv[2], 60, NULL, argv[4], argv[3]);
-			stream->write_function(stream, "OK\n");
-		} else {
-			syntax_err = 1;
-		}
-	}
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-	return syntax_err;
+    if (argc > 2) {
+        conference_outcall(conference, NULL, argv[2], 60, NULL, argv[4], argv[3]);
+        stream->write_function(stream, "OK\n");
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
+
+    return ret_status;
 }
 
-static int conf_api_sub_transfer(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (conference != NULL && stream != NULL) {
-		if (argc > 3 && !switch_strlen_zero(argv[2])) {
-			int x;
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-			for (x=3; x<argc; x++) {
-				conference_member_t *member = NULL;
-				uint32_t id = atoi(argv[x]);
-				conference_obj_t *new_conference = NULL;
-				switch_channel_t *channel;
-				switch_event_t *event;
-				char *profile_name;
-				switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
+    if (argc > 3 && !switch_strlen_zero(argv[2])) {
+        int x;
 
-				if (!(member = conference_member_get(conference, id))) {								
-					stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
-					continue;
-				}
+        for (x = 3; x<argc; x++) {
+            conference_member_t *member = NULL;
+            uint32_t id = atoi(argv[x]);
+            conference_obj_t *new_conference = NULL;
+            switch_channel_t *channel;
+            switch_event_t *event;
+            char *profile_name;
+            switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
 
-				channel = switch_core_session_get_channel(member->session);
+            if (!(member = conference_member_get(conference, id))) {								
+                stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
+                continue;
+            }
 
-				/* build a new conference if it doesn't exist */
-				if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[2]))) {
-					switch_memory_pool_t *pool = NULL;
-					char *conf_name;
-					conf_xml_cfg_t xml_cfg;
+            channel = switch_core_session_get_channel(member->session);
 
-					/* Setup a memory pool to use. */
-					if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-						goto done;
-					}
+            /* build a new conference if it doesn't exist */
+            if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[2]))) {
+                switch_memory_pool_t *pool = NULL;
+                char *conf_name;
+                conf_xml_cfg_t xml_cfg = {0};
 
-					conf_name = switch_core_strdup(pool, argv[2]);
+                /* Setup a memory pool to use. */
+                if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+                    goto done;
+                }
 
-					if ((profile_name = strchr(conf_name, '@'))) {
-						*profile_name++ = '\0';
+                conf_name = switch_core_strdup(pool, argv[2]);
 
-						/* Open the config from the xml registry  */
-						if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
-							goto done;
-						}
+                if ((profile_name = strchr(conf_name, '@'))) {
+                    *profile_name++ = '\0';
 
-						if ((profiles = switch_xml_child(cfg, "profiles"))) {
-							xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
-						}
-						xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
+                    /* Open the config from the xml registry  */
+                    if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+                        goto done;
+                    }
+
+                    if ((profiles = switch_xml_child(cfg, "profiles"))) {
+                        xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+                    }
+                    xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
 #ifdef OPTION_IVR_MENU_SUPPORT
-						xml_cfg.menus = switch_xml_child(cfg, "menus");
+                    xml_cfg.menus = switch_xml_child(cfg, "menus");
 #endif
-					} 
+                } 
 
-					/* Release the config registry handle */
-					if (cxml) {
-						switch_xml_free(cxml);
-						cxml = NULL;
-					}
+                /* Release the config registry handle */
+                if (cxml) {
+                    switch_xml_free(cxml);
+                    cxml = NULL;
+                }
 
-					/* Create the conference object. */
-					new_conference = conference_new(conf_name, xml_cfg, pool);
+                /* Create the conference object. */
+                new_conference = conference_new(conf_name, xml_cfg, pool);
 
-					if (!new_conference) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-						if (pool != NULL) {
-							switch_core_destroy_memory_pool(&pool);
-						}
-						goto done;
-					}
+                if (!new_conference) {
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+                    if (pool != NULL) {
+                        switch_core_destroy_memory_pool(&pool);
+                    }
+                    goto done;
+                }
 
-					/* Set the minimum number of members (once you go above it you cannot go below it) */
-				new_conference->min = 1;
+                /* Set the minimum number of members (once you go above it you cannot go below it) */
+                new_conference->min = 1;
 
-				/* Indicate the conference is dynamic */
-				switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
+                /* Indicate the conference is dynamic */
+                switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
 
-				/* Start the conference thread for this conference */
-				launch_conference_thread(new_conference);
-				}
+                /* Start the conference thread for this conference */
+                launch_conference_thread(new_conference);
+            }
 
-				/* move the member from the old conference to the new one */
-				conference_del_member(member->last_conference, member);
-				conference_add_member(new_conference, member);
+            /* move the member from the old conference to the new one */
+            conference_del_member(member->last_conference, member);
+            conference_add_member(new_conference, member);
 
-				stream->write_function(stream, "OK Members sent to conference %s.\n", argv[2]);
+            stream->write_function(stream, "OK Members sent to conference %s.\n", argv[2]);
 
-				/* tell them what happened */
-				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-					switch_channel_event_set_data(channel, event);
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[3]);
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
-					switch_event_fire(&event);
-				}
-			}
-		} else {
-			syntax_err = 1;
-		}
-	}
-done:
-	return syntax_err;
+            /* tell them what happened */
+            if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+                switch_channel_event_set_data(channel, event);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[3]);
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
+                switch_event_fire(&event);
+            }
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
+
+ done:
+    return ret_status;
 }
 
-static int conf_api_sub_record(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-	if (conference != NULL && stream != NULL) {
-		if (argc > 2) {
-			launch_conference_record_thread(conference, argv[2]);
-		} else {
-			syntax_err = 1;
-		}
-	}
+    if (argc > 2) {
+        launch_conference_record_thread(conference, argv[2]);
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
 
-	return syntax_err;
+    return ret_status;
 }
 
-static int conf_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
-	int syntax_err = 0;
+    switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 
-	if (conference != NULL && stream != NULL) {
-		if (argc > 2) {
-			int all = (strcasecmp(argv[2], "all") == 0 );
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-			if(!conference_record_stop(conference, all ? NULL : argv[2]) && !all) {
-				stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
-			}
-		} else {
-			syntax_err = 1;
-		}
-	}
+    if (argc > 2) {
+        int all = (strcasecmp(argv[2], "all") == 0 );
 
-	return syntax_err;
+        if (!conference_record_stop(conference, all ? NULL : argv[2]) && !all) {
+            stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
+        }
+    } else {
+        ret_status = SWITCH_STATUS_GENERR;
+    }
+	
+    return ret_status;
 }
 
-enum {
-	CONF_API_SUB_ARGS_SPLIT,
-	CONF_API_SUB_MEMBER_TARGET,
-	CONF_API_SUB_ARGS_AS_ONE,
-};
-
 /* API Interface Function sub-commands */
 static api_command_t conf_api_sub_commands[] = {
-	{"list",	&conf_api_sub_list,		CONF_API_SUB_ARGS_SPLIT,	"<confname> list [delim <string>]"},
-	{"energy",	&conf_api_sub_energy,		CONF_API_SUB_MEMBER_TARGET,	"<confname> energy <member_id|all|last> [<newval>]"},
-	{"volume in",	&conf_api_sub_volume_in,	CONF_API_SUB_MEMBER_TARGET,	"<confname> volume_in <member_id|all|last> [<newval>]"},
-	{"volume out",	&conf_api_sub_volume_out,	CONF_API_SUB_MEMBER_TARGET,	"<confname> volume_out <member_id|all|last> [<newval>]"},
-	{"play",	&conf_api_sub_play,		CONF_API_SUB_ARGS_SPLIT,	"<confname> play <file_path> [<member_id>]"},
-	{"say",		&conf_api_sub_say,		CONF_API_SUB_ARGS_AS_ONE,	"<confname> say <text>"},
-	{"saymember",	&conf_api_sub_saymember,	CONF_API_SUB_ARGS_AS_ONE,	"<confname> saymember <member_id> <text>"},
-	{"stop",	&conf_api_sub_stop,		CONF_API_SUB_MEMBER_TARGET,	"<confname> stop <[current|all|last]> [<member_id>]"},
-	{"kick",	&conf_api_sub_kick,		CONF_API_SUB_MEMBER_TARGET,	"<confname> kick <[member_id|all|last]>"},
-	{"mute",	&conf_api_sub_mute,		CONF_API_SUB_MEMBER_TARGET,	"<confname> mute <[member_id|all]|last>"},
-	{"unmute",	&conf_api_sub_unmute,		CONF_API_SUB_MEMBER_TARGET,	"<confname> unmute <[member_id|all]|last>"},
-	{"deaf",	&conf_api_sub_deaf,		CONF_API_SUB_MEMBER_TARGET,	"<confname> deaf <[member_id|all]|last>"},
-	{"undeaf",	&conf_api_sub_undeaf,		CONF_API_SUB_MEMBER_TARGET,	"<confname> undeaf <[member_id|all]|last>"},
-	{"relate",	&conf_api_sub_relate,		CONF_API_SUB_ARGS_SPLIT,	"<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
-	{"lock",	&conf_api_sub_lock,		CONF_API_SUB_ARGS_SPLIT,	"<confname> lock"},
-	{"unlock",	&conf_api_sub_unlock,		CONF_API_SUB_ARGS_SPLIT,	"<confname> unlock"},
-	{"dial",	&conf_api_sub_dial,		CONF_API_SUB_ARGS_SPLIT,	"<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
-	{"transfer",	&conf_api_sub_transfer,		CONF_API_SUB_ARGS_SPLIT,	"<confname> transfer <conference_name> <member id> [...<member id>]"},
-	{"record",	&conf_api_sub_record,		CONF_API_SUB_ARGS_SPLIT,	"<confname> record <filename>"},
-	{"norecord",	&conf_api_sub_norecord,		CONF_API_SUB_ARGS_SPLIT,	"<confname> norecord <[filename|all]>"},
+	{"list", &conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"}, 
+	{"energy", &conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"}, 
+	{"volume_in", &conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_in <member_id|all|last> [<newval>]"}, 
+	{"volume_out", &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"}, 
+	{"play", &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"}, 
+	{"say", &conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"}, 
+	{"saymember", &conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"}, 
+	{"stop", &conf_api_sub_stop, CONF_API_SUB_MEMBER_TARGET, "<confname> stop <[current|all|last]> [<member_id>]"}, 
+	{"kick", &conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"}, 
+	{"mute", &conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"}, 
+	{"unmute", &conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"}, 
+	{"deaf", &conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"}, 
+	{"undeaf", &conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"}, 
+	{"relate", &conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"}, 
+	{"lock", &conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"}, 
+	{"unlock", &conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"}, 
+	{"dial", &conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"}, 
+	{"transfer", &conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name> <member id> [...<member id>]"}, 
+	{"record", &conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"}, 
+	{"norecord", &conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"}, 
 };
 
 #define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0]))
 
-switch_status_t conf_api_dispatch(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv, char *cmdline, int argn)
-{	switch_status_t status = SWITCH_STATUS_FALSE;
+switch_status_t conf_api_dispatch(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv, const char *cmdline, int argn)
+{	
+    switch_status_t status = SWITCH_STATUS_FALSE;
+    uint32_t i, found = 0;
+    assert(conference != NULL);
+    assert(stream != NULL);
 
-	if (conference != NULL) {
-		int i,found=0;
+    /* loop through the command table to find a match */
+    for (i = 0; i<CONFFUNCAPISIZE && !found; i++) {
+        if (strcasecmp(argv[argn], conf_api_sub_commands[i].pname) == 0) {
+            found = 1;
+            switch(conf_api_sub_commands[i].fntype) {
 
-		/* loop through the command table to find a match */
-		for (i=0; i<CONFFUNCAPISIZE && !found; i++) {
-			if (strcasecmp(argv[argn],conf_api_sub_commands[i].pname) == 0) {
-				found = 1;
-				switch(conf_api_sub_commands[i].fntype) {
+                /* commands that we've broken the command line into arguments for */
+            case CONF_API_SUB_ARGS_SPLIT:
+                {	conf_api_args_cmd_t pfn = (conf_api_args_cmd_t)conf_api_sub_commands[i].pfnapicmd;
 
-					/* commands that we've broken the command line into arguments for */
-					case CONF_API_SUB_ARGS_SPLIT:
-						{	conf_api_args_cmd_t pfn = (conf_api_args_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+                    if (pfn(conference, stream, argc, argv) != SWITCH_STATUS_SUCCESS) {
+                        /* command returned error, so show syntax usage */
+                        stream->write_function(stream, conf_api_sub_commands[i].psyntax);
+                    }
+                }
+                break;
 
-							if (pfn(conference, stream, argc, argv) != 0) {
-								/* command returned error, so show syntax usage */
-								stream->write_function(stream,conf_api_sub_commands[i].psyntax);
-								}
-						}
-						break;
+                /* member specific command that can be itteratted */
+            case CONF_API_SUB_MEMBER_TARGET:
+                {
+                    uint32_t id = atoi(argv[argn+1]);
+                    int all = ( id == 0 && strcasecmp(argv[argn+1], "all") == 0 );
+                    int last = ( id == 0 && strcasecmp(argv[argn+1], "last") == 0 );
 
-					/* member specific command that can be itteratted */
-					case CONF_API_SUB_MEMBER_TARGET:
-						{
-							uint32_t id = atoi(argv[argn+1]);
-							int all = ( id == 0 && strcasecmp(argv[argn+1], "all") == 0 );
-							int last = ( id == 0 && strcasecmp(argv[argn+1], "last") == 0 );
+                    if (all) {
+                        conference_member_itterator(conference, stream, conf_api_sub_commands[i].pfnapicmd, argv[argn+2]);
+                    } else if (last) {
+                        conference_member_t *member = NULL;
+                        conference_member_t *last_member = NULL;
 
-							if(all) {
-								 conference_member_itterator(conference, stream, conf_api_sub_commands[i].pfnapicmd, argv[argn+2]);
-							} else if (last) {
-								conference_member_t *member = NULL;
-								conference_member_t *last_member = NULL;
+                        switch_mutex_lock(conference->member_mutex);
 
-								switch_mutex_lock(conference->member_mutex);
+                        /* find last (oldest) member */
+                        member = conference->members;
+                        while (member != NULL) {
+                            if (last_member == NULL || member->id > last_member->id) {
+                                last_member = member;
+                            }
+                            member = member->next;
+                        }
 
-								/* find last (oldest) member */
-								member = conference->members;
-								while (member != NULL) {
-									if (last_member == NULL || member->id > last_member->id) {
-										last_member = member;
-									}
-									member = member->next;
-								}
+                        /* exec functio on last (oldest) member */
+                        if (last_member != NULL) {
+                            conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+                            pfn(last_member, stream, argv[argn+2]);
+                        }
 
-								/* exec functio on last (oldest) member */
-								if (last_member != NULL) {
-									conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
-									pfn(last_member, stream, argv[argn+2]);
-								}
+                        switch_mutex_unlock(conference->member_mutex);
+                    } else {
+                        conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+                        conference_member_t *member = conference_member_get(conference, id);
 
-								switch_mutex_unlock(conference->member_mutex);
-							} else {
-								conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
-								conference_member_t *member = conference_member_get(conference, id);
+                        if (member != NULL) {
+                            pfn(conference_member_get(conference, id), stream, argv[argn+2]);
+                        } else {
+                            if (id == 0) {
+                                stream->write_function(stream, conf_api_sub_commands[i].psyntax);
+                            } else {
+                                stream->write_function(stream, "Non-Existant ID %u\n", id);
+                            }
+                        }
+                    }
+                }
+                break;
 
-								if (member != NULL) {
-									pfn(conference_member_get(conference, id), stream, argv[argn+2]);
-								} else {
-									if (id == 0) {
-										stream->write_function(stream,conf_api_sub_commands[i].psyntax);
-									} else {
-										stream->write_function(stream, "Non-Existant ID %u\n", id);
-									}
-								}
-							}
-						}
-						break;
+                /* commands that deals with all text after command */
+            case CONF_API_SUB_ARGS_AS_ONE:
+                {	
+                    conf_api_text_cmd_t pfn = (conf_api_text_cmd_t) conf_api_sub_commands[i].pfnapicmd;
+                    char *start_text;
+                    const char *modified_cmdline = cmdline;
+                    const char *cmd = conf_api_sub_commands[i].pname;
 
-					/* commands that deals with all text after command */
-					case CONF_API_SUB_ARGS_AS_ONE:
-						{	conf_api_text_cmd_t pfn = (conf_api_text_cmd_t)conf_api_sub_commands[i].pfnapicmd;
-							char *pstr = cmdline+strlen(conf_api_sub_commands[i].pname)+1;
+                    if ((start_text = strstr(modified_cmdline, cmd))) {
+                        modified_cmdline = start_text + strlen(cmd);
+                        while(modified_cmdline && *modified_cmdline && (*modified_cmdline  == ' ' || *modified_cmdline == '\t')) {
+                            modified_cmdline++;
+                        }
+                    }
+                            
+                    /* call the command handler */
+                    if (pfn(conference, stream, modified_cmdline) != SWITCH_STATUS_SUCCESS) {
+                        /* command returned error, so show syntax usage */
+                        stream->write_function(stream, conf_api_sub_commands[i].psyntax);
+                    }
+                }
+                break;
+            }
+        }
+    }
 
-							/* advance past all leading white space after command */
-							while(*pstr == ' ' || *pstr == '\t') {
-								pstr++;
-							}
+    if (!found) {
+        stream->write_function(stream, "Confernece command '%s' not found.\n", argv[argn]);
+    } else {
+        status = SWITCH_STATUS_SUCCESS;
+    }
 
-							/* call the command handler */
-							if (pfn(conference, stream, pstr) != 0) {
-								/* command returned error, so show syntax usage */
-								stream->write_function(stream,conf_api_sub_commands[i].psyntax);
-								}
-						}
-						break;
-				}
-			}
-		}
-
-		if(!found) {
-			stream->write_function(stream, "Confernece command '%s' not found.\n", argv[argn]);
-		} else {
-			status = SWITCH_STATUS_SUCCESS;
-		}
-	}
-
-	return status;
+    return status;
 }
 
 /* API Interface Function */
 static switch_status_t conf_api_main(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
-	char *lbuf = NULL;
-	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	char *http = NULL;
+    char *lbuf = NULL;
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
+    char *http = NULL;
+    int argc;
+    char *argv[25] = {0};
 
-	if (session) {
-		return SWITCH_STATUS_FALSE;
-	}
+    if (!buf) {
+        buf = "help";
+    }
 
-	if (stream->event) {
-		http = switch_event_get_header(stream->event, "http-host");
-	}
+    if (session) {
+        return SWITCH_STATUS_FALSE;
+    }
 
-	if (http) {
-		/* Output must be to a web browser */
-		stream->write_function(stream, "<pre>\n");
-	}
+    if (stream->event) {
+        http = switch_event_get_header(stream->event, "http-host");
+    }
 
-	if (buf != NULL && (lbuf = strdup(buf))) {
-		int argc;
-		char *argv[25];
+    if (http) {
+        /* Output must be to a web browser */
+        stream->write_function(stream, "<pre>\n");
+    }
 
-		memset(argv,0,sizeof(argv));
-		argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+    if (!(lbuf = strdup(buf))) {
+        return status;
+    }
 
-		/* try to find a command to execute */
-		if (argc) {
-			conference_obj_t *conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[0]);
+    argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 
-			if(conference != NULL) {
-				if (argc >= 2) {
-					status = conf_api_dispatch(conference, stream, argc, argv, lbuf, 1);
-				} else {
-					stream->write_function(stream,"Conference command, not specified.\nTry 'help'\n");
-				}
-			} else {
-				/* special case the list command, because it doesn't require a conference argument */
-				if (strcasecmp(argv[0],"list") == 0) {
-					conf_api_sub_list(NULL, stream, argc, argv);
-				} else if (strcasecmp(argv[0],"help") == 0 || strcasecmp(argv[0],"commands") == 0) {
-					stream->write_function(stream, "%s\n", conf_api_interface.syntax);
-				} else {
-					stream->write_function(stream, "Conference %s not found\n", argv[0]);
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s not found\n", argv[0]);
-				}
-			}
+    /* try to find a command to execute */
+    if (argc) {
+        conference_obj_t *conference = NULL;
 
-		} else {
-			stream->write_function(stream, "No parameters specified.\nTry 'help conference'\n");
-		}
-	}
+        if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[0]))) {
+            if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
+            }
 
-	switch_safe_free(lbuf);
+            if (argc >= 2) {
+                conf_api_dispatch(conference, stream, argc, argv, (const char *)buf, 1);
+            } else {
+                stream->write_function(stream, "Conference command, not specified.\nTry 'help'\n");
+            }
 
-	return status;
+            switch_thread_rwlock_unlock(conference->rwlock);
 
+        } else {
+            /* special case the list command, because it doesn't require a conference argument */
+            if (strcasecmp(argv[0], "list") == 0) {
+                conf_api_sub_list(NULL, stream, argc, argv);
+            } else if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
+                stream->write_function(stream, "%s\n", conf_api_interface.syntax);
+            } else {
+                stream->write_function(stream, "Conference %s not found\n", argv[0]);
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s not found\n", argv[0]);
+            }
+        }
+
+    } else {
+        stream->write_function(stream, "No parameters specified.\nTry 'help conference'\n");
+    }
+    
+    switch_safe_free(lbuf);
+
+    return status;
+
 }
 
 /* outbound call bridge progress call state callback handler */
 static switch_status_t audio_bridge_on_ring(switch_core_session_t *session)
 {
-	switch_channel_t *channel = NULL;
+    switch_channel_t *channel = NULL;
 
-	channel = switch_core_session_get_channel(session);
-	assert(channel != NULL);
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RING\n");
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RING\n");
 
-	/* put the channel in a passive state so we can loop audio to it */
-	switch_channel_set_state(channel, CS_TRANSMIT);
-	return SWITCH_STATUS_FALSE;
+    /* put the channel in a passive state so we can loop audio to it */
+    switch_channel_set_state(channel, CS_TRANSMIT);
+    return SWITCH_STATUS_FALSE;
 }
 
 static const switch_state_handler_table_t audio_bridge_peer_state_handlers = {
-	/*.on_init */ NULL,
-	/*.on_ring */ audio_bridge_on_ring,
-	/*.on_execute */ NULL,
-	/*.on_hangup */ NULL,
-	/*.on_loopback */ NULL,
-	/*.on_transmit */ NULL,
-	/*.on_hold */ NULL,
+    /*.on_init */ NULL, 
+    /*.on_ring */ audio_bridge_on_ring, 
+    /*.on_execute */ NULL, 
+    /*.on_hangup */ NULL, 
+    /*.on_loopback */ NULL, 
+    /*.on_transmit */ NULL, 
+    /*.on_hold */ NULL, 
 };
 
 /* generate an outbound call from the conference */
-static switch_status_t conference_outcall(conference_obj_t *conference,
-										  switch_core_session_t *session,
-										  char *bridgeto,
-										  uint32_t timeout,
-										  char *flags,
-										  char *cid_name,
-										  char *cid_num)
+static switch_status_t conference_outcall(conference_obj_t *conference, 
+                                          switch_core_session_t *session, 
+                                          char *bridgeto, 
+                                          uint32_t timeout, 
+                                          char *flags, 
+                                          char *cid_name, 
+                                          char *cid_num)
 {
-	switch_core_session_t *peer_session;
-	switch_channel_t *peer_channel;
-	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	switch_channel_t *caller_channel = NULL;
-	char appdata[512];
-	switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
+    switch_core_session_t *peer_session;
+    switch_channel_t *peer_channel;
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
+    switch_channel_t *caller_channel = NULL;
+    char appdata[512];
+    switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
 
 
-	if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
-		return SWITCH_STATUS_FALSE;
-	}
+    if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
+        return SWITCH_STATUS_FALSE;
+    }
 
-	if (session != NULL) {
-		caller_channel = switch_core_session_get_channel(session);
+    if (session != NULL) {
+        caller_channel = switch_core_session_get_channel(session);
 	
-	}
+    }
 
-	if (switch_strlen_zero(cid_name)) {
-		cid_name = conference->caller_id_name;
-	}
+    if (switch_strlen_zero(cid_name)) {
+        cid_name = conference->caller_id_name;
+    }
 
-	if (switch_strlen_zero(cid_num)) {
-		cid_num = conference->caller_id_number;
-	}
+    if (switch_strlen_zero(cid_num)) {
+        cid_num = conference->caller_id_number;
+    }
 
-	/* establish an outbound call leg */
-	if (switch_ivr_originate(session,
-							 &peer_session,
-							 &cause,
-							 bridgeto,
-							 timeout,
-							 &audio_bridge_peer_state_handlers,
-							 cid_name,
-							 cid_num,
-							 NULL) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
-				  switch_channel_cause2str(cause));
-		if (caller_channel) {
-			switch_channel_hangup(caller_channel, cause);
-		}
-		goto done;
-	} 
+    /* establish an outbound call leg */
+    if (switch_ivr_originate(session, 
+                             &peer_session, 
+                             &cause, 
+                             bridgeto, 
+                             timeout, 
+                             &audio_bridge_peer_state_handlers, 
+                             cid_name, 
+                             cid_num, 
+                             NULL) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n", 
+                          switch_channel_cause2str(cause));
+        if (caller_channel) {
+            switch_channel_hangup(caller_channel, cause);
+        }
+        goto done;
+    } 
 
 
-	peer_channel = switch_core_session_get_channel(peer_session);
-	assert(peer_channel != NULL);
+    peer_channel = switch_core_session_get_channel(peer_session);
+    assert(peer_channel != NULL);
 
-	/* make sure the conference still exists */
-	if (!switch_test_flag(conference, CFLAG_RUNNING)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
-		if (caller_channel) {
-			switch_channel_hangup(caller_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
-		}
-		switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
-		goto done;
-	}
+    /* make sure the conference still exists */
+    if (!switch_test_flag(conference, CFLAG_RUNNING)) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
+        if (caller_channel) {
+            switch_channel_hangup(caller_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
+        }
+        switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
+        goto done;
+    }
 
-	if (caller_channel && switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
-		switch_channel_answer(caller_channel);
-	}
+    if (caller_channel && switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
+        switch_channel_answer(caller_channel);
+    }
 
-	/* if the outbound call leg is ready */
-	if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
-		switch_caller_extension_t *extension = NULL;
+    /* if the outbound call leg is ready */
+    if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
+        switch_caller_extension_t *extension = NULL;
 
-		/* build an extension name object */
-		if ((extension = switch_caller_extension_new(peer_session, conference->name, conference->name)) == 0) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
-			status = SWITCH_STATUS_MEMERR;
-			goto done;
-		}
-		/* add them to the conference */
-		if (flags && strcasecmp(flags, "none")) {
-			snprintf(appdata, sizeof(appdata), "%s +flags{%s}", conference->name, flags);
-			switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, appdata);
-		} else {
-			switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, conference->name);
-		}
+        /* build an extension name object */
+        if ((extension = switch_caller_extension_new(peer_session, conference->name, conference->name)) == 0) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
+            status = SWITCH_STATUS_MEMERR;
+            goto done;
+        }
+        /* add them to the conference */
+        if (flags && strcasecmp(flags, "none")) {
+            snprintf(appdata, sizeof(appdata), "%s +flags{%s}", conference->name, flags);
+            switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, appdata);
+        } else {
+            switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, conference->name);
+        }
 
-		switch_channel_set_caller_extension(peer_channel, extension);
-		switch_channel_set_state(peer_channel, CS_EXECUTE);
+        switch_channel_set_caller_extension(peer_channel, extension);
+        switch_channel_set_state(peer_channel, CS_EXECUTE);
 
-	} else {
-		switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ANSWER);
-		status = SWITCH_STATUS_FALSE;
-		goto done;
-	}
+    } else {
+        switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ANSWER);
+        status = SWITCH_STATUS_FALSE;
+        goto done;
+    }
 
-done:
-	switch_thread_rwlock_unlock(conference->rwlock);
-	return status;
+ done:
+    switch_thread_rwlock_unlock(conference->rwlock);
+    return status;
 }
 
 /* Play a file */
 static switch_status_t conference_local_play_file(switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len)
 {
-	uint32_t x = 0;
-	switch_status_t status = SWITCH_STATUS_SUCCESS;
+    uint32_t x = 0;
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	/* generate some space infront of the file to be played */
-	for (x = 0; x < leadin; x++) {
-		switch_frame_t *read_frame;
-		switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
+    /* generate some space infront of the file to be played */
+    for (x = 0; x < leadin; x++) {
+        switch_frame_t *read_frame;
+        switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
 
-		if (!SWITCH_READ_ACCEPTABLE(status)) {
-			break;
-		}
-	}
+        if (!SWITCH_READ_ACCEPTABLE(status)) {
+            break;
+        }
+    }
 
-	/* if all is well, really play the file */
-	if (status == SWITCH_STATUS_SUCCESS) {
-		status = switch_ivr_play_file(session, NULL, path, NULL, NULL, NULL, 0);
-	}
+    /* if all is well, really play the file */
+    if (status == SWITCH_STATUS_SUCCESS) {
+        status = switch_ivr_play_file(session, NULL, path, NULL, NULL, NULL, 0);
+    }
 
-	return status;
+    return status;
 }
 
 /* Application interface function that is called from the dialplan to join the channel to a conference */
 static void conference_function(switch_core_session_t *session, char *data)
 {
-	switch_codec_t *read_codec = NULL;
-	switch_memory_pool_t *pool = NULL, *freepool = NULL;
-	uint32_t flags = 0;
-	conference_member_t member = {0};
-	conference_obj_t *conference = NULL;
-	switch_channel_t *channel = NULL;
-	char *mydata = switch_core_session_strdup(session, data);
-	char *conf_name = NULL;
-	char *bridge_prefix = "bridge:";
-	char *flags_prefix = "+flags{";
-	char *bridgeto = NULL;
-	char *profile_name = NULL;
-	switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
-	char *flags_str;
-	member_flag_t uflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
-	switch_core_session_message_t msg = {0};
-	uint8_t rl = 0, isbr = 0;
-	char *dpin = NULL;
-	conf_xml_cfg_t xml_cfg;
+    switch_codec_t *read_codec = NULL;
+    switch_memory_pool_t *pool = NULL, *freepool = NULL;
+    uint32_t flags = 0;
+    conference_member_t member = {0};
+    conference_obj_t *conference = NULL;
+    switch_channel_t *channel = NULL;
+    char *mydata = switch_core_session_strdup(session, data);
+    char *conf_name = NULL;
+    char *bridge_prefix = "bridge:";
+    char *flags_prefix = "+flags{";
+    char *bridgeto = NULL;
+    char *profile_name = NULL;
+    switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
+    char *flags_str;
+    member_flag_t uflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
+    switch_core_session_message_t msg = {0};
+    uint8_t rl = 0, isbr = 0;
+    char *dpin = NULL;
+    conf_xml_cfg_t xml_cfg = {0};
 
-	channel = switch_core_session_get_channel(session);
-	assert(channel != NULL);
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
 
-	if (!mydata) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-		return;
-	}
+    if (!mydata) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+        return;
+    }
 
-	/* Setup a memory pool to use. */
-	if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-		return;
-	}
+    /* Setup a memory pool to use. */
+    if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+        return;
+    }
 
-	/* Start the conference muted or deaf ? */
-	if ((flags_str=strstr(mydata, flags_prefix))) {
-		char *p;
+    /* Start the conference muted or deaf ? */
+    if ((flags_str = strstr(mydata, flags_prefix))) {
+        char *p;
 
-		*flags_str = '\0';
-		flags_str += strlen(flags_prefix);
-		if ((p = strchr(flags_str, '}'))) {
-			*p = '\0';
-		}
+        *flags_str = '\0';
+        flags_str += strlen(flags_prefix);
+        if ((p = strchr(flags_str, '}'))) {
+            *p = '\0';
+        }
 
-		if (strstr(flags_str, "mute")) {
-			uflags &= ~MFLAG_CAN_SPEAK;
-		} else if (strstr(flags_str, "deaf")) {
-			uflags &= ~MFLAG_CAN_HEAR;
-		}
-	}
+        if (strstr(flags_str, "mute")) {
+            uflags &= ~MFLAG_CAN_SPEAK;
+        } else if (strstr(flags_str, "deaf")) {
+            uflags &= ~MFLAG_CAN_HEAR;
+        }
+    }
 
-	/* is this a bridging conference ? */
-	if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
-		isbr = 1;
-		mydata += strlen(bridge_prefix);
-		if ((bridgeto = strchr(mydata, ':'))) {
-			*bridgeto++ = '\0';
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Config Error!\n");
-			goto done;
-		}
-	}
+    /* is this a bridging conference ? */
+    if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
+        isbr = 1;
+        mydata += strlen(bridge_prefix);
+        if ((bridgeto = strchr(mydata, ':'))) {
+            *bridgeto++ = '\0';
+        } else {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Config Error!\n");
+            goto done;
+        }
+    }
 
-	conf_name = mydata;
+    conf_name = mydata;
 
-	/* is there a conference pin ? */
-	if ((dpin = strchr(conf_name, '+'))) {
-		*dpin++ = '\0';
-	}
+    /* is there a conference pin ? */
+    if ((dpin = strchr(conf_name, '+'))) {
+        *dpin++ = '\0';
+    }
 
-	/* is there profile specification ? */
-	if ((profile_name = strchr(conf_name, '@'))) {
-		*profile_name++ = '\0';
+    /* is there profile specification ? */
+    if ((profile_name = strchr(conf_name, '@'))) {
+        *profile_name++ = '\0';
 
-		/* Open the config from the xml registry */
-		if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
-			goto done;
-		}
+        /* Open the config from the xml registry */
+        if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+            goto done;
+        }
 
-		if ((profiles = switch_xml_child(cfg, "profiles"))) {
-			xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
-		}
+        if ((profiles = switch_xml_child(cfg, "profiles"))) {
+            xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+        }
 
-		xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
+        xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
 #ifdef OPTION_IVR_MENU_SUPPORT
-		xml_cfg.menus = switch_xml_child(cfg, "menus");
+        xml_cfg.menus = switch_xml_child(cfg, "menus");
 #endif
-	} 
+    } 
 
-	/* if this is a bridging call, and it's not a duplicate, build a */
-	/* conference object, and skip pin handling, and locked checking */
-	if (isbr) {
-		char *uuid = switch_core_session_get_uuid(session);
+    /* if this is a bridging call, and it's not a duplicate, build a */
+    /* conference object, and skip pin handling, and locked checking */
+    if (isbr) {
+        char *uuid = switch_core_session_get_uuid(session);
 
-		if (!strcmp(conf_name, "_uuid_")) {
-			conf_name = uuid;
-		}
+        if (!strcmp(conf_name, "_uuid_")) {
+            conf_name = uuid;
+        }
 
-		if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s already exists!\n", conf_name);
-			goto done;
-		}
+        if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s already exists!\n", conf_name);
+            goto done;
+        }
 
-		/* Create the conference object. */
-		conference = conference_new(conf_name, xml_cfg, pool);
+        /* Create the conference object. */
+        conference = conference_new(conf_name, xml_cfg, pool);
 
-		if (!conference) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-			goto done;
-		}
+        if (!conference) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+            goto done;
+        }
 
-		/* Set the minimum number of members (once you go above it you cannot go below it) */
-		conference->min = 2;
+        /* Set the minimum number of members (once you go above it you cannot go below it) */
+        conference->min = 2;
 
-		/* if the dialplan specified a pin, override the profile's value */
-		if (dpin) {
-			conference->pin = switch_core_strdup(conference->pool, dpin);
-		}
+        /* if the dialplan specified a pin, override the profile's value */
+        if (dpin) {
+            conference->pin = switch_core_strdup(conference->pool, dpin);
+        }
 
-		/* Indicate the conference is dynamic */
-		switch_set_flag_locked(conference, CFLAG_DYNAMIC);	
+        /* Indicate the conference is dynamic */
+        switch_set_flag_locked(conference, CFLAG_DYNAMIC);	
 
-		/* Start the conference thread for this conference */
-		launch_conference_thread(conference);
+        /* Start the conference thread for this conference */
+        launch_conference_thread(conference);
 
-	} else {
-		/* if the conference exists, get the pointer to it */
-		if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
-			freepool = pool;
-		/* couldn't find the conference, create one */
-		} else {
-			conference = conference_new(conf_name, xml_cfg, pool);
+    } else {
+        /* if the conference exists, get the pointer to it */
+        if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+            freepool = pool;
+            /* couldn't find the conference, create one */
+        } else {
+            conference = conference_new(conf_name, xml_cfg, pool);
 
-			if (!conference) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-				goto done;
-			}
+            if (!conference) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+                goto done;
+            }
 
-			/* if the dialplan specified a pin, override the profile's value */
-			if (dpin) {
-				conference->pin = switch_core_strdup(conference->pool, dpin);
-			}
+            /* if the dialplan specified a pin, override the profile's value */
+            if (dpin) {
+                conference->pin = switch_core_strdup(conference->pool, dpin);
+            }
 
-			/* Set the minimum number of members (once you go above it you cannot go below it) */
-			conference->min = 1;
+            /* Set the minimum number of members (once you go above it you cannot go below it) */
+            conference->min = 1;
 
-			/* Indicate the conference is dynamic */
-			switch_set_flag_locked(conference, CFLAG_DYNAMIC);
+            /* Indicate the conference is dynamic */
+            switch_set_flag_locked(conference, CFLAG_DYNAMIC);
 
-			/* Start the conference thread for this conference */
-			launch_conference_thread(conference);
-		}
+            /* Start the conference thread for this conference */
+            launch_conference_thread(conference);
+        }
 
         /* acquire a read lock on the thread so it can't leave without us */
         if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
@@ -3424,214 +3498,214 @@
         }
         rl++;
         
-		/* if this is not an outbound call, deal with conference pins */
-		if (!switch_channel_test_flag(channel, CF_OUTBOUND) && conference->pin) {
-			char pin_buf[80] = "";
-			int  pin_retries = 3;	/* XXX - this should be configurable - i'm too lazy to do it right now... */
-			int  pin_valid = 0;
-			switch_status_t status = SWITCH_STATUS_SUCCESS;
+        /* if this is not an outbound call, deal with conference pins */
+        if (!switch_channel_test_flag(channel, CF_OUTBOUND) && conference->pin) {
+            char pin_buf[80] = "";
+            int  pin_retries = 3;	/* XXX - this should be configurable - i'm too lazy to do it right now... */
+            int  pin_valid = 0;
+            switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-			/* Answer the channel */
-			switch_channel_answer(channel);
+            /* Answer the channel */
+            switch_channel_answer(channel);
 
-			while(!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
+            while(!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
 
-				/* be friendly */
-				if (conference->pin_sound) {
-					conference_local_play_file(session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
-				} 
-				/* wait for them if neccessary */
-				if (strlen(pin_buf) < strlen(conference->pin)) {
-					char *buf = pin_buf + strlen(pin_buf);
-					char term = '\0';
+                /* be friendly */
+                if (conference->pin_sound) {
+                    conference_local_play_file(session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
+                } 
+                /* wait for them if neccessary */
+                if (strlen(pin_buf) < strlen(conference->pin)) {
+                    char *buf = pin_buf + strlen(pin_buf);
+                    char term = '\0';
 
-					status = switch_ivr_collect_digits_count(session,
-												buf,
-												sizeof(pin_buf) - (unsigned int)strlen(pin_buf),
-												(unsigned int)strlen(conference->pin) - (unsigned int)strlen(pin_buf),
-												"#", &term, 10000);
-				}
+                    status = switch_ivr_collect_digits_count(session, 
+                                                             buf, 
+                                                             sizeof(pin_buf) - (unsigned int)strlen(pin_buf), 
+                                                             (unsigned int)strlen(conference->pin) - (unsigned int)strlen(pin_buf), 
+                                                             "#", &term, 10000);
+                }
 
-				pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
-				if (!pin_valid) {
-					/* zero the collected pin */
-					memset(pin_buf,0,sizeof(pin_buf));
+                pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
+                if (!pin_valid) {
+                    /* zero the collected pin */
+                    memset(pin_buf, 0, sizeof(pin_buf));
 
-					/* more friendliness */
-					if (conference->bad_pin_sound) {
-						conference_local_play_file(session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
-					}
-				}
-				pin_retries --;
-			}
+                    /* more friendliness */
+                    if (conference->bad_pin_sound) {
+                        conference_local_play_file(session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
+                    }
+                }
+                pin_retries --;
+            }
 
-			if (!pin_valid) {
-				goto done;
-			}
-		}
+            if (!pin_valid) {
+                goto done;
+            }
+        }
 
-		/* don't allow more callers if the conference is locked, unless we invited them */
-		if (switch_test_flag(conference, CFLAG_LOCKED) && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Conference %s is locked.\n", conf_name);
-			if (conference->locked_sound) {
-				/* Answer the channel */
-				switch_channel_answer(channel);
-				conference_local_play_file(session, conference->locked_sound, 20, NULL, 0);
-			}
-			goto done;
-		}
-	}
+        /* don't allow more callers if the conference is locked, unless we invited them */
+        if (switch_test_flag(conference, CFLAG_LOCKED) && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Conference %s is locked.\n", conf_name);
+            if (conference->locked_sound) {
+                /* Answer the channel */
+                switch_channel_answer(channel);
+                conference_local_play_file(session, conference->locked_sound, 20, NULL, 0);
+            }
+            goto done;
+        }
+    }
 
-	/* Release the config registry handle */
-	if (cxml) {
-		switch_xml_free(cxml);
-		cxml = NULL;
-	}
+    /* Release the config registry handle */
+    if (cxml) {
+        switch_xml_free(cxml);
+        cxml = NULL;
+    }
 
-	/* if we're using "bridge:" make an outbound call and bridge it in */
-	if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
-		if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
-			goto done;
-		}
-	} else {	
-		/* if we're not using "bridge:" set the conference answered flag */
-		/* and this isn't an outbound channel, answer the call */
-		if (!switch_channel_test_flag(channel, CF_OUTBOUND)) 
-			switch_set_flag(conference, CFLAG_ANSWERED);
-	}
+    /* if we're using "bridge:" make an outbound call and bridge it in */
+    if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
+        if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+            goto done;
+        }
+    } else {	
+        /* if we're not using "bridge:" set the conference answered flag */
+        /* and this isn't an outbound channel, answer the call */
+        if (!switch_channel_test_flag(channel, CF_OUTBOUND)) 
+            switch_set_flag(conference, CFLAG_ANSWERED);
+    }
 
-	/* Save the original read codec. */
-	read_codec = switch_core_session_get_read_codec(session);
-	member.native_rate = read_codec->implementation->samples_per_second;
+    /* Save the original read codec. */
+    read_codec = switch_core_session_get_read_codec(session);
+    member.native_rate = read_codec->implementation->samples_per_second;
 
-	/* Setup a Signed Linear codec for reading audio. */
-	if (switch_core_codec_init(&member.read_codec,
-							   "L16",
-							   NULL,
-							   read_codec->implementation->samples_per_second,
-							   read_codec->implementation->microseconds_per_frame / 1000,
-							   1,
-							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-							   NULL,
-							   pool) == SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
-						  conference->rate, conference->interval);
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
-						  conference->rate, conference->interval);
-		flags = 0;
-		goto done;
-	}
+    /* Setup a Signed Linear codec for reading audio. */
+    if (switch_core_codec_init(&member.read_codec, 
+                               "L16", 
+                               NULL, 
+                               read_codec->implementation->samples_per_second, 
+                               read_codec->implementation->microseconds_per_frame / 1000, 
+                               1, 
+                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, 
+                               NULL, 
+                               pool) == SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n", 
+                          conference->rate, conference->interval);
+    } else {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n", 
+                          conference->rate, conference->interval);
+        flags = 0;
+        goto done;
+    }
 
-	if (read_codec->implementation->samples_per_second != conference->rate) {
-		switch_audio_resampler_t **resampler = read_codec->implementation->samples_per_second > conference->rate ? 
-			&member.read_resampler : &member.mux_resampler;
+    if (read_codec->implementation->samples_per_second != conference->rate) {
+        switch_audio_resampler_t **resampler = read_codec->implementation->samples_per_second > conference->rate ? 
+            &member.read_resampler : &member.mux_resampler;
 
-		switch_resample_create(resampler,
-							   read_codec->implementation->samples_per_second,
-							   read_codec->implementation->samples_per_second * 20,
-							   conference->rate,
-							   conference->rate * 20,
-							   switch_core_session_get_pool(session));
+        switch_resample_create(resampler, 
+                               read_codec->implementation->samples_per_second, 
+                               read_codec->implementation->samples_per_second * 20, 
+                               conference->rate, 
+                               conference->rate * 20, 
+                               switch_core_session_get_pool(session));
 
-		/* Setup an audio buffer for the resampled audio */
-		if (switch_buffer_create_dynamic(&member.resample_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
-			goto done;
-		}
-	}
-	/* Setup a Signed Linear codec for writing audio. */
-	if (switch_core_codec_init(&member.write_codec,
-							   "L16",
-							   NULL,
-							   conference->rate,
-							   conference->interval,
-							   1,
-							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-							   NULL,
-							   pool) == SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
-						  conference->rate, conference->interval);
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
-						  conference->rate, conference->interval);
-		flags = 0;
-		goto codec_done2;
-	}
+        /* Setup an audio buffer for the resampled audio */
+        if (switch_buffer_create_dynamic(&member.resample_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
+            goto done;
+        }
+    }
+    /* Setup a Signed Linear codec for writing audio. */
+    if (switch_core_codec_init(&member.write_codec, 
+                               "L16", 
+                               NULL, 
+                               conference->rate, 
+                               conference->interval, 
+                               1, 
+                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, 
+                               NULL, 
+                               pool) == SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n", 
+                          conference->rate, conference->interval);
+    } else {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n", 
+                          conference->rate, conference->interval);
+        flags = 0;
+        goto codec_done2;
+    }
 
-	/* Setup an audio buffer for the incoming audio */
-	if (switch_buffer_create_dynamic(&member.audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
-		goto codec_done1;
-	}
+    /* Setup an audio buffer for the incoming audio */
+    if (switch_buffer_create_dynamic(&member.audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
+        goto codec_done1;
+    }
 
-	/* Setup an audio buffer for the outgoing audio */
-	if (switch_buffer_create_dynamic(&member.mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
-		goto codec_done1;
-	}
+    /* Setup an audio buffer for the outgoing audio */
+    if (switch_buffer_create_dynamic(&member.mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
+        goto codec_done1;
+    }
 
-	/* Prepare MUTEXS */
-	member.id = next_member_id();
-	member.pool = pool;
-	member.session = session;
-	switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, pool);
-	switch_mutex_init(&member.audio_in_mutex, SWITCH_MUTEX_NESTED, pool);
-	switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, pool);
+    /* Prepare MUTEXS */
+    member.id = next_member_id();
+    member.pool = pool;
+    member.session = session;
+    switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, pool);
+    switch_mutex_init(&member.audio_in_mutex, SWITCH_MUTEX_NESTED, pool);
+    switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, pool);
 
-	/* Install our Signed Linear codec so we get the audio in that format */
-	switch_core_session_set_read_codec(member.session, &member.read_codec);
+    /* Install our Signed Linear codec so we get the audio in that format */
+    switch_core_session_set_read_codec(member.session, &member.read_codec);
 
-	/* Add the caller to the conference */
-	if (conference_add_member(conference, &member) != SWITCH_STATUS_SUCCESS) {
-		goto codec_done1;
-	}
-	switch_set_flag_locked((&member), MFLAG_RUNNING | uflags);
+    /* Add the caller to the conference */
+    if (conference_add_member(conference, &member) != SWITCH_STATUS_SUCCESS) {
+        goto codec_done1;
+    }
+    switch_set_flag_locked((&member), MFLAG_RUNNING | uflags);
 
-	msg.from = __FILE__;
+    msg.from = __FILE__;
 
-	/* Tell the channel we are going to be in a bridge */
-	msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
-	switch_core_session_receive_message(session, &msg);
+    /* Tell the channel we are going to be in a bridge */
+    msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
+    switch_core_session_receive_message(session, &msg);
 
-	/* Run the confernece loop */
-	conference_loop_output(&member);
+    /* Run the confernece loop */
+    conference_loop_output(&member);
 
-	/* Tell the channel we are no longer going to be in a bridge */
-	msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
-	switch_core_session_receive_message(session, &msg);
+    /* Tell the channel we are no longer going to be in a bridge */
+    msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
+    switch_core_session_receive_message(session, &msg);
 
-	/* Remove the caller from the conference */
-	conference_del_member(member.last_conference, &member);
+    /* Remove the caller from the conference */
+    conference_del_member(member.last_conference, &member);
 
-	/* Put the original codec back */
-	switch_core_session_set_read_codec(member.session, read_codec);
+    /* Put the original codec back */
+    switch_core_session_set_read_codec(member.session, read_codec);
 
-	/* Clean Up.  codec_done(X): is for error situations after the codecs were setup and done: is for situations before */
-codec_done1:
-	switch_core_codec_destroy(&member.read_codec);
-codec_done2:
-	switch_core_codec_destroy(&member.write_codec);
-done:
+    /* Clean Up.  codec_done(X): is for error situations after the codecs were setup and done: is for situations before */
+ codec_done1:
+    switch_core_codec_destroy(&member.read_codec);
+ codec_done2:
+    switch_core_codec_destroy(&member.write_codec);
+ done:
 
-	switch_buffer_destroy(&member.resample_buffer);
-	switch_buffer_destroy(&member.audio_buffer);
-	switch_buffer_destroy(&member.mux_buffer);
+    switch_buffer_destroy(&member.resample_buffer);
+    switch_buffer_destroy(&member.audio_buffer);
+    switch_buffer_destroy(&member.mux_buffer);
 
-	/* Release the config registry handle */
-	if (cxml) {
-		switch_xml_free(cxml);
-	}
+    /* Release the config registry handle */
+    if (cxml) {
+        switch_xml_free(cxml);
+    }
 
-	if (freepool) {
-		switch_core_destroy_memory_pool(&freepool);
-	}
+    if (freepool) {
+        switch_core_destroy_memory_pool(&freepool);
+    }
 
-	if (switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
-		switch_ivr_play_file(session, NULL, conference->kicked_sound, NULL, NULL, NULL, 0);
-	}
+    if (switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
+        switch_ivr_play_file(session, NULL, conference->kicked_sound, NULL, NULL, NULL, 0);
+    }
 
-	switch_core_session_reset(session);
+    switch_core_session_reset(session);
 
     /* release the readlock */
     if (rl) {
@@ -3642,801 +3716,818 @@
 /* Create a thread for the conference and launch it */
 static void launch_conference_thread(conference_obj_t *conference)
 {
-	switch_thread_t *thread;
-	switch_threadattr_t *thd_attr = NULL;
+    switch_thread_t *thread;
+    switch_threadattr_t *thd_attr = NULL;
 
-	switch_set_flag_locked(conference, CFLAG_RUNNING);
-	switch_threadattr_create(&thd_attr, conference->pool);
-	switch_threadattr_detach_set(thd_attr, 1);
-	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-	switch_mutex_lock(globals.hash_mutex);
-	switch_core_hash_insert(globals.conference_hash, conference->name, conference);
-	switch_mutex_unlock(globals.hash_mutex);
-	switch_thread_create(&thread, thd_attr, conference_thread_run, conference, conference->pool);
+    switch_set_flag_locked(conference, CFLAG_RUNNING);
+    switch_threadattr_create(&thd_attr, conference->pool);
+    switch_threadattr_detach_set(thd_attr, 1);
+    switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+    switch_mutex_lock(globals.hash_mutex);
+    switch_core_hash_insert(globals.conference_hash, conference->name, conference);
+    switch_mutex_unlock(globals.hash_mutex);
+    switch_thread_create(&thread, thd_attr, conference_thread_run, conference, conference->pool);
 }
 
 static void launch_conference_record_thread(conference_obj_t *conference, char *path)
 {
-	switch_thread_t *thread;
-	switch_threadattr_t *thd_attr = NULL;
-	switch_memory_pool_t *pool;
-	conference_record_t *rec;
+    switch_thread_t *thread;
+    switch_threadattr_t *thd_attr = NULL;
+    switch_memory_pool_t *pool;
+    conference_record_t *rec;
 
-	/* Setup a memory pool to use. */
-	if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-	}
+    /* Setup a memory pool to use. */
+    if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+    }
 
-	/* Create a node object*/
-	if (!(rec = switch_core_alloc(pool, sizeof(*rec)))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
-		switch_core_destroy_memory_pool(&pool);
-	}
+    /* Create a node object*/
+    if (!(rec = switch_core_alloc(pool, sizeof(*rec)))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+        switch_core_destroy_memory_pool(&pool);
+    }
 
-	rec->conference = conference;
-	rec->path = switch_core_strdup(pool, path);
-	rec->pool = pool;
+    rec->conference = conference;
+    rec->path = switch_core_strdup(pool, path);
+    rec->pool = pool;
 
-	switch_threadattr_create(&thd_attr, rec->pool);
-	switch_threadattr_detach_set(thd_attr, 1);
-	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-	switch_thread_create(&thread, thd_attr, conference_record_thread_run, rec, rec->pool);
+    switch_threadattr_create(&thd_attr, rec->pool);
+    switch_threadattr_detach_set(thd_attr, 1);
+    switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+    switch_thread_create(&thread, thd_attr, conference_record_thread_run, rec, rec->pool);
 }
 
 static const switch_application_interface_t conference_application_interface = {
-	/*.interface_name */ global_app_name,
-	/*.application_function */ conference_function,
-	NULL, NULL, NULL,
-	/*.next*/ NULL
+    /*.interface_name */ global_app_name, 
+    /*.application_function */ conference_function, 
+    NULL, NULL, NULL, 
+    /*.next*/ NULL
 };
 
 static switch_api_interface_t conf_api_interface = {
-	/*.interface_name */	"conference",
-	/*.desc */		"Conference module commands",
-	/*.function */		conf_api_main,
-	/*.syntax */		/* see switch_module_load, this is built on the fly */
-	/*.next */ 
+    /*.interface_name */	"conference", 
+    /*.desc */				"Conference module commands", 
+    /*.function */			conf_api_main, 
+    /*.syntax */		/* see switch_module_load, this is built on the fly */
+    /*.next */ 
 };
 
 static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
 {
-	char name[512] = "", *p, *lbuf;
-	switch_chat_interface_t *ci;
-	conference_obj_t *conference = NULL;
-	switch_stream_handle_t stream = {0};
+    char name[512] = "", *p, *lbuf;
+    switch_chat_interface_t *ci;
+    conference_obj_t *conference = NULL;
+    switch_stream_handle_t stream = {0};
 
-	if ((p = strchr(to, '+'))) {
-		to = ++p;
-	}
+    if ((p = strchr(to, '+'))) {
+        to = ++p;
+    }
 
-	if (!body) {
-		return SWITCH_STATUS_SUCCESS;
-	}
+    if (!body) {
+        return SWITCH_STATUS_SUCCESS;
+    }
 
-	if (!(ci = switch_loadable_module_get_chat_interface(proto))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
-	}
+    if (!(ci = switch_loadable_module_get_chat_interface(proto))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
+    }
 
 
-	if ((p = strchr(to, '@'))) {
-		switch_copy_string(name, to, ++p-to);
-	} else {
-		switch_copy_string(name, to, sizeof(name));
-	}
+    if ((p = strchr(to, '@'))) {
+        switch_copy_string(name, to, ++p-to);
+    } else {
+        switch_copy_string(name, to, sizeof(name));
+    }
 
-	if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
-		ci->chat_send(CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL);
-		return SWITCH_STATUS_FALSE;
-	}
+    if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
+        ci->chat_send(CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL);
+        return SWITCH_STATUS_FALSE;
+    }
 
-	SWITCH_STANDARD_STREAM(stream);
+    SWITCH_STANDARD_STREAM(stream);
 
-	if (body != NULL && (lbuf = strdup(body))) {
-		int argc;
-		char *argv[25];
+    if (body != NULL && (lbuf = strdup(body))) {
+        int argc;
+        char *argv[25];
 
-		memset(argv,0,sizeof(argv));
-		argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+        memset(argv, 0, sizeof(argv));
+        argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 
-		/* try to find a command to execute */
-		if (argc) {
-			/* special case list */
-			if (strcasecmp(argv[0],"list") == 0) {
-				conference_list_pretty(conference, &stream);
-			/* provide help */
-			} else if (strcasecmp(argv[0],"help") == 0 || strcasecmp(argv[0],"commands") == 0) {
-				stream.write_function(&stream, "%s\n", conf_api_interface.syntax);
-			/* find a normal command */
-			} else {
-				conf_api_dispatch(conference, &stream, argc, argv, lbuf, 0);
-			}
-		} else {
-			stream.write_function(&stream, "No parameters specified.\nTry 'help'\n");
-		}
-	}
-	switch_safe_free(lbuf);
+        /* try to find a command to execute */
+        if (argc) {
+            /* special case list */
+            if (strcasecmp(argv[0], "list") == 0) {
+                conference_list_pretty(conference, &stream);
+                /* provide help */
+            } 
+            else {
+                if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
+                    stream.write_function(&stream, "%s\n", conf_api_interface.syntax);
+                    /* find a normal command */
+                } else {
+                    conf_api_dispatch(conference, &stream, argc, argv, (const char *)body, 0);
+                }
+            }
+        } else {
+            stream.write_function(&stream, "No parameters specified.\nTry 'help'\n");
+        }
+    }
+    switch_safe_free(lbuf);
 
-	ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
-	switch_safe_free(stream.data);
+    ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
+    switch_safe_free(stream.data);
 
-	return SWITCH_STATUS_SUCCESS;
+    return SWITCH_STATUS_SUCCESS;
 }
 
 static const switch_chat_interface_t conference_chat_interface = {
-	/*.name */ CONF_CHAT_PROTO,
-	/*.chat_send */ chat_send,
+    /*.name */ CONF_CHAT_PROTO, 
+    /*.chat_send */ chat_send, 
 
 };
 
 static switch_loadable_module_interface_t conference_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ &conference_application_interface,
-	/*.api_interface */ &conf_api_interface,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL,
-	/*.chat_interface */ &conference_chat_interface
+    /*.module_name */ modname, 
+    /*.endpoint_interface */ NULL, 
+    /*.timer_interface */ NULL, 
+    /*.dialplan_interface */ NULL, 
+    /*.codec_interface */ NULL, 
+    /*.application_interface */ &conference_application_interface, 
+    /*.api_interface */ &conf_api_interface, 
+    /*.file_interface */ NULL, 
+    /*.speech_interface */ NULL, 
+    /*.directory_interface */ NULL, 
+    /*.chat_interface */ &conference_chat_interface
 };
 
 #ifdef OPTION_IVR_MENU_SUPPORT
 static switch_ivr_action_t conference_caller_control_menu_handler(switch_ivr_menu_t *menu, char *param, char *buf, size_t buflen, void *obj)
 {
-	switch_ivr_action_t action = SWITCH_IVR_ACTION_NOOP;
+    switch_ivr_action_t action = SWITCH_IVR_ACTION_NOOP;
 
-	if (!switch_strlen_zero(param)) {
-		if (obj != NULL) {
-			int i,found;
-			char *action_name = strdup(param);
+    if (!switch_strlen_zero(param)) {
+        if (obj != NULL) {
+            int i, found;
+            char *action_name = strdup(param);
 
-			if (action_name != NULL) {
-				char *sep = (action_name != NULL ? strchr(action_name,' ') : NULL);
+            if (action_name != NULL) {
+                char *sep = (action_name != NULL ? strchr(action_name, ' ') : NULL);
 
-				/* split the action from any parameters */
-				if (sep != NULL) {
-					*sep ='\0';
-				}
+                /* split the action from any parameters */
+                if (sep != NULL) {
+                    *sep  = '\0';
+                }
 
-				/* find and execute the caller control handler */
-				for(i=0,found=0; !found && i<CCFNTBL_QTY; i++) {
-					found = (ccfntbl[i].action != CALLER_CONTROL_MENU && strcasecmp(ccfntbl[i].key,action_name) == 0);
-					if (found) {
-						if (obj != NULL) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "invoking caller control menu action '%s'\n",ccfntbl[i].key);
-							ccfntbl[i].handler((conference_member_t *)obj, (sep != NULL ? sep+1 : NULL));
-							if (ccfntbl[i].action == CALLER_CONTROL_HANGUP) {
-								action = SWITCH_IVR_ACTION_DIE;
-							}
-						}
-					}
-				}
+                /* find and execute the caller control handler */
+                for(i = 0, found = 0; !found && i<CCFNTBL_QTY; i++) {
+                    found = (ccfntbl[i].action != CALLER_CONTROL_MENU && strcasecmp(ccfntbl[i].key, action_name) == 0);
+                    if (found) {
+                        if (obj != NULL) {
+                            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "invoking caller control menu action '%s'\n", ccfntbl[i].key);
+                            ccfntbl[i].handler((conference_member_t *)obj, (sep != NULL ? sep+1 : NULL));
+                            if (ccfntbl[i].action == CALLER_CONTROL_HANGUP) {
+                                action = SWITCH_IVR_ACTION_DIE;
+                            }
+                        }
+                    }
+                }
 
-				free(action_name);
-			}
+                free(action_name);
+            }
 
-			if (!found) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unknown caller control menu action '%s'\n",param);
-			}
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to invoke caller control menu action '%s', NULL member!\n",param);
-		}
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NULL or empty param!\n");
-	}
+            if (!found) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unknown caller control menu action '%s'\n", param);
+            }
+        } else {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to invoke caller control menu action '%s', NULL member!\n", param);
+        }
+    } else {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NULL or empty param!\n");
+    }
 
-	return action;
+    return action;
 }
 
 /*
-static switch_status_t ivr_menu_callback_play_file(char *file, uint32_t leadin, void *member)
-{
-	switch_status_t status;
+  static switch_status_t ivr_menu_callback_play_file(char *file, uint32_t leadin, void *member)
+  {
+  switch_status_t status;
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_play_file\n");
-	status = conference_member_play_file((conference_member_t *)member, file, leadin);
-	if (status != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ivr_menu_callback_play_file ERROR\n");
-	}
+  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_play_file\n");
+  status = conference_member_play_file((conference_member_t *)member, file, leadin);
+  if (status != SWITCH_STATUS_SUCCESS) {
+  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ivr_menu_callback_play_file ERROR\n");
+  }
 
-	return status;
-}
+  return status;
+  }
 
-static switch_status_t ivr_menu_callback_say(char *file, uint32_t leadin, void *member)
-{
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_say\n");
-	return conference_member_say((conference_member_t *)member, file, leadin);
-}
+  static switch_status_t ivr_menu_callback_say(char *file, uint32_t leadin, void *member)
+  {
+  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_say\n");
+  return conference_member_say((conference_member_t *)member, file, leadin);
+  }
 */
 
-static switch_status_t conference_caller_control_menu_build(caller_control_menu_ctx_t **ctx, conference_obj_t *conference, switch_xml_t menu_group, char *menu_name)
+static switch_status_t conference_caller_control_menu_build(caller_control_menu_ctx_t **ctx, 
+                                                            conference_obj_t *conference, 
+                                                            switch_xml_t menu_group, 
+                                                            char *menu_name)
 {
-	switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_xml_t xml_menus;
+    switch_xml_t xml_menu;
 
-	if (ctx != NULL && conference != NULL && menu_group != NULL && menu_name != NULL) {
-		switch_xml_t xml_menus = switch_xml_child(menu_group, "menus");
-		switch_xml_t xml_menu = (xml_menus != NULL ? switch_xml_find_child(xml_menus, "menu", "name", menu_name) : NULL);
+    assert(conference != NULL);
+    assert(ctx != NULL);
+    assert(menu_group != NULL);
+    assert(menu_name != NULL);
+    assert(xml_menus != NULL);
 
-		/* if we found the requested menu in our menu_group */
-		if (xml_menu != NULL && xml_menu != NULL) {
-			*ctx = (caller_control_menu_ctx_t *)switch_core_alloc(conference->pool,sizeof(caller_control_menu_ctx_t));
+    xml_menus = switch_xml_child(menu_group, "menus");
+    xml_menu = (xml_menus != NULL ? switch_xml_find_child(xml_menus, "menu", "name", menu_name) : NULL);
 
-			if (*ctx != NULL) {
-				memset(*ctx,0,sizeof(caller_control_menu_ctx_t));
 
-				/* setup an xml parser context, and a menu stack context for the specified menu in our memory pool */
-				status = switch_ivr_menu_stack_xml_init(&(*ctx)->xml_ctx, conference->pool);
-				if (status == SWITCH_STATUS_SUCCESS) {
-					(*ctx)->name = switch_core_strdup(conference->pool,menu_name);
 
-					/* add our xml menu handler to the xml stack parser */
-					status = switch_ivr_menu_stack_xml_add_custom((*ctx)->xml_ctx, "control", &conference_caller_control_menu_handler);
-					if (status != SWITCH_STATUS_SUCCESS)
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to add custom xml handler\n");
+    /* if we found the requested menu in our menu_group */
+    if (xml_menu != NULL && xml_menu != NULL) {
+        *ctx = (caller_control_menu_ctx_t *)switch_core_alloc(conference->pool, sizeof(caller_control_menu_ctx_t));
 
-					/* parse the xml stack to build the menu stack */
-					status = switch_ivr_menu_stack_xml_build((*ctx)->xml_ctx, &(*ctx)->menu_stack, xml_menus, xml_menu, conference->timer_name);
-					if (status != SWITCH_STATUS_SUCCESS)
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build xml menu stack\n");
+        if (*ctx != NULL) {
+            memset(*ctx, 0, sizeof(caller_control_menu_ctx_t));
 
-/*
-					// instruct ivr menu to use our file play and tts routines
-					status = switch_ivr_menu_set_fileplay_callback((*ctx)->menu_stack, &ivr_menu_callback_play_file);
-					if (status != SWITCH_STATUS_SUCCESS)
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set file play calback\n");
-					status = switch_ivr_menu_set_tts_callback((*ctx)->menu_stack, &ivr_menu_callback_say);
-					if (status != SWITCH_STATUS_SUCCESS)
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set tts calback\n");
-*/
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to init xml menu context\n");
-				}
-				if (status != SWITCH_STATUS_SUCCESS)
-					*ctx = NULL;
-			}
-		} else {
-			if(xml_menus == NULL)
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menus\n");
-			if(xml_menu == NULL)
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menu '%s'\n",menu_name);
-		}
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "null parameters!\n");
-	}
+            /* setup an xml parser context, and a menu stack context for the specified menu in our memory pool */
+            status = switch_ivr_menu_stack_xml_init(&(*ctx)->xml_ctx, conference->pool);
+            if (status == SWITCH_STATUS_SUCCESS) {
+                (*ctx)->name = switch_core_strdup(conference->pool, menu_name);
 
-	return status;
+                /* add our xml menu handler to the xml stack parser */
+                status = switch_ivr_menu_stack_xml_add_custom((*ctx)->xml_ctx, "control", &conference_caller_control_menu_handler);
+                if (status != SWITCH_STATUS_SUCCESS)
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to add custom xml handler\n");
+
+                /* parse the xml stack to build the menu stack */
+                status = switch_ivr_menu_stack_xml_build((*ctx)->xml_ctx, &(*ctx)->menu_stack, xml_menus, xml_menu, conference->timer_name);
+                if (status != SWITCH_STATUS_SUCCESS)
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build xml menu stack\n");
+
+                /*
+                // instruct ivr menu to use our file play and tts routines
+                status = switch_ivr_menu_set_fileplay_callback((*ctx)->menu_stack, &ivr_menu_callback_play_file);
+                if (status != SWITCH_STATUS_SUCCESS)
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set file play calback\n");
+                status = switch_ivr_menu_set_tts_callback((*ctx)->menu_stack, &ivr_menu_callback_say);
+                if (status != SWITCH_STATUS_SUCCESS)
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set tts calback\n");
+                */
+            } else {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to init xml menu context\n");
+            }
+            if (status != SWITCH_STATUS_SUCCESS)
+                *ctx = NULL;
+        }
+    } else {
+        if (xml_menus == NULL)
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menus\n");
+        if (xml_menu == NULL)
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menu '%s'\n", menu_name);
+    }
+
+    return status;
 }
 #endif
 
-static switch_status_t conference_new_install_caller_controls_default(conference_obj_t *conference)
+static switch_status_t conf_default_controls(conference_obj_t *conference)
 {
-	switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_status_t status = SWITCH_STATUS_FALSE;
+    uint32_t i;
+    caller_control_action_t *action;
 
-	if(conference != NULL) {
-		int i;
-		caller_control_action_t *action;
+    assert(conference != NULL);
 
-		for(i=0,status=SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i<CCFNTBL_QTY; i++) {
-			if (!switch_strlen_zero(ccfntbl[i].digits)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing default caller control action '%s' bound to '%s'.\n",
-											ccfntbl[i].key,
-											ccfntbl[i].digits);
-				action = (caller_control_action_t *)switch_core_alloc(conference->pool,sizeof(caller_control_action_t));
-				if (action != NULL) {
-					action->fndesc = &ccfntbl[i];
-					action->data = NULL;
-					status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,ccfntbl[i].digits,action);
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n",ccfntbl[i].key,ccfntbl[i].digits);
-					status = SWITCH_STATUS_MEMERR;
-				}
-			}
-		}
-	}
+    for(i = 0, status = SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i<CCFNTBL_QTY; i++) {
+        if (!switch_strlen_zero(ccfntbl[i].digits)) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing default caller control action '%s' bound to '%s'.\n", 
+                              ccfntbl[i].key, 
+                              ccfntbl[i].digits);
+            action = (caller_control_action_t *)switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
+            if (action != NULL) {
+                action->fndesc = &ccfntbl[i];
+                action->data = NULL;
+                status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, ccfntbl[i].digits, action);
+            } else {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n", 
+                                  ccfntbl[i].key, ccfntbl[i].digits);
+                status = SWITCH_STATUS_MEMERR;
+            }
+        }
+    }
+	
 
-	return status;
+    return status;
 }
 
 static switch_status_t conference_new_install_caller_controls_custom(conference_obj_t *conference, switch_xml_t xml_controls, switch_xml_t xml_menus)
 {
-	switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_xml_t xml_kvp;
 
-	if (conference != NULL && xml_controls != NULL) {
-		switch_xml_t xml_kvp;
+    assert(conference != NULL);
+    assert(xml_controls != NULL);
 
-		/* parse the controls tree for caller control digit strings */
-		for (xml_kvp = switch_xml_child(xml_controls, "control"); xml_kvp; xml_kvp = xml_kvp->next) {
-			char *key = (char *) switch_xml_attr(xml_kvp, "action");
-			char *val = (char *) switch_xml_attr(xml_kvp, "digits");
-			char *data = (char *)switch_xml_attr_soft(xml_kvp, "data");
+    /* parse the controls tree for caller control digit strings */
+    for (xml_kvp = switch_xml_child(xml_controls, "control"); xml_kvp; xml_kvp = xml_kvp->next) {
+        char *key = (char *) switch_xml_attr(xml_kvp, "action");
+        char *val = (char *) switch_xml_attr(xml_kvp, "digits");
+        char *data = (char *)switch_xml_attr_soft(xml_kvp, "data");
 
-			if(!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
-				int i;
+        if (!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
+            uint32_t i;
 
-				/* scan through all of the valid actions, and if found, */
-				/* set the new caller control action digit string, then */
-				/* stop scanning the table, and go to the next xml kvp. */
-				for(i=0,status=SWITCH_STATUS_NOOP; i<CCFNTBL_QTY && status == SWITCH_STATUS_NOOP; i++) {
+            /* scan through all of the valid actions, and if found, */
+            /* set the new caller control action digit string, then */
+            /* stop scanning the table, and go to the next xml kvp. */
+            for(i = 0, status = SWITCH_STATUS_NOOP; i<CCFNTBL_QTY && status == SWITCH_STATUS_NOOP; i++) {
 
-					if(strcasecmp(ccfntbl[i].key,key) == 0) {
-						status = SWITCH_STATUS_SUCCESS;
+                if (strcasecmp(ccfntbl[i].key, key) == 0) {
+                    status = SWITCH_STATUS_SUCCESS;
 #ifdef OPTION_IVR_MENU_SUPPORT
-						if (xml_menus != NULL && ccfntbl[i].action == CALLER_CONTROL_MENU) {
-							char *menu_group_name = strdup(data);
-							char *menu_name = (menu_group_name != NULL ? strchr(menu_group_name,'/') : NULL);
+                    if (xml_menus != NULL && ccfntbl[i].action == CALLER_CONTROL_MENU) {
+                        char *menu_group_name = strdup(data);
+                        char *menu_name = (menu_group_name != NULL ? strchr(menu_group_name, '/') : NULL);
 
-							/* format: "menu_group_name/menu_name" */
-							/* separate the menu name from the menu group */
-							if (menu_name != NULL) {
-								*(menu_name++) = '\0';
-							}
-							/* if there is a menu name, build the menu */
-							if (menu_name != NULL) {
-								caller_control_menu_ctx_t *menu_ctx = NULL;
-								switch_xml_t menu_group = switch_xml_find_child(xml_menus, "group", "name", menu_group_name);
+                        /* format: "menu_group_name/menu_name" */
+                        /* separate the menu name from the menu group */
+                        if (menu_name != NULL) {
+                            *(menu_name++) = '\0';
+                        }
+                        /* if there is a menu name, build the menu */
+                        if (menu_name != NULL) {
+                            caller_control_menu_ctx_t *menu_ctx = NULL;
+                            switch_xml_t menu_group = switch_xml_find_child(xml_menus, "group", "name", menu_group_name);
 
-								status = conference_caller_control_menu_build(&menu_ctx, conference, menu_group, menu_name);
-								data = (char *)menu_ctx;
-							} else {
-								status = SWITCH_STATUS_FALSE;
-							}
+                            status = conference_caller_control_menu_build(&menu_ctx, conference, menu_group, menu_name);
+                            data = (char *)menu_ctx;
+                        } else {
+                            status = SWITCH_STATUS_FALSE;
+                        }
 
-							if (status != SWITCH_STATUS_SUCCESS) {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build menu '%s' bound to '%s'\n",data,val);
-							}
+                        if (status != SWITCH_STATUS_SUCCESS) {
+                            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build menu '%s' bound to '%s'\n", data, val);
+                        }
 
-							/* clean up */
-							if (menu_group_name != NULL) {
-								free(menu_group_name);
-							}
-						}
+                        /* clean up */
+                        if (menu_group_name != NULL) {
+                            free(menu_group_name);
+                        }
+                    }
 #endif
 
-						if (status == SWITCH_STATUS_SUCCESS) {
-							caller_control_action_t *action;
+                    if (status == SWITCH_STATUS_SUCCESS) {
+                        caller_control_action_t *action;
 
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing caller control action '%s' bound to '%s'.\n",key,val);
-							action = (caller_control_action_t *)switch_core_alloc(conference->pool,sizeof(caller_control_action_t));
-							if (action != NULL) {
-								action->fndesc = &ccfntbl[i];
-								action->data = (void *)data;
-								status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,val,action);
-							} else {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n",ccfntbl[i].key,ccfntbl[i].digits);
-								status = SWITCH_STATUS_MEMERR;
-							}
-						}
-					}
-				}
-				if(status == SWITCH_STATUS_NOOP) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control action name '%s'.\n",key);
-				}
-			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control config entry pair action='%s' digits='%s'\n",key,val);
-			}
-		}
-	}
+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing caller control action '%s' bound to '%s'.\n", key, val);
+                        action = (caller_control_action_t *)switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
+                        if (action != NULL) {
+                            action->fndesc = &ccfntbl[i];
+                            action->data = (void *)data;
+                            status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, val, action);
+                        } else {
+                            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n", ccfntbl[i].key, ccfntbl[i].digits);
+                            status = SWITCH_STATUS_MEMERR;
+                        }
+                    }
+                }
+            }
+            if (status == SWITCH_STATUS_NOOP) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control action name '%s'.\n", key);
+            }
+        } else {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control config entry pair action = '%s' digits = '%s'\n", key, val);
+        }
+    }
 
-	return status;
+    return status;
 }
 
 /* create a new conferene with a specific profile */
 static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool)
 {
-	conference_obj_t *conference;
-	switch_xml_t xml_kvp;
-	char *rate_name = NULL;
-	char *interval_name = NULL;
-	char *timer_name = NULL;
-	char *domain = NULL;
-	char *tts_engine = NULL;
-	char *tts_voice = NULL;
-	char *enter_sound = NULL;
-	char *exit_sound = NULL;
-	char *alone_sound = NULL;
-	char *ack_sound = NULL;
-	char *nack_sound = NULL;
-	char *muted_sound = NULL;
-	char *unmuted_sound = NULL;
-	char *locked_sound = NULL;
-	char *kicked_sound = NULL;
-	char *pin = NULL;
-	char *pin_sound = NULL; 
-	char *bad_pin_sound = NULL;
-	char *energy_level = NULL;
-	char *caller_id_name = NULL;
-	char *caller_id_number = NULL;
-	char *caller_controls = NULL;
-	uint32_t rate = 8000, interval = 20;
-	switch_status_t status;
+    conference_obj_t *conference;
+    switch_xml_t xml_kvp;
+    char *rate_name = NULL;
+    char *interval_name = NULL;
+    char *timer_name = NULL;
+    char *domain = NULL;
+    char *tts_engine = NULL;
+    char *tts_voice = NULL;
+    char *enter_sound = NULL;
+    char *exit_sound = NULL;
+    char *alone_sound = NULL;
+    char *ack_sound = NULL;
+    char *nack_sound = NULL;
+    char *muted_sound = NULL;
+    char *unmuted_sound = NULL;
+    char *locked_sound = NULL;
+    char *kicked_sound = NULL;
+    char *pin = NULL;
+    char *pin_sound = NULL; 
+    char *bad_pin_sound = NULL;
+    char *energy_level = NULL;
+    char *caller_id_name = NULL;
+    char *caller_id_number = NULL;
+    char *caller_controls = NULL;
+    uint32_t rate = 8000, interval = 20;
+    switch_status_t status;
 
-	/* Validate the conference name */
-	if (switch_strlen_zero(name)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
-		return NULL;
-	}
+    /* Validate the conference name */
+    if (switch_strlen_zero(name)) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
+        return NULL;
+    }
 
-	/* parse the profile tree for param values */
-	for (xml_kvp = switch_xml_child(cfg.profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
-		char *var = (char *) switch_xml_attr_soft(xml_kvp, "name");
-		char *val = (char *) switch_xml_attr_soft(xml_kvp, "value");
-		char buf[128] = "";
-		char *p;
+    /* parse the profile tree for param values */
+    for (xml_kvp = switch_xml_child(cfg.profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
+        char *var = (char *) switch_xml_attr_soft(xml_kvp, "name");
+        char *val = (char *) switch_xml_attr_soft(xml_kvp, "value");
+        char buf[128] = "";
+        char *p;
 
-		if ((p = strchr(var, '_'))) {
-			switch_copy_string(buf, var, sizeof(buf));
-			for(p = buf; *p; p++) {
-				if (*p == '_') {
-					*p = '-';
-				}
-			}
-			var = buf;
-		}
+        if ((p = strchr(var, '_'))) {
+            switch_copy_string(buf, var, sizeof(buf));
+            for(p = buf; *p; p++) {
+                if (*p == '_') {
+                    *p = '-';
+                }
+            }
+            var = buf;
+        }
 
-		if (!strcasecmp(var, "rate")) {
-			rate_name = val;
-		} else if (!strcasecmp(var, "domain")) {
-			domain = val;
-		} else if (!strcasecmp(var, "interval")) {
-			interval_name= val;
-		} else if (!strcasecmp(var, "timer-name")) {
-			timer_name= val;
-		} else if (!strcasecmp(var, "tts-engine")) {
-			tts_engine= val;
-		} else if (!strcasecmp(var, "tts-voice")) {
-			tts_voice= val;
-		} else if (!strcasecmp(var, "enter-sound")) {
-			enter_sound = val;
-		} else if (!strcasecmp(var, "exit-sound")) {
-			exit_sound = val;
-		} else if (!strcasecmp(var, "alone-sound")) {
-			alone_sound = val;
-		} else if (!strcasecmp(var, "ack-sound")) {
-			ack_sound = val;
-		} else if (!strcasecmp(var, "nack-sound")) {
-			nack_sound = val;
-		} else if (!strcasecmp(var, "muted-sound")) {
-			muted_sound = val;
-		} else if (!strcasecmp(var, "unmuted-sound")) {
-			unmuted_sound = val;
-		} else if (!strcasecmp(var, "locked-sound")) {
-			locked_sound= val;
-		} else if (!strcasecmp(var, "kicked-sound")) {
-			kicked_sound = val;
-		} else if (!strcasecmp(var, "pin")) {
-			pin = val;
-		} else if (!strcasecmp(var, "pin-sound")) {
-			pin_sound = val;
-		} else if (!strcasecmp(var, "bad-pin-sound")) {
-			bad_pin_sound = val;
-		} else if (!strcasecmp(var, "energy-level")) {
-			energy_level = val;
-		} else if (!strcasecmp(var, "caller-id-name")) {
-			caller_id_name = val;
-		} else if (!strcasecmp(var, "caller-id-number")) {
-			caller_id_number = val;
-		} else if (!strcasecmp(var, "caller-controls")) {
-			caller_controls = val;
-		}
-	}
+        if (!strcasecmp(var, "rate")) {
+            rate_name = val;
+        } else if (!strcasecmp(var, "domain")) {
+            domain = val;
+        } else if (!strcasecmp(var, "interval")) {
+            interval_name = val;
+        } else if (!strcasecmp(var, "timer-name")) {
+            timer_name = val;
+        } else if (!strcasecmp(var, "tts-engine")) {
+            tts_engine = val;
+        } else if (!strcasecmp(var, "tts-voice")) {
+            tts_voice = val;
+        } else if (!strcasecmp(var, "enter-sound")) {
+            enter_sound = val;
+        } else if (!strcasecmp(var, "exit-sound")) {
+            exit_sound = val;
+        } else if (!strcasecmp(var, "alone-sound")) {
+            alone_sound = val;
+        } else if (!strcasecmp(var, "ack-sound")) {
+            ack_sound = val;
+        } else if (!strcasecmp(var, "nack-sound")) {
+            nack_sound = val;
+        } else if (!strcasecmp(var, "muted-sound")) {
+            muted_sound = val;
+        } else if (!strcasecmp(var, "unmuted-sound")) {
+            unmuted_sound = val;
+        } else if (!strcasecmp(var, "locked-sound")) {
+            locked_sound = val;
+        } else if (!strcasecmp(var, "kicked-sound")) {
+            kicked_sound = val;
+        } else if (!strcasecmp(var, "pin")) {
+            pin = val;
+        } else if (!strcasecmp(var, "pin-sound")) {
+            pin_sound = val;
+        } else if (!strcasecmp(var, "bad-pin-sound")) {
+            bad_pin_sound = val;
+        } else if (!strcasecmp(var, "energy-level")) {
+            energy_level = val;
+        } else if (!strcasecmp(var, "caller-id-name")) {
+            caller_id_name = val;
+        } else if (!strcasecmp(var, "caller-id-number")) {
+            caller_id_number = val;
+        } else if (!strcasecmp(var, "caller-controls")) {
+            caller_controls = val;
+        }
+    }
 
-	/* Set defaults and various paramaters */
+    /* Set defaults and various paramaters */
 
-	/* Speed in hertz */
-	if (!switch_strlen_zero(rate_name)) {
-		uint32_t r = atoi(rate_name);
-		if (r) {
-			rate = r;
-		}
-	}
+    /* Speed in hertz */
+    if (!switch_strlen_zero(rate_name)) {
+        uint32_t r = atoi(rate_name);
+        if (r) {
+            rate = r;
+        }
+    }
 
-	/* Packet Interval in milliseconds */
-	if (!switch_strlen_zero(interval_name)) {
-		uint32_t i = atoi(interval_name);
-		if (i) {
-			interval = i;
-		}
-	}
+    /* Packet Interval in milliseconds */
+    if (!switch_strlen_zero(interval_name)) {
+        uint32_t i = atoi(interval_name);
+        if (i) {
+            interval = i;
+        }
+    }
 
-	/* Timer module to use */
-	if (switch_strlen_zero(timer_name)) {
-		timer_name = "soft";
-	}
+    /* Timer module to use */
+    if (switch_strlen_zero(timer_name)) {
+        timer_name = "soft";
+    }
 
-	/* Caller ID Name */
-	if (switch_strlen_zero(caller_id_name)) {
-		caller_id_name = (char *) global_app_name;
-	}
+    /* Caller ID Name */
+    if (switch_strlen_zero(caller_id_name)) {
+        caller_id_name = (char *) global_app_name;
+    }
 
-	/* Caller ID Number */
-	if (switch_strlen_zero(caller_id_number)) {
-		caller_id_number = "0000000000";
-	}
+    /* Caller ID Number */
+    if (switch_strlen_zero(caller_id_number)) {
+        caller_id_number = "0000000000";
+    }
 
-	if (!pool) {
-		/* Setup a memory pool to use. */
-		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-			status = SWITCH_STATUS_TERM;
-			return NULL;
-		}
-	}
+    if (!pool) {
+        /* Setup a memory pool to use. */
+        if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+            status = SWITCH_STATUS_TERM;
+            return NULL;
+        }
+    }
 
-	/* Create the conference object. */
-	if (!(conference = switch_core_alloc(pool, sizeof(*conference)))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-		status = SWITCH_STATUS_TERM;
-		return NULL;
-	}
+    /* Create the conference object. */
+    if (!(conference = switch_core_alloc(pool, sizeof(*conference)))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+        status = SWITCH_STATUS_TERM;
+        return NULL;
+    }
 
-	/* initialize the conference object with settings from the specified profile */
-	conference->pool = pool;
-	conference->timer_name = switch_core_strdup(conference->pool, timer_name);
-	conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
-	conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
+    /* initialize the conference object with settings from the specified profile */
+    conference->pool = pool;
+    conference->timer_name = switch_core_strdup(conference->pool, timer_name);
+    conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
+    conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
 
-	conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
-	conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
+    conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
+    conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
 
-	if (!switch_strlen_zero(enter_sound)) {
-		conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
-	}
+    if (!switch_strlen_zero(enter_sound)) {
+        conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
+    }
 
-	if (!switch_strlen_zero(exit_sound)) {
-		conference->exit_sound = switch_core_strdup(conference->pool, exit_sound);
-	}
+    if (!switch_strlen_zero(exit_sound)) {
+        conference->exit_sound = switch_core_strdup(conference->pool, exit_sound);
+    }
 
-	if (!switch_strlen_zero(ack_sound)) {
-		conference->ack_sound = switch_core_strdup(conference->pool, ack_sound);
-	}
+    if (!switch_strlen_zero(ack_sound)) {
+        conference->ack_sound = switch_core_strdup(conference->pool, ack_sound);
+    }
 
-	if (!switch_strlen_zero(nack_sound)) {
-		conference->nack_sound = switch_core_strdup(conference->pool, nack_sound);
-	}
+    if (!switch_strlen_zero(nack_sound)) {
+        conference->nack_sound = switch_core_strdup(conference->pool, nack_sound);
+    }
 
-	if (!switch_strlen_zero(muted_sound)) {
-		conference->muted_sound = switch_core_strdup(conference->pool, muted_sound);
-	}
+    if (!switch_strlen_zero(muted_sound)) {
+        conference->muted_sound = switch_core_strdup(conference->pool, muted_sound);
+    }
 
-	if (!switch_strlen_zero(unmuted_sound)) {
-		conference->unmuted_sound = switch_core_strdup(conference->pool, unmuted_sound);
-	}
+    if (!switch_strlen_zero(unmuted_sound)) {
+        conference->unmuted_sound = switch_core_strdup(conference->pool, unmuted_sound);
+    }
 
-	if (!switch_strlen_zero(kicked_sound)) {
-		conference->kicked_sound = switch_core_strdup(conference->pool, kicked_sound);
-	}
+    if (!switch_strlen_zero(kicked_sound)) {
+        conference->kicked_sound = switch_core_strdup(conference->pool, kicked_sound);
+    }
 
-	if (!switch_strlen_zero(pin_sound)) {
-		conference->pin_sound = switch_core_strdup(conference->pool, pin_sound);
-	}
+    if (!switch_strlen_zero(pin_sound)) {
+        conference->pin_sound = switch_core_strdup(conference->pool, pin_sound);
+    }
 
-	if (!switch_strlen_zero(bad_pin_sound)) {
-		conference->bad_pin_sound = switch_core_strdup(conference->pool, bad_pin_sound);
-	}
+    if (!switch_strlen_zero(bad_pin_sound)) {
+        conference->bad_pin_sound = switch_core_strdup(conference->pool, bad_pin_sound);
+    }
 
-	if (!switch_strlen_zero(pin)) {
-		conference->pin = switch_core_strdup(conference->pool, pin);
-	}
+    if (!switch_strlen_zero(pin)) {
+        conference->pin = switch_core_strdup(conference->pool, pin);
+    }
 
-	if (!switch_strlen_zero(alone_sound)) {
-		conference->alone_sound = switch_core_strdup(conference->pool, alone_sound);
-	} 
+    if (!switch_strlen_zero(alone_sound)) {
+        conference->alone_sound = switch_core_strdup(conference->pool, alone_sound);
+    } 
 
-	if (!switch_strlen_zero(locked_sound)) {
-		conference->locked_sound = switch_core_strdup(conference->pool, locked_sound);
-	}
+    if (!switch_strlen_zero(locked_sound)) {
+        conference->locked_sound = switch_core_strdup(conference->pool, locked_sound);
+    }
 
-	if (!switch_strlen_zero(energy_level)) {
-		conference->energy_level = atoi(energy_level);
-	}
+    if (!switch_strlen_zero(energy_level)) {
+        conference->energy_level = atoi(energy_level);
+    }
 
-	conference->name = switch_core_strdup(conference->pool, name);
-	if (domain) {
-		conference->domain = switch_core_strdup(conference->pool, domain);
-	} else {
-		conference->domain = "cluecon.com";
-	}
-	conference->rate = rate;
-	conference->interval = interval;
-	conference->dtmf_parser = NULL;
+    conference->name = switch_core_strdup(conference->pool, name);
+    if (domain) {
+        conference->domain = switch_core_strdup(conference->pool, domain);
+    } else {
+        conference->domain = "cluecon.com";
+    }
+    conference->rate = rate;
+    conference->interval = interval;
+    conference->dtmf_parser = NULL;
 
-	/* caller control configuration chores */
-	if(switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
+    /* caller control configuration chores */
+    if (switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
 
-		/* if no controls, or default controls specified, install default */
-		if (caller_controls == NULL || *caller_controls == '\0' || strcasecmp(caller_controls, "default") == 0) {
-			status = conference_new_install_caller_controls_default(conference);
-		} else if (strcasecmp(caller_controls,"none") != 0) {
-		/* try to build caller control if the group has been specified and != "none" */
-			switch_xml_t xml_controls = switch_xml_find_child(cfg.controls, "group", "name", caller_controls);
+        /* if no controls, or default controls specified, install default */
+        if (caller_controls == NULL || *caller_controls == '\0' || strcasecmp(caller_controls, "default") == 0) {
+            status = conf_default_controls(conference);
+        } else if (strcasecmp(caller_controls, "none") != 0) {
+            /* try to build caller control if the group has been specified and != "none" */
+            switch_xml_t xml_controls = switch_xml_find_child(cfg.controls, "group", "name", caller_controls);
 #ifdef OPTION_IVR_MENU_SUPPORT
-			status = conference_new_install_caller_controls_custom(conference, xml_controls, cfg.menus);
+            status = conference_new_install_caller_controls_custom(conference, xml_controls, cfg.menus);
 #else
-			status = conference_new_install_caller_controls_custom(conference, xml_controls, NULL);
+            status = conference_new_install_caller_controls_custom(conference, xml_controls, NULL);
 #endif
-			if (status != SWITCH_STATUS_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to install caller controls group '%s'\n",caller_controls);
-			}
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "no caller controls intalled.\n");
-		}
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n");
-	}
+            if (status != SWITCH_STATUS_SUCCESS) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to install caller controls group '%s'\n", caller_controls);
+            }
+        } else {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "no caller controls intalled.\n");
+        }
+    } else {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n");
+    }
 
-	/* Activate the conference mutex for exclusivity */
-	switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
-	switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
-	switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
-	switch_thread_rwlock_create(&conference->rwlock, conference->pool);
+    /* Activate the conference mutex for exclusivity */
+    switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
+    switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
+    switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
+    switch_thread_rwlock_create(&conference->rwlock, conference->pool);
 
-	return conference;
+    return conference;
 }
 
 static void pres_event_handler(switch_event_t *event) 
 { 
-	char *to = switch_event_get_header(event, "to"); 
-	char *dup_to = NULL, *conf_name, *e; 
-	conference_obj_t *conference; 
+    char *to = switch_event_get_header(event, "to"); 
+    char *dup_to = NULL, *conf_name, *e; 
+    conference_obj_t *conference; 
 
-	if (!to || strncasecmp(to, "conf+", 5)) { 
-		return; 
-	} 
+    if (!to || strncasecmp(to, "conf+", 5)) { 
+        return; 
+    } 
 
-	if (!(dup_to = strdup(to))) { 
-		return; 
-	} 
+    if (!(dup_to = strdup(to))) { 
+        return; 
+    } 
 
-	conf_name = dup_to + 5; 
+    conf_name = dup_to + 5; 
 
-	if ((e = strchr(conf_name, '@'))) { 
-		*e = '\0'; 
-	} 
+    if ((e = strchr(conf_name, '@'))) { 
+        *e = '\0'; 
+    } 
 
-	if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) { 
-		switch_event_t *event; 
+    if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) { 
+        switch_event_t *event; 
 
-	if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name); 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain); 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s"); 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); 
-		switch_event_fire(&event); 
-		} 
-	} else if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conf_name); 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to); 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle"); 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle"); 
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); 
-		switch_event_fire(&event); 
-	} 
+        if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { 
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); 
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name); 
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain); 
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s"); 
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); 
+            switch_event_fire(&event); 
+        } 
+    } else if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { 
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); 
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conf_name); 
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to); 
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle"); 
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle"); 
+        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); 
+        switch_event_fire(&event); 
+    } 
 
     switch_safe_free(dup_to); 
 } 
  
 static void send_presence(switch_event_types_t id) 
 { 
-	switch_xml_t cxml, cfg, advertise, room; 
+    switch_xml_t cxml, cfg, advertise, room; 
 
-	/* Open the config from the xml registry */ 
-	if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) { 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name); 
-		goto done; 
-	} 
+    /* Open the config from the xml registry */ 
+    if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) { 
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name); 
+        goto done; 
+    } 
 
-	if ((advertise = switch_xml_child(cfg, "advertise"))) { 
-		for (room = switch_xml_child(advertise, "room"); room; room = room->next) { 
-			char *name = (char *) switch_xml_attr_soft(room, "name"); 
-			char *status = (char *) switch_xml_attr_soft(room, "status"); 
-			switch_event_t *event; 
+    if ((advertise = switch_xml_child(cfg, "advertise"))) { 
+        for (room = switch_xml_child(advertise, "room"); room; room = room->next) { 
+            char *name = (char *) switch_xml_attr_soft(room, "name"); 
+            char *status = (char *) switch_xml_attr_soft(room, "status"); 
+            switch_event_t *event; 
 
-			if (name && switch_event_create(&event, id) == SWITCH_STATUS_SUCCESS) { 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", name); 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", name); 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", status ? status : "Available"); 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle"); 
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); 
-				switch_event_fire(&event); 
-			} 
-		} 
-	} 
+            if (name && switch_event_create(&event, id) == SWITCH_STATUS_SUCCESS) { 
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); 
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", name); 
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", name); 
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", status ? status : "Available"); 
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle"); 
+                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); 
+                switch_event_fire(&event); 
+            } 
+        } 
+    } 
 
-	done: 
-	/* Release the config registry handle */ 
-	if (cxml) { 
-		switch_xml_free(cxml); 
-		cxml = NULL; 
-	} 
+ done: 
+    /* Release the config registry handle */ 
+    if (cxml) { 
+        switch_xml_free(cxml); 
+        cxml = NULL; 
+    } 
 } 
 
-	/* Called by FreeSWITCH when the module loads */
+/* Called by FreeSWITCH when the module loads */
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
 {
-	int i;
-	size_t nl,ol=0;
-	char *p = NULL;
-	switch_status_t status = SWITCH_STATUS_SUCCESS;
+    uint32_t i;
+    size_t nl, ol = 0;
+    char *p = NULL;
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	memset(&globals, 0, sizeof(globals));
+    memset(&globals, 0, sizeof(globals));
 
-	/* build api interface help ".syntax" field string */
-	p=strdup("list\n");
-	for (i=0; i<CONFFUNCAPISIZE; i++) {
-		nl=strlen(conf_api_sub_commands[i].psyntax)+4;
-		if(p != NULL)
-			ol = strlen(p);
-		p = realloc(p,ol+nl);
-		if(p != NULL) {
-			strcat(p,"\t\t");
-			strcat(p,conf_api_sub_commands[i].psyntax);
-			if(i<CONFFUNCAPISIZE-1)
-				strcat(p,"\n");
-		}
+    /* build api interface help ".syntax" field string */
+    p = strdup("");
+    for (i = 0; i<CONFFUNCAPISIZE; i++) {
+        nl = strlen(conf_api_sub_commands[i].psyntax) + 4;
+        if (p != NULL) {
+            ol = strlen(p);
+        }
+        p = realloc(p, ol+nl);
+        if (p != NULL) {
+            strcat(p, "\t\t");
+            strcat(p, conf_api_sub_commands[i].psyntax);
+            if (i < CONFFUNCAPISIZE-1) {
+                strcat(p, "\n");
+            }
+        }
 		
-	}
-	/* install api interface help ".syntax" field string */
-	if(p != NULL)
-		conf_api_interface.syntax = p;
+    }
+    /* install api interface help ".syntax" field string */
+    if (p != NULL) {
+        conf_api_interface.syntax = p;
+    }
 
-	/* Connect my internal structure to the blank pointer passed to me */
-	*module_interface = &conference_module_interface;
+    /* Connect my internal structure to the blank pointer passed to me */
+    *module_interface = &conference_module_interface;
 
-	/* create/register custom event message type */
-	if (switch_event_reserve_subclass(CONF_EVENT_MAINT) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", CONF_EVENT_MAINT);
-		return SWITCH_STATUS_TERM;
-	}
+    /* create/register custom event message type */
+    if (switch_event_reserve_subclass(CONF_EVENT_MAINT) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", CONF_EVENT_MAINT);
+        return SWITCH_STATUS_TERM;
+    }
 
-	/* Setup the pool */
-	if (switch_core_new_memory_pool(&globals.conference_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no conference pool\n");
-		return SWITCH_STATUS_TERM;
-	}
+    /* Setup the pool */
+    if (switch_core_new_memory_pool(&globals.conference_pool) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no conference pool\n");
+        return SWITCH_STATUS_TERM;
+    }
 
-	/* Setup a hash to store conferences by name */
-	switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
-	switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
-	switch_mutex_init(&globals.id_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
-	switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+    /* Setup a hash to store conferences by name */
+    switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
+    switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+    switch_mutex_init(&globals.id_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+    switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
 
-	/* Subscribe to presence request events */
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
-		return SWITCH_STATUS_GENERR;
-	}
+    /* Subscribe to presence request events */
+    if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
+        return SWITCH_STATUS_GENERR;
+    }
 
-	send_presence(SWITCH_EVENT_PRESENCE_IN);
+    send_presence(SWITCH_EVENT_PRESENCE_IN);
 
-	globals.running = 1;
-	/* indicate that the module should continue to be loaded */
-	return status;
+    globals.running = 1;
+    /* indicate that the module should continue to be loaded */
+    return status;
 }
 
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
 {
+    if (globals.running) {
 
+        /* signal all threads to shutdown */
+        globals.running = 0;
 
-	if (globals.running) {
-		/* signal all threads to shutdown */
-		globals.running = 0;
-		/* wait for all threads */
-		while (globals.threads) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for %d threads\n", globals.threads);
-			switch_yield(100000);
-		}
+        /* wait for all threads */
+        while (globals.threads) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for %d threads\n", globals.threads);
+            switch_yield(100000);
+        }
 
-		/* free api interface help ".syntax" field string */
-		if (conf_api_interface.syntax != NULL)
-			free((char *)conf_api_interface.syntax);
-	}
+        /* free api interface help ".syntax" field string */
+        if (conf_api_interface.syntax != NULL) {
+            free((char *)conf_api_interface.syntax);
+        }
+    }
 
-	return SWITCH_STATUS_SUCCESS;
+    return SWITCH_STATUS_SUCCESS;
 }
 
 /* For Emacs:
@@ -4447,5 +4538,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop = 4 shiftwidth = 4 tabstop = 4 expandtab:
  */

Modified: freeswitch/branches/knhor/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	Sat Dec 23 00:27:43 2006
@@ -150,11 +150,19 @@
 		for (xaction = switch_xml_child(xcond, "action"); xaction; xaction = xaction->next) {
 			char *application = (char*) switch_xml_attr_soft(xaction, "application");
 			char *data = (char *) switch_xml_attr_soft(xaction, "data");
-			char substituted[1024] = "";
+			char *substituted = NULL;
+            uint32_t len = 0;
 			char *app_data = NULL;
 
 			if (field && strchr(expression, '(')) {
-				switch_perform_substitution(re, proceed, data, field_data, substituted, sizeof(substituted), ovector);
+                len = (uint32_t)(strlen(data) + strlen(field_data) + 10);
+                if (!(substituted = malloc(len))) {
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
+                    proceed = 0;
+                    goto done;
+                }
+                memset(substituted, 0, len);
+				switch_perform_substitution(re, proceed, data, field_data, substituted, len, ovector);
 				app_data = substituted;
 			} else {
 				app_data = data;
@@ -170,6 +178,7 @@
 			}
 
 			switch_caller_extension_add_application(session, *extension, application, app_data);
+            switch_safe_free(substituted);
 		}
         
 		switch_clean_re(re);

Modified: freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Sat Dec 23 00:27:43 2006
@@ -1280,17 +1280,19 @@
 		}
 
 		if (tech_pvt->read_frame.datalen > 0) {
-			if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
-				bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
-				frames = (tech_pvt->read_frame.datalen / bytes);
-			} else {
-				frames = 1;
-			}
-			samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
-			ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame;
-			tech_pvt->timestamp_recv += (int32_t) samples;
-			tech_pvt->read_frame.samples = (int) samples;
-			tech_pvt->last_read = tech_pvt->read_frame.datalen;
+            if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
+                if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame && bytes) {
+                    bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+                    frames = (tech_pvt->read_frame.datalen / bytes);
+                } else {
+                    frames = 1;
+                }
+                samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
+                ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame;
+                tech_pvt->timestamp_recv += (int32_t) samples;
+                tech_pvt->read_frame.samples = (int) samples;
+                tech_pvt->last_read = tech_pvt->read_frame.datalen;
+            }
 			break;
 		}
 

Modified: freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Sat Dec 23 00:27:43 2006
@@ -1614,9 +1614,12 @@
                 size_t bytes = 0;
                 int frames = 0;
 				//tech_pvt->last_read = switch_time_now();
-                bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
-                frames = (tech_pvt->read_frame.datalen / bytes);
-				tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame);
+                if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
+                    if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame)) {
+                        frames = (tech_pvt->read_frame.datalen / bytes);
+                        tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame);
+                    }
+                }
 				break;
 			}
 		}

Modified: freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Sat Dec 23 00:27:43 2006
@@ -415,7 +415,9 @@
 
 	if (stream.data) {
 		if (switch_api_execute(acs->api_cmd, acs->arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
-
+            if (!stream.data) {
+                stream.write_function(&stream, "Command returned no output!\n");
+            }
 			if (acs->bg) {
 				switch_event_t *event;
 

Modified: freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj	Sat Dec 23 00:27:43 2006
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel-1.2\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel\include&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -126,7 +126,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel-1.2\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel\include&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"

Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Sat Dec 23 00:27:43 2006
@@ -1592,7 +1592,7 @@
 /*********************************************************************************/
 enum session_tinyid {
 	SESSION_NAME, SESSION_STATE,
-	PROFILE_DIALPLAN, PROFILE_CID_NAME, PROFILE_CID_NUM, PROFILE_IP, PROFILE_ANI, PROFILE_ANI_II, PROFILE_DEST
+	PROFILE_DIALPLAN, PROFILE_CID_NAME, PROFILE_CID_NUM, PROFILE_IP, PROFILE_ANI, PROFILE_ANI_II, PROFILE_DEST, SESSION_UUID
 };
 
 static JSFunctionSpec session_methods[] = {
@@ -1627,6 +1627,7 @@
 	{"ani", PROFILE_ANI, JSPROP_READONLY|JSPROP_PERMANENT}, 
 	{"aniii", PROFILE_ANI_II, JSPROP_READONLY|JSPROP_PERMANENT}, 
 	{"destination", PROFILE_DEST, JSPROP_READONLY|JSPROP_PERMANENT}, 
+	{"uuid", SESSION_UUID, JSPROP_READONLY|JSPROP_PERMANENT}, 
 	{0}
 };
 
@@ -1660,6 +1661,9 @@
 	case SESSION_NAME:
 		*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_get_name(channel)));
 		break;
+	case SESSION_UUID:
+		*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_get_uuid(channel)));
+		break;
 	case SESSION_STATE:
 		*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_state_name(switch_channel_get_state(channel))));
 		break;
@@ -2254,7 +2258,9 @@
 	JS_DefineFunctions(cx, javascript_object, fs_functions);
 
 	JS_InitStandardClasses(cx, javascript_object);
-				
+
+    /* this doesnt load in standard classes figure out wtf */
+    js_InitFileClass(cx, javascript_object);
 
 	JS_InitClass(cx,
 				 javascript_object,

Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c	Sat Dec 23 00:27:43 2006
@@ -223,7 +223,7 @@
 	{0}
 };
 
-switch_status_t spidermonkey_load(JSContext *cx, JSObject *obj)
+switch_status_t etpan_load(JSContext *cx, JSObject *obj)
 {
 	JS_DefineFunctions(cx, obj, etpan_functions);
 
@@ -244,7 +244,7 @@
 
 const sm_module_interface_t etpan_module_interface = {
 	/*.name = */ modname,
-	/*.spidermonkey_load*/ spidermonkey_load,
+	/*.spidermonkey_load*/ etpan_load,
 	/*.next*/ NULL
 };
 

Modified: freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c	Sat Dec 23 00:27:43 2006
@@ -30,46 +30,84 @@
  */
 #include <switch.h>
 #include <math.h>
+#include <ctype.h>
 
 static const char modname[] = "mod_say_en";
 
-typedef struct {
-	switch_core_session_t *session;
-	switch_input_callback_function_t input_callback;
-	void *buf;
-	uint32_t buflen;
-} common_args_t;
 
-static void play_group(int a, int b, int c, char *what, common_args_t *args)
+#define say_num(num) {\
+		char tmp[80];\
+		switch_status_t status;\
+		snprintf(tmp, sizeof(tmp), "%u", (unsigned)num);				\
+	if ((status = en_say_general_count(session, tmp, SST_ITEMS, SSM_PRONOUNCED, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {\
+		return status;\
+	}}\
+
+#define say_file(...) {\
+		char tmp[80];\
+		snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
+		switch_ivr_play_file(session, NULL, tmp, NULL, input_callback, buf, buflen); \
+		if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
+			return SWITCH_STATUS_FALSE;\
+		}}\
+
+
+
+static switch_status_t en_spell(switch_core_session_t *session,
+								   char *tosay,
+								   switch_say_type_t type,
+								   switch_say_method_t method,
+								   switch_input_callback_function_t input_callback,
+								   void *buf,
+								   uint32_t buflen)
 {
-	char tmp[80] = "";
+	char *p;
 
+	for(p = tosay; p && *p; p++) {
+		int a = tolower((int) *p);
+		if (type == SST_NAME_SPELLED) {
+			say_file("ascii/%d.wav", a);
+		} else if (type == SST_NAME_PHONETIC) {
+			say_file("phonetic-ascii/%d.wav", a);
+		}
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t play_group(int a,
+								  int b,
+								  int c,
+								  char *what,
+								  switch_core_session_t *session,
+								  switch_input_callback_function_t input_callback,
+								  void *buf,
+								  uint32_t buflen)
+{
+
 	if (a) {
-		snprintf(tmp, sizeof(tmp), "digits/%d.wav", a);
-		switch_ivr_play_file(args->session, NULL, tmp, NULL, args->input_callback, args->buf, args->buflen);
-		switch_ivr_play_file(args->session, NULL, "digits/hundred.wav", NULL, args->input_callback, args->buf, args->buflen);
+		say_file("digits/%d.wav", a);
+		say_file("digits/hundred.wav");
 	}
 
 	if (b) {
 		if (b > 1) {
-			snprintf(tmp, sizeof(tmp), "digits/%d0.wav", b);
-			switch_ivr_play_file(args->session, NULL, tmp, NULL, args->input_callback, args->buf, args->buflen);
+			say_file("digits/%d0.wav", b);
 		} else {
-			snprintf(tmp, sizeof(tmp), "digits/%d%d.wav", b, c);
-			switch_ivr_play_file(args->session, NULL, tmp, NULL, args->input_callback, args->buf, args->buflen);
+			say_file("digits/%d%d.wav", b, c);
 			c = 0;
 		}
 	}
 
 	if (c) {
-		snprintf(tmp, sizeof(tmp), "digits/%d.wav", c);
-		switch_ivr_play_file(args->session, NULL, tmp, NULL, args->input_callback, args->buf, args->buflen);
+		say_file("digits/%d.wav", c);
 	}
 
 	if (what && (a || b || c)) {
-		switch_ivr_play_file(args->session, NULL, what, NULL, args->input_callback, args->buf, args->buflen);
+		say_file(what);
 	}
 
+	return SWITCH_STATUS_SUCCESS;
 }
 					   
 static char *strip_commas(char *in, char *out, switch_size_t len)
@@ -106,19 +144,13 @@
 	switch_channel_t *channel;
 	int in;
 	int x = 0, places[9] = {0};
-	char tmp[80] = "";
 	char sbuf[13] = "";
-	common_args_t args = {0};
-
+	switch_status_t status;
+	
 	assert(session != NULL);
 	channel = switch_core_session_get_channel(session);
 	assert(channel != NULL);
 			
-	args.session = session;
-	args.input_callback = input_callback;
-	args.buf = buf;
-	args.buflen = buflen;
-	
 	if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
 		return SWITCH_STATUS_GENERR;
@@ -135,15 +167,20 @@
 
 	switch (method) {
 	case SSM_PRONOUNCED:
-		play_group(places[8], places[7], places[6], "digits/million.wav", &args);
-		play_group(places[5], places[4], places[3], "digits/thousand.wav", &args);
-		play_group(places[2], places[1], places[0], NULL, &args);
+		if ((status = play_group(places[8], places[7], places[6], "digits/million.wav", session, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {
+			return status;
+		}
+		if ((status = play_group(places[5], places[4], places[3], "digits/thousand.wav", session, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {
+			return status;
+		}
+		if ((status = play_group(places[2], places[1], places[0], NULL, session, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {
+			return status;
+		}
 		break;
 	case SSM_ITERATED:
 		for(x = 8; x >= 0; x--) {
 			if (places[x]) {
-				snprintf(tmp, sizeof(tmp), "digits/%d.wav", places[x]);
-				switch_ivr_play_file(session, NULL, tmp, NULL, input_callback, buf, buflen);
+				say_file("digits/%d.wav", places[x]);
 			}
 		}
 		break;
@@ -153,6 +190,138 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
+static switch_status_t en_say_time(switch_core_session_t *session,
+								   char *tosay,
+								   switch_say_type_t type,
+								   switch_say_method_t method,
+								   switch_input_callback_function_t input_callback,
+								   void *buf,
+								   uint32_t buflen)
+{
+	int32_t t;
+	switch_time_t target = 0;
+	switch_time_exp_t tm;
+	uint8_t say_date = 0, say_time = 0;
+	
+	if (type == SST_TIME_MEASUREMENT) {
+		int64_t hours = 0;
+		int64_t minutes = 0;
+		int64_t seconds = 0;
+		int64_t r = 0;
+
+		if (strchr(tosay, ':')) {
+			char *tme = switch_core_session_strdup(session, tosay);
+			char *p;
+			
+			if ((p = strrchr(tme, ':'))) {
+				*p++ = '\0';
+				seconds = atoi(p);
+				if ((p = strrchr(tme, ':'))) {
+					*p++ = '\0';
+					minutes = atoi(p);
+					if (tme) {
+						hours = atoi(tme);
+					}
+				}
+			}
+		} else {
+			if ((seconds = atoi(tosay)) <= 0) {
+				seconds = (int64_t) time(NULL);
+			}
+
+			if (seconds >= 60) {
+				minutes = seconds / 60;
+				r = seconds % 60;
+				seconds = r;
+			}
+			
+			if (minutes >= 60) {
+				hours = minutes / 60;
+				r = minutes % 60;
+				minutes = r;
+			}
+		}
+
+		if (hours) {
+			say_num(hours);
+			say_file("digits/hours.wav");
+		}
+
+		if (minutes) {
+			say_num(minutes);
+			say_file("digits/minutes.wav");
+		}
+
+		if (seconds) {
+			say_num(seconds);
+			say_file("digits/seconds.wav");
+		}
+
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if ((t = atoi(tosay)) > 0) {
+		target = switch_time_make(t, 0);
+	} else {
+		target = switch_time_now();
+	}
+	switch_time_exp_lt(&tm, target);
+	
+	switch(type) {
+	case SST_CURRENT_DATE_TIME:
+		say_date = say_time = 1;
+		break;
+	case SST_CURRENT_DATE:
+		say_date = 1;
+		break;
+	case SST_CURRENT_TIME:
+		say_time = 1;
+		break;
+	default:
+		break;
+	}
+
+	if (say_date) {
+		say_file("digits/day-%d.wav", tm.tm_wday);
+		say_file("digits/mon-%d.wav", tm.tm_mon);
+		say_num(tm.tm_mday);
+		say_num(tm.tm_year + 1900);
+	}
+
+	if (say_time) {
+		int32_t hour = tm.tm_hour, pm = 0;
+		
+		if (hour > 12) {
+			hour -= 12;
+            pm = 1;
+		} else if (hour == 12) {
+			pm = 1;
+		} else if (hour == 0) {
+			hour = 12;
+			pm = 0;
+		}
+
+		say_num(hour);
+
+		if (tm.tm_min > 9) {
+			say_num(tm.tm_min);
+		} else if (tm.tm_min) {
+			say_file("digits/oh.wav");
+			say_num(tm.tm_min);
+		} else {
+			say_file("digits/oclock.wav");
+		}
+
+		say_file("digits/%s.wav", pm ? "p-m" : "a-m");
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+
+
 static switch_status_t en_say(switch_core_session_t *session,
 							  char *tosay,
 							  switch_say_type_t type,
@@ -170,6 +339,16 @@
 	case SST_PERSONS:
 	case SST_MESSAGES:
 		say_cb = en_say_general_count;
+		break;
+	case SST_TIME_MEASUREMENT:
+	case SST_CURRENT_DATE:
+	case SST_CURRENT_TIME:
+	case SST_CURRENT_DATE_TIME:
+		say_cb = en_say_time;
+		break;
+	case SST_NAME_SPELLED:
+	case SST_NAME_PHONETIC:
+		say_cb = en_spell;
 		break;
 	default:
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Finish ME!\n");

Modified: freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj	Sat Dec 23 00:27:43 2006
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlcurl-c-1.03.14\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlcurl-c-1.03.14&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\curl\include&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -125,7 +125,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlcurl-c-1.03.14\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlcurl-c-1.03.14&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\curl\include&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"

Modified: freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj	Sat Dec 23 00:27:43 2006
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\curl\include&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -125,7 +125,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\curl\include&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"

Modified: freeswitch/branches/knhor/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/switch_ivr.c	(original)
+++ freeswitch/branches/knhor/trunk/src/switch_ivr.c	Sat Dec 23 00:27:43 2006
@@ -338,7 +338,7 @@
 {
 	switch_channel_t *channel;
     char dtmf[128];
-	switch_file_handle_t lfh;
+	switch_file_handle_t lfh = {0};
 	switch_frame_t *read_frame;
 	switch_codec_t codec, *read_codec;
 	char *codec_name;
@@ -346,11 +346,11 @@
 	char *p;
 	const char *vval;
     time_t start = 0;
+	uint32_t org_silence_hits = 0;
 
 	if (!fh) {
 		fh = &lfh;
 	}
-	memset(fh, 0, sizeof(*fh));
 
 	channel = switch_core_session_get_channel(session);
     assert(channel != NULL);
@@ -433,10 +433,13 @@
     }
 
     if (fh->thresh) {
-        if (!fh->silence_hits) {
-            fh->silence_hits = 20;
+        if (fh->silence_hits) {
+			fh->silence_hits = fh->samplerate * fh->silence_hits / read_codec->implementation->samples_per_frame;
+		} else {
+            fh->silence_hits = fh->samplerate * 3 / read_codec->implementation->samples_per_frame;
         }
-    }
+		org_silence_hits = fh->silence_hits;
+	}
 
 	while(switch_channel_ready(channel)) {
 		switch_size_t len;
@@ -504,7 +507,9 @@
                 if (!--fh->silence_hits) {
                     break;
                 }
-            }
+			} else {
+				fh->silence_hits = org_silence_hits;
+			}
         }
 
 		if (!switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
@@ -4488,17 +4493,26 @@
         if (pattern) {
             pcre *re = NULL;
             int proceed = 0, ovector[30];
-            char substituted[1024] = "";
+            char *substituted = NULL;
+            uint32_t len = 0;
             char *odata = NULL;
             char *expanded = NULL;
-
+            
             if ((proceed = switch_perform_regex(data, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
                 for (action = switch_xml_child(input, "action"); action; action = action->next) {
                     char *adata = (char *) switch_xml_attr_soft(action, "data");
                     char *func = (char *) switch_xml_attr_soft(action, "function");
 
                     if (strchr(pattern, '(') && strchr(adata, '$')) {
-                        switch_perform_substitution(re, proceed, adata, data, substituted, sizeof(substituted), ovector);
+                        len = (uint32_t)(strlen(data) + strlen(adata) + 10);
+                        if (!(substituted = malloc(len))) {
+                            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
+                            switch_clean_re(re);
+                            switch_safe_free(expanded);
+                            goto done;
+                        }
+                        memset(substituted, 0, len);
+                        switch_perform_substitution(re, proceed, adata, data, substituted, len, ovector);
                         odata = substituted;
                     } else {
                         odata = adata;
@@ -4512,7 +4526,7 @@
                         odata = expanded;
                     }
                     
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Handle %s:[%s] (%s)\n", func, odata, lang);
+                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s:[%s] (%s)\n", func, odata, lang);
 
                     if (!strcasecmp(func, "play-file")) {
                         switch_ivr_play_file(session, NULL, odata, NULL, input_callback, buf, buflen);
@@ -4567,6 +4581,7 @@
 
             switch_clean_re(re);
             switch_safe_free(expanded);
+            switch_safe_free(substituted);
         }
 
         input = input->next;

Modified: freeswitch/branches/knhor/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/switch_rtp.c	(original)
+++ freeswitch/branches/knhor/trunk/src/switch_rtp.c	Sat Dec 23 00:27:43 2006
@@ -467,7 +467,7 @@
 	rtp_session->recv_msg.header.x       = 0;
 	rtp_session->recv_msg.header.cc      = 0;
 
-	rtp_session->seq = rtp_session->send_msg.header.seq;
+	rtp_session->seq = (uint16_t)rtp_session->send_msg.header.seq;
 	rtp_session->payload = payload;
 	rtp_session->ms_per_packet = ms_per_packet;
 	rtp_session->packet_size = packet_size;
@@ -782,7 +782,7 @@
             *flags |= SFF_CNG;
             /* Return a CNG frame */
             *payload_type = SWITCH_RTP_CNG_PAYLOAD;
-            return SWITCH_RTP_CNG_PAYLOAD;
+            return SWITCH_RTP_CNG_PAYLOAD + rtp_header_len;
 		}
 
 		if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
@@ -857,7 +857,7 @@
 				*flags |= SFF_CNG;
 				/* Return a CNG frame */
 				*payload_type = SWITCH_RTP_CNG_PAYLOAD;
-				return SWITCH_RTP_CNG_PAYLOAD;
+				return SWITCH_RTP_CNG_PAYLOAD + rtp_header_len;
 			}
 		}		
 		
@@ -896,7 +896,7 @@
 			if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_GOOGLEHACK) && rtp_session->recv_msg.header.pt == 102) {
 				rtp_session->recv_msg.header.pt = 97;
 			}
-			rtp_session->rseq = ntohs(rtp_session->recv_msg.header.seq);
+			rtp_session->rseq = ntohs((uint16_t)rtp_session->recv_msg.header.seq);
 			rtp_session->rpayload = (switch_payload_t)rtp_session->recv_msg.header.pt;
 		} else {
 			if (rtp_session->recv_msg.header.version == 0 && rtp_session->ice_user) {
@@ -1296,7 +1296,7 @@
 		if (!rtp_session->mini && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_MINI)) {
 			rtp_session->mini++;
 			rtp_session->rpayload = (switch_payload_t)send_msg->header.pt;
-			rtp_session->rseq = ntohs(send_msg->header.seq);
+			rtp_session->rseq = ntohs((uint16_t)send_msg->header.seq);
 		}
 
 	}



More information about the Freeswitch-svn mailing list