[Freeswitch-svn] [commit] r8689 - in freeswitch/trunk/src/mod: applications/mod_commands applications/mod_conference applications/mod_dptools applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_fsv applications/mod_limit applications/mod_rss applications/mod_skel applications/mod_soundtouch applications/mod_voicemail asr_tts/mod_cepstral asr_tts/mod_lumenvox asr_tts/mod_openmrcp codecs/mod_amr codecs/mod_g723_1 codecs/mod_g729 codecs/mod_h26x codecs/mod_ilbc codecs/mod_speex codecs/mod_voipcodecs dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml endpoints/mod_alsa endpoints/mod_dingaling endpoints/mod_iax endpoints/mod_portaudio endpoints/mod_reference endpoints/mod_sofia endpoints/mod_wanpipe endpoints/mod_woomera event_handlers/mod_cdr_csv event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_event_test event_handlers/mod_radius_cdr formats/mod_local_stream formats/mod_shout formats/mod_sndfile formats/mod_tone_stream languages/mod_lua languages/mod_mono languages/mod_perl languages/mod_python languages/mod_spidermonkey languages/mod_spidermonkey_core_db languages/mod_spidermonkey_curl languages/mod_spidermonkey_odbc languages/mod_spidermonkey_skel languages/mod_spidermonkey_socket languages/mod_spidermonkey_teletone loggers/mod_console loggers/mod_logfile loggers/mod_syslog say/mod_say_de say/mod_say_en say/mod_say_es say/mod_say_fr say/mod_say_it say/mod_say_nl say/mod_say_zh xml_int/mod_xml_cdr xml_int/mod_xml_curl xml_int/mod_xml_ldap xml_int/mod_xml_rpc

Freeswitch SVN anthm at freeswitch.org
Tue May 27 00:54:52 EDT 2008


Author: anthm
Date: Tue May 27 00:54:52 2008
New Revision: 8689

Modified:
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
   freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
   freeswitch/trunk/src/mod/applications/mod_expr/expreval.c
   freeswitch/trunk/src/mod/applications/mod_expr/exprfunc.c
   freeswitch/trunk/src/mod/applications/mod_expr/exprinit.c
   freeswitch/trunk/src/mod/applications/mod_expr/exprmem.c
   freeswitch/trunk/src/mod/applications/mod_expr/exprobj.c
   freeswitch/trunk/src/mod/applications/mod_expr/exprpars.c
   freeswitch/trunk/src/mod/applications/mod_expr/exprutil.c
   freeswitch/trunk/src/mod/applications/mod_expr/exprval.c
   freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c
   freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
   freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c
   freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
   freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
   freeswitch/trunk/src/mod/applications/mod_skel/mod_skel.c
   freeswitch/trunk/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
   freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
   freeswitch/trunk/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp
   freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
   freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c
   freeswitch/trunk/src/mod/codecs/mod_g723_1/mod_g723_1.c
   freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c
   freeswitch/trunk/src/mod/codecs/mod_h26x/mod_h26x.c
   freeswitch/trunk/src/mod/codecs/mod_ilbc/mod_ilbc.c
   freeswitch/trunk/src/mod/codecs/mod_speex/mod_speex.c
   freeswitch/trunk/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c
   freeswitch/trunk/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
   freeswitch/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
   freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
   freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/iax-mutex.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/iax.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/iax2-parser.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/jitterbuf.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/md5.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
   freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
   freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c
   freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
   freeswitch/trunk/src/mod/endpoints/mod_wanpipe/lib_api.c
   freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
   freeswitch/trunk/src/mod/endpoints/mod_wanpipe/ss7boost_client.c
   freeswitch/trunk/src/mod/endpoints/mod_wanpipe/testapp.c
   freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
   freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
   freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
   freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
   freeswitch/trunk/src/mod/event_handlers/mod_event_test/mod_event_test.c
   freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
   freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
   freeswitch/trunk/src/mod/formats/mod_shout/layer3.c
   freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
   freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c
   freeswitch/trunk/src/mod/formats/mod_tone_stream/mod_tone_stream.c
   freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
   freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp
   freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_extra.c
   freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp
   freeswitch/trunk/src/mod/languages/mod_mono/freeswitch_mono.cpp
   freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.cpp
   freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
   freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
   freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.c
   freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
   freeswitch/trunk/src/mod/languages/mod_perl/perlxsi.c
   freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
   freeswitch/trunk/src/mod/languages/mod_python/mod_python.c
   freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
   freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
   freeswitch/trunk/src/mod/loggers/mod_console/mod_console.c
   freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c
   freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c
   freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c
   freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
   freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c
   freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
   freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c
   freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
   freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c
   freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
   freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
   freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c
   freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c

Log:
indent pass 2

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Tue May 27 00:54:52 2008
@@ -43,7 +43,7 @@
 
 SWITCH_STANDARD_API(user_data_function)
 {
-	switch_xml_t x_domain, xml = NULL, x_user = NULL, x_param, x_params;	
+	switch_xml_t x_domain, xml = NULL, x_user = NULL, x_param, x_params;
 	int argc;
 	char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *user, *domain;
 	char delim = ' ';
@@ -94,7 +94,7 @@
 		}
 	}
 
-end:
+  end:
 	switch_xml_free(xml);
 	free(mydata);
 	switch_event_destroy(&params);
@@ -115,7 +115,7 @@
 	const char *err = NULL;
 
 	if (stream->param_event && (host = switch_event_get_header(stream->param_event, "http-host"))) {
-		stream->write_function(stream,  "Content-Type: text/xml\r\n\r\n");
+		stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
 		if ((path_info = switch_event_get_header(stream->param_event, "http-path-info"))) {
 			cmd = path_info;
 			delim = '/';
@@ -151,16 +151,16 @@
 		goto end;
 	}
 
-end:
+  end:
 	if (session || tf) {
 		stream->write_function(stream, err ? "false" : "true");
 		switch_xml_free(xml);
 	} else {
 		if (err) {
 			if (host) {
-				stream->write_function(stream,  "<error>%s</error>\n", err);
+				stream->write_function(stream, "<error>%s</error>\n", err);
 			} else {
-				stream->write_function(stream,  "-Error %s\n", err);
+				stream->write_function(stream, "-Error %s\n", err);
 			}
 		}
 
@@ -168,7 +168,7 @@
 			xmlstr = switch_xml_toxml(x_user, SWITCH_FALSE);
 			switch_assert(xmlstr);
 
-			stream->write_function(stream,  "%s", xmlstr);
+			stream->write_function(stream, "%s", xmlstr);
 			free(xmlstr);
 			switch_xml_free(xml);
 		}
@@ -201,7 +201,7 @@
 	const char *err = NULL;
 
 	if (stream->param_event && (host = switch_event_get_header(stream->param_event, "http-host"))) {
-		stream->write_function(stream,  "Content-Type: text/xml\r\n\r\n");
+		stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
 		if ((path_info = switch_event_get_header(stream->param_event, "http-path-info"))) {
 			cmd = path_info;
 			delim = '/';
@@ -243,16 +243,16 @@
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_val", tag_attr_val);
 
 	if (switch_xml_locate(section, tag, tag_attr_name, tag_attr_val, &xml, &obj, params) != SWITCH_STATUS_SUCCESS) {
-		stream->write_function(stream,  "can't find anything\n");
+		stream->write_function(stream, "can't find anything\n");
 		goto end;
 	}
 
-end:
+  end:
 	if (err) {
 		if (host) {
-			stream->write_function(stream,  "<error>%s</error>\n", err);
+			stream->write_function(stream, "<error>%s</error>\n", err);
 		} else {
-			stream->write_function(stream,  "-Error %s\n", err);
+			stream->write_function(stream, "-Error %s\n", err);
 		}
 	}
 
@@ -260,7 +260,7 @@
 		xmlstr = switch_xml_toxml(obj, SWITCH_FALSE);
 		switch_assert(xmlstr);
 
-		stream->write_function(stream,  "%s", xmlstr);
+		stream->write_function(stream, "%s", xmlstr);
 		free(xmlstr);
 		switch_xml_free(xml);
 
@@ -274,11 +274,11 @@
 SWITCH_STANDARD_API(reload_acl_function)
 {
 	const char *err;
-    switch_xml_t xml_root;
+	switch_xml_t xml_root;
 
-    if (session) {
-        return SWITCH_STATUS_FALSE;
-    }
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	if (cmd && !strcmp(cmd, "reloadxml")) {
 		if ((xml_root = switch_xml_open_root(1, &err))) {
@@ -311,15 +311,15 @@
 	}
 
 	if (switch_check_network_list_ip(argv[0], argv[1])) {
-		stream->write_function(stream, "true");    
+		stream->write_function(stream, "true");
 		goto ok;
 	}
 
-error:
+  error:
 
-	stream->write_function(stream, "false");    
+	stream->write_function(stream, "false");
 
-ok:
+  ok:
 
 	switch_safe_free(mydata);
 
@@ -357,10 +357,10 @@
 			substituted = malloc(len);
 			switch_assert(substituted);
 			memset(substituted, 0, len);
-			switch_replace_char(argv[2], '%','$', SWITCH_FALSE);
+			switch_replace_char(argv[2], '%', '$', SWITCH_FALSE);
 			switch_perform_substitution(re, proceed, argv[2], argv[0], substituted, len, ovector);
 
-			stream->write_function(stream, "%s", substituted);    			
+			stream->write_function(stream, "%s", substituted);
 			free(substituted);
 		} else {
 			stream->write_function(stream, "true");
@@ -370,9 +370,9 @@
 	}
 	goto ok;
 
-error:
-	stream->write_function(stream, "-ERR");    
-ok:
+  error:
+	stream->write_function(stream, "-ERR");
+  ok:
 	switch_regex_safe_free(re);
 	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
@@ -426,14 +426,14 @@
 			o = O_NE;
 		}
 	} else if ((expr = strchr(a, '>'))) {
-		if (*(expr+1) == '=') {
+		if (*(expr + 1) == '=') {
 			*expr++ = '\0';
 			o = O_GE;
 		} else {
 			o = O_GT;
 		}
 	} else if ((expr = strchr(a, '<'))) {
-		if (*(expr+1) == '=') {
+		if (*(expr + 1) == '=') {
 			*expr++ = '\0';
 			o = O_LE;
 		} else {
@@ -493,11 +493,11 @@
 		switch_safe_free(s_b);
 		stream->write_function(stream, "%s", is_true ? argv[1] : argv[2]);
 		goto ok;
-	} 
+	}
 
-error:
-	stream->write_function(stream, "-ERR");    
-ok:
+  error:
+	stream->write_function(stream, "-ERR");
+  ok:
 
 	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
@@ -512,7 +512,7 @@
 SWITCH_STANDARD_API(status_function)
 {
 	uint8_t html = 0;
-	switch_core_time_duration_t duration = {0};
+	switch_core_time_duration_t duration = { 0 };
 	char *http = NULL;
 	int sps = 0, last_sps = 0;
 
@@ -532,13 +532,13 @@
 	}
 
 	stream->write_function(stream,
-		"UP %u year%s, %u day%s, %u hour%s, %u minute%s, %u second%s, %u millisecond%s, %u microsecond%s\n",
-		duration.yr, duration.yr == 1 ? "" : "s", duration.day, duration.day == 1 ? "" : "s",
-		duration.hr, duration.hr == 1 ? "" : "s", duration.min, duration.min == 1 ? "" : "s",
-		duration.sec, duration.sec == 1 ? "" : "s", duration.ms, duration.ms == 1 ? "" : "s", duration.mms,
-		duration.mms == 1 ? "" : "s");
+						   "UP %u year%s, %u day%s, %u hour%s, %u minute%s, %u second%s, %u millisecond%s, %u microsecond%s\n",
+						   duration.yr, duration.yr == 1 ? "" : "s", duration.day, duration.day == 1 ? "" : "s",
+						   duration.hr, duration.hr == 1 ? "" : "s", duration.min, duration.min == 1 ? "" : "s",
+						   duration.sec, duration.sec == 1 ? "" : "s", duration.ms, duration.ms == 1 ? "" : "s", duration.mms,
+						   duration.mms == 1 ? "" : "s");
 
-	stream->write_function(stream, "%"SWITCH_SIZE_T_FMT" session(s) since startup\n", switch_core_session_id() - 1 );
+	stream->write_function(stream, "%" SWITCH_SIZE_T_FMT " session(s) since startup\n", switch_core_session_id() - 1);
 	switch_core_session_ctl(SCSC_LAST_SPS, &last_sps);
 	switch_core_session_ctl(SCSC_SPS, &sps);
 	stream->write_function(stream, "%d session(s) %d/%d\n", switch_core_session_count(), last_sps, sps);
@@ -644,10 +644,10 @@
 		} else {
 			stream->write_function(stream, "-ERR INVALID COMMAND\nUSAGE: fsctl %s", CTL_SYNTAX);
 			goto end;
-		} 
+		}
 
 		stream->write_function(stream, "+OK\n");
-end:
+	  end:
 		free(mydata);
 	} else {
 		stream->write_function(stream, "-ERR Memory error\n");
@@ -831,7 +831,7 @@
 
 	switch_core_session_rwunlock(tsession);
 
-done:
+  done:
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -866,7 +866,7 @@
 	if (argv[4]) {
 		uint32_t mto;
 		if (*argv[4] == '+') {
-			if ((mto = atoi(argv[4]+1)) > 0) {
+			if ((mto = atoi(argv[4] + 1)) > 0) {
 				to = switch_timestamp(NULL) + mto;
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
@@ -884,7 +884,7 @@
 	switch_ivr_tone_detect_session(rsession, argv[1], argv[2], argv[3], to, argv[5], argv[6]);
 	stream->write_function(stream, "+OK Enabling tone detection '%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
 
-done:
+  done:
 
 	free(mydata);
 	switch_core_session_rwunlock(rsession);
@@ -1246,13 +1246,13 @@
 	} else {
 		switch_status_t status;
 		char *who = NULL;
-		
+
 		if ((status = switch_ivr_uuid_bridge(argv[0], argv[1])) != SWITCH_STATUS_SUCCESS) {
 			if (argv[2]) {
 				if ((status = switch_ivr_uuid_bridge(argv[0], argv[2])) == SWITCH_STATUS_SUCCESS) {
 					who = argv[2];
 				}
-			} 
+			}
 		} else {
 			who = argv[1];
 		}
@@ -1317,11 +1317,11 @@
 
 	goto done;
 
-usage:
+  usage:
 	stream->write_function(stream, "-USAGE: %s\n", SESS_REC_SYNTAX);
 	switch_safe_free(mycmd);
 
-done:
+  done:
 	if (rsession) {
 		switch_core_session_rwunlock(rsession);
 	}
@@ -1377,11 +1377,11 @@
 
 	goto done;
 
-usage:
+  usage:
 	stream->write_function(stream, "-USAGE: %s\n", DISPLACE_SYNTAX);
 	switch_safe_free(mycmd);
 
-done:
+  done:
 	if (rsession) {
 		switch_core_session_rwunlock(rsession);
 	}
@@ -1513,7 +1513,8 @@
 		timeout = atoi(argv[6]);
 	}
 
-	if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS || !caller_session) {
+	if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS
+		|| !caller_session) {
 		if (machine) {
 			stream->write_function(stream, "-ERR %s\n", switch_channel_cause2str(cause));
 		} else {
@@ -1557,7 +1558,7 @@
 
 	switch_core_session_rwunlock(caller_session);
 
-done:
+  done:
 	switch_safe_free(mycmd);
 	return status;
 }
@@ -1594,7 +1595,7 @@
 		int64_t tmp;
 		tmp = (uint32_t) atoi(cmd);
 		if (tmp > 0) {
-			cnt = switch_scheduler_del_task_id((uint32_t)tmp);
+			cnt = switch_scheduler_del_task_id((uint32_t) tmp);
 		}
 	} else {
 		cnt = switch_scheduler_del_task_group(cmd);
@@ -1643,14 +1644,7 @@
 			}
 		}
 
-		stream->write_function(stream, 
-			"<result>\n"
-			"  <row id=\"1\">\n"
-			"    <data>%s</data>\n"
-			"  </row>\n"
-			"</result>\n",
-			send ? send : "ERROR"
-			);
+		stream->write_function(stream, "<result>\n" "  <row id=\"1\">\n" "    <data>%s</data>\n" "  </row>\n" "</result>\n", send ? send : "ERROR");
 		switch_safe_free(mystream.data);
 		switch_safe_free(edata);
 		free(dcommand);
@@ -1688,12 +1682,12 @@
 			id = switch_scheduler_add_task(when, sch_api_callback, (char *) __SWITCH_FUNC__, group, 0, strdup(dcmd), SSHF_FREE_ARG);
 			stream->write_function(stream, "+OK Added: %u\n", id);
 			goto good;
-		} 
+		}
 	}
 
 	stream->write_function(stream, "-ERR Invalid syntax\n");
 
-good:
+  good:
 	switch_safe_free(tm);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -1701,7 +1695,7 @@
 struct bg_job {
 	char *cmd;
 	char *arg;
-	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];	
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	switch_memory_pool_t *pool;
 };
 
@@ -1715,7 +1709,8 @@
 	char *arg;
 	switch_memory_pool_t *pool;
 
-	if (!job) return NULL;
+	if (!job)
+		return NULL;
 
 	pool = job->pool;
 
@@ -1817,7 +1812,7 @@
 
 	switch_xml_set_attr(switch_xml_set_flag(row, SWITCH_XML_DUP), strdup("row_id"), strdup(id));
 
-	for(x = 0; x < argc; x++) {
+	for (x = 0; x < argc; x++) {
 		char *name = columnNames[x];
 		char *val = switch_str_nil(argv[x]);
 
@@ -1896,7 +1891,7 @@
 	} else {
 		stream->write_function(stream, "-USAGE: %s\n", COMPLETE_SYNTAX);
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1912,7 +1907,7 @@
 	} else {
 		stream->write_function(stream, "-USAGE: %s\n", ALIAS_SYNTAX);
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1924,7 +1919,7 @@
 	switch_core_db_t *db;
 	struct holder holder = { 0 };
 	int help = 0;
-	char *mydata = NULL, *argv[6] = {0};
+	char *mydata = NULL, *argv[6] = { 0 };
 	int argc;
 	char *command = NULL, *as = NULL;
 	switch_core_flag_t cflags = switch_core_flags();
@@ -1980,7 +1975,8 @@
 		holder.print_title = 0;
 		if ((cmdname = strchr(command, ' ')) != 0) {
 			*cmdname++ = '\0';
-			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s' order by name", cmdname);
+			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s' order by name",
+							cmdname);
 		} else {
 			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' order by name");
 		}
@@ -2127,10 +2123,10 @@
 
 	stream->write_function(stream, "-USAGE: %s\n", SETVAR_SYNTAX);
 
-done:
+  done:
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
-} 
+}
 
 #define GETVAR_SYNTAX "<uuid> <var>"
 SWITCH_STANDARD_API(uuid_getvar_function)
@@ -2177,7 +2173,7 @@
 
 	stream->write_function(stream, "-USAGE: %s\n", GETVAR_SYNTAX);
 
-done:
+  done:
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -2224,7 +2220,7 @@
 					}
 
 					switch_assert(buf);
-					stream->raw_write_function(stream, (unsigned char *)buf, strlen(buf));
+					stream->raw_write_function(stream, (unsigned char *) buf, strlen(buf));
 					switch_event_destroy(&event);
 					free(buf);
 				} else {
@@ -2242,7 +2238,7 @@
 
 	stream->write_function(stream, "-USAGE: %s\n", DUMP_SYNTAX);
 
-done:
+  done:
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -2270,10 +2266,10 @@
 
 	stream->write_function(stream, "-USAGE: %s\n", GLOBAL_SETVAR_SYNTAX);
 
-done:
+  done:
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
-} 
+}
 
 #define GLOBAL_GETVAR_SYNTAX "<var>"
 SWITCH_STANDARD_API(global_getvar_function)
@@ -2285,7 +2281,7 @@
 	}
 
 	stream->write_function(stream, "-USAGE: %s\n", GLOBAL_GETVAR_SYNTAX);
-done:
+  done:
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -2325,8 +2321,10 @@
 	SWITCH_ADD_API(commands_api_interface, "help", "Show help for all the api commands", help_function, "");
 	SWITCH_ADD_API(commands_api_interface, "version", "Show version of the switch", version_function, "");
 	SWITCH_ADD_API(commands_api_interface, "sched_hangup", "Schedule a running call to hangup", sched_hangup_function, SCHED_HANGUP_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function, SCHED_BROADCAST_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "sched_transfer", "Schedule a broadcast event to a running call", sched_transfer_function, SCHED_TRANSFER_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function,
+				   SCHED_BROADCAST_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "sched_transfer", "Schedule a broadcast event to a running call", sched_transfer_function,
+				   SCHED_TRANSFER_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "create_uuid", "Create a uuid", uuid_function, UUID_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "sched_api", "Schedule an api command", sched_api_function, "[+]<time> <group_name> <command_string>");
 	SWITCH_ADD_API(commands_api_interface, "bgapi", "Execute an api command in a thread", bgapi_function, "<command>[ <arg>]");

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Tue May 27 00:54:52 2008
@@ -137,7 +137,7 @@
 	MFLAG_WASTE_BANDWIDTH = (1 << 7),
 	MFLAG_FLUSH_BUFFER = (1 << 8),
 	MFLAG_ENDCONF = (1 << 9),
-    MFLAG_HAS_AUDIO = (1 << 10),
+	MFLAG_HAS_AUDIO = (1 << 10),
 	MFLAG_TALKING = (1 << 11)
 } member_flag_t;
 
@@ -257,9 +257,9 @@
 	uint8_t min;
 	switch_speech_handle_t lsh;
 	switch_speech_handle_t *sh;
-    switch_byte_t *not_talking_buf;
-    uint32_t not_talking_buf_len;
-    int comfort_noise_level;
+	switch_byte_t *not_talking_buf;
+	uint32_t not_talking_buf_len;
+	int comfort_noise_level;
 	int video_running;
 	uint32_t eflags;
 } conference_obj_t;
@@ -290,7 +290,7 @@
 	switch_codec_t write_codec;
 	char *rec_path;
 	uint8_t *frame;
-    uint32_t frame_size;
+	uint32_t frame_size;
 	uint8_t *mux_frame;
 	uint32_t read;
 	int32_t energy_level;
@@ -298,8 +298,8 @@
 	int32_t volume_out_level;
 	uint32_t native_rate;
 	switch_audio_resampler_t *read_resampler;
-    int16_t *resample_out;
-    uint32_t resample_out_len;
+	int16_t *resample_out;
+	uint32_t resample_out_len;
 	conference_file_node_t *fnode;
 	conference_relationship_t *relationships;
 	switch_ivr_digit_stream_parser_t *dtmf_parser;
@@ -335,54 +335,54 @@
 
 /* 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);
-static conference_member_t *conference_member_get(conference_obj_t * conference, uint32_t id);
-static conference_relationship_t *member_add_relationship(conference_member_t * member, uint32_t id);
-static switch_status_t member_del_relationship(conference_member_t * member, uint32_t id);
-static switch_status_t conference_add_member(conference_obj_t * conference, conference_member_t * member);
-static switch_status_t conference_del_member(conference_obj_t * conference, conference_member_t * member);
-static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread, void *obj);
-static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t * thread, void *obj);
-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, uint8_t async);
-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 conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member);
+static conference_member_t *conference_member_get(conference_obj_t *conference, uint32_t id);
+static conference_relationship_t *member_add_relationship(conference_member_t *member, uint32_t id);
+static switch_status_t member_del_relationship(conference_member_t *member, uint32_t id);
+static switch_status_t conference_add_member(conference_obj_t *conference, conference_member_t *member);
+static switch_status_t conference_del_member(conference_obj_t *conference, conference_member_t *member);
+static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *obj);
+static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thread, void *obj);
+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, uint8_t async);
+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);
 SWITCH_STANDARD_API(conf_api_main);
 
-static switch_status_t conference_outcall(conference_obj_t * conference,
+static switch_status_t conference_outcall(conference_obj_t *conference,
 										  char *conference_name,
 										  switch_core_session_t *session,
 										  char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause);
-static switch_status_t conference_outcall_bg(conference_obj_t * conference,
+static switch_status_t conference_outcall_bg(conference_obj_t *conference,
 											 char *conference_name,
-											 switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name, const char *cid_num);
+											 switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
+											 const char *cid_num);
 SWITCH_STANDARD_APP(conference_function);
-static void launch_conference_thread(conference_obj_t * conference);
-static void launch_conference_video_thread(conference_obj_t * conference);
-static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread, void *obj);
-static switch_status_t conference_local_play_file(conference_obj_t * conference,
-												  switch_core_session_t *session, char *path, uint32_t leadin);
-static switch_status_t conference_member_play_file(conference_member_t * member, char *file, uint32_t leadin);
-static switch_status_t conference_member_say(conference_member_t * member, char *text, uint32_t leadin);
-static uint32_t conference_member_stop_file(conference_member_t * member, file_stop_t stop);
+static void launch_conference_thread(conference_obj_t *conference);
+static void launch_conference_video_thread(conference_obj_t *conference);
+static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj);
+static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin);
+static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin);
+static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
+static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
 static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool);
 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);
+static void launch_conference_record_thread(conference_obj_t *conference, char *path);
 
 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, 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);
-static switch_status_t conference_add_event_data(conference_obj_t * conference, switch_event_t *event);
-static switch_status_t conference_add_event_member_data(conference_member_t * member, switch_event_t *event);
+static void conference_member_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, 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);
+static switch_status_t conference_add_event_data(conference_obj_t *conference, switch_event_t *event);
+static switch_status_t conference_add_event_member_data(conference_member_t *member, switch_event_t *event);
 
-static switch_status_t conference_add_event_data(conference_obj_t * conference, switch_event_t *event)
+static switch_status_t conference_add_event_data(conference_obj_t *conference, switch_event_t *event)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
@@ -392,11 +392,12 @@
 
 	return status;
 }
-static switch_status_t conference_add_event_member_data(conference_member_t * member, switch_event_t *event)
+static switch_status_t conference_add_event_member_data(conference_member_t *member, switch_event_t *event)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
-	if (!member) return status;
+
+	if (!member)
+		return status;
 
 	if (member->session) {
 		switch_channel_t *channel = switch_core_session_get_channel(member->session);
@@ -426,11 +427,12 @@
 }
 
 /* if other_member has a relationship with member, produce it */
-static conference_relationship_t *member_get_relationship(conference_member_t * member, conference_member_t * other_member)
+static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member)
 {
 	conference_relationship_t *rel = NULL, *global = NULL;
 
-	if (member == NULL || other_member == NULL || member->relationships == NULL) return NULL;
+	if (member == NULL || other_member == NULL || member->relationships == NULL)
+		return NULL;
 
 	switch_mutex_lock(member->flag_mutex);
 	switch_mutex_lock(other_member->flag_mutex);
@@ -453,11 +455,11 @@
 }
 
 /* traverse the conference member list for the specified member id and return it's pointer */
-static conference_member_t *conference_member_get(conference_obj_t * conference, uint32_t id)
+static conference_member_t *conference_member_get(conference_obj_t *conference, uint32_t id)
 {
 	conference_member_t *member = NULL;
 
-	switch_assert(conference != NULL); 
+	switch_assert(conference != NULL);
 	if (!id) {
 		return NULL;
 	}
@@ -484,7 +486,7 @@
 }
 
 /* stop the specified recording */
-static switch_status_t 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;
@@ -502,11 +504,12 @@
 }
 
 /* Add a custom relationship to a member */
-static conference_relationship_t *member_add_relationship(conference_member_t * member, uint32_t id)
+static conference_relationship_t *member_add_relationship(conference_member_t *member, uint32_t id)
 {
 	conference_relationship_t *rel = NULL;
 
-	if (member == NULL || id == 0 || !(rel = switch_core_alloc(member->pool, sizeof(*rel)))) return NULL;
+	if (member == NULL || id == 0 || !(rel = switch_core_alloc(member->pool, sizeof(*rel))))
+		return NULL;
 
 	rel->id = id;
 
@@ -519,12 +522,13 @@
 }
 
 /* Remove a custom relationship from a member */
-static switch_status_t member_del_relationship(conference_member_t * member, uint32_t id)
+static switch_status_t member_del_relationship(conference_member_t *member, uint32_t id)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	conference_relationship_t *rel, *last = NULL;
 
-	if (member == NULL || id == 0) return status;
+	if (member == NULL || id == 0)
+		return status;
 
 	switch_mutex_lock(member->flag_mutex);
 	for (rel = member->relationships; rel; rel = rel->next) {
@@ -546,11 +550,11 @@
 }
 
 /* Gain exclusive access and add the member to the list */
-static switch_status_t conference_add_member(conference_obj_t * conference, conference_member_t * member)
+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;
-	char msg[512];					/* conference count anouncement */
+	char msg[512];				/* conference count anouncement */
 	call_list_t *call_list = NULL;
 	switch_channel_t *channel;
 
@@ -600,7 +604,7 @@
 
 		channel = switch_core_session_get_channel(member->session);
 		call_list = (call_list_t *) switch_channel_get_private(channel, "_conference_autocall_list_");
-			
+
 		if (call_list) {
 			char saymsg[1024];
 			switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->itteration);
@@ -613,13 +617,14 @@
 					conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
 				} else if (conference->count == 1 && !conference->perpetual_sound) {
 					if (conference->alone_sound) {
-						conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
+						conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session),
+											 0);
 					} else {
 						switch_snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
 						conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
 					}
 				}
-			} 
+			}
 		}
 
 		if (conference->count == 1) {
@@ -650,7 +655,7 @@
 }
 
 /* Gain exclusive access and remove the member from the list */
-static switch_status_t conference_del_member(conference_obj_t * conference, conference_member_t * member)
+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;
@@ -712,7 +717,7 @@
 	}
 
 	member->conference = NULL;
-	
+
 	if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
 		conference->count--;
 		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
@@ -773,7 +778,7 @@
 	switch_frame_t *vid_frame;
 	switch_status_t status;
 	int has_vid = 1, req_iframe = 0;
-	
+
 	conference->video_running = 1;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Video thread started for conference %s\n", conference->name);
 
@@ -781,17 +786,17 @@
 		if (!conference->floor_holder) {
 			switch_yield(100000);
 			continue;
-		} 
-		
+		}
+
 		if (switch_channel_test_flag(switch_core_session_get_channel(conference->floor_holder->session), CF_VIDEO)) {
 			status = switch_core_session_read_video_frame(conference->floor_holder->session, &vid_frame, SWITCH_IO_FLAG_NONE, 0);
-			
+
 			if (!SWITCH_READ_ACCEPTABLE(status)) {
 				conference->floor_holder = NULL;
 				req_iframe = 0;
 				continue;
 			}
-			
+
 			if (switch_test_flag(vid_frame, SFF_CNG)) {
 				continue;
 			}
@@ -810,18 +815,18 @@
 					req_iframe = 1;
 				}
 #endif
-		
-				if (vid_frame->codec->implementation->ianacode == 34) { /* h.263 */
-					iframe = (*((int16_t*)vid_frame->data) >> 12 == 6);
-				} else if (vid_frame->codec->implementation->ianacode == 115) { /* h.263-1998 */
-					int y = *((int8_t*)vid_frame->data + 2) & 0xfe;
-					iframe = (y == 0x80 || y == 0x82);					
-				} else if (vid_frame->codec->implementation->ianacode == 99) { /* h.264 */
-					iframe = (*((int16_t*)vid_frame->data) >> 5 == 0x11);
-				} else { /* we need more defs */
+
+				if (vid_frame->codec->implementation->ianacode == 34) {	/* h.263 */
+					iframe = (*((int16_t *) vid_frame->data) >> 12 == 6);
+				} else if (vid_frame->codec->implementation->ianacode == 115) {	/* h.263-1998 */
+					int y = *((int8_t *) vid_frame->data + 2) & 0xfe;
+					iframe = (y == 0x80 || y == 0x82);
+				} else if (vid_frame->codec->implementation->ianacode == 99) {	/* h.264 */
+					iframe = (*((int16_t *) vid_frame->data) >> 5 == 0x11);
+				} else {		/* we need more defs */
 					iframe = 1;
 				}
-				
+
 				if (!iframe) {
 					continue;
 				}
@@ -830,8 +835,8 @@
 			}
 
 			last_member = conference->floor_holder;
-			
-			switch_mutex_lock(conference->member_mutex);	
+
+			switch_mutex_lock(conference->member_mutex);
 			has_vid = 0;
 			for (imember = conference->members; imember; imember = imember->next) {
 				if (switch_channel_test_flag(switch_core_session_get_channel(imember->session), CF_VIDEO)) {
@@ -849,7 +854,7 @@
 }
 
 /* Main monitor thread (1 per distinct conference room) */
-static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *obj)
 {
 	conference_obj_t *conference = (conference_obj_t *) obj;
 	conference_member_t *imember, *omember;
@@ -860,7 +865,7 @@
 	switch_event_t *event;
 	uint8_t *file_frame;
 	uint8_t *async_file_frame;
-	
+
 	file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	async_file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE);
 
@@ -879,7 +884,7 @@
 		switch_size_t file_sample_len = samples;
 		switch_size_t file_data_len = samples * 2;
 		int has_file_data = 0, members_with_video = 0;
-		
+
 		if (conference->perpetual_sound && !conference->async_fnode) {
 			conference_play_file(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1);
 		} else if (conference->moh_sound && conference->count == 1 && !conference->async_fnode) {
@@ -891,7 +896,7 @@
 			switch_set_flag(conference, CFLAG_DESTRUCT);
 			break;
 		}
-		
+
 		switch_mutex_lock(conference->mutex);
 		has_file_data = ready = total = 0;
 
@@ -908,11 +913,11 @@
 			switch_clear_flag_locked(imember, MFLAG_HAS_AUDIO);
 			switch_mutex_lock(imember->audio_in_mutex);
 
-			if (switch_buffer_inuse(imember->audio_buffer) >= bytes 
-                && (buf_read = (uint32_t) switch_buffer_read(imember->audio_buffer, imember->frame, bytes))) {
-                imember->read = buf_read;
-                switch_set_flag_locked(imember, MFLAG_HAS_AUDIO);
-                ready++;
+			if (switch_buffer_inuse(imember->audio_buffer) >= bytes
+				&& (buf_read = (uint32_t) switch_buffer_read(imember->audio_buffer, imember->frame, bytes))) {
+				imember->read = buf_read;
+				switch_set_flag_locked(imember, MFLAG_HAS_AUDIO);
+				ready++;
 			}
 			switch_mutex_unlock(imember->audio_in_mutex);
 		}
@@ -940,15 +945,15 @@
 				} else if (conference->fnode->type == NODE_TYPE_FILE) {
 					switch_core_file_read(&conference->fnode->fh, file_frame, &file_sample_len);
 				}
-				
+
 				if (file_sample_len <= 0) {
 					conference->fnode->done++;
 				} else {
 					has_file_data = 1;
 				}
-			}			
+			}
 		}
-		
+
 		if (conference->async_fnode) {
 			/* Lead in time */
 			if (conference->async_fnode->leadin) {
@@ -984,25 +989,25 @@
 		if (ready || has_file_data) {
 			//int nt = 0;
 			/* Build a muxed frame for every member that contains the mixed audio of everyone else */
-			
+
 			for (omember = conference->members; omember; omember = omember->next) {
 				if (has_file_data && file_sample_len) {
-                    uint32_t sample_bytes = file_sample_len * 2;
+					uint32_t sample_bytes = file_sample_len * 2;
 					memcpy(omember->mux_frame, file_frame, sample_bytes);
-                    if (sample_bytes < bytes) {
-                        if (conference->comfort_noise_level) {
-                            switch_generate_sln_silence((int16_t *)omember->mux_frame + sample_bytes, 
-                                                        (bytes - sample_bytes) / 2, conference->comfort_noise_level);
-                        } else {
-                            memset(omember->mux_frame + sample_bytes, 255, bytes - sample_bytes);
-                        }
-                    }
-                } else {
-                    if (conference->comfort_noise_level) {
-                        switch_generate_sln_silence((int16_t *)omember->mux_frame, bytes / 2, conference->comfort_noise_level);
-                    } else {
-                        memset(omember->mux_frame, 255, bytes);
-                    }
+					if (sample_bytes < bytes) {
+						if (conference->comfort_noise_level) {
+							switch_generate_sln_silence((int16_t *) omember->mux_frame + sample_bytes,
+														(bytes - sample_bytes) / 2, conference->comfort_noise_level);
+						} else {
+							memset(omember->mux_frame + sample_bytes, 255, bytes - sample_bytes);
+						}
+					}
+				} else {
+					if (conference->comfort_noise_level) {
+						switch_generate_sln_silence((int16_t *) omember->mux_frame, bytes / 2, conference->comfort_noise_level);
+					} else {
+						memset(omember->mux_frame, 255, bytes);
+					}
 				}
 				for (imember = conference->members; imember; imember = imember->next) {
 					uint32_t x;
@@ -1022,7 +1027,7 @@
 								continue;
 							}
 						}
-					} 
+					}
 
 					/* If we are not supposed to hear them then don't let it happen */
 					if (imember->relationships) {
@@ -1168,7 +1173,7 @@
 
 	if (conference->video_running == 1) {
 		conference->video_running = -1;
-		while(conference->video_running) {
+		while (conference->video_running) {
 			switch_yield(1000);
 		}
 	}
@@ -1207,9 +1212,10 @@
 	return NULL;
 }
 
-static void conference_loop_fn_mute_toggle(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_mute_toggle(conference_member_t *member, caller_control_action_t *action)
 {
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
 		conf_api_sub_mute(member, NULL, NULL);
@@ -1221,9 +1227,10 @@
 	}
 }
 
-static void conference_loop_fn_deafmute_toggle(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_deafmute_toggle(conference_member_t *member, caller_control_action_t *action)
 {
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
 		conf_api_sub_mute(member, NULL, NULL);
@@ -1238,12 +1245,13 @@
 	}
 }
 
-static void conference_loop_fn_energy_up(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_energy_up(conference_member_t *member, caller_control_action_t *action)
 {
 	char msg[512];
 	switch_event_t *event;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_mutex_lock(member->flag_mutex);
 	member->energy_level += 200;
@@ -1264,12 +1272,13 @@
 	conference_member_say(member, msg, 0);
 }
 
-static void conference_loop_fn_energy_equ_conf(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_energy_equ_conf(conference_member_t *member, caller_control_action_t *action)
 {
 	char msg[512];
 	switch_event_t *event;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_mutex_lock(member->flag_mutex);
 	member->energy_level = member->conference->energy_level;
@@ -1287,12 +1296,13 @@
 	conference_member_say(member, msg, 0);
 }
 
-static void conference_loop_fn_energy_dn(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_energy_dn(conference_member_t *member, caller_control_action_t *action)
 {
 	char msg[512];
 	switch_event_t *event;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_mutex_lock(member->flag_mutex);
 	member->energy_level -= 100;
@@ -1313,12 +1323,13 @@
 	conference_member_say(member, msg, 0);
 }
 
-static void conference_loop_fn_volume_talk_up(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_talk_up(conference_member_t *member, caller_control_action_t *action)
 {
 	char msg[512];
 	switch_event_t *event;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_mutex_lock(member->flag_mutex);
 	member->volume_out_level++;
@@ -1337,12 +1348,13 @@
 	conference_member_say(member, msg, 0);
 }
 
-static void conference_loop_fn_volume_talk_zero(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_talk_zero(conference_member_t *member, caller_control_action_t *action)
 {
 	char msg[512];
 	switch_event_t *event;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_mutex_lock(member->flag_mutex);
 	member->volume_out_level = 0;
@@ -1360,12 +1372,13 @@
 	conference_member_say(member, msg, 0);
 }
 
-static void conference_loop_fn_volume_talk_dn(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_talk_dn(conference_member_t *member, caller_control_action_t *action)
 {
 	char msg[512];
 	switch_event_t *event;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_mutex_lock(member->flag_mutex);
 	member->volume_out_level--;
@@ -1384,12 +1397,13 @@
 	conference_member_say(member, msg, 0);
 }
 
-static void conference_loop_fn_volume_listen_up(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_listen_up(conference_member_t *member, caller_control_action_t *action)
 {
 	char msg[512];
 	switch_event_t *event;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_mutex_lock(member->flag_mutex);
 	member->volume_in_level++;
@@ -1408,12 +1422,13 @@
 	conference_member_say(member, msg, 0);
 }
 
-static void conference_loop_fn_volume_listen_zero(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_listen_zero(conference_member_t *member, caller_control_action_t *action)
 {
 	char msg[512];
 	switch_event_t *event;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_mutex_lock(member->flag_mutex);
 	member->volume_in_level = 0;
@@ -1431,12 +1446,13 @@
 	conference_member_say(member, msg, 0);
 }
 
-static void conference_loop_fn_volume_listen_dn(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_listen_dn(conference_member_t *member, caller_control_action_t *action)
 {
 	char msg[512];
 	switch_event_t *event;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_mutex_lock(member->flag_mutex);
 	member->volume_in_level--;
@@ -1455,11 +1471,10 @@
 	conference_member_say(member, msg, 0);
 }
 
-static void conference_loop_fn_event(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_event(conference_member_t *member, caller_control_action_t *action)
 {
 	switch_event_t *event;
-	if (test_eflag(member->conference, EFLAG_DTMF) &&
-		switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+	if (test_eflag(member->conference, EFLAG_DTMF) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 		conference_add_event_member_data(member, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "dtmf");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Key", "%s", action->binded_dtmf);
@@ -1467,13 +1482,13 @@
 	}
 }
 
-static void conference_loop_fn_hangup(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_hangup(conference_member_t *member, caller_control_action_t *action)
 {
 	switch_clear_flag_locked(member, MFLAG_RUNNING);
 }
 
 /* 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)
+static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj)
 {
 	conference_member_t *member = obj;
 	switch_channel_t *channel;
@@ -1564,23 +1579,22 @@
 						switch_event_t *event;
 						switch_set_flag_locked(member, MFLAG_TALKING);
 						switch_mutex_lock(member->conference->member_mutex);
-						if (!member->conference->floor_holder || 
-							!switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || member->score > 
+						if (!member->conference->floor_holder ||
+							!switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || member->score >
 							member->conference->floor_holder->score + 200) {
 							if (test_eflag(member->conference, EFLAG_FLOOR_CHANGE) &&
 								switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 								conference_add_event_member_data(member, event);
 								switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "floor-change");
-								switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "%d", 
+								switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "%d",
 														member->conference->floor_holder ? member->conference->floor_holder->id : 0);
-								switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d", 
-														member->conference->floor_holder ? member->id : 0);
+								switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d", member->conference->floor_holder ? member->id : 0);
 								switch_event_fire(&event);
 							}
 							member->conference->floor_holder = member;
 						}
 						switch_mutex_unlock(member->conference->member_mutex);
-						
+
 						if (test_eflag(member->conference, EFLAG_START_TALKING) &&
 							switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 							conference_add_event_member_data(member, event);
@@ -1621,11 +1635,9 @@
 				int len = (int) read_frame->datalen;
 
 				read_resampler->from_len = switch_short_to_float(bptr, read_resampler->from, (int) len / 2);
-				read_resampler->to_len = switch_resample_process(read_resampler, 
+				read_resampler->to_len = switch_resample_process(read_resampler,
 																 read_resampler->from,
-																 read_resampler->from_len, 
-																 read_resampler->to, 
-																 read_resampler->to_size, 0);
+																 read_resampler->from_len, read_resampler->to, read_resampler->to_size, 0);
 
 				switch_float_to_short(read_resampler->to, member->resample_out, read_resampler->to_len);
 				len = read_resampler->to_len * 2;
@@ -1655,12 +1667,13 @@
 }
 
 /* launch an input thread for the call leg */
-static void launch_conference_loop_input(conference_member_t * member, switch_memory_pool_t *pool)
+static void launch_conference_loop_input(conference_member_t *member, switch_memory_pool_t *pool)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
 
-	if (member == NULL) return;
+	if (member == NULL)
+		return;
 
 	switch_threadattr_create(&thd_attr, pool);
 	switch_threadattr_detach_set(thd_attr, 1);
@@ -1689,7 +1702,7 @@
 
 /* marshall frames from the conference (or file or tts output) to the call leg */
 /* NB. this starts the input thread after some initial setup for the call leg */
-static void conference_loop_output(conference_member_t * member)
+static void conference_loop_output(conference_member_t *member)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(member->session);
 	switch_frame_t write_frame = { 0 };
@@ -1698,12 +1711,12 @@
 	switch_codec_t *read_codec = switch_core_session_get_read_codec(member->session);
 	uint32_t interval = read_codec->implementation->microseconds_per_frame / 1000;
 	uint32_t samples = switch_samples_per_frame(member->conference->rate, interval);
-    uint32_t csamples = samples;
+	uint32_t csamples = samples;
 	uint32_t tsamples = member->orig_read_codec->implementation->samples_per_frame;
 	uint32_t flush_len = 0;
 	uint32_t low_count = 0, bytes = samples * 2;
 	call_list_t *call_list = NULL, *cp = NULL;
-    
+
 	switch_assert(member->conference != NULL);
 
 	flush_len = switch_samples_per_frame(member->conference->rate, member->conference->interval) * 10;
@@ -1770,8 +1783,8 @@
 		int use_timer = 0;
 		switch_size_t file_sample_len = csamples;
 		switch_size_t file_data_len = file_sample_len * 2;
-			
-			
+
+
 		switch_mutex_lock(member->flag_mutex);
 
 
@@ -1894,7 +1907,7 @@
 						switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
 						switch_core_timer_next(&timer);
 
-                            
+
 						/* forget the conference data we played file node data instead */
 						switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
 					}
@@ -1914,9 +1927,9 @@
 					/* getting behind, clear the buffer */
 					switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
 				}
-			} 
-				
-				
+			}
+
+
 			use_timer = 1;
 
 			if (mux_used) {
@@ -1962,7 +1975,7 @@
 			}
 			switch_clear_flag_locked(member, MFLAG_FLUSH_BUFFER);
 		}
-			
+
 		switch_mutex_unlock(member->flag_mutex);
 
 		if (use_timer) {
@@ -1971,7 +1984,7 @@
 			switch_yield(1000);
 		}
 
-	} /* Rinse ... Repeat */
+	}							/* Rinse ... Repeat */
 
 	if (member->digit_stream != NULL) {
 		switch_ivr_digit_stream_destroy(member->digit_stream);
@@ -1995,7 +2008,7 @@
 }
 
 /* Sub-Routine called by a record entity inside a conference */
-static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, void *obj)
 {
 	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_file_handle_t fh = { 0 };
@@ -2029,9 +2042,9 @@
 	member->id = next_member_id();
 	member->pool = rec->pool;
 
-    member->frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE;
-    member->frame = switch_core_alloc(member->pool, member->frame_size);
-    member->mux_frame = switch_core_alloc(member->pool, member->frame_size);
+	member->frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE;
+	member->frame = switch_core_alloc(member->pool, member->frame_size);
+	member->mux_frame = switch_core_alloc(member->pool, member->frame_size);
 
 
 	switch_mutex_init(&member->flag_mutex, SWITCH_MUTEX_NESTED, rec->pool);
@@ -2080,7 +2093,7 @@
 	while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(conference, CFLAG_RUNNING) && conference->count) {
 		switch_size_t len;
 		mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
-		
+
 		if (switch_test_flag(member, MFLAG_FLUSH_BUFFER)) {
 			if (mux_used) {
 				switch_mutex_lock(member->audio_out_mutex);
@@ -2095,7 +2108,7 @@
 			/* Flush the output buffer and write all the data (presumably muxed) to the file */
 			switch_mutex_lock(member->audio_out_mutex);
 			low_count = 0;
-			
+
 			if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data, sizeof(data)))) {
 				if (!switch_test_flag((&fh), SWITCH_FILE_PAUSE)) {
 					len = (switch_size_t) rlen / sizeof(int16_t);
@@ -2117,9 +2130,9 @@
 		}
 
 		switch_core_timer_next(&timer);
-	} /* Rinse ... Repeat */
+	}							/* Rinse ... Repeat */
 
- end:
+  end:
 
 	switch_core_timer_destroy(&timer);
 	conference_del_member(conference, member);
@@ -2146,7 +2159,7 @@
 }
 
 /* Make files stop playing in a conference either the current one or all of them */
-static uint32_t conference_stop_file(conference_obj_t * conference, file_stop_t stop)
+static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop)
 {
 	uint32_t count = 0;
 	conference_file_node_t *nptr;
@@ -2182,12 +2195,13 @@
 }
 
 /* stop playing a file for the member of the conference */
-static uint32_t conference_member_stop_file(conference_member_t * member, file_stop_t stop)
+static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop)
 {
 	conference_file_node_t *nptr;
 	uint32_t count = 0;
 
-	if (member == NULL) return count;
+	if (member == NULL)
+		return count;
 
 	switch_mutex_lock(member->flag_mutex);
 
@@ -2209,7 +2223,7 @@
 }
 
 /* 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, uint8_t async)
+static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	conference_file_node_t *fnode, *nptr = NULL;
@@ -2225,7 +2239,8 @@
 	switch_mutex_unlock(conference->member_mutex);
 	switch_mutex_unlock(conference->mutex);
 
-	if (!count) return SWITCH_STATUS_FALSE;
+	if (!count)
+		return SWITCH_STATUS_FALSE;
 
 	if (channel) {
 		if ((expanded = switch_channel_expand_variables(channel, file)) != file) {
@@ -2310,7 +2325,7 @@
 
 	switch_mutex_unlock(conference->mutex);
 
- done:
+  done:
 
 	switch_safe_free(expanded);
 	switch_safe_free(dfile);
@@ -2319,14 +2334,15 @@
 }
 
 /* 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)
+static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	char *dfile = NULL, *expanded = NULL;
 	conference_file_node_t *fnode, *nptr = NULL;
 	switch_memory_pool_t *pool;
 
-	if (member == NULL || file == NULL) return status;
+	if (member == NULL || file == NULL)
+		return status;
 
 	if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(member->session), file)) != file) {
 		file = expanded;
@@ -2384,7 +2400,7 @@
 	switch_mutex_unlock(member->flag_mutex);
 	status = SWITCH_STATUS_SUCCESS;
 
- done:
+  done:
 
 	switch_safe_free(expanded);
 	switch_safe_free(dfile);
@@ -2393,7 +2409,7 @@
 }
 
 /* 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)
+static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin)
 {
 	conference_obj_t *conference = (member != NULL ? member->conference : NULL);
 	conference_file_node_t *fnode, *nptr;
@@ -2401,7 +2417,8 @@
 	switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	if (member == NULL || switch_strlen_zero(text)) return SWITCH_STATUS_FALSE;
+	if (member == NULL || switch_strlen_zero(text))
+		return SWITCH_STATUS_FALSE;
 
 	switch_assert(conference != NULL);
 
@@ -2428,7 +2445,7 @@
 
 	if (!member->sh) {
 		memset(&member->lsh, 0, sizeof(member->lsh));
-		if (switch_core_speech_open(&member->lsh, conference->tts_engine, conference->tts_voice, 
+		if (switch_core_speech_open(&member->lsh, conference->tts_engine, conference->tts_voice,
 									conference->rate, conference->interval, &flags, switch_core_session_get_pool(member->session)) !=
 			SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
@@ -2452,7 +2469,7 @@
 	switch_sleep(200000);
 
 	if (*text == '#') {
-		char *tmp = (char *)text + 1;
+		char *tmp = (char *) text + 1;
 		char *vp = tmp, voice[128] = "";
 		if ((tmp = strchr(tmp, '#'))) {
 			text = tmp + 1;
@@ -2472,7 +2489,7 @@
 }
 
 /* Say some thing with TTS in the conference room */
-static switch_status_t conference_say(conference_obj_t * conference, const 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;
 	conference_file_node_t *fnode, *nptr;
@@ -2514,12 +2531,11 @@
 
 	fnode->type = NODE_TYPE_SPEECH;
 	fnode->leadin = leadin;
-	
+
 	if (!conference->sh) {
 		memset(&conference->lsh, 0, sizeof(conference->lsh));
-		if (switch_core_speech_open(&conference->lsh, conference->tts_engine, conference->tts_voice, 
-									conference->rate, conference->interval, &flags, conference->pool) !=
-			SWITCH_STATUS_SUCCESS) {
+		if (switch_core_speech_open(&conference->lsh, conference->tts_engine, conference->tts_voice,
+									conference->rate, conference->interval, &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;
 		}
@@ -2540,7 +2556,7 @@
 
 	fnode->sh = conference->sh;
 	if (*text == '#') {
-		char *tmp = (char *)text + 1;
+		char *tmp = (char *) text + 1;
 		char *vp = tmp, voice[128] = "";
 		if ((tmp = strchr(tmp, '#'))) {
 			text = tmp + 1;
@@ -2562,7 +2578,7 @@
 }
 
 /* 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)
+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;
 
@@ -2578,7 +2594,7 @@
 
 }
 
-static void conference_list_pretty(conference_obj_t * conference, switch_stream_handle_t *stream)
+static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream)
 {
 	conference_member_t *member = NULL;
 
@@ -2603,7 +2619,7 @@
 	switch_mutex_unlock(conference->member_mutex);
 }
 
-static void conference_list(conference_obj_t * conference, switch_stream_handle_t *stream, char *delim)
+static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim)
 {
 	conference_member_t *member = NULL;
 
@@ -2663,11 +2679,12 @@
 	switch_mutex_unlock(conference->member_mutex);
 }
 
-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_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
 	switch_event_t *event;
 
-	if (member == NULL)  return SWITCH_STATUS_GENERR;
+	if (member == NULL)
+		return SWITCH_STATUS_GENERR;
 
 	switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
 	if (member->conference->muted_sound) {
@@ -2691,11 +2708,12 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-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_unmute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
 	switch_event_t *event;
 
-	if (member == NULL) return SWITCH_STATUS_GENERR;
+	if (member == NULL)
+		return SWITCH_STATUS_GENERR;
 
 	switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
 	if (stream != NULL) {
@@ -2719,11 +2737,12 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-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_deaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
 	switch_event_t *event;
 
-	if (member == NULL) return SWITCH_STATUS_GENERR;
+	if (member == NULL)
+		return SWITCH_STATUS_GENERR;
 
 	switch_clear_flag_locked(member, MFLAG_CAN_HEAR);
 	if (stream != NULL) {
@@ -2738,11 +2757,12 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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)
 {
 	switch_event_t *event;
-	
-	if (member == NULL) return SWITCH_STATUS_GENERR;
+
+	if (member == NULL)
+		return SWITCH_STATUS_GENERR;
 
 	switch_set_flag_locked(member, MFLAG_CAN_HEAR);
 	if (stream != NULL) {
@@ -2757,11 +2777,12 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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)
 {
 	switch_event_t *event;
 
-	if (member == NULL) return SWITCH_STATUS_GENERR;
+	if (member == NULL)
+		return SWITCH_STATUS_GENERR;
 
 	switch_mutex_lock(member->flag_mutex);
 	switch_clear_flag(member, MFLAG_RUNNING);
@@ -2781,11 +2802,11 @@
 }
 
 
-static switch_status_t conf_api_sub_dtmf(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_dtmf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
 {
 	switch_event_t *event;
 	char *dtmf = (char *) data;
-	
+
 	if (member == NULL) {
 		stream->write_function(stream, "Invalid member!\n");
 		return SWITCH_STATUS_GENERR;
@@ -2798,7 +2819,7 @@
 
 	switch_mutex_lock(member->flag_mutex);
 	switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
-	switch_core_session_send_dtmf_string(member->session, (char *)data);
+	switch_core_session_send_dtmf_string(member->session, (char *) data);
 	switch_mutex_unlock(member->flag_mutex);
 
 	if (stream != NULL) {
@@ -2816,11 +2837,12 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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)
 {
 	switch_event_t *event;
 
-	if (member == NULL) return SWITCH_STATUS_GENERR;
+	if (member == NULL)
+		return SWITCH_STATUS_GENERR;
 
 	if (data) {
 		switch_mutex_lock(member->flag_mutex);
@@ -2831,21 +2853,22 @@
 		stream->write_function(stream, "Energy %u = %d\n", member->id, member->energy_level);
 	}
 	if (test_eflag(member->conference, EFLAG_ENERGY_LEVEL_MEMBER) &&
-		data && switch_event_create_subclass(& event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+		data && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 		conference_add_event_member_data(member, event);
 		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);
+		switch_event_fire(&event);
 	}
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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)
 {
 	switch_event_t *event;
 
-	if (member == NULL) return SWITCH_STATUS_GENERR;
+	if (member == NULL)
+		return SWITCH_STATUS_GENERR;
 
 	if (data) {
 		switch_mutex_lock(member->flag_mutex);
@@ -2857,21 +2880,22 @@
 		stream->write_function(stream, "Volume IN %u = %d\n", member->id, member->volume_in_level);
 	}
 	if (test_eflag(member->conference, EFLAG_VOLUME_IN_MEMBER) &&
-		data && switch_event_create_subclass(& event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+		data && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 		conference_add_event_member_data(member, event);
 		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);
+		switch_event_fire(&event);
 	}
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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)
 {
 	switch_event_t *event;
 
-	if (member == NULL) return SWITCH_STATUS_GENERR;
+	if (member == NULL)
+		return SWITCH_STATUS_GENERR;
 
 	if (data) {
 		switch_mutex_lock(member->flag_mutex);
@@ -2883,17 +2907,17 @@
 		stream->write_function(stream, "Volume OUT %u = %d\n", member->id, member->volume_out_level);
 	}
 	if (test_eflag(member->conference, EFLAG_VOLUME_OUT_MEMBER) && data &&
-		switch_event_create_subclass(& event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+		switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 		conference_add_event_member_data(member, event);
 		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);
+		switch_event_fire(&event);
 	}
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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 ret_status = SWITCH_STATUS_GENERR;
 	int count = 0;
@@ -2955,7 +2979,7 @@
 	return ret_status;
 }
 
-static switch_status_t 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 ret_status = SWITCH_STATUS_GENERR;
 	switch_event_t *event;
@@ -3009,7 +3033,7 @@
 	return ret_status;
 }
 
-static switch_status_t conf_api_sub_say(conference_obj_t * conference, switch_stream_handle_t *stream, const char *text)
+static switch_status_t conf_api_sub_say(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
 {
 	switch_event_t *event;
 
@@ -3024,8 +3048,7 @@
 	}
 
 	stream->write_function(stream, "(say) OK\n");
-	if (test_eflag(conference, EFLAG_SPEAK_TEXT) &&
-		switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+	if (test_eflag(conference, EFLAG_SPEAK_TEXT) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 		conference_add_event_data(conference, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
@@ -3034,7 +3057,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t conf_api_sub_saymember(conference_obj_t * conference, switch_stream_handle_t *stream, const char *text)
+static switch_status_t conf_api_sub_saymember(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
 {
 	int ret_status = SWITCH_STATUS_GENERR;
 	char *expanded = NULL;
@@ -3077,10 +3100,10 @@
 		expanded = NULL;
 	}
 
-	if (!text || conference_member_say(member, (char*)text, 0) != SWITCH_STATUS_SUCCESS) {
+	if (!text || conference_member_say(member, (char *) text, 0) != SWITCH_STATUS_SUCCESS) {
 		stream->write_function(stream, "(saymember) Error!");
 		goto done;
-	} 
+	}
 
 	stream->write_function(stream, "(saymember) OK\n");
 	if (test_eflag(member->conference, EFLAG_SPEAK_TEXT_MEMBER) &&
@@ -3092,13 +3115,13 @@
 	}
 	ret_status = SWITCH_STATUS_SUCCESS;
 
- done:
+  done:
 	switch_safe_free(workspace);
 	switch_safe_free(expanded);
 	return ret_status;
 }
 
-static switch_status_t 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)
 {
 	uint8_t current = 0, all = 0;
 
@@ -3112,7 +3135,8 @@
 		all = 1;
 	}
 
-	if (!(current || all)) return SWITCH_STATUS_GENERR;
+	if (!(current || all))
+		return SWITCH_STATUS_GENERR;
 
 	if (argc == 4) {
 		uint32_t id = atoi(argv[3]);
@@ -3131,14 +3155,15 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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)
 {
 	uint8_t nospeak = 0, nohear = 0, clear = 0;
 
 	switch_assert(conference != NULL);
 	switch_assert(stream != NULL);
 
-	if (argc <= 4) return SWITCH_STATUS_GENERR;
+	if (argc <= 4)
+		return SWITCH_STATUS_GENERR;
 
 	nospeak = strstr(argv[4], "nospeak") ? 1 : 0;
 	nohear = strstr(argv[4], "nohear") ? 1 : 0;
@@ -3150,7 +3175,7 @@
 	if (!(clear || nospeak || nohear)) {
 		return SWITCH_STATUS_GENERR;
 	}
-	
+
 	if (clear) {
 		conference_member_t *member = NULL;
 		uint32_t id = atoi(argv[2]);
@@ -3163,8 +3188,8 @@
 			stream->write_function(stream, "relationship %u->%u not found", id, oid);
 		}
 		return SWITCH_STATUS_SUCCESS;
-	} 
-	
+	}
+
 	if (nospeak || nohear) {
 		conference_member_t *member = NULL, *other_member = NULL;
 		uint32_t id = atoi(argv[2]);
@@ -3199,7 +3224,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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)
 {
 	switch_event_t *event;
 
@@ -3212,8 +3237,7 @@
 
 	switch_set_flag_locked(conference, CFLAG_LOCKED);
 	stream->write_function(stream, "OK %s locked\n", argv[0]);
-	if (test_eflag(conference, EFLAG_LOCK) &&
-		switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+	if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 		conference_add_event_data(conference, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "lock");
 		switch_event_fire(&event);
@@ -3222,7 +3246,7 @@
 	return 0;
 }
 
-static switch_status_t 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)
 {
 	switch_event_t *event;
 
@@ -3235,8 +3259,7 @@
 
 	switch_clear_flag_locked(conference, CFLAG_LOCKED);
 	stream->write_function(stream, "OK %s unlocked\n", argv[0]);
-	if (test_eflag(conference, EFLAG_UNLOCK) &&
-		switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+	if (test_eflag(conference, EFLAG_UNLOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 		conference_add_event_data(conference, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
 		switch_event_fire(&event);
@@ -3245,7 +3268,7 @@
 	return 0;
 }
 
-static switch_status_t 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)
 {
 	switch_call_cause_t cause;
 
@@ -3267,7 +3290,7 @@
 }
 
 
-static switch_status_t conf_api_sub_bgdial(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_bgdial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
 {
 	switch_assert(stream != NULL);
 
@@ -3285,7 +3308,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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)
 {
 	switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
 	char *conf_name = NULL, *profile_name;
@@ -3303,7 +3326,7 @@
 		} else {
 			profile_name = "default";
 		}
-		
+
 		for (x = 3; x < argc; x++) {
 			conference_member_t *member = NULL;
 			uint32_t id = atoi(argv[x]);
@@ -3393,7 +3416,7 @@
 			switch_mutex_unlock(new_conference->mutex);
 			switch_mutex_unlock(member->flag_mutex);
 			stream->write_function(stream, "OK Members sent to conference %s.\n", argv[2]);
-			
+
 			/* tell them what happened */
 			if (test_eflag(conference, EFLAG_TRANSFER) &&
 				switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
@@ -3408,7 +3431,7 @@
 		ret_status = SWITCH_STATUS_GENERR;
 	}
 
- done:
+  done:
 	if (params) {
 		switch_event_destroy(&params);
 	}
@@ -3416,26 +3439,28 @@
 	return ret_status;
 }
 
-static switch_status_t 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)
 {
 	switch_assert(conference != NULL);
 	switch_assert(stream != NULL);
 
-	if (argc <= 2) return SWITCH_STATUS_GENERR;
+	if (argc <= 2)
+		return SWITCH_STATUS_GENERR;
 
 	stream->write_function(stream, "Record file %s\n", argv[2]);
 	launch_conference_record_thread(conference, argv[2]);
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t 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 all;
 
 	switch_assert(conference != NULL);
 	switch_assert(stream != NULL);
 
-	if (argc <= 2) return SWITCH_STATUS_GENERR;
+	if (argc <= 2)
+		return SWITCH_STATUS_GENERR;
 
 	all = (strcasecmp(argv[2], "all") == 0);
 	stream->write_function(stream, "Stop recording file %s\n", argv[2]);
@@ -3446,7 +3471,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t conf_api_sub_pin(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_pin(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
 {
 	switch_assert(conference != NULL);
 	switch_assert(stream != NULL);
@@ -3493,47 +3518,47 @@
 /* API Interface Function sub-commands */
 /* Entries in this list should be kept in sync with the enum above */
 static api_command_t conf_api_sub_commands[] = {
-	{"list", (void_fn_t) & conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
-	{"energy", (void_fn_t) & conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET,
+	{"list", (void_fn_t) &conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
+	{"energy", (void_fn_t) &conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> energy <member_id|all|last> [<newval>]"},
-	{"volume_in", (void_fn_t) & conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET,
+	{"volume_in", (void_fn_t) &conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> volume_in <member_id|all|last> [<newval>]"},
-	{"volume_out", (void_fn_t) & conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET,
+	{"volume_out", (void_fn_t) &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> volume_out <member_id|all|last> [<newval>]"},
-	{"play", (void_fn_t) & conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
-	{"say", (void_fn_t) & conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
-	{"saymember", (void_fn_t) & conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE,
+	{"play", (void_fn_t) &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
+	{"say", (void_fn_t) &conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
+	{"saymember", (void_fn_t) &conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE,
 	 "<confname> saymember <member_id> <text>"},
-	{"stop", (void_fn_t) & conf_api_sub_stop, CONF_API_SUB_ARGS_SPLIT,
+	{"stop", (void_fn_t) &conf_api_sub_stop, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> stop <[current|all|last]> [<member_id>]"},
-	{"dtmf", (void_fn_t) & conf_api_sub_dtmf, CONF_API_SUB_MEMBER_TARGET,
+	{"dtmf", (void_fn_t) &conf_api_sub_dtmf, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> dtmf <[member_id|all|last]> <digits>"},
-	{"kick", (void_fn_t) & conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
-	{"mute", (void_fn_t) & conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
-	{"unmute", (void_fn_t) & conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET,
+	{"kick", (void_fn_t) &conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
+	{"mute", (void_fn_t) &conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
+	{"unmute", (void_fn_t) &conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> unmute <[member_id|all]|last>"},
-	{"deaf", (void_fn_t) & conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
-	{"undeaf", (void_fn_t) & conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET,
+	{"deaf", (void_fn_t) &conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
+	{"undeaf", (void_fn_t) &conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> undeaf <[member_id|all]|last>"},
-	{"relate", (void_fn_t) & conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT,
+	{"relate", (void_fn_t) &conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
-	{"lock", (void_fn_t) & conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
-	{"unlock", (void_fn_t) & conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
-	{"dial", (void_fn_t) & conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT,
+	{"lock", (void_fn_t) &conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
+	{"unlock", (void_fn_t) &conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
+	{"dial", (void_fn_t) &conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
-	{"bgdial", (void_fn_t) & conf_api_sub_bgdial, CONF_API_SUB_ARGS_SPLIT,
+	{"bgdial", (void_fn_t) &conf_api_sub_bgdial, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> bgdial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
-	{"transfer", (void_fn_t) & conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT,
+	{"transfer", (void_fn_t) &conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> transfer <conference_name> <member id> [...<member id>]"},
-	{"record", (void_fn_t) & conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
-	{"norecord", (void_fn_t) & conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
-	{"pin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> pin <pin#>"},
-	{"nopin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> nopin"},
+	{"record", (void_fn_t) &conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
+	{"norecord", (void_fn_t) &conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
+	{"pin", (void_fn_t) &conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> pin <pin#>"},
+	{"nopin", (void_fn_t) &conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> nopin"},
 };
 
 #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, const char *cmdline, int argn)
+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;
@@ -3719,7 +3744,7 @@
 		stream->write_function(stream, "No parameters specified.\nTry 'help conference'\n");
 	}
 
- done:
+  done:
 	switch_safe_free(lbuf);
 
 	return status;
@@ -3727,7 +3752,7 @@
 }
 
 /* generate an outbound call from the conference */
-static switch_status_t conference_outcall(conference_obj_t * conference,
+static switch_status_t conference_outcall(conference_obj_t *conference,
 										  char *conference_name,
 										  switch_core_session_t *session,
 										  char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause)
@@ -3776,21 +3801,19 @@
 	}
 
 	/* establish an outbound call leg */
-		
-	if (switch_ivr_originate(session,
-							 &peer_session, cause, bridgeto, timeout, NULL,  cid_name, cid_num,
-							 NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
+
+	if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != 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;
 	}
-	
+
 	rdlock = 1;
 	peer_channel = switch_core_session_get_channel(peer_session);
 	switch_channel_set_state(peer_channel, CS_SOFT_EXECUTE);
-	
+
 	/* 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");
@@ -3805,7 +3828,7 @@
 		switch_channel_answer(caller_channel);
 	}
 
- callup:
+  callup:
 
 	/* 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)) {
@@ -3834,7 +3857,7 @@
 		goto done;
 	}
 
- done:
+  done:
 	if (conference) {
 		switch_thread_rwlock_unlock(conference->rwlock);
 	}
@@ -3856,7 +3879,7 @@
 	char *conference_name;
 };
 
-static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread, void *obj)
 {
 	struct bg_call *call = (struct bg_call *) obj;
 
@@ -3864,7 +3887,7 @@
 		switch_call_cause_t cause;
 		switch_event_t *event;
 
-		conference_outcall(call->conference, call->conference_name, 
+		conference_outcall(call->conference, call->conference_name,
 						   call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause);
 
 		if (test_eflag(call->conference, EFLAG_BGDIAL_RESULT) &&
@@ -3885,15 +3908,17 @@
 	return NULL;
 }
 
-static switch_status_t conference_outcall_bg(conference_obj_t * conference,
+static switch_status_t conference_outcall_bg(conference_obj_t *conference,
 											 char *conference_name,
-											 switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name, const char *cid_num)
+											 switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
+											 const char *cid_num)
 {
 	struct bg_call *call = NULL;
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
 
-	if (!(call = malloc(sizeof(*call)))) return SWITCH_STATUS_MEMERR;
+	if (!(call = malloc(sizeof(*call))))
+		return SWITCH_STATUS_MEMERR;
 
 	memset(call, 0, sizeof(*call));
 	call->conference = conference;
@@ -3927,8 +3952,7 @@
 }
 
 /* Play a file */
-static switch_status_t conference_local_play_file(conference_obj_t * conference,
-												  switch_core_session_t *session, char *path, uint32_t leadin)
+static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin)
 {
 	uint32_t x = 0;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -3948,7 +3972,7 @@
 	/* if all is well, really play the file */
 	if (status == SWITCH_STATUS_SUCCESS) {
 		char *dpath = NULL;
-	
+
 		channel = switch_core_session_get_channel(session);
 		if ((expanded = switch_channel_expand_variables(channel, path)) != path) {
 			path = expanded;
@@ -3977,13 +4001,13 @@
 		switch_safe_free(dpath);
 	}
 
- done:
+  done:
 	switch_safe_free(expanded);
-	
+
 	return status;
 }
 
-static void set_mflags(char *flags, member_flag_t * f)
+static void set_mflags(char *flags, member_flag_t *f)
 {
 	if (flags) {
 		if (strstr(flags, "mute")) {
@@ -3999,11 +4023,11 @@
 
 }
 
-static void clear_eflags(char *events, uint32_t * f)
+static void clear_eflags(char *events, uint32_t *f)
 {
 	char buf[512] = "";
-	char* next = NULL;
-	char* event = buf;
+	char *next = NULL;
+	char *event = buf;
 
 	if (events) {
 		switch_copy_string(buf, events, sizeof(buf));
@@ -4122,7 +4146,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Channel has no media!\n");
 		return;
 	}
-	
+
 
 	if (switch_strlen_zero(data)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid arguments\n");
@@ -4176,7 +4200,7 @@
 	if (0) {
 		member.dtmf_parser = conference->dtmf_parser;
 	} else {
-		
+
 	}
 #endif
 
@@ -4245,7 +4269,7 @@
 		if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
 			/* couldn't find the conference, create one */
 			conference = conference_new(conf_name, xml_cfg, NULL);
-			
+
 			if (!conference) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 				goto done;
@@ -4317,7 +4341,7 @@
 				goto done;
 			}
 		}
-		
+
 		if (conference->special_announce) {
 			conference_local_play_file(conference, session, conference->special_announce, CONF_DEFAULT_LEADIN);
 		}
@@ -4367,7 +4391,7 @@
 		if (!switch_channel_test_flag(channel, CF_OUTBOUND))
 			switch_set_flag(conference, CFLAG_ANSWERED);
 	}
-	
+
 	member.orig_read_codec = read_codec;
 	member.native_rate = read_codec->implementation->samples_per_second;
 	member.pool = switch_core_session_get_pool(session);
@@ -4375,9 +4399,7 @@
 	/* Setup a Signed Linear codec for reading audio. */
 	if (switch_core_codec_init(&member.read_codec,
 							   "L16",
-							   NULL,
-							   read_codec->implementation->actual_samples_per_second,
-							   read_codec->implementation->microseconds_per_frame / 1000,
+							   NULL, read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000,
 							   //conference->interval,
 							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member.pool) == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
@@ -4387,30 +4409,27 @@
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
 						  read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
-                          
+
 		flags = 0;
 		goto done;
 	}
 
-    member.frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE;
-    member.frame = switch_core_alloc(member.pool, member.frame_size);
-    member.mux_frame = switch_core_alloc(member.pool, member.frame_size);
-    
+	member.frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE;
+	member.frame = switch_core_alloc(member.pool, member.frame_size);
+	member.mux_frame = switch_core_alloc(member.pool, member.frame_size);
+
 	if (read_codec->implementation->actual_samples_per_second != conference->rate) {
 		if (switch_resample_create(&member.read_resampler,
 								   read_codec->implementation->actual_samples_per_second,
-								   member.frame_size,
-								   conference->rate,
-                                   member.frame_size,
-								   member.pool) != SWITCH_STATUS_SUCCESS) {
+								   member.frame_size, conference->rate, member.frame_size, member.pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
 			goto done;
 		}
 
 
-        member.resample_out = switch_core_alloc(member.pool, member.frame_size);
-        member.resample_out_len = member.frame_size;
-        
+		member.resample_out = switch_core_alloc(member.pool, member.frame_size);
+		member.resample_out_len = member.frame_size;
+
 		/* 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) {
@@ -4478,7 +4497,7 @@
 	/* Run the confernece loop */
 	conference_loop_output(&member);
 	switch_channel_set_private(channel, "_conference_autocall_list_", NULL);
-	
+
 	/* 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);
@@ -4490,11 +4509,11 @@
 	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:
+  codec_done1:
 	switch_core_codec_destroy(&member.read_codec);
- codec_done2:
+  codec_done2:
 	switch_core_codec_destroy(&member.write_codec);
- done:
+  done:
 	switch_event_destroy(&params);
 	switch_buffer_destroy(&member.resample_buffer);
 	switch_buffer_destroy(&member.audio_buffer);
@@ -4521,7 +4540,7 @@
 		char *dfile = NULL;
 
 		if (conference->sound_prefix) {
-			dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR,  conference->kicked_sound);
+			dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, conference->kicked_sound);
 			switch_assert(dfile);
 			toplay = dfile;
 		} else {
@@ -4541,7 +4560,7 @@
 }
 
 /* Create a thread for the conference and launch it */
-static void launch_conference_thread(conference_obj_t * conference)
+static void launch_conference_thread(conference_obj_t *conference)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
@@ -4569,7 +4588,7 @@
 	switch_thread_create(&thread, thd_attr, conference_video_thread_run, conference, conference->pool);
 }
 
-static void launch_conference_record_thread(conference_obj_t * conference, char *path)
+static void launch_conference_record_thread(conference_obj_t *conference, char *path)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
@@ -4624,7 +4643,7 @@
 	} 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);
@@ -4638,8 +4657,7 @@
 		if (switch_stristr("list", lbuf)) {
 			conference_list_pretty(conference, &stream);
 			/* provide help */
-		}
-		else {
+		} else {
 			return SWITCH_STATUS_SUCCESS;
 		}
 #if 0
@@ -4660,7 +4678,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t conf_default_controls(conference_obj_t * conference)
+static switch_status_t conf_default_controls(conference_obj_t *conference)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	uint32_t i;
@@ -4688,7 +4706,7 @@
 	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)
+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_xml_t xml_kvp;
@@ -4778,7 +4796,7 @@
 	char *maxmember_sound = NULL;
 	uint32_t rate = 8000, interval = 20;
 	switch_status_t status;
-    int comfort_noise_level = 0;
+	int comfort_noise_level = 0;
 	char *suppress_events = NULL;
 
 	/* Validate the conference name */
@@ -4805,10 +4823,10 @@
 		}
 
 		if (!strcasecmp(var, "rate") && !switch_strlen_zero(val)) {
-            uint32_t tmp = atoi(val);
-            if (tmp == 8000 || tmp == 16000 || tmp == 32000) {
-                rate = tmp;
-            }
+			uint32_t tmp = atoi(val);
+			if (tmp == 8000 || tmp == 16000 || tmp == 32000) {
+				rate = tmp;
+			}
 		} else if (!strcasecmp(var, "domain") && !switch_strlen_zero(val)) {
 			domain = val;
 		} else if (!strcasecmp(var, "interval") && !switch_strlen_zero(val)) {
@@ -4817,7 +4835,7 @@
 				interval = tmp;
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-								  "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL); 
+								  "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
 			}
 		} else if (!strcasecmp(var, "timer-name") && !switch_strlen_zero(val)) {
 			timer_name = val;
@@ -4868,13 +4886,13 @@
 		} else if (!strcasecmp(var, "caller-controls") && !switch_strlen_zero(val)) {
 			caller_controls = val;
 		} else if (!strcasecmp(var, "comfort-noise") && !switch_strlen_zero(val)) {
-            int tmp;
-            tmp = atoi(val);
-            if (tmp > 1 && tmp < 10000) {
-                comfort_noise_level = tmp;
-            } else if (switch_true(val)) {
-                comfort_noise_level = 1400;
-            }
+			int tmp;
+			tmp = atoi(val);
+			if (tmp > 1 && tmp < 10000) {
+				comfort_noise_level = tmp;
+			} else if (switch_true(val)) {
+				comfort_noise_level = 1400;
+			}
 		} else if (!strcasecmp(var, "sound-prefix") && !switch_strlen_zero(val)) {
 			sound_prefix = val;
 		} else if (!strcasecmp(var, "max-members") && !switch_strlen_zero(val)) {
@@ -4897,7 +4915,7 @@
 			}
 		} else if (!strcasecmp(var, "suppress-events") && !switch_strlen_zero(val)) {
 			suppress_events = val;
-        }
+		}
 	}
 
 	/* Set defaults and various paramaters */
@@ -4946,7 +4964,7 @@
 		conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
 	}
 
-    conference->comfort_noise_level = comfort_noise_level;
+	conference->comfort_noise_level = comfort_noise_level;
 	conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
 	conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
 
@@ -5140,11 +5158,11 @@
 {
 	switch_xml_t cxml, cfg, advertise, room;
 	switch_event_t *params = NULL;
-	
+
 	switch_event_create(&params, SWITCH_EVENT_MESSAGE);
 	switch_assert(params);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "presence", "true");
-	
+
 
 	/* Open the config from the xml registry */
 	if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, params))) {
@@ -5170,7 +5188,7 @@
 		}
 	}
 
- done:
+  done:
 	switch_event_destroy(&params);
 
 	/* Release the config registry handle */

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Tue May 27 00:54:52 2008
@@ -49,7 +49,7 @@
 
 	if (!caller_profile) {
 		caller_profile = switch_channel_get_caller_profile(channel);
-	}	
+	}
 
 	if ((extension = switch_caller_extension_new(session, "inline", "inline")) == 0) {
 		abort();
@@ -58,26 +58,26 @@
 	if (switch_strlen_zero(target)) {
 		target = caller_profile->destination_number;
 	}
-	
+
 	if (!switch_strlen_zero(target) && (lbuf = switch_core_session_strdup(session, target))
 		&& (argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 	} else {
 		return NULL;
 	}
 
-	
-	for(x = 0; x < argc; x++) {
+
+	for (x = 0; x < argc; x++) {
 		char *app = argv[x];
 		char *data = strchr(app, ':');
 
 		if (data) {
 			*data++ = '\0';
 		}
-		
-		while(*app == ' ') {
+
+		while (*app == ' ') {
 			app++;
 		}
-		
+
 		switch_caller_extension_add_application(session, extension, app, data);
 	}
 
@@ -119,7 +119,7 @@
 	char *argv[4] = { 0 };
 	int argc;
 	char *lbuf = NULL;
-	
+
 	if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		switch_core_session_execute_exten(session, argv[0], argv[1], argv[2]);
@@ -135,13 +135,13 @@
 	char *argv[4] = { 0 };
 	int argc;
 	char *lbuf = NULL;
-	
+
 	if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
 		switch_ivr_say(session, argv[3], argv[0], argv[1], argv[2], NULL);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", SAY_SYNTAX);
-	}	
+	}
 
 }
 
@@ -151,7 +151,7 @@
 	char *argv[3] = { 0 };
 	int argc;
 	char *lbuf = NULL;
-	
+
 	if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
 		switch_ivr_soft_hold(session, argv[0], argv[1], argv[2]);
@@ -166,7 +166,7 @@
 	char *argv[4] = { 0 };
 	int argc;
 	char *lbuf = NULL;
-	
+
 	if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
 		int kval = atoi(argv[0]);
@@ -239,7 +239,7 @@
 			} else {
 				uuid = argv[0];
 			}
-			
+
 			switch_ivr_intercept_session(session, uuid, bleg);
 		}
 		return;
@@ -275,10 +275,10 @@
 	} else {
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		const char *require_group = switch_channel_get_variable(channel, "eavesdrop_require_group");
-		if (!strcasecmp((char *)data, "all")) {
+		if (!strcasecmp((char *) data, "all")) {
 			switch_core_db_t *db = switch_core_db_handle();
 			char *errmsg = NULL;
-			struct e_data e_data = {{ 0 }};
+			struct e_data e_data = { {0} };
 			char *sql = switch_mprintf("select uuid from channels where uuid != '%q'", switch_core_session_get_uuid(session));
 			const char *file = NULL;
 			int x = 0;
@@ -286,9 +286,9 @@
 			switch_size_t buflen = sizeof(buf);
 			char terminator;
 			switch_status_t status;
-			
-			while(switch_channel_ready(channel)) {
-				for(x = 0; x < MAX_SPY; x++) {
+
+			while (switch_channel_ready(channel)) {
+				for (x = 0; x < MAX_SPY; x++) {
 					switch_safe_free(e_data.uuid_list[x]);
 				}
 				e_data.total = 0;
@@ -326,12 +326,12 @@
 				}
 			}
 
-			for(x = 0; x < MAX_SPY; x++) {
+			for (x = 0; x < MAX_SPY; x++) {
 				switch_safe_free(e_data.uuid_list[x]);
 			}
 
 			switch_core_db_close(db);
-			
+
 		} else {
 			switch_ivr_eavesdrop_session(session, data, require_group, ED_DTMF);
 		}
@@ -352,7 +352,7 @@
 #define SET_USER_SYNTAX "<user>@<domain>"
 SWITCH_STANDARD_APP(set_user_function)
 {
-	switch_xml_t x_domain, xml = NULL, x_user, x_param, x_params;	
+	switch_xml_t x_domain, xml = NULL, x_user, x_param, x_params;
 	char *user, *mailbox, *domain;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 
@@ -367,21 +367,21 @@
 	}
 
 	*domain++ = '\0';
-	
+
 	if (switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", user, domain);
 		goto done;
 	}
 
-	if ((mailbox = (char *)switch_xml_attr(x_user, "mailbox"))) {
+	if ((mailbox = (char *) switch_xml_attr(x_user, "mailbox"))) {
 		switch_channel_set_variable(channel, "mailbox", mailbox);
 	}
-	
+
 	if ((x_params = switch_xml_child(x_user, "variables"))) {
 		for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
 			const char *var = switch_xml_attr(x_param, "name");
 			const char *val = switch_xml_attr(x_param, "value");
-			
+
 			if (var && val) {
 				switch_channel_set_variable(channel, var, val);
 			}
@@ -393,10 +393,10 @@
 
 	goto done;
 
- error:
+  error:
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No user at domain specified.\n");
 
- done:
+  done:
 	if (xml) {
 		switch_xml_free(xml);
 	}
@@ -425,7 +425,7 @@
 SWITCH_STANDARD_APP(check_acl_function)
 {
 	int argc;
-    char *argv[3] = { 0 };
+	char *argv[3] = { 0 };
 	char *mydata;
 	switch_call_cause_t cause = SWITCH_CAUSE_CALL_REJECTED;
 
@@ -441,7 +441,7 @@
 			}
 		}
 	}
-	
+
 }
 
 SWITCH_STANDARD_APP(transfer_function)
@@ -451,7 +451,7 @@
 	char *mydata;
 	int bleg = 0, both = 0;
 
-	
+
 	if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
 		if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
 			bleg = !strcasecmp(argv[0], "-bleg");
@@ -459,7 +459,7 @@
 
 			if (bleg || both) {
 				const char *uuid;
-				switch_channel_t *channel = switch_core_session_get_channel(session);																		
+				switch_channel_t *channel = switch_core_session_get_channel(session);
 				if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
 					switch_core_session_t *b_session;
 					if ((b_session = switch_core_session_locate(uuid))) {
@@ -592,7 +592,7 @@
 	} else {
 		len = atoi(data);
 	}
-	
+
 	switch_ivr_delay_echo(session, len);
 }
 
@@ -776,16 +776,16 @@
 			caller_profile->caller_id_number = val;
 		}
 		if (val && !strcasecmp(name, "caller_ton")) {
-			caller_profile->caller_ton = (uint8_t)atoi(val);
+			caller_profile->caller_ton = (uint8_t) atoi(val);
 		}
 		if (val && !strcasecmp(name, "caller_numplan")) {
-			caller_profile->caller_numplan = (uint8_t)atoi(val);
+			caller_profile->caller_numplan = (uint8_t) atoi(val);
 		}
 		if (val && !strcasecmp(name, "destination_number_ton")) {
-			caller_profile->destination_number_ton = (uint8_t)atoi(val);
+			caller_profile->destination_number_ton = (uint8_t) atoi(val);
 		}
 		if (val && !strcasecmp(name, "destination_number_numplan")) {
-			caller_profile->destination_number_numplan = (uint8_t)atoi(val);
+			caller_profile->destination_number_numplan = (uint8_t) atoi(val);
 		}
 		if (!strcasecmp(name, "ani")) {
 			caller_profile->ani = val;
@@ -846,7 +846,8 @@
 			}
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name ? var_name : "", val ? val : "UNDEF");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name ? var_name : "",
+						  val ? val : "UNDEF");
 		switch_channel_set_variable(channel, var, val);
 
 		if (var && val) {
@@ -929,17 +930,20 @@
 				if (this) {
 					char *var, *val;
 					p = this;
-					while(*p == ' ') *p++ = '\0';
+					while (*p == ' ')
+						*p++ = '\0';
 					this = p;
-				
+
 					var = this;
 					val = NULL;
 					if ((val = strchr(var, '='))) {
 						p = val - 1;
 						*val++ = '\0';
-						while(*p == ' ') *p-- = '\0';
+						while (*p == ' ')
+							*p-- = '\0';
 						p = val;
-						while(*p == ' ') *p++ = '\0';
+						while (*p == ' ')
+							*p++ = '\0';
 						val = p;
 						switch_event_add_header(event, SWITCH_STACK_BOTTOM, var, "%s", val);
 					}
@@ -1019,8 +1023,8 @@
 	switch_time_t thetime;
 	char *p;
 	if (!switch_strlen_zero(cmd) && (p = strchr(cmd, '|'))) {
-		thetime = switch_time_make(atoi(cmd),0);
-		cmd = p+1;
+		thetime = switch_time_make(atoi(cmd), 0);
+		cmd = p + 1;
 	} else {
 		thetime = switch_timestamp_now();
 	}
@@ -1091,7 +1095,7 @@
 static char *ivr_cf_name = "ivr.conf";
 
 #ifdef _TEST_CALLBACK_
-static switch_ivr_action_t menu_handler(switch_ivr_menu_t * menu, char *param, char *buf, size_t buflen, void *obj)
+static switch_ivr_action_t 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;
 
@@ -1107,7 +1111,7 @@
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_event_t *params;
-	
+
 	if (channel) {
 		switch_xml_t cxml = NULL, cfg = NULL, xml_menus = NULL, xml_menu = NULL;
 
@@ -1118,7 +1122,7 @@
 
 		if ((cxml = switch_xml_open_cfg(ivr_cf_name, &cfg, params)) != NULL) {
 			if ((xml_menus = switch_xml_child(cfg, "menus"))) {
-				xml_menu = switch_xml_find_child(xml_menus, "menu", "name", (char *)data);
+				xml_menu = switch_xml_find_child(xml_menus, "menu", "name", (char *) data);
 
 				// if the menu was found
 				if (xml_menu != NULL) {
@@ -1134,7 +1138,7 @@
 						switch_xml_free(cxml);
 						cxml = NULL;
 						switch_channel_pre_answer(channel);
-						switch_ivr_menu_execute(session, menu_stack, (char *)data, NULL);
+						switch_ivr_menu_execute(session, menu_stack, (char *) data, NULL);
 						switch_ivr_menu_stack_free(menu_stack);
 					} else {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create menu\n");
@@ -1164,12 +1168,12 @@
 SWITCH_STANDARD_APP(dtmf_session_generate_function)
 {
 	switch_bool_t do_read = SWITCH_TRUE;
-	
+
 	if (!switch_strlen_zero(data)) {
 		if (!strcasecmp(data, "write")) {
 			do_read = SWITCH_FALSE;
 		}
-	}	
+	}
 	switch_ivr_inband_dtmf_generate_session(session, do_read);
 }
 
@@ -1185,9 +1189,9 @@
 
 SWITCH_STANDARD_APP(system_session_function)
 {
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n",data);
-    if (!system(data)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Failed to execute command: %s\n",data);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n", data);
+	if (!system(data)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", data);
 	}
 }
 
@@ -1211,7 +1215,7 @@
 	if (argv[3]) {
 		uint32_t mto;
 		if (*argv[3] == '+') {
-			if ((mto = atol(argv[3]+1)) > 0) {
+			if ((mto = atol(argv[3] + 1)) > 0) {
 				to = switch_timestamp(NULL) + mto;
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
@@ -1225,7 +1229,7 @@
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Enabling tone detection '%s' '%s'\n", argv[0], argv[1]);
-	
+
 	switch_ivr_tone_detect_session(session, argv[0], argv[1], argv[2], to, argv[4], argv[5]);
 }
 
@@ -1261,7 +1265,7 @@
 static switch_status_t bridge_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
 {
 	char *str = (char *) buf;
-	
+
 	if (str && input && itype == SWITCH_INPUT_TYPE_DTMF) {
 		switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
 		if (strchr(str, dtmf->digit)) {
@@ -1288,7 +1292,7 @@
 				terminators = NULL;
 			}
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digit %c\n", dtmf->digit);
-			
+
 			for (p = terminators; p && *p; p++) {
 				if (*p == dtmf->digit) {
 					return SWITCH_STATUS_BREAK;
@@ -1326,7 +1330,7 @@
 	}
 
 	argc = switch_separate_string(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
-	
+
 	if (argc == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Params!\n");
 		return;
@@ -1381,11 +1385,11 @@
 
 	switch (itype) {
 	case SWITCH_INPUT_TYPE_DTMF:
-		{			
+		{
 			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
 			switch_channel_t *channel = switch_core_session_get_channel(session);
 			switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
-			
+
 			if (dtmf->digit == '#') {
 				return SWITCH_STATUS_FALSE;
 			}
@@ -1404,12 +1408,12 @@
 					}
 					switch_core_session_rwunlock(b_session);
 				}
-				
+
 				if ((extension = switch_caller_extension_new(peer_session, app, app_arg)) == 0) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
 					abort();
 				}
-				
+
 				switch_caller_extension_add_application(peer_session, extension, app, app_arg);
 				switch_channel_set_caller_extension(peer_channel, extension);
 				switch_channel_set_flag(peer_channel, CF_TRANSFER);
@@ -1418,7 +1422,7 @@
 
 				return SWITCH_STATUS_FALSE;
 			}
-			
+
 		}
 		break;
 	default:
@@ -1444,7 +1448,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nHangup Command uuid_bridge(%s):\n%s\n", id, switch_str_nil((char *) stream.data));
 			switch_safe_free(stream.data);
 		}
-		
+
 		switch_core_event_hook_remove_state_change(session, hanguphook);
 	}
 	return SWITCH_STATUS_SUCCESS;
@@ -1468,8 +1472,8 @@
 	}
 
 	switch_channel_set_variable(channel, SWITCH_HOLDING_UUID_VARIABLE, bond);
-	
-	
+
+
 	if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
 		timelimit = atoi(var);
 	}
@@ -1481,9 +1485,9 @@
 	peer_channel = switch_core_session_get_channel(peer_session);
 	switch_channel_set_flag(peer_channel, CF_INNER_BRIDGE);
 	switch_channel_set_flag(channel, CF_INNER_BRIDGE);
-	
+
 	switch_ivr_multi_threaded_bridge(session, peer_session, xfer_on_dtmf, peer_session, NULL);
-	
+
 	switch_channel_clear_flag(peer_channel, CF_INNER_BRIDGE);
 	switch_channel_clear_flag(channel, CF_INNER_BRIDGE);
 
@@ -1510,13 +1514,13 @@
 
 			switch_core_session_rwunlock(b_session);
 		}
-		
+
 		switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, bond);
 	}
-	
+
 	switch_core_session_rwunlock(peer_session);
-	
- end:
+
+  end:
 	switch_channel_set_variable(channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
 }
 
@@ -1538,12 +1542,12 @@
 	if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No arguements specified.\n");		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No arguements specified.\n");
 		return;
 	}
 
 	min_digits = atoi(argv[0]);
-	
+
 	if (argc > 1) {
 		max_digits = atoi(argv[1]);
 	}
@@ -1551,19 +1555,19 @@
 	if (argc > 2) {
 		prompt_audio_file = argv[2];
 	}
-	
+
 	if (argc > 3) {
 		var_name = argv[3];
 	}
-	
+
 	if (argc > 4) {
 		timeout = atoi(argv[4]);
 	}
-	
+
 	if (argc > 5) {
 		valid_terminators = argv[5];
 	}
-	
+
 	if (min_digits <= 1) {
 		min_digits = 1;
 	}
@@ -1571,7 +1575,7 @@
 	if (max_digits < min_digits) {
 		max_digits = min_digits;
 	}
-	
+
 	if (timeout <= 1000) {
 		timeout = 1000;
 	}
@@ -1634,7 +1638,7 @@
 	if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		path = argv[0];
-		for(x = 1; x < argc; x++) {
+		for (x = 1; x < argc; x++) {
 			if (strchr(argv[x], '+')) {
 				limit = atoi(argv[x]);
 			} else if (!switch_strlen_zero(argv[x])) {
@@ -1659,7 +1663,7 @@
 	switch_input_args_t args = { 0 };
 	switch_file_handle_t fh = { 0 };
 	int argc;
-    char *mydata, *argv[4] = { 0 };
+	char *mydata, *argv[4] = { 0 };
 	char *l = NULL;
 	const char *tmp;
 	int rate;
@@ -1667,10 +1671,10 @@
 	if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No file specified.\n");		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No file specified.\n");
 		return;
 	}
-	
+
 	path = argv[0];
 	l = argv[1];
 
@@ -1726,11 +1730,12 @@
 
 	path = switch_core_session_strdup(session, data);
 
-	if (!path) return;
+	if (!path)
+		return;
 
 	if ((p = strchr(path, '+'))) {
 		char *q = p - 1;
-		while(q && *q == ' ') {
+		while (q && *q == ' ') {
 			*q = '\0';
 			q--;
 		}
@@ -1767,11 +1772,11 @@
 	}
 
 	continue_on_fail = switch_channel_get_variable(caller_channel, "continue_on_fail");
-	
+
 	if ((var = switch_channel_get_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE)) && switch_true(var)) {
 		switch_channel_set_flag(caller_channel, CF_PROXY_MEDIA);
 	}
-	
+
 	if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)
 		|| ((var = switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE)) && switch_true(var))) {
 		if (!switch_channel_test_flag(caller_channel, CF_ANSWERED)
@@ -1801,7 +1806,7 @@
 		   'true' to continue on all failures.
 		   'false' to not continue.
 		   A list of codes either names or numbers eg "user_busy,normal_temporary_failure,603"
-		*/
+		 */
 		if (continue_on_fail) {
 			const char *cause_str;
 			char cause_num[35] = "";
@@ -1850,11 +1855,11 @@
 			} else {
 				switch_channel_t *channel = switch_core_session_get_channel(session);
 				switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
-				char *a_key = (char *)switch_channel_get_variable(channel, "bridge_terminate_key");
-				char *b_key = (char *)switch_channel_get_variable(peer_channel, "bridge_terminate_key");
+				char *a_key = (char *) switch_channel_get_variable(channel, "bridge_terminate_key");
+				char *b_key = (char *) switch_channel_get_variable(peer_channel, "bridge_terminate_key");
 				int ok = 0;
 				switch_input_callback_function_t func = NULL;
-				
+
 				if (a_key) {
 					a_key = switch_core_session_strdup(session, a_key);
 					ok++;
@@ -1873,7 +1878,7 @@
 				switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, a_key);
 			}
 		}
-	end:
+	  end:
 		if (peer_session) {
 			switch_core_session_rwunlock(peer_session);
 		}
@@ -1885,9 +1890,7 @@
 static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
 												 switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, 
-												 switch_memory_pool_t **pool,
-												 switch_originate_flag_t flags);
+												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 switch_io_routines_t user_io_routines = {
 	/*.outgoing_channel */ user_outgoing_channel
 };
@@ -1895,11 +1898,9 @@
 static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
 												 switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, 
-												 switch_memory_pool_t **pool,
-												 switch_originate_flag_t flags)
+												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
-	switch_xml_t x_domain = NULL, xml = NULL, x_user = NULL, x_param, x_params;	
+	switch_xml_t x_domain = NULL, xml = NULL, x_user = NULL, x_param, x_params;
 	char *user = NULL, *domain = NULL;
 	const char *dest = NULL;
 	static switch_call_cause_t cause = SWITCH_CAUSE_UNALLOCATED;
@@ -1912,7 +1913,8 @@
 
 	user = strdup(outbound_profile->destination_number);
 
-	if (!user) goto done;
+	if (!user)
+		goto done;
 
 	if (!(domain = strchr(user, '@'))) {
 		goto done;
@@ -1934,7 +1936,7 @@
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 			const char *var = switch_xml_attr(x_param, "name");
 			const char *val = switch_xml_attr(x_param, "value");
-			
+
 			if (!strcasecmp(var, "dial-string")) {
 				dest = val;
 				break;
@@ -1946,7 +1948,7 @@
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 			const char *var = switch_xml_attr(x_param, "name");
 			const char *val = switch_xml_attr(x_param, "value");
-			
+
 			if (!strcasecmp(var, "dial-string")) {
 				dest = val;
 				break;
@@ -1965,10 +1967,10 @@
 			if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
 				timelimit = atoi(var);
 			}
-			
+
 			switch_channel_set_variable(channel, "dialed_user", user);
 			switch_channel_set_variable(channel, "dialed_domain", domain);
-			
+
 			d_dest = switch_channel_expand_variables(channel, dest);
 
 		} else {
@@ -1977,7 +1979,7 @@
 				switch_event_create(&event, SWITCH_EVENT_MESSAGE);
 				switch_assert(event);
 			}
-			
+
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", user);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
 			d_dest = switch_event_expand_headers(event, dest);
@@ -1985,7 +1987,7 @@
 				switch_event_destroy(&event);
 			}
 		}
-		
+
 		if ((flags & SOF_FORKED_DIAL)) {
 			myflags |= SOF_NOBLOCK;
 		}
@@ -1995,7 +1997,7 @@
 			switch_caller_profile_t *cp;
 
 			new_channel = switch_core_session_get_channel(*new_session);
-			
+
 			if ((context = switch_channel_get_variable(new_channel, "user_context"))) {
 				if ((cp = switch_channel_get_caller_profile(new_channel))) {
 					cp->context = switch_core_strdup(cp->pool, context);
@@ -2027,12 +2029,12 @@
 		}
 	}
 
- done:
+  done:
 
 	if (xml) {
 		switch_xml_free(xml);
 	}
-	
+
 	if (params) {
 		switch_event_destroy(&params);
 	}
@@ -2080,20 +2082,22 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	user_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
-    user_endpoint_interface->interface_name = "USER";
-    user_endpoint_interface->io_routines = &user_io_routines;
+	user_endpoint_interface->interface_name = "USER";
+	user_endpoint_interface->io_routines = &user_io_routines;
 
 	SWITCH_ADD_API(api_interface, "strepoch", "Convert a date string into epoch time", strepoch_api_function, "<string>");
 	SWITCH_ADD_API(api_interface, "chat", "chat", chat_api_function, "<proto>|<from>|<to>|<message>");
 	SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, "<format_string>");
 	SWITCH_ADD_API(api_interface, "presence", "presence", presence_api_function, "<user> <rpid> <message>");
-	SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number",
+				   SAF_SUPPORT_NOMEDIA);
 
 	SWITCH_ADD_APP(app_interface, "hold", "Send a hold message", "Send a hold message", hold_function, HOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "unhold", "Send a un-hold message", "Send a un-hold message", unhold_function, UNHOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "transfer", "Transfer a channel", TRANSFER_LONG_DESC, transfer_function, "<exten> [<dialplan> <context>]", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "check_acl", "Check an ip against an ACL list", 
-				   "Check an ip against an ACL list", check_acl_function, "<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "transfer", "Transfer a channel", TRANSFER_LONG_DESC, transfer_function, "<exten> [<dialplan> <context>]",
+				   SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "check_acl", "Check an ip against an ACL list", "Check an ip against an ACL list", check_acl_function,
+				   "<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "delay_echo", "echo audio at a specified delay", "Delay n ms", delay_function, "<delay ms>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "strftime", NULL, NULL, strftime_function, NULL, SAF_SUPPORT_NOMEDIA);
@@ -2106,36 +2110,50 @@
 	SWITCH_ADD_APP(app_interface, "log", "Logs a channel variable", LOG_LONG_DESC, log_function, "<varname>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "info", "Display Call Info", "Display Call Info", info_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "event", "Fire an event", "Fire an event", event_function, "", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "export", "Export a channel variable across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "export", "Export a channel variable across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>",
+				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "set", "Set a channel variable", SET_LONG_DESC, set_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "set_global", "Set a global variable", SET_GLOBAL_LONG_DESC, set_global_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "set_profile_var", "Set a caller profile variable", SET_PROFILE_VAR_LONG_DESC, set_profile_var_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "set_global", "Set a global variable", SET_GLOBAL_LONG_DESC, set_global_function, "<varname>=<value>",
+				   SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "set_profile_var", "Set a caller profile variable", SET_PROFILE_VAR_LONG_DESC, set_profile_var_function,
+				   "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "unset", "Unset a channel variable", UNSET_LONG_DESC, unset_function, "<varname>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "ring_ready", "Indicate Ring_Ready", "Indicate Ring_Ready on a channel.", ring_ready_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "break", "Break", "Set the break flag.", break_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "detect_speech", "Detect speech", "Detect speech on a channel.", detect_speech_function, DETECT_SPEECH_SYNTAX, SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "ivr", "Run an ivr menu", "Run an ivr menu.", ivr_application_function, "<menu_name>", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "<redirect_data>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "<redirect_data>",
+				   SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>",
+				   SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>",
+				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "sched_hangup", SCHED_HANGUP_DESCR, SCHED_HANGUP_DESCR, sched_hangup_function, "[+]<time> [<cause>]", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "sched_broadcast", SCHED_BROADCAST_DESCR, SCHED_BROADCAST_DESCR, sched_broadcast_function, "[+]<time> <path> [aleg|bleg|both]", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "sched_transfer", SCHED_TRANSF_DESCR, SCHED_TRANSF_DESCR, sched_transfer_function, "[+]<time> <extension> <dialplan> <context>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>",
+				   SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>",
+				   SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "sched_hangup", SCHED_HANGUP_DESCR, SCHED_HANGUP_DESCR, sched_hangup_function, "[+]<time> [<cause>]",
+				   SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "sched_broadcast", SCHED_BROADCAST_DESCR, SCHED_BROADCAST_DESCR, sched_broadcast_function,
+				   "[+]<time> <path> [aleg|bleg|both]", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "sched_transfer", SCHED_TRANSF_DESCR, SCHED_TRANSF_DESCR, sched_transfer_function,
+				   "[+]<time> <extension> <dialplan> <context>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "execute_extension", "Execute an extension", "Execute an extension", exe_function, EXE_SYNTAX, SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX, SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "bind_meta_app", "Bind a key to an application", "Bind a key to an application", dtmf_bind_function, BIND_SYNTAX, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX,
+				   SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "bind_meta_app", "Bind a key to an application", "Bind a key to an application", dtmf_bind_function, BIND_SYNTAX,
+				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "intercept", "intercept", "intercept", intercept_function, INTERCEPT_SYNTAX, SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "eavesdrop", "eavesdrop on a uuid", "eavesdrop on a uuid", eavesdrop_function, eavesdrop_SYNTAX, SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "three_way", "three way call with a uuid", "three way call with a uuid", three_way_function, threeway_SYNTAX, SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "set_user", "Set a User", "Set a User", set_user_function, SET_USER_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "stop_dtmf", "stop inband dtmf", "Stop detecting inband dtmf.", stop_dtmf_session_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "stop_dtmf_generate", "stop inband dtmf generation", "Stop generating inband dtmf.", 
+	SWITCH_ADD_APP(app_interface, "stop_dtmf_generate", "stop inband dtmf generation", "Stop generating inband dtmf.",
 				   stop_dtmf_session_generate_function, "[write]", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "start_dtmf_generate", "Generate dtmf", "Generate inband dtmf on the session", dtmf_session_generate_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "start_dtmf_generate", "Generate dtmf", "Generate inband dtmf on the session", dtmf_session_generate_function, "",
+				   SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "stop_tone_detect", "stop detecting tones", "Stop detecting tones", stop_fax_detect_session_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "fax_detect", "Detect faxes", "Detect fax send tone", fax_detect_session_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "tone_detect", "Detect tones", "Detect tones", tone_detect_session_function, "", SAF_NONE);
@@ -2148,13 +2166,19 @@
 	SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, "<min> <max> <file> <var name> <timeout> <terminators>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "stop_record_session", "Stop Record Session", STOP_SESS_REC_DESC, stop_record_session_function, "<path>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "record_session", "Record Session", SESS_REC_DESC, record_session_function, "<path>", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function, "<path> [<time_limit_secs>] [<silence_thresh>] [<silence_hits>]", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "stop_displace_session", "Stop Displace File", "Stop Displacing to a file", stop_displace_session_function, "<path>", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "displace_session", "Displace File", DISPLACE_DESC, displace_session_function, "<path> [+time_limit_ms] [mux]", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function,
+				   "<path> [<time_limit_secs>] [<silence_thresh>] [<silence_hits>]", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "stop_displace_session", "Stop Displace File", "Stop Displacing to a file", stop_displace_session_function, "<path>",
+				   SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "displace_session", "Displace File", DISPLACE_DESC, displace_session_function, "<path> [+time_limit_ms] [mux]",
+				   SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "speak", "Speak text", SPEAK_DESC, speak_function, "<engine>|<voice>|<text>", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "clear_speech_cache", "Clear Speech Handle Cache", "Clear Speech Handle Cache", clear_speech_cache_function, "", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "<channel_url>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "clear_speech_cache", "Clear Speech Handle Cache", "Clear Speech Handle Cache", clear_speech_cache_function, "",
+				   SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "<channel_url>",
+				   SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>",
+				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "say", "say", "say", say_function, SAY_SYNTAX, SAF_NONE);
 
 	SWITCH_ADD_DIALPLAN(dp_interface, "inline", inline_dialplan_hunt);

Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	Tue May 27 00:54:52 2008
@@ -200,16 +200,16 @@
 	return out;
 }
 
-static void dnserror(enum_query_t * q, int errnum)
+static void dnserror(enum_query_t *q, int errnum)
 {
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to lookup %s record for %s: %s\n",
 					  dns_typename(q->qtyp), dns_dntosp(q->dn), dns_strerror(errnum));
 	q->errs++;
 }
 
 
-static void add_result(enum_query_t * q, int order, int preference, char *service, char *route, int supported)
+static void add_result(enum_query_t *q, int order, int preference, char *service, char *route, int supported)
 {
 	enum_record_t *new_result, *rp, *prev = NULL;
 
@@ -255,7 +255,7 @@
 }
 
 
-static void free_results(enum_record_t ** results)
+static void free_results(enum_record_t **results)
 {
 	enum_record_t *fp, *rp;
 
@@ -269,7 +269,7 @@
 	*results = NULL;
 }
 
-static void parse_rr(const struct dns_parse *p, enum_query_t * q, struct dns_rr *rr)
+static void parse_rr(const struct dns_parse *p, enum_query_t *q, struct dns_rr *rr)
 {
 	const unsigned char *pkt = p->dnsp_pkt;
 	const unsigned char *end = p->dnsp_end;
@@ -287,17 +287,17 @@
 	int argc = 0;
 	char *argv[4] = { 0 };
 	int n;
-	char string_arg[3][256] = {{0}};
+	char string_arg[3][256] = { {0} };
 
 	switch (rr->dnsrr_typ) {
-	case DNS_T_NAPTR:/* prio weight port targetDN */
+	case DNS_T_NAPTR:			/* prio weight port targetDN */
 		c = dptr;
-		c += 4; /* order, pref */
+		c += 4;					/* order, pref */
 
 		for (n = 0; n < 3; ++n) {
 			if (c >= dend) {
 				goto xperr;
-			} else { 
+			} else {
 				c += *c + 1;
 			}
 		}
@@ -307,18 +307,18 @@
 		}
 
 		c = dptr;
-		order = dns_get16(c+0);
-		preference = dns_get16(c+2);
+		order = dns_get16(c + 0);
+		preference = dns_get16(c + 2);
 		flags = (char) dns_get16(c + 4);
 		c += 4;
 
-		for(n = 0; n < 3; n++) {
+		for (n = 0; n < 3; n++) {
 			uint32_t len = *c++, cpylen = len;
 			switch_assert(string_arg[n]);
 			if (len > sizeof(string_arg[n]) - 1) {
 				cpylen = sizeof(string_arg[n]) - 1;
 			}
-			strncpy(string_arg[n], (char *)c, cpylen);
+			strncpy(string_arg[n], (char *) c, cpylen);
 			*(string_arg[n] + len) = '\0';
 			c += len;
 		}
@@ -357,7 +357,7 @@
 				}
 
 				switch_mutex_lock(MUTEX);
-				for(route = globals.route_order; route; route = route->next) {
+				for (route = globals.route_order; route; route = route->next) {
 					if (strcasecmp(service, route->service)) {
 						continue;
 					}
@@ -377,9 +377,9 @@
 				if (!supported) {
 					add_result(q, order, preference, service, uri, 0);
 				}
-			} 
+			}
 			switch_mutex_unlock(MUTEX);
-			
+
 
 			switch_regex_safe_free(re);
 		}
@@ -392,7 +392,7 @@
 
 	return;
 
-	xperr:
+  xperr:
 	//printf("<parse error>\n");
 	return;
 }
@@ -452,7 +452,7 @@
 }
 
 
-static switch_status_t enum_lookup(char *root, char *in, enum_record_t ** results)
+static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results)
 {
 	switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
 	char *name = NULL;
@@ -467,7 +467,7 @@
 	char *num, *mnum = NULL, *mroot = NULL, *p;
 
 	mnum = switch_mprintf("%s%s", *in == '+' ? "" : "+", in);
-	
+
 	if ((p = strchr(mnum, '*'))) {
 		*p++ = '\0';
 		mroot = switch_mprintf("%s.%s", p, root ? root : globals.isn_root);
@@ -587,15 +587,15 @@
 		}
 		switch_channel_set_variable(channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, "true");
 
-		
+
 		for (rp = results; rp; rp = rp->next) {
 			if (!rp->supported) {
 				continue;
 			}
 
-			switch_caller_extension_add_application(session, extension, "bridge", rp->route);			
+			switch_caller_extension_add_application(session, extension, "bridge", rp->route);
 		}
-		
+
 
 		free_results(&results);
 	}
@@ -644,7 +644,7 @@
 					continue;
 				}
 				switch_snprintf(vbuf, sizeof(vbuf), "enum_route_%d", cnt++);
-				switch_channel_set_variable(channel, vbuf, rp->route);						
+				switch_channel_set_variable(channel, vbuf, rp->route);
 				if (rp->preference == last_pref && rp->order == last_order) {
 					*last_delim = ',';
 				}
@@ -656,7 +656,7 @@
 				rbp += l;
 				rbl -= l;
 			}
-			
+
 			switch_snprintf(vbuf, sizeof(vbuf), "%d", cnt);
 			switch_channel_set_variable(channel, "enum_route_count", vbuf);
 			*(rbuf + strlen(rbuf) - 1) = '\0';
@@ -681,7 +681,7 @@
 	int last_order = -1, last_pref = -2;
 	char *last_delim = "|";
 	int ok = 0;
-	
+
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "%s", "none");
 		return SWITCH_STATUS_SUCCESS;
@@ -709,7 +709,7 @@
 				l = strlen(rp->route) + 1;
 				rbp += l;
 				rbl -= l;
-			
+
 			}
 			*(rbuf + strlen(rbuf) - 1) = '\0';
 			stream->write_function(stream, "%s", rbuf);
@@ -738,7 +738,7 @@
 	memset(&globals, 0, sizeof(globals));
 	switch_core_new_memory_pool(&globals.pool);
 	globals.timeout = 10;
-    load_config();
+	load_config();
 	switch_mutex_unlock(MUTEX);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ENUM Reloaded\n");
 
@@ -772,7 +772,7 @@
 		if (!strcasecmp(dest, "reload")) {
 			do_load();
 			stream->write_function(stream, "+OK ENUM Reloaded.\n");
-            return SWITCH_STATUS_SUCCESS;
+			return SWITCH_STATUS_SUCCESS;
 
 		}
 
@@ -843,10 +843,11 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_API(api_interface, "enum", "ENUM", enum_function, "");
 	SWITCH_ADD_API(api_interface, "enum_auto", "ENUM", enum_api, "");
-	SWITCH_ADD_APP(app_interface, "enum", "Perform an ENUM lookup", "Perform an ENUM lookup", enum_app_function, "[reload | <number> [<root>]]", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "enum", "Perform an ENUM lookup", "Perform an ENUM lookup", enum_app_function, "[reload | <number> [<root>]]",
+				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_DIALPLAN(dp_interface, "enum", enum_dialplan_hunt);
 
-	
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c	Tue May 27 00:54:52 2008
@@ -63,7 +63,7 @@
 	switch_status_t status;
 	switch_size_t bytes;
 	ls_control_packet_t control_packet;
-	switch_codec_t codec = { 0}, *read_codec, *orig_codec = NULL;
+	switch_codec_t codec = { 0 }, *read_codec, *orig_codec = NULL;
 	uint32_t flags = 0;
 	const char *err;
 	switch_rtp_t *rtp_session = NULL;
@@ -71,7 +71,7 @@
 	char guess_ip[25];
 	ls_how_t ready = SEND_TYPE_UNKNOWN;
 	int argc;
-    char *mydata, *argv[5];
+	char *mydata, *argv[5];
 	char *mcast_ip = "224.168.168.168";
 	switch_port_t mcast_port = 34567;
 	switch_port_t mcast_control_port = 6061;
@@ -84,7 +84,7 @@
 		assert(mydata != NULL);
 
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-	
+
 		if ((var = switch_channel_get_variable(channel, "esf_multicast_ip"))) {
 			mcast_ip = switch_core_session_strdup(session, var);
 		}
@@ -95,23 +95,23 @@
 
 		if (!switch_strlen_zero(argv[1])) {
 			mcast_port_str = argv[1];
-			mcast_port = (switch_port_t)atoi(mcast_port_str);
+			mcast_port = (switch_port_t) atoi(mcast_port_str);
 		}
 
 		if (!switch_strlen_zero(argv[2])) {
-			mcast_control_port = (switch_port_t)atoi(argv[2]);
+			mcast_control_port = (switch_port_t) atoi(argv[2]);
 		}
 	}
 
-	
+
 	if (switch_true(switch_channel_get_variable(channel, SWITCH_BYPASS_MEDIA_VARIABLE))) {
 		switch_core_session_message_t msg = { 0 };
 
 		ready = SEND_TYPE_NOMEDIA;
-		
+
 		switch_channel_set_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, mcast_ip);
 		switch_channel_set_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, mcast_port_str);
-		
+
 		/* special answer with the mcast addr */
 		msg.from = __FILE__;
 		msg.string_arg = "recvonly";
@@ -119,7 +119,7 @@
 		switch_core_session_receive_message(session, &msg);
 	} else {
 		switch_channel_answer(channel);
-	} 
+	}
 
 	read_codec = switch_core_session_get_read_codec(session);
 
@@ -128,14 +128,14 @@
 		goto fail;
 	}
 
-	if (switch_sockaddr_info_get(&control_packet_addr, mcast_ip, SWITCH_UNSPEC, 
+	if (switch_sockaddr_info_get(&control_packet_addr, mcast_ip, SWITCH_UNSPEC,
 								 mcast_control_port, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error 3\n");
 		goto fail;
 	}
 
 
-	while(!ready) {
+	while (!ready) {
 		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 		if (read_frame && switch_test_flag(read_frame, SFF_CNG)) {
 			continue;
@@ -144,7 +144,7 @@
 		if (!SWITCH_READ_ACCEPTABLE(status) || !read_frame) {
 			goto fail;
 		}
-		
+
 		if (read_frame->packet && read_frame->packetlen && read_codec->implementation->ianacode == 0) {
 			ready = SEND_TYPE_RAW;
 		} else {
@@ -153,23 +153,23 @@
 	}
 
 	if (ready == SEND_TYPE_RTP) {
-        if (read_codec->implementation->ianacode != 0) {
-            if (switch_core_codec_init(&codec,
-                                       "PCMU",
-                                       NULL,
-                                       8000,
-                                       20,
-                                       1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, 
-                                       NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
-                orig_codec = read_codec;
-                read_codec = &codec;
-                switch_core_session_set_read_codec(session, read_codec);
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec Activation Success\n");
-            } else {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Activation Fail\n");
-                goto fail;
-            }
-        }
+		if (read_codec->implementation->ianacode != 0) {
+			if (switch_core_codec_init(&codec,
+									   "PCMU",
+									   NULL,
+									   8000,
+									   20,
+									   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+									   NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+				orig_codec = read_codec;
+				read_codec = &codec;
+				switch_core_session_set_read_codec(session, read_codec);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec Activation Success\n");
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Activation Fail\n");
+				goto fail;
+			}
+		}
 
 		if ((var = switch_channel_get_variable(channel, "esf_broadcast_ip"))) {
 			esf_broadcast_ip = switch_core_session_strdup(session, var);
@@ -191,9 +191,8 @@
 									 read_codec->implementation->ianacode,
 									 read_codec->implementation->samples_per_frame,
 									 read_codec->implementation->microseconds_per_frame,
-									 (switch_rtp_flag_t) flags,
-									 "soft", &err, switch_core_session_get_pool(session));
-	
+									 (switch_rtp_flag_t) flags, "soft", &err, switch_core_session_get_pool(session));
+
 		if (!switch_rtp_ready(rtp_session)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Error\n");
 			goto fail;
@@ -207,23 +206,23 @@
 		}
 	}
 
-	control_packet.unique_id = htonl((u_long)switch_timestamp(NULL));
+	control_packet.unique_id = htonl((u_long) switch_timestamp(NULL));
 	control_packet.command = htonl(LS_START_BCAST);
 	control_packet.ip = inet_addr(mcast_ip);
 	control_packet.port = htonl(mcast_port);
 
 	bytes = 16;
-	switch_socket_sendto(socket, control_packet_addr, 0, (void *)&control_packet, &bytes);
+	switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
 	bytes = 16;
-	switch_socket_sendto(socket, control_packet_addr, 0, (void *)&control_packet, &bytes);
+	switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
 
-	for(;;) {
+	for (;;) {
 
 		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 
-        if (!SWITCH_READ_ACCEPTABLE(status)) {
-            break;
-        }
+		if (!SWITCH_READ_ACCEPTABLE(status)) {
+			break;
+		}
 		if (switch_test_flag(read_frame, SFF_CNG)) {
 			continue;
 		}
@@ -235,23 +234,23 @@
 		}
 	}
 
-	control_packet.unique_id = htonl((u_long)switch_timestamp(NULL));
+	control_packet.unique_id = htonl((u_long) switch_timestamp(NULL));
 	control_packet.command = htonl(LS_STOP_BCAST);
 	bytes = 8;
-	switch_socket_sendto(socket, control_packet_addr, 0, (void *)&control_packet, &bytes);
+	switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
 	bytes = 8;
-	switch_socket_sendto(socket, control_packet_addr, 0, (void *)&control_packet, &bytes);
+	switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
 
- fail:
+  fail:
 
-    if (orig_codec) {
-        switch_core_session_set_read_codec(session, orig_codec);
-        switch_core_codec_destroy(&codec);
-    }
+	if (orig_codec) {
+		switch_core_session_set_read_codec(session, orig_codec);
+		switch_core_codec_destroy(&codec);
+	}
 
 	if (rtp_session && ready == SEND_TYPE_RTP && switch_rtp_ready(rtp_session)) {
 		switch_rtp_destroy(&rtp_session);
-	}	
+	}
 
 	if (socket) {
 		switch_socket_close(socket);

Modified: freeswitch/trunk/src/mod/applications/mod_expr/expreval.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/expreval.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/expreval.c	Tue May 27 00:54:52 2008
@@ -25,244 +25,224 @@
 
 
 /* This routine will evaluate an expression */
-int exprEval(exprObj *obj, EXPRTYPE *val)
-    {
-    EXPRTYPE dummy;
-
-    if(val ==  NULL)
-        val = &dummy;
-
-    /* Make sure it was parsed successfully */
-    if(!obj->parsedbad && obj->parsedgood && obj->headnode)
-        {
-        /* Do NOT reset the break count.  Let is accumulate
-           between calls until breaker function is called */
-        return exprEvalNode(obj, obj->headnode, 0, val);
-        }
-    else
-        return EXPR_ERROR_BADEXPR;
-    }
+int exprEval(exprObj * obj, EXPRTYPE * val)
+{
+	EXPRTYPE dummy;
+
+	if (val == NULL)
+		val = &dummy;
+
+	/* Make sure it was parsed successfully */
+	if (!obj->parsedbad && obj->parsedgood && obj->headnode) {
+		/* Do NOT reset the break count.  Let is accumulate
+		   between calls until breaker function is called */
+		return exprEvalNode(obj, obj->headnode, 0, val);
+	} else
+		return EXPR_ERROR_BADEXPR;
+}
 
 /* Evaluate a node */
-int exprEvalNode(exprObj *obj, exprNode *nodes, int curnode, EXPRTYPE *val)
-    {
-    int err;
-    int pos;
-    EXPRTYPE d1, d2;
-
-    if(obj == NULL || nodes == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    /* Update n to point to correct node */
-    nodes += curnode;
-
-    /* Check breaker count */
-    if(obj->breakcur-- <= 0)
-        {
-        /* Reset count before returning */
-        obj->breakcur = obj->breakcount;
-                
-        if(exprGetBreakResult(obj))
-            {
-            return EXPR_ERROR_BREAK;
-            }
-        }
-
-    switch(nodes->type)
-        {
-        case EXPR_NODETYPE_MULTI:
-            {
-            /* Multi for multiple expressions in one string */
-            for(pos = 0; pos < nodes->data.oper.nodecount; pos++)
-                {
-                err = exprEvalNode(obj, nodes->data.oper.nodes, pos, val);
-                if(err)
-                    return err;
-                }
-            break;
-            }
-
-        case EXPR_NODETYPE_ADD:
-            {
-            /* Addition */
-            err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
-            if(!err)
-                err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
-            if(!err)
-                *val = d1 + d2;
-            else
-                return err;
-
-            break;
-            }
-
-        case EXPR_NODETYPE_SUBTRACT:
-            {
-            /* Subtraction */
-            err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-            
-            if(!err)
-                err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
-            if(!err)
-                *val = d1 - d2;
-            else
-                return err;
-
-            break;
-            }
-
-        case EXPR_NODETYPE_MULTIPLY:
-            {
-            /* Multiplication */
-            err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
-            if(!err)
-                err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
-            if(!err)
-                *val = d1 * d2;
-            else
-                return err;
-
-            break;
-            }
-
-        case EXPR_NODETYPE_DIVIDE:
-            {
-            /* Division */
-            err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
-            if(!err)
-                err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
-            if(!err)
-                {
-                if(d2 != 0.0)
-                    *val = d1 / d2;
-                else
-                    {
+int exprEvalNode(exprObj * obj, exprNode * nodes, int curnode, EXPRTYPE * val)
+{
+	int err;
+	int pos;
+	EXPRTYPE d1, d2;
+
+	if (obj == NULL || nodes == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	/* Update n to point to correct node */
+	nodes += curnode;
+
+	/* Check breaker count */
+	if (obj->breakcur-- <= 0) {
+		/* Reset count before returning */
+		obj->breakcur = obj->breakcount;
+
+		if (exprGetBreakResult(obj)) {
+			return EXPR_ERROR_BREAK;
+		}
+	}
+
+	switch (nodes->type) {
+	case EXPR_NODETYPE_MULTI:
+		{
+			/* Multi for multiple expressions in one string */
+			for (pos = 0; pos < nodes->data.oper.nodecount; pos++) {
+				err = exprEvalNode(obj, nodes->data.oper.nodes, pos, val);
+				if (err)
+					return err;
+			}
+			break;
+		}
+
+	case EXPR_NODETYPE_ADD:
+		{
+			/* Addition */
+			err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+			if (!err)
+				err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+			if (!err)
+				*val = d1 + d2;
+			else
+				return err;
+
+			break;
+		}
+
+	case EXPR_NODETYPE_SUBTRACT:
+		{
+			/* Subtraction */
+			err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+			if (!err)
+				err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+			if (!err)
+				*val = d1 - d2;
+			else
+				return err;
+
+			break;
+		}
+
+	case EXPR_NODETYPE_MULTIPLY:
+		{
+			/* Multiplication */
+			err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+			if (!err)
+				err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+			if (!err)
+				*val = d1 * d2;
+			else
+				return err;
+
+			break;
+		}
+
+	case EXPR_NODETYPE_DIVIDE:
+		{
+			/* Division */
+			err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+			if (!err)
+				err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+			if (!err) {
+				if (d2 != 0.0)
+					*val = d1 / d2;
+				else {
 #if(EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
-                    return EXPR_ERROR_DIVBYZERO;
+					return EXPR_ERROR_DIVBYZERO;
 #else
-                    *val = 0.0;
-                    return EXPR_ERROR_NOERROR;
+					*val = 0.0;
+					return EXPR_ERROR_NOERROR;
 #endif
-                    }
-                }
-            else
-                return err;
-
-            break;
-            }
-
-        case EXPR_NODETYPE_EXPONENT:
-            {
-            /* Exponent */
-            err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
-            if(!err)
-                err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
-            if(!err)
-                {
-                EXPR_RESET_ERR();
-                *val = pow(d1, d2);
-                EXPR_CHECK_ERR();
-                }
-            else
-                return err;
-
-            break;
-            }
-
-        case EXPR_NODETYPE_NEGATE:
-            {
-            /* Negative value */
-            err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
-            if(!err)
-                *val = -d1;
-            else
-                return err;
-           
-            break;
-            }
-
-
-        case EXPR_NODETYPE_VALUE:
-            {
-            /* Directly access the value */
-            *val = nodes->data.value.value;
-            break;
-            }
-
-        case EXPR_NODETYPE_VARIABLE:
-            {
-            /* Directly access the variable or constant */
-            *val = *(nodes->data.variable.vaddr);
-            break;
-            }
-
-        case EXPR_NODETYPE_ASSIGN:
-            {
-            /* Evaluate assignment subnode */
-            err = exprEvalNode(obj, nodes->data.assign.node, 0, val);
-
-            if(!err)
-                {
-                /* Directly assign the variable */
-                *(nodes->data.assign.vaddr) = *val;
-                }
-            else
-                return err;
-            
-            break;
-            }
-
-        case EXPR_NODETYPE_FUNCTION:
-            {
-            /* Evaluate the function */
-            if(nodes->data.function.fptr == NULL)
-                {
-                /* No function pointer means we are not using
-                   function solvers.  See if the function has a
-                   type to solve directly. */
-                switch(nodes->data.function.type)
-                    {
-                    /* This is to keep the file from being too crowded.
-                       See exprilfs.h for the definitions. */
+				}
+			} else
+				return err;
+
+			break;
+		}
+
+	case EXPR_NODETYPE_EXPONENT:
+		{
+			/* Exponent */
+			err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+			if (!err)
+				err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+			if (!err) {
+				EXPR_RESET_ERR();
+				*val = pow(d1, d2);
+				EXPR_CHECK_ERR();
+			} else
+				return err;
+
+			break;
+		}
+
+	case EXPR_NODETYPE_NEGATE:
+		{
+			/* Negative value */
+			err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+			if (!err)
+				*val = -d1;
+			else
+				return err;
+
+			break;
+		}
+
+
+	case EXPR_NODETYPE_VALUE:
+		{
+			/* Directly access the value */
+			*val = nodes->data.value.value;
+			break;
+		}
+
+	case EXPR_NODETYPE_VARIABLE:
+		{
+			/* Directly access the variable or constant */
+			*val = *(nodes->data.variable.vaddr);
+			break;
+		}
+
+	case EXPR_NODETYPE_ASSIGN:
+		{
+			/* Evaluate assignment subnode */
+			err = exprEvalNode(obj, nodes->data.assign.node, 0, val);
+
+			if (!err) {
+				/* Directly assign the variable */
+				*(nodes->data.assign.vaddr) = *val;
+			} else
+				return err;
+
+			break;
+		}
+
+	case EXPR_NODETYPE_FUNCTION:
+		{
+			/* Evaluate the function */
+			if (nodes->data.function.fptr == NULL) {
+				/* No function pointer means we are not using
+				   function solvers.  See if the function has a
+				   type to solve directly. */
+				switch (nodes->data.function.type) {
+					/* This is to keep the file from being too crowded.
+					   See exprilfs.h for the definitions. */
 #include "exprilfs.h"
-                   
-
-                    default:
-                        {
-                        return EXPR_ERROR_UNKNOWN;
-                        }
-                    }
-                }
-            else
-                {
-                /* Call the correct function */
-                return (*(nodes->data.function.fptr))(obj,
-                    nodes->data.function.nodes, nodes->data.function.nodecount,
-                    nodes->data.function.refs, nodes->data.function.refcount, val);
-                }
-
-            break;
-            }
-
-        default:
-            {
-            /* Unknown node type */
-            return EXPR_ERROR_UNKNOWN;
-            }
-        }
-
-    return EXPR_ERROR_NOERROR;
-    }
 
 
+				default:
+					{
+						return EXPR_ERROR_UNKNOWN;
+					}
+				}
+			} else {
+				/* Call the correct function */
+				return (*(nodes->data.function.fptr)) (obj,
+													   nodes->data.function.nodes, nodes->data.function.nodecount,
+													   nodes->data.function.refs, nodes->data.function.refcount, val);
+			}
+
+			break;
+		}
+
+	default:
+		{
+			/* Unknown node type */
+			return EXPR_ERROR_UNKNOWN;
+		}
+	}
 
+	return EXPR_ERROR_NOERROR;
+}

Modified: freeswitch/trunk/src/mod/applications/mod_expr/exprfunc.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/exprfunc.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/exprfunc.c	Tue May 27 00:54:52 2008
@@ -17,313 +17,296 @@
 
 /* Internal functions */
 static exprFunc *exprCreateFunc(char *name, exprFuncType ptr, int type, int min, int max, int refmin, int refmax);
-static void exprFuncListFreeData(exprFunc *func);
+static void exprFuncListFreeData(exprFunc * func);
 
 
 /* This function creates the function list, */
-int exprFuncListCreate(exprFuncList **flist)
-    {
-    exprFuncList *tmp;
+int exprFuncListCreate(exprFuncList ** flist)
+{
+	exprFuncList *tmp;
 
-    if(flist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
+	if (flist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
 
-    *flist = NULL; /* Set to NULL initially */
+	*flist = NULL;				/* Set to NULL initially */
 
-    tmp = exprAllocMem(sizeof(exprFuncList));
+	tmp = exprAllocMem(sizeof(exprFuncList));
 
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY; /* Could not allocate memory */
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;	/* Could not allocate memory */
 
-    /* Update pointer */
-    *flist = tmp;
+	/* Update pointer */
+	*flist = tmp;
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* Add a function to the list */
-int exprFuncListAdd(exprFuncList *flist, char *name, exprFuncType ptr, int min, int max, int refmin, int refmax)
-    {
-    exprFunc *tmp;
-    exprFunc *cur;
-    int result;
-
-    if(flist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    /* Make sure the name is valid */
-    if(!exprValidIdent(name))
-        return EXPR_ERROR_BADIDENTIFIER;
-
-    /* Fix values only if none are negative (negative values mean no limit) */
-
-    /* if both are neg, no min or max number of args */
-    /* if min is neg, max pos, no min number of args but a maximum */
-    /* if min is pos, max neg, there is a min number of args, but no max */
-    /* if both pos, then a min and max limit.  We swap to make sure it works
-       right. I.E.  Min of 3 and max of 2 would make function unusable */
-    if(min >= 0 && max >= 0)
-        {
-        if(min > max)
-            {
-            result = min;
-            min = max;
-            max = result;
-            }
-        }
-
-    if(refmin >= 0 && refmax >= 0)
-        {
-        if(refmin > refmax)
-            {
-            result = refmin;
-            refmin = max;
-            refmax = result;
-            }
-        }
-
-    if(flist->head == NULL)
-        {
-        /* Create the node right here */
-        tmp = exprCreateFunc(name, ptr, EXPR_NODETYPE_FUNCTION, min, max, refmin, refmax);
-
-        if(tmp == NULL)
-            return EXPR_ERROR_MEMORY;
-
-        flist->head = tmp;
-        return EXPR_ERROR_NOERROR;
-        }
-
-    /* See if it already exists */
-    cur = flist->head;
-    
-    while(cur)
-        {
-        result = strcmp(name, cur->fname);
-        
-        if(result == 0)
-            return EXPR_ERROR_ALREADYEXISTS;
-            
-        cur = cur->next;
-        }
-        
-    /* It did not exist, so add it at the head */
-    tmp = exprCreateFunc(name, ptr, EXPR_NODETYPE_FUNCTION, min, max, refmin, refmax);
-        
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-            
-    tmp->next = flist->head;
-    flist->head = tmp;
-    return EXPR_ERROR_NOERROR;
-    }
+int exprFuncListAdd(exprFuncList * flist, char *name, exprFuncType ptr, int min, int max, int refmin, int refmax)
+{
+	exprFunc *tmp;
+	exprFunc *cur;
+	int result;
+
+	if (flist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	/* Make sure the name is valid */
+	if (!exprValidIdent(name))
+		return EXPR_ERROR_BADIDENTIFIER;
+
+	/* Fix values only if none are negative (negative values mean no limit) */
+
+	/* if both are neg, no min or max number of args */
+	/* if min is neg, max pos, no min number of args but a maximum */
+	/* if min is pos, max neg, there is a min number of args, but no max */
+	/* if both pos, then a min and max limit.  We swap to make sure it works
+	   right. I.E.  Min of 3 and max of 2 would make function unusable */
+	if (min >= 0 && max >= 0) {
+		if (min > max) {
+			result = min;
+			min = max;
+			max = result;
+		}
+	}
+
+	if (refmin >= 0 && refmax >= 0) {
+		if (refmin > refmax) {
+			result = refmin;
+			refmin = max;
+			refmax = result;
+		}
+	}
+
+	if (flist->head == NULL) {
+		/* Create the node right here */
+		tmp = exprCreateFunc(name, ptr, EXPR_NODETYPE_FUNCTION, min, max, refmin, refmax);
+
+		if (tmp == NULL)
+			return EXPR_ERROR_MEMORY;
+
+		flist->head = tmp;
+		return EXPR_ERROR_NOERROR;
+	}
+
+	/* See if it already exists */
+	cur = flist->head;
+
+	while (cur) {
+		result = strcmp(name, cur->fname);
+
+		if (result == 0)
+			return EXPR_ERROR_ALREADYEXISTS;
+
+		cur = cur->next;
+	}
+
+	/* It did not exist, so add it at the head */
+	tmp = exprCreateFunc(name, ptr, EXPR_NODETYPE_FUNCTION, min, max, refmin, refmax);
+
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+	tmp->next = flist->head;
+	flist->head = tmp;
+	return EXPR_ERROR_NOERROR;
+}
 
 /* Add a function node type to the list
    This works pretty much the same way, except the function
    pointer is NULL and the node type specifies the function
    to do.  exprEvalNode handles this, instead of calling
    a function solver. */
-int exprFuncListAddType(exprFuncList *flist, char *name, int type, int min, int max, int refmin, int refmax)
-    {
-    exprFunc *tmp;
-    exprFunc *cur;
-    int result;
-
-    if(flist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    /* Make sure the name is valid */
-    if(!exprValidIdent(name))
-        return EXPR_ERROR_BADIDENTIFIER;
-
-    /* Fix values only if none are negative (negative values mean no limit) */
-
-    /* if both are neg, no min or max number of args */
-    /* if min is neg, max pos, no min number of args but a maximum */
-    /* if min is pos, max neg, there is a min number of args, but no max */
-    /* if both pos, then a min and max limit.  We swap to make sure it works
-       right. I.E.  Min of 3 and max of 2 would make function unusable */
-    if(min >= 0 && max >= 0)
-        {
-        if(min > max)
-            {
-            result = min;
-            min = max;
-            max = result;
-            }
-        }
-
-    if(refmin >= 0 && refmax >= 0)
-        {
-        if(refmin > refmax)
-            {
-            result = refmin;
-            refmin = max;
-            refmax = result;
-            }
-        }
-
-    if(flist->head == NULL)
-        {
-        /* Create the node right here */
-        tmp = exprCreateFunc(name, NULL, type, min, max, refmin, refmax);
-
-        if(tmp == NULL)
-            return EXPR_ERROR_MEMORY;
-
-        flist->head = tmp;
-        return EXPR_ERROR_NOERROR;
-        }
-
-    /* See if it already exists */
-    cur = flist->head;
-    
-    while(cur)
-        {
-        result = strcmp(name, cur->fname);
-        
-        if(result == 0)
-            return EXPR_ERROR_ALREADYEXISTS;
-            
-        cur = cur->next;
-        }
-        
-    /* It did not exist, so add it at the head */
-    tmp = exprCreateFunc(name, NULL, type, min, max, refmin, refmax);
-    
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-        
-    tmp->next = flist->head;
-    flist->head = tmp;
-    return EXPR_ERROR_NOERROR;
-    }
+int exprFuncListAddType(exprFuncList * flist, char *name, int type, int min, int max, int refmin, int refmax)
+{
+	exprFunc *tmp;
+	exprFunc *cur;
+	int result;
+
+	if (flist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	/* Make sure the name is valid */
+	if (!exprValidIdent(name))
+		return EXPR_ERROR_BADIDENTIFIER;
+
+	/* Fix values only if none are negative (negative values mean no limit) */
+
+	/* if both are neg, no min or max number of args */
+	/* if min is neg, max pos, no min number of args but a maximum */
+	/* if min is pos, max neg, there is a min number of args, but no max */
+	/* if both pos, then a min and max limit.  We swap to make sure it works
+	   right. I.E.  Min of 3 and max of 2 would make function unusable */
+	if (min >= 0 && max >= 0) {
+		if (min > max) {
+			result = min;
+			min = max;
+			max = result;
+		}
+	}
+
+	if (refmin >= 0 && refmax >= 0) {
+		if (refmin > refmax) {
+			result = refmin;
+			refmin = max;
+			refmax = result;
+		}
+	}
+
+	if (flist->head == NULL) {
+		/* Create the node right here */
+		tmp = exprCreateFunc(name, NULL, type, min, max, refmin, refmax);
+
+		if (tmp == NULL)
+			return EXPR_ERROR_MEMORY;
+
+		flist->head = tmp;
+		return EXPR_ERROR_NOERROR;
+	}
+
+	/* See if it already exists */
+	cur = flist->head;
+
+	while (cur) {
+		result = strcmp(name, cur->fname);
+
+		if (result == 0)
+			return EXPR_ERROR_ALREADYEXISTS;
+
+		cur = cur->next;
+	}
+
+	/* It did not exist, so add it at the head */
+	tmp = exprCreateFunc(name, NULL, type, min, max, refmin, refmax);
+
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+	tmp->next = flist->head;
+	flist->head = tmp;
+	return EXPR_ERROR_NOERROR;
+}
 
 
 /* Get the function from a list along with it's min an max data */
-int exprFuncListGet(exprFuncList *flist, char *name, exprFuncType *ptr, int *type, int *min, int *max, int *refmin, int *refmax)
-    {
-    exprFunc *cur;
-    int result;
-
-    if(flist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    if(name == NULL || name[0] == '\0')
-        return EXPR_ERROR_NOTFOUND;
-
-    /* Search for the item */
-    cur = flist->head;
-    
-    while(cur)
-        {
-        result = strcmp(name, cur->fname);
-
-        if(result == 0)
-            {
-            /* We found it. */
-            *ptr = cur->fptr;
-            *min = cur->min;
-            *max = cur->max;
-            *refmin = cur->refmin;
-            *refmax = cur->refmax;
-            *type = cur->type;
-
-            /* return now */
-            return EXPR_ERROR_NOERROR;
-            }
-            
-        cur = cur->next;
-        }
-
-    /* If we got here, we did not find the item in the list */
-    return EXPR_ERROR_NOTFOUND;
-    }
+int exprFuncListGet(exprFuncList * flist, char *name, exprFuncType * ptr, int *type, int *min, int *max, int *refmin, int *refmax)
+{
+	exprFunc *cur;
+	int result;
+
+	if (flist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	if (name == NULL || name[0] == '\0')
+		return EXPR_ERROR_NOTFOUND;
+
+	/* Search for the item */
+	cur = flist->head;
+
+	while (cur) {
+		result = strcmp(name, cur->fname);
+
+		if (result == 0) {
+			/* We found it. */
+			*ptr = cur->fptr;
+			*min = cur->min;
+			*max = cur->max;
+			*refmin = cur->refmin;
+			*refmax = cur->refmax;
+			*type = cur->type;
+
+			/* return now */
+			return EXPR_ERROR_NOERROR;
+		}
+
+		cur = cur->next;
+	}
+
+	/* If we got here, we did not find the item in the list */
+	return EXPR_ERROR_NOTFOUND;
+}
 
 /* This routine will free the function list */
-int exprFuncListFree(exprFuncList *flist)
-    {
-    /* Make sure it exists, if not it is not error */
-    if(flist == NULL)
-        return EXPR_ERROR_NOERROR;
+int exprFuncListFree(exprFuncList * flist)
+{
+	/* Make sure it exists, if not it is not error */
+	if (flist == NULL)
+		return EXPR_ERROR_NOERROR;
 
-    /* Free the nodes */
-    exprFuncListFreeData(flist->head);
+	/* Free the nodes */
+	exprFuncListFreeData(flist->head);
 
-    /* Free the container */
-    exprFreeMem(flist);
+	/* Free the container */
+	exprFreeMem(flist);
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* This routine will clear the function list */
-int exprFuncListClear(exprFuncList *flist)
-    {
-    if(flist == NULL)
-        return EXPR_ERROR_NOERROR;
-
-    /* Free the nodes only */
-    if(flist->head)
-        {
-        exprFuncListFreeData(flist->head);
+int exprFuncListClear(exprFuncList * flist)
+{
+	if (flist == NULL)
+		return EXPR_ERROR_NOERROR;
+
+	/* Free the nodes only */
+	if (flist->head) {
+		exprFuncListFreeData(flist->head);
 
-        flist->head = NULL;
-        }
+		flist->head = NULL;
+	}
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* This routine will free any child nodes, and then free itself */
-void exprFuncListFreeData(exprFunc *func)
-    {
-    exprFunc *next;
-    
-    while(func)
-        {
-        /* Remember the next item */
-        next = func->next;
-
-        /* Free name */
-        exprFreeMem(func->fname);
-
-        /* Free ourself */
-        exprFreeMem(func);
-        
-        func = next;
-        }
-    }
+void exprFuncListFreeData(exprFunc * func)
+{
+	exprFunc *next;
+
+	while (func) {
+		/* Remember the next item */
+		next = func->next;
+
+		/* Free name */
+		exprFreeMem(func->fname);
+
+		/* Free ourself */
+		exprFreeMem(func);
+
+		func = next;
+	}
+}
 
 /* This routine will create the function object */
 exprFunc *exprCreateFunc(char *name, exprFuncType ptr, int type, int min, int max, int refmin, int refmax)
-    {
-    exprFunc *tmp;
-    char *vtmp;
-
-    /* We already checked the name in exprFuncListAdd */
-
-    /* Create it */
-    tmp = exprAllocMem(sizeof(exprFunc));
-    if(tmp == NULL)
-        return NULL;
-
-    /* Allocate space for the name */
-    vtmp = exprAllocMem(strlen(name) + 1);
-
-    if(vtmp == NULL)
-        {
-        exprFreeMem(tmp);
-        return NULL;
-        }
-
-    /* Copy the data over */
-    strcpy(vtmp, name);
-    tmp->fname = vtmp;
-    tmp->fptr = ptr;
-    tmp->min = min;
-    tmp->max = max;
-    tmp->refmin = refmin;
-    tmp->refmax = refmax;
-    tmp->type = type;
+{
+	exprFunc *tmp;
+	char *vtmp;
+
+	/* We already checked the name in exprFuncListAdd */
+
+	/* Create it */
+	tmp = exprAllocMem(sizeof(exprFunc));
+	if (tmp == NULL)
+		return NULL;
+
+	/* Allocate space for the name */
+	vtmp = exprAllocMem(strlen(name) + 1);
+
+	if (vtmp == NULL) {
+		exprFreeMem(tmp);
+		return NULL;
+	}
+
+	/* Copy the data over */
+	strcpy(vtmp, name);
+	tmp->fname = vtmp;
+	tmp->fptr = ptr;
+	tmp->min = min;
+	tmp->max = max;
+	tmp->refmin = refmin;
+	tmp->refmax = refmax;
+	tmp->type = type;
 
-    return tmp;
-    }
+	return tmp;
+}

Modified: freeswitch/trunk/src/mod/applications/mod_expr/exprinit.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/exprinit.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/exprinit.c	Tue May 27 00:54:52 2008
@@ -26,90 +26,88 @@
     return err;
 
 /* Call this function to initialize these functions into a function list */
-int exprFuncListInit(exprFuncList *flist)
-    {
-    int err;
-
-    if(flist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    EXPR_ADDFUNC_TYPE("abs", EXPR_NODEFUNC_ABS, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("mod", EXPR_NODEFUNC_MOD, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("ipart", EXPR_NODEFUNC_IPART, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("fpart", EXPR_NODEFUNC_FPART, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("min", EXPR_NODEFUNC_MIN, 1, -1, 0, 0);
-    EXPR_ADDFUNC_TYPE("max", EXPR_NODEFUNC_MAX, 1, -1, 0, 0);
-    EXPR_ADDFUNC_TYPE("pow", EXPR_NODEFUNC_POW, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("sqrt", EXPR_NODEFUNC_SQRT, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("sin", EXPR_NODEFUNC_SIN, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("sinh", EXPR_NODEFUNC_SINH, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("asin", EXPR_NODEFUNC_ASIN, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("cos", EXPR_NODEFUNC_COS, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("cosh", EXPR_NODEFUNC_COSH, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("acos", EXPR_NODEFUNC_ACOS, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("tan", EXPR_NODEFUNC_TAN, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("tanh", EXPR_NODEFUNC_TANH, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("atan", EXPR_NODEFUNC_ATAN, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("atan2", EXPR_NODEFUNC_ATAN2, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("log", EXPR_NODEFUNC_LOG, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("pow10", EXPR_NODEFUNC_POW10, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("ln", EXPR_NODEFUNC_LN, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("exp", EXPR_NODEFUNC_EXP, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("logn", EXPR_NODEFUNC_LOGN, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("ceil", EXPR_NODEFUNC_CEIL, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("floor", EXPR_NODEFUNC_FLOOR, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("rand", EXPR_NODEFUNC_RAND, 0, 0, 1, 1);
-    EXPR_ADDFUNC_TYPE("random", EXPR_NODEFUNC_RANDOM, 2, 2, 1, 1);
-    EXPR_ADDFUNC_TYPE("randomize", EXPR_NODEFUNC_RANDOMIZE, 0, 0, 1, 1);
-    EXPR_ADDFUNC_TYPE("deg", EXPR_NODEFUNC_DEG, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("rad", EXPR_NODEFUNC_RAD, 1, 1, 0, 0);
-    EXPR_ADDFUNC_TYPE("recttopolr", EXPR_NODEFUNC_RECTTOPOLR, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("recttopola", EXPR_NODEFUNC_RECTTOPOLA, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("poltorectx", EXPR_NODEFUNC_POLTORECTX, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("poltorecty", EXPR_NODEFUNC_POLTORECTY, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("if", EXPR_NODEFUNC_IF, 3, 3, 0, 0);
-    EXPR_ADDFUNC_TYPE("select", EXPR_NODEFUNC_SELECT, 3, 4, 0, 0);
-    EXPR_ADDFUNC_TYPE("equal", EXPR_NODEFUNC_EQUAL, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("above", EXPR_NODEFUNC_ABOVE, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("below", EXPR_NODEFUNC_BELOW, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("avg", EXPR_NODEFUNC_AVG, 1, -1, 0, 0);
-    EXPR_ADDFUNC_TYPE("clip", EXPR_NODEFUNC_CLIP, 3, 3, 0, 0);
-    EXPR_ADDFUNC_TYPE("clamp", EXPR_NODEFUNC_CLAMP, 3, 3, 0, 0);
-    EXPR_ADDFUNC_TYPE("pntchange", EXPR_NODEFUNC_PNTCHANGE, 5, 5, 0, 0);
-    EXPR_ADDFUNC_TYPE("poly", EXPR_NODEFUNC_POLY, 2, -1, 0, 0);
-    EXPR_ADDFUNC_TYPE("and", EXPR_NODEFUNC_AND, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("or", EXPR_NODEFUNC_OR, 2, 2, 0, 0);
-    EXPR_ADDFUNC_TYPE("not", EXPR_NODEFUNC_NOT, 1 ,1, 0, 0);
-    EXPR_ADDFUNC_TYPE("for", EXPR_NODEFUNC_FOR, 4, -1, 0, 0);
-    EXPR_ADDFUNC_TYPE("many", EXPR_NODEFUNC_MANY, 1, -1, 0, 0);
+int exprFuncListInit(exprFuncList * flist)
+{
+	int err;
+
+	if (flist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	EXPR_ADDFUNC_TYPE("abs", EXPR_NODEFUNC_ABS, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("mod", EXPR_NODEFUNC_MOD, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("ipart", EXPR_NODEFUNC_IPART, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("fpart", EXPR_NODEFUNC_FPART, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("min", EXPR_NODEFUNC_MIN, 1, -1, 0, 0);
+	EXPR_ADDFUNC_TYPE("max", EXPR_NODEFUNC_MAX, 1, -1, 0, 0);
+	EXPR_ADDFUNC_TYPE("pow", EXPR_NODEFUNC_POW, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("sqrt", EXPR_NODEFUNC_SQRT, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("sin", EXPR_NODEFUNC_SIN, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("sinh", EXPR_NODEFUNC_SINH, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("asin", EXPR_NODEFUNC_ASIN, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("cos", EXPR_NODEFUNC_COS, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("cosh", EXPR_NODEFUNC_COSH, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("acos", EXPR_NODEFUNC_ACOS, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("tan", EXPR_NODEFUNC_TAN, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("tanh", EXPR_NODEFUNC_TANH, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("atan", EXPR_NODEFUNC_ATAN, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("atan2", EXPR_NODEFUNC_ATAN2, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("log", EXPR_NODEFUNC_LOG, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("pow10", EXPR_NODEFUNC_POW10, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("ln", EXPR_NODEFUNC_LN, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("exp", EXPR_NODEFUNC_EXP, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("logn", EXPR_NODEFUNC_LOGN, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("ceil", EXPR_NODEFUNC_CEIL, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("floor", EXPR_NODEFUNC_FLOOR, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("rand", EXPR_NODEFUNC_RAND, 0, 0, 1, 1);
+	EXPR_ADDFUNC_TYPE("random", EXPR_NODEFUNC_RANDOM, 2, 2, 1, 1);
+	EXPR_ADDFUNC_TYPE("randomize", EXPR_NODEFUNC_RANDOMIZE, 0, 0, 1, 1);
+	EXPR_ADDFUNC_TYPE("deg", EXPR_NODEFUNC_DEG, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("rad", EXPR_NODEFUNC_RAD, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("recttopolr", EXPR_NODEFUNC_RECTTOPOLR, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("recttopola", EXPR_NODEFUNC_RECTTOPOLA, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("poltorectx", EXPR_NODEFUNC_POLTORECTX, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("poltorecty", EXPR_NODEFUNC_POLTORECTY, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("if", EXPR_NODEFUNC_IF, 3, 3, 0, 0);
+	EXPR_ADDFUNC_TYPE("select", EXPR_NODEFUNC_SELECT, 3, 4, 0, 0);
+	EXPR_ADDFUNC_TYPE("equal", EXPR_NODEFUNC_EQUAL, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("above", EXPR_NODEFUNC_ABOVE, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("below", EXPR_NODEFUNC_BELOW, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("avg", EXPR_NODEFUNC_AVG, 1, -1, 0, 0);
+	EXPR_ADDFUNC_TYPE("clip", EXPR_NODEFUNC_CLIP, 3, 3, 0, 0);
+	EXPR_ADDFUNC_TYPE("clamp", EXPR_NODEFUNC_CLAMP, 3, 3, 0, 0);
+	EXPR_ADDFUNC_TYPE("pntchange", EXPR_NODEFUNC_PNTCHANGE, 5, 5, 0, 0);
+	EXPR_ADDFUNC_TYPE("poly", EXPR_NODEFUNC_POLY, 2, -1, 0, 0);
+	EXPR_ADDFUNC_TYPE("and", EXPR_NODEFUNC_AND, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("or", EXPR_NODEFUNC_OR, 2, 2, 0, 0);
+	EXPR_ADDFUNC_TYPE("not", EXPR_NODEFUNC_NOT, 1, 1, 0, 0);
+	EXPR_ADDFUNC_TYPE("for", EXPR_NODEFUNC_FOR, 4, -1, 0, 0);
+	EXPR_ADDFUNC_TYPE("many", EXPR_NODEFUNC_MANY, 1, -1, 0, 0);
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* Call this function to initialize some constants into a value list */
-int exprValListInit(exprValList *vlist)
-    {
-    int err;
-
-    if(vlist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    EXPR_ADDCONST("M_E", M_E);
-    EXPR_ADDCONST("M_LOG2E", M_LOG2E);
-    EXPR_ADDCONST("M_LOG10E", M_LOG10E);
-    EXPR_ADDCONST("M_LN2", M_LN2);
-    EXPR_ADDCONST("M_LN10", M_LN10);
-    EXPR_ADDCONST("M_PI", M_PI);
-    EXPR_ADDCONST("M_PI_2", M_PI_2);
-    EXPR_ADDCONST("M_PI_4", M_PI_4);
-    EXPR_ADDCONST("M_1_PI", M_1_PI);
-    EXPR_ADDCONST("M_2_PI", M_2_PI);
-    EXPR_ADDCONST("M_1_SQRTPI", M_1_SQRTPI);
-    EXPR_ADDCONST("M_2_SQRTPI", M_2_SQRTPI);
-    EXPR_ADDCONST("M_SQRT2", M_SQRT2);
-    EXPR_ADDCONST("M_1_SQRT2", M_1_SQRT2);
-
-    return EXPR_ERROR_NOERROR;
-    }
-
+int exprValListInit(exprValList * vlist)
+{
+	int err;
+
+	if (vlist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	EXPR_ADDCONST("M_E", M_E);
+	EXPR_ADDCONST("M_LOG2E", M_LOG2E);
+	EXPR_ADDCONST("M_LOG10E", M_LOG10E);
+	EXPR_ADDCONST("M_LN2", M_LN2);
+	EXPR_ADDCONST("M_LN10", M_LN10);
+	EXPR_ADDCONST("M_PI", M_PI);
+	EXPR_ADDCONST("M_PI_2", M_PI_2);
+	EXPR_ADDCONST("M_PI_4", M_PI_4);
+	EXPR_ADDCONST("M_1_PI", M_1_PI);
+	EXPR_ADDCONST("M_2_PI", M_2_PI);
+	EXPR_ADDCONST("M_1_SQRTPI", M_1_SQRTPI);
+	EXPR_ADDCONST("M_2_SQRTPI", M_2_SQRTPI);
+	EXPR_ADDCONST("M_SQRT2", M_SQRT2);
+	EXPR_ADDCONST("M_1_SQRT2", M_1_SQRT2);
 
+	return EXPR_ERROR_NOERROR;
+}

Modified: freeswitch/trunk/src/mod/applications/mod_expr/exprmem.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/exprmem.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/exprmem.c	Tue May 27 00:54:52 2008
@@ -13,27 +13,26 @@
 #include "exprmem.h"
 
 /* Allocate memory and zero it */
-void* exprAllocMem(size_t size)
-    {
-    void *data = malloc(size);
-    
-    if(data)
-        {
-        memset(data, 0, size);
-        }
-    
-    return data;
-    }
+void *exprAllocMem(size_t size)
+{
+	void *data = malloc(size);
+
+	if (data) {
+		memset(data, 0, size);
+	}
+
+	return data;
+}
 
 /* Free memory */
 void exprFreeMem(void *data)
-    {
-    if(data)
-        free(data);
-    }
+{
+	if (data)
+		free(data);
+}
 
 /* Allocate a list of nodes */
 exprNode *exprAllocNodes(size_t count)
-    {
-    return exprAllocMem(count * sizeof(exprNode));
-    }
+{
+	return exprAllocMem(count * sizeof(exprNode));
+}

Modified: freeswitch/trunk/src/mod/applications/mod_expr/exprobj.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/exprobj.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/exprobj.c	Tue May 27 00:54:52 2008
@@ -14,224 +14,215 @@
 #include "exprmem.h"
 
 /* Internal functions */
-static void exprFreeNodeData(exprNode *node);
+static void exprFreeNodeData(exprNode * node);
 
 
 /* Function to create an expression object */
-int exprCreate(exprObj **obj, exprFuncList *flist, exprValList *vlist, exprValList *clist,
-    exprBreakFuncType breaker, void *userdata)
-    {
-    exprObj *tmp;
-
-    /* Allocate memory for the object */
-    tmp = exprAllocMem(sizeof(exprObj));
-
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-
-
-    /* Assign data */
-    tmp->flist = flist;
-    tmp->vlist = vlist;
-    tmp->clist = clist;
-    tmp->breakerfunc = breaker;
-    tmp->userdata = userdata;
-    tmp->breakcount = 100000; /* Default breaker count setting */
-    tmp->breakcur = 0;
+int exprCreate(exprObj ** obj, exprFuncList * flist, exprValList * vlist, exprValList * clist, exprBreakFuncType breaker, void *userdata)
+{
+	exprObj *tmp;
+
+	/* Allocate memory for the object */
+	tmp = exprAllocMem(sizeof(exprObj));
+
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+
+	/* Assign data */
+	tmp->flist = flist;
+	tmp->vlist = vlist;
+	tmp->clist = clist;
+	tmp->breakerfunc = breaker;
+	tmp->userdata = userdata;
+	tmp->breakcount = 100000;	/* Default breaker count setting */
+	tmp->breakcur = 0;
 
-    /* Update pointer */
-    *obj = tmp;
+	/* Update pointer */
+	*obj = tmp;
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 
 /* Free the expression */
-int exprFree(exprObj *obj)
-    {
-    if(obj == NULL)
-        return EXPR_ERROR_NOERROR;
-
-    /* First free the node data */
-    exprFreeNodeData(obj->headnode);
-    exprFreeMem(obj->headnode);
+int exprFree(exprObj * obj)
+{
+	if (obj == NULL)
+		return EXPR_ERROR_NOERROR;
+
+	/* First free the node data */
+	exprFreeNodeData(obj->headnode);
+	exprFreeMem(obj->headnode);
 
-    /* Free ourself */
-    exprFreeMem(obj);
+	/* Free ourself */
+	exprFreeMem(obj);
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* Clear expression, keep lists, etc */
-int exprClear(exprObj *obj)
-    {
-    if(obj == NULL)
-        return EXPR_ERROR_NOERROR;
-
-    /* Free the node data only, keep function, variable, constant lists */
-    exprFreeNodeData(obj->headnode);
-    exprFreeMem(obj->headnode);
-
-    obj->headnode = NULL;
-    obj->parsedbad = 0;
-    obj->parsedgood = 0;
+int exprClear(exprObj * obj)
+{
+	if (obj == NULL)
+		return EXPR_ERROR_NOERROR;
+
+	/* Free the node data only, keep function, variable, constant lists */
+	exprFreeNodeData(obj->headnode);
+	exprFreeMem(obj->headnode);
+
+	obj->headnode = NULL;
+	obj->parsedbad = 0;
+	obj->parsedgood = 0;
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 
 /* Get functions to get information about the expression object */
 
 /* Get the function list */
-exprFuncList *exprGetFuncList(exprObj *obj)
-    {
-    return (obj == NULL) ? NULL : obj->flist;
-    }
+exprFuncList *exprGetFuncList(exprObj * obj)
+{
+	return (obj == NULL) ? NULL : obj->flist;
+}
 
 /* Get the variable list */
-exprValList *exprGetVarList(exprObj *obj)
-    {
-    return (obj == NULL) ? NULL : obj->vlist;
-    }
+exprValList *exprGetVarList(exprObj * obj)
+{
+	return (obj == NULL) ? NULL : obj->vlist;
+}
 
 /* Get the constant list */
-exprValList *exprGetConstList(exprObj *obj)
-    {
-    return (obj == NULL) ? NULL : obj->clist;
-    }
+exprValList *exprGetConstList(exprObj * obj)
+{
+	return (obj == NULL) ? NULL : obj->clist;
+}
 
 /* Get the breaker function */
-exprBreakFuncType exprGetBreakFunc(exprObj *obj)
-    {
-    return (obj == NULL) ? NULL : obj->breakerfunc;
-    }
+exprBreakFuncType exprGetBreakFunc(exprObj * obj)
+{
+	return (obj == NULL) ? NULL : obj->breakerfunc;
+}
 
 /* Check for break status */
-int exprGetBreakResult(exprObj *obj)
-    {
-    if(obj == NULL)
-        return 0;
+int exprGetBreakResult(exprObj * obj)
+{
+	if (obj == NULL)
+		return 0;
 
-    if(obj->breakerfunc == NULL)
-        return 0;
+	if (obj->breakerfunc == NULL)
+		return 0;
 
-    return (*(obj->breakerfunc))(obj);
-    }
+	return (*(obj->breakerfunc)) (obj);
+}
 
 /* Get the user data */
-void *exprGetUserData(exprObj *obj)
-    {
-    return (obj == NULL) ? NULL : obj->userdata;
-    }
+void *exprGetUserData(exprObj * obj)
+{
+	return (obj == NULL) ? NULL : obj->userdata;
+}
 
 
 /* Set functions to set certain data */
 
 /* Set user data */
-void exprSetUserData(exprObj *obj, void *userdata)
-    {
-    if(obj)
-        obj->userdata = userdata;
-    }
+void exprSetUserData(exprObj * obj, void *userdata)
+{
+	if (obj)
+		obj->userdata = userdata;
+}
 
 
 /* Set breaker count */
-void exprSetBreakCount(exprObj *obj, int count)
-    {
-    if(obj)
-        {
-        /* If count is negative, make it positive */
-        if(count < 0)
-            count = -count;
-
-        obj->breakcount = count;
-
-        /* Make sure the current value is not bigger than count */
-        if(obj->breakcur > count)
-            obj->breakcur = count;
-        }
-    }
+void exprSetBreakCount(exprObj * obj, int count)
+{
+	if (obj) {
+		/* If count is negative, make it positive */
+		if (count < 0)
+			count = -count;
+
+		obj->breakcount = count;
+
+		/* Make sure the current value is not bigger than count */
+		if (obj->breakcur > count)
+			obj->breakcur = count;
+	}
+}
 
 /* Get error position */
-void exprGetErrorPosition(exprObj *obj, int *start, int *end)
-    {
-    if(obj)
-        {
-        if(start)
-            *start = obj->starterr;
-
-        if(end)
-            *end = obj->enderr;
-        }
-    }
+void exprGetErrorPosition(exprObj * obj, int *start, int *end)
+{
+	if (obj) {
+		if (start)
+			*start = obj->starterr;
+
+		if (end)
+			*end = obj->enderr;
+	}
+}
 
 /* This function will free a node's data */
-static void exprFreeNodeData(exprNode *node)
-    {
-    int pos;
-
-    if(node == NULL)
-        return;
-
-    /* free data based on type */
-    switch(node->type)
-        {
-        case EXPR_NODETYPE_ADD:
-        case EXPR_NODETYPE_SUBTRACT:
-        case EXPR_NODETYPE_MULTIPLY:
-        case EXPR_NODETYPE_DIVIDE:
-        case EXPR_NODETYPE_EXPONENT:
-        case EXPR_NODETYPE_NEGATE:
-        case EXPR_NODETYPE_MULTI:
-            /* Free operation data */
-            if(node->data.oper.nodes)
-                {
-                for(pos = 0; pos < node->data.oper.nodecount; pos++)
-                    exprFreeNodeData(&(node->data.oper.nodes[pos]));
-
-                exprFreeMem(node->data.oper.nodes);
-                }
-
-            break;
-
-
-        case EXPR_NODETYPE_VALUE:
-            /* Nothing to free for value */
-            break;
-
-        case EXPR_NODETYPE_VARIABLE:
-            /* Nothing to free for variable */
-            break;
-
-        case EXPR_NODETYPE_FUNCTION:
-            /* Free data of each subnode */
-            if(node->data.function.nodes)
-                {
-                for(pos = 0; pos < node->data.function.nodecount; pos++)
-                    exprFreeNodeData(&(node->data.function.nodes[pos]));
-
-                /* Free the subnode array */
-                exprFreeMem(node->data.function.nodes);
-                }
-
-            /* Free reference variable list */
-            if(node->data.function.refs)
-                exprFreeMem(node->data.function.refs);
-
-            break;
-
-        case EXPR_NODETYPE_ASSIGN:
-            /* Free subnode data */
-            if(node->data.assign.node)
-                {
-                exprFreeNodeData(node->data.assign.node);
-
-                /* Free the subnode */
-                exprFreeMem(node->data.assign.node);
-                }
-
-            break;
-        }
-    }
-
-
+static void exprFreeNodeData(exprNode * node)
+{
+	int pos;
+
+	if (node == NULL)
+		return;
+
+	/* free data based on type */
+	switch (node->type) {
+	case EXPR_NODETYPE_ADD:
+	case EXPR_NODETYPE_SUBTRACT:
+	case EXPR_NODETYPE_MULTIPLY:
+	case EXPR_NODETYPE_DIVIDE:
+	case EXPR_NODETYPE_EXPONENT:
+	case EXPR_NODETYPE_NEGATE:
+	case EXPR_NODETYPE_MULTI:
+		/* Free operation data */
+		if (node->data.oper.nodes) {
+			for (pos = 0; pos < node->data.oper.nodecount; pos++)
+				exprFreeNodeData(&(node->data.oper.nodes[pos]));
+
+			exprFreeMem(node->data.oper.nodes);
+		}
+
+		break;
+
+
+	case EXPR_NODETYPE_VALUE:
+		/* Nothing to free for value */
+		break;
+
+	case EXPR_NODETYPE_VARIABLE:
+		/* Nothing to free for variable */
+		break;
+
+	case EXPR_NODETYPE_FUNCTION:
+		/* Free data of each subnode */
+		if (node->data.function.nodes) {
+			for (pos = 0; pos < node->data.function.nodecount; pos++)
+				exprFreeNodeData(&(node->data.function.nodes[pos]));
+
+			/* Free the subnode array */
+			exprFreeMem(node->data.function.nodes);
+		}
+
+		/* Free reference variable list */
+		if (node->data.function.refs)
+			exprFreeMem(node->data.function.refs);
+
+		break;
+
+	case EXPR_NODETYPE_ASSIGN:
+		/* Free subnode data */
+		if (node->data.assign.node) {
+			exprFreeNodeData(node->data.assign.node);
+
+			/* Free the subnode */
+			exprFreeMem(node->data.assign.node);
+		}
+
+		break;
+	}
+}

Modified: freeswitch/trunk/src/mod/applications/mod_expr/exprpars.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/exprpars.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/exprpars.c	Tue May 27 00:54:52 2008
@@ -14,18 +14,16 @@
 #include "exprmem.h"
 
 /* Data structure used by parser */
-typedef struct _exprToken
-    {
-    int type; /* token type */
-    int start; /* token start position */
-    int end; /* token end position */
-
-    union _tdata
-        {
-        char *str; /* string data */
-        EXPRTYPE val; /* value data */
-        } data;
-    } exprToken;
+typedef struct _exprToken {
+	int type;					/* token type */
+	int start;					/* token start position */
+	int end;					/* token end position */
+
+	union _tdata {
+		char *str;				/* string data */
+		EXPRTYPE val;			/* value data */
+	} data;
+} exprToken;
 
 /* Defines for token types */
 #define EXPR_TOKEN_UNKNOWN 0
@@ -44,1515 +42,1378 @@
 #define EXPR_TOKEN_HAT 13
 
 /* Internal functions */
-int exprMultiParse(exprObj *obj, exprNode *node, exprToken *tokens, int count);
-int exprInternalParse(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end);
-int exprInternalParseAssign(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseAdd(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseSub(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseMul(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseDiv(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParsePosNeg(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseExp(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseFunction(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int p1, int p2);
-int exprInternalParseVarVal(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end);
-int exprStringToTokenList(exprObj *obj, char *expr, exprToken **tokens, int *count);
-void exprFreeTokenList(exprToken *tokens, int count);
+int exprMultiParse(exprObj * obj, exprNode * node, exprToken * tokens, int count);
+int exprInternalParse(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end);
+int exprInternalParseAssign(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseAdd(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseSub(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseMul(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseDiv(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParsePosNeg(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseExp(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseFunction(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int p1, int p2);
+int exprInternalParseVarVal(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end);
+int exprStringToTokenList(exprObj * obj, char *expr, exprToken ** tokens, int *count);
+void exprFreeTokenList(exprToken * tokens, int count);
 
 /* This frees a token list */
-void exprFreeTokenList(exprToken *tokens, int count)
-    {
-    int pos;
-
-    if(tokens == NULL)
-        return;
-
-    for(pos = 0; pos < count; pos++)
-        {
-        if(tokens[pos].type == EXPR_TOKEN_IDENTIFIER)
-            exprFreeMem(tokens[pos].data.str);
-        }
+void exprFreeTokenList(exprToken * tokens, int count)
+{
+	int pos;
+
+	if (tokens == NULL)
+		return;
+
+	for (pos = 0; pos < count; pos++) {
+		if (tokens[pos].type == EXPR_TOKEN_IDENTIFIER)
+			exprFreeMem(tokens[pos].data.str);
+	}
 
-    exprFreeMem(tokens);
-    }
+	exprFreeMem(tokens);
+}
 
 /* This converts an expression string to a token list */
-int exprStringToTokenList(exprObj *obj, char *expr, exprToken **tokens, int *count)
-    {
-    int found;
-    exprToken *list;
-    int pass;
-    int pos, len;
-    int tpos;
-    int comment; /* Is a comment active */
-    int start, ilen;
-    char buf[EXPR_MAXIDENTSIZE + 1];
-
-    /* Set initial variables */
-    found = 0;
-    tpos = 0;
-    list = NULL;
-    comment = 0;
-    *tokens = NULL;
-    *count = 0;
-
-
-    /* Check string length */
-    len = (int)strlen(expr);
-    if(len == 0)
-        return EXPR_ERROR_EMPTYEXPR;
-
-    /* Two passes, one to count, one to tokenize */
-    for(pass = 0; pass <= 1; pass++)
-        {
-        for(pos = 0; pos < len; pos++)
-            {
-            switch(expr[pos])
-                {
-                /* Comment */
-                case '#':
-                    {
-                    /* Only set it if a comment is not already active */
-                    if(!comment)
-                        comment = 1;
-
-                    break;
-                    }
-
-                /* Newline characters turn off comments */
-                case '\r':
-                case '\n':
-                    {
-                    /* If a comment is active, unset it */
-                    if(comment)
-                        comment = 0;
-
-                    break;
-                    }
-
-                /* Open parenthesis */
-                case '(':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_OPAREN;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Close parenthesis */
-                case ')':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_CPAREN;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Plus */
-                case '+':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_PLUS;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Hyphen */
-                case '-':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_HYPHEN;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Asterisk */
-                case '*':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_ASTERISK;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Forward slash */
-                case '/':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_FSLASH;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Hat */
-                case '^':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_HAT;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Ampersand */
-                case '&':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_AMPERSAND;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Semicolon */
-                case ';':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_SEMICOLON;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Comma */
-                case ',':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_COMMA;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Equal sign */
-                case '=':
-                    {
-                    if(!comment)
-                        {
-                        if(pass == 0)
-                            found++;
-                        else
-                            {
-                            list[tpos].type = EXPR_TOKEN_EQUAL;
-                            list[tpos].start = pos;
-                            list[tpos].end = pos;
-                            tpos++;
-                            }
-                        }
-
-                    break;
-                    }
-
-                /* Identifiers and values */
-                default:
-                    {
-                    if(!comment)
-                        {
-                        if(expr[pos] == '.' || isdigit(expr[pos]))
-                            {
-                            /* Value */
-                            start = pos;
-
-                            /* Find digits before a period */
-                            while(isdigit(expr[pos]))
-                                pos++;
-
-                            /* Find a period */
-                            if(expr[pos] == '.')
-                                pos++;
-
-                            /* Find digits after a period */
-                            while(isdigit(expr[pos]))
-                                pos++;
-
-                            /* pos is AFTER last item, back up */
-                            pos--;
-
-                            if(pass == 0)
-                                found++;
-                            else
-                                {
-                                ilen = pos - start + 1;
-
-                                /* Is the value to large */
-                                if(ilen > EXPR_MAXIDENTSIZE)
-                                    {
-                                    obj->starterr = start;
-                                    obj->enderr = pos;
-                                    exprFreeTokenList(list, found);
-                                    return EXPR_ERROR_BADIDENTIFIER;
-                                    }
-
-                                /* Create value token */
-                                strncpy(buf, expr + start, ilen);
-                                buf[ilen] = '\0';
-
-                                list[tpos].type = EXPR_TOKEN_VALUE;
-                                list[tpos].start = start;
-                                list[tpos].end = pos;
-                                list[tpos].data.val = (EXPRTYPE)atof(buf);
-                                tpos++;
-                                }
-                            }
-                        else if(expr[pos] == '_' || isalpha(expr[pos]))
-                            {
-                            /* Identifier */
-                            start = pos;
-
-                            /* Find rest of identifier */
-                            while(expr[pos] == '_' || isalnum(expr[pos]))
-                                pos++;
-
-                            /* pos is AFTER last item, back up */
-                            pos--;
-
-                            if(pass == 0)
-                                found++;
-                            else
-                                {
-                                ilen = pos - start + 1;
-
-                                /* Is the value to large */
-                                if(ilen > EXPR_MAXIDENTSIZE)
-                                    {
-                                    obj->starterr = start;
-                                    obj->enderr = pos;
-                                    exprFreeTokenList(list, found);
-                                    return EXPR_ERROR_BADIDENTIFIER;
-                                    }
-
-                                /* Create value token */
-                                strncpy(buf, expr + start, ilen);
-                                buf[ilen] = '\0';
-
-                                /* Allocate memory for identifier */
-                                list[tpos].data.str = exprAllocMem(ilen + 1);
-                                if(list[tpos].data.str == NULL)
-                                    {
-                                    exprFreeTokenList(list, found);
-                                    return EXPR_ERROR_MEMORY;
-                                    }
-
-                                list[tpos].type = EXPR_TOKEN_IDENTIFIER;
-                                list[tpos].start = start;
-                                list[tpos].end = pos;
-                                strcpy(list[tpos].data.str, buf);
-                                tpos++;
-                                }
-                            }
-                        else if(isspace(expr[pos]))
-                            {
-                            /* Spaces are ignored, do nothing */
-                            }
-                        else
-                            {
-                            /* Unknown */
-                            obj->starterr = obj->enderr = pos;
-                            exprFreeTokenList(list, found);
-                            return EXPR_ERROR_INVALIDCHAR;
-                            }
-                        }
-
-                    break;
-                    }
-                }
-            }
-
-        /* If pass is 0, allocate memory for next pass */
-        if(pass == 0)
-            {
-            /* First, make sure all comments were ended */
-            if(comment)
-                comment = 0;
-
-            /* Make sure the expression is not empty */
-            if(found == 0)
-                return EXPR_ERROR_EMPTYEXPR;
-
-            /* Allocate memory for token list */
-            list = exprAllocMem(found * sizeof(exprToken));
-            if(list == NULL)
-                return EXPR_ERROR_MEMORY;
-
-            tpos = 0;
-            }
-        }
-
-    *count = found;
-    *tokens = list;
-    return EXPR_ERROR_NOERROR;
-    }
+int exprStringToTokenList(exprObj * obj, char *expr, exprToken ** tokens, int *count)
+{
+	int found;
+	exprToken *list;
+	int pass;
+	int pos, len;
+	int tpos;
+	int comment;				/* Is a comment active */
+	int start, ilen;
+	char buf[EXPR_MAXIDENTSIZE + 1];
+
+	/* Set initial variables */
+	found = 0;
+	tpos = 0;
+	list = NULL;
+	comment = 0;
+	*tokens = NULL;
+	*count = 0;
+
+
+	/* Check string length */
+	len = (int) strlen(expr);
+	if (len == 0)
+		return EXPR_ERROR_EMPTYEXPR;
+
+	/* Two passes, one to count, one to tokenize */
+	for (pass = 0; pass <= 1; pass++) {
+		for (pos = 0; pos < len; pos++) {
+			switch (expr[pos]) {
+				/* Comment */
+			case '#':
+				{
+					/* Only set it if a comment is not already active */
+					if (!comment)
+						comment = 1;
+
+					break;
+				}
+
+				/* Newline characters turn off comments */
+			case '\r':
+			case '\n':
+				{
+					/* If a comment is active, unset it */
+					if (comment)
+						comment = 0;
+
+					break;
+				}
+
+				/* Open parenthesis */
+			case '(':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_OPAREN;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Close parenthesis */
+			case ')':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_CPAREN;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Plus */
+			case '+':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_PLUS;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Hyphen */
+			case '-':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_HYPHEN;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Asterisk */
+			case '*':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_ASTERISK;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Forward slash */
+			case '/':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_FSLASH;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Hat */
+			case '^':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_HAT;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Ampersand */
+			case '&':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_AMPERSAND;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Semicolon */
+			case ';':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_SEMICOLON;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Comma */
+			case ',':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_COMMA;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Equal sign */
+			case '=':
+				{
+					if (!comment) {
+						if (pass == 0)
+							found++;
+						else {
+							list[tpos].type = EXPR_TOKEN_EQUAL;
+							list[tpos].start = pos;
+							list[tpos].end = pos;
+							tpos++;
+						}
+					}
+
+					break;
+				}
+
+				/* Identifiers and values */
+			default:
+				{
+					if (!comment) {
+						if (expr[pos] == '.' || isdigit(expr[pos])) {
+							/* Value */
+							start = pos;
+
+							/* Find digits before a period */
+							while (isdigit(expr[pos]))
+								pos++;
+
+							/* Find a period */
+							if (expr[pos] == '.')
+								pos++;
+
+							/* Find digits after a period */
+							while (isdigit(expr[pos]))
+								pos++;
+
+							/* pos is AFTER last item, back up */
+							pos--;
+
+							if (pass == 0)
+								found++;
+							else {
+								ilen = pos - start + 1;
+
+								/* Is the value to large */
+								if (ilen > EXPR_MAXIDENTSIZE) {
+									obj->starterr = start;
+									obj->enderr = pos;
+									exprFreeTokenList(list, found);
+									return EXPR_ERROR_BADIDENTIFIER;
+								}
+
+								/* Create value token */
+								strncpy(buf, expr + start, ilen);
+								buf[ilen] = '\0';
+
+								list[tpos].type = EXPR_TOKEN_VALUE;
+								list[tpos].start = start;
+								list[tpos].end = pos;
+								list[tpos].data.val = (EXPRTYPE) atof(buf);
+								tpos++;
+							}
+						} else if (expr[pos] == '_' || isalpha(expr[pos])) {
+							/* Identifier */
+							start = pos;
+
+							/* Find rest of identifier */
+							while (expr[pos] == '_' || isalnum(expr[pos]))
+								pos++;
+
+							/* pos is AFTER last item, back up */
+							pos--;
+
+							if (pass == 0)
+								found++;
+							else {
+								ilen = pos - start + 1;
+
+								/* Is the value to large */
+								if (ilen > EXPR_MAXIDENTSIZE) {
+									obj->starterr = start;
+									obj->enderr = pos;
+									exprFreeTokenList(list, found);
+									return EXPR_ERROR_BADIDENTIFIER;
+								}
+
+								/* Create value token */
+								strncpy(buf, expr + start, ilen);
+								buf[ilen] = '\0';
+
+								/* Allocate memory for identifier */
+								list[tpos].data.str = exprAllocMem(ilen + 1);
+								if (list[tpos].data.str == NULL) {
+									exprFreeTokenList(list, found);
+									return EXPR_ERROR_MEMORY;
+								}
+
+								list[tpos].type = EXPR_TOKEN_IDENTIFIER;
+								list[tpos].start = start;
+								list[tpos].end = pos;
+								strcpy(list[tpos].data.str, buf);
+								tpos++;
+							}
+						} else if (isspace(expr[pos])) {
+							/* Spaces are ignored, do nothing */
+						} else {
+							/* Unknown */
+							obj->starterr = obj->enderr = pos;
+							exprFreeTokenList(list, found);
+							return EXPR_ERROR_INVALIDCHAR;
+						}
+					}
+
+					break;
+				}
+			}
+		}
+
+		/* If pass is 0, allocate memory for next pass */
+		if (pass == 0) {
+			/* First, make sure all comments were ended */
+			if (comment)
+				comment = 0;
+
+			/* Make sure the expression is not empty */
+			if (found == 0)
+				return EXPR_ERROR_EMPTYEXPR;
+
+			/* Allocate memory for token list */
+			list = exprAllocMem(found * sizeof(exprToken));
+			if (list == NULL)
+				return EXPR_ERROR_MEMORY;
+
+			tpos = 0;
+		}
+	}
+
+	*count = found;
+	*tokens = list;
+	return EXPR_ERROR_NOERROR;
+}
 
 
 /* This is the main parsing routine */
-int exprParse(exprObj *obj, char *expr)
-    {
-    exprToken *tokens;
-    int count;
-    int err;
-    exprNode *tmp;
-
-    /* Make sure an object was passed */
-    if(obj == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    /* Clear expression error position */
-    obj->starterr = obj->enderr = -1;
-
-    /* Have we already been parsed? */
-    if(obj->parsedbad != 0)
-        return EXPR_ERROR_ALREADYPARSEDBAD;
-
-    if(obj->parsedgood != 0)
-        return EXPR_ERROR_ALREADYPARSEDGOOD;
-
-    /* Make sure an expression was passed */
-    if(expr == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    /* Create token list */
-    err = exprStringToTokenList(obj, expr, &tokens, &count);
-    if(err != EXPR_ERROR_NOERROR)
-        return err;
-    
-    /* Create head pointer */
-    tmp = exprAllocNodes(1);
-    if(tmp == NULL)
-        {
-        exprFreeTokenList(tokens, count);
-        return EXPR_ERROR_MEMORY;
-        }
-
-    obj->headnode = tmp;
-
-    /* Call the multiparse routine to parse subexpressions */
-    err = exprMultiParse(obj, tmp, tokens, count);
-
-    /* Free the token list */
-    exprFreeTokenList(tokens, count);
-
-    /* successful parse? */
-    if(err == EXPR_ERROR_NOERROR)
-        {
-        obj->parsedgood = 1;
-        obj->parsedbad = 0;
-        }
-    else
-        {
-        obj->parsedbad = 1;
-        obj->parsedgood = 0;
-        }
+int exprParse(exprObj * obj, char *expr)
+{
+	exprToken *tokens;
+	int count;
+	int err;
+	exprNode *tmp;
+
+	/* Make sure an object was passed */
+	if (obj == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	/* Clear expression error position */
+	obj->starterr = obj->enderr = -1;
+
+	/* Have we already been parsed? */
+	if (obj->parsedbad != 0)
+		return EXPR_ERROR_ALREADYPARSEDBAD;
+
+	if (obj->parsedgood != 0)
+		return EXPR_ERROR_ALREADYPARSEDGOOD;
+
+	/* Make sure an expression was passed */
+	if (expr == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	/* Create token list */
+	err = exprStringToTokenList(obj, expr, &tokens, &count);
+	if (err != EXPR_ERROR_NOERROR)
+		return err;
+
+	/* Create head pointer */
+	tmp = exprAllocNodes(1);
+	if (tmp == NULL) {
+		exprFreeTokenList(tokens, count);
+		return EXPR_ERROR_MEMORY;
+	}
+
+	obj->headnode = tmp;
+
+	/* Call the multiparse routine to parse subexpressions */
+	err = exprMultiParse(obj, tmp, tokens, count);
+
+	/* Free the token list */
+	exprFreeTokenList(tokens, count);
+
+	/* successful parse? */
+	if (err == EXPR_ERROR_NOERROR) {
+		obj->parsedgood = 1;
+		obj->parsedbad = 0;
+	} else {
+		obj->parsedbad = 1;
+		obj->parsedgood = 0;
+	}
 
-    return err;
-    }
+	return err;
+}
 
 
 /* Parse the subexpressions, each ending with semicolons */
-int exprMultiParse(exprObj *obj, exprNode *node, exprToken *tokens, int count)
-    {
-    int pos, plevel, last;
-    int num, cur, err;
-    exprNode *tmp;
-
-    plevel = 0;
-    num = 0;
-    last = -1;
-
-    /* First count the number of arguments */
-    for(pos = 0; pos < count; pos++)
-        {
-        switch(tokens[pos].type)
-            {
-            case EXPR_TOKEN_OPAREN:
-                /* increase plevel */
-                plevel++;
-                break;
-
-            case EXPR_TOKEN_CPAREN:
-                /* decrease plevel */
-                plevel--;
-
-                if(plevel < 0)
-                    {
-                    obj->starterr = tokens[pos].start;
-                    obj->enderr = tokens[pos].end;
-                    return EXPR_ERROR_UNMATCHEDPAREN;
-                    }
-
-                break;
-
-            case EXPR_TOKEN_SEMICOLON:
-                if(plevel == 0)
-                    {
-                    if(last == pos - 1 || pos == 0)
-                        {
-                        /* last semicolon is before us or we are at the start */
-                        obj->starterr = tokens[pos].start;
-                        obj->enderr = tokens[pos].end;
-                        return EXPR_ERROR_SYNTAX;
-                        }
-                    else
-                        {
-                        /* last semicolon is not right before us */
-                        num++;
-                        }
-                    }
-                else
-                    {
-                    /* Semicolon should not be in a parenthesis */
-                    obj->starterr = tokens[pos].start;
-                    obj->enderr = tokens[pos].end;
-                    return EXPR_ERROR_SYNTAX;
-                    }
-
-                last = pos; /* update position of last semicolon */
-                break;
-            }
-        }
-
-    /* plevel should be zero now */
-    if(plevel != 0)
-        return EXPR_ERROR_UNMATCHEDPAREN;
-
-    /* the last character should be a semicolon */
-    if(last != pos - 1)
-        return EXPR_ERROR_MISSINGSEMICOLON;
-
-    /* Now we know how many arguments there are */
-
-    /* Allocate array of subnodes */
-    tmp = exprAllocNodes(num);
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-
-    /* Set the current node's data */
-    node->type = EXPR_NODETYPE_MULTI;
-    node->data.oper.nodes = tmp;
-    node->data.oper.nodecount = num;
-
-    /* now we parse each subexpression */
-    last = 0; /* Not for last semicolon, but for first char of subexpr */
-    cur = 0;
-
-    for(pos = 0; pos < count; pos++)
-        {
-        if(tokens[pos].type == EXPR_TOKEN_SEMICOLON)
-            {
-            /* Everything from last up to pos - 1 is a parameter */
-            err = exprInternalParse(obj, &(tmp[cur]), tokens, last, pos - 1);
-            if(err != EXPR_ERROR_NOERROR)
-                return err;
-
-            /* Update last position and current argument */
-            last = pos + 1;
-            cur++;
-            }
-        }
+int exprMultiParse(exprObj * obj, exprNode * node, exprToken * tokens, int count)
+{
+	int pos, plevel, last;
+	int num, cur, err;
+	exprNode *tmp;
+
+	plevel = 0;
+	num = 0;
+	last = -1;
+
+	/* First count the number of arguments */
+	for (pos = 0; pos < count; pos++) {
+		switch (tokens[pos].type) {
+		case EXPR_TOKEN_OPAREN:
+			/* increase plevel */
+			plevel++;
+			break;
+
+		case EXPR_TOKEN_CPAREN:
+			/* decrease plevel */
+			plevel--;
+
+			if (plevel < 0) {
+				obj->starterr = tokens[pos].start;
+				obj->enderr = tokens[pos].end;
+				return EXPR_ERROR_UNMATCHEDPAREN;
+			}
+
+			break;
+
+		case EXPR_TOKEN_SEMICOLON:
+			if (plevel == 0) {
+				if (last == pos - 1 || pos == 0) {
+					/* last semicolon is before us or we are at the start */
+					obj->starterr = tokens[pos].start;
+					obj->enderr = tokens[pos].end;
+					return EXPR_ERROR_SYNTAX;
+				} else {
+					/* last semicolon is not right before us */
+					num++;
+				}
+			} else {
+				/* Semicolon should not be in a parenthesis */
+				obj->starterr = tokens[pos].start;
+				obj->enderr = tokens[pos].end;
+				return EXPR_ERROR_SYNTAX;
+			}
+
+			last = pos;			/* update position of last semicolon */
+			break;
+		}
+	}
+
+	/* plevel should be zero now */
+	if (plevel != 0)
+		return EXPR_ERROR_UNMATCHEDPAREN;
+
+	/* the last character should be a semicolon */
+	if (last != pos - 1)
+		return EXPR_ERROR_MISSINGSEMICOLON;
+
+	/* Now we know how many arguments there are */
+
+	/* Allocate array of subnodes */
+	tmp = exprAllocNodes(num);
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+	/* Set the current node's data */
+	node->type = EXPR_NODETYPE_MULTI;
+	node->data.oper.nodes = tmp;
+	node->data.oper.nodecount = num;
+
+	/* now we parse each subexpression */
+	last = 0;					/* Not for last semicolon, but for first char of subexpr */
+	cur = 0;
+
+	for (pos = 0; pos < count; pos++) {
+		if (tokens[pos].type == EXPR_TOKEN_SEMICOLON) {
+			/* Everything from last up to pos - 1 is a parameter */
+			err = exprInternalParse(obj, &(tmp[cur]), tokens, last, pos - 1);
+			if (err != EXPR_ERROR_NOERROR)
+				return err;
+
+			/* Update last position and current argument */
+			last = pos + 1;
+			cur++;
+		}
+	}
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* This function parses each subnode and recurses if needed */
-int exprInternalParse(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end)
-    {
-    int pos;
-    int plevel = 0; /* Paren level */
-    int fgopen = -1; /* First paren group open index */
-    int fgclose = -1; /* First paren group close index */
-    int assignindex = -1; /* First = at plevel 0 for assignment */
-    int addsubindex = -1; /* Last + or - at plevel 0 for adding or subtracting */
-    int muldivindex = -1; /* Last * or / at plevel 0 for multiplying or dividing */
-    int expindex = -1; /* Last ^ fount at plevel 0 for exponents */
-    int posnegindex = -1; /* First +,- at plevel 0 for positive,negative */
-
-    /* Make sure some conditions are right */
-    if(start > end)
-        return EXPR_ERROR_UNKNOWN;
-
-    /* Scan the string for certain characters */
-    for(pos = start; pos <= end; pos++)
-        {
-        switch(tokens[pos].type)
-            {
-            case EXPR_TOKEN_OPAREN:
-                plevel++;
-
-                /* First group open? */
-                if(plevel == 1 && fgopen == -1)
-                    fgopen = pos;
-                break;
-
-            case EXPR_TOKEN_CPAREN:
-                plevel--;
-
-                /* First group close? */
-                if(plevel == 0 && fgclose == -1)
-                    fgclose = pos;
-
-                if(plevel < 0)
-                    {
-                    obj->starterr = tokens[pos].start;
-                    obj->enderr = tokens[pos].end;
-                    return EXPR_ERROR_UNMATCHEDPAREN;
-                    }
-                break;
-
-            case EXPR_TOKEN_EQUAL:
-                /* Assignment found */
-                if(plevel == 0)
-                    {
-                    if(assignindex == -1)
-                        assignindex = pos;
-                    }
-                break;
-
-            case EXPR_TOKEN_ASTERISK:
-            case EXPR_TOKEN_FSLASH:
-                /* Multiplication or division */
-                if(plevel == 0)
-                    muldivindex = pos;
-                break;
-
-            case EXPR_TOKEN_HAT:
-                /* Exponent */
-                if(plevel == 0)
-                    expindex = pos;
-                break;
-
-
-            case EXPR_TOKEN_PLUS:
-            case EXPR_TOKEN_HYPHEN:
-                /* Addition or positive or subtraction or negative*/
-                if(plevel == 0)
-                    {
-                    if(pos == start)
-                        {
-                        /* At the start area, positive/negative */
-                        if(posnegindex == -1)
-                            posnegindex = pos;
-                        }
-                    else
-                        {
-                        /* Not at start, check item in front */
-                        switch(tokens[pos - 1].type)
-                            {
-                            case EXPR_TOKEN_EQUAL: /* Equal sign */
-                            case EXPR_TOKEN_PLUS: /* Add/positive sign */
-                            case EXPR_TOKEN_HYPHEN: /* Subtract/negative sign */
-                            case EXPR_TOKEN_ASTERISK: /* Multiply sign */
-                            case EXPR_TOKEN_FSLASH: /* Divide sign */
-                            case EXPR_TOKEN_HAT: /* Exponent sign */
-
-                                /* After theses, it is positive/negative */
-                                if(posnegindex == -1)
-                                    posnegindex = pos;
-
-                                break;
-
-                            default:
-                                /* Otherwise it is addition/subtraction */
-                                addsubindex = pos;
-                                break;
-                            }
-                        }
-                    }
-                break;
-
-            }
-        }
-
-    /* plevel should now be zero */
-    if(plevel != 0)
-        return EXPR_ERROR_UNMATCHEDPAREN;
-
-    /* We must parse the data in a certain order to maintain the
-       correct order of operators at evaluation time */
-
-    /* First, take care of assignment */
-    if(assignindex != -1)
-        return exprInternalParseAssign(obj, node, tokens, start, end, assignindex);
-
-    /* Addition or subtraction is next */
-    if(addsubindex != -1)
-        {
-        if(tokens[addsubindex].type == EXPR_TOKEN_PLUS)
-            return exprInternalParseAdd(obj, node, tokens, start, end, addsubindex);
-        else
-            return exprInternalParseSub(obj, node, tokens, start, end, addsubindex);
-        }
-
-
-    /* Multiplycation or division */
-    if(muldivindex != -1)
-        {
-        if(tokens[muldivindex].type == EXPR_TOKEN_ASTERISK)
-            return exprInternalParseMul(obj, node, tokens, start, end, muldivindex);
-        else
-            return exprInternalParseDiv(obj, node, tokens, start, end, muldivindex);
-        }
-
-    /* Exponent */
-    if(expindex != -1)
-        return exprInternalParseExp(obj, node, tokens, start, end, expindex);
-
-    /* Negation */
-    if(posnegindex != -1)
-        return exprInternalParsePosNeg(obj, node, tokens, start, end, posnegindex);
-
-
-    /* Grouped parenthesis */
-    if(fgopen == start)
-        {
-        /* Closing paren. should be at the end */
-        if(fgclose == end)
-            {
-            /* Anything between them */
-            if(fgclose > fgopen + 1)
-                {
-                return exprInternalParse(obj, node, tokens, fgopen + 1, fgclose - 1);
-                }
-            else
-                {
-                /* Nothing between them */
-                obj->starterr = tokens[fgopen].start;
-                obj->enderr = tokens[fgclose].end;
-                return EXPR_ERROR_SYNTAX;
-                }
-            }
-        else /* Closing paren not at the end */
-            return EXPR_ERROR_SYNTAX;
-        }
-
-    /* Functions */
-    if(fgopen > start)
-        {
-        /* Closing paren should be at end */
-        if(fgclose == end)
-            {
-            return exprInternalParseFunction(obj, node, tokens, start, end, fgopen, fgclose);
-            }
-        else /* Closing paren not at end */
-            return EXPR_ERROR_SYNTAX;
-        }
-
-    /* If it was none of the above, it must be a variable or value */
-    return exprInternalParseVarVal(obj, node, tokens, start, end);
-    }
+int exprInternalParse(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end)
+{
+	int pos;
+	int plevel = 0;				/* Paren level */
+	int fgopen = -1;			/* First paren group open index */
+	int fgclose = -1;			/* First paren group close index */
+	int assignindex = -1;		/* First = at plevel 0 for assignment */
+	int addsubindex = -1;		/* Last + or - at plevel 0 for adding or subtracting */
+	int muldivindex = -1;		/* Last * or / at plevel 0 for multiplying or dividing */
+	int expindex = -1;			/* Last ^ fount at plevel 0 for exponents */
+	int posnegindex = -1;		/* First +,- at plevel 0 for positive,negative */
+
+	/* Make sure some conditions are right */
+	if (start > end)
+		return EXPR_ERROR_UNKNOWN;
+
+	/* Scan the string for certain characters */
+	for (pos = start; pos <= end; pos++) {
+		switch (tokens[pos].type) {
+		case EXPR_TOKEN_OPAREN:
+			plevel++;
+
+			/* First group open? */
+			if (plevel == 1 && fgopen == -1)
+				fgopen = pos;
+			break;
+
+		case EXPR_TOKEN_CPAREN:
+			plevel--;
+
+			/* First group close? */
+			if (plevel == 0 && fgclose == -1)
+				fgclose = pos;
+
+			if (plevel < 0) {
+				obj->starterr = tokens[pos].start;
+				obj->enderr = tokens[pos].end;
+				return EXPR_ERROR_UNMATCHEDPAREN;
+			}
+			break;
+
+		case EXPR_TOKEN_EQUAL:
+			/* Assignment found */
+			if (plevel == 0) {
+				if (assignindex == -1)
+					assignindex = pos;
+			}
+			break;
+
+		case EXPR_TOKEN_ASTERISK:
+		case EXPR_TOKEN_FSLASH:
+			/* Multiplication or division */
+			if (plevel == 0)
+				muldivindex = pos;
+			break;
+
+		case EXPR_TOKEN_HAT:
+			/* Exponent */
+			if (plevel == 0)
+				expindex = pos;
+			break;
+
+
+		case EXPR_TOKEN_PLUS:
+		case EXPR_TOKEN_HYPHEN:
+			/* Addition or positive or subtraction or negative */
+			if (plevel == 0) {
+				if (pos == start) {
+					/* At the start area, positive/negative */
+					if (posnegindex == -1)
+						posnegindex = pos;
+				} else {
+					/* Not at start, check item in front */
+					switch (tokens[pos - 1].type) {
+					case EXPR_TOKEN_EQUAL:	/* Equal sign */
+					case EXPR_TOKEN_PLUS:	/* Add/positive sign */
+					case EXPR_TOKEN_HYPHEN:	/* Subtract/negative sign */
+					case EXPR_TOKEN_ASTERISK:	/* Multiply sign */
+					case EXPR_TOKEN_FSLASH:	/* Divide sign */
+					case EXPR_TOKEN_HAT:	/* Exponent sign */
+
+						/* After theses, it is positive/negative */
+						if (posnegindex == -1)
+							posnegindex = pos;
+
+						break;
+
+					default:
+						/* Otherwise it is addition/subtraction */
+						addsubindex = pos;
+						break;
+					}
+				}
+			}
+			break;
+
+		}
+	}
+
+	/* plevel should now be zero */
+	if (plevel != 0)
+		return EXPR_ERROR_UNMATCHEDPAREN;
+
+	/* We must parse the data in a certain order to maintain the
+	   correct order of operators at evaluation time */
+
+	/* First, take care of assignment */
+	if (assignindex != -1)
+		return exprInternalParseAssign(obj, node, tokens, start, end, assignindex);
+
+	/* Addition or subtraction is next */
+	if (addsubindex != -1) {
+		if (tokens[addsubindex].type == EXPR_TOKEN_PLUS)
+			return exprInternalParseAdd(obj, node, tokens, start, end, addsubindex);
+		else
+			return exprInternalParseSub(obj, node, tokens, start, end, addsubindex);
+	}
+
+
+	/* Multiplycation or division */
+	if (muldivindex != -1) {
+		if (tokens[muldivindex].type == EXPR_TOKEN_ASTERISK)
+			return exprInternalParseMul(obj, node, tokens, start, end, muldivindex);
+		else
+			return exprInternalParseDiv(obj, node, tokens, start, end, muldivindex);
+	}
+
+	/* Exponent */
+	if (expindex != -1)
+		return exprInternalParseExp(obj, node, tokens, start, end, expindex);
+
+	/* Negation */
+	if (posnegindex != -1)
+		return exprInternalParsePosNeg(obj, node, tokens, start, end, posnegindex);
+
+
+	/* Grouped parenthesis */
+	if (fgopen == start) {
+		/* Closing paren. should be at the end */
+		if (fgclose == end) {
+			/* Anything between them */
+			if (fgclose > fgopen + 1) {
+				return exprInternalParse(obj, node, tokens, fgopen + 1, fgclose - 1);
+			} else {
+				/* Nothing between them */
+				obj->starterr = tokens[fgopen].start;
+				obj->enderr = tokens[fgclose].end;
+				return EXPR_ERROR_SYNTAX;
+			}
+		} else					/* Closing paren not at the end */
+			return EXPR_ERROR_SYNTAX;
+	}
+
+	/* Functions */
+	if (fgopen > start) {
+		/* Closing paren should be at end */
+		if (fgclose == end) {
+			return exprInternalParseFunction(obj, node, tokens, start, end, fgopen, fgclose);
+		} else					/* Closing paren not at end */
+			return EXPR_ERROR_SYNTAX;
+	}
+
+	/* If it was none of the above, it must be a variable or value */
+	return exprInternalParseVarVal(obj, node, tokens, start, end);
+}
 
 /* Function to parse an assignment node */
-int exprInternalParseAssign(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
-    {
-    exprNode *tmp;
-    exprValList *l;
-    EXPRTYPE *addr;
-
-    /* Make sure the equal sign is not at the start or end */
-    if(index != start + 1 || index >= end)
-        {
-        obj->starterr = tokens[index].start;
-        obj->enderr = tokens[index].end;
-        return EXPR_ERROR_SYNTAX;
-        }
-
-    /* Make sure item before equal sign is an identifier */
-    if(tokens[index - 1].type != EXPR_TOKEN_IDENTIFIER)
-        {
-        obj->starterr = tokens[index - 1].start;
-        obj->enderr = tokens[index].end;
-        return EXPR_ERROR_SYNTAX;
-        }
-
-    /* Create expression subnode */
-    tmp = exprAllocNodes(1);
-    if(tmp == NULL)
-        {
-        return EXPR_ERROR_MEMORY;
-        }
-
-
-    /* Set the data */
-    node->type = EXPR_NODETYPE_ASSIGN;
-    node->data.assign.node = tmp;
-
-
-    /*
-        The fast access method directly accesses the memory address
-        of the variable's value at evaluation time.  Because of this,
-        we must make sure the variable does exists in the variable list.
-    */
-
-    /* Make sure name is not a constant name */
-    l = exprGetConstList(obj);
-    if(l)
-        {
-        exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
-        if(addr)
-            {
-            obj->starterr = tokens[index - 1].start;
-            obj->enderr = tokens[index].end;
-            return EXPR_ERROR_CONSTANTASSIGN;
-            }
-        }
-
-    /* Get the variable list */
-    l = exprGetVarList(obj);
-    if(l == NULL)
-        return EXPR_ERROR_NOVARLIST;
-
-    /* Get variable address if already in the list */
-    exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
-    if(addr == NULL) /* Variable not in the list, add it */
-        {
-        exprValListAdd(l, tokens[index - 1].data.str, 0.0);
-
-        /* Try to get address again */
-        exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
-        if(addr == NULL) /* Could not add variable */
-            return EXPR_ERROR_MEMORY; /* Could not add variable to list */
-        }
-
-    node->data.assign.vaddr = addr;
-
-    /* Parse the subnode */
-    return exprInternalParse(obj, tmp, tokens, index + 1, end);
-    }
+int exprInternalParseAssign(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+	exprNode *tmp;
+	exprValList *l;
+	EXPRTYPE *addr;
+
+	/* Make sure the equal sign is not at the start or end */
+	if (index != start + 1 || index >= end) {
+		obj->starterr = tokens[index].start;
+		obj->enderr = tokens[index].end;
+		return EXPR_ERROR_SYNTAX;
+	}
+
+	/* Make sure item before equal sign is an identifier */
+	if (tokens[index - 1].type != EXPR_TOKEN_IDENTIFIER) {
+		obj->starterr = tokens[index - 1].start;
+		obj->enderr = tokens[index].end;
+		return EXPR_ERROR_SYNTAX;
+	}
+
+	/* Create expression subnode */
+	tmp = exprAllocNodes(1);
+	if (tmp == NULL) {
+		return EXPR_ERROR_MEMORY;
+	}
+
+
+	/* Set the data */
+	node->type = EXPR_NODETYPE_ASSIGN;
+	node->data.assign.node = tmp;
+
+
+	/*
+	   The fast access method directly accesses the memory address
+	   of the variable's value at evaluation time.  Because of this,
+	   we must make sure the variable does exists in the variable list.
+	 */
+
+	/* Make sure name is not a constant name */
+	l = exprGetConstList(obj);
+	if (l) {
+		exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
+		if (addr) {
+			obj->starterr = tokens[index - 1].start;
+			obj->enderr = tokens[index].end;
+			return EXPR_ERROR_CONSTANTASSIGN;
+		}
+	}
+
+	/* Get the variable list */
+	l = exprGetVarList(obj);
+	if (l == NULL)
+		return EXPR_ERROR_NOVARLIST;
+
+	/* Get variable address if already in the list */
+	exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
+	if (addr == NULL) {			/* Variable not in the list, add it */
+		exprValListAdd(l, tokens[index - 1].data.str, 0.0);
+
+		/* Try to get address again */
+		exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
+		if (addr == NULL)		/* Could not add variable */
+			return EXPR_ERROR_MEMORY;	/* Could not add variable to list */
+	}
+
+	node->data.assign.vaddr = addr;
+
+	/* Parse the subnode */
+	return exprInternalParse(obj, tmp, tokens, index + 1, end);
+}
 
 /* Function to parse an addition operator */
-int exprInternalParseAdd(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
-    {
-    exprNode *tmp;
-    int err;
-
-    /* Make sure plus sign is at a good place */
-    if(index <= start || index >= end)
-        {
-        obj->starterr = tokens[index].start;
-        obj->enderr = tokens[index].end;
-        return EXPR_ERROR_SYNTAX;
-        }
-
-    /* Allocate space for 2 subnodes */
-    tmp = exprAllocNodes(2);
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-
-
-    /* Set the data */
-    node->type = EXPR_NODETYPE_ADD;
-    node->data.oper.nodes = tmp;
-    node->data.oper.nodecount = 2;
-
-    /* parse the left side */
-    err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
-    if(err != EXPR_ERROR_NOERROR)
-        return err;
-
-    /* parse the right side */
-    return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
-    }
+int exprInternalParseAdd(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+	exprNode *tmp;
+	int err;
+
+	/* Make sure plus sign is at a good place */
+	if (index <= start || index >= end) {
+		obj->starterr = tokens[index].start;
+		obj->enderr = tokens[index].end;
+		return EXPR_ERROR_SYNTAX;
+	}
+
+	/* Allocate space for 2 subnodes */
+	tmp = exprAllocNodes(2);
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+
+	/* Set the data */
+	node->type = EXPR_NODETYPE_ADD;
+	node->data.oper.nodes = tmp;
+	node->data.oper.nodecount = 2;
+
+	/* parse the left side */
+	err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+	if (err != EXPR_ERROR_NOERROR)
+		return err;
+
+	/* parse the right side */
+	return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
 
 /* Function to parse a subtraction operator */
-int exprInternalParseSub(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
-    {
-    exprNode *tmp;
-    int err;
-
-    /* Make sure minus sign is at a good place */
-    if(index <= start || index >= end)
-        {
-        obj->starterr = tokens[index].start;
-        obj->enderr = tokens[index].end;
-        return EXPR_ERROR_SYNTAX;
-        }
-
-    /* Allocate space for 2 subnodes */
-    tmp = exprAllocNodes(2);
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-
-
-    /* Set the data */
-    node->type = EXPR_NODETYPE_SUBTRACT;
-    node->data.oper.nodes = tmp;
-    node->data.oper.nodecount = 2;
-    
-    /* parse the left side */
-    err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
-    if(err != EXPR_ERROR_NOERROR)
-        return err;
-
-    /* parse the right side */
-    return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
-    }
+int exprInternalParseSub(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+	exprNode *tmp;
+	int err;
+
+	/* Make sure minus sign is at a good place */
+	if (index <= start || index >= end) {
+		obj->starterr = tokens[index].start;
+		obj->enderr = tokens[index].end;
+		return EXPR_ERROR_SYNTAX;
+	}
+
+	/* Allocate space for 2 subnodes */
+	tmp = exprAllocNodes(2);
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+
+	/* Set the data */
+	node->type = EXPR_NODETYPE_SUBTRACT;
+	node->data.oper.nodes = tmp;
+	node->data.oper.nodecount = 2;
+
+	/* parse the left side */
+	err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+	if (err != EXPR_ERROR_NOERROR)
+		return err;
+
+	/* parse the right side */
+	return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
 
 /* Function to parse a multiplication operator */
-int exprInternalParseMul(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
-    {
-    exprNode *tmp;
-    int err;
-
-    /* Make sure times sign is at a good place */
-    if(index <= start || index >= end)
-        {
-        obj->starterr = tokens[index].start;
-        obj->enderr = tokens[index].end;
-        return EXPR_ERROR_SYNTAX;
-        }
-
-
-    /* Allocate space for 2 subnodes */
-    tmp = exprAllocNodes(2);
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-
-
-    /* Set the data */
-    node->type = EXPR_NODETYPE_MULTIPLY;
-    node->data.oper.nodes = tmp;
-    node->data.oper.nodecount = 2;
-
-    /* parse the left side */
-    err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
-    if(err != EXPR_ERROR_NOERROR)
-        return err;
-
-    /* parse the right side */
-    return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
-    }
+int exprInternalParseMul(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+	exprNode *tmp;
+	int err;
+
+	/* Make sure times sign is at a good place */
+	if (index <= start || index >= end) {
+		obj->starterr = tokens[index].start;
+		obj->enderr = tokens[index].end;
+		return EXPR_ERROR_SYNTAX;
+	}
+
+
+	/* Allocate space for 2 subnodes */
+	tmp = exprAllocNodes(2);
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+
+	/* Set the data */
+	node->type = EXPR_NODETYPE_MULTIPLY;
+	node->data.oper.nodes = tmp;
+	node->data.oper.nodecount = 2;
+
+	/* parse the left side */
+	err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+	if (err != EXPR_ERROR_NOERROR)
+		return err;
+
+	/* parse the right side */
+	return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
 
 /* Function to parse a division operator */
-int exprInternalParseDiv(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
-    {
-    exprNode *tmp;
-    int err;
-
-    /* Make sure slash sign is at a good place */
-    if(index <= start || index >= end)
-        {
-        obj->starterr = tokens[index].start;
-        obj->enderr = tokens[index].end;
-        return EXPR_ERROR_SYNTAX;
-        }
-
-
-    /* Allocate space for 2 subnodes */
-    tmp = exprAllocNodes(2);
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-
-
-    /* Set the data */
-    node->type = EXPR_NODETYPE_DIVIDE;
-    node->data.oper.nodes = tmp;
-    node->data.oper.nodecount = 2;
-
-    /* parse the left side */
-    err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
-    if(err != EXPR_ERROR_NOERROR)
-        return err;
-
-    /* parse the right side */
-    return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
-    }
+int exprInternalParseDiv(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+	exprNode *tmp;
+	int err;
+
+	/* Make sure slash sign is at a good place */
+	if (index <= start || index >= end) {
+		obj->starterr = tokens[index].start;
+		obj->enderr = tokens[index].end;
+		return EXPR_ERROR_SYNTAX;
+	}
+
+
+	/* Allocate space for 2 subnodes */
+	tmp = exprAllocNodes(2);
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+
+	/* Set the data */
+	node->type = EXPR_NODETYPE_DIVIDE;
+	node->data.oper.nodes = tmp;
+	node->data.oper.nodecount = 2;
+
+	/* parse the left side */
+	err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+	if (err != EXPR_ERROR_NOERROR)
+		return err;
+
+	/* parse the right side */
+	return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
 
 /* Function to parse an exponent operator */
-int exprInternalParseExp(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
-    {
-    exprNode *tmp;
-    int err;
-
-    /* Make sure exponent sign is at a good place */
-    if(index <= start || index >= end)
-        {
-        obj->starterr = tokens[index].start;
-        obj->enderr = tokens[index].end;
-        return EXPR_ERROR_SYNTAX;
-        }
-
-
-    /* Allocate space for 2 subnodes */
-    tmp = exprAllocNodes(2);
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-
-
-    /* Set the data */
-    node->type = EXPR_NODETYPE_EXPONENT;
-    node->data.oper.nodes = tmp;
-    node->data.oper.nodecount = 2;
-
-    /* parse the left side */
-    err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
-    if(err != EXPR_ERROR_NOERROR)
-        return err;
-
-    /* parse the right side */
-    return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
-    }
+int exprInternalParseExp(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+	exprNode *tmp;
+	int err;
+
+	/* Make sure exponent sign is at a good place */
+	if (index <= start || index >= end) {
+		obj->starterr = tokens[index].start;
+		obj->enderr = tokens[index].end;
+		return EXPR_ERROR_SYNTAX;
+	}
+
+
+	/* Allocate space for 2 subnodes */
+	tmp = exprAllocNodes(2);
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+
+	/* Set the data */
+	node->type = EXPR_NODETYPE_EXPONENT;
+	node->data.oper.nodes = tmp;
+	node->data.oper.nodecount = 2;
+
+	/* parse the left side */
+	err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+	if (err != EXPR_ERROR_NOERROR)
+		return err;
+
+	/* parse the right side */
+	return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
 
 /* Function to parse for positive and negative */
-int exprInternalParsePosNeg(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
-    {
-    exprNode *tmp;
-
-    /* Position should be the same as start */
-    if(index != start)
-        {
-        obj->starterr = tokens[index].start;
-        obj->enderr = tokens[index].end;
-        return EXPR_ERROR_UNKNOWN;
-        }
-
-    /* If it is a positive, just parse the internal of it */
-    if(tokens[index].type == EXPR_TOKEN_PLUS)
-        return exprInternalParse(obj, node, tokens, index + 1, end);
-    else
-        {
-        /* Allocate subnode */
-        tmp = exprAllocNodes(1);
-        if(tmp == NULL)
-            return EXPR_ERROR_NOERROR;
-
-
-        /* Set data */
-        node->type = EXPR_NODETYPE_NEGATE;
-        node->data.oper.nodes = tmp;
-        node->data.oper.nodecount = 1;
-
-        /* Parse the subnode */
-        return exprInternalParse(obj, tmp, tokens, index + 1, end);
-        }
-    }
+int exprInternalParsePosNeg(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+	exprNode *tmp;
+
+	/* Position should be the same as start */
+	if (index != start) {
+		obj->starterr = tokens[index].start;
+		obj->enderr = tokens[index].end;
+		return EXPR_ERROR_UNKNOWN;
+	}
+
+	/* If it is a positive, just parse the internal of it */
+	if (tokens[index].type == EXPR_TOKEN_PLUS)
+		return exprInternalParse(obj, node, tokens, index + 1, end);
+	else {
+		/* Allocate subnode */
+		tmp = exprAllocNodes(1);
+		if (tmp == NULL)
+			return EXPR_ERROR_NOERROR;
+
+
+		/* Set data */
+		node->type = EXPR_NODETYPE_NEGATE;
+		node->data.oper.nodes = tmp;
+		node->data.oper.nodecount = 1;
+
+		/* Parse the subnode */
+		return exprInternalParse(obj, tmp, tokens, index + 1, end);
+	}
+}
 
 /* Function will parse a call to a function */
-int exprInternalParseFunction(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int p1, int p2)
-    {
-    int pos;
-    int num, cur;
-    int refnum, refcur;
-    int plevel = 0;
-    int lv, err;
-    exprNode *tmp;
-    exprFuncType fptr;
-    int argmin, argmax;
-    int refargmin, refargmax;
-    int type;
-    exprFuncList *l;
-    exprValList *vars;
-    EXPRTYPE *addr;
-    EXPRTYPE **reftmp;
-
-    /* We should have a function list */
-    l = exprGetFuncList(obj);
-    if(l == NULL)
-        return EXPR_ERROR_NOSUCHFUNCTION;
-
-    /* check paren. location */
-    if(p2 <= p1)
-        return EXPR_ERROR_SYNTAX;
-
-    /* second paren. should not be after the end */
-    if(p2 > end)
-        return EXPR_ERROR_SYNTAX;
-
-    /* Item before parenthesis should be an identifier */
-    if(tokens[p1 - 1].type != EXPR_TOKEN_IDENTIFIER)
-        {
-        obj->starterr = tokens[p1 - 1].start;
-        obj->enderr = tokens[p1].end;
-        return EXPR_ERROR_SYNTAX;
-        }
-
-
-    /* Look up the function */
-    err = exprFuncListGet(l, tokens[p1 - 1].data.str, &fptr, &type, &argmin, &argmax, &refargmin, &refargmax);
-    if(err != EXPR_ERROR_NOERROR)
-        {
-        if(err == EXPR_ERROR_NOTFOUND)
-            {
-            obj->starterr = tokens[p1 - 1].start;
-            obj->enderr = tokens[p1 - 1].end;
-            return EXPR_ERROR_NOSUCHFUNCTION;
-            }
-        else
-            return err;
-        }
-
-    /* Make sure the function exists */
-    if(fptr == NULL && type == 0)
-        {
-        obj->starterr = tokens[p1 - 1].start;
-        obj->enderr = tokens[p1 - 1].end;
-        return EXPR_ERROR_NOSUCHFUNCTION;
-        }
-
-    /* Count arguments */
-    if(p2 == p1 + 1)
-        {
-        num = 0;
-        refnum = 0;
-        }
-    else
-        {
-        num = 1;
-        refnum = 0;
-
-
-        /* count commas */
-        for(pos = p1 + 1; pos < p2; pos++)
-            {
-            switch(tokens[pos].type)
-                {
-                case EXPR_TOKEN_OPAREN:
-                    plevel++;
-                    break;
-
-                case EXPR_TOKEN_CPAREN:
-                    plevel--;
-                    if(plevel < 0)
-                        {
-                        obj->starterr = tokens[pos].start;
-                        obj->enderr = tokens[pos].end;
-                        return EXPR_ERROR_UNMATCHEDPAREN;
-                        }
-                    break;
-
-                case EXPR_TOKEN_COMMA:
-                    /* Found comma */
-                    if(plevel == 0)
-                        num++;
-                    break;
-
-                case EXPR_TOKEN_AMPERSAND:
-                    /* Found reference mark */
-                    if(plevel == 0)
-                        {
-                        /* This may only occur after the open parenthesis or comma */
-                        if(tokens[pos - 1].type == EXPR_TOKEN_OPAREN || tokens[pos - 1].type == EXPR_TOKEN_COMMA)
-                            refnum++;
-                        else
-                            return EXPR_ERROR_SYNTAX;
-                        }
-                    break;
-                }
-            }
-
-        /* plevel should be zero */
-        if(plevel != 0)
-            return EXPR_ERROR_UNMATCHEDPAREN;
-        }
-
-    /* We now have the number of total arguments and
-       number of ref arguments.  Get number of normal
-       arguments */
-    num = num - refnum;
-
-    /* Make sure number of arguments is correct */
-    /* Here we make sure the limits are greater
-       or equal to zero because any negative number
-       could be used to specify no limit */
-    if(argmin >= 0 && num < argmin)
-        {
-        obj->starterr = tokens[p1 - 1].start;
-        obj->enderr = tokens[p2].end;
-        return EXPR_ERROR_BADNUMBERARGUMENTS;
-        }
-
-    if(argmax >= 0 && num > argmax)
-        {
-        obj->starterr = tokens[p1 - 1].start;
-        obj->enderr = tokens[p2].end;
-        return EXPR_ERROR_BADNUMBERARGUMENTS;
-        }
-
-    if(refargmin >= 0 && refnum < refargmin)
-        {
-        obj->starterr = tokens[p1 - 1].start;
-        obj->enderr = tokens[p2].end;
-        return EXPR_ERROR_BADNUMBERARGUMENTS;
-        }
-
-    if(refargmax >= 0 && refnum > refargmax)
-        {
-        obj->starterr = tokens[p1 - 1].start;
-        obj->enderr = tokens[p2].end;
-        return EXPR_ERROR_BADNUMBERARGUMENTS;
-        }
-
-    /* Set tmp to null in case of no arguments */
-    tmp = NULL;
-    reftmp = NULL;
-
-    if(num > 0)
-        {
-        /* Allocate subnodes */
-        tmp = exprAllocNodes(num);
-        if(tmp == NULL)
-            return EXPR_ERROR_MEMORY;
-        }
-
-    if(refnum > 0)
-        {
-        /* Allocate ref pointers */
-        reftmp = exprAllocMem(sizeof(EXPRTYPE*) * refnum);
-        if(reftmp == NULL)
-            {
-            exprFreeMem(tmp);
-            return EXPR_ERROR_MEMORY;
-            }
-        }
-
-
-
-    /* Set this node's data */
-    node->type = EXPR_NODETYPE_FUNCTION;
-    node->data.function.fptr = fptr;
-    node->data.function.nodecount = num;
-    node->data.function.nodes = tmp;
-    node->data.function.refcount = refnum;
-    node->data.function.refs = reftmp;
-    node->data.function.type = type;
-
-    /* parse each subnode */
-    if(num + refnum > 0)
-        {
-        plevel = 0;
-        cur = 0;
-        refcur = 0;
-        lv = p1 + 1;
-
-        /* look for commas if more than 1 arg */
-        if(num + refnum > 1)
-            {
-            for(pos = p1 + 1; pos < p2; pos++)
-                {
-                switch(tokens[pos].type)
-                    {
-                    case EXPR_TOKEN_OPAREN:
-                        plevel++;
-                        break;
-
-                    case EXPR_TOKEN_CPAREN:
-                        plevel--;
-                        break; /* Already checked paren nesting above */
-
-                    case EXPR_TOKEN_COMMA:
-                        /* Found comma */
-                        if(plevel == 0)
-                            {
-                            /* parse inside */
-                            if(tokens[lv].type == EXPR_TOKEN_AMPERSAND)
-                                {
-                                if(lv != pos - 2)
-                                    {
-                                    obj->starterr = tokens[lv].start;
-                                    obj->enderr = tokens[pos].end;
-                                    return EXPR_ERROR_SYNTAX;
-                                    }
-
-                                /* It is a reference */
-                                if(tokens[lv + 1].type != EXPR_TOKEN_IDENTIFIER)
-                                    {
-                                    obj->starterr = tokens[lv].start;
-                                    obj->enderr = tokens[lv + 1].end;
-                                    return EXPR_ERROR_SYNTAX;
-                                    }
-
-                                
-                                /* Make sure it is not a constant */
-                                vars = exprGetConstList(obj);
-                                if(vars)
-                                    {
-                                    exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
-                                    if(addr)
-                                        {
-                                        obj->starterr = tokens[lv].start;
-                                        obj->enderr = tokens[lv + 1].start;
-                                        return EXPR_ERROR_REFCONSTANT;
-                                        }
-                                    }
-
-                                /* Get variable list */
-                                vars = exprGetVarList(obj);
-                                if(vars == NULL)
-                                    return EXPR_ERROR_NOVARLIST;
-
-                                /* Get variable address */
-                                exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
-                                if(addr == NULL)
-                                    {
-                                    /* Add variable to list */
-                                    exprValListAdd(vars, tokens[lv + 1].data.str, 0.0);
-
-                                    /* Try to get address again */
-                                    exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
-                                    if(addr == NULL)
-                                        return EXPR_ERROR_MEMORY; /* Could not add variable */
-                                    }
-
-                                /* Set reference item */
-                                reftmp[refcur] = addr;
-
-                                /* increase ref arg number and lv position*/
-                                refcur++;
-                                lv = pos + 1;
-                                }
-                            else
-                                {
-                                err = exprInternalParse(obj, &(tmp[cur]), tokens, lv, pos - 1);
-                                if(err != EXPR_ERROR_NOERROR)
-                                    return err;
-
-                                /* increase arg number and lv position*/
-                                lv = pos + 1;
-                                cur++;
-                                }
-                            }
-                        break;
-                    }
-                }
-            }
-
-        /* lv should point after the last comma, or open paren. if only 1 arg */
-        if(tokens[lv].type == EXPR_TOKEN_AMPERSAND)
-            {
-            if(lv != p2 - 2)
-                {
-                obj->starterr = tokens[lv].start;
-                obj->enderr = tokens[p2].end; 
-                return EXPR_ERROR_SYNTAX;
-                }
-
-            /* It is a reference */
-            if(tokens[lv + 1].type != EXPR_TOKEN_IDENTIFIER)
-                {
-                obj->starterr = tokens[lv].start;
-                obj->enderr = tokens[lv + 1].end;
-                return EXPR_ERROR_SYNTAX;
-                }
-            
-            /* Make sure it is not a constant */
-            vars = exprGetConstList(obj);
-            if(vars)
-                {
-                exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
-                if(addr)
-                    {
-                    obj->starterr = tokens[lv].start;
-                    obj->enderr = tokens[lv + 1].start;
-                    return EXPR_ERROR_REFCONSTANT;
-                    }
-                }
-
-            /* Get variable list */
-            vars = exprGetVarList(obj);
-            if(vars == NULL)
-                return EXPR_ERROR_NOVARLIST;
-
-            /* Get variable address */
-            exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
-            if(addr == NULL)
-                {
-                /* Add variable to list */
-                exprValListAdd(vars, tokens[lv + 1].data.str, 0.0);
-
-                /* Try to get address again */
-                exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
-                if(addr == NULL)
-                    return EXPR_ERROR_MEMORY; /* Could not add variable */
-                }
-
-            /* Set reference item */
-            reftmp[refcur] = addr;
-            }
-        else
-            {
-            err = exprInternalParse(obj, &(tmp[cur]), tokens, lv, p2 - 1);
-            if(err != EXPR_ERROR_NOERROR)
-                return err;
-            }
-        }
+int exprInternalParseFunction(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int p1, int p2)
+{
+	int pos;
+	int num, cur;
+	int refnum, refcur;
+	int plevel = 0;
+	int lv, err;
+	exprNode *tmp;
+	exprFuncType fptr;
+	int argmin, argmax;
+	int refargmin, refargmax;
+	int type;
+	exprFuncList *l;
+	exprValList *vars;
+	EXPRTYPE *addr;
+	EXPRTYPE **reftmp;
+
+	/* We should have a function list */
+	l = exprGetFuncList(obj);
+	if (l == NULL)
+		return EXPR_ERROR_NOSUCHFUNCTION;
+
+	/* check paren. location */
+	if (p2 <= p1)
+		return EXPR_ERROR_SYNTAX;
+
+	/* second paren. should not be after the end */
+	if (p2 > end)
+		return EXPR_ERROR_SYNTAX;
+
+	/* Item before parenthesis should be an identifier */
+	if (tokens[p1 - 1].type != EXPR_TOKEN_IDENTIFIER) {
+		obj->starterr = tokens[p1 - 1].start;
+		obj->enderr = tokens[p1].end;
+		return EXPR_ERROR_SYNTAX;
+	}
+
+
+	/* Look up the function */
+	err = exprFuncListGet(l, tokens[p1 - 1].data.str, &fptr, &type, &argmin, &argmax, &refargmin, &refargmax);
+	if (err != EXPR_ERROR_NOERROR) {
+		if (err == EXPR_ERROR_NOTFOUND) {
+			obj->starterr = tokens[p1 - 1].start;
+			obj->enderr = tokens[p1 - 1].end;
+			return EXPR_ERROR_NOSUCHFUNCTION;
+		} else
+			return err;
+	}
+
+	/* Make sure the function exists */
+	if (fptr == NULL && type == 0) {
+		obj->starterr = tokens[p1 - 1].start;
+		obj->enderr = tokens[p1 - 1].end;
+		return EXPR_ERROR_NOSUCHFUNCTION;
+	}
+
+	/* Count arguments */
+	if (p2 == p1 + 1) {
+		num = 0;
+		refnum = 0;
+	} else {
+		num = 1;
+		refnum = 0;
+
+
+		/* count commas */
+		for (pos = p1 + 1; pos < p2; pos++) {
+			switch (tokens[pos].type) {
+			case EXPR_TOKEN_OPAREN:
+				plevel++;
+				break;
+
+			case EXPR_TOKEN_CPAREN:
+				plevel--;
+				if (plevel < 0) {
+					obj->starterr = tokens[pos].start;
+					obj->enderr = tokens[pos].end;
+					return EXPR_ERROR_UNMATCHEDPAREN;
+				}
+				break;
+
+			case EXPR_TOKEN_COMMA:
+				/* Found comma */
+				if (plevel == 0)
+					num++;
+				break;
+
+			case EXPR_TOKEN_AMPERSAND:
+				/* Found reference mark */
+				if (plevel == 0) {
+					/* This may only occur after the open parenthesis or comma */
+					if (tokens[pos - 1].type == EXPR_TOKEN_OPAREN || tokens[pos - 1].type == EXPR_TOKEN_COMMA)
+						refnum++;
+					else
+						return EXPR_ERROR_SYNTAX;
+				}
+				break;
+			}
+		}
+
+		/* plevel should be zero */
+		if (plevel != 0)
+			return EXPR_ERROR_UNMATCHEDPAREN;
+	}
+
+	/* We now have the number of total arguments and
+	   number of ref arguments.  Get number of normal
+	   arguments */
+	num = num - refnum;
+
+	/* Make sure number of arguments is correct */
+	/* Here we make sure the limits are greater
+	   or equal to zero because any negative number
+	   could be used to specify no limit */
+	if (argmin >= 0 && num < argmin) {
+		obj->starterr = tokens[p1 - 1].start;
+		obj->enderr = tokens[p2].end;
+		return EXPR_ERROR_BADNUMBERARGUMENTS;
+	}
+
+	if (argmax >= 0 && num > argmax) {
+		obj->starterr = tokens[p1 - 1].start;
+		obj->enderr = tokens[p2].end;
+		return EXPR_ERROR_BADNUMBERARGUMENTS;
+	}
+
+	if (refargmin >= 0 && refnum < refargmin) {
+		obj->starterr = tokens[p1 - 1].start;
+		obj->enderr = tokens[p2].end;
+		return EXPR_ERROR_BADNUMBERARGUMENTS;
+	}
+
+	if (refargmax >= 0 && refnum > refargmax) {
+		obj->starterr = tokens[p1 - 1].start;
+		obj->enderr = tokens[p2].end;
+		return EXPR_ERROR_BADNUMBERARGUMENTS;
+	}
+
+	/* Set tmp to null in case of no arguments */
+	tmp = NULL;
+	reftmp = NULL;
+
+	if (num > 0) {
+		/* Allocate subnodes */
+		tmp = exprAllocNodes(num);
+		if (tmp == NULL)
+			return EXPR_ERROR_MEMORY;
+	}
+
+	if (refnum > 0) {
+		/* Allocate ref pointers */
+		reftmp = exprAllocMem(sizeof(EXPRTYPE *) * refnum);
+		if (reftmp == NULL) {
+			exprFreeMem(tmp);
+			return EXPR_ERROR_MEMORY;
+		}
+	}
+
+
+
+	/* Set this node's data */
+	node->type = EXPR_NODETYPE_FUNCTION;
+	node->data.function.fptr = fptr;
+	node->data.function.nodecount = num;
+	node->data.function.nodes = tmp;
+	node->data.function.refcount = refnum;
+	node->data.function.refs = reftmp;
+	node->data.function.type = type;
+
+	/* parse each subnode */
+	if (num + refnum > 0) {
+		plevel = 0;
+		cur = 0;
+		refcur = 0;
+		lv = p1 + 1;
+
+		/* look for commas if more than 1 arg */
+		if (num + refnum > 1) {
+			for (pos = p1 + 1; pos < p2; pos++) {
+				switch (tokens[pos].type) {
+				case EXPR_TOKEN_OPAREN:
+					plevel++;
+					break;
+
+				case EXPR_TOKEN_CPAREN:
+					plevel--;
+					break;		/* Already checked paren nesting above */
+
+				case EXPR_TOKEN_COMMA:
+					/* Found comma */
+					if (plevel == 0) {
+						/* parse inside */
+						if (tokens[lv].type == EXPR_TOKEN_AMPERSAND) {
+							if (lv != pos - 2) {
+								obj->starterr = tokens[lv].start;
+								obj->enderr = tokens[pos].end;
+								return EXPR_ERROR_SYNTAX;
+							}
+
+							/* It is a reference */
+							if (tokens[lv + 1].type != EXPR_TOKEN_IDENTIFIER) {
+								obj->starterr = tokens[lv].start;
+								obj->enderr = tokens[lv + 1].end;
+								return EXPR_ERROR_SYNTAX;
+							}
+
+
+							/* Make sure it is not a constant */
+							vars = exprGetConstList(obj);
+							if (vars) {
+								exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+								if (addr) {
+									obj->starterr = tokens[lv].start;
+									obj->enderr = tokens[lv + 1].start;
+									return EXPR_ERROR_REFCONSTANT;
+								}
+							}
+
+							/* Get variable list */
+							vars = exprGetVarList(obj);
+							if (vars == NULL)
+								return EXPR_ERROR_NOVARLIST;
+
+							/* Get variable address */
+							exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+							if (addr == NULL) {
+								/* Add variable to list */
+								exprValListAdd(vars, tokens[lv + 1].data.str, 0.0);
+
+								/* Try to get address again */
+								exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+								if (addr == NULL)
+									return EXPR_ERROR_MEMORY;	/* Could not add variable */
+							}
+
+							/* Set reference item */
+							reftmp[refcur] = addr;
+
+							/* increase ref arg number and lv position */
+							refcur++;
+							lv = pos + 1;
+						} else {
+							err = exprInternalParse(obj, &(tmp[cur]), tokens, lv, pos - 1);
+							if (err != EXPR_ERROR_NOERROR)
+								return err;
+
+							/* increase arg number and lv position */
+							lv = pos + 1;
+							cur++;
+						}
+					}
+					break;
+				}
+			}
+		}
+
+		/* lv should point after the last comma, or open paren. if only 1 arg */
+		if (tokens[lv].type == EXPR_TOKEN_AMPERSAND) {
+			if (lv != p2 - 2) {
+				obj->starterr = tokens[lv].start;
+				obj->enderr = tokens[p2].end;
+				return EXPR_ERROR_SYNTAX;
+			}
+
+			/* It is a reference */
+			if (tokens[lv + 1].type != EXPR_TOKEN_IDENTIFIER) {
+				obj->starterr = tokens[lv].start;
+				obj->enderr = tokens[lv + 1].end;
+				return EXPR_ERROR_SYNTAX;
+			}
+
+			/* Make sure it is not a constant */
+			vars = exprGetConstList(obj);
+			if (vars) {
+				exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+				if (addr) {
+					obj->starterr = tokens[lv].start;
+					obj->enderr = tokens[lv + 1].start;
+					return EXPR_ERROR_REFCONSTANT;
+				}
+			}
+
+			/* Get variable list */
+			vars = exprGetVarList(obj);
+			if (vars == NULL)
+				return EXPR_ERROR_NOVARLIST;
+
+			/* Get variable address */
+			exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+			if (addr == NULL) {
+				/* Add variable to list */
+				exprValListAdd(vars, tokens[lv + 1].data.str, 0.0);
+
+				/* Try to get address again */
+				exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+				if (addr == NULL)
+					return EXPR_ERROR_MEMORY;	/* Could not add variable */
+			}
+
+			/* Set reference item */
+			reftmp[refcur] = addr;
+		} else {
+			err = exprInternalParse(obj, &(tmp[cur]), tokens, lv, p2 - 1);
+			if (err != EXPR_ERROR_NOERROR)
+				return err;
+		}
+	}
 
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* Parse a variable or value */
-int exprInternalParseVarVal(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end)
-    {
-    exprValList *l;
-    EXPRTYPE *addr;
-
-
-    /* Make sure positions are correct */
-    if(start != end)
-        {
-        return EXPR_ERROR_UNKNOWN;
-        }
-    
-    
-    /* Are we an identifier */
-    if(tokens[start].type == EXPR_TOKEN_IDENTIFIER)
-        {
-        /* we are an identifier */
-
-        /* check to see if it is a constant */
-        l = exprGetConstList(obj);
-        if(l != NULL)
-            {
-            if(exprValListGetAddress(l, tokens[start].data.str, &addr) == EXPR_ERROR_NOERROR)
-                {
-                /* We found it in the constant list */
-
-                /*
-                    Treat is like a variable node so application can change
-                    constant value and it will reflect in expression
-                */
-
-                node->type = EXPR_NODETYPE_VARIABLE;
-                node->data.variable.vaddr = addr;
-                return EXPR_ERROR_NOERROR;
-                }
-            }
-
-        /* Not found in the constant list, so it must be a variable */
-
-        /* Set node type */
-        node->type = EXPR_NODETYPE_VARIABLE;
-
-        /*
-            The fast access method directly accesses the memory address
-            of the variable's value at evaluation time.  Because of this,
-            we must make sure the variable does exists in the variable list.
-        */
-
-        /* Get the variable list */
-        l = exprGetVarList(obj);
-        if(l == NULL)
-            return EXPR_ERROR_NOVARLIST;
-
-        /* Get variable address if already in the list */
-        exprValListGetAddress(l, tokens[start].data.str, &addr);
-        if(addr == NULL) /* Variable not in the list, add it */
-            {
-            exprValListAdd(l, tokens[start].data.str, 0.0);
-
-            /* Try to get address again */
-            exprValListGetAddress(l, tokens[start].data.str, &addr);
-            if(addr == NULL) /* Could not add variable */
-                return EXPR_ERROR_MEMORY; /* Could not add variable to list */
-            }
-
-        node->data.variable.vaddr = addr;
-
-        return EXPR_ERROR_NOERROR;
-        }
-    else if(tokens[start].type == EXPR_TOKEN_VALUE)
-        {
-        /* we are a value */
-        node->type = EXPR_NODETYPE_VALUE;
-        node->data.value.value = tokens[start].data.val;
-        return EXPR_ERROR_NOERROR;
-        }
-    else
-        {
-        obj->starterr = tokens[start].start;
-        obj->enderr = tokens[end].end;
-        return EXPR_ERROR_UNKNOWN;
-        }
-    }
+int exprInternalParseVarVal(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end)
+{
+	exprValList *l;
+	EXPRTYPE *addr;
+
+
+	/* Make sure positions are correct */
+	if (start != end) {
+		return EXPR_ERROR_UNKNOWN;
+	}
+
+
+	/* Are we an identifier */
+	if (tokens[start].type == EXPR_TOKEN_IDENTIFIER) {
+		/* we are an identifier */
+
+		/* check to see if it is a constant */
+		l = exprGetConstList(obj);
+		if (l != NULL) {
+			if (exprValListGetAddress(l, tokens[start].data.str, &addr) == EXPR_ERROR_NOERROR) {
+				/* We found it in the constant list */
+
+				/*
+				   Treat is like a variable node so application can change
+				   constant value and it will reflect in expression
+				 */
+
+				node->type = EXPR_NODETYPE_VARIABLE;
+				node->data.variable.vaddr = addr;
+				return EXPR_ERROR_NOERROR;
+			}
+		}
+
+		/* Not found in the constant list, so it must be a variable */
+
+		/* Set node type */
+		node->type = EXPR_NODETYPE_VARIABLE;
+
+		/*
+		   The fast access method directly accesses the memory address
+		   of the variable's value at evaluation time.  Because of this,
+		   we must make sure the variable does exists in the variable list.
+		 */
+
+		/* Get the variable list */
+		l = exprGetVarList(obj);
+		if (l == NULL)
+			return EXPR_ERROR_NOVARLIST;
+
+		/* Get variable address if already in the list */
+		exprValListGetAddress(l, tokens[start].data.str, &addr);
+		if (addr == NULL) {		/* Variable not in the list, add it */
+			exprValListAdd(l, tokens[start].data.str, 0.0);
+
+			/* Try to get address again */
+			exprValListGetAddress(l, tokens[start].data.str, &addr);
+			if (addr == NULL)	/* Could not add variable */
+				return EXPR_ERROR_MEMORY;	/* Could not add variable to list */
+		}
+
+		node->data.variable.vaddr = addr;
+
+		return EXPR_ERROR_NOERROR;
+	} else if (tokens[start].type == EXPR_TOKEN_VALUE) {
+		/* we are a value */
+		node->type = EXPR_NODETYPE_VALUE;
+		node->data.value.value = tokens[start].data.val;
+		return EXPR_ERROR_NOERROR;
+	} else {
+		obj->starterr = tokens[start].start;
+		obj->enderr = tokens[end].end;
+		return EXPR_ERROR_UNKNOWN;
+	}
+}

Modified: freeswitch/trunk/src/mod/applications/mod_expr/exprutil.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/exprutil.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/exprutil.c	Tue May 27 00:54:52 2008
@@ -15,29 +15,27 @@
 
 /* Return the version number */
 void exprGetVersion(int *major, int *minor)
-    {
-    *major = EXPR_VERSIONMAJOR;
-    *minor = EXPR_VERSIONMINOR;
-    }
+{
+	*major = EXPR_VERSIONMAJOR;
+	*minor = EXPR_VERSIONMINOR;
+}
 
 /* This utility function determines if an identifier is valid */
 int exprValidIdent(char *name)
-    {
-    if(name == NULL) /* Null string */
-        return 0;
-
-    /* First must be letter or underscore */
-    if(isalpha(*name) || *name == '_')
-        name++; /* Point to next letter */
-    else
-        return 0; /* Not letter or underscore, maybe empty*/
-
-    /* others can be letter, number, or underscore */
-    while(isalnum(*name) || *name == '_')
-        name++;
-
-    /* When the while breaks out, we should be at the end */
-    return (*name == '\0') ? 1 : 0;
-    }
-
-
+{
+	if (name == NULL)			/* Null string */
+		return 0;
+
+	/* First must be letter or underscore */
+	if (isalpha(*name) || *name == '_')
+		name++;					/* Point to next letter */
+	else
+		return 0;				/* Not letter or underscore, maybe empty */
+
+	/* others can be letter, number, or underscore */
+	while (isalnum(*name) || *name == '_')
+		name++;
+
+	/* When the while breaks out, we should be at the end */
+	return (*name == '\0') ? 1 : 0;
+}

Modified: freeswitch/trunk/src/mod/applications/mod_expr/exprval.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/exprval.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/exprval.c	Tue May 27 00:54:52 2008
@@ -15,381 +15,365 @@
 
 
 /* Internal functions */
-static exprVal *exprCreateVal(char *name, EXPRTYPE val, EXPRTYPE *addr);
-static void exprValListFreeData(exprVal *val);
-static void exprValListResetData(exprVal *val);
+static exprVal *exprCreateVal(char *name, EXPRTYPE val, EXPRTYPE * addr);
+static void exprValListFreeData(exprVal * val);
+static void exprValListResetData(exprVal * val);
 
 /* This function creates the value list, */
-int exprValListCreate(exprValList **vlist)
-    {
-    exprValList *tmp;
+int exprValListCreate(exprValList ** vlist)
+{
+	exprValList *tmp;
 
-    if(vlist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
+	if (vlist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
 
-    *vlist = NULL; /* Set to NULL initially */
+	*vlist = NULL;				/* Set to NULL initially */
 
-    tmp = exprAllocMem(sizeof(exprValList));
+	tmp = exprAllocMem(sizeof(exprValList));
 
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY; /* Could not allocate memory */
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;	/* Could not allocate memory */
 
-    /* Update pointer */
-    *vlist = tmp;
+	/* Update pointer */
+	*vlist = tmp;
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* Add a value to the list */
-int exprValListAdd(exprValList *vlist, char *name, EXPRTYPE val)
-    {
-    exprVal *tmp;
-    exprVal *cur;
-    int result;
-
-    if(vlist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    /* Make sure the name is valid */
-    if(!exprValidIdent(name))
-        return EXPR_ERROR_BADIDENTIFIER;
-
-    if(vlist->head == NULL)
-        {
-        /* Create the node right here */
-        tmp = exprCreateVal(name, val, NULL);
-
-        if(tmp == NULL)
-            return EXPR_ERROR_MEMORY;
-
-        vlist->head = tmp;
-        return EXPR_ERROR_NOERROR;
-        }
-
-    /* See if already exists */
-    cur = vlist->head;
-
-    while(cur)
-        {
-        result = strcmp(name, cur->vname);
-        
-        if(result == 0)
-            return EXPR_ERROR_ALREADYEXISTS;
-            
-        cur = cur->next;
-        }
-        
-    /* We did not find it, create it and add it to the beginning */
-    tmp = exprCreateVal(name, val, NULL);
-
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-        
-    tmp->next = vlist->head;
-    vlist->head = tmp;
-    
-    return EXPR_ERROR_NOERROR;
-    }
-    
+int exprValListAdd(exprValList * vlist, char *name, EXPRTYPE val)
+{
+	exprVal *tmp;
+	exprVal *cur;
+	int result;
+
+	if (vlist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	/* Make sure the name is valid */
+	if (!exprValidIdent(name))
+		return EXPR_ERROR_BADIDENTIFIER;
+
+	if (vlist->head == NULL) {
+		/* Create the node right here */
+		tmp = exprCreateVal(name, val, NULL);
+
+		if (tmp == NULL)
+			return EXPR_ERROR_MEMORY;
+
+		vlist->head = tmp;
+		return EXPR_ERROR_NOERROR;
+	}
+
+	/* See if already exists */
+	cur = vlist->head;
+
+	while (cur) {
+		result = strcmp(name, cur->vname);
+
+		if (result == 0)
+			return EXPR_ERROR_ALREADYEXISTS;
+
+		cur = cur->next;
+	}
+
+	/* We did not find it, create it and add it to the beginning */
+	tmp = exprCreateVal(name, val, NULL);
+
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+	tmp->next = vlist->head;
+	vlist->head = tmp;
+
+	return EXPR_ERROR_NOERROR;
+}
+
 /* Set a value in the list */
-int exprValListSet(exprValList *vlist, char *name, EXPRTYPE val)
-    {
-    exprVal *cur;
-    int result;
-
-    if(vlist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    if(name == NULL || name[0] == '\0')
-        return EXPR_ERROR_NOTFOUND;
-
-    /* Find and set it */
-    cur = vlist->head;
-
-    while(cur)
-        {
-        result = strcmp(name, cur->vname);
-        
-        if(result == 0)
-            {
-            if(cur->vptr)
-                *(cur->vptr) = val;
-            else
-                cur->vval = val;
-                
-            return EXPR_ERROR_NOERROR;                
-            }
-            
-        cur = cur->next;
-        }
-        
-    return EXPR_ERROR_NOTFOUND;
-    }    
+int exprValListSet(exprValList * vlist, char *name, EXPRTYPE val)
+{
+	exprVal *cur;
+	int result;
+
+	if (vlist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	if (name == NULL || name[0] == '\0')
+		return EXPR_ERROR_NOTFOUND;
+
+	/* Find and set it */
+	cur = vlist->head;
+
+	while (cur) {
+		result = strcmp(name, cur->vname);
+
+		if (result == 0) {
+			if (cur->vptr)
+				*(cur->vptr) = val;
+			else
+				cur->vval = val;
+
+			return EXPR_ERROR_NOERROR;
+		}
+
+		cur = cur->next;
+	}
+
+	return EXPR_ERROR_NOTFOUND;
+}
 
 /* Get the value from a list  */
-int exprValListGet(exprValList *vlist, char *name, EXPRTYPE *val)
-    {
-    exprVal *cur;
-    int result;
-
-    if(vlist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    if(name == NULL || name[0] == '\0')
-        return EXPR_ERROR_NOTFOUND;
-
-    /* Search for the item */
-    cur = vlist->head;
-
-    while(cur)
-        {
-        result = strcmp(name, cur->vname);
-
-        if(result == 0)
-            {
-            /* We found it. */
-            if(cur->vptr)
-                *val = *(cur->vptr);
-            else
-                *val = cur->vval;
-
-            /* return now */
-            return EXPR_ERROR_NOERROR;
-            }
-
-        cur = cur->next;
-        }
-
-    /* If we got here, we did not find the item in the list */
-    return EXPR_ERROR_NOTFOUND;
-    }
-    
+int exprValListGet(exprValList * vlist, char *name, EXPRTYPE * val)
+{
+	exprVal *cur;
+	int result;
+
+	if (vlist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	if (name == NULL || name[0] == '\0')
+		return EXPR_ERROR_NOTFOUND;
+
+	/* Search for the item */
+	cur = vlist->head;
+
+	while (cur) {
+		result = strcmp(name, cur->vname);
+
+		if (result == 0) {
+			/* We found it. */
+			if (cur->vptr)
+				*val = *(cur->vptr);
+			else
+				*val = cur->vval;
+
+			/* return now */
+			return EXPR_ERROR_NOERROR;
+		}
+
+		cur = cur->next;
+	}
+
+	/* If we got here, we did not find the item in the list */
+	return EXPR_ERROR_NOTFOUND;
+}
+
 /* Add an address to the list */
-int exprValListAddAddress(exprValList *vlist, char *name, EXPRTYPE *addr)
-    {
-    exprVal *tmp;
-    exprVal *cur;
-    int result;
-
-    if(vlist == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-    /* Make sure the name is valid */
-    if(!exprValidIdent(name))
-        return EXPR_ERROR_BADIDENTIFIER;
-
-    if(vlist->head == NULL)
-        {
-        /* Create the node right here */
-        tmp = exprCreateVal(name, (EXPRTYPE)0.0, addr);
-
-        if(tmp == NULL)
-            return EXPR_ERROR_MEMORY;
-
-        vlist->head = tmp;
-        return EXPR_ERROR_NOERROR;
-        }
-
-    /* See if it already exists */
-    cur = vlist->head;
-    
-    while(cur)
-        {
-        result = strcmp(name, cur->vname);
-
-        if(result == 0)
-            return EXPR_ERROR_ALREADYEXISTS;
-            
-        cur = cur->next;
-        }
-        
-    /* Add it to the list */
-    tmp = exprCreateVal(name, (EXPRTYPE)0.0, addr);
-
-    if(tmp == NULL)
-        return EXPR_ERROR_MEMORY;
-        
-    tmp->next = vlist->head;
-    vlist->head = tmp;
+int exprValListAddAddress(exprValList * vlist, char *name, EXPRTYPE * addr)
+{
+	exprVal *tmp;
+	exprVal *cur;
+	int result;
 
-    return EXPR_ERROR_NOERROR;
-    }    
+	if (vlist == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+	/* Make sure the name is valid */
+	if (!exprValidIdent(name))
+		return EXPR_ERROR_BADIDENTIFIER;
+
+	if (vlist->head == NULL) {
+		/* Create the node right here */
+		tmp = exprCreateVal(name, (EXPRTYPE) 0.0, addr);
+
+		if (tmp == NULL)
+			return EXPR_ERROR_MEMORY;
+
+		vlist->head = tmp;
+		return EXPR_ERROR_NOERROR;
+	}
+
+	/* See if it already exists */
+	cur = vlist->head;
+
+	while (cur) {
+		result = strcmp(name, cur->vname);
+
+		if (result == 0)
+			return EXPR_ERROR_ALREADYEXISTS;
+
+		cur = cur->next;
+	}
+
+	/* Add it to the list */
+	tmp = exprCreateVal(name, (EXPRTYPE) 0.0, addr);
+
+	if (tmp == NULL)
+		return EXPR_ERROR_MEMORY;
+
+	tmp->next = vlist->head;
+	vlist->head = tmp;
+
+	return EXPR_ERROR_NOERROR;
+}
 
 /* Get memory address of a variable value in a value list */
-int exprValListGetAddress(exprValList *vlist, char *name, EXPRTYPE **addr)
-    {
-    exprVal *cur;
-    int result;
-
-    /* Not found yet */
-    *addr = NULL;
-
-    if(vlist == NULL || addr == NULL)
-        return EXPR_ERROR_NULLPOINTER;
-
-
-    if(name == NULL || name[0] == '\0')
-        return EXPR_ERROR_NOTFOUND;
-
-    /* Search for the item */
-    cur = vlist->head;
-
-    while(cur)
-        {
-        result = strcmp(name, cur->vname);
-
-        if(result == 0)
-            {
-            /* We found it. */
-            if(cur->vptr)
-                *addr = cur->vptr;
-            else
-                *addr = &(cur->vval);
-
-            /* return now */
-            return EXPR_ERROR_NOERROR;
-            }
-            
-        cur = cur->next;
-        }
-
-    /* If we got here, we did not find it in the list */
-    return EXPR_ERROR_NOTFOUND;
-    }
-    
+int exprValListGetAddress(exprValList * vlist, char *name, EXPRTYPE ** addr)
+{
+	exprVal *cur;
+	int result;
+
+	/* Not found yet */
+	*addr = NULL;
+
+	if (vlist == NULL || addr == NULL)
+		return EXPR_ERROR_NULLPOINTER;
+
+
+	if (name == NULL || name[0] == '\0')
+		return EXPR_ERROR_NOTFOUND;
+
+	/* Search for the item */
+	cur = vlist->head;
+
+	while (cur) {
+		result = strcmp(name, cur->vname);
+
+		if (result == 0) {
+			/* We found it. */
+			if (cur->vptr)
+				*addr = cur->vptr;
+			else
+				*addr = &(cur->vval);
+
+			/* return now */
+			return EXPR_ERROR_NOERROR;
+		}
+
+		cur = cur->next;
+	}
+
+	/* If we got here, we did not find it in the list */
+	return EXPR_ERROR_NOTFOUND;
+}
+
 /* This function is used to enumerate the values in a value list */
-void *exprValListGetNext(exprValList *vlist, char **name, EXPRTYPE *value, EXPRTYPE** addr, void *cookie)
-    {
-    exprVal *cur;
-    
-    if(vlist == NULL)
-        return NULL;
-        
-    /* Get the current item */
-    cur = (exprVal*)cookie;
-    
-    /* Find the next item */
-    if(cur == NULL)
-        cur = vlist->head;
-    else
-        cur = cur->next;
-        
-    /* Set up the data */
-    if(cur)
-        {
-        if(name)
-            *name = cur->vname;
-           
-        if(value)
-            {
-            if(cur->vptr)
-                *value = *(cur->vptr);
-            else
-                *value = cur->vval;
-            }
-            
-        if(addr)
-            {
-            if(cur->vptr)
-                *addr = cur->vptr;
-            else
-                *addr = &(cur->vval);
-            }                                
-        }
-        
-    /* If there was no value, return NULL, otherwise, return the item */
-    return (void*)cur;
-    }
+void *exprValListGetNext(exprValList * vlist, char **name, EXPRTYPE * value, EXPRTYPE ** addr, void *cookie)
+{
+	exprVal *cur;
+
+	if (vlist == NULL)
+		return NULL;
+
+	/* Get the current item */
+	cur = (exprVal *) cookie;
+
+	/* Find the next item */
+	if (cur == NULL)
+		cur = vlist->head;
+	else
+		cur = cur->next;
+
+	/* Set up the data */
+	if (cur) {
+		if (name)
+			*name = cur->vname;
+
+		if (value) {
+			if (cur->vptr)
+				*value = *(cur->vptr);
+			else
+				*value = cur->vval;
+		}
+
+		if (addr) {
+			if (cur->vptr)
+				*addr = cur->vptr;
+			else
+				*addr = &(cur->vval);
+		}
+	}
+
+	/* If there was no value, return NULL, otherwise, return the item */
+	return (void *) cur;
+}
 
 /* This routine will free the value list */
-int exprValListFree(exprValList *vlist)
-    {
-    /* Make sure it exists, if not it is not error */
-    if(vlist == NULL)
-        return EXPR_ERROR_NOERROR;
+int exprValListFree(exprValList * vlist)
+{
+	/* Make sure it exists, if not it is not error */
+	if (vlist == NULL)
+		return EXPR_ERROR_NOERROR;
 
-    /* Free the nodes */
-    exprValListFreeData(vlist->head);
+	/* Free the nodes */
+	exprValListFreeData(vlist->head);
 
-    /* Freethe container */
-    exprFreeMem(vlist);
+	/* Freethe container */
+	exprFreeMem(vlist);
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* This routine will reset the value list to 0.0 */
-int exprValListClear(exprValList *vlist)
-    {
-    if(vlist == NULL)
-        return EXPR_ERROR_NOERROR;
+int exprValListClear(exprValList * vlist)
+{
+	if (vlist == NULL)
+		return EXPR_ERROR_NOERROR;
 
-    exprValListResetData(vlist->head);
+	exprValListResetData(vlist->head);
 
-    return EXPR_ERROR_NOERROR;
-    }
+	return EXPR_ERROR_NOERROR;
+}
 
 /* This routine will free any child nodes, and then free itself */
-static void exprValListFreeData(exprVal *val)
-    {
-    exprVal *next;
-    
-    while(val)
-        {
-        /* Remember the next */
-        next = val->next;
-        
-        /* Free name */
-        exprFreeMem(val->vname);
-
-        /* Free ourself */
-        exprFreeMem(val);
-        
-        val = next;
-        }
-    }
+static void exprValListFreeData(exprVal * val)
+{
+	exprVal *next;
+
+	while (val) {
+		/* Remember the next */
+		next = val->next;
+
+		/* Free name */
+		exprFreeMem(val->vname);
+
+		/* Free ourself */
+		exprFreeMem(val);
+
+		val = next;
+	}
+}
 
 /* This routine will reset variables to 0.0 */
-static void exprValListResetData(exprVal *val)
-    {
-    while(val)
-        {
-        /* Reset data */
-        if(val->vptr)
-            *(val->vptr) = 0.0;
-      
-        val->vval = 0.0;
-        
-        val = val->next;
-        }
-    }
+static void exprValListResetData(exprVal * val)
+{
+	while (val) {
+		/* Reset data */
+		if (val->vptr)
+			*(val->vptr) = 0.0;
+
+		val->vval = 0.0;
+
+		val = val->next;
+	}
+}
 
 /* This routine will create the value object */
-static exprVal *exprCreateVal(char *name, EXPRTYPE val, EXPRTYPE *addr)
-    {
-    exprVal *tmp;
-    char *vtmp;
-
-    /* Name already tested in exprValListAdd */
-
-    /* Create it */
-    tmp = exprAllocMem(sizeof(exprVal));
-    if(tmp == NULL)
-        return NULL;
-
-    /* Allocate space for the name */
-    vtmp = exprAllocMem(strlen(name) + 1);
-
-    if(vtmp == NULL)
-        {
-        exprFreeMem(tmp);
-        return NULL;
-        }
-
-    /* Copy the data over */
-    strcpy(vtmp, name);
-    tmp->vname = vtmp;
-    tmp->vval = val;
-    tmp->vptr = addr;
+static exprVal *exprCreateVal(char *name, EXPRTYPE val, EXPRTYPE * addr)
+{
+	exprVal *tmp;
+	char *vtmp;
+
+	/* Name already tested in exprValListAdd */
+
+	/* Create it */
+	tmp = exprAllocMem(sizeof(exprVal));
+	if (tmp == NULL)
+		return NULL;
+
+	/* Allocate space for the name */
+	vtmp = exprAllocMem(strlen(name) + 1);
+
+	if (vtmp == NULL) {
+		exprFreeMem(tmp);
+		return NULL;
+	}
+
+	/* Copy the data over */
+	strcpy(vtmp, name);
+	tmp->vname = vtmp;
+	tmp->vval = val;
+	tmp->vptr = addr;
 
-    return tmp;
-    }
+	return tmp;
+}

Modified: freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c	Tue May 27 00:54:52 2008
@@ -33,145 +33,145 @@
 
 /* Breaker function to break out of long expression functions
    such as the 'for' function */
-int breaker(exprObj *o)
+int breaker(exprObj * o)
 {
-    /* Return nonzero to break out */
-    return -1;
+	/* Return nonzero to break out */
+	return -1;
 }
 
 
 SWITCH_STANDARD_API(expr_function)
 {
-    exprObj *e = NULL;
-    exprFuncList *f = NULL;
-    exprValList *v = NULL;
-    exprValList *c = NULL;
-    EXPRTYPE last_expr;
+	exprObj *e = NULL;
+	exprFuncList *f = NULL;
+	exprValList *v = NULL;
+	exprValList *c = NULL;
+	EXPRTYPE last_expr;
 	const char *expr;
 	int err;
-    char val[512] = "", *p;
-    char *m_cmd = NULL;
-    size_t len;
-
-    if (switch_strlen_zero(cmd)) {
-        goto error;
-    }
-
-    len = strlen(cmd) + 3;
-
-
-    m_cmd = malloc(len);
-    switch_assert(m_cmd);
-    switch_copy_string(m_cmd, cmd, len);
-    
-    for (p = m_cmd; p && *p; p++) {
-        if (*p == '|') {
-            *p = ';';
-        }
-    }
-
-    p = m_cmd + (strlen(m_cmd) - 1);
-    if (*p != ';') {
-        p++;
-        *p = ';';
-        p++;
-        *p = '\0';
-    }
-
-    expr = m_cmd;
-
-    /* Create function list */
-    err = exprFuncListCreate(&f);
-    if (err != EXPR_ERROR_NOERROR)
-        goto error;
-
-    /* Init function list with internal functions */
-    err = exprFuncListInit(f);
-    if (err != EXPR_ERROR_NOERROR)
-        goto error;
-
-    /* Add custom function */
-    //err = exprFuncListAdd(f, my_func, "myfunc", 1, 1, 1, 1);
-    //if (err != EXPR_ERROR_NOERROR)
+	char val[512] = "", *p;
+	char *m_cmd = NULL;
+	size_t len;
+
+	if (switch_strlen_zero(cmd)) {
+		goto error;
+	}
+
+	len = strlen(cmd) + 3;
+
+
+	m_cmd = malloc(len);
+	switch_assert(m_cmd);
+	switch_copy_string(m_cmd, cmd, len);
+
+	for (p = m_cmd; p && *p; p++) {
+		if (*p == '|') {
+			*p = ';';
+		}
+	}
+
+	p = m_cmd + (strlen(m_cmd) - 1);
+	if (*p != ';') {
+		p++;
+		*p = ';';
+		p++;
+		*p = '\0';
+	}
+
+	expr = m_cmd;
+
+	/* Create function list */
+	err = exprFuncListCreate(&f);
+	if (err != EXPR_ERROR_NOERROR)
+		goto error;
+
+	/* Init function list with internal functions */
+	err = exprFuncListInit(f);
+	if (err != EXPR_ERROR_NOERROR)
+		goto error;
+
+	/* Add custom function */
+	//err = exprFuncListAdd(f, my_func, "myfunc", 1, 1, 1, 1);
+	//if (err != EXPR_ERROR_NOERROR)
 	//goto error;
 
-    /* Create constant list */
-    err = exprValListCreate(&c);
-    if (err != EXPR_ERROR_NOERROR)
-        goto error;
-
-    /* Init constant list with internal constants */
-    err = exprValListInit(c);
-    if (err != EXPR_ERROR_NOERROR)
-        goto error;
-
-    /* Create variable list */
-    err = exprValListCreate(&v);
-    if (err != EXPR_ERROR_NOERROR)
-        goto error;
-
-    /* Create expression object */
-    err = exprCreate(&e, f, v, c, breaker, NULL);
-    if (err != EXPR_ERROR_NOERROR)
-        goto error;
-
-    /* Parse expression */
-    err = exprParse(e, (char *)expr);
-
-    if (err != EXPR_ERROR_NOERROR)
-        goto error;
-
-    /* Enable soft errors */
-    //exprSetSoftErrors(e, 1);
-    
+	/* Create constant list */
+	err = exprValListCreate(&c);
+	if (err != EXPR_ERROR_NOERROR)
+		goto error;
+
+	/* Init constant list with internal constants */
+	err = exprValListInit(c);
+	if (err != EXPR_ERROR_NOERROR)
+		goto error;
+
+	/* Create variable list */
+	err = exprValListCreate(&v);
+	if (err != EXPR_ERROR_NOERROR)
+		goto error;
+
+	/* Create expression object */
+	err = exprCreate(&e, f, v, c, breaker, NULL);
+	if (err != EXPR_ERROR_NOERROR)
+		goto error;
+
+	/* Parse expression */
+	err = exprParse(e, (char *) expr);
+
+	if (err != EXPR_ERROR_NOERROR)
+		goto error;
+
+	/* Enable soft errors */
+	//exprSetSoftErrors(e, 1);
+
 	do {
 		err = exprEval(e, &last_expr);
 	} while (err);
 
-    switch_snprintf(val, sizeof(val), "%0.10f", last_expr);
-    for (p = (val + strlen(val) - 1); p != val; p--) {
-        if (*p != '0') {
-            *(p+1) = '\0';
-            break;
-        } 
-    }
+	switch_snprintf(val, sizeof(val), "%0.10f", last_expr);
+	for (p = (val + strlen(val) - 1); p != val; p--) {
+		if (*p != '0') {
+			*(p + 1) = '\0';
+			break;
+		}
+	}
 
-    p = val + strlen(val) - 1;
-    if (*p == '.') {
-        *p = '\0';
-    }
+	p = val + strlen(val) - 1;
+	if (*p == '.') {
+		*p = '\0';
+	}
 
-    stream->write_function(stream, "%s", val);
+	stream->write_function(stream, "%s", val);
 
 
-    goto done;
+	goto done;
 
- error:
-    /* Alert user of error */
-    stream->write_function(stream, "!err!");
+  error:
+	/* Alert user of error */
+	stream->write_function(stream, "!err!");
 
 
- done:
-    /* Do cleanup */
-    if (e) {
-        exprFree(e); 
-    }
+  done:
+	/* Do cleanup */
+	if (e) {
+		exprFree(e);
+	}
 
-    if (f) {
-        exprFuncListFree(f);
-    }
+	if (f) {
+		exprFuncListFree(f);
+	}
 
-    if (v) {
-        exprValListFree(v);
-    }
+	if (v) {
+		exprValListFree(v);
+	}
 
-    if (c) {
-        exprValListFree(c);
-    }
+	if (c) {
+		exprValListFree(c);
+	}
 
-    switch_safe_free(m_cmd);
+	switch_safe_free(m_cmd);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 
@@ -181,10 +181,10 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_expr_load)
 {
 	switch_api_interface_t *commands_api_interface;
-    
+
 	/* connect my internal structure to the blank pointer passed to me */
-    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-    
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
 	SWITCH_ADD_API(commands_api_interface, "expr", "Eval an expession", expr_function, "<expr>");
 
 

Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	Tue May 27 00:54:52 2008
@@ -39,13 +39,13 @@
 #define MAX_PRI 10
 
 struct fifo_node {
-    char *name;
-    switch_mutex_t *mutex;
-    switch_queue_t *fifo_list[MAX_PRI];
-    switch_hash_t *caller_hash;
-    switch_hash_t *consumer_hash;
-    int caller_count;
-    int consumer_count;
+	char *name;
+	switch_mutex_t *mutex;
+	switch_queue_t *fifo_list[MAX_PRI];
+	switch_hash_t *caller_hash;
+	switch_hash_t *consumer_hash;
+	int caller_count;
+	int consumer_count;
 	switch_time_t start_waiting;
 	uint32_t importance;
 };
@@ -57,12 +57,12 @@
 
 static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
 {
-    switch_core_session_t *bleg = (switch_core_session_t *) buf;
+	switch_core_session_t *bleg = (switch_core_session_t *) buf;
 
 	switch (itype) {
 	case SWITCH_INPUT_TYPE_DTMF:
-        {
-            switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+		{
+			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
 			switch_channel_t *bchan = switch_core_session_get_channel(bleg);
 			switch_channel_t *channel = switch_core_session_get_channel(session);
 			if (switch_channel_test_flag(switch_core_session_get_channel(session), CF_ORIGINATOR)) {
@@ -71,11 +71,11 @@
 					return SWITCH_STATUS_BREAK;
 				} else if (dtmf->digit == '0') {
 					const char *moh_a = NULL, *moh_b = NULL;
-					
+
 					if (!(moh_b = switch_channel_get_variable(bchan, "fifo_music"))) {
 						moh_b = switch_channel_get_variable(bchan, "hold_music");
 					}
-					
+
 					if (!(moh_a = switch_channel_get_variable(channel, "fifo_hold_music"))) {
 						if (!(moh_a = switch_channel_get_variable(channel, "fifo_music"))) {
 							moh_a = switch_channel_get_variable(channel, "hold_music");
@@ -86,7 +86,7 @@
 					return SWITCH_STATUS_IGNORE;
 				}
 			}
-        }
+		}
 		break;
 	default:
 		break;
@@ -101,17 +101,17 @@
 
 	switch (itype) {
 	case SWITCH_INPUT_TYPE_DTMF:
-        {
-            switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+		{
+			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
 			switch_channel_t *channel = switch_core_session_get_channel(session);
 			const char *caller_exit_key = switch_channel_get_variable(channel, "fifo_caller_exit_key");
-			
-            if (caller_exit_key && dtmf->digit == *caller_exit_key) {
+
+			if (caller_exit_key && dtmf->digit == *caller_exit_key) {
 				char *bp = buf;
 				*bp = dtmf->digit;
 				return SWITCH_STATUS_BREAK;
-            }
-        }
+			}
+		}
 		break;
 	default:
 		break;
@@ -125,7 +125,7 @@
 static int node_consumer_wait_count(fifo_node_t *node)
 {
 	int i, len = 0;
-	
+
 	for (i = 0; i < MAX_PRI; i++) {
 		len += switch_queue_size(node->fifo_list[i]);
 	}
@@ -142,9 +142,9 @@
 		if (!(len = switch_queue_size(node->fifo_list[i]))) {
 			continue;
 		}
-		while(len) {
+		while (len) {
 			if (switch_queue_trypop(node->fifo_list[i], &pop) == SWITCH_STATUS_SUCCESS && pop) {
-				if (!done && !strcmp((char *)pop, uuid)) {
+				if (!done && !strcmp((char *) pop, uuid)) {
 					free(pop);
 					done++;
 				} else {
@@ -181,7 +181,7 @@
 static switch_status_t caller_read_frame_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
 {
 	fifo_chime_data_t *cd = (fifo_chime_data_t *) user_data;
-	
+
 	if (!cd) {
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -220,8 +220,8 @@
 {
 	fifo_node_t *node, **node_list = (fifo_node_t **) user_data;
 	int x = 0, total = 0, i = 0;
-	
-	for(i = 0; ; i++) {
+
+	for (i = 0;; i++) {
 		if (!(node = node_list[i])) {
 			break;
 		}
@@ -230,74 +230,74 @@
 		}
 	}
 
-    if (total) {
-        return SWITCH_STATUS_FALSE;
-    }
+	if (total) {
+		return SWITCH_STATUS_FALSE;
+	}
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static struct {
-    switch_hash_t *fifo_hash;
-    switch_mutex_t *mutex;
-    switch_memory_pool_t *pool;
-    int running;
+	switch_hash_t *fifo_hash;
+	switch_mutex_t *mutex;
+	switch_memory_pool_t *pool;
+	int running;
 } globals;
 
 
 static fifo_node_t *create_node(const char *name, uint32_t importance)
 {
-    fifo_node_t *node;
+	fifo_node_t *node;
 	int x = 0;
-	
-    if (!globals.running) {
-        return NULL;
-    }
 
-    node = switch_core_alloc(globals.pool, sizeof(*node));
-    node->name = switch_core_strdup(globals.pool, name);
+	if (!globals.running) {
+		return NULL;
+	}
+
+	node = switch_core_alloc(globals.pool, sizeof(*node));
+	node->name = switch_core_strdup(globals.pool, name);
 	for (x = 0; x < MAX_PRI; x++) {
 		switch_queue_create(&node->fifo_list[x], SWITCH_CORE_QUEUE_LEN, globals.pool);
 		switch_assert(node->fifo_list[x]);
 	}
-    switch_core_hash_init(&node->caller_hash, globals.pool);
-    switch_core_hash_init(&node->consumer_hash, globals.pool);
-	
-    switch_mutex_init(&node->mutex, SWITCH_MUTEX_NESTED, globals.pool);
-    switch_core_hash_insert(globals.fifo_hash, name, node);
+	switch_core_hash_init(&node->caller_hash, globals.pool);
+	switch_core_hash_init(&node->consumer_hash, globals.pool);
+
+	switch_mutex_init(&node->mutex, SWITCH_MUTEX_NESTED, globals.pool);
+	switch_core_hash_insert(globals.fifo_hash, name, node);
 
 	node->importance = importance;
 
-    return node;
+	return node;
 }
 
 static void send_presence(fifo_node_t *node)
 {
-    switch_event_t *event;
+	switch_event_t *event;
 	int wait_count = 0;
 
-    if (!globals.running) {
-        return;
-    }
+	if (!globals.running) {
+		return;
+	}
 
 	if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%s", "park");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", node->name);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", node->name);
-        if ((wait_count = node_consumer_wait_count(node)) > 0) {
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d waiting)", wait_count);
-        } else {
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle");
-        }
-        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", "unknown");
+		if ((wait_count = node_consumer_wait_count(node)) > 0) {
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d waiting)", wait_count);
+		} else {
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle");
+		}
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", "unknown");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", 0);
 
-        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-state", "%s", wait_count > 0 ? "CS_ROUTING" : "CS_HANGUP");
-        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "unique-id", "%s", node->name);
-        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "answer-state", "%s", wait_count > 0 ? "early" : "terminated");
-        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-direction", "%s", "inbound");
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-state", "%s", wait_count > 0 ? "CS_ROUTING" : "CS_HANGUP");
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "unique-id", "%s", node->name);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "answer-state", "%s", wait_count > 0 ? "early" : "terminated");
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-direction", "%s", "inbound");
 		switch_event_fire(&event);
 	}
 }
@@ -307,29 +307,29 @@
 {
 	char *to = switch_event_get_header(event, "to");
 	char *dup_to = NULL, *node_name;
-    fifo_node_t *node;
+	fifo_node_t *node;
+
+	if (!globals.running) {
+		return;
+	}
 
-    if (!globals.running) {
-        return;
-    }
-    
 	if (!to || strncasecmp(to, "park+", 5)) {
 		return;
 	}
 
 	dup_to = strdup(to);
-    switch_assert(dup_to);
+	switch_assert(dup_to);
 
 	node_name = dup_to + 5;
 
-    switch_mutex_lock(globals.mutex);
-    if (!(node = switch_core_hash_find(globals.fifo_hash, node_name))) {
-        node = create_node(node_name, 0);
-    }
+	switch_mutex_lock(globals.mutex);
+	if (!(node = switch_core_hash_find(globals.fifo_hash, node_name))) {
+		node = create_node(node_name, 0);
+	}
 
-    send_presence(node);
+	send_presence(node);
 
-    switch_mutex_unlock(globals.mutex);
+	switch_mutex_unlock(globals.mutex);
 
 	switch_safe_free(dup_to);
 }
@@ -344,18 +344,18 @@
 #define FIFO_USAGE "<fifo name> [in [<announce file>|undef] [<music file>|undef] | out [wait|nowait] [<announce file>|undef] [<music file>|undef]]"
 SWITCH_STANDARD_APP(fifo_function)
 {
-    int argc;
-    char *mydata = NULL, *argv[5] = { 0 };
-    fifo_node_t *node = NULL, *node_list[MAX_NODES_PER_CONSUMER+1] = { 0 };
-    switch_channel_t *channel = switch_core_session_get_channel(session);
-    int do_wait = 1, node_count = 0, i = 0;
-    const char *moh = NULL;
-    const char *announce = NULL;
-    switch_event_t *event = NULL;
-    char date[80] = "";
-    switch_time_exp_t tm;
-    switch_time_t ts = switch_timestamp_now();
-    switch_size_t retsize;
+	int argc;
+	char *mydata = NULL, *argv[5] = { 0 };
+	fifo_node_t *node = NULL, *node_list[MAX_NODES_PER_CONSUMER + 1] = { 0 };
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	int do_wait = 1, node_count = 0, i = 0;
+	const char *moh = NULL;
+	const char *announce = NULL;
+	switch_event_t *event = NULL;
+	char date[80] = "";
+	switch_time_exp_t tm;
+	switch_time_t ts = switch_timestamp_now();
+	switch_size_t retsize;
 	char *list_string;
 	int nlist_count;
 	char *nlist[MAX_NODES_PER_CONSUMER];
@@ -364,51 +364,51 @@
 	const char *arg_inout = NULL;
 	const char *serviced_uuid = NULL;
 
-    if (!globals.running) {
-        return;
-    }
+	if (!globals.running) {
+		return;
+	}
 
 	if (switch_strlen_zero(data)) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Args\n");
-        return;
-    }
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Args\n");
+		return;
+	}
 
-    mydata = switch_core_session_strdup(session, data);
-    switch_assert(mydata);
+	mydata = switch_core_session_strdup(session, data);
+	switch_assert(mydata);
 
 	argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 	arg_fifo_name = argv[0];
 	arg_inout = argv[1];
-	
-    if (!(arg_fifo_name && arg_inout)) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
-        return;
-    }
+
+	if (!(arg_fifo_name && arg_inout)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
+		return;
+	}
 
 	if (!strcasecmp(arg_inout, "out")) {
 		consumer = 1;
 	} else if (strcasecmp(arg_inout, "in")) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
-        return;
+		return;
 	}
 
 	list_string = switch_core_session_strdup(session, arg_fifo_name);
 
-    if (!(nlist_count = switch_separate_string(list_string, ',', nlist, (sizeof(nlist) / sizeof(nlist[0]))))) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
-        return;
+	if (!(nlist_count = switch_separate_string(list_string, ',', nlist, (sizeof(nlist) / sizeof(nlist[0]))))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
+		return;
 	}
 
 	if (!consumer && nlist_count > 1) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
-        return;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
+		return;
 	}
 
 	switch_mutex_lock(globals.mutex);
-	for(i = 0; i < nlist_count; i++) {
+	for (i = 0; i < nlist_count; i++) {
 		int importance = 0;
 		char *p;
-		
+
 		if ((p = strrchr(nlist[i], '!'))) {
 			*p++ = '\0';
 			importance = atoi(p);
@@ -422,37 +422,37 @@
 		}
 		node_list[node_count++] = node;
 	}
-    switch_mutex_unlock(globals.mutex);
+	switch_mutex_unlock(globals.mutex);
 
 	moh = switch_channel_get_variable(channel, "fifo_music");
-    announce = switch_channel_get_variable(channel, "fifo_announce");
+	announce = switch_channel_get_variable(channel, "fifo_announce");
 
 	if (consumer) {
 		if (argc > 3) {
-            announce = argv[3];
-        }
+			announce = argv[3];
+		}
 
-        if (argc > 4) {
-            moh = argv[4];
-        }
+		if (argc > 4) {
+			moh = argv[4];
+		}
 
 	} else {
 		if (argc > 2) {
-            announce = argv[2];
-        }
+			announce = argv[2];
+		}
 
-        if (argc > 3) {
-            moh = argv[3];
-        }
+		if (argc > 3) {
+			moh = argv[3];
+		}
 	}
 
 	check_string(announce);
 	check_string(moh);
 
-    if (!consumer && node) {
-        switch_core_session_t *other_session;
+	if (!consumer && node) {
+		switch_core_session_t *other_session;
 		switch_channel_t *other_channel;
-        const char *uuid = switch_core_session_get_uuid(session);
+		const char *uuid = switch_core_session_get_uuid(session);
 		const char *pri;
 		char tmp[25] = "";
 		int p = 0;
@@ -479,8 +479,8 @@
 				cd.orbit_timeout = switch_timestamp(NULL) + to;
 			}
 		}
-		
-		
+
+
 		if (chime_freq) {
 			ftmp = atoi(chime_freq);
 			if (ftmp > 0) {
@@ -490,50 +490,50 @@
 
 
 
-        switch_channel_answer(channel);
+		switch_channel_answer(channel);
+
+		switch_mutex_lock(node->mutex);
+		node->caller_count++;
 
-        switch_mutex_lock(node->mutex);
-        node->caller_count++;
+		switch_core_hash_insert(node->caller_hash, uuid, session);
 
-        switch_core_hash_insert(node->caller_hash, uuid, session);
-		
 
-        if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) {
+		if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) {
 			p = atoi(pri);
 		}
 
 		if (p >= MAX_PRI) {
 			p = MAX_PRI - 1;
 		}
-		
+
 		if (!node_consumer_wait_count(node)) {
 			node->start_waiting = switch_timestamp_now();
 		}
-		
-        switch_queue_push(node->fifo_list[p], (void *)strdup(uuid));
+
+		switch_queue_push(node->fifo_list[p], (void *) strdup(uuid));
 
 		if (!pri) {
 			switch_snprintf(tmp, sizeof(tmp), "%d", p);
 			switch_channel_set_variable(channel, "fifo_priority", tmp);
 		}
 
-        switch_mutex_unlock(node->mutex);
-		
-        ts = switch_timestamp_now();
-        switch_time_exp_lt(&tm, ts);
-        switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
-        switch_channel_set_variable(channel, "fifo_status", "WAITING");
-        switch_channel_set_variable(channel, "fifo_timestamp", date);
-        
+		switch_mutex_unlock(node->mutex);
+
+		ts = switch_timestamp_now();
+		switch_time_exp_lt(&tm, ts);
+		switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+		switch_channel_set_variable(channel, "fifo_status", "WAITING");
+		switch_channel_set_variable(channel, "fifo_timestamp", date);
+
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
 			switch_channel_event_set_data(channel, event);
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "push");
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Slot", "%d", p);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "push");
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Slot", "%d", p);
 			switch_event_fire(&event);
 		}
-		
-        switch_channel_set_flag(channel, CF_TAGGED);
+
+		switch_channel_set_flag(channel, CF_TAGGED);
 
 		if (chime_list) {
 			char *list_dup = switch_core_session_strdup(session, chime_list);
@@ -542,12 +542,12 @@
 			cd.next = switch_timestamp(NULL) + cd.freq;
 		}
 
-        send_presence(node);
+		send_presence(node);
 
-		while(switch_channel_ready(channel)) {
+		while (switch_channel_ready(channel)) {
 			switch_input_args_t args = { 0 };
 			char buf[25] = "";
-			
+
 			args.input_callback = moh_on_dtmf;
 			args.buf = buf;
 			args.buflen = sizeof(buf);
@@ -559,7 +559,7 @@
 
 			if (cd.abort || cd.do_orbit) {
 				aborted = 1;
-                goto abort;
+				goto abort;
 			}
 
 			if ((serviced_uuid = switch_channel_get_variable(channel, "fifo_serviced_uuid"))) {
@@ -577,7 +577,7 @@
 			} else {
 				switch_ivr_collect_digits_callback(session, &args, 0);
 			}
-			
+
 			if (caller_exit_key && *buf == *caller_exit_key) {
 				aborted = 1;
 				goto abort;
@@ -596,59 +596,59 @@
 				switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 			}
 		}
-		
+
 		switch_core_session_flush_private_events(session);
 
 		if (switch_channel_ready(channel)) {
-            if (announce) {
-                switch_ivr_play_file(session, NULL, announce, NULL);
-            }
-        }
-
-        switch_channel_clear_flag(channel, CF_TAGGED);
-		
-	abort:
-		
-        if (!aborted && switch_channel_ready(channel)) {
-            switch_channel_set_state(channel, CS_HIBERNATE);            
-        } else {
-            ts = switch_timestamp_now();
-            switch_time_exp_lt(&tm, ts);
-            switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
-            switch_channel_set_variable(channel, "fifo_status", cd.do_orbit ? "TIMEOUT" : "ABORTED");
-            switch_channel_set_variable(channel, "fifo_timestamp", date);
-            
-            if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
-                switch_channel_event_set_data(channel, event);
-                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
-                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", cd.do_orbit ? "timeout" : "abort");
-                switch_event_fire(&event);
-            }
-            switch_mutex_lock(node->mutex);
+			if (announce) {
+				switch_ivr_play_file(session, NULL, announce, NULL);
+			}
+		}
+
+		switch_channel_clear_flag(channel, CF_TAGGED);
+
+	  abort:
+
+		if (!aborted && switch_channel_ready(channel)) {
+			switch_channel_set_state(channel, CS_HIBERNATE);
+		} else {
+			ts = switch_timestamp_now();
+			switch_time_exp_lt(&tm, ts);
+			switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+			switch_channel_set_variable(channel, "fifo_status", cd.do_orbit ? "TIMEOUT" : "ABORTED");
+			switch_channel_set_variable(channel, "fifo_timestamp", date);
+
+			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
+				switch_channel_event_set_data(channel, event);
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", cd.do_orbit ? "timeout" : "abort");
+				switch_event_fire(&event);
+			}
+			switch_mutex_lock(node->mutex);
 			node_remove_uuid(node, uuid);
-            node->caller_count--;
-            switch_core_hash_delete(node->caller_hash, uuid);
-            switch_mutex_unlock(node->mutex);
-            send_presence(node);
-			
-        }
-        
+			node->caller_count--;
+			switch_core_hash_delete(node->caller_hash, uuid);
+			switch_mutex_unlock(node->mutex);
+			send_presence(node);
+
+		}
+
 		if (cd.do_orbit && cd.orbit_exten) {
-            if (orbit_ann) {
-                switch_ivr_play_file(session, NULL, orbit_ann, NULL);
-            }
+			if (orbit_ann) {
+				switch_ivr_play_file(session, NULL, orbit_ann, NULL);
+			}
 			switch_ivr_session_transfer(session, cd.orbit_exten, NULL, NULL);
 		}
 
-        return;
-    } else { /* consumer */
-        void *pop = NULL;
-        switch_frame_t *read_frame;
-        switch_status_t status;
-        char *uuid;
-        int done = 0;
-        switch_core_session_t *other_session;
-        switch_input_args_t args = { 0 };
+		return;
+	} else {					/* consumer */
+		void *pop = NULL;
+		switch_frame_t *read_frame;
+		switch_status_t status;
+		char *uuid;
+		int done = 0;
+		switch_core_session_t *other_session;
+		switch_input_args_t args = { 0 };
 		const char *pop_order = NULL;
 		int custom_pop = 0;
 		int pop_array[MAX_PRI] = { 0 };
@@ -660,7 +660,7 @@
 		const char *strat_str = switch_channel_get_variable(channel, "fifo_strategy");
 		fifo_strategy_t strat = STRAT_WAITING_LONGER;
 
-		
+
 		if (!switch_strlen_zero(strat_str)) {
 			if (!strcasecmp(strat_str, "more_ppl")) {
 				strat = STRAT_MORE_PPL;
@@ -687,8 +687,8 @@
 			my_id = switch_core_session_get_uuid(session);
 		}
 
-        
-        if (do_wait) {
+
+		if (do_wait) {
 			for (i = 0; i < node_count; i++) {
 				if (!(node = node_list[i])) {
 					continue;
@@ -698,28 +698,28 @@
 				switch_core_hash_insert(node->consumer_hash, switch_core_session_get_uuid(session), session);
 				switch_mutex_unlock(node->mutex);
 			}
-            switch_channel_answer(channel);
-        }
-		
+			switch_channel_answer(channel);
+		}
+
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
-            switch_channel_event_set_data(channel, event);
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_start");
-            switch_event_fire(&event);
-        }
-
-        ts = switch_timestamp_now();
-        switch_time_exp_lt(&tm, ts);
-        switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
-        switch_channel_set_variable(channel, "fifo_status", "WAITING");
-        switch_channel_set_variable(channel, "fifo_timestamp", date);
+			switch_channel_event_set_data(channel, event);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_start");
+			switch_event_fire(&event);
+		}
+
+		ts = switch_timestamp_now();
+		switch_time_exp_lt(&tm, ts);
+		switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+		switch_channel_set_variable(channel, "fifo_status", "WAITING");
+		switch_channel_set_variable(channel, "fifo_timestamp", date);
 
-        if ((pop_order = switch_channel_get_variable(channel, "fifo_pop_order"))) {
+		if ((pop_order = switch_channel_get_variable(channel, "fifo_pop_order"))) {
 			char *tmp = switch_core_session_strdup(session, pop_order);
 			int x;
 			custom_pop = switch_separate_string(tmp, ',', pop_list, (sizeof(pop_list) / sizeof(pop_list[0])));
 			if (custom_pop >= MAX_PRI) {
-				custom_pop = MAX_PRI -1;
+				custom_pop = MAX_PRI - 1;
 			}
 
 			for (x = 0; x < custom_pop; x++) {
@@ -731,33 +731,33 @@
 				}
 			}
 		}
-		
-		while(switch_channel_ready(channel)) {
+
+		while (switch_channel_ready(channel)) {
 			int x = 0, winner = -1;
 			switch_time_t longest = 0xFFFFFFFFFFFFFFFF / 2;
 			uint32_t importance = 0, waiting = 0, most_waiting = 0;
-			
+
 			pop = NULL;
-			
-            if (moh && do_wait) {
+
+			if (moh && do_wait) {
 				switch_status_t moh_status = switch_ivr_play_file(session, NULL, moh, &args);
 				memset(&args, 0, sizeof(args));
-                args.read_frame_callback = consumer_read_frame_callback;
-                args.user_data = node_list;
-                switch_ivr_play_file(session, NULL, moh, &args);
-				
+				args.read_frame_callback = consumer_read_frame_callback;
+				args.user_data = node_list;
+				switch_ivr_play_file(session, NULL, moh, &args);
+
 				if (!SWITCH_READ_ACCEPTABLE(moh_status)) {
 					break;
 				}
-            }
-			
-			for(i = 0; i < node_count; i++) {
+			}
+
+			for (i = 0; i < node_count; i++) {
 				if (!(node = node_list[i])) {
 					continue;
 				}
-				
+
 				if ((waiting = node_consumer_wait_count(node))) {
-					
+
 					if (!importance || node->importance > importance) {
 						if (strat == STRAT_WAITING_LONGER) {
 							if (node->start_waiting < longest) {
@@ -771,14 +771,14 @@
 							}
 						}
 					}
-					
+
 					if (node->importance > importance) {
 						importance = node->importance;
 					}
 				}
 
 			}
-			
+
 			if (winner > -1) {
 				node = node_list[winner];
 			} else {
@@ -787,76 +787,76 @@
 
 			if (node) {
 				if (custom_pop) {
-					for(x = 0; x < MAX_PRI; x++) {
+					for (x = 0; x < MAX_PRI; x++) {
 						if (switch_queue_trypop(node->fifo_list[pop_array[x]], &pop) == SWITCH_STATUS_SUCCESS && pop) {
 							break;
 						}
 					}
 				} else {
-					for(x = 0; x < MAX_PRI; x++) {
+					for (x = 0; x < MAX_PRI; x++) {
 						if (switch_queue_trypop(node->fifo_list[x], &pop) == SWITCH_STATUS_SUCCESS && pop) {
 							break;
 						}
 					}
 				}
-			
+
 				if (pop && !node_consumer_wait_count(node)) {
 					switch_mutex_lock(node->mutex);
 					node->start_waiting = 0;
 					switch_mutex_unlock(node->mutex);
 				}
 			}
-			
+
 
 			if (!pop) {
-                if (!do_wait) {
-                    break;
-                }
-
-                status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
-                if (!SWITCH_READ_ACCEPTABLE(status)) {
-                    break;
-                }
-
-                continue;
-            }
-			
-            uuid = (char *) pop;
+				if (!do_wait) {
+					break;
+				}
+
+				status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+
+				if (!SWITCH_READ_ACCEPTABLE(status)) {
+					break;
+				}
+
+				continue;
+			}
+
+			uuid = (char *) pop;
 			pop = NULL;
 
-            if (node && (other_session = switch_core_session_locate(uuid))) {
-                switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
-                switch_caller_profile_t *cloned_profile;
+			if (node && (other_session = switch_core_session_locate(uuid))) {
+				switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+				switch_caller_profile_t *cloned_profile;
 				const char *o_announce = NULL;
 				const char *record_template = switch_channel_get_variable(channel, "fifo_record_template");
 				char *expanded = NULL;
-				
+
 				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
-                    switch_channel_event_set_data(other_channel, event);
-                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
-                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "caller_pop");
-                    switch_event_fire(&event);
-                }
-
-                if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
-                    switch_channel_event_set_data(channel, event);
-                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
-                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_pop");
-                    switch_event_fire(&event);
-                }
+					switch_channel_event_set_data(other_channel, event);
+					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "caller_pop");
+					switch_event_fire(&event);
+				}
+
+				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
+					switch_channel_event_set_data(channel, event);
+					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_pop");
+					switch_event_fire(&event);
+				}
 
 				if ((o_announce = switch_channel_get_variable(other_channel, "fifo_override_announce"))) {
 					announce = o_announce;
 				}
 
 				if (announce) {
-                    switch_ivr_play_file(session, NULL, announce, NULL);
-                } else {
+					switch_ivr_play_file(session, NULL, announce, NULL);
+				} else {
 					switch_ivr_sleep(session, 500);
-                }
-				
-				
+				}
+
+
 				switch_channel_set_variable(other_channel, "fifo_serviced_by", my_id);
 				switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session));
 
@@ -868,7 +868,7 @@
 						break;
 					}
 				}
-				
+
 				if (!(switch_channel_ready(channel))) {
 					switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING);
 					switch_core_session_rwunlock(other_session);
@@ -876,28 +876,28 @@
 				}
 
 
-                switch_channel_answer(channel);
+				switch_channel_answer(channel);
 				cloned_profile = switch_caller_profile_clone(other_session, switch_channel_get_caller_profile(channel));
-                switch_assert(cloned_profile);
-                switch_channel_set_originator_caller_profile(other_channel, cloned_profile);
+				switch_assert(cloned_profile);
+				switch_channel_set_originator_caller_profile(other_channel, cloned_profile);
 
 				cloned_profile = switch_caller_profile_clone(session, switch_channel_get_caller_profile(other_channel));
-                switch_assert(cloned_profile);
-                switch_assert(cloned_profile->next == NULL);
-                switch_channel_set_originatee_caller_profile(channel, cloned_profile);
-				
-                ts = switch_timestamp_now();
-                switch_time_exp_lt(&tm, ts);
-                switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
-                switch_channel_set_variable(channel, "fifo_status", "TALKING");
-                switch_channel_set_variable(channel, "fifo_target", uuid);
-                switch_channel_set_variable(channel, "fifo_timestamp", date);
-                
-                switch_channel_set_variable(other_channel, "fifo_status", "TALKING");
-                switch_channel_set_variable(other_channel, "fifo_timestamp", date);
-                switch_channel_set_variable(other_channel, "fifo_target", switch_core_session_get_uuid(session));
+				switch_assert(cloned_profile);
+				switch_assert(cloned_profile->next == NULL);
+				switch_channel_set_originatee_caller_profile(channel, cloned_profile);
+
+				ts = switch_timestamp_now();
+				switch_time_exp_lt(&tm, ts);
+				switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+				switch_channel_set_variable(channel, "fifo_status", "TALKING");
+				switch_channel_set_variable(channel, "fifo_target", uuid);
+				switch_channel_set_variable(channel, "fifo_timestamp", date);
+
+				switch_channel_set_variable(other_channel, "fifo_status", "TALKING");
+				switch_channel_set_variable(other_channel, "fifo_timestamp", date);
+				switch_channel_set_variable(other_channel, "fifo_target", switch_core_session_get_uuid(session));
 
-                send_presence(node);
+				send_presence(node);
 
 
 				if (record_template) {
@@ -905,7 +905,7 @@
 					switch_ivr_record_session(session, expanded, 0, NULL);
 				}
 
-                switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session);
+				switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session);
 
 				if (record_template) {
 					switch_ivr_stop_record_session(session, expanded);
@@ -914,26 +914,26 @@
 					}
 				}
 
-                ts = switch_timestamp_now();
-                switch_time_exp_lt(&tm, ts);
-                switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
-                switch_channel_set_variable(channel, "fifo_status", "WAITING");
-                switch_channel_set_variable(channel, "fifo_timestamp", date);
-
-                switch_channel_set_variable(other_channel, "fifo_status", "DONE");
-                switch_channel_set_variable(other_channel, "fifo_timestamp", date);
-                
-                switch_mutex_lock(node->mutex);
-                node->caller_count--;
-                switch_core_hash_delete(node->caller_hash, uuid);
-                switch_mutex_unlock(node->mutex);
-                send_presence(node);
-                switch_core_session_rwunlock(other_session);
-
-
-                if (!do_wait) {
-                    done = 1;
-                }
+				ts = switch_timestamp_now();
+				switch_time_exp_lt(&tm, ts);
+				switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+				switch_channel_set_variable(channel, "fifo_status", "WAITING");
+				switch_channel_set_variable(channel, "fifo_timestamp", date);
+
+				switch_channel_set_variable(other_channel, "fifo_status", "DONE");
+				switch_channel_set_variable(other_channel, "fifo_timestamp", date);
+
+				switch_mutex_lock(node->mutex);
+				node->caller_count--;
+				switch_core_hash_delete(node->caller_hash, uuid);
+				switch_mutex_unlock(node->mutex);
+				send_presence(node);
+				switch_core_session_rwunlock(other_session);
+
+
+				if (!do_wait) {
+					done = 1;
+				}
 
 				fifo_consumer_wrapup_sound = switch_channel_get_variable(channel, "fifo_consumer_wrapup_sound");
 				fifo_consumer_wrapup_key = switch_channel_get_variable(channel, "fifo_consumer_wrapup_key");
@@ -947,33 +947,33 @@
 				}
 
 				if (!switch_strlen_zero(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) {
-					for(;;) {
-						char terminator = 0;                        
-						switch_ivr_collect_digits_count(session, buf, sizeof(buf)-1, 1, fifo_consumer_wrapup_key, &terminator, 0, 0, 0);
+					for (;;) {
+						char terminator = 0;
+						switch_ivr_collect_digits_count(session, buf, sizeof(buf) - 1, 1, fifo_consumer_wrapup_key, &terminator, 0, 0, 0);
 						if (terminator == *fifo_consumer_wrapup_key) {
 							break;
 						}
 					}
 				}
 			}
-			
-            switch_safe_free(uuid);
 
-            if (done) {
-                break;
-            }
-        }
-		
+			switch_safe_free(uuid);
+
+			if (done) {
+				break;
+			}
+		}
+
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
-            switch_channel_event_set_data(channel, event);
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_stop");
-            switch_event_fire(&event);
-        }
+			switch_channel_event_set_data(channel, event);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_stop");
+			switch_event_fire(&event);
+		}
 
-        if (do_wait) {
+		if (do_wait) {
 			for (i = 0; i < node_count; i++) {
-                if (!(node = node_list[i])) {
+				if (!(node = node_list[i])) {
 					continue;
 				}
 				switch_mutex_lock(node->mutex);
@@ -981,150 +981,150 @@
 				node->consumer_count--;
 				switch_mutex_unlock(node->mutex);
 			}
-        }
-		
-    }
+		}
+
+	}
 }
 
 static int xml_hash(switch_xml_t xml, switch_hash_t *hash, char *container, char *tag, int cc_off, int verbose)
 {
-    switch_xml_t x_tmp, x_caller, x_cp, variables;
-    switch_hash_index_t *hi;
-    switch_core_session_t *session;
-    switch_channel_t *channel;
-    void *val;
-    const void *var;
-
-    x_tmp = switch_xml_add_child_d(xml, container, cc_off++);
-    switch_assert(x_tmp);
-
-    for (hi = switch_hash_first(NULL, hash); hi; hi = switch_hash_next(hi)) {
-        int c_off = 0, d_off = 0;
-        const char *status;
-        const char *ts;
-
-        switch_hash_this(hi, &var, NULL, &val);
-        session = (switch_core_session_t *) val;
-        channel = switch_core_session_get_channel(session);
-        x_caller = switch_xml_add_child_d(x_tmp, tag, c_off++);
-        switch_assert(x_caller);
-        
-        switch_xml_set_attr_d(x_caller, "uuid", switch_core_session_get_uuid(session));
-
-        if ((status = switch_channel_get_variable(channel, "fifo_status"))) {
-            switch_xml_set_attr_d(x_caller, "status", status);
-        }
-
-        if ((ts = switch_channel_get_variable(channel, "fifo_timestamp"))) {
-            switch_xml_set_attr_d(x_caller, "timestamp", ts);
-        }
-
-        if ((ts = switch_channel_get_variable(channel, "fifo_target"))) {
-            switch_xml_set_attr_d(x_caller, "target", ts);
-        }
-        
+	switch_xml_t x_tmp, x_caller, x_cp, variables;
+	switch_hash_index_t *hi;
+	switch_core_session_t *session;
+	switch_channel_t *channel;
+	void *val;
+	const void *var;
+
+	x_tmp = switch_xml_add_child_d(xml, container, cc_off++);
+	switch_assert(x_tmp);
+
+	for (hi = switch_hash_first(NULL, hash); hi; hi = switch_hash_next(hi)) {
+		int c_off = 0, d_off = 0;
+		const char *status;
+		const char *ts;
+
+		switch_hash_this(hi, &var, NULL, &val);
+		session = (switch_core_session_t *) val;
+		channel = switch_core_session_get_channel(session);
+		x_caller = switch_xml_add_child_d(x_tmp, tag, c_off++);
+		switch_assert(x_caller);
+
+		switch_xml_set_attr_d(x_caller, "uuid", switch_core_session_get_uuid(session));
+
+		if ((status = switch_channel_get_variable(channel, "fifo_status"))) {
+			switch_xml_set_attr_d(x_caller, "status", status);
+		}
+
+		if ((ts = switch_channel_get_variable(channel, "fifo_timestamp"))) {
+			switch_xml_set_attr_d(x_caller, "timestamp", ts);
+		}
+
+		if ((ts = switch_channel_get_variable(channel, "fifo_target"))) {
+			switch_xml_set_attr_d(x_caller, "target", ts);
+		}
+
 		if (!(x_cp = switch_xml_add_child_d(x_caller, "caller_profile", d_off++))) {
-            abort();
+			abort();
 		}
-        if (verbose) {
-            d_off += switch_ivr_set_xml_profile_data(x_cp, switch_channel_get_caller_profile(channel), d_off);
-        
-            if (!(variables = switch_xml_add_child_d(x_caller, "variables", c_off++))) {
-                abort();
-            }
-        
-            switch_ivr_set_xml_chan_vars(variables, channel, c_off);
-        }
-        
-    }
+		if (verbose) {
+			d_off += switch_ivr_set_xml_profile_data(x_cp, switch_channel_get_caller_profile(channel), d_off);
+
+			if (!(variables = switch_xml_add_child_d(x_caller, "variables", c_off++))) {
+				abort();
+			}
+
+			switch_ivr_set_xml_chan_vars(variables, channel, c_off);
+		}
+
+	}
 
-    return cc_off;
+	return cc_off;
 }
 
 static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int verbose)
 {
 
-    switch_xml_t x_fifo;
-    int cc_off = 0;
-    char buffer[35];
+	switch_xml_t x_fifo;
+	int cc_off = 0;
+	char buffer[35];
 	char *tmp = buffer;
 
-    x_fifo = switch_xml_add_child_d(x_report, "fifo", (*off)++);;
-    switch_assert(x_fifo);
+	x_fifo = switch_xml_add_child_d(x_report, "fifo", (*off)++);;
+	switch_assert(x_fifo);
+
+	switch_xml_set_attr_d(x_fifo, "name", node->name);
+	switch_snprintf(tmp, sizeof(buffer), "%d", node->consumer_count);
+	switch_xml_set_attr_d(x_fifo, "consumer_count", tmp);
+	switch_snprintf(tmp, sizeof(buffer), "%d", node->caller_count);
+	switch_xml_set_attr_d(x_fifo, "caller_count", tmp);
+	switch_snprintf(tmp, sizeof(buffer), "%d", node_consumer_wait_count(node));
+	switch_xml_set_attr_d(x_fifo, "waiting_count", tmp);
+	switch_snprintf(tmp, sizeof(buffer), "%u", node->importance);
+	switch_xml_set_attr_d(x_fifo, "importance", tmp);
 
-    switch_xml_set_attr_d(x_fifo, "name", node->name);
-    switch_snprintf(tmp, sizeof(buffer), "%d", node->consumer_count);
-    switch_xml_set_attr_d(x_fifo, "consumer_count", tmp);
-    switch_snprintf(tmp, sizeof(buffer), "%d", node->caller_count);
-    switch_xml_set_attr_d(x_fifo, "caller_count", tmp);
-    switch_snprintf(tmp, sizeof(buffer), "%d", node_consumer_wait_count(node));
-    switch_xml_set_attr_d(x_fifo, "waiting_count", tmp);
-    switch_snprintf(tmp, sizeof(buffer), "%u", node->importance);
-    switch_xml_set_attr_d(x_fifo, "importance", tmp);
-    
-    cc_off = xml_hash(x_fifo, node->caller_hash, "callers", "caller", cc_off, verbose);
-    cc_off = xml_hash(x_fifo, node->consumer_hash, "consumers", "consumer", cc_off, verbose);
+	cc_off = xml_hash(x_fifo, node->caller_hash, "callers", "caller", cc_off, verbose);
+	cc_off = xml_hash(x_fifo, node->consumer_hash, "consumers", "consumer", cc_off, verbose);
 
 }
 
 #define FIFO_API_SYNTAX "list|list_verbose|count|importance [<fifo name>]"
 SWITCH_STANDARD_API(fifo_api_function)
 {
-    int len = 0;
-    fifo_node_t *node;
-    char *data = NULL;
-    int argc = 0;
-    char *argv[5] = { 0 };
-    switch_hash_index_t *hi;
-    void *val;
-    const void *var;
-    int x = 0, verbose = 0;
-
-
-    if (!globals.running) {
-        return SWITCH_STATUS_FALSE;
-    }
-
-    if (!switch_strlen_zero(cmd)) {
-        data = strdup(cmd);
-        switch_assert(data);
-    }
-    
-    if (switch_strlen_zero(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1 || !argv[0]) {
-        stream->write_function(stream, "%s\n", FIFO_API_SYNTAX);
-        return SWITCH_STATUS_SUCCESS;
-    }
-
-    switch_mutex_lock(globals.mutex);
-    verbose = !strcasecmp(argv[0], "list_verbose");
-
-    if (!strcasecmp(argv[0], "list") || verbose) {    
-        char *xml_text = NULL;
-        switch_xml_t x_report = switch_xml_new("fifo_report");
-        switch_assert(x_report);
-		
-        if (argc < 2) {
-            for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
-                switch_hash_this(hi, &var, NULL, &val);
-                node = (fifo_node_t *) val;
-                switch_mutex_lock(node->mutex);
-                list_node(node, x_report, &x, verbose);
-                switch_mutex_unlock(node->mutex);
-            }
-        } else {
-            if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
-                switch_mutex_lock(node->mutex);
-                list_node(node, x_report, &x, verbose);
-                switch_mutex_unlock(node->mutex);
-            }
-        }
-        xml_text = switch_xml_toxml(x_report, SWITCH_FALSE);
-        switch_assert(xml_text);
-        stream->write_function(stream, "%s\n", xml_text);
-        switch_xml_free(x_report);
-        switch_safe_free(xml_text);
-        
-    } else if (!strcasecmp(argv[0], "importance")) {
+	int len = 0;
+	fifo_node_t *node;
+	char *data = NULL;
+	int argc = 0;
+	char *argv[5] = { 0 };
+	switch_hash_index_t *hi;
+	void *val;
+	const void *var;
+	int x = 0, verbose = 0;
+
+
+	if (!globals.running) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (!switch_strlen_zero(cmd)) {
+		data = strdup(cmd);
+		switch_assert(data);
+	}
+
+	if (switch_strlen_zero(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1 || !argv[0]) {
+		stream->write_function(stream, "%s\n", FIFO_API_SYNTAX);
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	switch_mutex_lock(globals.mutex);
+	verbose = !strcasecmp(argv[0], "list_verbose");
+
+	if (!strcasecmp(argv[0], "list") || verbose) {
+		char *xml_text = NULL;
+		switch_xml_t x_report = switch_xml_new("fifo_report");
+		switch_assert(x_report);
+
+		if (argc < 2) {
+			for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
+				switch_hash_this(hi, &var, NULL, &val);
+				node = (fifo_node_t *) val;
+				switch_mutex_lock(node->mutex);
+				list_node(node, x_report, &x, verbose);
+				switch_mutex_unlock(node->mutex);
+			}
+		} else {
+			if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
+				switch_mutex_lock(node->mutex);
+				list_node(node, x_report, &x, verbose);
+				switch_mutex_unlock(node->mutex);
+			}
+		}
+		xml_text = switch_xml_toxml(x_report, SWITCH_FALSE);
+		switch_assert(xml_text);
+		stream->write_function(stream, "%s\n", xml_text);
+		switch_xml_free(x_report);
+		switch_safe_free(xml_text);
+
+	} else if (!strcasecmp(argv[0], "importance")) {
 		if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
 			int importance = 0;
 			if (argc > 2) {
@@ -1138,40 +1138,40 @@
 		} else {
 			stream->write_function(stream, "no fifo by that name\n");
 		}
-    } else if (!strcasecmp(argv[0], "count")) {
-        if (argc < 2) {
-            for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
-                switch_hash_this(hi, &var, NULL, &val);
-                node = (fifo_node_t *) val;
+	} else if (!strcasecmp(argv[0], "count")) {
+		if (argc < 2) {
+			for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
+				switch_hash_this(hi, &var, NULL, &val);
+				node = (fifo_node_t *) val;
 				len = node_consumer_wait_count(node);
-                switch_mutex_lock(node->mutex);
-                stream->write_function(stream, "%s:%d:%d:%d\n", (char *)var, node->consumer_count, node->caller_count, len);
-                switch_mutex_unlock(node->mutex);
-                x++;
-            }
-            
-            if (!x) {
-                stream->write_function(stream, "none\n");
-            }
-        } else if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
+				switch_mutex_lock(node->mutex);
+				stream->write_function(stream, "%s:%d:%d:%d\n", (char *) var, node->consumer_count, node->caller_count, len);
+				switch_mutex_unlock(node->mutex);
+				x++;
+			}
+
+			if (!x) {
+				stream->write_function(stream, "none\n");
+			}
+		} else if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
 			len = node_consumer_wait_count(node);
-            switch_mutex_lock(node->mutex);
-            stream->write_function(stream, "%s:%d:%d:%d\n", argv[1], node->consumer_count, node->caller_count, len);
-            switch_mutex_unlock(node->mutex);
+			switch_mutex_lock(node->mutex);
+			stream->write_function(stream, "%s:%d:%d:%d\n", argv[1], node->consumer_count, node->caller_count, len);
+			switch_mutex_unlock(node->mutex);
 		} else {
 			stream->write_function(stream, "none\n");
-        }
-    }
+		}
+	}
 
-    switch_mutex_unlock(globals.mutex);
-    return SWITCH_STATUS_SUCCESS;
+	switch_mutex_unlock(globals.mutex);
+	return SWITCH_STATUS_SUCCESS;
 }
 
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load)
 {
 	switch_application_interface_t *app_interface;
-    switch_api_interface_t *commands_api_interface;
+	switch_api_interface_t *commands_api_interface;
 
 
 	/* create/register custom event message type */
@@ -1186,15 +1186,15 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
-    switch_core_new_memory_pool(&globals.pool);
-    switch_core_hash_init(&globals.fifo_hash, globals.pool);
-    switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
+	switch_core_new_memory_pool(&globals.pool);
+	switch_core_hash_init(&globals.fifo_hash, globals.pool);
+	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_APP(app_interface, "fifo", "Park with FIFO", FIFO_DESC, fifo_function, FIFO_USAGE, SAF_NONE);
-    SWITCH_ADD_API(commands_api_interface, "fifo", "Return data about a fifo", fifo_api_function, FIFO_API_SYNTAX);
-    globals.running = 1;
+	SWITCH_ADD_API(commands_api_interface, "fifo", "Return data about a fifo", fifo_api_function, FIFO_API_SYNTAX);
+	globals.running = 1;
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -1204,32 +1204,32 @@
 */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
 {
-    switch_hash_index_t *hi;
-    void *val, *pop;
-    fifo_node_t *node;
-    switch_memory_pool_t *pool = globals.pool;
-    switch_mutex_t *mutex = globals.mutex;
-
-    switch_mutex_lock(mutex);
-    
-    globals.running = 0;
-    /* Cleanup*/
-    for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
-		int x = 0 ;
-        switch_hash_this(hi, NULL, NULL, &val);
-        node = (fifo_node_t *) val;
+	switch_hash_index_t *hi;
+	void *val, *pop;
+	fifo_node_t *node;
+	switch_memory_pool_t *pool = globals.pool;
+	switch_mutex_t *mutex = globals.mutex;
+
+	switch_mutex_lock(mutex);
+
+	globals.running = 0;
+	/* Cleanup */
+	for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
+		int x = 0;
+		switch_hash_this(hi, NULL, NULL, &val);
+		node = (fifo_node_t *) val;
 		for (x = 0; x < MAX_PRI; x++) {
 			while (switch_queue_trypop(node->fifo_list[x], &pop) == SWITCH_STATUS_SUCCESS) {
 				free(pop);
 			}
 		}
-        switch_core_hash_destroy(&node->caller_hash);
-        switch_core_hash_destroy(&node->consumer_hash);
-    }
-    switch_core_hash_destroy(&globals.fifo_hash);
-    memset(&globals, 0, sizeof(globals));    
-    switch_mutex_unlock(mutex);
-    switch_core_destroy_memory_pool(&pool);
+		switch_core_hash_destroy(&node->caller_hash);
+		switch_core_hash_destroy(&node->consumer_hash);
+	}
+	switch_core_hash_destroy(&globals.fifo_hash);
+	memset(&globals, 0, sizeof(globals));
+	switch_mutex_unlock(mutex);
+	switch_core_destroy_memory_pool(&pool);
 	return SWITCH_STATUS_SUCCESS;
 }
 

Modified: freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c	Tue May 27 00:54:52 2008
@@ -61,35 +61,35 @@
 	switch_status_t status;
 	switch_frame_t *read_frame;
 	int bytes;
-	
-	eh->up = 1;	
-	while(switch_channel_ready(channel)) {
+
+	eh->up = 1;
+	while (switch_channel_ready(channel)) {
 		status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 
 		if (!SWITCH_READ_ACCEPTABLE(status)) {
 			break;
 		}
-		
+
 		if (switch_test_flag(read_frame, SFF_CNG)) {
 			continue;
 		}
 
-		bytes = read_frame->packetlen |VID_BIT;
-		
+		bytes = read_frame->packetlen | VID_BIT;
+
 		switch_mutex_lock(eh->mutex);
-		
-		if (write(eh->fd, &bytes, sizeof(bytes)) != (int)sizeof(bytes)) {
+
+		if (write(eh->fd, &bytes, sizeof(bytes)) != (int) sizeof(bytes)) {
 			switch_mutex_unlock(eh->mutex);
 			break;
 		}
 
-		if (write(eh->fd, read_frame->packet, read_frame->packetlen) != (int)read_frame->packetlen) {
+		if (write(eh->fd, read_frame->packet, read_frame->packetlen) != (int) read_frame->packetlen) {
 			switch_mutex_unlock(eh->mutex);
 			break;
 		}
 
 		switch_mutex_unlock(eh->mutex);
-        
+
 		switch_core_session_write_video_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);
 	}
 	eh->up = 0;
@@ -101,24 +101,24 @@
 	switch_status_t status;
 	switch_frame_t *read_frame;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	struct record_helper eh = {0};
+	struct record_helper eh = { 0 };
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
 	int fd;
 	switch_mutex_t *mutex = NULL;
 	switch_codec_t codec, *read_codec, *vid_codec;
-	
+
 	switch_channel_answer(channel);
-	
-	if ((fd = open((char *)data, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) < 0) {
+
+	if ((fd = open((char *) data, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) < 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data);
 		return;
 	}
-	
+
 	switch_channel_answer(channel);
 
 	read_codec = switch_core_session_get_read_codec(session);
-	
+
 	if (switch_core_codec_init(&codec,
 							   "L16",
 							   NULL,
@@ -131,14 +131,14 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Audio Codec Activation Fail\n");
 		goto end;
 	}
-	
+
 	switch_core_session_set_read_codec(session, &codec);
-	
+
 	if (switch_channel_test_flag(channel, CF_VIDEO)) {
 		struct file_header h;
 		memset(&h, 0, sizeof(h));
 		vid_codec = switch_core_session_get_video_read_codec(session);
-		
+
 		h.version = VERSION;
 		h.created = switch_timestamp_now();
 		switch_set_string(h.video_codec_name, vid_codec->implementation->iananame);
@@ -147,11 +147,11 @@
 		}
 		h.audio_rate = read_codec->implementation->samples_per_second;
 		h.audio_ptime = read_codec->implementation->microseconds_per_frame / 1000;
-		
+
 		if (write(fd, &h, sizeof(h)) != sizeof(h)) {
 			goto end;
 		}
-		
+
 		switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
 		eh.mutex = mutex;
 		eh.fd = fd;
@@ -161,12 +161,12 @@
 		switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 		switch_thread_create(&thread, thd_attr, record_video_thread, &eh, switch_core_session_get_pool(session));
 	}
-	
-	
-	while(switch_channel_ready(channel)) {
+
+
+	while (switch_channel_ready(channel)) {
 
 		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-		
+
 		if (!SWITCH_READ_ACCEPTABLE(status)) {
 			break;
 		}
@@ -186,7 +186,7 @@
 			break;
 		}
 
-		if (write(fd, read_frame->data, read_frame->datalen) != (int)read_frame->datalen) {
+		if (write(fd, read_frame->data, read_frame->datalen) != (int) read_frame->datalen) {
 			if (mutex) {
 				switch_mutex_unlock(mutex);
 			}
@@ -198,42 +198,44 @@
 		}
 	}
 
-	
- end:
+
+  end:
 
 	if (eh.up) {
-		while(eh.up) {
+		while (eh.up) {
 			switch_yield(1000);
 		}
 	}
 
 	switch_core_session_set_read_codec(session, read_codec);
 	switch_core_codec_destroy(&codec);
-	
+
 }
 
 SWITCH_STANDARD_APP(play_fsv_function)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_frame_t write_frame = {0}, vid_frame = {0};
+	switch_frame_t write_frame = { 0 }, vid_frame = {
+	0};
 	int fd = -1;
 	int bytes;
-	switch_codec_t *read_codec = NULL, codec = {0}, vid_codec = {0}, *read_vid_codec;
+	switch_codec_t *read_codec = NULL, codec = { 0 }, vid_codec = {
+	0}, *read_vid_codec;
 	unsigned char *aud_buffer;
 	unsigned char *vid_buffer;
 	struct file_header h;
-	uint32_t ts = 0, last = 0;	
-	switch_timer_t timer = {0};
+	uint32_t ts = 0, last = 0;
+	switch_timer_t timer = { 0 };
 	switch_payload_t pt = 0;
 
 	aud_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	vid_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
-	
-	if ((fd = open((char *)data, O_RDONLY)) < 0) {
+
+	if ((fd = open((char *) data, O_RDONLY)) < 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data);
 		return;
 	}
-	
+
 	if (read(fd, &h, sizeof(h)) != sizeof(h)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "error reading file header\n");
 		goto end;
@@ -246,7 +248,7 @@
 
 	switch_channel_set_variable(channel, "sip_force_video_fmtp", h.video_fmtp);
 	switch_channel_answer(channel);
-	
+
 	if ((read_vid_codec = switch_core_session_get_video_read_codec(session))) {
 		pt = read_vid_codec->agreed_pt;
 	}
@@ -254,16 +256,16 @@
 	write_frame.codec = &codec;
 	write_frame.data = aud_buffer;
 	write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
-	
+
 	vid_frame.codec = &vid_codec;
 	vid_frame.packet = vid_buffer;
 	vid_frame.data = vid_buffer + 12;
 	vid_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
 	switch_set_flag((&vid_frame), SFF_RAW_RTP);
-	
+
 	read_codec = switch_core_session_get_read_codec(session);
 
-	if (switch_core_timer_init(&timer, "soft", read_codec->implementation->microseconds_per_frame / 1000, 
+	if (switch_core_timer_init(&timer, "soft", read_codec->implementation->microseconds_per_frame / 1000,
 							   read_codec->implementation->samples_per_frame, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "timer Activation Fail\n");
 		goto end;
@@ -281,7 +283,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Audio Codec Activation Fail\n");
 		goto end;
 	}
-	
+
 	if (switch_core_codec_init(&vid_codec,
 							   h.video_codec_name,
 							   NULL,
@@ -296,20 +298,20 @@
 	}
 	switch_core_session_set_read_codec(session, &codec);
 
-	while(switch_channel_ready(channel)) {
+	while (switch_channel_ready(channel)) {
 
 		if (read(fd, &bytes, sizeof(bytes)) != sizeof(bytes)) {
 			break;
 		}
-		
+
 		if (bytes & VID_BIT) {
 			switch_rtp_hdr_t *hdr = vid_frame.packet;
 			bytes &= ~VID_BIT;
 
-			if ((vid_frame.packetlen = read(fd, vid_frame.packet, bytes)) != (uint32_t)bytes) {
+			if ((vid_frame.packetlen = read(fd, vid_frame.packet, bytes)) != (uint32_t) bytes) {
 				break;
 			}
-			
+
 			ts = ntohl(hdr->ts);
 			if (pt) {
 				hdr->pt = pt;
@@ -322,7 +324,7 @@
 			}
 			last = ts;
 		} else {
-			if (bytes > (int)write_frame.buflen) {
+			if (bytes > (int) write_frame.buflen) {
 				bytes = write_frame.buflen;
 			}
 			if ((write_frame.datalen = read(fd, write_frame.data, bytes)) <= 0) {
@@ -333,9 +335,9 @@
 		}
 
 	}
-	
- end:
-	
+
+  end:
+
 	if (timer.interval) {
 		switch_core_timer_destroy(&timer);
 	}
@@ -343,15 +345,15 @@
 	if (read_codec) {
 		switch_core_session_set_read_codec(session, read_codec);
 	}
-	
+
 	if (codec.implementation) {
 		switch_core_codec_destroy(&codec);
 	}
-	
+
 	if (vid_codec.implementation) {
 		switch_core_codec_destroy(&vid_codec);
 	}
-	
+
 	if (fd > -1) {
 		close(fd);
 	}
@@ -362,7 +364,7 @@
 	switch_application_interface_t *app_interface;
 
 	/* connect my internal structure to the blank pointer passed to me */
-    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	SWITCH_ADD_APP(app_interface, "play_fsv", "play an fsv file", "play an fsv file", play_fsv_function, "<file>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "record_fsv", "record an fsv file", "record an fsv file", record_fsv_function, "<file>", SAF_NONE);

Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c	Tue May 27 00:54:52 2008
@@ -53,28 +53,16 @@
 
 static char limit_sql[] =
 	"CREATE TABLE limit_data (\n"
-	"   hostname   VARCHAR(255),\n"
-	"   realm      VARCHAR(255),\n"
-	"   id         VARCHAR(255),\n" 
-	"   uuid       VARCHAR(255)\n"
-	");\n";
+	"   hostname   VARCHAR(255),\n" "   realm      VARCHAR(255),\n" "   id         VARCHAR(255),\n" "   uuid       VARCHAR(255)\n" ");\n";
 
 
 static char db_sql[] =
 	"CREATE TABLE db_data (\n"
-	"   hostname   VARCHAR(255),\n"
-	"   realm      VARCHAR(255),\n"
-	"   data_key   VARCHAR(255),\n" 
-	"   data       VARCHAR(255)\n"
-	");\n";
+	"   hostname   VARCHAR(255),\n" "   realm      VARCHAR(255),\n" "   data_key   VARCHAR(255),\n" "   data       VARCHAR(255)\n" ");\n";
 
 
 static char group_sql[] =
-	"CREATE TABLE group_data (\n"
-	"   hostname   VARCHAR(255),\n"
-	"   groupname  VARCHAR(255),\n"
-	"   url        VARCHAR(255)\n"
-	");\n";
+	"CREATE TABLE group_data (\n" "   hostname   VARCHAR(255),\n" "   groupname  VARCHAR(255),\n" "   url        VARCHAR(255)\n" ");\n";
 
 
 
@@ -86,9 +74,8 @@
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
-
 #ifdef SWITCH_HAVE_ODBC
-    if (globals.odbc_dsn) {
+	if (globals.odbc_dsn) {
 		SQLHSTMT stmt;
 		if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
 			char *err_str;
@@ -110,33 +97,29 @@
 		switch_core_db_close(db);
 
 #ifdef SWITCH_HAVE_ODBC
-    }
+	}
 #endif
 
 
- end:
+  end:
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
 
-    return status;
+	return status;
 }
 
 
-static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex,
-                                                char *sql,
-                                                switch_core_db_callback_func_t callback,
-                                                void *pdata)
+static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
 	switch_bool_t ret = SWITCH_FALSE;
 	switch_core_db_t *db;
 	char *errmsg = NULL;
-	
+
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
 
-
 #ifdef SWITCH_HAVE_ODBC
 	if (globals.odbc_dsn) {
 		switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata);
@@ -161,7 +144,7 @@
 	}
 #endif
 
- end:
+  end:
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
@@ -185,12 +168,12 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
 		return SWITCH_STATUS_TERM;
 	}
-    
+
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 			char *var = NULL;
 			char *val = NULL;
-            
+
 			var = (char *) switch_xml_attr_soft(param, "name");
 			val = (char *) switch_xml_attr_soft(param, "value");
 
@@ -198,9 +181,9 @@
 #ifdef SWITCH_HAVE_ODBC
 				globals.odbc_dsn = switch_core_strdup(globals.pool, val);
 				if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
-				*odbc_user++ = '\0';
+					*odbc_user++ = '\0';
 					if ((odbc_pass = strchr(odbc_user, ':'))) {
-					*odbc_pass++ = '\0';
+						*odbc_pass++ = '\0';
 					}
 				}
 #else
@@ -214,7 +197,6 @@
 	if (switch_strlen_zero(globals.odbc_dsn) || switch_strlen_zero(odbc_user) || switch_strlen_zero(odbc_pass)) {
 		globals.dbname = "call_limit";
 	}
-    
 
 #ifdef SWITCH_HAVE_ODBC
 	if (globals.odbc_dsn) {
@@ -228,11 +210,11 @@
 			status = SWITCH_STATUS_FALSE;
 			goto done;
 		}
-        
+
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.odbc_dsn);
 		if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from limit_data", NULL) != SWITCH_STATUS_SUCCESS) {
 			if (switch_odbc_handle_exec(globals.master_odbc, limit_sql, NULL) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
 			}
 		}
 		if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from db_data", NULL) != SWITCH_STATUS_SUCCESS) {
@@ -258,10 +240,10 @@
 		}
 		switch_core_db_close(db);
 #ifdef SWITCH_HAVE_ODBC
-	}           
+	}
 #endif
 
- done:
+  done:
 
 	sql = switch_mprintf("delete from limit_data where hostname='%q';", globals.hostname);
 	limit_execute_sql(sql, globals.mutex);
@@ -284,8 +266,8 @@
 	if (state == CS_HANGUP || state == CS_ROUTING) {
 		id = switch_channel_get_variable(channel, "limit_id");
 		realm = switch_channel_get_variable(channel, "limit_realm");
-		sql = switch_mprintf("delete from limit_data where uuid='%q' and hostname='%q' and realm='%q'and id='%q';", 
-                             switch_core_session_get_uuid(session), globals.hostname, realm, id);
+		sql = switch_mprintf("delete from limit_data where uuid='%q' and hostname='%q' and realm='%q'and id='%q';",
+							 switch_core_session_get_uuid(session), globals.hostname, realm, id);
 		limit_execute_sql(sql, globals.mutex);
 		switch_safe_free(sql);
 		switch_core_event_hook_remove_state_change(session, hanguphook);
@@ -343,8 +325,10 @@
 		sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
 		assert(sql);
 		limit_execute_sql(sql, NULL);
-		switch_safe_free(sql);    
-		sql = switch_mprintf("insert into db_data (hostname, realm, data_key, data) values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2], argv[3]);
+		switch_safe_free(sql);
+		sql =
+			switch_mprintf("insert into db_data (hostname, realm, data_key, data) values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2],
+						   argv[3]);
 		assert(sql);
 		limit_execute_sql(sql, NULL);
 		switch_safe_free(sql);
@@ -357,7 +341,7 @@
 		sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
 		assert(sql);
 		limit_execute_sql(sql, NULL);
-		switch_safe_free(sql);    
+		switch_safe_free(sql);
 		stream->write_function(stream, "+OK");
 		goto done;
 	} else if (!strcasecmp(argv[0], "select")) {
@@ -372,18 +356,18 @@
 		limit_execute_sql_callback(NULL, sql, sql2str_callback, &cbt);
 		stream->write_function(stream, "%s", buf);
 		goto done;
-	} 
+	}
 
 
- error:
+  error:
 	stream->write_function(stream, "!err!");
-    
- done:
+
+  done:
 
 	switch_mutex_unlock(globals.mutex);
 	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
-    
+
 }
 
 
@@ -411,8 +395,10 @@
 		switch_assert(sql);
 		limit_execute_sql(sql, globals.mutex);
 		switch_safe_free(sql);
-        
-		sql = switch_mprintf("insert into db_data (hostname, realm, data_key, data) values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2], argv[3]);
+
+		sql =
+			switch_mprintf("insert into db_data (hostname, realm, data_key, data) values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2],
+						   argv[3]);
 	} else if (!strcasecmp(argv[0], "delete")) {
 		sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
 	}
@@ -422,7 +408,7 @@
 	switch_safe_free(sql);
 	return;
 
-error:
+  error:
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: db %s\n", DB_USAGE);
 }
 
@@ -481,7 +467,7 @@
 		callback_t cbt = { 0 };
 		cbt.buf = buf;
 		cbt.len = sizeof(buf);
-        
+
 		if (argc > 2) {
 			if (!strcasecmp(argv[2], "order")) {
 				how = "|";
@@ -497,15 +483,15 @@
 		goto done;
 	}
 
- error:
+  error:
 	stream->write_function(stream, "!err!");
-    
- done:
+
+  done:
 
 	switch_mutex_unlock(globals.mutex);
 	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
-    
+
 }
 
 #define GROUP_USAGE "[insert|delete]:<group name>:<val>"
@@ -544,7 +530,7 @@
 
 #define LIMIT_USAGE "<realm> <id> <max> [transfer_destination_number]"
 #define LIMIT_DESC "limit access to an extension"
-static char *limit_def_xfer_exten="limit_exceeded";
+static char *limit_def_xfer_exten = "limit_exceeded";
 
 SWITCH_STANDARD_APP(limit_function)
 {
@@ -585,7 +571,7 @@
 	if (max < 0) {
 		max = 0;
 	}
-    
+
 	switch_channel_set_variable(channel, "limit_realm", realm);
 	switch_channel_set_variable(channel, "limit_id", id);
 	switch_channel_set_variable(channel, "limit_max", argv[2]);
@@ -602,11 +588,13 @@
 	}
 
 	switch_core_event_hook_add_state_change(session, hanguphook);
-	sql = switch_mprintf("insert into limit_data (hostname, realm, id, uuid) values('%q','%q','%q','%q');", globals.hostname, realm, id, switch_core_session_get_uuid(session));
+	sql =
+		switch_mprintf("insert into limit_data (hostname, realm, id, uuid) values('%q','%q','%q','%q');", globals.hostname, realm, id,
+					   switch_core_session_get_uuid(session));
 	limit_execute_sql(sql, NULL);
 	switch_safe_free(sql);
 
-done:
+  done:
 	switch_mutex_unlock(globals.mutex);
 }
 
@@ -626,7 +614,7 @@
 	}
 
 	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
-    
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 

Modified: freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c	Tue May 27 00:54:52 2008
@@ -91,7 +91,7 @@
 {
 	switch (itype) {
 	case SWITCH_INPUT_TYPE_DTMF:{
-		switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
 			struct dtmf_buffer *dtb;
 			dtb = (struct dtmf_buffer *) buf;
 
@@ -175,7 +175,8 @@
 	uint32_t last;
 	char *mydata = NULL;
 	char *filename = NULL;
-	char *argv[3], *feed_list[TTS_MAX_ENTRIES] = { 0 }, *feed_names[TTS_MAX_ENTRIES] = {0};
+	char *argv[3], *feed_list[TTS_MAX_ENTRIES] = { 0 }, *feed_names[TTS_MAX_ENTRIES] = {
+	0};
 	int argc, feed_index = 0;
 	const char *cf = "rss.conf";
 	switch_xml_t cfg, cxml, feeds, feed;
@@ -311,12 +312,12 @@
 			switch_core_speech_flush_tts(&sh);
 #ifdef MATCH_COUNT
 			switch_snprintf(buf + len, sizeof(buf) - len, "%s",
-					 ",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
-					 "Select one of the following news sources, or press 0 to exit. " ",<break time=\"600ms\"/>");
+							",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
+							"Select one of the following news sources, or press 0 to exit. " ",<break time=\"600ms\"/>");
 #else
 			switch_snprintf(buf + len, sizeof(buf) - len, "%s",
-					 ",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
-					 "Select one of the following news sources, followed by the pound key or press 0 to exit. " ",<break time=\"600ms\"/>");
+							",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
+							"Select one of the following news sources, followed by the pound key or press 0 to exit. " ",<break time=\"600ms\"/>");
 #endif
 			len = (int32_t) strlen(buf);
 
@@ -482,8 +483,8 @@
 
 
 			switch_snprintf(buf, sizeof(buf),
-					 ",<break time=\"500ms\"/>%s. %s. %s. local time: %s, Press 0 for options, 5 to change voice, or pound to return to the main menu. ",
-					 title_txt, description_txt, rights_txt, date);
+							",<break time=\"500ms\"/>%s. %s. %s. local time: %s, Press 0 for options, 5 to change voice, or pound to return to the main menu. ",
+							title_txt, description_txt, rights_txt, date);
 			args.input_callback = NULL;
 			args.buf = dtmf;
 			args.buflen = sizeof(dtmf);
@@ -539,7 +540,8 @@
 					}
 					if (switch_test_flag(&dtb, SFLAG_INFO)) {
 						switch_clear_flag(&dtb, SFLAG_INFO);
-						switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice, dtb.speed);
+						switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice,
+										dtb.speed);
 						tmplen = (uint32_t) strlen(tmpbuf);
 					}
 
@@ -547,12 +549,12 @@
 						switch_clear_flag(&dtb, SFLAG_INSTRUCT);
 						cont = 1;
 						switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "%s",
-								 "Press star to pause or resume speech. "
-								 "To go to the next item, press six. "
-								 "To go back, press 4. "
-								 "Press two to go faster, eight to slow down, or 7 to resume normal speed. "
-								 "To change voices, press five. To restore the original voice press 9. "
-								 "To hear these options again, press zero or press pound to return to the main menu. ");
+										"Press star to pause or resume speech. "
+										"To go to the next item, press six. "
+										"To go back, press 4. "
+										"Press two to go faster, eight to slow down, or 7 to resume normal speed. "
+										"To change voices, press five. To restore the original voice press 9. "
+										"To hear these options again, press zero or press pound to return to the main menu. ");
 					} else {
 						switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "Story %d. ", dtb.index + 1);
 						tmplen = (uint32_t) strlen(tmpbuf);

Modified: freeswitch/trunk/src/mod/applications/mod_skel/mod_skel.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_skel/mod_skel.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_skel/mod_skel.c	Tue May 27 00:54:52 2008
@@ -41,7 +41,7 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load)
 {
 	/* connect my internal structure to the blank pointer passed to me */
-    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
 

Modified: freeswitch/trunk/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	(original)
+++ freeswitch/trunk/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	Tue May 27 00:54:52 2008
@@ -43,107 +43,107 @@
 SWITCH_MODULE_DEFINITION(mod_soundtouch, mod_soundtouch_load, NULL, NULL);
 
 struct soundtouch_helper {
-    SoundTouch *st;
-    switch_core_session_t *session;
-    int send;
-    int read;
-    float pitch;
-    float octaves;
-    float semi;
-    float rate;
-    float tempo;
-    int literal;
+	SoundTouch *st;
+	switch_core_session_t *session;
+	int send;
+	int read;
+	float pitch;
+	float octaves;
+	float semi;
+	float rate;
+	float tempo;
+	int literal;
 };
 
 static switch_status_t on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
 {
 
-    switch_media_bug_t *bug;
-    switch_channel_t *channel = switch_core_session_get_channel(session);
-    
-    if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
-        struct soundtouch_helper *sth = (struct soundtouch_helper *) switch_core_media_bug_get_user_data(bug);
-        
-        if (sth) {
-            if (sth->literal) {
-                sth->literal = 0;
-                return SWITCH_STATUS_SUCCESS;
-            }
-
-            
-            switch(dtmf->digit) {
-            case '*':
-                sth->literal++;
-                break;
-            case '3':
-                sth->semi += .5;
-                sth->st->setPitchSemiTones(sth->semi);
-                sth->st->flush();
-                break;
-            case '2':
-                sth->semi = 0;
-                sth->st->setPitchSemiTones(sth->semi);
-                sth->st->flush();
-                break;
-            case '1':
-                sth->semi -= .5;
-                sth->st->setPitchSemiTones(sth->semi);
-                sth->st->flush();
-                break;
-
-            case '6':
-                sth->pitch += .2;
-                sth->st->setPitch(sth->pitch);
-                sth->st->flush();
-                break;
-            case '5':
-                sth->pitch = 1;
-                sth->st->setPitch(sth->pitch);
-                sth->st->flush();
-                break;
-            case '4':
-                sth->pitch -= .2;
-                if (sth->pitch <= 0) {
-                    sth->pitch = .2;
-                }
-                sth->st->setPitch(sth->pitch);
-                sth->st->flush();
-                break;
-
-            case '9':
-                sth->octaves += .2;
-                sth->st->setPitchOctaves(sth->octaves);
-                sth->st->flush();
-                break;
-            case '8':
-                sth->octaves = 0;
-                sth->st->setPitchOctaves(sth->octaves);
-                sth->st->flush();
-                break;
-            case '7':
-                sth->octaves -= .2;
-                sth->st->setPitchOctaves(sth->octaves);
-                sth->st->flush();
-                break;
-
-
-            case '0':
-                sth->octaves = 0;
-                sth->st->setPitchOctaves(sth->octaves);
-                sth->pitch = 1;
-                sth->st->setPitch(sth->pitch);
-                sth->semi = 0;
-                sth->st->setPitchSemiTones(sth->semi);
-                sth->st->flush();
-                    
-            }
-
-        }
-        
-
-        return SWITCH_STATUS_FALSE;
-    }
-    return SWITCH_STATUS_SUCCESS;
+	switch_media_bug_t *bug;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+
+	if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
+		struct soundtouch_helper *sth = (struct soundtouch_helper *) switch_core_media_bug_get_user_data(bug);
+
+		if (sth) {
+			if (sth->literal) {
+				sth->literal = 0;
+				return SWITCH_STATUS_SUCCESS;
+			}
+
+
+			switch (dtmf->digit) {
+			case '*':
+				sth->literal++;
+				break;
+			case '3':
+				sth->semi += .5;
+				sth->st->setPitchSemiTones(sth->semi);
+				sth->st->flush();
+				break;
+			case '2':
+				sth->semi = 0;
+				sth->st->setPitchSemiTones(sth->semi);
+				sth->st->flush();
+				break;
+			case '1':
+				sth->semi -= .5;
+				sth->st->setPitchSemiTones(sth->semi);
+				sth->st->flush();
+				break;
+
+			case '6':
+				sth->pitch += .2;
+				sth->st->setPitch(sth->pitch);
+				sth->st->flush();
+				break;
+			case '5':
+				sth->pitch = 1;
+				sth->st->setPitch(sth->pitch);
+				sth->st->flush();
+				break;
+			case '4':
+				sth->pitch -= .2;
+				if (sth->pitch <= 0) {
+					sth->pitch = .2;
+				}
+				sth->st->setPitch(sth->pitch);
+				sth->st->flush();
+				break;
+
+			case '9':
+				sth->octaves += .2;
+				sth->st->setPitchOctaves(sth->octaves);
+				sth->st->flush();
+				break;
+			case '8':
+				sth->octaves = 0;
+				sth->st->setPitchOctaves(sth->octaves);
+				sth->st->flush();
+				break;
+			case '7':
+				sth->octaves -= .2;
+				sth->st->setPitchOctaves(sth->octaves);
+				sth->st->flush();
+				break;
+
+
+			case '0':
+				sth->octaves = 0;
+				sth->st->setPitchOctaves(sth->octaves);
+				sth->pitch = 1;
+				sth->st->setPitch(sth->pitch);
+				sth->semi = 0;
+				sth->st->setPitchSemiTones(sth->semi);
+				sth->st->flush();
+
+			}
+
+		}
+
+
+		return SWITCH_STATUS_FALSE;
+	}
+	return SWITCH_STATUS_SUCCESS;
 }
 
 
@@ -153,85 +153,85 @@
 
 	switch (type) {
 	case SWITCH_ABC_TYPE_INIT:
-        {
-            switch_codec_t *read_codec = switch_core_session_get_read_codec(sth->session);
-            sth->st = new SoundTouch();
-            sth->st->setSampleRate(read_codec->implementation->samples_per_second);
-            sth->st->setChannels(read_codec->implementation->number_of_channels);
-            
-            sth->st->setSetting(SETTING_USE_QUICKSEEK, 1);
-            sth->st->setSetting(SETTING_USE_AA_FILTER, 1);
-
-            if (sth->semi) {
-                sth->st->setPitchSemiTones(sth->semi);
-            }
-
-            if (sth->pitch) {
-                sth->st->setPitch(sth->pitch);
-            }
-
-            if (sth->octaves) {
-                sth->st->setPitchOctaves(sth->octaves);
-            }
-
-            if (sth->rate) {
-                sth->st->setRate(sth->rate);
-            }
-
-            if (sth->tempo) {
-                sth->st->setRate(sth->tempo);
-            }
-            
-            if (sth->send) {
-                switch_core_event_hook_add_send_dtmf(sth->session, on_dtmf);
-            } else {
-                switch_core_event_hook_add_recv_dtmf(sth->session, on_dtmf);
-            }
-        }
-        break;
+		{
+			switch_codec_t *read_codec = switch_core_session_get_read_codec(sth->session);
+			sth->st = new SoundTouch();
+			sth->st->setSampleRate(read_codec->implementation->samples_per_second);
+			sth->st->setChannels(read_codec->implementation->number_of_channels);
+
+			sth->st->setSetting(SETTING_USE_QUICKSEEK, 1);
+			sth->st->setSetting(SETTING_USE_AA_FILTER, 1);
+
+			if (sth->semi) {
+				sth->st->setPitchSemiTones(sth->semi);
+			}
+
+			if (sth->pitch) {
+				sth->st->setPitch(sth->pitch);
+			}
+
+			if (sth->octaves) {
+				sth->st->setPitchOctaves(sth->octaves);
+			}
+
+			if (sth->rate) {
+				sth->st->setRate(sth->rate);
+			}
+
+			if (sth->tempo) {
+				sth->st->setRate(sth->tempo);
+			}
+
+			if (sth->send) {
+				switch_core_event_hook_add_send_dtmf(sth->session, on_dtmf);
+			} else {
+				switch_core_event_hook_add_recv_dtmf(sth->session, on_dtmf);
+			}
+		}
+		break;
 	case SWITCH_ABC_TYPE_CLOSE:
-        {
-            delete sth->st;
-            if (sth->send) {
-                switch_core_event_hook_remove_send_dtmf(sth->session, on_dtmf);
-            } else {
-                switch_core_event_hook_remove_recv_dtmf(sth->session, on_dtmf);
-            }
-        }
+		{
+			delete sth->st;
+			if (sth->send) {
+				switch_core_event_hook_remove_send_dtmf(sth->session, on_dtmf);
+			} else {
+				switch_core_event_hook_remove_recv_dtmf(sth->session, on_dtmf);
+			}
+		}
 		break;
 	case SWITCH_ABC_TYPE_READ:
 	case SWITCH_ABC_TYPE_WRITE:
-        break;
+		break;
 	case SWITCH_ABC_TYPE_READ_REPLACE:
 	case SWITCH_ABC_TYPE_WRITE_REPLACE:
-        {
-            switch_frame_t *frame;
-            
-            assert(sth != NULL);
-            assert(sth->st != NULL);
-
-            if (sth->read) {
-                frame = switch_core_media_bug_get_read_replace_frame(bug);
-            } else {
-                frame = switch_core_media_bug_get_write_replace_frame(bug);
-            }
-
-            sth->st->putSamples((SAMPLETYPE *)frame->data, frame->samples);
-
-            if (sth->st->numSamples() >= frame->samples * 2) {
-                frame->samples = sth->st->receiveSamples((SAMPLETYPE *)frame->data, frame->samples);
-                frame->datalen = frame->samples * 2;
-            } else {
-                memset(frame->data, 0, frame->datalen);
-            }
-
-            if (sth->read) {
-                switch_core_media_bug_set_read_replace_frame(bug, frame);
-            } else {
-                switch_core_media_bug_set_write_replace_frame(bug, frame);
-            }
-            
-        }
+		{
+			switch_frame_t *frame;
+
+			assert(sth != NULL);
+			assert(sth->st != NULL);
+
+			if (sth->read) {
+				frame = switch_core_media_bug_get_read_replace_frame(bug);
+			} else {
+				frame = switch_core_media_bug_get_write_replace_frame(bug);
+			}
+
+			sth->st->putSamples((SAMPLETYPE *) frame->data, frame->samples);
+
+			if (sth->st->numSamples() >= frame->samples * 2) {
+				frame->samples = sth->st->receiveSamples((SAMPLETYPE *) frame->data, frame->samples);
+				frame->datalen = frame->samples * 2;
+			} else {
+				memset(frame->data, 0, frame->datalen);
+			}
+
+			if (sth->read) {
+				switch_core_media_bug_set_read_replace_frame(bug, frame);
+			} else {
+				switch_core_media_bug_set_write_replace_frame(bug, frame);
+			}
+
+		}
 	default:
 		break;
 	}
@@ -241,68 +241,68 @@
 
 SWITCH_STANDARD_APP(soundtouch_start_function)
 {
-    switch_media_bug_t *bug;
-    switch_status_t status;
-    switch_channel_t *channel = switch_core_session_get_channel(session);
-    struct soundtouch_helper *sth;
-    char *argv[6];
+	switch_media_bug_t *bug;
+	switch_status_t status;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	struct soundtouch_helper *sth;
+	char *argv[6];
 	int argc;
 	char *lbuf = NULL;
-    int x;
- 
-    if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
-        if (!switch_strlen_zero(data) && !strcasecmp(data, "stop")) {
-            switch_channel_set_private(channel, "_soundtouch_", NULL);
-            switch_core_media_bug_remove(session, &bug);
-        } else {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
-        }
-        return;
-    }
+	int x;
+
+	if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
+		if (!switch_strlen_zero(data) && !strcasecmp(data, "stop")) {
+			switch_channel_set_private(channel, "_soundtouch_", NULL);
+			switch_core_media_bug_remove(session, &bug);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
+		}
+		return;
+	}
 
-    sth = (struct soundtouch_helper *) switch_core_session_alloc(session, sizeof(*sth));
-    assert(sth != NULL);
+	sth = (struct soundtouch_helper *) switch_core_session_alloc(session, sizeof(*sth));
+	assert(sth != NULL);
 
 
 	if (data && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
-        sth->send = 0;
-        sth->read = 0;
-        sth->pitch = 1;
-        for(x = 0; x < argc; x++) {
-            if (!strncasecmp(argv[x], "send", 4)) {
-                sth->send = 1;
-            } else if (!strncasecmp(argv[x], "read", 4)) {
-                sth->read = 1;
-            } else if (strchr(argv[x], 'p')) {
-                if ((sth->pitch = atof(argv[x]) < 0)) {
-                    sth->pitch = 0;
-                }
-            } else if (strchr(argv[x], 'r')) {
-                sth->rate = atof(argv[x]);
-            } else if (strchr(argv[x], 'o')) {
-                sth->octaves = atof(argv[x]);
-            } else if (strchr(argv[x], 's')) {
-                sth->semi = atof(argv[x]);
-            } else if (strchr(argv[x], 't')) {
-                if ((sth->tempo = atof(argv[x]) < 0)) {
-                    sth->tempo = 0;
-                }
-            }
-        }
-    }
-    
-
-    sth->session = session;
-
-	if ((status = switch_core_media_bug_add(session, soundtouch_callback, sth, 0, 
-                                            sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure!\n");
+		sth->send = 0;
+		sth->read = 0;
+		sth->pitch = 1;
+		for (x = 0; x < argc; x++) {
+			if (!strncasecmp(argv[x], "send", 4)) {
+				sth->send = 1;
+			} else if (!strncasecmp(argv[x], "read", 4)) {
+				sth->read = 1;
+			} else if (strchr(argv[x], 'p')) {
+				if ((sth->pitch = atof(argv[x]) < 0)) {
+					sth->pitch = 0;
+				}
+			} else if (strchr(argv[x], 'r')) {
+				sth->rate = atof(argv[x]);
+			} else if (strchr(argv[x], 'o')) {
+				sth->octaves = atof(argv[x]);
+			} else if (strchr(argv[x], 's')) {
+				sth->semi = atof(argv[x]);
+			} else if (strchr(argv[x], 't')) {
+				if ((sth->tempo = atof(argv[x]) < 0)) {
+					sth->tempo = 0;
+				}
+			}
+		}
+	}
+
+
+	sth->session = session;
+
+	if ((status = switch_core_media_bug_add(session, soundtouch_callback, sth, 0,
+											sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure!\n");
 		return;
 	}
-    
+
 	switch_channel_set_private(channel, "_soundtouch_", bug);
-    
+
 }
 static switch_application_interface_t soundtouch_application_interface = {
 	/*.interface_name */ "soundtouch",
@@ -311,8 +311,8 @@
 	/* short_desc */ "Alter the audio stream",
 	/* syntax */ "[send|recv] [-]<X>s [.]<X>p",
 	/* flags */ SAF_NONE,
-    /* next*/ 
-    
+	/* next */
+
 };
 
 static switch_loadable_module_interface_t soundtouch_module_interface = {

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	Tue May 27 00:54:52 2008
@@ -35,7 +35,7 @@
 #include <switch_odbc.h>
 #endif
 
-#ifdef _MSC_VER /* compilers are stupid sometimes */
+#ifdef _MSC_VER					/* compilers are stupid sometimes */
 #define TRY_CODE(code) for(;;) {status = code; if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { goto end; } break;}
 #else
 #define TRY_CODE(code) do { status = code; if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { goto end; } break;} while(status)
@@ -62,7 +62,7 @@
 	char play_new_messages_key[2];
 	char play_saved_messages_key[2];
 
-	char main_menu_key[2];    
+	char main_menu_key[2];
 	char config_menu_key[2];
 	char record_greeting_key[2];
 	char choose_greeting_key[2];
@@ -141,7 +141,7 @@
 		switch_core_db_close(db);
 	}
 
-end:
+  end:
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
@@ -149,11 +149,7 @@
 }
 
 
-static switch_bool_t vm_execute_sql_callback(vm_profile_t *profile,
-											 switch_mutex_t *mutex,
-											 char *sql,
-											 switch_core_db_callback_func_t callback,
-											 void *pdata)
+static switch_bool_t vm_execute_sql_callback(vm_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
 	switch_bool_t ret = SWITCH_FALSE;
 	switch_core_db_t *db;
@@ -185,7 +181,7 @@
 		}
 	}
 
-end:
+  end:
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
@@ -196,26 +192,19 @@
 static char vm_sql[] =
 	"CREATE TABLE voicemail_msgs (\n"
 	"   created_epoch INTEGER,\n"
-	"   read_epoch    INTEGER,\n" 
-	"   username      VARCHAR(255),\n" 
-	"   domain        VARCHAR(255),\n" 
-	"   uuid          VARCHAR(255),\n" 
-	"   cid_name      VARCHAR(255),\n" 
-	"   cid_number    VARCHAR(255),\n" 
-	"   in_folder     VARCHAR(255),\n" 
-	"   file_path     VARCHAR(255),\n" 
-	"   message_len   INTEGER,\n" 
-	"   flags         VARCHAR(255),\n"
-	"   read_flags    VARCHAR(255)\n" 
-	");\n";
+	"   read_epoch    INTEGER,\n"
+	"   username      VARCHAR(255),\n"
+	"   domain        VARCHAR(255),\n"
+	"   uuid          VARCHAR(255),\n"
+	"   cid_name      VARCHAR(255),\n"
+	"   cid_number    VARCHAR(255),\n"
+	"   in_folder     VARCHAR(255),\n"
+	"   file_path     VARCHAR(255),\n" "   message_len   INTEGER,\n" "   flags         VARCHAR(255),\n" "   read_flags    VARCHAR(255)\n" ");\n";
 
 static char vm_pref_sql[] =
 	"CREATE TABLE voicemail_prefs (\n"
-	"   username        VARCHAR(255),\n" 
-	"   domain          VARCHAR(255),\n" 
-	"   name_path       VARCHAR(255),\n" 
-	"   greeting_path VARCHAR(255)\n" 
-	");\n";
+	"   username        VARCHAR(255),\n"
+	"   domain          VARCHAR(255),\n" "   name_path       VARCHAR(255),\n" "   greeting_path VARCHAR(255)\n" ");\n";
 
 static switch_status_t load_config(void)
 {
@@ -254,7 +243,7 @@
 		char *play_new_messages_key = "1";
 		char *play_saved_messages_key = "2";
 
-		char *main_menu_key = "0";    
+		char *main_menu_key = "0";
 		char *config_menu_key = "5";
 		char *record_greeting_key = "1";
 		char *choose_greeting_key = "2";
@@ -328,17 +317,14 @@
 					if (switch_is_file_path(val)) {
 						path = val;
 					} else {
-						dpath = switch_mprintf("%s%s%s", 
-							SWITCH_GLOBAL_dirs.conf_dir, 
-							SWITCH_PATH_SEPARATOR,
-							val);
+						dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, val);
 						path = dpath;
 					}
 
 					if ((fd = open(path, O_RDONLY)) > -1) {
 						char buf[2048];
 						SWITCH_STANDARD_STREAM(stream);
-						while(switch_fd_read_line(fd, buf, sizeof(buf))) {
+						while (switch_fd_read_line(fd, buf, sizeof(buf))) {
 							stream.write_function(&stream, "%s", buf);
 						}
 						close(fd);
@@ -373,17 +359,14 @@
 				if (switch_is_file_path(val)) {
 					path = val;
 				} else {
-					dpath = switch_mprintf("%s%s%s", 
-						SWITCH_GLOBAL_dirs.conf_dir, 
-						SWITCH_PATH_SEPARATOR,
-						val);
+					dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, val);
 					path = dpath;
 				}
 
 				if ((fd = open(path, O_RDONLY)) > -1) {
 					char buf[2048];
 					SWITCH_STANDARD_STREAM(stream);
-					while(switch_fd_read_line(fd, buf, sizeof(buf))) {
+					while (switch_fd_read_line(fd, buf, sizeof(buf))) {
 						stream.write_function(&stream, "%s", buf);
 					}
 					close(fd);
@@ -437,10 +420,10 @@
 				operator_key = val;
 			} else if (!strcasecmp(var, "operator-extension") && !switch_strlen_zero(val)) {
 				operator_ext = val;
-                        } else if (!strcasecmp(var, "vmain-key") && !switch_strlen_zero(val)) {
-                                vmain_key = val;
-                        } else if (!strcasecmp(var, "vmain-extension") && !switch_strlen_zero(val)) {
-                                vmain_ext = val;
+			} else if (!strcasecmp(var, "vmain-key") && !switch_strlen_zero(val)) {
+				vmain_key = val;
+			} else if (!strcasecmp(var, "vmain-extension") && !switch_strlen_zero(val)) {
+				vmain_ext = val;
 			} else if (!strcasecmp(var, "storage-dir") && !switch_strlen_zero(val)) {
 				storage_dir = val;
 			} else if (!strcasecmp(var, "callback-dialplan") && !switch_strlen_zero(val)) {
@@ -577,19 +560,18 @@
 					switch_odbc_handle_exec(profile->master_odbc, vm_pref_sql, NULL);
 				}
 
-                if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_data", NULL) == SWITCH_ODBC_SUCCESS) {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Old table voicemail_data found, migrating data!\n");
-                    /* XXX: Old table found.. migrating data into new table */
-                    if (switch_odbc_handle_exec(profile->master_odbc,
+				if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_data", NULL) == SWITCH_ODBC_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Old table voicemail_data found, migrating data!\n");
+					/* XXX: Old table found.. migrating data into new table */
+					if (switch_odbc_handle_exec(profile->master_odbc,
 												"insert into voicemail_msgs select created_epoch, read_epoch, user as username, domain, uuid,"
 												"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
 												NULL) != SWITCH_ODBC_SUCCESS) {
-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to migrate old voicemail_data to voicemail_msgs!\n");
-                        continue;
-                    }
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to migrate old voicemail_data to voicemail_msgs!\n");
+						continue;
+					}
 					switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_data", NULL);
-                }
-
+				}
 #endif
 			} else {
 				if ((db = switch_core_db_open_file(profile->dbname))) {
@@ -604,12 +586,12 @@
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Migrating data from voicemail_data to voicemail_msgs!\n");
 						switch_core_db_exec(db, "insert into voicemail_msgs select created_epoch, read_epoch, user as username, domain, uuid,"
 											"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
-										    NULL, NULL, &errmsg);
+											NULL, NULL, &errmsg);
 						if (errmsg) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
 							switch_core_db_free(errmsg);
 							errmsg = NULL;
-						} 
+						}
 						switch_core_db_exec(db, "drop table voicemail_data", NULL, NULL, &errmsg);
 						if (errmsg) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
@@ -625,7 +607,7 @@
 					continue;
 				}
 				switch_core_db_close(db);
-			}            
+			}
 
 			profile->web_head = web_head;
 			profile->web_tail = web_tail;
@@ -660,13 +642,13 @@
 			*profile->rew_key = *rew_key;
 			*profile->urgent_key = *urgent_key;
 			*profile->operator_key = *operator_key;
-                        *profile->vmain_key = *vmain_key;
+			*profile->vmain_key = *vmain_key;
 			profile->record_threshold = record_threshold;
 			profile->record_silence_hits = record_silence_hits;
 			profile->record_sample_rate = record_sample_rate;
 
 			profile->operator_ext = switch_core_strdup(globals.pool, operator_ext);
-                        profile->vmain_ext = switch_core_strdup(globals.pool, vmain_ext);
+			profile->vmain_ext = switch_core_strdup(globals.pool, vmain_ext);
 			profile->storage_dir = switch_core_strdup(globals.pool, storage_dir);
 			profile->tone_spec = switch_core_strdup(globals.pool, tone_spec);
 			profile->callback_dialplan = switch_core_strdup(globals.pool, callback_dialplan);
@@ -684,7 +666,7 @@
 		}
 	}
 
-end:
+  end:
 	switch_xml_free(xml);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -730,7 +712,9 @@
 			switch_file_handle_t *fh = cc->fh;
 			uint32_t pos = 0;
 
-			if (!cc->noexit && (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key || dtmf->digit == *cc->profile->terminator_key)) {
+			if (!cc->noexit
+				&& (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key
+					|| dtmf->digit == *cc->profile->terminator_key)) {
 				*cc->buf = dtmf->digit;
 				return SWITCH_STATUS_BREAK;
 			}
@@ -770,7 +754,7 @@
 		break;
 	default:
 		break;
-		}
+	}
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -834,12 +818,7 @@
 static switch_status_t vm_macro_get(switch_core_session_t *session,
 									char *macro,
 									char *macro_arg,
-									char *buf,
-									switch_size_t buflen,
-									switch_size_t maxlen,
-									char *term_chars,
-									char *terminator_key,
-									uint32_t timeout)
+									char *buf, switch_size_t buflen, switch_size_t maxlen, char *term_chars, char *terminator_key, uint32_t timeout)
 {
 	switch_input_args_t args = { 0 }, *ap = NULL;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -849,7 +828,7 @@
 		memset(buf, 0, buflen);
 		args.input_callback = cancel_on_dtmf;
 		args.buf = buf;
-		args.buflen = (uint32_t)buflen;
+		args.buflen = (uint32_t) buflen;
 		ap = &args;
 	}
 
@@ -869,7 +848,7 @@
 	bslen = strlen(buf);
 
 	if (maxlen == 0 || maxlen > buflen - 1) {
-		maxlen = buflen -1;
+		maxlen = buflen - 1;
 	}
 	if (bslen < maxlen) {
 		status = switch_ivr_collect_digits_count(session, buf + bslen, buflen, maxlen - bslen, term_chars, terminator_key, timeout, 0, 0);
@@ -913,29 +892,26 @@
 } msg_type_t;
 
 
-static switch_status_t create_file(switch_core_session_t *session, vm_profile_t *profile, 
-                                   char *macro_name, char *file_path, switch_size_t *message_len, switch_bool_t limit)
+static switch_status_t create_file(switch_core_session_t *session, vm_profile_t *profile,
+								   char *macro_name, char *file_path, switch_size_t *message_len, switch_bool_t limit)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_file_handle_t fh = { 0 };
 	switch_input_args_t args = { 0 };
 	char term;
-	char input[10] = "" , key_buf[80] = "";
+	char input[10] = "", key_buf[80] = "";
 	cc_t cc = { 0 };
 	switch_codec_t *read_codec;
 
 	read_codec = switch_core_session_get_read_codec(session);
 
-	while(switch_channel_ready(channel)) {
+	while (switch_channel_ready(channel)) {
 
-		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s", 
-			profile->listen_file_key,
-			profile->save_file_key,
-			profile->record_file_key);
+		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s", profile->listen_file_key, profile->save_file_key, profile->record_file_key);
 
-record_file:
-        *message_len = 0;
+	  record_file:
+		*message_len = 0;
 		args.input_callback = cancel_on_dtmf;
 		TRY_CODE(switch_ivr_phrase_macro(session, macro_name, NULL, NULL, NULL));
 		TRY_CODE(switch_ivr_gentones(session, profile->tone_spec, 0, NULL));
@@ -946,22 +922,22 @@
 		fh.samplerate = profile->record_sample_rate;
 		switch_ivr_record_file(session, &fh, file_path, &args, profile->max_record_len);
 		if (limit && (*message_len = fh.sample_count / read_codec->implementation->actual_samples_per_second) < profile->min_record_len) {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Message is less than minimum record length: %d, discarding it.\n", 
-                              profile->min_record_len);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Message is less than minimum record length: %d, discarding it.\n",
+							  profile->min_record_len);
 			if (unlink(file_path) != 0) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "failed to delete file [%s]\n", file_path);
 			}
-            if (switch_channel_ready(channel)) {
-                /* TODO Rel 1.0 : Add Playback of Prompt <message is too short, please rerecord your message>, then go back at record_file */
-                goto record_file;
-            } else {
-                status = SWITCH_STATUS_BREAK;
-                goto end;
-            }
-        } else {
-            status = SWITCH_STATUS_SUCCESS;
-        }
-play_file:
+			if (switch_channel_ready(channel)) {
+				/* TODO Rel 1.0 : Add Playback of Prompt <message is too short, please rerecord your message>, then go back at record_file */
+				goto record_file;
+			} else {
+				status = SWITCH_STATUS_BREAK;
+				goto end;
+			}
+		} else {
+			status = SWITCH_STATUS_SUCCESS;
+		}
+	  play_file:
 		memset(&fh, 0, sizeof(fh));
 		args.input_callback = control_playback;
 		memset(&cc, 0, sizeof(cc));
@@ -970,15 +946,14 @@
 		args.buf = &cc;
 		switch_ivr_play_file(session, &fh, file_path, &args);
 
-		while(switch_channel_ready(channel)) {
+		while (switch_channel_ready(channel)) {
 			if (*cc.buf) {
 				*input = *cc.buf;
-				*(input+1) = '\0';
+				*(input + 1) = '\0';
 				status = SWITCH_STATUS_SUCCESS;
 				*cc.buf = '\0';
 			} else {
-				status = vm_macro_get(session, VM_RECORD_FILE_CHECK_MACRO, 
-					key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
+				status = vm_macro_get(session, VM_RECORD_FILE_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
 			}
 
 			if (!strcmp(input, profile->listen_file_key)) {
@@ -992,7 +967,7 @@
 		}
 	}
 
-end:
+  end:
 	return status;
 }
 
@@ -1042,7 +1017,7 @@
 }
 
 
-static void message_count(vm_profile_t *profile, const char *myid, const char *domain_name, char *myfolder, 
+static void message_count(vm_profile_t *profile, const char *myid, const char *domain_name, char *myfolder,
 						  int *total_new_messages, int *total_saved_messages, int *total_new_urgent_messages, int *total_saved_urgent_messages)
 {
 	char msg_count[80] = "";
@@ -1052,37 +1027,27 @@
 	cbt.buf = msg_count;
 	cbt.len = sizeof(msg_count);
 
-	switch_snprintf(sql, sizeof(sql), 
-		"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0", 
-		myid,
-		domain_name,
-		myfolder);
+	switch_snprintf(sql, sizeof(sql),
+					"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0",
+					myid, domain_name, myfolder);
 	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
 	*total_new_messages = atoi(msg_count);
 
-	switch_snprintf(sql, sizeof(sql), 
-		"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0 and read_flags='%s'", 
-		myid,
-		domain_name,
-		myfolder, 
-		URGENT_FLAG_STRING);
+	switch_snprintf(sql, sizeof(sql),
+					"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0 and read_flags='%s'",
+					myid, domain_name, myfolder, URGENT_FLAG_STRING);
 	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
 	*total_new_urgent_messages = atoi(msg_count);
 
-	switch_snprintf(sql, sizeof(sql), 
-		"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0", 
-		myid,
-		domain_name,
-		myfolder);
+	switch_snprintf(sql, sizeof(sql),
+					"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0",
+					myid, domain_name, myfolder);
 	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
 	*total_saved_messages = atoi(msg_count);
 
-	switch_snprintf(sql, sizeof(sql), 
-		"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0 and read_flags='%s'", 
-		myid,
-		domain_name,
-		myfolder,
-		URGENT_FLAG_STRING);
+	switch_snprintf(sql, sizeof(sql),
+					"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0 and read_flags='%s'",
+					myid, domain_name, myfolder, URGENT_FLAG_STRING);
 	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
 	*total_saved_urgent_messages = atoi(msg_count);
 }
@@ -1094,7 +1059,7 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_input_args_t args = { 0 };
 	char term;
-	char input[10] = "" , key_buf[80] = "";
+	char input[10] = "", key_buf[80] = "";
 	switch_file_handle_t fh = { 0 };
 	cc_t cc = { 0 };
 
@@ -1102,14 +1067,10 @@
 
 		args.input_callback = cancel_on_dtmf;
 
-		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s", 
-			profile->listen_file_key,
-			profile->save_file_key,
-			profile->delete_file_key,
-			profile->email_key,
-			profile->callback_key);
+		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s",
+						profile->listen_file_key, profile->save_file_key, profile->delete_file_key, profile->email_key, profile->callback_key);
 
-		switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want+1);
+		switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want + 1);
 		memset(&cc, 0, sizeof(cc));
 		cc.profile = profile;
 		args.buf = &cc;
@@ -1118,7 +1079,7 @@
 		if (!*cc.buf) {
 			TRY_CODE(switch_ivr_phrase_macro(session, VM_SAY_DATE_MACRO, cbt->created_epoch, NULL, &args));
 		}
-play_file:
+	  play_file:
 
 		if (!*cc.buf) {
 			memset(&fh, 0, sizeof(fh));
@@ -1133,12 +1094,11 @@
 		if (switch_channel_ready(channel)) {
 			if (*cc.buf) {
 				*input = *cc.buf;
-				*(input+1) = '\0';
+				*(input + 1) = '\0';
 				status = SWITCH_STATUS_SUCCESS;
 				*cc.buf = '\0';
 			} else {
-				status = vm_macro_get(session, VM_LISTEN_FILE_CHECK_MACRO, 
-					key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
+				status = vm_macro_get(session, VM_LISTEN_FILE_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
 			}
 			if (!strcmp(input, profile->listen_file_key)) {
 				goto play_file;
@@ -1157,7 +1117,7 @@
 					switch_size_t retsize;
 					switch_time_exp_t tm;
 					char date[80] = "";
-					char tmp[50]="";
+					char tmp[50] = "";
 					int total_new_messages = 0;
 					int total_saved_messages = 0;
 					int total_new_urgent_messages = 0;
@@ -1173,18 +1133,18 @@
 					}
 
 					message_count(profile, cbt->user, cbt->domain, cbt->in_folder, &total_new_messages, &total_saved_messages,
-						&total_new_urgent_messages, &total_saved_urgent_messages);
+								  &total_new_urgent_messages, &total_saved_urgent_messages);
 
 					switch_time_exp_lt(&tm, atoi(cbt->created_epoch) * 1000000);
 					switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
 
-					switch_snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
+					switch_snprintf(tmp, sizeof(tmp), "%d", total_new_messages);
 					switch_channel_set_variable(channel, "voicemail_total_new_messages", tmp);
-					switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
+					switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_messages);
 					switch_channel_set_variable(channel, "voicemail_total_saved_messages", tmp);
-					switch_snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
+					switch_snprintf(tmp, sizeof(tmp), "%d", total_new_urgent_messages);
 					switch_channel_set_variable(channel, "voicemail_urgent_new_messages", tmp);
-					switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
+					switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_urgent_messages);
 					switch_channel_set_variable(channel, "voicemail_urgent_saved_messages", tmp);
 					switch_channel_set_variable(channel, "voicemail_current_folder", cbt->in_folder);
 					switch_channel_set_variable(channel, "voicemail_account", cbt->user);
@@ -1194,7 +1154,7 @@
 					switch_channel_set_variable(channel, "voicemail_file_path", cbt->file_path);
 					switch_channel_set_variable(channel, "voicemail_read_flags", cbt->read_flags);
 					switch_channel_set_variable(channel, "voicemail_time", date);
-					switch_snprintf(tmp,sizeof(tmp), "%d", priority);
+					switch_snprintf(tmp, sizeof(tmp), "%d", priority);
 					switch_channel_set_variable(channel, "voicemail_priority", tmp);
 					message_len = atoi(cbt->message_len);
 
@@ -1203,11 +1163,7 @@
 					duration.day += duration.yr * 365;
 					duration.hr += duration.day * 24;
 
-					switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
-						duration.hr,
-						duration.min,
-						duration.sec
-						);
+					switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
 
 					switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
 					switch_channel_set_variable(channel, "voicemail_email", cbt->email);
@@ -1215,20 +1171,20 @@
 					if (switch_strlen_zero(profile->email_headers)) {
 						from = switch_core_session_sprintf(session, "%s@%s", cbt->user, cbt->domain);
 					} else {
-						from = switch_channel_expand_variables(channel,profile->email_from);
+						from = switch_channel_expand_variables(channel, profile->email_from);
 					}
 
 					if (switch_strlen_zero(profile->email_headers)) {
-						headers = switch_core_session_sprintf(session, 
-							"From: FreeSWITCH mod_voicemail <%s@%s>\nSubject: Voicemail from %s %s\nX-Priority: %d", 
-							cbt->user, cbt->domain, cbt->cid_name, cbt->cid_number, priority);
+						headers = switch_core_session_sprintf(session,
+															  "From: FreeSWITCH mod_voicemail <%s@%s>\nSubject: Voicemail from %s %s\nX-Priority: %d",
+															  cbt->user, cbt->domain, cbt->cid_name, cbt->cid_number, priority);
 					} else {
-						headers = switch_channel_expand_variables(channel,profile->email_headers);
+						headers = switch_channel_expand_variables(channel, profile->email_headers);
 					}
 
 					p = headers + (strlen(headers) - 1);
 					if (*p == '\n') {
-						if (*(p-1) == '\r') {
+						if (*(p - 1) == '\r') {
 							p--;
 						}
 						*p = '\0';
@@ -1238,8 +1194,8 @@
 
 					if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
 						/* this isnt done?  it was in the other place
-						* switch_channel_event_set_data(channel, event);
-						*/
+						 * switch_channel_event_set_data(channel, event);
+						 */
 						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Type", "forwarded-voicemail");
 						switch_event_fire(&event);
 					}
@@ -1247,8 +1203,7 @@
 					if (profile->email_body) {
 						body = switch_channel_expand_variables(channel, profile->email_body);
 					} else {
-						body = switch_mprintf("%u second Voicemail from %s %s", message_len, 
-							cbt->cid_name, cbt->cid_number);
+						body = switch_mprintf("%u second Voicemail from %s %s", message_len, cbt->cid_name, cbt->cid_number);
 					}
 
 					switch_simple_email(cbt->email, from, header_string, body, cbt->file_path);
@@ -1267,7 +1222,7 @@
 		}
 	}
 
-end:
+  end:
 
 	return status;
 }
@@ -1307,413 +1262,407 @@
 	args.buflen = sizeof(foo);
 	status = switch_ivr_phrase_macro(session, VM_HELLO_MACRO, NULL, NULL, &args);
 
-	while(switch_channel_ready(channel)) {
+	while (switch_channel_ready(channel)) {
 		switch_ivr_sleep(session, 100);
 
-		switch(vm_check_state) {
-case VM_CHECK_START:
-	{
-		total_new_messages = 0;
-		total_saved_messages = 0;
-		total_new_urgent_messages = 0;
-		total_saved_urgent_messages = 0;
-		heard_auto_saved = 0;
-		heard_auto_new = 0;
-		play_msg_type = MSG_NONE;
-		attempts = profile->max_login_attempts;
-		myid = id;
-		mypass = NULL;
-		myfolder = "inbox";
-		vm_check_state = VM_CHECK_AUTH;
-		if (x_domain_root) {
-			switch_xml_free(x_domain_root);
-		}
-		x_user = x_domain = x_domain_root = NULL;
-	}
-	break;
-case VM_CHECK_FOLDER_SUMMARY:
-	{
-		int informed = 0;
-		char msg_count[80] = "";
+		switch (vm_check_state) {
+		case VM_CHECK_START:
+			{
+				total_new_messages = 0;
+				total_saved_messages = 0;
+				total_new_urgent_messages = 0;
+				total_saved_urgent_messages = 0;
+				heard_auto_saved = 0;
+				heard_auto_new = 0;
+				play_msg_type = MSG_NONE;
+				attempts = profile->max_login_attempts;
+				myid = id;
+				mypass = NULL;
+				myfolder = "inbox";
+				vm_check_state = VM_CHECK_AUTH;
+				if (x_domain_root) {
+					switch_xml_free(x_domain_root);
+				}
+				x_user = x_domain = x_domain_root = NULL;
+			}
+			break;
+		case VM_CHECK_FOLDER_SUMMARY:
+			{
+				int informed = 0;
+				char msg_count[80] = "";
 
-		switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
-		message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages, 
-			&total_new_urgent_messages, &total_saved_urgent_messages);
+				switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
+				message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
+							  &total_new_urgent_messages, &total_saved_urgent_messages);
 
-		if (total_new_urgent_messages > 0) {
-			switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
-			TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
-			informed++;
-		}
-		if (total_new_messages > 0 && total_new_messages != total_new_urgent_messages) {
-			switch_snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
-			TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
-			informed++;
-		}
+				if (total_new_urgent_messages > 0) {
+					switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
+					TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+					informed++;
+				}
+				if (total_new_messages > 0 && total_new_messages != total_new_urgent_messages) {
+					switch_snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
+					TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+					informed++;
+				}
 
-		if (!heard_auto_new && total_new_messages + total_new_urgent_messages> 0) {
-			heard_auto_new = 1;
-			play_msg_type = MSG_NEW;
-			vm_check_state = VM_CHECK_PLAY_MESSAGES;
-			continue;
-		}
+				if (!heard_auto_new && total_new_messages + total_new_urgent_messages > 0) {
+					heard_auto_new = 1;
+					play_msg_type = MSG_NEW;
+					vm_check_state = VM_CHECK_PLAY_MESSAGES;
+					continue;
+				}
 
-		if (total_saved_urgent_messages > 0) {
-			switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-saved", total_saved_urgent_messages);
-			TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
-			informed++;
-		}
+				if (total_saved_urgent_messages > 0) {
+					switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-saved", total_saved_urgent_messages);
+					TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+					informed++;
+				}
+
+				if (total_saved_messages > 0 && total_saved_messages != total_saved_urgent_messages) {
+					switch_snprintf(msg_count, sizeof(msg_count), "%d:saved", total_saved_messages);
+					TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+					informed++;
+				}
+
+				if (!heard_auto_saved && total_saved_messages + total_saved_urgent_messages > 0) {
+					heard_auto_saved = 1;
+					play_msg_type = MSG_SAVED;
+					vm_check_state = VM_CHECK_PLAY_MESSAGES;
+					continue;
+				}
 
-		if (total_saved_messages > 0 && total_saved_messages != total_saved_urgent_messages) {
-			switch_snprintf(msg_count, sizeof(msg_count), "%d:saved", total_saved_messages);
-			TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
-			informed++;
-		}
+				if (!informed) {
+					switch_snprintf(msg_count, sizeof(msg_count), "0:new");
+					TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+					informed++;
+				}
 
-		if (!heard_auto_saved && total_saved_messages + total_saved_urgent_messages> 0) {
-			heard_auto_saved = 1;
-			play_msg_type = MSG_SAVED;
-			vm_check_state = VM_CHECK_PLAY_MESSAGES;
-			continue;
-		}
+				vm_check_state = VM_CHECK_MENU;
+			}
+			break;
+		case VM_CHECK_PLAY_MESSAGES:
+			{
+				listen_callback_t cbt;
+				char sql[256];
+				int cur_message, total_messages;
+				switch_event_t *event;
 
-		if (!informed) {
-			switch_snprintf(msg_count, sizeof(msg_count), "0:new");
-			TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
-			informed++;
-		}
+				message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
+							  &total_new_urgent_messages, &total_saved_urgent_messages);
+				memset(&cbt, 0, sizeof(cbt));
+				cbt.email = email_vm;
+				switch (play_msg_type) {
+				case MSG_NEW:
+					{
+						switch_snprintf(sql, sizeof(sql),
+										"select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch=0 order by read_flags", myid,
+										domain_name);
+						total_messages = total_new_messages;
+						heard_auto_new = heard_auto_saved = 1;
+					}
+					break;
+				case MSG_SAVED:
+				default:
+					{
+						switch_snprintf(sql, sizeof(sql),
+										"select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch !=0 order by read_flags", myid,
+										domain_name);
+						total_messages = total_saved_messages;
+						heard_auto_new = heard_auto_saved = 1;
+					}
+					break;
+				}
+				for (cur_message = 0; cur_message < total_messages; cur_message++) {
+					cbt.index = 0;
+					cbt.want = cur_message;
+					cbt.type = play_msg_type;
+					vm_execute_sql_callback(profile, profile->mutex, sql, listen_callback, &cbt);
+					status = listen_file(session, profile, &cbt);
+					if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+						break;
+					}
+				}
+				switch_snprintf(sql, sizeof(sql), "update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and flags='save'",
+								(long) switch_timestamp(NULL), myid, domain_name);
+				vm_execute_sql(profile, sql, profile->mutex);
+				switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid,
+								domain_name);
+				vm_execute_sql_callback(profile, profile->mutex, sql, unlink_callback, NULL);
+				switch_snprintf(sql, sizeof(sql), "delete from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid, domain_name);
+				vm_execute_sql(profile, sql, profile->mutex);
+				vm_check_state = VM_CHECK_FOLDER_SUMMARY;
 
-		vm_check_state = VM_CHECK_MENU;
-	}
-	break;
-case VM_CHECK_PLAY_MESSAGES:
-	{
-		listen_callback_t cbt;
-		char sql[256];
-		int cur_message, total_messages;
-		switch_event_t *event;
+				message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
+							  &total_new_urgent_messages, &total_saved_urgent_messages);
 
-		message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages, 
-			&total_new_urgent_messages, &total_saved_urgent_messages);
-		memset(&cbt, 0, sizeof(cbt));
-		cbt.email = email_vm;
-		switch(play_msg_type) {
-case MSG_NEW:
-	{
-		switch_snprintf(sql, sizeof(sql),
-			"select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch=0 order by read_flags", myid, domain_name);
-		total_messages = total_new_messages;
-		heard_auto_new = heard_auto_saved = 1;
-	}
-	break;
-case MSG_SAVED:
-default:
-	{
-		switch_snprintf(sql, sizeof(sql),
-			"select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch !=0 order by read_flags", myid, domain_name);
-		total_messages = total_saved_messages;
-		heard_auto_new = heard_auto_saved = 1;                        
-	}
-	break;
-		}
-		for (cur_message = 0; cur_message < total_messages; cur_message++) {
-			cbt.index = 0;
-			cbt.want = cur_message;
-			cbt.type = play_msg_type;
-			vm_execute_sql_callback(profile, profile->mutex, sql, listen_callback, &cbt);
-			status = listen_file(session, profile, &cbt);
-			if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
-				break;
+				if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
+					char *mwi_id;
+					const char *yn = "no";
+					if (total_new_messages || total_new_urgent_messages) {
+						yn = "yes";
+					}
+					mwi_id = switch_mprintf("%s@%s", myid, domain_name);
+					switch_assert(mwi_id);
+					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
+					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
+					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
+											total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+					switch_event_fire(&event);
+					switch_safe_free(mwi_id);
+				}
 			}
-		}
-		switch_snprintf(sql, sizeof(sql), "update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and flags='save'", 
-			(long)switch_timestamp(NULL), myid, domain_name);
-		vm_execute_sql(profile, sql, profile->mutex);
-		switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid, domain_name);
-		vm_execute_sql_callback(profile, profile->mutex, sql, unlink_callback, NULL);
-		switch_snprintf(sql, sizeof(sql), "delete from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid, domain_name);
-		vm_execute_sql(profile, sql, profile->mutex);
-		vm_check_state = VM_CHECK_FOLDER_SUMMARY;
+			break;
+		case VM_CHECK_CONFIG:
+			{
+				char *sql = NULL;
+				char input[10] = "";
+				char key_buf[80] = "";
+				callback_t cbt = { 0 };
+				char msg_count[80] = "";
+				cc_t cc = { 0 };
+				switch_size_t message_len = 0;
+
+				cbt.buf = msg_count;
+				cbt.len = sizeof(msg_count);
+				sql = switch_mprintf("select count(*) from voicemail_prefs where username='%q' and domain = '%q'", myid, domain_name);
+				vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
+				switch_safe_free(sql);
+				if (*msg_count == '\0' || !atoi(msg_count)) {
+					sql = switch_mprintf("insert into voicemail_prefs values('%q','%q','','')", myid, domain_name);
+					vm_execute_sql(profile, sql, profile->mutex);
+					switch_safe_free(sql);
+				}
 
-		message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
-			&total_new_urgent_messages, &total_saved_urgent_messages);
+				switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
+								profile->record_greeting_key, profile->choose_greeting_key, profile->record_name_key, profile->main_menu_key);
 
-		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
-			char *mwi_id;
-			const char *yn = "no";
-			if (total_new_messages || total_new_urgent_messages ) {
-				yn = "yes";
-			}
-			mwi_id = switch_mprintf("%s@%s", myid, domain_name);
-			switch_assert(mwi_id);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", 
-				total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
-			switch_event_fire(&event);
-			switch_safe_free(mwi_id);
-		} 
-	}
-	break;
-case VM_CHECK_CONFIG:
-	{
-		char *sql = NULL;
-		char input[10] = "";
-		char key_buf[80] = "";
-		callback_t cbt = { 0 };
-		char msg_count[80] = "";
-		cc_t cc = { 0 };
-		switch_size_t message_len = 0;
-
-		cbt.buf = msg_count;
-		cbt.len = sizeof(msg_count);
-		sql = switch_mprintf("select count(*) from voicemail_prefs where username='%q' and domain = '%q'", myid, domain_name);
-		vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
-		switch_safe_free(sql);
-		if (*msg_count == '\0' || !atoi(msg_count)) {
-			sql = switch_mprintf("insert into voicemail_prefs values('%q','%q','','')", myid, domain_name);
-			vm_execute_sql(profile, sql, profile->mutex);
-			switch_safe_free(sql);
-		}
-
-		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s", 
-			profile->record_greeting_key, 
-			profile->choose_greeting_key, 
-			profile->record_name_key,
-			profile->main_menu_key);
 
+				TRY_CODE(vm_macro_get(session, VM_CONFIG_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
+				if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+					goto end;
+				}
 
-		TRY_CODE(vm_macro_get(session, VM_CONFIG_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
-		if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
-			goto end;
-		}
+				if (!strcmp(input, profile->main_menu_key)) {
+					vm_check_state = VM_CHECK_MENU;
+				} else if (!strcmp(input, profile->choose_greeting_key)) {
+					int num;
+					switch_input_args_t greeting_args = { 0 };
+					greeting_args.input_callback = cancel_on_dtmf;
+
+					TRY_CODE(vm_macro_get(session, VM_CHOOSE_GREETING_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
 
-		if (!strcmp(input, profile->main_menu_key)) {
-			vm_check_state = VM_CHECK_MENU;
-		} else if (!strcmp(input, profile->choose_greeting_key)) {
-			int num;
-			switch_input_args_t greeting_args = { 0 };
-			greeting_args.input_callback = cancel_on_dtmf;
-
-			TRY_CODE(vm_macro_get(session, VM_CHOOSE_GREETING_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
 
+					num = atoi(input);
+					file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext);
+					if (num < 1 || num > VM_MAX_GREETINGS) {
+						status = SWITCH_STATUS_FALSE;
+					} else {
+						switch_file_handle_t fh = { 0 };
+						memset(&fh, 0, sizeof(fh));
+						greeting_args.input_callback = control_playback;
+						memset(&cc, 0, sizeof(cc));
+						cc.profile = profile;
+						cc.fh = &fh;
+						cc.noexit = 1;
+						greeting_args.buf = &cc;
+						status = switch_ivr_play_file(session, NULL, file_path, &greeting_args);
+					}
+					if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+						TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
+					} else {
+						TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_SELECTED_MACRO, input, NULL, NULL));
+						sql =
+							switch_mprintf("update voicemail_prefs set greeting_path='%s' where username='%s' and domain='%s'", file_path, myid,
+										   domain_name);
+						vm_execute_sql(profile, sql, profile->mutex);
+						switch_safe_free(sql);
+					}
+					switch_safe_free(file_path);
+				} else if (!strcmp(input, profile->record_greeting_key)) {
+					int num;
+					TRY_CODE(vm_macro_get(session, VM_CHOOSE_GREETING_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
+
+					num = atoi(input);
+					if (num < 1 || num > VM_MAX_GREETINGS) {
+						TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
+					} else {
+						file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext);
+						TRY_CODE(create_file(session, profile, VM_RECORD_GREETING_MACRO, file_path, &message_len, SWITCH_TRUE));
+						sql =
+							switch_mprintf("update voicemail_prefs set greeting_path='%s' where username='%s' and domain='%s'", file_path, myid,
+										   domain_name);
+						vm_execute_sql(profile, sql, profile->mutex);
+						switch_safe_free(sql);
+						switch_safe_free(file_path);
+					}
 
-			num = atoi(input);
-			file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext);
-			if (num < 1 || num > VM_MAX_GREETINGS) {
-				status = SWITCH_STATUS_FALSE;
-			} else {
-				switch_file_handle_t fh = { 0 };
-				memset(&fh, 0, sizeof(fh));
-				greeting_args.input_callback = control_playback;
-				memset(&cc, 0, sizeof(cc));
-				cc.profile = profile;
-				cc.fh = &fh;
-				cc.noexit = 1;
-				greeting_args.buf = &cc;
-				status = switch_ivr_play_file(session, NULL, file_path, &greeting_args);
-			}
-			if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
-				TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
-			} else {
-				TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_SELECTED_MACRO, input, NULL, NULL));
-				sql = switch_mprintf("update voicemail_prefs set greeting_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name);
-				vm_execute_sql(profile, sql, profile->mutex);
-				switch_safe_free(sql);
-			}
-			switch_safe_free(file_path);
-		} else if (!strcmp(input, profile->record_greeting_key)) {
-			int num;
-			TRY_CODE(vm_macro_get(session, VM_CHOOSE_GREETING_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
-
-			num = atoi(input);
-			if (num < 1 || num > VM_MAX_GREETINGS) {
-				TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
-			} else {
-				file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext);
-				TRY_CODE(create_file(session, profile, VM_RECORD_GREETING_MACRO, file_path, &message_len, SWITCH_TRUE));
-				sql = switch_mprintf("update voicemail_prefs set greeting_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name);
-				vm_execute_sql(profile, sql, profile->mutex);
-				switch_safe_free(sql);
-				switch_safe_free(file_path);
+				} else if (!strcmp(input, profile->record_name_key)) {
+					file_path = switch_mprintf("%s%srecorded_name.%s", dir_path, SWITCH_PATH_SEPARATOR, profile->file_ext);
+					TRY_CODE(create_file(session, profile, VM_RECORD_NAME_MACRO, file_path, &message_len, SWITCH_FALSE));
+					sql = switch_mprintf("update voicemail_prefs set name_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name);
+					vm_execute_sql(profile, sql, profile->mutex);
+					switch_safe_free(file_path);
+					switch_safe_free(sql);
+				}
+				continue;
 			}
+			break;
+		case VM_CHECK_MENU:
+			{
+				char input[10] = "";
+				char key_buf[80] = "";
+				play_msg_type = MSG_NONE;
 
-		} else if (!strcmp(input, profile->record_name_key)) {
-			file_path = switch_mprintf("%s%srecorded_name.%s", dir_path, SWITCH_PATH_SEPARATOR, profile->file_ext);
-			TRY_CODE(create_file(session, profile, VM_RECORD_NAME_MACRO, file_path, &message_len, SWITCH_FALSE));
-			sql = switch_mprintf("update voicemail_prefs set name_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name);
-			vm_execute_sql(profile, sql, profile->mutex);
-			switch_safe_free(file_path);
-			switch_safe_free(sql);
-		}
-		continue;
-	}
-	break;
-case VM_CHECK_MENU:
-	{
-		char input[10] = "";
-		char key_buf[80] = "";
-		play_msg_type = MSG_NONE;
-
-		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s", 
-			profile->play_new_messages_key, 
-			profile->play_saved_messages_key,
-			profile->config_menu_key,
-			profile->terminator_key);
+				switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
+								profile->play_new_messages_key, profile->play_saved_messages_key, profile->config_menu_key, profile->terminator_key);
 
-		status = vm_macro_get(session, VM_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout);
+				status = vm_macro_get(session, VM_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout);
 
-		if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
-			goto end;
-		}
+				if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+					goto end;
+				}
 
-		if (!strcmp(input, profile->play_new_messages_key)) {
-			play_msg_type = MSG_NEW;
-		} else if (!strcmp(input, profile->play_saved_messages_key)) {
-			play_msg_type = MSG_SAVED;
-		} else if (!strcmp(input, profile->terminator_key)) {
-			goto end;
-		} else if (!strcmp(input, profile->config_menu_key)) {
-			vm_check_state = VM_CHECK_CONFIG;
-		}
+				if (!strcmp(input, profile->play_new_messages_key)) {
+					play_msg_type = MSG_NEW;
+				} else if (!strcmp(input, profile->play_saved_messages_key)) {
+					play_msg_type = MSG_SAVED;
+				} else if (!strcmp(input, profile->terminator_key)) {
+					goto end;
+				} else if (!strcmp(input, profile->config_menu_key)) {
+					vm_check_state = VM_CHECK_CONFIG;
+				}
 
-		if (play_msg_type) {
-			vm_check_state = VM_CHECK_PLAY_MESSAGES;
-		}
+				if (play_msg_type) {
+					vm_check_state = VM_CHECK_PLAY_MESSAGES;
+				}
 
-		continue;
-	}
-	break;
-case VM_CHECK_AUTH:
-	{
-		if (!attempts) {
-			failed = 1;
-			goto end;
-		}
+				continue;
+			}
+			break;
+		case VM_CHECK_AUTH:
+			{
+				if (!attempts) {
+					failed = 1;
+					goto end;
+				}
 
-		attempts--;
+				attempts--;
 
-		if (!myid) {
-			status = vm_macro_get(session, VM_ENTER_ID_MACRO, profile->terminator_key, id_buf, sizeof(id_buf), 0, 
-				profile->terminator_key, &term, timeout);
-			if (status != SWITCH_STATUS_SUCCESS) {
-				goto end;
-			}
+				if (!myid) {
+					status = vm_macro_get(session, VM_ENTER_ID_MACRO, profile->terminator_key, id_buf, sizeof(id_buf), 0,
+										  profile->terminator_key, &term, timeout);
+					if (status != SWITCH_STATUS_SUCCESS) {
+						goto end;
+					}
 
-			if (*id_buf == '\0') {
-				continue;
-			} else {
-				myid = id_buf;
-			} 
-		}
+					if (*id_buf == '\0') {
+						continue;
+					} else {
+						myid = id_buf;
+					}
+				}
 
-		if (!x_user) {
-            switch_event_t *params;
-			int ok = 1;
-			caller_profile = switch_channel_get_caller_profile(channel);
-
-            switch_event_create(&params, SWITCH_EVENT_MESSAGE);
-            switch_assert(params);
-            switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", myid);
-            switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "destination_number", caller_profile->destination_number);
-            switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "caller_id_number", caller_profile->caller_id_number);
-            
-            
-			if (switch_xml_locate_user("id", myid, domain_name, switch_channel_get_variable(channel, "network_addr"), 
-                                       &x_domain_root, &x_domain, &x_user, params) != SWITCH_STATUS_SUCCESS) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", myid, domain_name);
-                ok = 0;
-			}
-            
-            switch_event_destroy(&params);
+				if (!x_user) {
+					switch_event_t *params;
+					int ok = 1;
+					caller_profile = switch_channel_get_caller_profile(channel);
+
+					switch_event_create(&params, SWITCH_EVENT_MESSAGE);
+					switch_assert(params);
+					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", myid);
+					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "destination_number", caller_profile->destination_number);
+					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "caller_id_number", caller_profile->caller_id_number);
+
+
+					if (switch_xml_locate_user("id", myid, domain_name, switch_channel_get_variable(channel, "network_addr"),
+											   &x_domain_root, &x_domain, &x_user, params) != SWITCH_STATUS_SUCCESS) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", myid, domain_name);
+						ok = 0;
+					}
 
-			if (!ok) {
-				goto end;
-			}
-		}
+					switch_event_destroy(&params);
 
-		if (!mypass) {
-			if (auth) {
-				mypass = "OK";
-			} else {
-				status = vm_macro_get(session, VM_ENTER_PASS_MACRO, profile->terminator_key, 
-					pass_buf, sizeof(pass_buf), 0, profile->terminator_key, &term, timeout);
-				if (status != SWITCH_STATUS_SUCCESS) {
-					goto end;
+					if (!ok) {
+						goto end;
+					}
 				}
-				if (*pass_buf == '\0') {
-					continue;
-				} else {
-					mypass = pass_buf;
+
+				if (!mypass) {
+					if (auth) {
+						mypass = "OK";
+					} else {
+						status = vm_macro_get(session, VM_ENTER_PASS_MACRO, profile->terminator_key,
+											  pass_buf, sizeof(pass_buf), 0, profile->terminator_key, &term, timeout);
+						if (status != SWITCH_STATUS_SUCCESS) {
+							goto end;
+						}
+						if (*pass_buf == '\0') {
+							continue;
+						} else {
+							mypass = pass_buf;
+						}
+					}
 				}
-			}
-		}
 
-		if (!(x_params = switch_xml_child(x_user, "params"))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", myid, domain_name);
-			goto failed;
-		}
+				if (!(x_params = switch_xml_child(x_user, "params"))) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", myid, domain_name);
+					goto failed;
+				}
+
+				thepass = NULL;
+				for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+					const char *var = switch_xml_attr_soft(x_param, "name");
+					const char *val = switch_xml_attr_soft(x_param, "value");
+
+					if (!strcasecmp(var, "password")) {
+						thepass = val;
+					} else if (!strcasecmp(var, "vm-password")) {
+						thepass = val;
+					} else if (!strcasecmp(var, "vm-mailto")) {
+						email_vm = switch_core_session_strdup(session, val);
+					}
+				}
+				switch_xml_free(x_domain_root);
+				x_domain_root = NULL;
 
-		thepass = NULL;
-		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-			const char *var = switch_xml_attr_soft(x_param, "name");
-			const char *val = switch_xml_attr_soft(x_param, "value");
+				if (auth || !thepass || (thepass && mypass && !strcmp(thepass, mypass))) {
+					if (!dir_path) {
+						if (switch_strlen_zero(profile->storage_dir)) {
+							dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
+																   SWITCH_PATH_SEPARATOR,
+																   SWITCH_PATH_SEPARATOR,
+																   profile->name, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, myid);
+						} else {
+							dir_path = switch_core_session_sprintf(session, "%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, myid);
+						}
 
-			if (!strcasecmp(var, "password")) {
-				thepass = val;
-			} else if (!strcasecmp(var, "vm-password")) {
-				thepass = val;
-			} else if (!strcasecmp(var, "vm-mailto")) {
-				email_vm = switch_core_session_strdup(session, val);
-			}
-		}
-		switch_xml_free(x_domain_root);
-		x_domain_root = NULL;
+						if (switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", dir_path);
+							return;
+						}
+					}
 
-		if (auth || !thepass || (thepass && mypass && !strcmp(thepass, mypass))) {
-			if (!dir_path) {
-				if (switch_strlen_zero(profile->storage_dir)) {
-					dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, 
-						SWITCH_PATH_SEPARATOR,
-						SWITCH_PATH_SEPARATOR,
-						profile->name,
-						SWITCH_PATH_SEPARATOR,
-						domain_name,
-						SWITCH_PATH_SEPARATOR,
-						myid);
+					vm_check_state = VM_CHECK_FOLDER_SUMMARY;
 				} else {
-					dir_path = switch_core_session_sprintf(session, "%s%s%s",
-						profile->storage_dir,
-						SWITCH_PATH_SEPARATOR,
-						myid);
+					goto failed;
 				}
 
-				if (switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", dir_path);
-					return;
-				}
-			}
-
-			vm_check_state = VM_CHECK_FOLDER_SUMMARY;
-		} else {
-			goto failed;
-		}
-
-		continue;
+				continue;
 
-failed:
-		status = switch_ivr_phrase_macro(session, VM_FAIL_AUTH_MACRO, NULL, NULL, NULL);
-		myid = id;
-		mypass = NULL;
-		continue;
-	}
-	break;
-default:
-	break;
+			  failed:
+				status = switch_ivr_phrase_macro(session, VM_FAIL_AUTH_MACRO, NULL, NULL, NULL);
+				myid = id;
+				mypass = NULL;
+				continue;
+			}
+			break;
+		default:
+			break;
 		}
 	}
 
-end:
+  end:
 
 	if (switch_channel_ready(channel)) {
 		if (failed) {
@@ -1743,9 +1692,9 @@
 	switch_file_handle_t fh = { 0 };
 	switch_input_args_t args = { 0 };
 	char *email_vm = NULL;
-    char *email_vm_notify = NULL;
+	char *email_vm_notify = NULL;
 	int send_mail = 0;
-    int send_mail_only = 0;
+	int send_mail_only = 0;
 	cc_t cc = { 0 };
 	char *read_flags = NORMAL_FLAG_STRING;
 	int priority = 3;
@@ -1768,19 +1717,11 @@
 	}
 
 	if (switch_strlen_zero(profile->storage_dir)) {
-		dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, 
-			SWITCH_PATH_SEPARATOR,
-			SWITCH_PATH_SEPARATOR,
-			profile->name,
-			SWITCH_PATH_SEPARATOR,
-			domain_name,
-			SWITCH_PATH_SEPARATOR,
-			id);
+		dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
+											   SWITCH_PATH_SEPARATOR,
+											   SWITCH_PATH_SEPARATOR, profile->name, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, id);
 	} else {
-		dir_path = switch_core_session_sprintf(session, "%s%s%s",
-			profile->storage_dir,
-			SWITCH_PATH_SEPARATOR,
-			id);
+		dir_path = switch_core_session_sprintf(session, "%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, id);
 	}
 
 	if (switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
@@ -1790,60 +1731,57 @@
 
 	if (id) {
 		int ok = 1;
-        switch_event_t *params = NULL;
+		switch_event_t *params = NULL;
 		switch_xml_t x_domain, x_domain_root, x_user, x_params, x_param;
 		const char *email_addr = NULL;
-        
-        switch_event_create(&params, SWITCH_EVENT_MESSAGE);
-        switch_assert(params);
-        switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", id);
-        
+
+		switch_event_create(&params, SWITCH_EVENT_MESSAGE);
+		switch_assert(params);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", id);
+
 		x_user = x_domain = x_domain_root = NULL;
-		if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"), 
-                                   &x_domain_root, &x_domain, &x_user, params) == SWITCH_STATUS_SUCCESS) {
-            if ((x_params = switch_xml_child(x_user, "params"))) {
-                for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-						const char *var = switch_xml_attr_soft(x_param, "name");
-						const char *val = switch_xml_attr_soft(x_param, "value");
-
-						if (!strcasecmp(var, "vm-mailto")) {
-							email_vm = switch_core_session_strdup(session, val);
-                        } else if (!strcasecmp(var, "vm-mailto-notify")) {
-                            email_vm_notify = switch_core_session_strdup(session, val);
-						} else if (!strcasecmp(var, "email-addr")) {
-							email_addr = val;
-                        } else if (!strcasecmp(var, "vm-email-only")) {
-                            send_mail_only = switch_true(val);
-						} else if (!strcasecmp(var, "vm-email-all-messages")) {
-							send_mail = switch_true(val);
-						} else if (!strcasecmp(var, "vm-delete-file")) {
-							email_delete = switch_true(val);
-						} else if (!strcasecmp(var, "vm-attach-file")) {
-							email_attach = switch_true(val);
-						}
+		if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
+								   &x_domain_root, &x_domain, &x_user, params) == SWITCH_STATUS_SUCCESS) {
+			if ((x_params = switch_xml_child(x_user, "params"))) {
+				for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+					const char *var = switch_xml_attr_soft(x_param, "name");
+					const char *val = switch_xml_attr_soft(x_param, "value");
+
+					if (!strcasecmp(var, "vm-mailto")) {
+						email_vm = switch_core_session_strdup(session, val);
+					} else if (!strcasecmp(var, "vm-mailto-notify")) {
+						email_vm_notify = switch_core_session_strdup(session, val);
+					} else if (!strcasecmp(var, "email-addr")) {
+						email_addr = val;
+					} else if (!strcasecmp(var, "vm-email-only")) {
+						send_mail_only = switch_true(val);
+					} else if (!strcasecmp(var, "vm-email-all-messages")) {
+						send_mail = switch_true(val);
+					} else if (!strcasecmp(var, "vm-delete-file")) {
+						email_delete = switch_true(val);
+					} else if (!strcasecmp(var, "vm-attach-file")) {
+						email_attach = switch_true(val);
 					}
 				}
+			}
 
-				if (send_mail && switch_strlen_zero(email_vm) && !switch_strlen_zero(email_addr)) {
-					email_vm = switch_core_session_strdup(session, email_addr);
-				}
+			if (send_mail && switch_strlen_zero(email_vm) && !switch_strlen_zero(email_addr)) {
+				email_vm = switch_core_session_strdup(session, email_addr);
+			}
 
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", id, domain_name);
 			ok = 0;
 		}
 
-        switch_event_destroy(&params);
+		switch_event_destroy(&params);
 		switch_xml_free(x_domain_root);
 		if (!ok) {
 			goto end;
 		}
 	}
 
-	switch_snprintf(sql, sizeof(sql), 
-		"select * from voicemail_prefs where username='%s' and domain='%s'", 
-		id,
-		domain_name);
+	switch_snprintf(sql, sizeof(sql), "select * from voicemail_prefs where username='%s' and domain='%s'", id, domain_name);
 	vm_execute_sql_callback(profile, profile->mutex, sql, prefs_callback, &cbt);
 
 	file_path = switch_mprintf("%s%smsg_%s.%s", dir_path, SWITCH_PATH_SEPARATOR, uuid, profile->file_ext);
@@ -1857,7 +1795,7 @@
 		greet_path = cbt.greeting_path;
 	}
 
-greet:
+  greet:
 	memset(buf, 0, sizeof(buf));
 	args.input_callback = cancel_on_dtmf;
 	args.buf = buf;
@@ -1890,7 +1828,7 @@
 				if (argc >= 1 && argc <= 4) {
 					switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
 					/* the application still runs after we leave it so we need to make sure that we dont do anything evil */
-					send_mail=0;
+					send_mail = 0;
 					goto end;
 				}
 			}
@@ -1904,7 +1842,7 @@
 				if (argc >= 1 && argc <= 4) {
 					switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
 					/* the application still runs after we leave it so we need to make sure that we dont do anything evil */
-					send_mail=0;
+					send_mail = 0;
 					goto end;
 				}
 			}
@@ -1938,9 +1876,7 @@
 	if ((status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) && switch_channel_ready(channel)) {
 		char input[10] = "", key_buf[80] = "", term = 0;
 
-		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s", 
-			profile->urgent_key,
-			profile->terminator_key);
+		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s", profile->urgent_key, profile->terminator_key);
 
 		vm_macro_get(session, VM_RECORD_URGENT_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
 		if (*profile->urgent_key == *input) {
@@ -1961,14 +1897,14 @@
 		int total_new_urgent_messages = 0;
 		int total_saved_urgent_messages = 0;
 
-		usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long)switch_timestamp(NULL),
-			id, domain_name, uuid, caller_profile->caller_id_name, caller_profile->caller_id_number, 
-			myfolder, file_path, message_len, read_flags);
+		usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_timestamp(NULL),
+							  id, domain_name, uuid, caller_profile->caller_id_name, caller_profile->caller_id_number,
+							  myfolder, file_path, message_len, read_flags);
 		vm_execute_sql(profile, usql, profile->mutex);
 		switch_safe_free(usql);
 
 		message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
-			&total_new_urgent_messages, &total_saved_urgent_messages);
+					  &total_new_urgent_messages, &total_saved_urgent_messages);
 
 		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
 			const char *yn = "no";
@@ -1978,14 +1914,14 @@
 			mwi_id = switch_mprintf("%s@%s", id, domain_name);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", 
-				total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
+									total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
 			switch_event_fire(&event);
 			switch_safe_free(mwi_id);
-		}    
+		}
 	}
 
-end:
+  end:
 
 	if (send_mail && !switch_strlen_zero(email_vm) && switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
 		switch_event_t *event;
@@ -1993,7 +1929,7 @@
 		char *body;
 		char *headers;
 		char *header_string;
-		char tmp[50]="";
+		char tmp[50] = "";
 		int total_new_messages = 0;
 		int total_saved_messages = 0;
 		int total_new_urgent_messages = 0;
@@ -2004,19 +1940,19 @@
 		char duration_str[80];
 
 		message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
-			&total_new_urgent_messages, &total_saved_urgent_messages);
+					  &total_new_urgent_messages, &total_saved_urgent_messages);
 
 		switch_time_exp_lt(&tm, switch_timestamp_now());
 		switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
 
 		switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
-		switch_snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
+		switch_snprintf(tmp, sizeof(tmp), "%d", total_new_messages);
 		switch_channel_set_variable(channel, "voicemail_total_new_messages", tmp);
-		switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
+		switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_messages);
 		switch_channel_set_variable(channel, "voicemail_total_saved_messages", tmp);
-		switch_snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
+		switch_snprintf(tmp, sizeof(tmp), "%d", total_new_urgent_messages);
 		switch_channel_set_variable(channel, "voicemail_urgent_new_messages", tmp);
-		switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
+		switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_urgent_messages);
 		switch_channel_set_variable(channel, "voicemail_urgent_saved_messages", tmp);
 		switch_channel_set_variable(channel, "voicemail_account", id);
 		switch_channel_set_variable(channel, "voicemail_domain", domain_name);
@@ -2025,19 +1961,15 @@
 		switch_channel_set_variable(channel, "voicemail_file_path", file_path);
 		switch_channel_set_variable(channel, "voicemail_read_flags", read_flags);
 		switch_channel_set_variable(channel, "voicemail_time", date);
-		switch_snprintf(tmp,sizeof(tmp), "%d", priority);
+		switch_snprintf(tmp, sizeof(tmp), "%d", priority);
 		switch_channel_set_variable(channel, "voicemail_priority", tmp);
 		switch_channel_set_variable(channel, "voicemail_email", email_vm);
 
-		l_duration = (long)message_len * 1000000;
+		l_duration = (long) message_len *1000000;
 		switch_core_measure_time(l_duration, &duration);
 		duration.day += duration.yr * 365;
 		duration.hr += duration.day * 24;
-		switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
-			duration.hr,
-			duration.min,
-			duration.sec
-			);
+		switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
 
 		switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
 
@@ -2048,13 +1980,10 @@
 		}
 
 		if (switch_strlen_zero(profile->email_headers)) {
-			headers = switch_core_session_sprintf(session, 
-				"From: FreeSWITCH mod_voicemail <%s@%s>\n"
-				"Subject: Voicemail from %s %s\nX-Priority: %d", 
-				id, domain_name,
-				caller_profile->caller_id_name, 
-				caller_profile->caller_id_number,
-				priority);
+			headers = switch_core_session_sprintf(session,
+												  "From: FreeSWITCH mod_voicemail <%s@%s>\n"
+												  "Subject: Voicemail from %s %s\nX-Priority: %d",
+												  id, domain_name, caller_profile->caller_id_name, caller_profile->caller_id_number, priority);
 		} else {
 			headers = switch_channel_expand_variables(channel, profile->email_headers);
 		}
@@ -2062,7 +1991,7 @@
 		p = headers + (strlen(headers) - 1);
 
 		if (*p == '\n') {
-			if (*(p-1) == '\r') {
+			if (*(p - 1) == '\r') {
 				p--;
 			}
 			*p = '\0';
@@ -2079,8 +2008,7 @@
 		if (profile->email_body) {
 			body = switch_channel_expand_variables(channel, profile->email_body);
 		} else {
-			body = switch_mprintf("%u second Voicemail from %s %s", message_len,
-				caller_profile->caller_id_name, caller_profile->caller_id_number);
+			body = switch_mprintf("%u second Voicemail from %s %s", message_len, caller_profile->caller_id_name, caller_profile->caller_id_number);
 		}
 
 		if (email_attach) {
@@ -2088,9 +2016,9 @@
 		} else {
 			switch_simple_email(email_vm, from, header_string, body, NULL);
 		}
-        if (!switch_strlen_zero(email_vm_notify)) {
-            switch_simple_email(email_vm_notify, from, header_string, body, NULL);
-        }
+		if (!switch_strlen_zero(email_vm_notify)) {
+			switch_simple_email(email_vm_notify, from, header_string, body, NULL);
+		}
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", email_vm);
 		switch_safe_free(body);
@@ -2126,7 +2054,8 @@
 	int x = 0, check = 0, auth = 0;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 
-	if (switch_dir_make_recursive(SWITCH_GLOBAL_dirs.storage_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+	if (switch_dir_make_recursive(SWITCH_GLOBAL_dirs.storage_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) !=
+		SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", SWITCH_GLOBAL_dirs.storage_dir);
 		return;
 	}
@@ -2216,18 +2145,18 @@
 			free(dup);
 			return SWITCH_STATUS_SUCCESS;
 		}
-		
+
 		if ((domain = strchr(id, '@'))) {
 			*domain++ = '\0';
 			if ((p = strchr(domain, '|'))) {
 				*p++ = '\0';
 				how = p;
 			}
-			
+
 			for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
 				switch_hash_this(hi, NULL, NULL, &val);
 				profile = (vm_profile_t *) val;
-				total_new_messages =  total_saved_messages = 0;
+				total_new_messages = total_saved_messages = 0;
 				message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
 							  &total_new_urgent_messages, &total_saved_urgent_messages);
 			}
@@ -2285,19 +2214,19 @@
 			for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
 				switch_hash_this(hi, NULL, NULL, &val);
 				profile = (vm_profile_t *) val;
-				total_new_messages =  total_saved_messages = 0;
+				total_new_messages = total_saved_messages = 0;
 				message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
-					&total_new_urgent_messages, &total_saved_urgent_messages);
+							  &total_new_urgent_messages, &total_saved_urgent_messages);
 				if (total_new_messages || total_saved_messages) {
 					if (switch_event_create(&new_event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
 						const char *yn = "no";
-						if (total_new_messages || total_new_urgent_messages ) {
+						if (total_new_messages || total_new_urgent_messages) {
 							yn = "yes";
 						}
 						switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
 						switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", account);
-						switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", 
-							total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+						switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
+												total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
 						created++;
 					}
 				}
@@ -2383,8 +2312,8 @@
 	if (switch_file_open(&fd, argv[8], SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, holder->pool) == SWITCH_STATUS_SUCCESS) {
 		flen = switch_file_get_size(fd);
 		holder->stream->write_function(holder->stream, "Content-type: %s\n", mime_type);
-		holder->stream->write_function(holder->stream, "Content-length: %ld\n\n", (long)flen);
-		for(;;) {
+		holder->stream->write_function(holder->stream, "Content-length: %ld\n\n", (long) flen);
+		for (;;) {
 			switch_status_t status;
 
 			flen = sizeof(chunk);
@@ -2405,8 +2334,8 @@
 	char *sql;
 	struct holder holder;
 
-	sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and file_path like '%%%s'", 
-		(long)switch_timestamp(NULL), user, domain, file);
+	sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and file_path like '%%%s'",
+						 (long) switch_timestamp(NULL), user, domain, file);
 
 	vm_execute_sql(profile, sql, profile->mutex);
 	free(sql);
@@ -2444,9 +2373,8 @@
 	free(sql);
 
 	if (ref) {
-		stream->write_function(stream,"Content-type: text/html\n\n<h2>Message Deleted</h2>\n"
-			"<META http-equiv=\"refresh\" content=\"1;URL=%s\">",  ref);
-	} 
+		stream->write_function(stream, "Content-type: text/html\n\n<h2>Message Deleted</h2>\n" "<META http-equiv=\"refresh\" content=\"1;URL=%s\">", ref);
+	}
 }
 
 
@@ -2467,7 +2395,7 @@
 	const char *fmt = "%a, %e %b %Y %T %z";
 	char heard[80];
 	char title_b4[128] = "";
-	char title_aft[128*3] = "";
+	char title_aft[128 * 3] = "";
 
 	if (argc > 0) {
 		l_created = atol(argv[0]) * 1000000;
@@ -2495,11 +2423,7 @@
 	duration.day += duration.yr * 365;
 	duration.hr += duration.day * 24;
 
-	switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
-		duration.hr,
-		duration.min,
-		duration.sec
-		);
+	switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
 
 	if (l_created) {
 		switch_time_exp_lt(&tm, l_created);
@@ -2517,25 +2441,22 @@
 	get = switch_mprintf("http://%s:%s%s/get/%s", holder->host, holder->port, holder->uri, fname);
 	del = switch_mprintf("http://%s:%s%s/del/%s", holder->host, holder->port, holder->uri, fname);
 
-	holder->stream->write_function(holder->stream, "<font face=tahoma><div class=title><b>Message from %s %s</b></div><hr noshade size=1>\n", 
-		argv[5], argv[6]);
-	holder->stream->write_function(holder->stream, "Priority: %s<br>\n"
-		"Created: %s<br>\n"
-		"Last Heard: %s<br>\n"
-		"Duration: %s<br>\n",
-		//"<a href=%s>Delete This Message</a><br><hr noshade size=1>", 
-		strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", create_date, heard, duration_str);
+	holder->stream->write_function(holder->stream, "<font face=tahoma><div class=title><b>Message from %s %s</b></div><hr noshade size=1>\n",
+								   argv[5], argv[6]);
+	holder->stream->write_function(holder->stream, "Priority: %s<br>\n" "Created: %s<br>\n" "Last Heard: %s<br>\n" "Duration: %s<br>\n",
+								   //"<a href=%s>Delete This Message</a><br><hr noshade size=1>", 
+								   strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", create_date, heard, duration_str);
 
 	switch_snprintf(title_b4, sizeof(title_b4), "%s <%s> %s", argv[5], argv[6], rss_date);
 	switch_url_encode(title_b4, title_aft, sizeof(title_aft));
 
 	holder->stream->write_function(holder->stream,
-		"<br><object width=550 height=15 \n"
-		"type=\"application/x-shockwave-flash\" \n"
-		"data=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\">\n"
-		"<param name=movie value=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\"></object><br><br>\n"
-		"[<a href=%s>delete</a>] [<a href=%s>download</a>] [<a href=tel:%s>call</a>] <br><br><br></font>\n",
-		holder->host, holder->port, get, title_aft, holder->host, holder->port, get, title_aft, del, get, argv[6]);
+								   "<br><object width=550 height=15 \n"
+								   "type=\"application/x-shockwave-flash\" \n"
+								   "data=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\">\n"
+								   "<param name=movie value=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\"></object><br><br>\n"
+								   "[<a href=%s>delete</a>] [<a href=%s>download</a>] [<a href=tel:%s>call</a>] <br><br><br></font>\n",
+								   holder->host, holder->port, get, title_aft, holder->host, holder->port, get, title_aft, del, get, argv[6]);
 
 	free(get);
 	free(del);
@@ -2582,11 +2503,7 @@
 	duration.day += duration.yr * 365;
 	duration.hr += duration.day * 24;
 
-	switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
-		duration.hr,
-		duration.min,
-		duration.sec
-		);
+	switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
 
 	if (l_created) {
 		switch_time_exp_lt(&tm, l_created);
@@ -2622,10 +2539,9 @@
 	switch_xml_set_txt_d(x_link, del);
 
 	tmp = switch_mprintf("<![CDATA[Priority: %s<br>"
-		"Last Heard: %s<br>Duration: %s<br>"
-		"<a href=%s>Delete This Message</a><br>"
-		"]]>", 
-		strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", heard, duration_str, del);
+						 "Last Heard: %s<br>Duration: %s<br>"
+						 "<a href=%s>Delete This Message</a><br>"
+						 "]]>", strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", heard, duration_str, del);
 
 	switch_xml_set_txt_d(x_tmp, tmp);
 	free(tmp);
@@ -2740,7 +2656,7 @@
 	holder.uri = uri;
 
 	if (profile->web_head) {
-		stream->raw_write_function(stream, (uint8_t *)profile->web_head, strlen(profile->web_head));
+		stream->raw_write_function(stream, (uint8_t *) profile->web_head, strlen(profile->web_head));
 	}
 
 	cbt.buf = buf;
@@ -2758,7 +2674,7 @@
 	stream->write_function(stream, "%d message%s<br>", ttl, ttl == 1 ? "" : "s");
 
 	if (profile->web_tail) {
-		stream->raw_write_function(stream, (uint8_t *)profile->web_tail, strlen(profile->web_tail));
+		stream->raw_write_function(stream, (uint8_t *) profile->web_tail, strlen(profile->web_tail));
 	}
 }
 
@@ -2840,9 +2756,9 @@
 
 	if (path_info) {
 		if (!strncasecmp(path_info, "get/", 4)) {
-			do_play(profile, user, domain, path_info + 4, stream);        
+			do_play(profile, user, domain, path_info + 4, stream);
 		} else if (!strncasecmp(path_info, "del/", 4)) {
-			do_del(profile, user, domain, path_info + 4, stream);        
+			do_del(profile, user, domain, path_info + 4, stream);
 		} else if (!strncasecmp(path_info, "web", 3)) {
 			do_web(profile, user, domain, host, port, uri, stream);
 		}
@@ -2854,7 +2770,7 @@
 
 	goto done;
 
-error:
+  error:
 	if (host) {
 		if (!ct) {
 			stream->write_function(stream, "Content-type: text/html\n\n<h2>");
@@ -2862,7 +2778,7 @@
 	}
 	stream->write_function(stream, "Error: %s\n", VOICEMAIL_SYNTAX);
 
-done:
+  done:
 	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -2883,13 +2799,13 @@
 
 	if (switch_event_bind((char *) modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL)
 		!= SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
-			return SWITCH_STATUS_GENERR;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
 	}
 
 	SWITCH_ADD_API(commands_api_interface, "voicemail", "voicemail", voicemail_api_function, VOICEMAIL_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "vm_boxcount", "vm_boxcount", boxcount_api_function, BOXCOUNT_SYNTAX);
-	
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_NOUNLOAD;
 }

Modified: freeswitch/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	(original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	Tue May 27 00:54:52 2008
@@ -257,7 +257,7 @@
 	swift_port_stop(cepstral->port, SWIFT_ASYNC_ANY, SWIFT_EVENT_NOW);
 }
 
-static switch_status_t cepstral_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags)
+static switch_status_t cepstral_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
 {
 	cepstral_t *cepstral;
 	size_t desired = *datalen;

Modified: freeswitch/trunk/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp	(original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp	Tue May 27 00:54:52 2008
@@ -56,7 +56,7 @@
 	switch_mutex_t *flag_mutex;
 } lumenvox_t;
 
-static void log_callback(const char* message, void* userdata)
+static void log_callback(const char *message, void *userdata)
 {
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", message);
 }
@@ -72,50 +72,47 @@
 	"BEEP"
 };
 
-std::ostream& operator << (std::ostream& os ,const LVSemanticData& Data)
+std::ostream & operator <<(std::ostream & os, const LVSemanticData & Data)
 {
 	int i;
 	LVSemanticObject Obj;
-	switch (Data.Type())
-		{
-		case SI_TYPE_BOOL:
-			os << Data.GetBool();
-			break;
-		case SI_TYPE_INT:
-			os << Data.GetInt();
-			break;
-		case SI_TYPE_DOUBLE:
-			os << Data.GetDouble();
-			break;
-		case SI_TYPE_STRING:
-			os << Data.GetString();
-			break;
-		case SI_TYPE_OBJECT:
-			Obj = Data.GetSemanticObject();
-			for (i = 0; i < Obj.NumberOfProperties(); ++i)
-				{
-					os << "<" << Obj.PropertyName(i) << ">";
-					os << Obj.PropertyValue(i);
-					os << "</" << Obj.PropertyName(i) << ">";
-				}
-			break;
-		case SI_TYPE_ARRAY:
-			for (i = 0; i < Data.GetSemanticArray().Size(); ++i)
-				{
-					os << Data.GetArray().At(i);
-				}
-			break;
+	switch (Data.Type()) {
+	case SI_TYPE_BOOL:
+		os << Data.GetBool();
+		break;
+	case SI_TYPE_INT:
+		os << Data.GetInt();
+		break;
+	case SI_TYPE_DOUBLE:
+		os << Data.GetDouble();
+		break;
+	case SI_TYPE_STRING:
+		os << Data.GetString();
+		break;
+	case SI_TYPE_OBJECT:
+		Obj = Data.GetSemanticObject();
+		for (i = 0; i < Obj.NumberOfProperties(); ++i) {
+			os << "<" << Obj.PropertyName(i) << ">";
+			os << Obj.PropertyValue(i);
+			os << "</" << Obj.PropertyName(i) << ">";
+		}
+		break;
+	case SI_TYPE_ARRAY:
+		for (i = 0; i < Data.GetSemanticArray().Size(); ++i) {
+			os << Data.GetArray().At(i);
 		}
+		break;
+	}
 	return os;
 }
 
 //==============================================================================================
 // code to plug LVInterpretation into any standard stream
-std::ostream& operator << (std::ostream& os, const LVInterpretation& Interp)
+std::ostream & operator <<(std::ostream & os, const LVInterpretation & Interp)
 {
-	os << "<interpretation grammar=\""<<Interp.GrammarLabel()
-	   <<"\" score=\""<<Interp.Score()<<"\">";
-	os << "<result name=\""<<Interp.ResultName()<<"\">";
+	os << "<interpretation grammar=\"" << Interp.GrammarLabel()
+		<< "\" score=\"" << Interp.Score() << "\">";
+	os << "<result name=\"" << Interp.ResultName() << "\">";
 	os << Interp.ResultData();
 	os << "</result>";
 	os << "<input>";
@@ -126,30 +123,26 @@
 }
 
 
-static void state_change_callback(long new_state, unsigned long total_bytes,
-				   unsigned long recorded_bytes, void *user_data)
+static void state_change_callback(long new_state, unsigned long total_bytes, unsigned long recorded_bytes, void *user_data)
 {
 	lumenvox_t *lv = (lumenvox_t *) user_data;
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "State: [%s] total bytes: [%ld] recorded bytes: [%ld]\n",
-					  state_names[new_state],
-					  total_bytes,
-					  recorded_bytes);
-
-	switch (new_state)
-		{
-		case STREAM_STATUS_READY:
-			break;
-		case STREAM_STATUS_STOPPED:
-			switch_clear_flag_locked(lv, LVFLAG_READY);
-			break;
-		case STREAM_STATUS_END_SPEECH:
-			switch_set_flag_locked(lv, LVFLAG_HAS_TEXT);
-			break;
-		case STREAM_STATUS_BARGE_IN:
-			switch_set_flag_locked(lv, LVFLAG_BARGE);
-			break;
-		}
+					  state_names[new_state], total_bytes, recorded_bytes);
+
+	switch (new_state) {
+	case STREAM_STATUS_READY:
+		break;
+	case STREAM_STATUS_STOPPED:
+		switch_clear_flag_locked(lv, LVFLAG_READY);
+		break;
+	case STREAM_STATUS_END_SPEECH:
+		switch_set_flag_locked(lv, LVFLAG_HAS_TEXT);
+		break;
+	case STREAM_STATUS_BARGE_IN:
+		switch_set_flag_locked(lv, LVFLAG_BARGE);
+		break;
+	}
 }
 
 static switch_status_t lumenvox_asr_pause(switch_asr_handle_t *ah)
@@ -177,20 +170,20 @@
 			lv->port.ClosePort();
 			return SWITCH_STATUS_GENERR;
 		}
-		switch_set_flag_locked(lv, LVFLAG_READY);		
+		switch_set_flag_locked(lv, LVFLAG_READY);
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	return SWITCH_STATUS_GENERR;
 }
 
 /*! function to open the asr interface */
-static switch_status_t lumenvox_asr_open(switch_asr_handle_t *ah, char *codec, int rate, char *dest, switch_asr_flag_t *flags) 
+static switch_status_t lumenvox_asr_open(switch_asr_handle_t *ah, char *codec, int rate, char *dest, switch_asr_flag_t *flags)
 {
-	
+
 	lumenvox_t *lv;
 	int error_code;
-	
+
 	if (!(lv = (lumenvox_t *) switch_core_alloc(ah->memory_pool, sizeof(*lv)))) {
 		return SWITCH_STATUS_MEMERR;
 	}
@@ -199,7 +192,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Rate: Pick 8000 or 16000\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if (!strcasecmp(codec, "PCMU")) {
 		switch (rate) {
 		case 8000:
@@ -238,36 +231,35 @@
 	if (!lv->sound_format) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot negotiate sound format.\n");
 		return SWITCH_STATUS_FALSE;
-	}	
+	}
 
 	ah->rate = rate;
 	ah->codec = switch_core_strdup(ah->memory_pool, codec);
-	
+
 	lv->port.OpenPort(log_callback, NULL, 5);
 	error_code = lv->port.GetOpenPortStatus();
-	
-	switch(error_code)
-		{
-		case LV_FAILURE:
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Licenses Exceeded!\n");
-			return SWITCH_STATUS_GENERR;
-		case LV_OPEN_PORT_FAILED__PRIMARY_SERVER_NOT_RESPONDING:
-		case LV_NO_SERVER_RESPONDING:
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SRE Server Unavailable!\n");
-			return SWITCH_STATUS_GENERR;
-		case LV_SUCCESS:
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Port Opened %d %dkhz.\n", lv->sound_format, rate);
-			break;
-		}
+
+	switch (error_code) {
+	case LV_FAILURE:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Licenses Exceeded!\n");
+		return SWITCH_STATUS_GENERR;
+	case LV_OPEN_PORT_FAILED__PRIMARY_SERVER_NOT_RESPONDING:
+	case LV_NO_SERVER_RESPONDING:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SRE Server Unavailable!\n");
+		return SWITCH_STATUS_GENERR;
+	case LV_SUCCESS:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Port Opened %d %dkhz.\n", lv->sound_format, rate);
+		break;
+	}
 
 
 	// turn on sound and response file logging
 	/*
-	  int save_sound_files = 1;
-	  lv->port.SetPropertyEx(PROP_EX_SAVE_SOUND_FILES,
-						   PROP_EX_VALUE_TYPE_INT_PTR,
-						   &save_sound_files);
-	*/
+	   int save_sound_files = 1;
+	   lv->port.SetPropertyEx(PROP_EX_SAVE_SOUND_FILES,
+	   PROP_EX_VALUE_TYPE_INT_PTR,
+	   &save_sound_files);
+	 */
 	lv->channel = 1;
 	lv->flags = *flags;
 	lv->port.StreamSetParameter(STREAM_PARM_DETECT_BARGE_IN, 1);
@@ -275,9 +267,9 @@
 	lv->port.StreamSetParameter(STREAM_PARM_AUTO_DECODE, 1);
 	lv->port.StreamSetParameter(STREAM_PARM_DECODE_FLAGS, LV_DECODE_SEMANTIC_INTERPRETATION);
 	lv->port.StreamSetParameter(STREAM_PARM_VOICE_CHANNEL, lv->channel);
-	lv->port.StreamSetParameter(STREAM_PARM_GRAMMAR_SET, (long unsigned int) LV_ACTIVE_GRAMMAR_SET); 
+	lv->port.StreamSetParameter(STREAM_PARM_GRAMMAR_SET, (long unsigned int) LV_ACTIVE_GRAMMAR_SET);
+
 
-	
 	lv->port.StreamSetStateChangeCallBack(state_change_callback, lv);
 	lv->port.StreamSetParameter(STREAM_PARM_SOUND_FORMAT, lv->sound_format);
 
@@ -292,7 +284,7 @@
 		lv->port.ClosePort();
 		return SWITCH_STATUS_GENERR;
 	}
-	
+
 	ah->private_info = lv;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -347,13 +339,13 @@
 {
 
 	lumenvox_t *lv = (lumenvox_t *) ah->private_info;
-	
+
 	if (!switch_test_flag(lv, LVFLAG_HAS_TEXT) && switch_test_flag(lv, LVFLAG_READY)) {
 		if (lv->port.StreamSendData(data, len)) {
-			return SWITCH_STATUS_FALSE;		
+			return SWITCH_STATUS_FALSE;
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -384,21 +376,21 @@
 
 		lv->port.StreamStop();
 		code = lv->port.WaitForEngineToIdle(3000, lv->channel);
-	
+
 		if (code == LV_TIME_OUT) {
 			return SWITCH_STATUS_FALSE;
 		}
-		
+
 		numInterp = lv->port.GetNumberOfInterpretations(lv->channel);
-		
+
 		for (int t = 0; t < numInterp; ++t) {
 			ss << lv->port.GetInterpretation(lv->channel, t);
 		}
-		
-		*xmlstr = strdup((char *)ss.str().c_str());
+
+		*xmlstr = strdup((char *) ss.str().c_str());
 		switch_clear_flag_locked(lv, LVFLAG_HAS_TEXT);
 
-		
+
 		if (switch_test_flag(lv, SWITCH_ASR_FLAG_AUTO_RESUME)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Auto Resuming\n");
 			switch_set_flag_locked(lv, LVFLAG_READY);
@@ -410,21 +402,21 @@
 
 		ret = SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	return ret;
 }
 
 static const switch_asr_interface_t lumenvox_asr_interface = {
-	/*.interface_name*/			"lumenvox",
-	/*.asr_open*/				lumenvox_asr_open,
-	/*.asr_load_grammar*/		lumenvox_asr_load_grammar,
-	/*.asr_unload_grammar*/		lumenvox_asr_unload_grammar,
-	/*.asr_close*/				lumenvox_asr_close,
-	/*.asr_feed*/				lumenvox_asr_feed,
-	/*.asr_resume*/				lumenvox_asr_resume,
-	/*.asr_pause*/				lumenvox_asr_pause,
-	/*.asr_check_results*/		lumenvox_asr_check_results,
-	/*.asr_get_results*/		lumenvox_asr_get_results
+	/*.interface_name */ "lumenvox",
+	/*.asr_open */ lumenvox_asr_open,
+	/*.asr_load_grammar */ lumenvox_asr_load_grammar,
+	/*.asr_unload_grammar */ lumenvox_asr_unload_grammar,
+	/*.asr_close */ lumenvox_asr_close,
+	/*.asr_feed */ lumenvox_asr_feed,
+	/*.asr_resume */ lumenvox_asr_resume,
+	/*.asr_pause */ lumenvox_asr_pause,
+	/*.asr_check_results */ lumenvox_asr_check_results,
+	/*.asr_get_results */ lumenvox_asr_get_results
 };
 
 static const switch_loadable_module_interface_t lumenvox_module_interface = {
@@ -447,7 +439,7 @@
 {
 	LVSpeechPort::RegisterAppLogMsg(log_callback, NULL, 5);
 	//LVSpeechPort::SetClientPropertyEx(PROP_EX_SRE_SERVERS, PROP_EX_VALUE_TYPE_STRING, (void *)"127.0.0.1");
-	
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = &lumenvox_module_interface;
 

Modified: freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	(original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	Tue May 27 00:54:52 2008
@@ -66,40 +66,39 @@
 #include "mrcp_synthesizer.h"
 #include "mrcp_generic_header.h"
 
-	
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_openmrcp_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_openmrcp_shutdown);
-SWITCH_MODULE_DEFINITION(mod_openmrcp, mod_openmrcp_load, 
-						 mod_openmrcp_shutdown, NULL);
+SWITCH_MODULE_DEFINITION(mod_openmrcp, mod_openmrcp_load, mod_openmrcp_shutdown, NULL);
 
 typedef struct {
-	char                      *name;
+	char *name;
 	openmrcp_client_options_t *mrcp_options;
-	mrcp_client_t             *mrcp_client;
-	mrcp_client_context_t     *mrcp_context;
+	mrcp_client_t *mrcp_client;
+	mrcp_client_context_t *mrcp_context;
 } openmrcp_profile_t;
 
 typedef struct {
-	openmrcp_profile_t    *profile;
-	mrcp_session_t        *client_session;
+	openmrcp_profile_t *profile;
+	mrcp_session_t *client_session;
 	mrcp_client_channel_t *control_channel;
-	mrcp_audio_channel_t  *audio_channel;
-	mrcp_message_t        *mrcp_message_last_rcvd;
-	apr_pool_t            *pool;
-	switch_speech_flag_t   flags;
-	switch_mutex_t        *flag_mutex;
-	switch_thread_cond_t  *wait_object;
+	mrcp_audio_channel_t *audio_channel;
+	mrcp_message_t *mrcp_message_last_rcvd;
+	apr_pool_t *pool;
+	switch_speech_flag_t flags;
+	switch_mutex_t *flag_mutex;
+	switch_thread_cond_t *wait_object;
 } openmrcp_session_t;
 
 typedef enum {
-	FLAG_HAS_MESSAGE =    (1 << 0), 
-	FLAG_FEED_STARTED =   (1 << 1), 
-	FLAG_TERMINATING =    (1 << 2)
+	FLAG_HAS_MESSAGE = (1 << 0),
+	FLAG_FEED_STARTED = (1 << 1),
+	FLAG_TERMINATING = (1 << 2)
 } mrcp_flag_t;
 
 typedef struct {
 	switch_memory_pool_t *pool;
-	switch_hash_t        *profile_hash;
+	switch_hash_t *profile_hash;
 	char *asr_profile_name;
 	char *tts_profile_name;
 	//openmrcp_profile_t   *asr_profile;
@@ -109,7 +108,7 @@
 static openmrcp_module_t openmrcp_module;
 static switch_status_t openmrcp_profile_run(openmrcp_profile_t *profile);
 
-static openmrcp_session_t* openmrcp_session_create(openmrcp_profile_t *profile)
+static openmrcp_session_t *openmrcp_session_create(openmrcp_profile_t *profile)
 {
 	openmrcp_session_t *openmrcp_session;
 	apr_pool_t *session_pool;
@@ -172,14 +171,14 @@
 
 	if (switch_test_flag(openmrcp_session, FLAG_TERMINATING)) {
 		openmrcp_session_destroy(openmrcp_session);
-	}
-	else {
+	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "abnormal session terminate\n");
 	}
 	return MRCP_STATUS_SUCCESS;
 }
 
-static mrcp_status_t openmrcp_on_channel_add(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_client_channel_t *control_channel, mrcp_audio_channel_t *audio_channel)
+static mrcp_status_t openmrcp_on_channel_add(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_client_channel_t *control_channel,
+											 mrcp_audio_channel_t *audio_channel)
 {
 	openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_channel_add called\n");
@@ -242,8 +241,9 @@
 	apr_finfo_t finfo;
 	char *buf1;
 	apr_size_t bytes2read = 0;
-	
-	mrcp_message_t *mrcp_message = mrcp_client_context_message_get(context, asr_session->client_session, asr_session->control_channel, RECOGNIZER_RECOGNIZE);
+
+	mrcp_message_t *mrcp_message =
+		mrcp_client_context_message_get(context, asr_session->client_session, asr_session->control_channel, RECOGNIZER_RECOGNIZE);
 
 	if (!mrcp_message) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create mrcp msg\n");
@@ -257,9 +257,9 @@
 		return -1;
 	}
 	rv = apr_file_info_get(&finfo, APR_FINFO_NORM, fp);
-	
-	buf1 = apr_palloc(mp, (apr_size_t)finfo.size + 1);
-	bytes2read = (apr_size_t)finfo.size;
+
+	buf1 = apr_palloc(mp, (apr_size_t) finfo.size + 1);
+	bytes2read = (apr_size_t) finfo.size;
 	rv = apr_file_read(fp, buf1, &bytes2read);
 	buf1[bytes2read] = '\0';
 
@@ -286,27 +286,23 @@
  * This code expects certain one-time initialization of the openmrcp client
  * engine/systeme to have already taken place.function to open the asr interface 
  */
-static switch_status_t openmrcp_asr_open(switch_asr_handle_t *ah,
-										 const char *codec,
-										 int rate,
-										 const char *dest,
-										 switch_asr_flag_t *flags) 
+static switch_status_t openmrcp_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags)
 {
 	openmrcp_session_t *asr_session;
 	mrcp_client_channel_t *asr_channel;
 	char *profile_name = openmrcp_module.asr_profile_name;
-	openmrcp_profile_t   *asr_profile = NULL;
+	openmrcp_profile_t *asr_profile = NULL;
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "asr_open called, codec: %s, rate: %d\n", codec, rate);
 
 	if (strcmp(codec, "L16")) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sorry, only L16 codec supported\n");
-		return SWITCH_STATUS_GENERR;		
+		return SWITCH_STATUS_GENERR;
 	}
 	if (rate != 8000) {
 		// TODO: look into supporting other sample rates
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sorry, only 8kz supported\n");
-		return SWITCH_STATUS_GENERR;		
+		return SWITCH_STATUS_GENERR;
 	}
 
 	if (!switch_strlen_zero(ah->param)) {
@@ -315,7 +311,7 @@
 
 	if (!(asr_profile = switch_core_hash_find(openmrcp_module.profile_hash, profile_name))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot locate profile %s\n", profile_name);
-		return SWITCH_STATUS_GENERR;		
+		return SWITCH_STATUS_GENERR;
 	}
 
 	/* create session */
@@ -336,7 +332,7 @@
 
 	switch_mutex_lock(asr_session->flag_mutex);
 	mrcp_client_context_channel_add(asr_session->profile->mrcp_context, asr_session->client_session, asr_channel, NULL);
-	if (switch_thread_cond_timedwait(asr_session->wait_object, asr_session->flag_mutex, 5000*1000) != APR_SUCCESS) {
+	if (switch_thread_cond_timedwait(asr_session->wait_object, asr_session->flag_mutex, 5000 * 1000) != APR_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
 	}
 	switch_mutex_unlock(asr_session->flag_mutex);
@@ -358,15 +354,15 @@
 	
 	    TODO: - how does DEFINE-GRAMMAR fit into the picture here?  (if at all) 
 	*/
-	
+
 	openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
 	mrcp_client_context_t *context = asr_session->profile->mrcp_context;
-		
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading grammar\n");
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Start Recognizer\n");
 	openmrcp_recog_start(context, asr_session, path);
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Finished loading grammar\n");
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -387,22 +383,22 @@
 	/* sampling rate and frame size should be retrieved from audio sink */
 	media_frame.codec_frame.size = 160;
 	media_frame.codec_frame.buffer = data;
-	while(len >= media_frame.codec_frame.size) {
+	while (len >= media_frame.codec_frame.size) {
 		if (!audio_sink) {
 			/*!
-			  If there is no audio_sink established yet, discard the audio and
-			  return SUCCESS.  returning anything other than success causes freeswitch
-			  to abort the call and tear down the channel.  One reason there might
-			  not be an audio sink is that the openmrcp client lib is still in the startup
-			  process.  
-			*/
+			   If there is no audio_sink established yet, discard the audio and
+			   return SUCCESS.  returning anything other than success causes freeswitch
+			   to abort the call and tear down the channel.  One reason there might
+			   not be an audio sink is that the openmrcp client lib is still in the startup
+			   process.  
+			 */
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "!audio_sink\n");
-			return SWITCH_STATUS_SUCCESS;  
+			return SWITCH_STATUS_SUCCESS;
 		}
 		audio_sink->method_set->write_frame(audio_sink, &media_frame);
-		
-		len -= (unsigned int)media_frame.codec_frame.size;
-		media_frame.codec_frame.buffer = (char*)media_frame.codec_frame.buffer + media_frame.codec_frame.size;
+
+		len -= (unsigned int) media_frame.codec_frame.size;
+		media_frame.codec_frame.buffer = (char *) media_frame.codec_frame.buffer + media_frame.codec_frame.size;
 	}
 	if (len > 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "None frame alligned data len [%d]\n", len);
@@ -452,9 +448,9 @@
 
 	// terminate client session
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Going to TERMINATE SESSION\n");
-	switch_set_flag_locked(asr_session, FLAG_TERMINATING);  
+	switch_set_flag_locked(asr_session, FLAG_TERMINATING);
 	mrcp_client_context_session_terminate(context, asr_session->client_session);
-	
+
 	switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -470,7 +466,7 @@
 static switch_status_t openmrcp_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
 {
 	openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
-	
+
 	switch_status_t rv = (switch_test_flag(asr_session, FLAG_HAS_MESSAGE)) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
 
 	return rv;
@@ -491,49 +487,44 @@
 	switch_clear_flag_locked(asr_session, FLAG_HAS_MESSAGE);
 
 	if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
-		if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS && 
-			message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
+		if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS && message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "error code received [%d]\n", message->start_line.status_code);
 			ret = SWITCH_STATUS_FALSE;
 		}
-	} 
-	else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+	} else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
 		if (message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
 			/*! 
 			   we have to extract the XML but stripping off the <?xml version="1.0"?>
 			   header.  the body looks like:
-			
+
 			   Completion-Cause:001 no-match
 			   Content-Type: application/nlsml+xml
 			   Content-Length: 260
-			 
-			  <?xml version="1.0"?>
-			  <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" xmlns:ex="http://www.example.com/example" score="100" grammar="session:request1 at form-level.store">
-				<interpretation>             <input mode="speech">open a</input>
-				</interpretation>
-			  </result>
-			*/
+
+			   <?xml version="1.0"?>
+			   <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" xmlns:ex="http://www.example.com/example" score="100" grammar="session:request1 at form-level.store">
+			   <interpretation>             <input mode="speech">open a</input>
+			   </interpretation>
+			   </result>
+			 */
 
 			if (message->body) {
-				char *marker = "?>";  // FIXME -- lame and brittle way of doing this.  use regex or better.
+				char *marker = "?>";	// FIXME -- lame and brittle way of doing this.  use regex or better.
 				char *position = strstr(message->body, marker);
 				if (!position) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", message->body);
 					ret = SWITCH_STATUS_FALSE;
-				}
-				else {
+				} else {
 					position += strlen(marker);
 					*xmlstr = strdup(position);
 				}
-			}
-			else {
+			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No result received from mrcp server\n");
 				ret = SWITCH_STATUS_FALSE;
 			}
 
-			ret = SWITCH_STATUS_SUCCESS;	
-		} 
-		else if (message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
+			ret = SWITCH_STATUS_SUCCESS;
+		} else if (message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
 			ret = SWITCH_STATUS_BREAK;
 		}
 	}
@@ -546,23 +537,17 @@
 	mrcp_generic_header_t *generic_header;
 	mrcp_message_t *mrcp_message;
 	mrcp_status_t status = MRCP_STATUS_FAILURE;
-	
+
 	char *text2speak;
-	const char v2_xml_head[] = 
-		"<?xml version=\"1.0\"?>\r\n"
-		"<speak>\r\n"
-		"<paragraph>\r\n"
-		"    <sentence><break time=\"1000ms\"/>";
+	const char v2_xml_head[] = "<?xml version=\"1.0\"?>\r\n" "<speak>\r\n" "<paragraph>\r\n" "    <sentence><break time=\"1000ms\"/>";
 
-	const char v2_xml_tail[] = "<break time=\"1000ms\"/></sentence>\r\n"
-		"</paragraph>\r\n"
-		"</speak>\r\n";
+	const char v2_xml_tail[] = "<break time=\"1000ms\"/></sentence>\r\n" "</paragraph>\r\n" "</speak>\r\n";
 
-    const char v1_xml_head[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
-        "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\">\n<break time=\"1000ms\"/>";
+	const char v1_xml_head[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+		"<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\">\n<break time=\"1000ms\"/>";
 
 
-    const char v1_xml_tail[] = "<break time=\"1000ms\"/>\n</speak>\n";
+	const char v1_xml_tail[] = "<break time=\"1000ms\"/>\n</speak>\n";
 
 	const char *xml_head, *xml_tail;
 
@@ -592,7 +577,7 @@
 
 	status = mrcp_client_context_channel_modify(context, tts_session->client_session, mrcp_message);
 
- end:
+  end:
 
 	return status;
 
@@ -609,12 +594,12 @@
 }
 
 
-static switch_status_t openmrcp_tts_open(switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags) 
+static switch_status_t openmrcp_tts_open(switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags)
 {
 	openmrcp_session_t *tts_session;
 	mrcp_client_channel_t *tts_channel;
 	char *profile_name = openmrcp_module.tts_profile_name;
-	openmrcp_profile_t   *tts_profile = NULL;
+	openmrcp_profile_t *tts_profile = NULL;
 
 	if (!switch_strlen_zero(sh->param)) {
 		profile_name = sh->param;
@@ -622,7 +607,7 @@
 
 	if (!(tts_profile = switch_core_hash_find(openmrcp_module.profile_hash, profile_name))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot locate profile %s\n", profile_name);
-		return SWITCH_STATUS_GENERR;		
+		return SWITCH_STATUS_GENERR;
 	}
 
 	/* create session */
@@ -642,7 +627,7 @@
 	}
 	switch_mutex_lock(tts_session->flag_mutex);
 	mrcp_client_context_channel_add(tts_session->profile->mrcp_context, tts_session->client_session, tts_channel, NULL);
-	if (switch_thread_cond_timedwait(tts_session->wait_object, tts_session->flag_mutex, 5000*1000) != APR_SUCCESS) {
+	if (switch_thread_cond_timedwait(tts_session->wait_object, tts_session->flag_mutex, 5000 * 1000) != APR_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
 	}
 	switch_mutex_unlock(tts_session->flag_mutex);
@@ -665,7 +650,7 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "terminate tts_session\n");
 	switch_set_flag_locked(tts_session, FLAG_TERMINATING);
 	mrcp_client_context_session_terminate(context, tts_session->client_session);
-	return SWITCH_STATUS_SUCCESS;	
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t openmrcp_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
@@ -677,11 +662,11 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no synthesizer channel too feed tts\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
-	synth_speak(context, tts_session, text); 
-	
+
+	synth_speak(context, tts_session, text);
+
 	switch_clear_flag(tts_session, FLAG_FEED_STARTED);
-	return SWITCH_STATUS_SUCCESS;	
+	return SWITCH_STATUS_SUCCESS;
 }
 
 /**
@@ -693,7 +678,7 @@
 static switch_status_t openmrcp_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
 {
 	openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
-	size_t return_len=0;
+	size_t return_len = 0;
 	media_frame_t media_frame;
 	audio_source_t *audio_source;
 
@@ -703,13 +688,11 @@
 		switch_clear_flag_locked(tts_session, FLAG_HAS_MESSAGE);
 
 		if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
-			if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS && 
-				message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
+			if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS && message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "error code received [%d]\n", message->start_line.status_code);
 				return SWITCH_STATUS_BREAK;
 			}
-		} 
-		else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+		} else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
 			if (message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
 				/* tell fs we are done */
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FLAG_SPEAK_COMPLETE\n");
@@ -724,7 +707,7 @@
 	}
 
 	if (!switch_test_flag(tts_session, FLAG_FEED_STARTED)) {
-		switch_set_flag(tts_session, FLAG_FEED_STARTED);  // shouldn't this use set_flag_locked? -tl
+		switch_set_flag(tts_session, FLAG_FEED_STARTED);	// shouldn't this use set_flag_locked? -tl
 		if (audio_source->method_set->open) {
 			audio_source->method_set->open(audio_source);
 		}
@@ -733,8 +716,8 @@
 	/* sampling rate and frame size should be retrieved from audio source */
 	*rate = 8000;
 	media_frame.codec_frame.size = 160;
-	while(return_len < *datalen) {
-		media_frame.codec_frame.buffer = (char*)data + return_len;
+	while (return_len < *datalen) {
+		media_frame.codec_frame.buffer = (char *) data + return_len;
 		audio_source->method_set->read_frame(audio_source, &media_frame);
 		if (media_frame.type != MEDIA_FRAME_TYPE_AUDIO) {
 			memset(media_frame.codec_frame.buffer, 0, media_frame.codec_frame.size);
@@ -742,7 +725,7 @@
 		return_len += media_frame.codec_frame.size;
 	}
 	*datalen = return_len;
-	return SWITCH_STATUS_SUCCESS;	
+	return SWITCH_STATUS_SUCCESS;
 }
 
 
@@ -752,7 +735,7 @@
 	mrcp_client_context_t *context = tts_session->profile->mrcp_context;
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "flush_tts called\n");
-	synth_stop(context, tts_session); // TODO
+	synth_stop(context, tts_session);	// TODO
 }
 
 static void openmrcp_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
@@ -797,8 +780,7 @@
 				apt_log_priority_set(atoi(val));
 			}
 		}
-	}
-	else {
+	} else {
 		goto error;
 	}
 	if ((profiles = switch_xml_child(cfg, "profiles"))) {
@@ -818,9 +800,8 @@
 				const char *val = switch_xml_attr_soft(param, "value");
 
 				if (!strcasecmp(var, "proto_version")) {
-					mrcp_options->proto_version =(mrcp_version_t) atoi(val);
-				}
-				else if (!strcasecmp(var, "client_ip")) {
+					mrcp_options->proto_version = (mrcp_version_t) atoi(val);
+				} else if (!strcasecmp(var, "client_ip")) {
 					mrcp_options->client_ip = switch_core_strdup(openmrcp_module.pool, val);
 				} else if (!strcasecmp(var, "server_ip")) {
 					mrcp_options->server_ip = switch_core_strdup(openmrcp_module.pool, val);
@@ -835,27 +816,24 @@
 				}
 			}
 			mrcp_profile->mrcp_options = mrcp_options;
-			
+
 			/* add profile */
 			if (!switch_core_hash_find(openmrcp_module.profile_hash, mrcp_profile->name)) {
 				if (openmrcp_profile_run(mrcp_profile) == SWITCH_STATUS_SUCCESS) {
 					switch_core_hash_insert(openmrcp_module.profile_hash, mrcp_profile->name, mrcp_profile);
 				}
-			}
-			else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-					"profile with the name [%s] already exists\n", mrcp_profile->name);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "profile with the name [%s] already exists\n", mrcp_profile->name);
 			}
 		}
-	}
-	else {
+	} else {
 		goto error;
 	}
 
 	switch_xml_free(xml);
 	return SWITCH_STATUS_SUCCESS;
 
- error:
+  error:
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load module configuration\n");
 	switch_xml_free(xml);
 	return SWITCH_STATUS_TERM;
@@ -867,10 +845,10 @@
 	mrcp_client_event_handler_t *mrcp_event_handler;
 	mrcp_client_t *mrcp_client;
 	mrcp_client_context_t *mrcp_context;
-	
+
 	/*!
-	Perform one-time initialization of mrcp client library
-	*/
+	   Perform one-time initialization of mrcp client library
+	 */
 	mrcp_event_handler = switch_core_alloc(openmrcp_module.pool, sizeof(mrcp_client_event_handler_t));
 	mrcp_event_handler->on_session_initiate = openmrcp_on_session_initiate;
 	mrcp_event_handler->on_session_terminate = openmrcp_on_session_terminate;
@@ -902,7 +880,7 @@
 static switch_status_t openmrcp_init()
 {
 	/* one-time mrcp global initialization */
-	if(apr_pool_create(&openmrcp_module.pool,NULL) != APR_SUCCESS) {
+	if (apr_pool_create(&openmrcp_module.pool, NULL) != APR_SUCCESS) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -931,7 +909,7 @@
 		/* shutdown client engine */
 		openmrcp_client_shutdown(mrcp_profile->mrcp_client);
 		/* destroy client context */
-		mrcp_client_context_destroy(mrcp_profile->mrcp_context);		
+		mrcp_client_context_destroy(mrcp_profile->mrcp_context);
 	}
 	switch_core_hash_destroy(&openmrcp_module.profile_hash);
 	openmrcp_module.profile_hash = NULL;
@@ -973,7 +951,7 @@
 
 	/* initialize openmrcp */
 	if (openmrcp_init() != SWITCH_STATUS_SUCCESS) {
-		return SWITCH_STATUS_FALSE;		
+		return SWITCH_STATUS_FALSE;
 	}
 
 	/* indicate that the module should continue to be loaded */

Modified: freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c	Tue May 27 00:54:52 2008
@@ -139,8 +139,8 @@
 
 	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(struct amr_context))))) {
 		return SWITCH_STATUS_FALSE;
-	} else {	
-	
+	} else {
+
 		context->dtx_mode = AMR_DTX_ENABLED;
 		if (codec->fmtp_in) {
 			argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -207,7 +207,8 @@
 			context->enc_mode = globals.default_bitrate;
 		}
 
-		switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
+		switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0,
+						context->enc_mode);
 		codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
 
 		context->enc_mode = AMR_DEFAULT_BITRATE;
@@ -249,8 +250,7 @@
 										 switch_codec_t *other_codec,
 										 void *decoded_data,
 										 uint32_t decoded_data_len,
-										 uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
-										 unsigned int *flag)
+										 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
 {
 #ifdef AMR_PASSTHROUGH
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
@@ -272,8 +272,7 @@
 										 switch_codec_t *other_codec,
 										 void *encoded_data,
 										 uint32_t encoded_data_len,
-										 uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
-										 unsigned int *flag)
+										 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
 {
 #ifdef AMR_PASSTHROUGH
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
@@ -320,10 +319,9 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	SWITCH_ADD_CODEC(codec_interface, "AMR");
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_AUDIO, 96, "AMR", "octet-align=0", 8000, 8000, 12200,
-                                         20000, 160, 320, 0, 1, 1, 1,
-                                         switch_amr_init, switch_amr_encode, switch_amr_decode, switch_amr_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO, 96, "AMR", "octet-align=0", 8000, 8000, 12200,
+										 20000, 160, 320, 0, 1, 1, 1, switch_amr_init, switch_amr_encode, switch_amr_decode, switch_amr_destroy);
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/codecs/mod_g723_1/mod_g723_1.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g723_1/mod_g723_1.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_g723_1/mod_g723_1.c	Tue May 27 00:54:52 2008
@@ -110,7 +110,7 @@
 										  switch_codec_t *other_codec,
 										  void *decoded_data,
 										  uint32_t decoded_data_len,
-										  uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										  uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										  unsigned int *flag)
 {
 #ifdef G723_PASSTHROUGH
@@ -141,7 +141,7 @@
 										  switch_codec_t *other_codec,
 										  void *encoded_data,
 										  uint32_t encoded_data_len,
-										  uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										  uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										  unsigned int *flag)
 {
 #ifdef G723_PASSTHROUGH
@@ -170,16 +170,16 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_g723_1_load)
 {
 	switch_codec_interface_t *codec_interface;
-    int mpf = 30000, spf = 240, bpf = 480, ebpf = 24, count;
+	int mpf = 30000, spf = 240, bpf = 480, ebpf = 24, count;
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_CODEC(codec_interface, "G.723.1 6.3k");
-    for (count = 1; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 4, "G723", NULL, 8000, 8000, 6300,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 4, 
-                                             switch_g723_init, switch_g723_encode, switch_g723_decode, switch_g723_destroy);
-    }
+	for (count = 1; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 4, "G723", NULL, 8000, 8000, 6300,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 4,
+											 switch_g723_init, switch_g723_encode, switch_g723_decode, switch_g723_destroy);
+	}
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c	Tue May 27 00:54:52 2008
@@ -95,7 +95,7 @@
 										  switch_codec_t *other_codec,
 										  void *decoded_data,
 										  uint32_t decoded_data_len,
-										  uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										  uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										  unsigned int *flag)
 {
 #ifdef G729_PASSTHROUGH
@@ -138,7 +138,7 @@
 										  switch_codec_t *other_codec,
 										  void *encoded_data,
 										  uint32_t encoded_data_len,
-										  uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										  uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										  unsigned int *flag)
 {
 #ifdef G729_PASSTHROUGH
@@ -154,7 +154,7 @@
 	}
 
 	if (encoded_data_len % 2 == 0) {
-		
+
 		if (encoded_data_len == 2 || encoded_data_len % 12 == 0) {
 			return SWITCH_STATUS_BREAK;
 			//divisor = 12;
@@ -209,18 +209,18 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_g729_load)
 {
 	switch_codec_interface_t *codec_interface;
-    int mpf = 10000, spf = 80, bpf = 160, ebpf = 10, count;
+	int mpf = 10000, spf = 80, bpf = 160, ebpf = 10, count;
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	SWITCH_ADD_CODEC(codec_interface, "G.729");
-    for (count = 12; count > 0; count--) { 
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 18, "G729", NULL, 8000, 8000, 8000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g729_init, switch_g729_encode, switch_g729_decode, switch_g729_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 18, "G729", NULL, 8000, 8000, 8000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g729_init, switch_g729_encode, switch_g729_decode, switch_g729_destroy);
+	}
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/codecs/mod_h26x/mod_h26x.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_h26x/mod_h26x.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_h26x/mod_h26x.c	Tue May 27 00:54:52 2008
@@ -45,7 +45,7 @@
 	if (!(encoding || decoding)) {
 		return SWITCH_STATUS_FALSE;
 	} else {
-		if (codec->fmtp_in) { 
+		if (codec->fmtp_in) {
 			codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in);
 		}
 		return SWITCH_STATUS_SUCCESS;
@@ -53,21 +53,21 @@
 }
 
 static switch_status_t switch_h26x_encode(switch_codec_t *codec,
-										 switch_codec_t *other_codec,
-										 void *decoded_data,
-										 uint32_t decoded_data_len,
-										 uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
-										 unsigned int *flag)
+										  switch_codec_t *other_codec,
+										  void *decoded_data,
+										  uint32_t decoded_data_len,
+										  uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+										  unsigned int *flag)
 {
 	return SWITCH_STATUS_FALSE;
 }
 
 static switch_status_t switch_h26x_decode(switch_codec_t *codec,
-										 switch_codec_t *other_codec,
-										 void *encoded_data,
-										 uint32_t encoded_data_len,
-										 uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
-										 unsigned int *flag)
+										  switch_codec_t *other_codec,
+										  void *encoded_data,
+										  uint32_t encoded_data_len,
+										  uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+										  unsigned int *flag)
 {
 	return SWITCH_STATUS_FALSE;
 }
@@ -83,30 +83,25 @@
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_CODEC(codec_interface, "H.264 Video (passthru)");
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_VIDEO, 99, "H264", NULL, 90000, 90000, 0,
-                                         0, 0, 0, 0, 1, 1, 1,
-                                         switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_VIDEO, 99, "H264", NULL, 90000, 90000, 0,
+										 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
 	SWITCH_ADD_CODEC(codec_interface, "H.263 Video (passthru)");
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_VIDEO, 34, "H263", NULL, 90000, 90000, 0,
-                                         0, 0, 0, 0, 1, 1, 1,
-                                         switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_VIDEO, 34, "H263", NULL, 90000, 90000, 0,
+										 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
 	SWITCH_ADD_CODEC(codec_interface, "H.263+ Video (passthru)");
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_VIDEO, 115, "H263-1998", NULL, 90000, 90000, 0,
-                                         0, 0, 0, 0, 1, 1, 1,
-                                         switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_VIDEO, 115, "H263-1998", NULL, 90000, 90000, 0,
+										 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
 	SWITCH_ADD_CODEC(codec_interface, "H.263++ Video (passthru)");
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_VIDEO, 121, "H263-2000", NULL, 90000, 90000, 0,
-                                         0, 0, 0, 0, 1, 1, 1,
-                                         switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_VIDEO, 121, "H263-2000", NULL, 90000, 90000, 0,
+										 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
 	SWITCH_ADD_CODEC(codec_interface, "H.261 Video (passthru)");
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_VIDEO, 31, "H261", NULL, 90000, 90000, 0,
-                                         0, 0, 0, 0, 1, 1, 1,
-                                         switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_VIDEO, 31, "H261", NULL, 90000, 90000, 0,
+										 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/codecs/mod_ilbc/mod_ilbc.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_ilbc/mod_ilbc.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_ilbc/mod_ilbc.c	Tue May 27 00:54:52 2008
@@ -97,7 +97,7 @@
 										  switch_codec_t *other_codec,
 										  void *decoded_data,
 										  uint32_t decoded_data_len,
-										  uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										  uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										  unsigned int *flag)
 {
 	struct ilbc_context *context = codec->private_info;
@@ -137,7 +137,7 @@
 										  switch_codec_t *other_codec,
 										  void *encoded_data,
 										  uint32_t encoded_data_len,
-										  uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										  uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										  unsigned int *flag)
 {
 	struct ilbc_context *context = codec->private_info;
@@ -187,31 +187,31 @@
 
 	SWITCH_ADD_CODEC(codec_interface, "iLBC");
 
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_AUDIO, 97, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
-                                         20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
-                                         switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
-                                         20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
-                                         switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC102", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
-                                         20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
-                                         switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC20ms", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
-                                         20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
-                                         switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-    /* 30ms variants */
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_AUDIO, 98, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
-                                         30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
-                                         switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
-                                         30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
-                                         switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO, 97, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
+										 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
+										 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC102", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
+										 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC20ms", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
+										 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+	/* 30ms variants */
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO, 98, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
+										 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
+										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
+										 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
+										 switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/codecs/mod_speex/mod_speex.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_speex/mod_speex.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_speex/mod_speex.c	Tue May 27 00:54:52 2008
@@ -159,7 +159,7 @@
 										   switch_codec_t *other_codec,
 										   void *decoded_data,
 										   uint32_t decoded_data_len,
-										   uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										   unsigned int *flag)
 {
 	struct speex_context *context = codec->private_info;
@@ -211,7 +211,7 @@
 										   switch_codec_t *other_codec,
 										   void *encoded_data,
 										   uint32_t encoded_data_len,
-										   uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										   uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										   unsigned int *flag)
 {
 	struct speex_context *context = codec->private_info;
@@ -264,24 +264,24 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_speex_load)
 {
 	switch_codec_interface_t *codec_interface;
-    int mpf = 20000, spf = 160, bpf = 320, ebpf = 0, rate = 8000, counta, countb;
-    switch_payload_t ianacode[4] = { 0, 98, 99, 103};
-    int bps[4] = { 0, 24600, 42200, 44000 };
+	int mpf = 20000, spf = 160, bpf = 320, ebpf = 0, rate = 8000, counta, countb;
+	switch_payload_t ianacode[4] = { 0, 98, 99, 103 };
+	int bps[4] = { 0, 24600, 42200, 44000 };
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_CODEC(codec_interface, "Speex");
-    for (counta = 1; counta <= 3; counta++) {
-        for (countb = 1; countb > 0; countb--) {
-            switch_core_codec_add_implementation(pool, codec_interface,
-                                                 SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "SPEEX", NULL, rate, rate, bps[counta],
-                                                 mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, 1, 6,
-                                                 switch_speex_init, switch_speex_encode, switch_speex_decode, switch_speex_destroy);
-        }
-        rate = rate * 2;
-        spf = spf * 2;
-        bpf = bpf * 2;
-        ebpf = ebpf * 2;
-    }
+	for (counta = 1; counta <= 3; counta++) {
+		for (countb = 1; countb > 0; countb--) {
+			switch_core_codec_add_implementation(pool, codec_interface,
+												 SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "SPEEX", NULL, rate, rate, bps[counta],
+												 mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, 1, 6,
+												 switch_speex_init, switch_speex_encode, switch_speex_decode, switch_speex_destroy);
+		}
+		rate = rate * 2;
+		spf = spf * 2;
+		bpf = bpf * 2;
+		ebpf = ebpf * 2;
+	}
 
 
 

Modified: freeswitch/trunk/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c	Tue May 27 00:54:52 2008
@@ -81,7 +81,7 @@
 										   switch_codec_t *other_codec,
 										   void *decoded_data,
 										   uint32_t decoded_data_len,
-										   uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										   unsigned int *flag)
 {
 	struct lpc10_context *context = codec->private_info;
@@ -99,7 +99,7 @@
 										   switch_codec_t *other_codec,
 										   void *encoded_data,
 										   uint32_t encoded_data_len,
-										   uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										   uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										   unsigned int *flag)
 {
 	struct lpc10_context *context = codec->private_info;
@@ -138,8 +138,8 @@
 		}
 		if (decoding) {
 			gsm0610_init(&context->decoder_object, GSM0610_PACKING_VOIP);
- 		}
-		
+		}
+
 		codec->private_info = context;
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -149,8 +149,7 @@
 										 switch_codec_t *other_codec,
 										 void *decoded_data,
 										 uint32_t decoded_data_len,
-										 uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
-										 unsigned int *flag)
+										 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
 {
 	struct gsm_context *context = codec->private_info;
 
@@ -167,8 +166,7 @@
 										 switch_codec_t *other_codec,
 										 void *encoded_data,
 										 uint32_t encoded_data_len,
-										 uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
-										 unsigned int *flag)
+										 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
 {
 	struct gsm_context *context = codec->private_info;
 
@@ -187,6 +185,7 @@
 	codec->private_info = NULL;
 	return SWITCH_STATUS_SUCCESS;
 }
+
 /*  GSM       - END */
 
 #ifdef ENABLE_G711
@@ -209,7 +208,7 @@
 										   switch_codec_t *other_codec,
 										   void *decoded_data,
 										   uint32_t decoded_data_len,
-										   uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										   unsigned int *flag)
 {
 	short *dbuf;
@@ -232,7 +231,7 @@
 										   switch_codec_t *other_codec,
 										   void *encoded_data,
 										   uint32_t encoded_data_len,
-										   uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										   uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										   unsigned int *flag)
 {
 	short *dbuf;
@@ -280,7 +279,7 @@
 										   switch_codec_t *other_codec,
 										   void *decoded_data,
 										   uint32_t decoded_data_len,
-										   uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										   unsigned int *flag)
 {
 	short *dbuf;
@@ -303,7 +302,7 @@
 										   switch_codec_t *other_codec,
 										   void *encoded_data,
 										   uint32_t encoded_data_len,
-										   uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										   uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										   unsigned int *flag)
 {
 	short *dbuf;
@@ -370,7 +369,7 @@
 										  switch_codec_t *other_codec,
 										  void *decoded_data,
 										  uint32_t decoded_data_len,
-										  uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										  uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										  unsigned int *flag)
 {
 	struct g722_context *context = codec->private_info;
@@ -388,7 +387,7 @@
 										  switch_codec_t *other_codec,
 										  void *encoded_data,
 										  uint32_t encoded_data_len,
-										  uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										  uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										  unsigned int *flag)
 {
 	struct g722_context *context = codec->private_info;
@@ -416,8 +415,8 @@
 static switch_status_t switch_g726_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
 {
 	uint32_t encoding, decoding;
-    int packing = G726_PACKING_RIGHT;
-    g726_state_t *context;
+	int packing = G726_PACKING_RIGHT;
+	g726_state_t *context;
 
 	encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
 	decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
@@ -426,10 +425,10 @@
 		return SWITCH_STATUS_FALSE;
 	} else {
 		if ((flags & SWITCH_CODEC_FLAG_AAL2 || strstr(codec->implementation->iananame, "AAL2"))) {
-            packing = G726_PACKING_LEFT;
-        } 
+			packing = G726_PACKING_LEFT;
+		}
 
-        g726_init(context, codec->implementation->bits_per_second, G726_ENCODING_LINEAR, packing);
+		g726_init(context, codec->implementation->bits_per_second, G726_ENCODING_LINEAR, packing);
 
 		codec->private_info = context;
 		return SWITCH_STATUS_SUCCESS;
@@ -446,7 +445,7 @@
 										  switch_codec_t *other_codec,
 										  void *decoded_data,
 										  uint32_t decoded_data_len,
-										  uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										  uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										  unsigned int *flag)
 {
 	g726_state_t *context = codec->private_info;
@@ -455,7 +454,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-    *encoded_data_len = g726_encode(context, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
+	*encoded_data_len = g726_encode(context, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -464,16 +463,16 @@
 										  switch_codec_t *other_codec,
 										  void *encoded_data,
 										  uint32_t encoded_data_len,
-										  uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										  uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										  unsigned int *flag)
 {
-    g726_state_t *context = codec->private_info;
+	g726_state_t *context = codec->private_info;
 
 	if (!context) {
 		return SWITCH_STATUS_FALSE;
 	}
 
-    *decoded_data_len = (2 * g726_decode(context, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
+	*decoded_data_len = (2 * g726_decode(context, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -503,8 +502,8 @@
 		}
 		if (decoding) {
 			ima_adpcm_init(&context->decoder_object, IMA_ADPCM_DVI4, 0);
- 		}
-		
+		}
+
 		codec->private_info = context;
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -514,7 +513,7 @@
 										   switch_codec_t *other_codec,
 										   void *decoded_data,
 										   uint32_t decoded_data_len,
-										   uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+										   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
 										   unsigned int *flag)
 {
 	struct ima_adpcm_context *context = codec->private_info;
@@ -532,7 +531,7 @@
 										   switch_codec_t *other_codec,
 										   void *encoded_data,
 										   uint32_t encoded_data_len,
-										   uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+										   uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
 										   unsigned int *flag)
 {
 	struct ima_adpcm_context *context = codec->private_info;
@@ -559,7 +558,7 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_voipcodecs_load)
 {
 	switch_codec_interface_t *codec_interface;
-    int mpf, spf, bpf, ebpf, count;
+	int mpf, spf, bpf, ebpf, count;
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -567,134 +566,133 @@
 	/* IMA_ADPCM */
 	mpf = 10000, spf = 80, bpf = 160, ebpf = 80;
 	SWITCH_ADD_CODEC(codec_interface, "ADPCM (IMA)");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 5, "DVI4", NULL, 8000, 8000, 32000,
-                                             mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
-                                             switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 5, "DVI4", NULL, 8000, 8000, 32000,
+											 mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
+											 switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
+	}
 	mpf = 10000, spf = 160, bpf = 320, ebpf = 160;
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 6, "DVI4", NULL, 16000, 16000, 64000,
-                                             mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
-                                             switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 6, "DVI4", NULL, 16000, 16000, 64000,
+											 mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
+											 switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
+	}
 
 	/* G726 */
 	mpf = 10000, spf = 80, bpf = 160, ebpf = 20;
 	SWITCH_ADD_CODEC(codec_interface, "G.726 16k (AAL2)");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 124, "AAL2-G726-16", NULL, 8000, 8000, 16000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 124, "AAL2-G726-16", NULL, 8000, 8000, 16000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+	}
 	SWITCH_ADD_CODEC(codec_interface, "G.726 16k");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 127, "G726-16", NULL, 8000, 8000, 16000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
-    }
-    /* Increase encoded bytes per frame by 10 */
-    ebpf = ebpf + 10;
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 127, "G726-16", NULL, 8000, 8000, 16000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+	}
+	/* Increase encoded bytes per frame by 10 */
+	ebpf = ebpf + 10;
 
 	SWITCH_ADD_CODEC(codec_interface, "G.726 24k (AAL2)");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 123, "AAL2-G726-24", NULL, 8000, 8000, 24000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 123, "AAL2-G726-24", NULL, 8000, 8000, 24000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+	}
 	SWITCH_ADD_CODEC(codec_interface, "G.726 24k");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 126, "G726-24", NULL, 8000, 8000, 24000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
-    }
-    /* Increase encoded bytes per frame by 10 */
-    ebpf = ebpf + 10;
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 126, "G726-24", NULL, 8000, 8000, 24000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+	}
+	/* Increase encoded bytes per frame by 10 */
+	ebpf = ebpf + 10;
 
 	SWITCH_ADD_CODEC(codec_interface, "G.726 32k (AAL2)");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 2, "AAL2-G726-32", NULL, 8000, 8000, 32000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 2, "AAL2-G726-32", NULL, 8000, 8000, 32000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+	}
 	SWITCH_ADD_CODEC(codec_interface, "G.726 32k");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 2, "G726-32", NULL, 8000, 8000, 32000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
-    }
-    /* Increase encoded bytes per frame by 10 */
-    ebpf = ebpf + 10;
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 2, "G726-32", NULL, 8000, 8000, 32000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+	}
+	/* Increase encoded bytes per frame by 10 */
+	ebpf = ebpf + 10;
 
 	SWITCH_ADD_CODEC(codec_interface, "G.726 40k (AAL2)");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 122, "AAL2-G726-40", NULL, 8000, 8000, 40000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 122, "AAL2-G726-40", NULL, 8000, 8000, 40000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+	}
 	SWITCH_ADD_CODEC(codec_interface, "G.726 40k");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 125, "G726-40", NULL, 8000, 8000, 40000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 125, "G726-40", NULL, 8000, 8000, 40000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+	}
 
 	/* G722 */
 	mpf = 10000, spf = 80, bpf = 320, ebpf = 80;
 	SWITCH_ADD_CODEC(codec_interface, "G.722");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 9, "G722", NULL, 8000, 16000, 64000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g722_init, switch_g722_encode, switch_g722_decode, switch_g722_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 9, "G722", NULL, 8000, 16000, 64000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g722_init, switch_g722_encode, switch_g722_decode, switch_g722_destroy);
+	}
 
 #ifdef ENABLE_G711
 	/* G711 */
 	mpf = 10000, spf = 80, bpf = 160, ebpf = 80;
 	SWITCH_ADD_CODEC(codec_interface, "G.711 ulaw");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 0, "PCMU", NULL, 8000, 8000, 64000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g711u_init, switch_g711u_encode, switch_g711u_decode, switch_g711u_destroy);
-    }
-    
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 0, "PCMU", NULL, 8000, 8000, 64000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g711u_init, switch_g711u_encode, switch_g711u_decode, switch_g711u_destroy);
+	}
+
 	SWITCH_ADD_CODEC(codec_interface, "G.711 alaw");
-    for (count = 12; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 8, "PCMA", NULL, 8000, 8000, 64000,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
-                                             switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
-    }
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 8, "PCMA", NULL, 8000, 8000, 64000,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+											 switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
+	}
 #endif
 
 	/* GSM */
 	mpf = 20000, spf = 160, bpf = 320, ebpf = 33;
 	SWITCH_ADD_CODEC(codec_interface, "GSM");
-    for (count = 6; count > 0; count--) {
-        switch_core_codec_add_implementation(pool, codec_interface,
-                                             SWITCH_CODEC_TYPE_AUDIO, 3, "GSM", NULL, 8000, 8000, 13200,
-                                             mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 6,
-                                             switch_gsm_init, switch_gsm_encode, switch_gsm_decode, switch_gsm_destroy);
-    }
+	for (count = 6; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO, 3, "GSM", NULL, 8000, 8000, 13200,
+											 mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 6,
+											 switch_gsm_init, switch_gsm_encode, switch_gsm_decode, switch_gsm_destroy);
+	}
 	/* LPC10 */
 #if SWITCH_MAX_INTERVAL >= 90
 	SWITCH_ADD_CODEC(codec_interface, "LPC-10");
 	switch_core_codec_add_implementation(pool, codec_interface,
 										 SWITCH_CODEC_TYPE_AUDIO, 7, "LPC", NULL, 8000, 8000, 2400,
-										 90000, 720, 1440, 28, 1, 1, 1,
-										 switch_lpc10_init, switch_lpc10_encode, switch_lpc10_decode, switch_lpc10_destroy);
+										 90000, 720, 1440, 28, 1, 1, 1, switch_lpc10_init, switch_lpc10_encode, switch_lpc10_decode, switch_lpc10_destroy);
 #endif
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
==============================================================================
--- freeswitch/trunk/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c	(original)
+++ freeswitch/trunk/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c	Tue May 27 00:54:52 2008
@@ -58,31 +58,31 @@
 		if ((argc = switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
 			goto error;
 		}
-		
+
 		if (argc > 1) {
 			switch_channel_set_variable(channel, "call_timeout", argv[1]);
 		}
-		
-		switch_replace_char(argv[0], '&',',', SWITCH_FALSE);
-		
+
+		switch_replace_char(argv[0], '&', ',', SWITCH_FALSE);
+
 		if (exec_app(session, "bridge", argv[0]) != SWITCH_STATUS_SUCCESS) {
 			goto error;
 		}
-		
+
 		goto ok;
 	}
-	
- error:
+
+  error:
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error!\n");
 
- ok:
-	
+  ok:
+
 	return;
 }
 
 SWITCH_STANDARD_APP(avoid_function)
 {
-    void *y = NULL;
+	void *y = NULL;
 	int x = 0;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 
@@ -92,7 +92,7 @@
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "I should never be called!.\n");
-    memset((void *) y, 0, 1000);
+	memset((void *) y, 0, 1000);
 }
 
 SWITCH_STANDARD_APP(goto_function)
@@ -105,16 +105,16 @@
 		if ((argc = switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) {
 			goto error;
 		}
-		
+
 		switch_ivr_session_transfer(session, argv[1], "asterisk", argv[0]);
 		goto ok;
 	}
-	
- error:
+
+  error:
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error!\n");
 
- ok:
-	
+  ok:
+
 	return;
 }
 
@@ -134,14 +134,14 @@
 	if (!caller_profile) {
 		caller_profile = switch_channel_get_caller_profile(channel);
 	}
-	
+
 	if (!caller_profile || switch_strlen_zero(caller_profile->destination_number)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Obtaining Profile!\n");
 		return NULL;
 	}
 
 	context = caller_profile->context ? caller_profile->context : "default";
-	
+
 	if (!switch_config_open_file(&cfg, cf)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -166,11 +166,11 @@
 				const char *field_data = caller_profile->destination_number;
 				int proceed = 0;
 				switch_regex_t *re = NULL;
-				int ovector[30] = {0};
+				int ovector[30] = { 0 };
 				char *cid = NULL;
 
 				expression = expression_buf;
-						
+
 				argc = switch_separate_string(val, ',', argv, (sizeof(argv) / sizeof(argv[0])));
 				if (argc < 3) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "parse error line %d!\n", cfg.lineno);
@@ -178,14 +178,14 @@
 				}
 
 				pattern = argv[0];
-				
+
 				if (!strcasecmp(var, "exten")) {
 					char *p;
 					if (pattern && (p = strchr(pattern, '/'))) {
 						*p++ = '\0';
 						cid = pattern;
 						pattern = p;
-					}	
+					}
 				} else {
 					if (strchr(var, '$')) {
 						if ((field_expanded = switch_channel_expand_variables(channel, var)) == var) {
@@ -198,19 +198,19 @@
 						field_data = switch_caller_get_field_by_name(caller_profile, var);
 					}
 				}
-				
+
 				if (pattern && (*pattern == '_' || *pattern == '~')) {
 					if (*pattern == '_') {
 						pattern++;
 						if (switch_ast2regex(pattern, expression_buf, sizeof(expression_buf))) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "converting [%s] to real regex [%s] you should try them!\n", 
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "converting [%s] to real regex [%s] you should try them!\n",
 											  pattern, expression_buf);
 						}
 					} else {
 						pattern++;
 						expression = pattern;
 					}
-					
+
 					if (!field_data) {
 						field_data = "";
 					}
@@ -225,7 +225,7 @@
 						continue;
 					}
 				}
-				
+
 				if (cid) {
 					if (strcasecmp(cid, caller_profile->caller_id_number)) {
 						continue;
@@ -235,21 +235,21 @@
 				switch_channel_set_variable(channel, "EXTEN", caller_profile->destination_number);
 				switch_channel_set_variable(channel, "CHANNEL", switch_channel_get_name(channel));
 				switch_channel_set_variable(channel, "UNIQUEID", switch_core_session_get_uuid(session));
-				
+
 				pri = argv[1];
 				app = argv[2];
-				
+
 				if ((argument = strchr(app, '('))) {
 					char *p;
 					*argument++ = '\0';
 					p = strrchr(argument, ')');
 					if (p) {
-							*p = '\0';
+						*p = '\0';
 					}
 				} else if ((argument = strchr(app, ','))) {
 					*argument++ = '\0';
 				}
-				
+
 				if (!argument) {
 					argument = "";
 				}
@@ -274,10 +274,10 @@
 						break;
 					}
 				}
-				
+
 				switch_caller_extension_add_application(session, extension, app, argument);
 			}
-			
+
 			switch_safe_free(field_expanded);
 		}
 	}
@@ -291,18 +291,14 @@
 switch_endpoint_interface_t *sip_endpoint_interface;
 static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												switch_caller_profile_t *outbound_profile,
-												switch_core_session_t **new_session, 
-												switch_memory_pool_t **pool,
-												switch_originate_flag_t flags);
+												switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 switch_io_routines_t sip_io_routines = {
 	/*.outgoing_channel */ sip_outgoing_channel
 };
 
 static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												switch_caller_profile_t *outbound_profile,
-												switch_core_session_t **new_session, 
-												switch_memory_pool_t **pool,
-												switch_originate_flag_t flags)
+												switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
 	const char *profile;
 
@@ -326,18 +322,14 @@
 switch_endpoint_interface_t *iax2_endpoint_interface;
 static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, 
-												 switch_memory_pool_t **pool,
-												 switch_originate_flag_t flags);
+												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 switch_io_routines_t iax2_io_routines = {
 	/*.outgoing_channel */ iax2_outgoing_channel
 };
 
 static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, 
-												 switch_memory_pool_t **pool,
-												 switch_originate_flag_t flags)
+												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
 	return switch_core_session_outgoing_channel(session, var_event, "iax", outbound_profile, new_session, pool, SOF_NONE);
 }
@@ -346,7 +338,7 @@
 #define WE_DONT_NEED_NO_STINKIN_KEY "true"
 static char *key()
 {
-    return WE_DONT_NEED_NO_STINKIN_KEY;
+	return WE_DONT_NEED_NO_STINKIN_KEY;
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_asterisk_load)
@@ -359,7 +351,7 @@
 	if ((mykey = key())) {
 		mykey = NULL;
 	}
-	
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	/* add a dialplan interface */
@@ -369,7 +361,7 @@
 	SWITCH_ADD_APP(app_interface, "Dial", "Dial", "Dial", dial_function, "Dial", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "Goto", "Goto", "Goto", goto_function, "Goto", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "AvoidingDeadlock", "Avoid", "Avoid", avoid_function, "Avoid", SAF_SUPPORT_NOMEDIA);
-	
+
 	/* fake chan_sip facade */
 	sip_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
 	sip_endpoint_interface->interface_name = "SIP";
@@ -379,7 +371,7 @@
 	iax2_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
 	iax2_endpoint_interface->interface_name = "IAX2";
 	iax2_endpoint_interface->io_routines = &iax2_io_routines;
-	
+
 	if (getenv("FAITHFUL_EMULATION")) {
 		for (x = 0; x < 10; x++) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Avoiding Deadlock.\n");

Modified: freeswitch/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
==============================================================================
--- freeswitch/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	(original)
+++ freeswitch/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	Tue May 27 00:54:52 2008
@@ -96,7 +96,7 @@
 	if (!caller_profile) {
 		caller_profile = switch_channel_get_caller_profile(channel);
 	}
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Hello %s You Dialed %s!\n", caller_profile->caller_id_name,
 					  caller_profile->destination_number);
 
@@ -134,7 +134,7 @@
 			}
 		}
 	}
- out:
+  out:
 
 	switch_core_directory_close(&dh);
 

Modified: freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	(original)
+++ freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	Tue May 27 00:54:52 2008
@@ -185,15 +185,14 @@
 	return proceed;
 }
 
-static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t * root,
-										   switch_xml_t * node)
+static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t *root, switch_xml_t *node)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_GENERR;
 	switch_event_t *params = NULL;
 
 	switch_event_create(&params, SWITCH_EVENT_MESSAGE);
-    switch_assert(params);
+	switch_assert(params);
 
 	switch_channel_event_set_data(channel, params);
 
@@ -215,7 +214,7 @@
 			goto done;
 		}
 	}
-	
+
 	if (!caller_profile->context) {
 		caller_profile->context = "default";
 	}
@@ -265,7 +264,7 @@
 
 		proceed = parse_exten(session, caller_profile, xexten, &extension);
 
-		if (proceed && !switch_true(cont)) { 
+		if (proceed && !switch_true(cont)) {
 			break;
 		}
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c	Tue May 27 00:54:52 2008
@@ -139,8 +139,8 @@
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_device_name, globals.device_name);
 
 #define is_master(t) switch_test_flag(t, TFLAG_MASTER)
-static void add_pvt(private_t * tech_pvt, int master);
-static void remove_pvt(private_t * tech_pvt);
+static void add_pvt(private_t *tech_pvt, int master);
+static void remove_pvt(private_t *tech_pvt);
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
 static switch_status_t channel_on_routing(switch_core_session_t *session);
@@ -356,7 +356,7 @@
 
 
 
-static void add_pvt(private_t * tech_pvt, int master)
+static void add_pvt(private_t *tech_pvt, int master)
 {
 	private_t *tp;
 	uint8_t in_list = 0;
@@ -399,7 +399,7 @@
 	switch_mutex_unlock(globals.pvt_lock);
 }
 
-static void remove_pvt(private_t * tech_pvt)
+static void remove_pvt(private_t *tech_pvt)
 {
 	private_t *tp, *last = NULL;
 
@@ -562,8 +562,7 @@
 										  tech_pvt->hold_file,
 										  globals.read_codec.implementation->number_of_channels,
 										  globals.read_codec.implementation->actual_samples_per_second,
-										  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
-										  NULL) != SWITCH_STATUS_SUCCESS) {
+										  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 					switch_core_codec_destroy(&tech_pvt->write_codec);
 					tech_pvt->hold_file = NULL;
 					goto cng;
@@ -578,12 +577,12 @@
 
 			goto hold;
 		}
-	cng:
+	  cng:
 		switch_yield(globals.read_codec.implementation->microseconds_per_frame);
 		*frame = &globals.cng_frame;
 		return SWITCH_STATUS_SUCCESS;
 
-	hold:
+	  hold:
 
 		{
 			switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
@@ -612,7 +611,7 @@
 	}
 
 	switch_mutex_lock(globals.device_lock);
-	if ((samples = snd_pcm_readi (globals.audio_stream_in, globals.read_frame.data, globals.read_codec.implementation->samples_per_frame)) > 0) {
+	if ((samples = snd_pcm_readi(globals.audio_stream_in, globals.read_frame.data, globals.read_codec.implementation->samples_per_frame)) > 0) {
 		globals.read_frame.datalen = samples * 2;
 		globals.read_frame.samples = samples;
 
@@ -887,7 +886,7 @@
 					globals.codec_ms = tmp;
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-									  "codec-ms must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL); 
+									  "codec-ms must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
 				}
 			} else if (!strcmp(var, "dialplan")) {
 				set_global_dialplan(val);
@@ -951,18 +950,18 @@
 	int err = 0;
 	snd_pcm_hw_params_t *hw_params = NULL;
 	char *device = globals.device_name;
-	
+
 	if (globals.audio_stream_in && globals.audio_stream_out) {
 		return SWITCH_STATUS_SUCCESS;
-	} 
+	}
 
 	if (globals.audio_stream_in) {
-		snd_pcm_close (globals.audio_stream_in);
+		snd_pcm_close(globals.audio_stream_in);
 		globals.audio_stream_in = NULL;
 	}
 
 	if (globals.audio_stream_out) {
-		snd_pcm_close (globals.audio_stream_out);
+		snd_pcm_close(globals.audio_stream_out);
 		globals.audio_stream_out = NULL;
 	}
 
@@ -976,33 +975,30 @@
 
 	if (switch_core_codec_init(&globals.read_codec,
 							   "L16",
-							   NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
-							   NULL) != SWITCH_STATUS_SUCCESS) {
+							   NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
 		return SWITCH_STATUS_FALSE;
 	} else {
 		if (switch_core_codec_init(&globals.write_codec,
 								   "L16",
 								   NULL,
-								   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
-								   NULL) != SWITCH_STATUS_SUCCESS) {
+								   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
 			switch_core_codec_destroy(&globals.read_codec);
 			return SWITCH_STATUS_FALSE;
 		}
 	}
-	
+
 	if (switch_core_timer_init(&globals.timer,
-							   globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame,
-							   module_pool) != SWITCH_STATUS_SUCCESS) {
+							   globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame, module_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
 		switch_core_codec_destroy(&globals.read_codec);
 		switch_core_codec_destroy(&globals.write_codec);
 		return SWITCH_STATUS_FALSE;
 	}
 
-	
-	
+
+
 	globals.read_frame.rate = sample_rate;
 	globals.read_frame.codec = &globals.read_codec;
 
@@ -1011,176 +1007,152 @@
 	switch_mutex_lock(globals.device_lock);
 	/* LOCKED ************************************************************************************************** */
 
-		
-	if ((err = snd_pcm_open (&globals.audio_stream_out, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot open audio device %s (%s)\n", 
-						  device,
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_open(&globals.audio_stream_out, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot open audio device %s (%s)\n", device, snd_strerror(err));
 		goto fail;
 	}
 
-	if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot allocate hardware parameter structure (%s)\n",
-						  snd_strerror (err));
+	if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot allocate hardware parameter structure (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	 
-	if ((err = snd_pcm_hw_params_any (globals.audio_stream_out, hw_params)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot initialize hardware parameter structure (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_any(globals.audio_stream_out, hw_params)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	if ((err = snd_pcm_hw_params_set_access (globals.audio_stream_out, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set access type (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_set_access(globals.audio_stream_out, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set access type (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	if ((err = snd_pcm_hw_params_set_format (globals.audio_stream_out, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set sample format (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_set_format(globals.audio_stream_out, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample format (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	if ((err = snd_pcm_hw_params_set_rate_near (globals.audio_stream_out, hw_params, &sample_rate, 0)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set sample rate (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_set_rate_near(globals.audio_stream_out, hw_params, &sample_rate, 0)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample rate (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	if ((err = snd_pcm_hw_params_set_channels (globals.audio_stream_out, hw_params, 1)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set channel count (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_set_channels(globals.audio_stream_out, hw_params, 1)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set channel count (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	if ((err = snd_pcm_hw_params (globals.audio_stream_out, hw_params)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set parameters (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params(globals.audio_stream_out, hw_params)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set parameters (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	
-	snd_pcm_hw_params_free (hw_params);
+
+
+	snd_pcm_hw_params_free(hw_params);
 	hw_params = NULL;
 
 
-	if ((err = snd_pcm_open (&globals.audio_stream_in, device, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot open audio device %s (%s)\n", 
-						  device,
-						  snd_strerror (err));
+	if ((err = snd_pcm_open(&globals.audio_stream_in, device, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot open audio device %s (%s)\n", device, snd_strerror(err));
 		goto fail;
-	} 
+	}
 
-	if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot allocate hardware parameter structure (%s)\n",
-						  snd_strerror (err));
+	if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot allocate hardware parameter structure (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	 
-	if ((err = snd_pcm_hw_params_any (globals.audio_stream_in, hw_params)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot initialize hardware parameter structure (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_any(globals.audio_stream_in, hw_params)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	if ((err = snd_pcm_hw_params_set_access (globals.audio_stream_in, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set access type (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_set_access(globals.audio_stream_in, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set access type (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	if ((err = snd_pcm_hw_params_set_format (globals.audio_stream_in, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set sample format (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_set_format(globals.audio_stream_in, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample format (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	if ((err = snd_pcm_hw_params_set_rate_near (globals.audio_stream_in, hw_params, &sample_rate, 0)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set sample rate (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_set_rate_near(globals.audio_stream_in, hw_params, &sample_rate, 0)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample rate (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
-	if ((err = snd_pcm_hw_params_set_channels (globals.audio_stream_in, hw_params, 1)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set channel count (%s)\n",
-						  snd_strerror (err));
+
+	if ((err = snd_pcm_hw_params_set_channels(globals.audio_stream_in, hw_params, 1)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set channel count (%s)\n", snd_strerror(err));
 		goto fail;
 	}
 
-	if ((err = snd_pcm_hw_params_set_period_time (globals.audio_stream_in, hw_params, globals.read_codec.implementation->microseconds_per_frame, 0)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set period time (%s)\n",
-						  snd_strerror (err));
+	if ((err = snd_pcm_hw_params_set_period_time(globals.audio_stream_in, hw_params, globals.read_codec.implementation->microseconds_per_frame, 0)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set period time (%s)\n", snd_strerror(err));
 		goto fail;
 	}
 
-	if ((err = snd_pcm_hw_params_set_period_size (globals.audio_stream_in, hw_params, globals.read_codec.implementation->samples_per_frame, 0)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set period size (%s)\n",
-						  snd_strerror (err));
+	if ((err = snd_pcm_hw_params_set_period_size(globals.audio_stream_in, hw_params, globals.read_codec.implementation->samples_per_frame, 0)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set period size (%s)\n", snd_strerror(err));
 		goto fail;
 	}
 
-	if ((err = snd_pcm_hw_params (globals.audio_stream_in, hw_params)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot set parameters (%s)\n",
-						  snd_strerror (err));
+	if ((err = snd_pcm_hw_params(globals.audio_stream_in, hw_params)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set parameters (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-	
+
 	if (hw_params) {
-		snd_pcm_hw_params_free (hw_params);
+		snd_pcm_hw_params_free(hw_params);
 		hw_params = NULL;
 	}
 
-	if ((err = snd_pcm_prepare (globals.audio_stream_out)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot prepare audio interface for use (%s)\n",
-						  snd_strerror (err));
+	if ((err = snd_pcm_prepare(globals.audio_stream_out)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot prepare audio interface for use (%s)\n", snd_strerror(err));
 		goto fail;
 	}
 
-	if ((err = snd_pcm_start (globals.audio_stream_out)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot start audio interface for use (%s)\n",
-						  snd_strerror (err));
+	if ((err = snd_pcm_start(globals.audio_stream_out)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot start audio interface for use (%s)\n", snd_strerror(err));
 		goto fail;
 	}
 
-	if ((err = snd_pcm_prepare (globals.audio_stream_in)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot prepare audio interface for use (%s)\n",
-						  snd_strerror (err));
+	if ((err = snd_pcm_prepare(globals.audio_stream_in)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot prepare audio interface for use (%s)\n", snd_strerror(err));
 		goto fail;
 	}
 
-	if ((err = snd_pcm_start (globals.audio_stream_in)) < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,  "cannot start audio interface for use (%s)\n",
-						  snd_strerror (err));
+	if ((err = snd_pcm_start(globals.audio_stream_in)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot start audio interface for use (%s)\n", snd_strerror(err));
 		goto fail;
 	}
-		
+
 	switch_mutex_unlock(globals.device_lock);
 	return SWITCH_STATUS_SUCCESS;
 
- fail:
+  fail:
 
 	if (hw_params) {
-		snd_pcm_hw_params_free (hw_params);
+		snd_pcm_hw_params_free(hw_params);
 		hw_params = NULL;
 	}
 
 	switch_mutex_unlock(globals.device_lock);
 
 	if (globals.audio_stream_in) {
-		snd_pcm_close (globals.audio_stream_in);
+		snd_pcm_close(globals.audio_stream_in);
 	}
 
 	if (globals.audio_stream_out) {
-		snd_pcm_close (globals.audio_stream_out);
+		snd_pcm_close(globals.audio_stream_out);
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device!\n");
 	switch_core_codec_destroy(&globals.read_codec);
 	switch_core_codec_destroy(&globals.write_codec);
-	
-	return SWITCH_STATUS_FALSE;	
+
+	return SWITCH_STATUS_FALSE;
 
 
 
@@ -1189,8 +1161,8 @@
 static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
 {
 	char *dtmf_str = argv[0];
-	switch_dtmf_t dtmf = {0, switch_core_default_dtmf_duration(0)};
-	
+	switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
+
 	if (switch_strlen_zero(dtmf_str)) {
 		stream->write_function(stream, "No DTMF Supplied!\n");
 	} else {
@@ -1198,7 +1170,7 @@
 		if (globals.call_list) {
 			switch_channel_t *channel = switch_core_session_get_channel(globals.call_list->session);
 			char *p = dtmf_str;
-			while(p && *p) {
+			while (p && *p) {
 				dtmf.digit = *p;
 				switch_channel_queue_dtmf(channel, &dtmf);
 				p++;
@@ -1250,7 +1222,7 @@
 		stream->write_function(stream, "NO SUCH CALL\n");
 	}
 
- done:
+  done:
 	switch_mutex_unlock(globals.pvt_lock);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -1317,7 +1289,7 @@
 			break;
 		}
 	}
- done:
+  done:
 	switch_mutex_unlock(globals.pvt_lock);
 
 	stream->write_function(stream, "Answered %d channels.\n", x);
@@ -1371,7 +1343,7 @@
 		goto bad;
 	}
 
- desc:
+  desc:
 	x = 0;
 	stream->write_function(stream, "FLAGS: ");
 	if (switch_test_flag((&globals), GFLAG_EAR)) {
@@ -1388,9 +1360,9 @@
 
 	goto done;
 
- bad:
+  bad:
 	stream->write_function(stream, "Usage: flags [on|off] <flags>\n");
- done:
+  done:
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1487,12 +1459,9 @@
 
 		if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
 																  NULL,
-																  dialplan, cid_name, cid_num,
-																  ip, NULL, NULL, NULL, (char *) modname, NULL,
-																  dest)) != 0) {
+																  dialplan, cid_name, cid_num, ip, NULL, NULL, NULL, (char *) modname, NULL, dest)) != 0) {
 			char name[128];
-			snprintf(name, sizeof(name), "Alsa/%s",
-					 tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
+			snprintf(name, sizeof(name), "Alsa/%s", tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
 			switch_channel_set_name(channel, name);
 
 			switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
@@ -1504,7 +1473,7 @@
 			switch_channel_set_state(channel, CS_INIT);
 
 			if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
 				switch_core_session_destroy(&session);
 				stream->write_function(stream, "FAIL:Thread Error!\n");
 			} else {
@@ -1536,7 +1505,7 @@
 		http = switch_event_get_header(stream->param_event, "http-host");
 	}
 
-	
+
 	const char *usage_string = "USAGE:\n"
 		"--------------------------------------------------------------------------------\n"
 		"alsa help\n"
@@ -1546,8 +1515,7 @@
 		"alsa list\n"
 		"alsa switch [<call_id>|none]\n"
 		"alsa dtmf <digit string>\n"
-		"alsa flags [on|off] [ear] [mouth]\n"
-		"--------------------------------------------------------------------------------\n";
+		"alsa flags [on|off] [ear] [mouth]\n" "--------------------------------------------------------------------------------\n";
 
 	if (http) {
 #if 0
@@ -1638,14 +1606,13 @@
 		stream->write_function(stream, "Unknown Command [%s]\n", argv[0]);
 	}
 
- done:
+  done:
 
 	if (http) {
 
 		stream->write_function(stream,
 							   "<br><br><table align=center><tr><td><center><form method=post>\n"
 							   "<input type=text name=wcmd size=40><br><br>\n"
-
 							   "<input name=action type=submit value=\"call\"> "
 							   "<input name=action type=submit value=\"hangup\"> "
 							   "<input name=action type=submit value=\"list\"> "
@@ -1658,25 +1625,18 @@
 							   "<td><input name=action type=submit value=\"2\"></td>"
 							   "<td><input name=action type=submit value=\"3\"></td>\n"
 							   "<td><input name=action type=submit value=\"A\"></td></tr>\n"
-
 							   "<tr><td><input name=action type=submit value=\"4\"></td>"
 							   "<td><input name=action type=submit value=\"5\"></td>"
 							   "<td><input name=action type=submit value=\"6\"></td>\n"
 							   "<td><input name=action type=submit value=\"B\"></td></tr>\n"
-
 							   "<tr><td><input name=action type=submit value=\"7\"></td>"
 							   "<td><input name=action type=submit value=\"8\"></td>"
 							   "<td><input name=action type=submit value=\"9\"></td>\n"
 							   "<td><input name=action type=submit value=\"C\"></td></tr>\n"
-
 							   "<tr><td><input name=action type=submit value=\"*\"></td>"
 							   "<td><input name=action type=submit value=\"0\"></td>"
 							   "<td><input name=action type=submit value=\"#\"></td>\n"
-							   "<td><input name=action type=submit value=\"D\"></td></tr>\n"
-							   "</table>"
-							   
-							   "</form><br></center></td></tr></table>\n"
-							   );
+							   "<td><input name=action type=submit value=\"D\"></td></tr>\n" "</table>" "</form><br></center></td></tr></table>\n");
 	}
 
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Tue May 27 00:54:52 2008
@@ -53,11 +53,7 @@
 
 static char sub_sql[] =
 	"CREATE TABLE jabber_subscriptions (\n"
-	"   sub_from      VARCHAR(255),\n" 
-	"   sub_to        VARCHAR(255),\n" 
-	"   show_pres     VARCHAR(255),\n" 
-	"   status        VARCHAR(255)\n"
-	");\n";
+	"   sub_from      VARCHAR(255),\n" "   sub_to        VARCHAR(255),\n" "   show_pres     VARCHAR(255),\n" "   status        VARCHAR(255)\n" ");\n";
 
 
 typedef enum {
@@ -215,9 +211,9 @@
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
 
-static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlsession, ldl_signal_t dl_signal,
+static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal,
 									char *to, char *from, char *subject, char *msg);
-static ldl_status handle_response(ldl_handle_t * handle, char *id);
+static ldl_status handle_response(ldl_handle_t *handle, char *id);
 static switch_status_t load_config(void);
 static int sin_callback(void *pArg, int argc, char **argv, char **columnNames);
 
@@ -270,9 +266,8 @@
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
-
 #ifdef SWITCH_HAVE_ODBC
-    if (profile->odbc_dsn) {
+	if (profile->odbc_dsn) {
 		SQLHSTMT stmt;
 		if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
 			char *err_str;
@@ -292,11 +287,11 @@
 		switch_core_db_close(db);
 
 #ifdef SWITCH_HAVE_ODBC
-    }
+	}
 #endif
 
 
- end:
+  end:
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
@@ -304,22 +299,18 @@
 
 
 static switch_bool_t mdl_execute_sql_callback(mdl_profile_t *profile,
-											  switch_mutex_t *mutex,
-											  char *sql,
-											  switch_core_db_callback_func_t callback,
-											  void *pdata)
+											  switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
 	switch_bool_t ret = SWITCH_FALSE;
 	switch_core_db_t *db;
 	char *errmsg = NULL;
-	
-	if (mutex) {
-        switch_mutex_lock(mutex);
-    }
 
+	if (mutex) {
+		switch_mutex_lock(mutex);
+	}
 
 #ifdef SWITCH_HAVE_ODBC
-    if (profile->odbc_dsn) {
+	if (profile->odbc_dsn) {
 		switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
 	} else {
 #endif
@@ -331,7 +322,7 @@
 			goto end;
 		}
 
-	
+
 		switch_core_db_exec(db, sql, callback, pdata, &errmsg);
 
 		if (errmsg) {
@@ -342,18 +333,17 @@
 		if (db) {
 			switch_core_db_close(db);
 		}
-
 #ifdef SWITCH_HAVE_ODBC
-    }
+	}
 #endif
 
 
- end:
+  end:
 
 	if (mutex) {
-        switch_mutex_unlock(mutex);
-    }
-	
+		switch_mutex_unlock(mutex);
+	}
+
 
 
 	return ret;
@@ -418,11 +408,11 @@
 	char *rpid = switch_event_get_header(event, "rpid");
 	char *type = switch_event_get_header(event, "event_subtype");
 	char *sql;
-    
-    if (globals.running != 1) {
-        return;
-    }
-    
+
+	if (globals.running != 1) {
+		return;
+	}
+
 	if (!proto) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Missing 'proto' header\n");
 		return;
@@ -481,7 +471,8 @@
 	}
 
 
-	sql = switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from jabber_subscriptions where sub_to like '%%%q'", type, rpid, status, proto, from);
+	sql =
+		switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from jabber_subscriptions where sub_to like '%%%q'", type, rpid, status, proto, from);
 
 
 	for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
@@ -495,7 +486,7 @@
 
 		if (sql) {
 			switch_bool_t worked = mdl_execute_sql_callback(profile, profile->mutex, sql, sub_callback, profile);
-			
+
 			if (!worked) {
 				continue;
 			}
@@ -564,9 +555,9 @@
 	void *val;
 	char *sql;
 
-    if (globals.running != 1) {
-        return;
-    }
+	if (globals.running != 1) {
+		return;
+	}
 
 	if (status && !strcasecmp(status, "n/a")) {
 		status = NULL;
@@ -697,7 +688,7 @@
 
 		tech_pvt = switch_core_session_get_private(*session);
 
-		
+
 		if (tech_pvt && tech_pvt->profile && tech_pvt->profile->ip && tech_pvt->local_port) {
 			switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->local_port);
 		}
@@ -748,8 +739,7 @@
 						xml = switch_xml_parse_str(xmltxt, strlen(xmltxt));
 						form = switch_xml_toxml(xml, SWITCH_FALSE);
 						switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level,
-										  "%s:\n-------------------------------------------------------------------------------\n"
-										  "%s\n", ll, form);
+										  "%s:\n-------------------------------------------------------------------------------\n" "%s\n", ll, form);
 						switch_xml_free(xml);
 						free(data);
 					}
@@ -774,8 +764,7 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
 				return 0;
 			}
-		} else if (((tech_pvt->num_codecs =
-					 switch_loadable_module_get_codecs(tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
+		} else if (((tech_pvt->num_codecs = switch_loadable_module_get_codecs(tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
 			return 0;
 		}
@@ -786,7 +775,7 @@
 
 
 
-static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t *thread, void *obj)
 {
 	ldl_handle_t *handle = obj;
 	mdl_profile_t *profile = NULL;
@@ -805,7 +794,7 @@
 	return NULL;
 }
 
-static void handle_thread_launch(ldl_handle_t * handle)
+static void handle_thread_launch(ldl_handle_t *handle)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
@@ -873,7 +862,7 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip,
 					  tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
-	
+
 	flags = SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTO_CNG;
 
 	if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
@@ -1089,8 +1078,7 @@
 	while (!(switch_test_flag(tech_pvt, TFLAG_CODEC_READY) &&
 			 switch_test_flag(tech_pvt, TFLAG_RTP_READY) &&
 			 switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) &&
-			 tech_pvt->remote_ip && tech_pvt->remote_port
-			 && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
+			 tech_pvt->remote_ip && tech_pvt->remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
 		now = switch_timestamp_now();
 		elapsed = (unsigned int) ((now - started) / 1000);
 
@@ -1140,9 +1128,9 @@
 
 	goto done;
 
- out:
+  out:
 	terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- done:
+  done:
 
 	return ret;
 }
@@ -1222,7 +1210,7 @@
 	/* Dunno why, but if googletalk calls us for the first time, as soon as the call ends
 	   they think we are offline for no reason so we send this presence packet to stop it from happening
 	   We should find out why.....
-	*/
+	 */
 	if ((tech_pvt->profile->user_flags & LDL_FLAG_COMPONENT) && is_special(tech_pvt->them)) {
 		ldl_handle_send_presence(tech_pvt->profile->handle, tech_pvt->them, tech_pvt->us, NULL, NULL, "Click To Call", tech_pvt->profile->avatar);
 	}
@@ -1497,21 +1485,21 @@
 		break;
 	case SWITCH_MESSAGE_INDICATE_BRIDGE:
 		/*
-		if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
-			switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
-			//switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
-		}
-		*/
+		   if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
+		   switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+		   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
+		   //switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
+		   }
+		 */
 		break;
 	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
 		/*
-		if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
-			switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
-			//switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
-		}
-		*/
+		   if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
+		   switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+		   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
+		   //switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
+		   }
+		 */
 		break;
 	default:
 		break;
@@ -1618,7 +1606,7 @@
 			} else {
 				if (!user) {
 					const char *id_num;
-					
+
 					if (!(id_num = outbound_profile->caller_id_number)) {
 						if (!(id_num = outbound_profile->caller_id_name)) {
 							id_num = "nobody";
@@ -1810,7 +1798,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static ldl_status handle_loop(ldl_handle_t * handle)
+static ldl_status handle_loop(ldl_handle_t *handle)
 {
 	if (!globals.running) {
 		return LDL_STATUS_FALSE;
@@ -1829,7 +1817,7 @@
 
 	if (!(profile->login && profile->password && profile->dialplan && profile->message && profile->ip && profile->name && profile->exten)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-						  "Invalid Profile\n" "login[%s]\n" "pass[%s]\n" "dialplan[%s]\n" 
+						  "Invalid Profile\n" "login[%s]\n" "pass[%s]\n" "dialplan[%s]\n"
 						  "message[%s]\n" "rtp-ip[%s]\n" "name[%s]\n" "exten[%s]\n",
 						  profile->login, profile->password, profile->dialplan, profile->message, profile->ip, profile->name, profile->exten);
 
@@ -1886,7 +1874,8 @@
 
 static void set_profile_val(mdl_profile_t *profile, char *var, char *val)
 {
-	if (!var) return;
+	if (!var)
+		return;
 
 	if (!strcasecmp(var, "login")) {
 		profile->login = switch_core_strdup(module_pool, val);
@@ -1903,8 +1892,7 @@
 				*profile->odbc_pass++ = '\0';
 			}
 		}
-		
-		
+
 #else
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
 #endif
@@ -1912,7 +1900,7 @@
 		switch_set_flag(profile, TFLAG_TIMER);
 	} else if (!strcasecmp(var, "dialplan") && !switch_strlen_zero(val)) {
 		profile->dialplan = switch_core_strdup(module_pool, val);
-#ifdef AUTO_REPLY // gotta fix looping on this
+#ifdef AUTO_REPLY				// gotta fix looping on this
 	} else if (!strcasecmp(var, "auto-reply")) {
 		profile->auto_reply = switch_core_strdup(module_pool, val);
 #endif
@@ -2182,7 +2170,7 @@
 				if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
 					continue;
-					
+
 				}
 				if (switch_odbc_handle_connect(profile->master_odbc) != SWITCH_ODBC_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
@@ -2292,7 +2280,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 	}
 
- end:
+  end:
 
 	switch_event_destroy(&params);
 
@@ -2307,8 +2295,7 @@
 	switch_safe_free(xmlstr);
 }
 
-static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject,
-									char *msg)
+static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject, char *msg)
 {
 	mdl_profile_t *profile = NULL;
 	switch_core_session_t *session = NULL;
@@ -2350,11 +2337,8 @@
 						mdl_execute_sql(profile, sql, NULL);
 						switch_core_db_free(sql);
 					}
-					if ((sql = switch_mprintf("insert into jabber_subscriptions values('%q','%q','%q','%q');\n", 
-											  switch_str_nil(from),
-											  switch_str_nil(to),
-											  switch_str_nil(msg),
-											  switch_str_nil(subject)))) {
+					if ((sql = switch_mprintf("insert into jabber_subscriptions values('%q','%q','%q','%q');\n",
+											  switch_str_nil(from), switch_str_nil(to), switch_str_nil(msg), switch_str_nil(subject)))) {
 						mdl_execute_sql(profile, sql, NULL);
 						switch_core_db_free(sql);
 					}
@@ -2362,7 +2346,8 @@
 					if (is_special(to)) {
 						ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call", profile->avatar);
 					} else {
-						ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Authenticated.\nCome to ClueCon!\nhttp://www.cluecon.com", profile->avatar);
+						ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Authenticated.\nCome to ClueCon!\nhttp://www.cluecon.com",
+												 profile->avatar);
 					}
 #if 0
 					if (is_special(to)) {
@@ -2400,7 +2385,7 @@
 				break;
 			case LDL_SIGNAL_PRESENCE_IN:
 
-				if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'", 
+				if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'",
 										  switch_str_nil(msg), switch_str_nil(subject), switch_str_nil(from)))) {
 					mdl_execute_sql(profile, sql, profile->mutex);
 					switch_core_db_free(sql);
@@ -2435,7 +2420,7 @@
 
 			case LDL_SIGNAL_PRESENCE_OUT:
 
-				if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'", 
+				if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'",
 										  switch_str_nil(msg), switch_str_nil(subject), switch_str_nil(from)))) {
 					mdl_execute_sql(profile, sql, profile->mutex);
 					switch_core_db_free(sql);
@@ -2454,45 +2439,45 @@
 
 		switch (dl_signal) {
 		case LDL_SIGNAL_MSG:{
-			switch_chat_interface_t *ci;
-			char *proto = MDL_CHAT_PROTO;
-			char *pproto = NULL, *ffrom = NULL;
-			char *hint;
+				switch_chat_interface_t *ci;
+				char *proto = MDL_CHAT_PROTO;
+				char *pproto = NULL, *ffrom = NULL;
+				char *hint;
 #ifdef AUTO_REPLY
-			if (profile->auto_reply) {
-				ldl_handle_send_msg(handle,
-									(profile->user_flags & LDL_FLAG_COMPONENT) ? to : ldl_handle_get_login(profile->handle), from, "",
-									profile->auto_reply);
-			}
+				if (profile->auto_reply) {
+					ldl_handle_send_msg(handle,
+										(profile->user_flags & LDL_FLAG_COMPONENT) ? to : ldl_handle_get_login(profile->handle), from, "",
+										profile->auto_reply);
+				}
 #endif
 
-			if (strchr(to, '+')) {
-				pproto = strdup(to);
-				if ((to = strchr(pproto, '+'))) {
-					*to++ = '\0';
+				if (strchr(to, '+')) {
+					pproto = strdup(to);
+					if ((to = strchr(pproto, '+'))) {
+						*to++ = '\0';
+					}
+					proto = pproto;
 				}
-				proto = pproto;
-			}
 
-			hint = from;
+				hint = from;
 
-			if (strchr(from, '/') && (ffrom = strdup(from))) {
-				char *p;
-				if ((p = strchr(ffrom, '/'))) {
-					*p = '\0';
+				if (strchr(from, '/') && (ffrom = strdup(from))) {
+					char *p;
+					if ((p = strchr(ffrom, '/'))) {
+						*p = '\0';
+					}
+					from = ffrom;
 				}
-				from = ffrom;
-			}
 
-			if ((ci = switch_loadable_module_get_chat_interface(proto))) {
-				ci->chat_send(MDL_CHAT_PROTO, from, to, subject, msg, hint);
-			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Chat Interface [%s]!\n", proto);
-			}
+				if ((ci = switch_loadable_module_get_chat_interface(proto))) {
+					ci->chat_send(MDL_CHAT_PROTO, from, to, subject, msg, hint);
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Chat Interface [%s]!\n", proto);
+				}
 
-			switch_safe_free(pproto);
-			switch_safe_free(ffrom);
-		}
+				switch_safe_free(pproto);
+				switch_safe_free(ffrom);
+			}
 			break;
 		case LDL_SIGNAL_LOGIN_SUCCESS:
 			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_SUCCESS) == SWITCH_STATUS_SUCCESS) {
@@ -2547,7 +2532,7 @@
 		}
 		if ((session = switch_core_session_request(dingaling_endpoint_interface, NULL)) != 0) {
 			switch_core_session_add_stream(session, NULL);
-			
+
 			if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
 				char *exten;
 				char *context;
@@ -2641,10 +2626,7 @@
 																			  ldl_session_get_ip(dlsession),
 																			  ldl_session_get_value(dlsession, "ani"),
 																			  ldl_session_get_value(dlsession, "aniii"),
-																			  ldl_session_get_value(dlsession, "rdnis"),
-																			  modname,
-																			  context,
-																			  exten)) != 0) {
+																			  ldl_session_get_value(dlsession, "rdnis"), modname, context, exten)) != 0) {
 						char name[128];
 						switch_snprintf(name, sizeof(name), "DingaLing/%s", tech_pvt->caller_profile->destination_number);
 						switch_channel_set_name(channel, name);
@@ -2669,8 +2651,8 @@
 			if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
 				terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-                status = LDL_STATUS_FALSE;
-                goto done;
+				status = LDL_STATUS_FALSE;
+				goto done;
 			}
 		} else {
 			status = LDL_STATUS_FALSE;
@@ -2832,7 +2814,7 @@
 			}
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%u candidates\n", len);
-			
+
 			if (profile->acl_count) {
 				for (x = 0; x < len; x++) {
 					uint32_t y = 0;
@@ -2843,18 +2825,18 @@
 						}
 
 						if (ok) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n", 
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n",
 											  candidates[x].address, candidates[x].port, profile->acl[y]);
 							break;
 						} else {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n", 
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n",
 											  candidates[x].address, candidates[x].port, profile->acl[y]);
 						}
 					}
 				}
 			} else {
 				for (x = 0; x < len; x++) {
-					
+
 					if (profile->lanaddr) {
 						lanaddr = strncasecmp(candidates[x].address, profile->lanaddr, strlen(profile->lanaddr)) ? 0 : 1;
 					}
@@ -2879,9 +2861,8 @@
 									   strncasecmp(candidates[x].address, "172.2", 5) &&
 									   strncasecmp(candidates[x].address, "172.30.", 7) &&
 									   strncasecmp(candidates[x].address, "172.31.", 7) &&
-									   strncasecmp(candidates[x].address, "192.0.2.", 8) &&
-									   strncasecmp(candidates[x].address, "169.254.", 8)
-									   ))) {
+									   strncasecmp(candidates[x].address, "192.0.2.", 8) && strncasecmp(candidates[x].address, "169.254.", 8)
+						 ))) {
 						choice = x;
 						ok = 1;
 					}
@@ -2893,7 +2874,7 @@
 
 				memset(payloads, 0, sizeof(payloads));
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 								  "Acceptable Candidate %s:%d\n", candidates[choice].address, candidates[choice].port);
 
 				if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
@@ -2934,7 +2915,7 @@
 				status = LDL_STATUS_SUCCESS;
 			}
 
-			goto done;				
+			goto done;
 
 		}
 		break;
@@ -2961,14 +2942,14 @@
 		break;
 	}
 
-	
- done:
+
+  done:
 
 
 	return status;
 }
 
-static ldl_status handle_response(ldl_handle_t * handle, char *id)
+static ldl_status handle_response(ldl_handle_t *handle, char *id)
 {
 	return LDL_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/iax-mutex.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/iax-mutex.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/iax-mutex.c	Tue May 27 00:54:52 2008
@@ -47,7 +47,7 @@
 #endif
 	mutex_t *check = NULL;
 
-	check = (mutex_t *)malloc(sizeof(**mutex));
+	check = (mutex_t *) malloc(sizeof(**mutex));
 	if (!check)
 		goto done;
 #ifdef WIN32
@@ -64,16 +64,16 @@
 
 	goto success;
 
-fail:
-        pthread_mutexattr_destroy(&attr);
-		goto done;
+  fail:
+	pthread_mutexattr_destroy(&attr);
+	goto done;
 
-success:
+  success:
 #endif
 	*mutex = check;
 	status = MUTEX_SUCCESS;
 
-done:
+  done:
 	return status;
 }
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/iax.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/iax.c	Tue May 27 00:54:52 2008
@@ -1,16 +1,16 @@
  /*
- * libiax: An implementation of Inter-Asterisk eXchange
- *
- * Copyright (C) 2001, Linux Support Services, Inc.
- *
- * Mark Spencer <markster at linux-support.net>
- *
- * This program is free software, distributed under the terms of
- * the GNU Lesser (Library) General Public License
- */
- 
+  * libiax: An implementation of Inter-Asterisk eXchange
+  *
+  * Copyright (C) 2001, Linux Support Services, Inc.
+  *
+  * Mark Spencer <markster at linux-support.net>
+  *
+  * This program is free software, distributed under the terms of
+  * the GNU Lesser (Library) General Public License
+  */
+
 #ifdef	WIN32
-#undef __STRICT_ANSI__ //for strdup with ms
+#undef __STRICT_ANSI__			//for strdup with ms
 
 #include <string.h>
 #include <process.h>
@@ -35,7 +35,7 @@
 #define strdup _strdup
 #endif
 
-void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz);
+void gettimeofday(struct timeval *tv, void /*struct timezone */ *tz);
 #include "winpoop.h"
 
 #else
@@ -56,7 +56,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <time.h>
-       
+
 #endif
 
 #include "iax2.h"
@@ -79,13 +79,13 @@
 /* Define socket options for IAX2 sockets, based on platform
  * availability of flags */
 #ifdef WIN32
- #define IAX_SOCKOPTS 0
+#define IAX_SOCKOPTS 0
 #else
- #ifdef LINUX
- #define IAX_SOCKOPTS MSG_DONTWAIT | MSG_NOSIGNAL
- #else
- #define IAX_SOCKOPTS MSG_DONTWAIT
- #endif
+#ifdef LINUX
+#define IAX_SOCKOPTS MSG_DONTWAIT | MSG_NOSIGNAL
+#else
+#define IAX_SOCKOPTS MSG_DONTWAIT
+#endif
 #endif
 
 
@@ -141,12 +141,12 @@
 static int maxretries = 10;
 
 /* configurable jitterbuffer options */
-static long jb_target_extra = -1; 
+static long jb_target_extra = -1;
 
 static int do_shutdown = 0;
 
 /* external global networking replacements */
-static sendto_t	  iax_sendto = (sendto_t) sendto;
+static sendto_t iax_sendto = (sendto_t) sendto;
 static recvfrom_t iax_recvfrom = (recvfrom_t) recvfrom;
 
 /* ping interval (seconds) */
@@ -162,7 +162,7 @@
 	int quelch;
 	/* Codec Pref Order */
 	char codec_order[32];
-	/* Codec Pref Order Index*/
+	/* Codec Pref Order Index */
 	int codec_order_len;
 	/* Last received voice format */
 	int voiceformat;
@@ -238,14 +238,14 @@
 
 	/* ping scheduler id */
 	int pingid;
-	
+
 	/* Transfer stuff */
 	struct sockaddr_in transfer;
 	int transferring;
 	int transfercallno;
 	int transferid;
-	int transferpeer;	/* for attended transfer */
-	int transfer_moh;	/* for music on hold while performing attended transfer */
+	int transferpeer;			/* for attended transfer */
+	int transfer_moh;			/* for music on hold while performing attended transfer */
 
 #ifdef NEWJB
 	jitterbuf *jb;
@@ -261,7 +261,7 @@
 
 static void destroy_session(struct iax_session *session);
 
-#define IAXERROR snprintf(iax_errstr, sizeof(iax_errstr), 
+#define IAXERROR snprintf(iax_errstr, sizeof(iax_errstr),
 
 #ifdef DEBUG_SUPPORT
 
@@ -281,15 +281,15 @@
 	debug = 0;
 }
 
-/* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */ 
+/* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */
 #ifdef WIN32
-#define G __FILE__, __LINE__, __FUNCTION__, 
+#define G __FILE__, __LINE__, __FUNCTION__,
 #else
-#define G __FILE__, __LINE__, (const char *)__func__, 
+#define G __FILE__, __LINE__, (const char *)__func__,
 #endif
 
-#define DEBU __debug 
-static int __debug(char *file, int lineno, const char *func, char *fmt, ...) 
+#define DEBU __debug
+static int __debug(char *file, int lineno, const char *func, char *fmt, ...)
 {
 	va_list args;
 	va_start(args, fmt);
@@ -311,7 +311,7 @@
 #define G
 #endif
 
-typedef void (*sched_func)(void *);
+typedef void (*sched_func) (void *);
 
 struct iax_sched {
 	/* These are scheduled things to be delivered */
@@ -396,16 +396,16 @@
 	/* Schedule event to be delivered to the client
 	   in ms milliseconds from now, or a reliable frame to be retransmitted */
 	struct iax_sched *sched, *cur, *prev = NULL;
-	
+
 	if (!event && !frame && !func) {
 		DEBU(G "No event, no frame, no func?  what are we scheduling?\n");
 		return -1;
 	}
-	
 
-	sched = (struct iax_sched*)malloc(sizeof(struct iax_sched));
+
+	sched = (struct iax_sched *) malloc(sizeof(struct iax_sched));
 	if (sched) {
-        memset(sched, 0, sizeof(struct iax_sched));
+		memset(sched, 0, sizeof(struct iax_sched));
 		sched->when = current_time_in_ms() + ms;
 		sched->event = event;
 		sched->frame = frame;
@@ -414,7 +414,7 @@
 		/* Put it in the list, in order */
 		iax_mutex_lock(sched_mutex);
 		cur = schedq;
-		while(cur && cur->when <= sched->when) {
+		while (cur && cur->when <= sched->when) {
 			prev = cur;
 			cur = cur->next;
 		}
@@ -446,7 +446,7 @@
 			else
 				schedq = cur->next;
 			tmp = cur;
-			cur = cur->next;	
+			cur = cur->next;
 			free(tmp);
 			if (!all) {
 				ret = -1;
@@ -457,7 +457,7 @@
 			cur = cur->next;
 		}
 	}
- done:
+  done:
 	iax_mutex_unlock(sched_mutex);
 
 	return 0;
@@ -469,7 +469,7 @@
 {
 	struct iax_sched *cur = NULL;
 	time_in_ms_t minimum = 999999999;
-	
+
 	iax_mutex_lock(sched_mutex);
 	cur = schedq;
 
@@ -478,7 +478,7 @@
 		iax_mutex_unlock(sched_mutex);
 		return -1;
 	}
-	while(cur) {
+	while (cur) {
 		if (cur->when < minimum) {
 			minimum = cur->when;
 		}
@@ -498,7 +498,7 @@
 struct iax_session *iax_session_new(void)
 {
 	struct iax_session *s;
-	s = (struct iax_session *)malloc(sizeof(struct iax_session));
+	s = (struct iax_session *) malloc(sizeof(struct iax_session));
 	if (s) {
 		memset(s, 0, sizeof(struct iax_session));
 		/* Initialize important fields */
@@ -507,12 +507,12 @@
 		/* Default pingtime to 30 ms */
 		s->pingtime = 30;
 		/* XXX Not quite right -- make sure it's not in use, but that won't matter
-	           unless you've had at least 65k calls.  XXX */
+		   unless you've had at least 65k calls.  XXX */
 		s->callno = callnums++;
 		if (callnums > 32767)
 			callnums = 1;
 		s->peercallno = 0;
-		s->transferpeer = 0;		/* for attended transfer */
+		s->transferpeer = 0;	/* for attended transfer */
 
 		s->sendto = iax_sendto;
 		s->pingid = -1;
@@ -542,7 +542,7 @@
 
 	iax_mutex_lock(session_mutex);
 	cur = sessions;
-	while(cur) {
+	while (cur) {
 		if (session == cur) {
 			iax_mutex_unlock(session_mutex);
 			return -1;
@@ -554,31 +554,34 @@
 	return 0;
 }
 
-int iax_get_netstats(struct iax_session *session, time_in_ms_t *rtt, struct iax_netstat *local, struct iax_netstat *remote) {
+int iax_get_netstats(struct iax_session *session, time_in_ms_t *rtt, struct iax_netstat *local, struct iax_netstat *remote)
+{
 
-  if(!iax_session_valid(session)) return -1;
+	if (!iax_session_valid(session))
+		return -1;
 
-  *rtt = session->pingtime;
+	*rtt = session->pingtime;
 
-  *remote = session->remote_netstats;
+	*remote = session->remote_netstats;
 
 #ifdef NEWJB
-  {
-      jb_info stats;
-      jb_getinfo(session->jb, &stats);
-
-      local->jitter = stats.jitter;
-      /* XXX: should be short-term loss pct.. */
-      if(stats.frames_in == 0) stats.frames_in = 1;
-      local->losspct = stats.losspct/1000;
-      local->losscnt = stats.frames_lost;
-      local->packets = stats.frames_in;
-      local->delay = stats.current - stats.min;
-      local->dropped = stats.frames_dropped;
-      local->ooo = stats.frames_ooo;
-  }
+	{
+		jb_info stats;
+		jb_getinfo(session->jb, &stats);
+
+		local->jitter = stats.jitter;
+		/* XXX: should be short-term loss pct.. */
+		if (stats.frames_in == 0)
+			stats.frames_in = 1;
+		local->losspct = stats.losspct / 1000;
+		local->losscnt = stats.frames_lost;
+		local->packets = stats.frames_in;
+		local->delay = stats.current - stats.min;
+		local->dropped = stats.frames_dropped;
+		local->ooo = stats.frames_ooo;
+	}
 #endif
-  return 0;
+	return 0;
 }
 
 static time_in_ms_t calc_timestamp(struct iax_session *session, time_in_ms_t ts, struct ast_frame *f)
@@ -587,13 +590,13 @@
 	time_in_ms_t time_in_ms;
 	int voice = 0;
 	int genuine = 0;
-	
+
 	if (f && f->frametype == AST_FRAME_VOICE) {
 		voice = 1;
 	} else if (!f || f->frametype == AST_FRAME_IAX) {
 		genuine = 1;
 	}
-	
+
 	/* If this is the first packet we're sending, get our
 	   offset now. */
 	if (!session->offset) {
@@ -616,34 +619,34 @@
 		ms = 0;
 	}
 
-	if(voice) {
+	if (voice) {
 #ifdef USE_VOICE_TS_PREDICTION
 
 		/* If we haven't most recently sent silence, and we're
 		 * close in time, use predicted time */
-		if(session->notsilenttx && iax_abs(ms - session->nextpred) <= 240) {
-		    /* Adjust our txcore, keeping voice and non-voice
-		     * synchronized */
-			session->offset += (int)(ms - session->nextpred)/10;
-		    
-		    if(!session->nextpred) {
-				session->nextpred = ms; 
+		if (session->notsilenttx && iax_abs(ms - session->nextpred) <= 240) {
+			/* Adjust our txcore, keeping voice and non-voice
+			 * synchronized */
+			session->offset += (int) (ms - session->nextpred) / 10;
+
+			if (!session->nextpred) {
+				session->nextpred = ms;
 			}
-		    ms = session->nextpred; 
+			ms = session->nextpred;
 		} else {
-		    /* in this case, just use the actual time, since
-		     * we're either way off (shouldn't happen), or we're
-		     * ending a silent period -- and seed the next predicted
-		     * time.  Also, round ms to the next multiple of
-		     * frame size (so our silent periods are multiples
-		     * of frame size too) */
-		    time_in_ms_t diff = ms % (f->samples / 8);
-		    if(diff)
-			ms += f->samples/8 - diff;
-		    session->nextpred = ms; 
+			/* in this case, just use the actual time, since
+			 * we're either way off (shouldn't happen), or we're
+			 * ending a silent period -- and seed the next predicted
+			 * time.  Also, round ms to the next multiple of
+			 * frame size (so our silent periods are multiples
+			 * of frame size too) */
+			time_in_ms_t diff = ms % (f->samples / 8);
+			if (diff)
+				ms += f->samples / 8 - diff;
+			session->nextpred = ms;
 		}
 #else
-		if(ms <= session->lastsent)
+		if (ms <= session->lastsent)
 			ms = session->lastsent + 3;
 #endif
 		session->notsilenttx = 1;
@@ -656,7 +659,7 @@
 		} else if (iax_abs(ms - session->lastsent) <= 240) {
 			ms = session->lastsent + 3;
 		}
-	      
+
 	}
 
 	/* Record the last sent packet for future reference */
@@ -666,8 +669,8 @@
 
 #ifdef USE_VOICE_TS_PREDICTION
 	/* set next predicted ts based on 8khz samples */
-	if(voice)
-	    session->nextpred = session->nextpred + f->samples / 8;
+	if (voice)
+		session->nextpred = session->nextpred + f->samples / 8;
 #endif
 
 	return ms;
@@ -676,44 +679,42 @@
 #ifdef NEWJB
 static unsigned char get_n_bits_at(unsigned char *data, int n, int bit)
 {
-	int byte = bit / 8;       /* byte containing first bit */
-	int rem = 8 - (bit % 8);  /* remaining bits in first byte */
+	int byte = bit / 8;			/* byte containing first bit */
+	int rem = 8 - (bit % 8);	/* remaining bits in first byte */
 	unsigned char ret = 0;
-	
+
 	if (n <= 0 || n > 8)
 		return 0;
 
 	if (rem < n) {
-		ret = (unsigned char)(data[byte] << (n - rem));
+		ret = (unsigned char) (data[byte] << (n - rem));
 		ret |= (data[byte + 1] >> (8 - n + rem));
 	} else {
-		ret = (unsigned char)(data[byte] >> (rem - n));
+		ret = (unsigned char) (data[byte] >> (rem - n));
 	}
 
-	return (unsigned char)(ret & (0xff >> (8 - n)));
+	return (unsigned char) (ret & (0xff >> (8 - n)));
 }
 
 static int speex_get_wb_sz_at(unsigned char *data, int len, int bit)
 {
 	static int SpeexWBSubModeSz[] = {
 		0, 36, 112, 192,
-		352, 0, 0, 0 };
+		352, 0, 0, 0
+	};
 	int off = bit;
 	unsigned char c;
 
 	/* skip up to two wideband frames */
-	if (((len * 8 - off) >= 5) && 
-		get_n_bits_at(data, 1, off)) {
+	if (((len * 8 - off) >= 5) && get_n_bits_at(data, 1, off)) {
 		c = get_n_bits_at(data, 3, off + 1);
 		off += SpeexWBSubModeSz[c];
 
-		if (((len * 8 - off) >= 5) && 
-			get_n_bits_at(data, 1, off)) {
+		if (((len * 8 - off) >= 5) && get_n_bits_at(data, 1, off)) {
 			c = get_n_bits_at(data, 3, off + 1);
 			off += SpeexWBSubModeSz[c];
 
-			if (((len * 8 - off) >= 5) && 
-				get_n_bits_at(data, 1, off)) {
+			if (((len * 8 - off) >= 5) && get_n_bits_at(data, 1, off)) {
 				/* too many in a row */
 				DEBU(G "\tCORRUPT too many wideband streams in a row\n");
 				return -1;
@@ -727,15 +728,17 @@
 static int speex_get_samples(unsigned char *data, int len)
 {
 	static int SpeexSubModeSz[] = {
-		0, 43, 119, 160, 
-		220, 300, 364, 492, 
+		0, 43, 119, 160,
+		220, 300, 364, 492,
 		79, 0, 0, 0,
-		0, 0, 0, 0 };
-	static int SpeexInBandSz[] = { 
+		0, 0, 0, 0
+	};
+	static int SpeexInBandSz[] = {
 		1, 1, 4, 4,
 		4, 4, 4, 4,
 		8, 8, 16, 16,
-		32, 32, 64, 64 };
+		32, 32, 64, 64
+	};
 	int bit = 0;
 	int cnt = 0;
 	int off = 0;
@@ -745,7 +748,7 @@
 	while ((len * 8 - bit) >= 5) {
 		/* skip wideband frames */
 		off = speex_get_wb_sz_at(data, len, bit);
-		if (off < 0)  {
+		if (off < 0) {
 			DEBU(G "\tERROR reading wideband frames\n");
 			break;
 		}
@@ -761,7 +764,7 @@
 		DEBU(G "\tCONTROL: %d at %d\n", c, bit);
 		bit += 5;
 
-		if (c == 15) { 
+		if (c == 15) {
 			DEBU(G "\tTERMINATOR\n");
 			break;
 		} else if (c == 14) {
@@ -784,7 +787,7 @@
 			DEBU(G "\tSUBMODE %d %d bits\n", c, SpeexSubModeSz[c]);
 			bit += SpeexSubModeSz[c] - 5;
 
-			cnt += 160; /* new frame */
+			cnt += 160;			/* new frame */
 		}
 	}
 	DEBU(G "\tSAMPLES: %d\n", cnt);
@@ -803,42 +806,42 @@
 	/*
 	 * In the case of zero length frames, do not return a cnt of 0
 	 */
-	if ( e->datalen == 0 ) {
-		return get_interp_len( e->subclass ) * 8;
+	if (e->datalen == 0) {
+		return get_interp_len(e->subclass) * 8;
 	}
 
 	switch (e->subclass) {
-	  case AST_FORMAT_SPEEX:
-	    cnt = speex_get_samples(e->data, e->datalen);
-	    break;
-	  case AST_FORMAT_G723_1:
-	    cnt = 240;		/* FIXME Not always the case */
-	    break;
-	  case AST_FORMAT_ILBC:
-	    cnt = 240 * (e->datalen / 50);
-	    break;
-	  case AST_FORMAT_GSM:
-	    cnt = 160 * (e->datalen / 33);
-	    break;
-	  case AST_FORMAT_G729A:
-	    cnt = 160 * (e->datalen / 20);
-	    break;
-	  case AST_FORMAT_SLINEAR:
-	    cnt = e->datalen / 2;
-	    break;
-	  case AST_FORMAT_LPC10:
-	    cnt = 22 * 8 + (((char *)(e->data))[7] & 0x1) * 8;
-	    break;
-	  case AST_FORMAT_ULAW:
-	  case AST_FORMAT_ALAW:
-	    cnt = e->datalen;
-	    break;
-	  case AST_FORMAT_ADPCM:
-	  case AST_FORMAT_G726:
-	    cnt = e->datalen * 2;
-	    break;
-	  default:
-	    return 0;
+	case AST_FORMAT_SPEEX:
+		cnt = speex_get_samples(e->data, e->datalen);
+		break;
+	case AST_FORMAT_G723_1:
+		cnt = 240;				/* FIXME Not always the case */
+		break;
+	case AST_FORMAT_ILBC:
+		cnt = 240 * (e->datalen / 50);
+		break;
+	case AST_FORMAT_GSM:
+		cnt = 160 * (e->datalen / 33);
+		break;
+	case AST_FORMAT_G729A:
+		cnt = 160 * (e->datalen / 20);
+		break;
+	case AST_FORMAT_SLINEAR:
+		cnt = e->datalen / 2;
+		break;
+	case AST_FORMAT_LPC10:
+		cnt = 22 * 8 + (((char *) (e->data))[7] & 0x1) * 8;
+		break;
+	case AST_FORMAT_ULAW:
+	case AST_FORMAT_ALAW:
+		cnt = e->datalen;
+		break;
+	case AST_FORMAT_ADPCM:
+	case AST_FORMAT_G726:
+		cnt = e->datalen * 2;
+		break;
+	default:
+		return 0;
 	}
 	return cnt;
 }
@@ -850,16 +853,13 @@
 #ifdef DEBUG_SUPPORT
 	struct ast_iax2_full_hdr *h = (f->data);
 	if (ntohs(h->scallno) & IAX_FLAG_FULL)
-		iax_showframe(f, NULL, 0, f->transfer ? 
-						&(f->session->transfer) :
-					&(f->session->peeraddr), f->datalen - sizeof(struct ast_iax2_full_hdr));
+		iax_showframe(f, NULL, 0, f->transfer ? &(f->session->transfer) : &(f->session->peeraddr), f->datalen - sizeof(struct ast_iax2_full_hdr));
 #endif
 
 	return f->session->sendto(netfd, (const char *) f->data, f->datalen,
-		IAX_SOCKOPTS,
-					f->transfer ? 
-						(struct sockaddr *)&(f->session->transfer) :
-					(struct sockaddr *)&(f->session->peeraddr), sizeof(f->session->peeraddr));
+							  IAX_SOCKOPTS,
+							  f->transfer ?
+							  (struct sockaddr *) &(f->session->transfer) : (struct sockaddr *) &(f->session->peeraddr), sizeof(f->session->peeraddr));
 }
 
 static int iax_reliable_xmit(struct iax_frame *f)
@@ -869,9 +869,9 @@
 	fh = (struct ast_iax2_full_hdr *) f->data;
 	if (!fh->type) {
 		DEBU(G "Asked to reliably transmit a non-packet.  Crashing.\n");
-		*((char *)0)=0;
+		*((char *) 0) = 0;
 	}
-	fc = (struct iax_frame *)malloc(sizeof(struct iax_frame));
+	fc = (struct iax_frame *) malloc(sizeof(struct iax_frame));
 	if (fc) {
 		/* Make a copy of the frame */
 		memcpy(fc, f, sizeof(struct iax_frame));
@@ -881,7 +881,7 @@
 			DEBU(G "No frame data?\n");
 			return -1;
 		} else {
-			fc->data = (char *)malloc(fc->datalen);
+			fc->data = (char *) malloc(fc->datalen);
 			if (!fc->data) {
 				DEBU(G "Out of memory\n");
 				IAXERROR "Out of memory\n");
@@ -895,40 +895,38 @@
 		return -1;
 }
 
-void iax_set_networking(sendto_t st, recvfrom_t rf)
-{
+void iax_set_networking(sendto_t st, recvfrom_t rf) {
 
 	init_time();
 	iax_sendto = st;
 	iax_recvfrom = rf;
 }
 
-int __iax_shutdown(void)
-{
+int __iax_shutdown(void) {
 	struct iax_sched *sp, *fp;
 
 	/* Hangup Calls */
 	if (sessions) {
 		struct iax_session *sp = NULL, *fp = NULL;
-		iax_mutex_lock(session_mutex); 
-		for(sp = sessions; sp ;) {
+		iax_mutex_lock(session_mutex);
+		for (sp = sessions; sp;) {
 			iax_hangup(sp, "System Shutdown");
 			fp = sp;
 			sp = sp->next;
 			destroy_session(fp);
 		}
-		iax_mutex_unlock(session_mutex); 
+		iax_mutex_unlock(session_mutex);
 	}
 
 	/* Clear Scheduler */
 	iax_mutex_lock(sched_mutex);
-	for(sp = schedq; sp ;) {
+	for (sp = schedq; sp;) {
 		fp = sp;
 		sp = sp->next;
 		free(fp);
 	}
 	iax_mutex_unlock(sched_mutex);
-	
+
 	if (netfd > -1) {
 		shutdown(netfd, 2);
 		close(netfd);
@@ -942,19 +940,16 @@
 	return 0;
 }
 
-int iax_shutdown(void)
-{
+int iax_shutdown(void) {
 	return do_shutdown++;
 }
 
-void iax_set_jb_target_extra( long value )
-{
+void iax_set_jb_target_extra(long value) {
 	/* store in jb_target_extra, a static global */
-	jb_target_extra = value ;
+	jb_target_extra = value;
 }
 
-int iax_init(char *ip, int preferredportno)
-{
+int iax_init(char *ip, int preferredportno) {
 	int portno = preferredportno;
 	struct sockaddr_in sin;
 #ifdef WIN32
@@ -969,102 +964,98 @@
 	iax_mutex_create(&sched_mutex);
 	iax_mutex_create(&session_mutex);
 
-	if(iax_recvfrom == (recvfrom_t) recvfrom) {
-	    if (netfd > -1) {
-		    /* Sokay, just don't do anything */
-		    DEBU(G "Already initialized.");
-		    return 0;
-	    }
-	    netfd = (int)socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
-	    if (netfd < 0) {
-		    DEBU(G "Unable to allocate UDP socket\n");
-		    IAXERROR "Unable to allocate UDP socket\n");
-		    return -1;
-	    }
-	    
-	    if (preferredportno == 0) preferredportno = IAX_DEFAULT_PORTNO;
-		if (preferredportno < 0)  preferredportno = 0;
+	if (iax_recvfrom == (recvfrom_t) recvfrom) {
+		if (netfd > -1) {
+			/* Sokay, just don't do anything */
+			DEBU(G "Already initialized.");
+			return 0;
+		}
+		netfd = (int) socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+		if (netfd < 0) {
+			DEBU(G "Unable to allocate UDP socket\n");
+			IAXERROR "Unable to allocate UDP socket\n");
+			return -1;
+		}
+
+		if (preferredportno == 0)
+			preferredportno = IAX_DEFAULT_PORTNO;
+		if (preferredportno < 0)
+			preferredportno = 0;
 
 		sin.sin_family = AF_INET;
 		sin.sin_addr.s_addr = 0;
-		sin.sin_port = htons((short)preferredportno);
-		if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0) 
-		{
+		sin.sin_port = htons((short) preferredportno);
+		if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
 #if defined(WIN32)  ||  defined(_WIN32_WCE)
 			if (WSAGetLastError() == WSAEADDRINUSE)
 #else
 			if (errno == EADDRINUSE)
 #endif
 			{
-				/*the port is already in use, so bind to a free port chosen by the IP stack*/
+				/*the port is already in use, so bind to a free port chosen by the IP stack */
 				DEBU(G "Unable to bind to preferred port - port is in use. Trying to bind to a free one");
-				sin.sin_port = htons((short)0);
-				if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
-				{
+				sin.sin_port = htons((short) 0);
+				if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
 					IAXERROR "Unable to bind UDP socket\n");
 					return -1;
 				}
-			} else
-			{
+			} else {
 				IAXERROR "Unable to bind UDP socket\n");
 				return -1;
 			}
 		}
 		sinlen = sizeof(sin);
-	    if (getsockname(netfd, (struct sockaddr *) &sin, &sinlen) < 0) {
-		    close(netfd);
-		    netfd = -1;
-		    DEBU(G "Unable to figure out what I'm bound to.");
-		    IAXERROR "Unable to determine bound port number.");
-	    }
+		if (getsockname(netfd, (struct sockaddr *) &sin, &sinlen) < 0) {
+			close(netfd);
+			netfd = -1;
+			DEBU(G "Unable to figure out what I'm bound to.");
+			IAXERROR "Unable to determine bound port number.");
+		}
 #ifdef	WIN32
-	    flags = 1;
-	    if (ioctlsocket(netfd,FIONBIO,(unsigned long *) &flags)) {
-		    closesocket(netfd);
-		    netfd = -1;
-		    DEBU(G "Unable to set non-blocking mode.");
-		    IAXERROR "Unable to set non-blocking mode.");
-	    }
-	    
+		flags = 1;
+		if (ioctlsocket(netfd, FIONBIO, (unsigned long *) &flags)) {
+			closesocket(netfd);
+			netfd = -1;
+			DEBU(G "Unable to set non-blocking mode.");
+			IAXERROR "Unable to set non-blocking mode.");
+		}
 #else
-	    if ((flags = fcntl(netfd, F_GETFL)) < 0) {
-		    close(netfd);
-		    netfd = -1;
-		    DEBU(G "Unable to retrieve socket flags.");
-		    IAXERROR "Unable to retrieve socket flags.");
-	    }
-	    if (fcntl(netfd, F_SETFL, flags | O_NONBLOCK) < 0) {
-		    close(netfd);
-		    netfd = -1;
-		    DEBU(G "Unable to set non-blocking mode.");
-		    IAXERROR "Unable to set non-blocking mode.");
-	    }
+		if ((flags = fcntl(netfd, F_GETFL)) < 0) {
+			close(netfd);
+			netfd = -1;
+			DEBU(G "Unable to retrieve socket flags.");
+			IAXERROR "Unable to retrieve socket flags.");
+		}
+		if (fcntl(netfd, F_SETFL, flags | O_NONBLOCK) < 0) {
+			close(netfd);
+			netfd = -1;
+			DEBU(G "Unable to set non-blocking mode.");
+			IAXERROR "Unable to set non-blocking mode.");
+		}
 #endif
-	    portno = ntohs(sin.sin_port);
+		portno = ntohs(sin.sin_port);
 	}
-	srand((unsigned int)time(NULL));
+	srand((unsigned int) time(NULL));
 	callnums = rand() % 32767 + 1;
 	transfer_id = rand() % 32767 + 1;
 	DEBU(G "Started on port %d\n", portno);
-	return portno;	
+	return portno;
 }
 
 
 
-static void convert_reply(char *out, unsigned char *in)
-{
+static void convert_reply(char *out, unsigned char *in) {
 	int x;
-	for (x=0;x<16;x++)
-		out += sprintf(out, "%2.2x", (int)in[x]);
+	for (x = 0; x < 16; x++)
+		out += sprintf(out, "%2.2x", (int) in[x]);
 }
 
-static unsigned char compress_subclass(int subclass)
-{
+static unsigned char compress_subclass(int subclass) {
 	int x;
-	int power=-1;
+	int power = -1;
 	/* If it's 128 or smaller, just return it */
 	if (subclass < IAX_FLAG_SC_LOG)
-		return (unsigned char)subclass;
+		return (unsigned char) subclass;
 	/* Otherwise find its power */
 	for (x = 0; x < IAX_MAX_SHIFT; x++) {
 		if (subclass & (1 << x)) {
@@ -1075,45 +1066,45 @@
 				power = x;
 		}
 	}
-	return (unsigned char)(power | IAX_FLAG_SC_LOG);
+	return (unsigned char) (power | IAX_FLAG_SC_LOG);
 }
 
-static int iax_send(struct iax_session *pvt, struct ast_frame *f, time_in_ms_t ts, int seqno, int now, int transfer, int final) 
-{
+static int iax_send(struct iax_session *pvt, struct ast_frame *f, time_in_ms_t ts, int seqno, int now, int transfer, int final) {
 	/* Queue a packet for delivery on a given private structure.  Use "ts" for
 	   timestamp, or calculate if ts is 0.  Send immediately without retransmission
 	   or delayed, with retransmission */
 	struct ast_iax2_full_hdr *fh;
 	struct ast_iax2_mini_hdr *mh;
-	unsigned char	buf[5120];
+	unsigned char buf[5120];
 	struct iax_frame *fr;
 	int res;
-	int sendmini=0;
+	int sendmini = 0;
 	time_in_ms_t lastsent;
 	time_in_ms_t fts;
-	
+
 	if (!pvt) {
 		IAXERROR "No private structure for packet?\n");
 		return -1;
 	}
-	
+
 	/* this must come before the next call to calc_timestamp() since
-	 calc_timestamp() will change lastsent to the returned value */
+	   calc_timestamp() will change lastsent to the returned value */
 	lastsent = pvt->lastsent;
 
 	/* Calculate actual timestamp */
 	fts = calc_timestamp(pvt, ts, f);
 
 	if (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L))
-		/* High two bits are the same on timestamp, or sending on a trunk */ &&
-	    (f->frametype == AST_FRAME_VOICE) 
-		/* is a voice frame */ &&
-		(f->subclass == pvt->svoiceformat) 
-		/* is the same type */ ) {
-			/* Force immediate rather than delayed transmission */
-			now = 1;
-			/* Mark that mini-style frame is appropriate */
-			sendmini = 1;
+		/* High two bits are the same on timestamp, or sending on a trunk */
+		&& (f->frametype == AST_FRAME_VOICE)
+		/* is a voice frame */
+		&& (f->subclass == pvt->svoiceformat)
+		/* is the same type */
+		) {
+		/* Force immediate rather than delayed transmission */
+		now = 1;
+		/* Mark that mini-style frame is appropriate */
+		sendmini = 1;
 	}
 	/* Allocate an iax_frame */
 	if (now) {
@@ -1135,7 +1126,7 @@
 		return -1;
 	}
 
-	fr->callno = (unsigned short)pvt->callno;
+	fr->callno = (unsigned short) pvt->callno;
 	fr->transfer = transfer;
 	fr->final = final;
 	fr->session = pvt;
@@ -1146,22 +1137,22 @@
 		else
 			fr->oseqno = pvt->oseqno++;
 		fr->iseqno = pvt->iseqno;
-		fh = (struct ast_iax2_full_hdr *)(((char *)fr->af.data) - sizeof(struct ast_iax2_full_hdr));
+		fh = (struct ast_iax2_full_hdr *) (((char *) fr->af.data) - sizeof(struct ast_iax2_full_hdr));
 		fh->scallno = htons(fr->callno | IAX_FLAG_FULL);
-		fh->ts = htonl((long)(fr->ts));
-		fh->oseqno = (unsigned char)fr->oseqno;
+		fh->ts = htonl((long) (fr->ts));
+		fh->oseqno = (unsigned char) fr->oseqno;
 		if (transfer) {
 			fh->iseqno = 0;
 		} else
-			fh->iseqno = (unsigned char)fr->iseqno;
+			fh->iseqno = (unsigned char) fr->iseqno;
 		/* Keep track of the last thing we've acknowledged */
-		pvt->aseqno = (unsigned char)fr->iseqno;
-		fh->type = (char)(fr->af.frametype & 0xFF);
+		pvt->aseqno = (unsigned char) fr->iseqno;
+		fh->type = (char) (fr->af.frametype & 0xFF);
 		fh->csub = compress_subclass(fr->af.subclass);
 		if (transfer) {
-			fr->dcallno = (unsigned short)pvt->transfercallno;
+			fr->dcallno = (unsigned short) pvt->transfercallno;
 		} else
-			fr->dcallno = (unsigned short)pvt->peercallno;
+			fr->dcallno = (unsigned short) pvt->peercallno;
 		fh->dcallno = htons(fr->dcallno);
 		fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_full_hdr);
 		fr->data = fh;
@@ -1187,22 +1178,21 @@
 		fr->oseqno = -1;
 		fr->iseqno = -1;
 		/* Mini frame will do */
-		mh = (struct ast_iax2_mini_hdr *)(((char *)fr->af.data) - sizeof(struct ast_iax2_mini_hdr));
+		mh = (struct ast_iax2_mini_hdr *) (((char *) fr->af.data) - sizeof(struct ast_iax2_mini_hdr));
 		mh->callno = htons(fr->callno);
-		mh->ts = htons((short)(fr->ts & 0xFFFF));
+		mh->ts = htons((short) (fr->ts & 0xFFFF));
 		fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_mini_hdr);
 		fr->data = mh;
 		fr->retries = -1;
 		res = iax_xmit_frame(fr);
 	}
-	if( !now && fr!=NULL )
-	        iax_frame_free( fr ); 
+	if (!now && fr != NULL)
+		iax_frame_free(fr);
 	return res;
 }
 
 #if 0
-static int iax_predestroy(struct iax_session *pvt)
-{
+static int iax_predestroy(struct iax_session *pvt) {
 	if (!pvt) {
 		return -1;
 	}
@@ -1226,9 +1216,8 @@
 }
 #endif
 
-static int __send_command(struct iax_session *i, char type, int command, time_in_ms_t ts, unsigned char *data, int datalen, int seqno, 
-		int now, int transfer, int final, int samples)
-{
+static int __send_command(struct iax_session *i, char type, int command, time_in_ms_t ts, unsigned char *data, int datalen, int seqno,
+						  int now, int transfer, int final, int samples) {
 	struct ast_frame f;
 	f.frametype = type;
 	f.subclass = command;
@@ -1245,77 +1234,69 @@
 	return iax_send(i, &f, ts, seqno, now, transfer, final);
 }
 
-static int send_command(struct iax_session *i, char type, int command, time_in_ms_t ts, unsigned char *data, int datalen, int seqno)
-{
+static int send_command(struct iax_session *i, char type, int command, time_in_ms_t ts, unsigned char *data, int datalen, int seqno) {
 	return __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 0, 0);
 }
 
-static int send_command_final(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno)
-{
+static int send_command_final(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno) {
 #if 0
 	/* It is assumed that the callno has already been locked */
 	iax_predestroy(i);
-#endif	
+#endif
 	int r;
 	r = __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 1, 0);
 	if (r >= 0) {
-		iax_mutex_lock(session_mutex); 
+		iax_mutex_lock(session_mutex);
 		destroy_session(i);
 		iax_mutex_unlock(session_mutex);
 	}
 	return r;
 }
 
-static int send_command_immediate(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno)
-{
+static int send_command_immediate(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno) {
 	return __send_command(i, type, command, ts, data, datalen, seqno, 1, 0, 0, 0);
 }
 
-static int send_command_transfer(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen)
-{
+static int send_command_transfer(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen) {
 	return __send_command(i, type, command, ts, data, datalen, 0, 0, 1, 0, 0);
 }
 
-static int send_command_samples(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno, int samples)
-{
+static int send_command_samples(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno, int samples) {
 	return __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 0, samples);
 }
 
 
-int iax_transfer(struct iax_session *session, char *number)
-{	
+int iax_transfer(struct iax_session *session, char *number) {
 	static int res;				//Return Code
-	struct iax_ie_data ied;			//IE Data Structure (Stuff To Send)
+	struct iax_ie_data ied;		//IE Data Structure (Stuff To Send)
 
 	// Clear The Memory Used For IE Buffer
 	memset(&ied, 0, sizeof(ied));
-	
+
 	// Copy The Transfer Destination Into The IE Structure
 	iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, (unsigned char *) number);
-	
-	// Send The Transfer Command - Asterisk Will Handle The Rest!			
+
+	// Send The Transfer Command - Asterisk Will Handle The Rest!           
 	res = send_command(session, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1);
-	
+
 	// Return Success
-	return 0;	
+	return 0;
 }
 
-static void stop_transfer(struct iax_session *session)
-{
+static void stop_transfer(struct iax_session *session) {
 	struct iax_sched *sch;
 
 	iax_mutex_lock(sched_mutex);
 	sch = schedq;
-	while(sch) {
+	while (sch) {
 		if (sch->frame && (sch->frame->session == session))
-					sch->frame->retries = -1;
+			sch->frame->retries = -1;
 		sch = sch->next;
 	}
 	iax_mutex_unlock(sched_mutex);
-}	/* stop_transfer */
+}								/* stop_transfer */
 
-static void complete_transfer(struct iax_session *session, int peercallno, int xfr2peer, int preserveSeq)
-{
+static void complete_transfer(struct iax_session *session, int peercallno, int xfr2peer, int preserveSeq) {
 	session->peercallno = peercallno;
 	/* Change from transfer to session now */
 	if (xfr2peer) {
@@ -1331,20 +1312,19 @@
 	session->rxcore = session->offset = 0;
 	memset(&session->history, 0, sizeof(session->history));
 #ifdef NEWJB
-	{ /* Reset jitterbuffer */
-	    jb_frame frame;
-	    while(jb_getall(session->jb,&frame) == JB_OK) 
-		iax_event_free(frame.data);
-	
-	    jb_reset(session->jb);
+	{							/* Reset jitterbuffer */
+		jb_frame frame;
+		while (jb_getall(session->jb, &frame) == JB_OK)
+			iax_event_free(frame.data);
+
+		jb_reset(session->jb);
 	}
 #endif
 	session->jitterbuffer = 0;
 	session->jitter = 0;
 	session->lag = 0;
 
-	if (! preserveSeq)
-	{
+	if (!preserveSeq) {
 		/* Reset sequence numbers */
 		session->aseqno = 0;
 		session->oseqno = 0;
@@ -1358,10 +1338,9 @@
 	/* We have to dump anything we were going to (re)transmit now that we've been
 	   transferred since they're all invalid and for the old host. */
 	stop_transfer(session);
-}	/* complete_transfer */
+}								/* complete_transfer */
 
-int iax_setup_transfer(struct iax_session *org_session, struct iax_session *new_session)
-{
+int iax_setup_transfer(struct iax_session *org_session, struct iax_session *new_session) {
 	int res;
 	struct iax_ie_data ied0;
 	struct iax_ie_data ied1;
@@ -1374,11 +1353,11 @@
 
 	/* reversed setup */
 	iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &s1->peeraddr);
-	iax_ie_append_short(&ied0, IAX_IE_CALLNO, (unsigned short)s1->peercallno);
+	iax_ie_append_short(&ied0, IAX_IE_CALLNO, (unsigned short) s1->peercallno);
 	iax_ie_append_int(&ied0, IAX_IE_TRANSFERID, transfer_id);
 
 	iax_ie_append_addr(&ied1, IAX_IE_APPARENT_ADDR, &s0->peeraddr);
-	iax_ie_append_short(&ied1, IAX_IE_CALLNO, (unsigned short)s0->peercallno);
+	iax_ie_append_short(&ied1, IAX_IE_CALLNO, (unsigned short) s0->peercallno);
 	iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, transfer_id);
 
 	s0->transfer = s1->peeraddr;
@@ -1414,8 +1393,7 @@
 	return 0;
 }
 
-static int iax_finish_transfer(struct iax_session *s, short new_peer)
-{
+static int iax_finish_transfer(struct iax_session *s, short new_peer) {
 	int res;
 	struct iax_ie_data ied;
 
@@ -1431,28 +1409,26 @@
 
 }
 
-static struct iax_session *iax_find_session2(short callno)
-{
+static struct iax_session *iax_find_session2(short callno) {
 	struct iax_session *cur;
 
-	iax_mutex_lock(session_mutex); 
+	iax_mutex_lock(session_mutex);
 	cur = sessions;
-	while(cur) {
-		if (callno == cur->callno && callno != 0)  {
-			iax_mutex_unlock(session_mutex); 
+	while (cur) {
+		if (callno == cur->callno && callno != 0) {
+			iax_mutex_unlock(session_mutex);
 			return cur;
 		}
 		cur = cur->next;
 	}
-	iax_mutex_unlock(session_mutex); 
+	iax_mutex_unlock(session_mutex);
 
 	return NULL;
 }
 
-static int iax_handle_txready(struct iax_session *s)
-{
+static int iax_handle_txready(struct iax_session *s) {
 	struct iax_session *s0, *s1;
-	short	s0_org_peer, s1_org_peer;
+	short s0_org_peer, s1_org_peer;
 
 	if (s->transfer_moh) {
 		s->transfer_moh = 0;
@@ -1464,15 +1440,12 @@
 	s->transferring = TRANSFER_REL;
 
 	s0 = s;
-	s1 = iax_find_session2((short)s0->transferpeer);
+	s1 = iax_find_session2((short) s0->transferpeer);
 
-	if (s1 != NULL &&
-	    s1->callno == s0->transferpeer &&
-		 s0->transferring == TRANSFER_REL &&
-		 s1->transferring == TRANSFER_REL) {
+	if (s1 != NULL && s1->callno == s0->transferpeer && s0->transferring == TRANSFER_REL && s1->transferring == TRANSFER_REL) {
 
-		s0_org_peer = (short)s0->peercallno;
-		s1_org_peer = (short)s1->peercallno;
+		s0_org_peer = (short) s0->peercallno;
+		s1_org_peer = (short) s1->peercallno;
 
 		iax_finish_transfer(s0, s1_org_peer);
 		iax_finish_transfer(s1, s0_org_peer);
@@ -1482,15 +1455,12 @@
 	return 0;
 }
 
-static void iax_handle_txreject(struct iax_session *s)
-{
+static void iax_handle_txreject(struct iax_session *s) {
 	struct iax_session *s0, *s1;
 
 	s0 = s;
-	s1 = iax_find_session2((short)s0->transferpeer);
-	if (s1 != NULL &&
-		 s0->transferpeer == s1->callno &&
-		 s1->transferring) {
+	s1 = iax_find_session2((short) s0->transferpeer);
+	if (s1 != NULL && s0->transferpeer == s1->callno && s1->transferring) {
 		if (s1->transfer_moh) {
 			s1->transfer_moh = 0;
 			send_command_immediate(s1, AST_FRAME_IAX, IAX_COMMAND_UNQUELCH, 0, NULL, 0, s1->iseqno);
@@ -1507,15 +1477,14 @@
 	s->transfer_moh = 0;
 }
 
-static void destroy_session(struct iax_session *session)
-{
-	struct iax_session *cur, *prev=NULL;
-	struct iax_sched *curs, *prevs=NULL, *nexts=NULL;
-	int    loop_cnt=0;
+static void destroy_session(struct iax_session *session) {
+	struct iax_session *cur, *prev = NULL;
+	struct iax_sched *curs, *prevs = NULL, *nexts = NULL;
+	int loop_cnt = 0;
 
 	iax_mutex_lock(sched_mutex);
 	curs = schedq;
-	while(curs) {
+	while (curs) {
 		nexts = curs->next;
 		if (curs->frame && curs->frame->session == session) {
 			/* Just mark these frames as if they've been sent */
@@ -1535,10 +1504,10 @@
 		loop_cnt++;
 	}
 	iax_mutex_unlock(sched_mutex);
-	
+
 
 	cur = sessions;
-	while(cur) {
+	while (cur) {
 		if (cur == session) {
 			if (prev)
 				prev->next = session->next;
@@ -1546,11 +1515,11 @@
 				sessions = session->next;
 #ifdef NEWJB
 			{
-			    jb_frame frame;
-			    while(jb_getall(session->jb,&frame) == JB_OK) 
-				iax_event_free(frame.data);
-		   	
-			    jb_destroy(session->jb);
+				jb_frame frame;
+				while (jb_getall(session->jb, &frame) == JB_OK)
+					iax_event_free(frame.data);
+
+				jb_destroy(session->jb);
 			}
 #endif
 			free(session);
@@ -1564,15 +1533,14 @@
 static int iax_send_lagrp(struct iax_session *session, time_in_ms_t ts);
 static int iax_send_pong(struct iax_session *session, time_in_ms_t ts);
 
-static struct iax_event *handle_event(struct iax_event *event)
-{
+static struct iax_event *handle_event(struct iax_event *event) {
 	/* We have a candidate event to be delievered.  Be sure
 	   the session still exists. */
 	if (event) {
 		if (iax_session_valid(event->session)) {
 			/* Lag requests are never actually sent to the client, but
 			   other than that are handled as normal packets */
-			switch(event->etype) {
+			switch (event->etype) {
 				/* the user on the outside may need to look at the session so we will not free 
 				   it here anymore we will test for hangup event in iax_event_free and do it
 				   there.
@@ -1595,48 +1563,42 @@
 				iax_send_pong(event->session, event->ts);
 				iax_destroy(event->session);
 				iax_event_free(event);
-				break;         
+				break;
 			default:
 				return event;
 			}
-		} else 
+		} else
 			iax_event_free(event);
 	}
 	return NULL;
 }
 
-static int iax2_vnak(struct iax_session *session)
-{
+static int iax2_vnak(struct iax_session *session) {
 	return send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_VNAK, 0, NULL, 0, session->iseqno);
 }
 
-int iax_send_dtmf(struct iax_session *session, char digit)
-{
+int iax_send_dtmf(struct iax_session *session, char digit) {
 	return send_command(session, AST_FRAME_DTMF, digit, 0, NULL, 0, -1);
 }
 
-int iax_send_voice(struct iax_session *session, int format, unsigned char *data, int datalen, int samples)
-{
+int iax_send_voice(struct iax_session *session, int format, unsigned char *data, int datalen, int samples) {
 	/* Send a (possibly compressed) voice frame */
 	if (!session->quelch)
 		return send_command_samples(session, AST_FRAME_VOICE, format, 0, data, datalen, -1, samples);
 	return 0;
 }
 
-int iax_send_cng(struct iax_session *session, int level, unsigned char *data, int datalen)
-{    
+int iax_send_cng(struct iax_session *session, int level, unsigned char *data, int datalen) {
 	session->notsilenttx = 0;
 	return send_command(session, AST_FRAME_CNG, level, 0, data, datalen, -1);
 }
 
-int iax_send_image(struct iax_session *session, int format, unsigned char *data, int datalen)
-{
+int iax_send_image(struct iax_session *session, int format, unsigned char *data, int datalen) {
 	/* Send an image frame */
 	return send_command(session, AST_FRAME_IMAGE, format, 0, data, datalen, -1);
 }
 
-int iax_register(struct iax_session *session, char *server, char *peer, char *secret, int refresh)
-{
+int iax_register(struct iax_session *session, char *server, char *peer, char *secret, int refresh) {
 	/* Send a registration request */
 	char tmp[256];
 	char *p;
@@ -1644,15 +1606,15 @@
 	int portno = IAX_DEFAULT_PORTNO;
 	struct iax_ie_data ied;
 	struct hostent *hp;
-	
+
 	tmp[255] = '\0';
 	strncpy(tmp, server, sizeof(tmp) - 1);
 	p = strchr(tmp, ':');
 	if (p) {
 		*p = '\0';
-		portno = atoi(p+1);
+		portno = atoi(p + 1);
 	}
-	
+
 	memset(&ied, 0, sizeof(ied));
 	if (secret)
 		strncpy(session->secret, secret, sizeof(session->secret) - 1);
@@ -1666,44 +1628,39 @@
 		return -1;
 	}
 	memcpy(&session->peeraddr.sin_addr, hp->h_addr, sizeof(session->peeraddr.sin_addr));
-	session->peeraddr.sin_port = htons((unsigned short)portno);
+	session->peeraddr.sin_port = htons((unsigned short) portno);
 	session->peeraddr.sin_family = AF_INET;
 	strncpy(session->username, peer, sizeof(session->username) - 1);
 	session->refresh = refresh;
 	iax_ie_append_str(&ied, IAX_IE_USERNAME, (unsigned char *) peer);
-	iax_ie_append_short(&ied, IAX_IE_REFRESH, (unsigned short)refresh);
+	iax_ie_append_short(&ied, IAX_IE_REFRESH, (unsigned short) refresh);
 	res = send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1);
 	return res;
 }
 
-int iax_reject_registration(struct iax_session *session, char *reason)
-{
+int iax_reject_registration(struct iax_session *session, char *reason) {
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_str(&ied, IAX_IE_CAUSE, reason ? (unsigned char *) reason : (unsigned char *) "Unspecified");
 	return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGREJ, 0, ied.buf, ied.pos, -1);
 }
 
-int iax_ack_registration(struct iax_session *session)
-{
+int iax_ack_registration(struct iax_session *session) {
 	return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGACK, 0, NULL, 0, -1);
 }
 
-int iax_auth_registration(struct iax_session *session)
-{
+int iax_auth_registration(struct iax_session *session) {
 	return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGAUTH, 0, NULL, 0, -1);
 }
 
-int iax_reject(struct iax_session *session, const char *reason)
-{
+int iax_reject(struct iax_session *session, const char *reason) {
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_str(&ied, IAX_IE_CAUSE, reason ? (unsigned char *) reason : (unsigned char *) "Unspecified");
 	return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REJECT, 0, ied.buf, ied.pos, -1);
 }
 
-int iax_hangup(struct iax_session *session, char *byemsg)
-{
+int iax_hangup(struct iax_session *session, char *byemsg) {
 	struct iax_ie_data ied;
 	iax_sched_del(NULL, NULL, send_ping, (void *) session, 1);
 	memset(&ied, 0, sizeof(ied));
@@ -1711,159 +1668,139 @@
 	return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1);
 }
 
-int iax_sendurl(struct iax_session *session, char *url)
-{
-	return send_command(session, AST_FRAME_HTML, AST_HTML_URL, 0, (unsigned char *) url, (int)strlen(url), -1);
+int iax_sendurl(struct iax_session *session, char *url) {
+	return send_command(session, AST_FRAME_HTML, AST_HTML_URL, 0, (unsigned char *) url, (int) strlen(url), -1);
 }
 
-int iax_ring_announce(struct iax_session *session)
-{
+int iax_ring_announce(struct iax_session *session) {
 	return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_RINGING, 0, NULL, 0, -1);
 }
 
-int iax_lag_request(struct iax_session *session)
-{
+int iax_lag_request(struct iax_session *session) {
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_LAGRQ, 0, NULL, 0, -1);
 }
 
-int iax_busy(struct iax_session *session)
-{
+int iax_busy(struct iax_session *session) {
 	return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_BUSY, 0, NULL, 0, -1);
 }
 
-int iax_congestion(struct iax_session *session)
-{
+int iax_congestion(struct iax_session *session) {
 	return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_CONGESTION, 0, NULL, 0, -1);
 }
 
 
-int iax_accept(struct iax_session *session, int format)
-{
+int iax_accept(struct iax_session *session, int format) {
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_int(&ied, IAX_IE_FORMAT, format);
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_ACCEPT, 0, ied.buf, ied.pos, -1);
 }
 
-int iax_answer(struct iax_session *session)
-{
+int iax_answer(struct iax_session *session) {
 	return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_ANSWER, 0, NULL, 0, -1);
 }
 
-int iax_load_complete(struct iax_session *session)
-{
+int iax_load_complete(struct iax_session *session) {
 	return send_command(session, AST_FRAME_HTML, AST_HTML_LDCOMPLETE, 0, NULL, 0, -1);
 }
 
-int iax_send_url(struct iax_session *session, char *url, int link)
-{
-	return send_command(session, AST_FRAME_HTML, link ? AST_HTML_LINKURL : AST_HTML_URL, 0, (unsigned char *) url, (int)strlen(url), -1);
+int iax_send_url(struct iax_session *session, char *url, int link) {
+	return send_command(session, AST_FRAME_HTML, link ? AST_HTML_LINKURL : AST_HTML_URL, 0, (unsigned char *) url, (int) strlen(url), -1);
 }
 
-int iax_send_text(struct iax_session *session, char *text)
-{
-	return send_command(session, AST_FRAME_TEXT, 0, 0, (unsigned char *) text, (int)strlen(text) + 1, -1);
+int iax_send_text(struct iax_session *session, char *text) {
+	return send_command(session, AST_FRAME_TEXT, 0, 0, (unsigned char *) text, (int) strlen(text) + 1, -1);
 }
 
-int iax_send_unlink(struct iax_session *session)
-{
+int iax_send_unlink(struct iax_session *session) {
 	return send_command(session, AST_FRAME_HTML, AST_HTML_UNLINK, 0, NULL, 0, -1);
 }
 
-int iax_send_link_reject(struct iax_session *session)
-{
+int iax_send_link_reject(struct iax_session *session) {
 	return send_command(session, AST_FRAME_HTML, AST_HTML_LINKREJECT, 0, NULL, 0, -1);
 }
 
-static int iax_send_pong(struct iax_session *session, time_in_ms_t ts)
-{
-        struct iax_ie_data ied;
+static int iax_send_pong(struct iax_session *session, time_in_ms_t ts) {
+	struct iax_ie_data ied;
 
-        memset(&ied, 0, sizeof(ied));
+	memset(&ied, 0, sizeof(ied));
 #ifdef NEWJB
 	{
-	    jb_info stats;
-	    jb_getinfo(session->jb, &stats);
+		jb_info stats;
+		jb_getinfo(session->jb, &stats);
 
-	    iax_ie_append_int(&ied,IAX_IE_RR_JITTER, (int)stats.jitter);
-	    /* XXX: should be short-term loss pct.. */
-	    if(stats.frames_in == 0) stats.frames_in = 1;
-	    iax_ie_append_int(&ied,IAX_IE_RR_LOSS, 
-		((0xff & (stats.losspct/1000)) << 24 | (stats.frames_lost & 0x00ffffff)));
-	    iax_ie_append_int(&ied,IAX_IE_RR_PKTS, stats.frames_in);
-	    iax_ie_append_short(&ied,IAX_IE_RR_DELAY, (unsigned short)(stats.current - stats.min));
-	    iax_ie_append_int(&ied,IAX_IE_RR_DROPPED, stats.frames_dropped);
-	    iax_ie_append_int(&ied,IAX_IE_RR_OOO, stats.frames_ooo);
+		iax_ie_append_int(&ied, IAX_IE_RR_JITTER, (int) stats.jitter);
+		/* XXX: should be short-term loss pct.. */
+		if (stats.frames_in == 0)
+			stats.frames_in = 1;
+		iax_ie_append_int(&ied, IAX_IE_RR_LOSS, ((0xff & (stats.losspct / 1000)) << 24 | (stats.frames_lost & 0x00ffffff)));
+		iax_ie_append_int(&ied, IAX_IE_RR_PKTS, stats.frames_in);
+		iax_ie_append_short(&ied, IAX_IE_RR_DELAY, (unsigned short) (stats.current - stats.min));
+		iax_ie_append_int(&ied, IAX_IE_RR_DROPPED, stats.frames_dropped);
+		iax_ie_append_int(&ied, IAX_IE_RR_OOO, stats.frames_ooo);
 	}
 #else
-	    iax_ie_append_int(&ied,IAX_IE_RR_JITTER, session->jitter);
-	    /* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_LOSS, 0); */
-	    /* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_PKTS, stats.frames_in); */
-	    /* don't know, don't send! iax_ie_append_short(&ied,IAX_IE_RR_DELAY, stats.current - stats.min); */
+	iax_ie_append_int(&ied, IAX_IE_RR_JITTER, session->jitter);
+	/* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_LOSS, 0); */
+	/* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_PKTS, stats.frames_in); */
+	/* don't know, don't send! iax_ie_append_short(&ied,IAX_IE_RR_DELAY, stats.current - stats.min); */
 #endif
 
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_PONG, ts, ied.buf, ied.pos, -1);
 }
 
 /* external API; deprecated since we send pings ourselves now (finally) */
-int iax_send_ping(struct iax_session *session)
-{
+int iax_send_ping(struct iax_session *session) {
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1);
 }
 
 /* scheduled ping sender; sends ping, then reschedules */
-static void send_ping(void *s)
-{
-	struct iax_session *session = (struct iax_session *)s;
+static void send_ping(void *s) {
+	struct iax_session *session = (struct iax_session *) s;
 
 	/* important, eh? */
-	if(!iax_session_valid(session)) return;
+	if (!iax_session_valid(session))
+		return;
 
 	send_command(session, AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1);
-	session->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)session, ping_time * 1000);
+	session->pingid = iax_sched_add(NULL, NULL, send_ping, (void *) session, ping_time * 1000);
 	return;
 }
 
-static int iax_send_lagrp(struct iax_session *session, time_in_ms_t ts)
-{
+static int iax_send_lagrp(struct iax_session *session, time_in_ms_t ts) {
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_LAGRP, ts, NULL, 0, -1);
 }
 
-static int iax_send_txcnt(struct iax_session *session)
-{
+static int iax_send_txcnt(struct iax_session *session) {
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_int(&ied, IAX_IE_TRANSFERID, session->transferid);
 	return send_command_transfer(session, AST_FRAME_IAX, IAX_COMMAND_TXCNT, 0, ied.buf, ied.pos);
 }
 
-static int iax_send_txrej(struct iax_session *session)
-{
+static int iax_send_txrej(struct iax_session *session) {
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_int(&ied, IAX_IE_TRANSFERID, session->transferid);
 	return send_command_transfer(session, AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, ied.buf, ied.pos);
 }
 
-static int iax_send_txaccept(struct iax_session *session)
-{
+static int iax_send_txaccept(struct iax_session *session) {
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_int(&ied, IAX_IE_TRANSFERID, session->transferid);
 	return send_command_transfer(session, AST_FRAME_IAX, IAX_COMMAND_TXACC, 0, ied.buf, ied.pos);
 }
 
-static int iax_send_txready(struct iax_session *session)
-{
+static int iax_send_txready(struct iax_session *session) {
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	/* see asterisk chan_iax2.c */
-	iax_ie_append_short(&ied, IAX_IE_CALLNO, (unsigned short)session->callno);
+	iax_ie_append_short(&ied, IAX_IE_CALLNO, (unsigned short) session->callno);
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_TXREADY, 0, ied.buf, ied.pos, -1);
 }
 
-int iax_auth_reply(struct iax_session *session, char *password, char *challenge, int methods)
-{
+int iax_auth_reply(struct iax_session *session, char *password, char *challenge, int methods) {
 	char reply[16];
 	struct MD5Context md5;
 	char realreply[256];
@@ -1871,8 +1808,8 @@
 	memset(&ied, 0, sizeof(ied));
 	if ((methods & IAX_AUTH_MD5) && challenge) {
 		MD5Init(&md5);
-		MD5Update(&md5, (const unsigned char *) challenge, (unsigned int)strlen(challenge));
-		MD5Update(&md5, (const unsigned char *) password, (unsigned int)strlen(password));
+		MD5Update(&md5, (const unsigned char *) challenge, (unsigned int) strlen(challenge));
+		MD5Update(&md5, (const unsigned char *) password, (unsigned int) strlen(password));
 		MD5Final((unsigned char *) reply, &md5);
 		memset(realreply, 0, sizeof(realreply));
 		convert_reply(realreply, (unsigned char *) reply);
@@ -1883,19 +1820,18 @@
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_AUTHREP, 0, ied.buf, ied.pos, -1);
 }
 
-static int iax_regauth_reply(struct iax_session *session, char *password, char *challenge, int methods)
-{
+static int iax_regauth_reply(struct iax_session *session, char *password, char *challenge, int methods) {
 	char reply[16];
 	struct MD5Context md5;
 	char realreply[256];
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_str(&ied, IAX_IE_USERNAME, (unsigned char *) session->username);
-	iax_ie_append_short(&ied, IAX_IE_REFRESH, (unsigned short)session->refresh);
+	iax_ie_append_short(&ied, IAX_IE_REFRESH, (unsigned short) session->refresh);
 	if ((methods & IAX_AUTHMETHOD_MD5) && challenge) {
 		MD5Init(&md5);
-		MD5Update(&md5, (const unsigned char *) challenge, (unsigned int)strlen(challenge));
-		MD5Update(&md5, (const unsigned char *) password, (unsigned int)strlen(password));
+		MD5Update(&md5, (const unsigned char *) challenge, (unsigned int) strlen(challenge));
+		MD5Update(&md5, (const unsigned char *) password, (unsigned int) strlen(password));
 		MD5Final((unsigned char *) reply, &md5);
 		memset(realreply, 0, sizeof(realreply));
 		convert_reply(realreply, (unsigned char *) reply);
@@ -1907,63 +1843,56 @@
 }
 
 
-int iax_dial(struct iax_session *session, char *number)
-{
+int iax_dial(struct iax_session *session, char *number) {
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, (unsigned char *) number);
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_DIAL, 0, ied.buf, ied.pos, -1);
 }
 
-int iax_quelch(struct iax_session *session)
-{
+int iax_quelch(struct iax_session *session) {
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_QUELCH, 0, NULL, 0, -1);
 }
 
-int iax_unquelch(struct iax_session *session)
-{
+int iax_unquelch(struct iax_session *session) {
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_UNQUELCH, 0, NULL, 0, -1);
 }
 
-int iax_dialplan_request(struct iax_session *session, char *number)
-{
+int iax_dialplan_request(struct iax_session *session, char *number) {
 	struct iax_ie_data ied;
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, (unsigned char *) number);
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_DPREQ, 0, ied.buf, ied.pos, -1);
 }
 
-static inline int which_bit(unsigned int i)
-{
-    unsigned char x;
-    for(x = 0; x < 32; x++) {
-        if ((unsigned)(1 << x) == i) {
-            return x + 1;
-        }
-    }
-    return 0;
+static inline int which_bit(unsigned int i) {
+	unsigned char x;
+	for (x = 0; x < 32; x++) {
+		if ((unsigned) (1 << x) == i) {
+			return x + 1;
+		}
+	}
+	return 0;
 }
 
-char iax_pref_codec_add(struct iax_session *session, unsigned int format)
-{
+char iax_pref_codec_add(struct iax_session *session, unsigned int format) {
 	int diff = (int) 'A';
-	session->codec_order[session->codec_order_len++] = (char)((which_bit(format)) + diff);
+	session->codec_order[session->codec_order_len++] = (char) ((which_bit(format)) + diff);
 	session->codec_order[session->codec_order_len] = '\0';
-	return session->codec_order[session->codec_order_len-1];
+	return session->codec_order[session->codec_order_len - 1];
 }
 
 
-void iax_pref_codec_del(struct iax_session *session, unsigned int format)
-{
+void iax_pref_codec_del(struct iax_session *session, unsigned int format) {
 	int diff = (int) 'A';
 	size_t x;
 	char old[32];
-	char remove = (char)(which_bit(format) + diff);
+	char remove = (char) (which_bit(format) + diff);
 
 	strncpy(old, session->codec_order, sizeof(old));
 	session->codec_order_len = 0;
 
-	for (x = 0; x < strlen(old) ; x++) {
+	for (x = 0; x < strlen(old); x++) {
 		if (old[x] != remove) {
 			session->codec_order[session->codec_order_len++] = old[x];
 		}
@@ -1971,11 +1900,10 @@
 	session->codec_order[session->codec_order_len] = '\0';
 }
 
-int iax_pref_codec_get(struct iax_session *session, unsigned int *array, int len)
-{
+int iax_pref_codec_get(struct iax_session *session, unsigned int *array, int len) {
 	int diff = (int) 'A';
 	int x;
-	
+
 	for (x = 0; x < session->codec_order_len && x < len; x++) {
 		array[x] = (1 << (session->codec_order[x] - diff - 1));
 	}
@@ -1983,15 +1911,13 @@
 	return x;
 }
 
-void iax_set_samplerate(struct iax_session *session, unsigned short samplemask)
-{
+void iax_set_samplerate(struct iax_session *session, unsigned short samplemask) {
 	session->samplemask = samplemask;
 }
 
 
-int iax_call(struct iax_session *session, const char *cidnum, const char *cidname, char *ich, char *lang, int wait, int formats, int capabilities)
-{
-	char tmp[256]="";
+int iax_call(struct iax_session *session, const char *cidnum, const char *cidname, char *ich, char *lang, int wait, int formats, int capabilities) {
+	char tmp[256] = "";
 	char *part1, *part2;
 	int res;
 	int portno;
@@ -2006,10 +1932,10 @@
 		return -1;
 	}
 	memset(&ied, 0, sizeof(ied));
-	strncpy(tmp, ich, sizeof(tmp) - 1);	
+	strncpy(tmp, ich, sizeof(tmp) - 1);
 
 	iax_ie_append_short(&ied, IAX_IE_VERSION, IAX_PROTO_VERSION);
-    if (session->samplemask) {
+	if (session->samplemask) {
 		iax_ie_append_short(&ied, IAX_IE_SAMPLINGRATE, session->samplemask);
 	}
 	if (cidnum)
@@ -2022,20 +1948,20 @@
 	}
 
 	session->capability = capabilities;
-	session->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)session, 2 * 1000);
+	session->pingid = iax_sched_add(NULL, NULL, send_ping, (void *) session, 2 * 1000);
 
 	/* XXX We should have a preferred format XXX */
 	iax_ie_append_int(&ied, IAX_IE_FORMAT, formats);
 	iax_ie_append_int(&ied, IAX_IE_CAPABILITY, capabilities);
 	if (lang)
 		iax_ie_append_str(&ied, IAX_IE_LANGUAGE, (unsigned char *) lang);
-	
+
 	/* Part 1 is [user[:password]@]peer[:port] */
 	part1 = strtok(tmp, "/");
 
 	/* Part 2 is exten[@context] if it is anything all */
 	part2 = strtok(NULL, "/");
-	
+
 	if (strchr(part1, '@')) {
 		username = strtok(part1, "@");
 		hostname = strtok(NULL, "@");
@@ -2043,19 +1969,19 @@
 		username = NULL;
 		hostname = part1;
 	}
-	
+
 	if (username && strchr(username, ':')) {
 		username = strtok(username, ":");
 		secret = strtok(NULL, ":");
 	} else
 		secret = NULL;
 
-	if(username)
-	  strncpy(session->username, username, sizeof(session->username) - 1);
+	if (username)
+		strncpy(session->username, username, sizeof(session->username) - 1);
+
+	if (secret)
+		strncpy(session->secret, secret, sizeof(session->secret) - 1);
 
-	if(secret)
-	  strncpy(session->secret, secret, sizeof(session->secret) - 1);
-	
 	if (strchr(hostname, ':')) {
 		strtok(hostname, ":");
 		portno = atoi(strtok(NULL, ":"));
@@ -2087,7 +2013,7 @@
 		return -1;
 	}
 	memcpy(&session->peeraddr.sin_addr, hp->h_addr, sizeof(session->peeraddr.sin_addr));
-	session->peeraddr.sin_port = htons((unsigned short)portno);
+	session->peeraddr.sin_port = htons((unsigned short) portno);
 	session->peeraddr.sin_family = AF_INET;
 	res = send_command(session, AST_FRAME_IAX, IAX_COMMAND_NEW, 0, ied.buf, ied.pos, -1);
 	if (res < 0)
@@ -2099,8 +2025,7 @@
 	return res;
 }
 
-static time_in_ms_t calc_rxstamp(struct iax_session *session)
-{
+static time_in_ms_t calc_rxstamp(struct iax_session *session) {
 	time_in_ms_t time_in_ms;
 
 	time_in_ms = current_time_in_ms();
@@ -2113,20 +2038,16 @@
 }
 
 #ifdef notdef_cruft
-static int match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur)
-{
-	if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) &&
-		(cur->peeraddr.sin_port == sin->sin_port)) {
+static int match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur) {
+	if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->peeraddr.sin_port == sin->sin_port)) {
 		/* This is the main host */
-		if ((cur->peercallno == callno) || 
-			((dcallno == cur->callno) && !cur->peercallno)) {
+		if ((cur->peercallno == callno) || ((dcallno == cur->callno) && !cur->peercallno)) {
 			/* That's us.  Be sure we keep track of the peer call number */
 			cur->peercallno = callno;
 			return 1;
 		}
 	}
-	if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) &&
-	    (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
+	if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
 		/* We're transferring */
 		if (dcallno == cur->callno)
 			return 1;
@@ -2141,21 +2062,17 @@
    same peercallno (from two different asterisks) exist in more than
 	one session.
  */
-static int forward_match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur)
-{
-	if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) &&
-		(cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
+static int forward_match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur) {
+	if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
 		/* We're transferring */
-		if (dcallno == cur->callno)
-		{
+		if (dcallno == cur->callno) {
 			return 1;
 		}
 	}
 
-	if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) &&
-		(cur->peeraddr.sin_port == sin->sin_port)) {
-		if (dcallno == cur->callno && dcallno != 0)  {
-					/* That's us.  Be sure we keep track of the peer call number */
+	if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->peeraddr.sin_port == sin->sin_port)) {
+		if (dcallno == cur->callno && dcallno != 0) {
+			/* That's us.  Be sure we keep track of the peer call number */
 			if (cur->peercallno == 0) {
 				cur->peercallno = callno;
 			}
@@ -2166,18 +2083,15 @@
 	return 0;
 }
 
-static int reverse_match(struct sockaddr_in *sin, short callno, struct iax_session *cur)
-{
-	if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) &&
-		(cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
+static int reverse_match(struct sockaddr_in *sin, short callno, struct iax_session *cur) {
+	if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
 		/* We're transferring */
-		if (callno == cur->peercallno)  {
+		if (callno == cur->peercallno) {
 			return 1;
 		}
 	}
-	if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) &&
-		(cur->peeraddr.sin_port == sin->sin_port)) {
-		if (callno == cur->peercallno)  {
+	if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->peeraddr.sin_port == sin->sin_port)) {
+		if (callno == cur->peercallno) {
 			return 1;
 		}
 	}
@@ -2185,33 +2099,29 @@
 	return 0;
 }
 
-static struct iax_session *iax_find_session(struct sockaddr_in *sin, 
-											short callno, 
-											short dcallno,
-											int makenew)
-{
+static struct iax_session *iax_find_session(struct sockaddr_in *sin, short callno, short dcallno, int makenew) {
 	struct iax_session *cur;
 
-	iax_mutex_lock(session_mutex); 
+	iax_mutex_lock(session_mutex);
 	cur = sessions;
-	while(cur) {
+	while (cur) {
 		if (forward_match(sin, callno, dcallno, cur)) {
-			iax_mutex_unlock(session_mutex); 
+			iax_mutex_unlock(session_mutex);
 			return cur;
 		}
 		cur = cur->next;
 	}
 
 	cur = sessions;
-	while(cur) {
+	while (cur) {
 		if (reverse_match(sin, callno, cur)) {
-			iax_mutex_unlock(session_mutex); 
+			iax_mutex_unlock(session_mutex);
 			return cur;
 		}
 		cur = cur->next;
 	}
 
-	iax_mutex_unlock(session_mutex); 
+	iax_mutex_unlock(session_mutex);
 
 	if (makenew && !dcallno) {
 		cur = iax_session_new();
@@ -2219,18 +2129,17 @@
 		cur->peeraddr.sin_addr.s_addr = sin->sin_addr.s_addr;
 		cur->peeraddr.sin_port = sin->sin_port;
 		cur->peeraddr.sin_family = AF_INET;
-		cur->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)cur, 2 * 1000);
+		cur->pingid = iax_sched_add(NULL, NULL, send_ping, (void *) cur, 2 * 1000);
 		DEBU(G "Making new session, peer callno %d, our callno %d\n", callno, cur->callno);
 	} else {
 		DEBU(G "No session, peer = %d, us = %d\n", callno, dcallno);
 	}
 
-	return cur;	
+	return cur;
 }
 
 #ifdef EXTREME_DEBUG
-static int display_time(int ms)
-{
+static int display_time(int ms) {
 	static int oldms = -1;
 	if (oldms < 0) {
 		DEBU(G "First measure\n");
@@ -2247,36 +2156,34 @@
 
 #ifdef NEWJB
 /* From chan_iax2/steve davies:  need to get permission from steve or digium, I guess */
-static time_in_ms_t unwrap_timestamp(time_in_ms_t ts, time_in_ms_t last)
-{
-        time_in_ms_t x;
+static time_in_ms_t unwrap_timestamp(time_in_ms_t ts, time_in_ms_t last) {
+	time_in_ms_t x;
 
-        if ( (ts & 0xFFFF0000) == (last & 0xFFFF0000) ) {
-                x = ts - last;
-                if (x < -50000) {
-                        /* Sudden big jump backwards in timestamp:
-                           What likely happened here is that miniframe timestamp has circled but we haven't
-                           gotten the update from the main packet.  We'll just pretend that we did, and
-                           update the timestamp appropriately. */
-                        ts = ( (last & 0xFFFF0000) + 0x10000) | (ts & 0xFFFF);
-                                DEBU(G "schedule_delivery: pushed forward timestamp\n");
-                }
-                if (x > 50000) {
-                        /* Sudden apparent big jump forwards in timestamp:
-                           What's likely happened is this is an old miniframe belonging to the previous
-                           top-16-bit timestamp that has turned up out of order.
-                           Adjust the timestamp appropriately. */
-                        ts = ( (last & 0xFFFF0000) - 0x10000) | (ts & 0xFFFF);
-                                DEBU(G "schedule_delivery: pushed back timestamp\n");
-                }
-        }
+	if ((ts & 0xFFFF0000) == (last & 0xFFFF0000)) {
+		x = ts - last;
+		if (x < -50000) {
+			/* Sudden big jump backwards in timestamp:
+			   What likely happened here is that miniframe timestamp has circled but we haven't
+			   gotten the update from the main packet.  We'll just pretend that we did, and
+			   update the timestamp appropriately. */
+			ts = ((last & 0xFFFF0000) + 0x10000) | (ts & 0xFFFF);
+			DEBU(G "schedule_delivery: pushed forward timestamp\n");
+		}
+		if (x > 50000) {
+			/* Sudden apparent big jump forwards in timestamp:
+			   What's likely happened is this is an old miniframe belonging to the previous
+			   top-16-bit timestamp that has turned up out of order.
+			   Adjust the timestamp appropriately. */
+			ts = ((last & 0xFFFF0000) - 0x10000) | (ts & 0xFFFF);
+			DEBU(G "schedule_delivery: pushed back timestamp\n");
+		}
+	}
 	return ts;
 }
 #endif
 
 
-static struct iax_event *schedule_delivery(struct iax_event *e, time_in_ms_t ts, int updatehistory)
-{
+static struct iax_event *schedule_delivery(struct iax_event *e, time_in_ms_t ts, int updatehistory) {
 	/* 
 	 * This is the core of the IAX jitterbuffer delivery mechanism: 
 	 * Dynamically adjust the jitterbuffer and decide how time_in_ms_t to wait
@@ -2285,21 +2192,21 @@
 #ifndef NEWJB
 	int ms, x;
 	int drops[MEMORY_SIZE];
-	int min, max=0, maxone=0, y, z, match;
+	int min, max = 0, maxone = 0, y, z, match;
 #endif
 
-#ifdef EXTREME_DEBUG	
+#ifdef EXTREME_DEBUG
 	DEBU(G "[%p] We are at %d, packet is for %d\n", e->session, calc_rxstamp(e->session), ts);
 #endif
-	
+
 #ifdef VOICE_SMOOTHING
 	if (e->etype == IAX_EVENT_VOICE) {
 		/* Smooth voices if we know enough about the format */
-		switch(e->event.voice.format) {
+		switch (e->event.voice.format) {
 		case AST_FORMAT_GSM:
 			/* GSM frames are 20 ms long, although there could be periods of 
 			   silence.  If the time is < 50 ms, assume it ought to be 20 ms */
-			if (ts - e->session->lastts < 50)  
+			if (ts - e->session->lastts < 50)
 				ts = e->session->lastts + 20;
 #ifdef EXTREME_DEBUG
 			display_time(ts);
@@ -2314,38 +2221,38 @@
 
 #ifdef NEWJB
 	{
-	    int type = JB_TYPE_CONTROL;
-	    int len = 0;
+		int type = JB_TYPE_CONTROL;
+		int len = 0;
+
+		if (e->etype == IAX_EVENT_VOICE) {
+			type = JB_TYPE_VOICE;
+			len = get_sample_cnt(e) / 8;
+		} else if (e->etype == IAX_EVENT_CNG) {
+			type = JB_TYPE_SILENCE;
+		}
+
+		/* unwrap timestamp */
+		ts = unwrap_timestamp(ts, e->session->last_ts);
 
-	    if(e->etype == IAX_EVENT_VOICE) {
-	      type = JB_TYPE_VOICE;
-	      len = get_sample_cnt(e) / 8;
-	    } else if(e->etype == IAX_EVENT_CNG) {
-	      type = JB_TYPE_SILENCE;	
-	    }
-
-	    /* unwrap timestamp */
-	    ts = unwrap_timestamp(ts,e->session->last_ts);
-
-	    /* move forward last_ts if it's greater.  We do this _after_ unwrapping, because
-	     * asterisk _still_ has cases where it doesn't send full frames when it ought to */
-	    if(ts > e->session->last_ts) {
-		e->session->last_ts = ts;		
-	    }
-
-
-	    /* insert into jitterbuffer */
-	    /* TODO: Perhaps we could act immediately if it's not droppable and late */
-	    if(jb_put(e->session->jb, e, type, len, ts, calc_rxstamp(e->session)) == JB_DROP) {
-		  iax_event_free(e);
-	    }
+		/* move forward last_ts if it's greater.  We do this _after_ unwrapping, because
+		 * asterisk _still_ has cases where it doesn't send full frames when it ought to */
+		if (ts > e->session->last_ts) {
+			e->session->last_ts = ts;
+		}
+
+
+		/* insert into jitterbuffer */
+		/* TODO: Perhaps we could act immediately if it's not droppable and late */
+		if (jb_put(e->session->jb, e, type, len, ts, calc_rxstamp(e->session)) == JB_DROP) {
+			iax_event_free(e);
+		}
 
 	}
 #else
-	
+
 	/* How many ms from now should this packet be delivered? (remember
 	   this can be a negative number, too */
-	ms = (int)(calc_rxstamp(e->session) - ts);
+	ms = (int) (calc_rxstamp(e->session) - ts);
 
 	/*  
 	   Drop voice frame if timestamp is way off 
@@ -2354,7 +2261,7 @@
 	   free(e);
 	   return NULL;
 	   }
-	*/
+	 */
 
 	/* Adjust if voice frame timestamp is off by a step */
 	if (ms > 32768) {
@@ -2368,33 +2275,32 @@
 		   time frame */
 		ms += 65536;
 	}
-
-#if 0	
+#if 0
 	printf("rxstamp is %d, timestamp is %d, ms is %d\n", calc_rxstamp(e->session), ts, ms);
 #endif
 	/* Rotate history queue.  Leading 0's are irrelevant. */
 	if (updatehistory) {
-	    for (x=0; x < MEMORY_SIZE - 1; x++) 
-		    e->session->history[x] = e->session->history[x+1];
-	    
-	    /* Add new entry for this time */
-	    e->session->history[x] = ms;
+		for (x = 0; x < MEMORY_SIZE - 1; x++)
+			e->session->history[x] = e->session->history[x + 1];
+
+		/* Add new entry for this time */
+		e->session->history[x] = ms;
 	}
-	
+
 	/* We have to find the maximum and minimum time delay we've had to deliver. */
 	min = e->session->history[0];
-	for (z=0;z < iax_dropcount + 1; z++) {
+	for (z = 0; z < iax_dropcount + 1; z++) {
 		/* We drop the top iax_dropcount entries.  iax_dropcount represents
 		   a tradeoff between quality of voice and latency.  3% drop seems to
 		   be unnoticable to the client and can significantly improve latency.  
 		   We add one more to our droplist, but that's the one we actually use, 
 		   and don't drop.  */
 		max = -99999999;
-		for (x=0;x<MEMORY_SIZE;x++) {
+		for (x = 0; x < MEMORY_SIZE; x++) {
 			if (max < e->session->history[x]) {
 				/* New candidate value.  Make sure we haven't dropped it. */
-				match=0;
-				for(y=0;!match && (y<z); y++) 
+				match = 0;
+				for (y = 0; !match && (y < z); y++)
 					match |= (drops[y] == x);
 				/* If there is no match, this is our new maximum */
 				if (!match) {
@@ -2413,7 +2319,7 @@
 	/* Again, just for reference.  The "jitter buffer" is the max.  The difference
 	   is the perceived jitter correction. */
 	e->session->jitter = max - min;
-	
+
 	/* If the jitter buffer is substantially too large, shrink it, slowly enough
 	   that the client won't notice ;-) . */
 	if (max < e->session->jitterbuffer - max_extra_jitterbuffer) {
@@ -2422,27 +2328,27 @@
 #endif
 		e->session->jitterbuffer -= 1;
 	}
-		
+
 	/* Keep the jitter buffer from becoming unreasonably large */
 	if (max > min + max_jitterbuffer) {
 		DEBU(G "Constraining jitter buffer (min = %d, max = %d)...\n", min, max);
 		max = min + max_jitterbuffer;
 	}
-	
+
 	/* If the jitter buffer is too small, we immediately grow our buffer to
 	   accomodate */
 	if (max > e->session->jitterbuffer)
 		e->session->jitterbuffer = max;
-	
+
 	/* Start with our jitter buffer delay, and subtract the lateness (or earliness).
 	   Remember these times are all relative to the first packet, so their absolute
 	   values are really irrelevant. */
 	ms = e->session->jitterbuffer - ms - IAX_SCHEDULE_FUZZ;
-	
+
 	/* If the jitterbuffer is disabled, always deliver immediately */
 	if (!iax_use_jitterbuffer)
 		ms = 0;
-	
+
 	if (ms < 1) {
 #ifdef EXTREME_DEBUG
 		DEBU(G "Calculated delay is only %d\n", ms);
@@ -2469,11 +2375,10 @@
 #endif
 #endif /* NEWJB */
 	return NULL;
-	
+
 }
 
-static int uncompress_subclass(unsigned char csub)
-{
+static int uncompress_subclass(unsigned char csub) {
 	/* If the SC_LOG flag is set, return 2^csub otherwise csub */
 	if (csub & IAX_FLAG_SC_LOG)
 		return 1 << (csub & ~IAX_FLAG_SC_LOG & IAX_MAX_SHIFT);
@@ -2481,8 +2386,7 @@
 		return csub;
 }
 
-static inline char *extract(char *src, char *string)
-{
+static inline char *extract(char *src, char *string) {
 	/* Extract and duplicate what we need from a string */
 	char *s, *t;
 	s = strstr(src, string);
@@ -2496,13 +2400,10 @@
 		}
 	}
 	return s;
-		
+
 }
 
-static struct iax_event *iax_header_to_event(struct iax_session *session,
-											 struct ast_iax2_full_hdr *fh,
-											 int datalen, struct sockaddr_in *sin)
-{
+static struct iax_event *iax_header_to_event(struct iax_session *session, struct ast_iax2_full_hdr *fh, int datalen, struct sockaddr_in *sin) {
 	struct iax_event *e;
 	struct iax_sched *sch;
 	unsigned int ts;
@@ -2512,14 +2413,10 @@
 	ts = ntohl(fh->ts);
 	/* don't run last_ts backwards; i.e. for retransmits and the like */
 	if (ts > session->last_ts &&
-	    (fh->type == AST_FRAME_IAX && 
-	     subclass != IAX_COMMAND_ACK &&
-	     subclass != IAX_COMMAND_PONG &&
-	     subclass != IAX_COMMAND_LAGRP)) {
-	    session->last_ts = ts;
+		(fh->type == AST_FRAME_IAX && subclass != IAX_COMMAND_ACK && subclass != IAX_COMMAND_PONG && subclass != IAX_COMMAND_LAGRP)) {
+		session->last_ts = ts;
 	}
 
-
 #ifdef DEBUG_SUPPORT
 	iax_showframe(NULL, fh, 1, sin, datalen);
 #endif
@@ -2527,89 +2424,75 @@
 	/* Get things going with it, timestamp wise, if we
 	   haven't already. */
 
-		/* Handle implicit ACKing unless this is an INVAL, and only if this is 
-		   from the real peer, not the transfer peer */
-		if (!inaddrcmp(sin, &session->peeraddr) && 
-			(((subclass != IAX_COMMAND_INVAL)) ||
-			(fh->type != AST_FRAME_IAX))) {
-			unsigned char x;
-			/* XXX This code is not very efficient.  Surely there is a better way which still
-			       properly handles boundary conditions? XXX */
-			/* First we have to qualify that the ACKed value is within our window */
-			for (x=session->rseqno; x != session->oseqno; x++)
-				if (fh->iseqno == x)
-					break;
-			if ((x != session->oseqno) || (session->oseqno == fh->iseqno)) {
-				/* The acknowledgement is within our window.  Time to acknowledge everything
-				   that it says to */
-				for (x=session->rseqno; x != fh->iseqno; x++) {
-					/* Ack the packet with the given timestamp */
-					DEBU(G "Cancelling transmission of packet %d\n", x);
-					iax_mutex_lock(sched_mutex);
-					sch = schedq;
-					while(sch) {
-						if (sch->frame && (sch->frame->session == session) && 
-						    (sch->frame->oseqno == x)) 
-							sch->frame->retries = -1;
-						sch = sch->next;
-					}
-					iax_mutex_unlock(sched_mutex);
+	/* Handle implicit ACKing unless this is an INVAL, and only if this is 
+	   from the real peer, not the transfer peer */
+	if (!inaddrcmp(sin, &session->peeraddr) && (((subclass != IAX_COMMAND_INVAL)) || (fh->type != AST_FRAME_IAX))) {
+		unsigned char x;
+		/* XXX This code is not very efficient.  Surely there is a better way which still
+		   properly handles boundary conditions? XXX */
+		/* First we have to qualify that the ACKed value is within our window */
+		for (x = session->rseqno; x != session->oseqno; x++)
+			if (fh->iseqno == x)
+				break;
+		if ((x != session->oseqno) || (session->oseqno == fh->iseqno)) {
+			/* The acknowledgement is within our window.  Time to acknowledge everything
+			   that it says to */
+			for (x = session->rseqno; x != fh->iseqno; x++) {
+				/* Ack the packet with the given timestamp */
+				DEBU(G "Cancelling transmission of packet %d\n", x);
+				iax_mutex_lock(sched_mutex);
+				sch = schedq;
+				while (sch) {
+					if (sch->frame && (sch->frame->session == session) && (sch->frame->oseqno == x))
+						sch->frame->retries = -1;
+					sch = sch->next;
 				}
-				/* Note how much we've received acknowledgement for */
-				session->rseqno = fh->iseqno;
-			} else
-				DEBU(G "Received iseqno %d not within window %d->%d\n", fh->iseqno, session->rseqno, session->oseqno);
-		}
+				iax_mutex_unlock(sched_mutex);
+			}
+			/* Note how much we've received acknowledgement for */
+			session->rseqno = fh->iseqno;
+		} else
+			DEBU(G "Received iseqno %d not within window %d->%d\n", fh->iseqno, session->rseqno, session->oseqno);
+	}
 
 	/* Check where we are */
-		if ((ntohs(fh->dcallno) & IAX_FLAG_RETRANS) || (fh->type != AST_FRAME_VOICE))
-			updatehistory = 0;
-		if ((session->iseqno != fh->oseqno) &&
-			(session->iseqno ||
-			   ((subclass != IAX_COMMAND_TXREADY) &&
-			    (subclass != IAX_COMMAND_TXREL) &&
-				(subclass != IAX_COMMAND_TXCNT) &&
-				(subclass != IAX_COMMAND_TXACC)) ||
-			  (fh->type != AST_FRAME_IAX))) {
-			if (
-			 ((subclass != IAX_COMMAND_ACK) &&
-			  (subclass != IAX_COMMAND_INVAL) &&
-			  (subclass != IAX_COMMAND_TXREADY) &&
-			  (subclass != IAX_COMMAND_TXREL) &&
-			  (subclass != IAX_COMMAND_TXCNT) &&
-			  (subclass != IAX_COMMAND_TXACC) &&
-			  (subclass != IAX_COMMAND_VNAK)) ||
-			  (fh->type != AST_FRAME_IAX)) {
-			 	/* If it's not an ACK packet, it's out of order. */
-				DEBU(G "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", 
-					session->iseqno, fh->oseqno, fh->type, subclass);
-				if (session->iseqno > fh->oseqno) {
-					/* If we've already seen it, ack it XXX There's a border condition here XXX */
-					if ((fh->type != AST_FRAME_IAX) || 
-							((subclass != IAX_COMMAND_ACK) && (subclass != IAX_COMMAND_INVAL))) {
-						DEBU(G "Acking anyway\n");
-						/* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if
-						   we have anything to send, we'll retransmit and get an ACK back anyway XXX */
-						send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0,fh->iseqno);
-					}
-				} else {
-					/* Send a VNAK requesting retransmission */
-					iax2_vnak(session);
+	if ((ntohs(fh->dcallno) & IAX_FLAG_RETRANS) || (fh->type != AST_FRAME_VOICE))
+		updatehistory = 0;
+	if ((session->iseqno != fh->oseqno) &&
+		(session->iseqno ||
+		 ((subclass != IAX_COMMAND_TXREADY) &&
+		  (subclass != IAX_COMMAND_TXREL) && (subclass != IAX_COMMAND_TXCNT) && (subclass != IAX_COMMAND_TXACC)) || (fh->type != AST_FRAME_IAX))) {
+		if (((subclass != IAX_COMMAND_ACK) &&
+			 (subclass != IAX_COMMAND_INVAL) &&
+			 (subclass != IAX_COMMAND_TXREADY) &&
+			 (subclass != IAX_COMMAND_TXREL) &&
+			 (subclass != IAX_COMMAND_TXCNT) && (subclass != IAX_COMMAND_TXACC) && (subclass != IAX_COMMAND_VNAK)) || (fh->type != AST_FRAME_IAX)) {
+			/* If it's not an ACK packet, it's out of order. */
+			DEBU(G "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n",
+				 session->iseqno, fh->oseqno, fh->type, subclass);
+			if (session->iseqno > fh->oseqno) {
+				/* If we've already seen it, ack it XXX There's a border condition here XXX */
+				if ((fh->type != AST_FRAME_IAX) || ((subclass != IAX_COMMAND_ACK) && (subclass != IAX_COMMAND_INVAL))) {
+					DEBU(G "Acking anyway\n");
+					/* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if
+					   we have anything to send, we'll retransmit and get an ACK back anyway XXX */
+					send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno);
 				}
-				return NULL;
+			} else {
+				/* Send a VNAK requesting retransmission */
+				iax2_vnak(session);
 			}
-		} else {
-			/* Increment unless it's an ACK or VNAK */
-			if (((subclass != IAX_COMMAND_ACK) &&
-			    (subclass != IAX_COMMAND_INVAL) &&
-			    (subclass != IAX_COMMAND_TXCNT) &&
-			    (subclass != IAX_COMMAND_TXACC) &&
-				(subclass != IAX_COMMAND_VNAK)) ||
-			    (fh->type != AST_FRAME_IAX))
-				session->iseqno++;
+			return NULL;
 		}
-			
-	e = (struct iax_event *)malloc(sizeof(struct iax_event) + datalen + 1);
+	} else {
+		/* Increment unless it's an ACK or VNAK */
+		if (((subclass != IAX_COMMAND_ACK) &&
+			 (subclass != IAX_COMMAND_INVAL) &&
+			 (subclass != IAX_COMMAND_TXCNT) && (subclass != IAX_COMMAND_TXACC) && (subclass != IAX_COMMAND_VNAK)) || (fh->type != AST_FRAME_IAX))
+			session->iseqno++;
+	}
+
+	e = (struct iax_event *) malloc(sizeof(struct iax_event) + datalen + 1);
 
 	if (e) {
 		memset(e, 0, sizeof(struct iax_event) + datalen);
@@ -2618,14 +2501,14 @@
 		 */
 		e->etype = -1;
 		e->session = session;
-		switch(fh->type) {
+		switch (fh->type) {
 		case AST_FRAME_DTMF:
 			e->etype = IAX_EVENT_DTMF;
 			e->subclass = subclass;
 			/* 
-			 We want the DTMF event deliver immediately so all I/O can be
-			 terminate quickly in an IVR system.
-			e = schedule_delivery(e, ts, updatehistory); */
+			   We want the DTMF event deliver immediately so all I/O can be
+			   terminate quickly in an IVR system.
+			   e = schedule_delivery(e, ts, updatehistory); */
 			break;
 		case AST_FRAME_VOICE:
 			e->etype = IAX_EVENT_VOICE;
@@ -2640,12 +2523,12 @@
 		case AST_FRAME_CNG:
 			e->etype = IAX_EVENT_CNG;
 			e->subclass = subclass;
-                        if (datalen) {
-                                memcpy(e->data, fh->iedata, datalen);
-                                e->datalen = datalen;
-                        }
-                        e = schedule_delivery(e, ts, updatehistory);
-                        break;
+			if (datalen) {
+				memcpy(e->data, fh->iedata, datalen);
+				e->datalen = datalen;
+			}
+			e = schedule_delivery(e, ts, updatehistory);
+			break;
 		case AST_FRAME_IAX:
 			/* Parse IE's */
 			if (datalen) {
@@ -2658,14 +2541,14 @@
 				e = NULL;
 				break;
 			}
-			switch(subclass) {
+			switch (subclass) {
 			case IAX_COMMAND_NEW:
 				/* This is a new, incoming call */
 				/* save the capability for validation */
 				session->capability = e->ies.capability;
 				if (e->ies.codec_prefs) {
 					strncpy(session->codec_order, e->ies.codec_prefs, sizeof(session->codec_order));
-					session->codec_order_len = (int)strlen(session->codec_order);
+					session->codec_order_len = (int) strlen(session->codec_order);
 				}
 				e->etype = IAX_EVENT_CONNECT;
 				e = schedule_delivery(e, ts, updatehistory);
@@ -2673,13 +2556,12 @@
 			case IAX_COMMAND_AUTHREQ:
 				/* This is a request for a call */
 				e->etype = IAX_EVENT_AUTHRQ;
-				if (strlen(session->username) && !strcmp(e->ies.username, session->username) &&
-					strlen(session->secret)) {
-						/* Hey, we already know this one */
-						iax_auth_reply(session, session->secret, e->ies.challenge, e->ies.authmethods);
-						free(e);
-						e = NULL;
-						break;
+				if (strlen(session->username) && !strcmp(e->ies.username, session->username) && strlen(session->secret)) {
+					/* Hey, we already know this one */
+					iax_auth_reply(session, session->secret, e->ies.challenge, e->ies.authmethods);
+					free(e);
+					e = NULL;
+					break;
 				}
 				e = schedule_delivery(e, ts, updatehistory);
 				break;
@@ -2717,7 +2599,7 @@
 			case IAX_COMMAND_PONG:
 				e->etype = IAX_EVENT_PONG;
 				/* track weighted average of ping time */
-				session->pingtime = ((2 * session->pingtime) + (calc_timestamp(session,0,NULL) - ts)) / 3;
+				session->pingtime = ((2 * session->pingtime) + (calc_timestamp(session, 0, NULL) - ts)) / 3;
 				session->remote_netstats.jitter = e->ies.rr_jitter;
 				session->remote_netstats.losspct = e->ies.rr_loss >> 24;;
 				session->remote_netstats.losscnt = e->ies.rr_loss & 0xffffff;
@@ -2729,13 +2611,12 @@
 			case IAX_COMMAND_ACCEPT:
 				if (e->ies.format & session->capability) {
 					e->etype = IAX_EVENT_ACCEPT;
-				}
-				else {
+				} else {
 					struct iax_ie_data ied;
 					/* Although this should not happen, we added this to make sure
 					   the negotiation protocol is enforced.
-						For lack of event to notify the application we use the defined
-						REJECT event.
+					   For lack of event to notify the application we use the defined
+					   REJECT event.
 					 */
 					memset(&ied, 0, sizeof(ied));
 					iax_ie_append_str(&ied, IAX_IE_CAUSE, (unsigned char *) "Unable to negotiate codec");
@@ -2779,15 +2660,15 @@
 				 *  apparent transfer address
 				 */
 				if (e->ies.apparent_addr != NULL) {
-				    /* so a full voice frame is sent on the 
-				       next voice output */
-				    session->svoiceformat = -1;	
-				    session->transfer = *e->ies.apparent_addr;
-				    session->transfer.sin_family = AF_INET;
-				    session->transfercallno = e->ies.callno;
-				    session->transferring = TRANSFER_BEGIN;
-				    session->transferid = e->ies.transferid;
-				    iax_send_txcnt(session);
+					/* so a full voice frame is sent on the 
+					   next voice output */
+					session->svoiceformat = -1;
+					session->transfer = *e->ies.apparent_addr;
+					session->transfer.sin_family = AF_INET;
+					session->transfercallno = e->ies.callno;
+					session->transferring = TRANSFER_BEGIN;
+					session->transferid = e->ies.transferid;
+					iax_send_txcnt(session);
 				}
 				free(e);
 				e = NULL;
@@ -2798,7 +2679,7 @@
 				/* Return immediately, makes no sense to schedule */
 				break;
 			case IAX_COMMAND_TXCNT:
-				if (session->transferring)  {
+				if (session->transferring) {
 					session->transfer = *sin;
 					iax_send_txaccept(session);
 				}
@@ -2816,11 +2697,10 @@
 				break;
 			case IAX_COMMAND_TXREL:
 				/* Release the transfer */
-			   send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, fh->ts, NULL, 0, fh->iseqno);
+				send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, fh->ts, NULL, 0, fh->iseqno);
 				if (session->transferring) {
 					complete_transfer(session, e->ies.callno, 1, 0);
-				}
-				else {
+				} else {
 					complete_transfer(session, session->peercallno, 0, 1);
 				}
 				e->etype = IAX_EVENT_TRANSFER;
@@ -2844,8 +2724,7 @@
 				send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno);
 				if (iax_handle_txready(session)) {
 					e->etype = IAX_EVENT_TXREADY;
-				}
-				else {
+				} else {
 					free(e);
 					e = NULL;
 				}
@@ -2857,7 +2736,7 @@
 			}
 			break;
 		case AST_FRAME_CONTROL:
-			switch(subclass) {
+			switch (subclass) {
 			case AST_CONTROL_ANSWER:
 				e->etype = IAX_EVENT_ANSWER;
 				e = schedule_delivery(e, ts, updatehistory);
@@ -2895,7 +2774,7 @@
 			break;
 
 		case AST_FRAME_HTML:
-			switch(fh->csub) {
+			switch (fh->csub) {
 			case AST_HTML_LINKURL:
 				e->etype = IAX_EVENT_LINKURL;
 				/* Fall through */
@@ -2934,22 +2813,19 @@
 		}
 	} else
 		DEBU(G "Out of memory\n");
-	    
+
 	/* Already ack'd iax frames */
 	if (session->aseqno != session->iseqno) {
-	    send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno);
+		send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno);
 	}
 	return e;
 }
 
-static struct iax_event *iax_miniheader_to_event(struct iax_session *session,
-						struct ast_iax2_mini_hdr *mh,
-						int datalen)
-{
+static struct iax_event *iax_miniheader_to_event(struct iax_session *session, struct ast_iax2_mini_hdr *mh, int datalen) {
 	struct iax_event *e;
 	time_in_ms_t ts;
 	int updatehistory = 1;
-	e = (struct iax_event *)malloc(sizeof(struct iax_event) + datalen);
+	e = (struct iax_event *) malloc(sizeof(struct iax_event) + datalen);
 	if (e) {
 		if (session->voiceformat > 0) {
 			e->etype = IAX_EVENT_VOICE;
@@ -2974,15 +2850,13 @@
 	return e;
 }
 
-void iax_destroy(struct iax_session *session)
-{
-	iax_mutex_lock(session_mutex); 
+void iax_destroy(struct iax_session *session) {
+	iax_mutex_lock(session_mutex);
 	destroy_session(session);
-	iax_mutex_unlock(session_mutex); 
+	iax_mutex_unlock(session_mutex);
 }
 
-static struct iax_event *iax_net_read(void)
-{
+static struct iax_event *iax_net_read(void) {
 	unsigned char buf[65536];
 	int res;
 #ifndef __Linux__
@@ -2993,7 +2867,7 @@
 	struct sockaddr_in sin;
 
 	sinlen = sizeof(sin);
-	res = iax_recvfrom(netfd, (char *)buf, sizeof(buf), 0, (struct sockaddr *) &sin, &sinlen);
+	res = iax_recvfrom(netfd, (char *) buf, sizeof(buf), 0, (struct sockaddr *) &sin, &sinlen);
 
 	if (res < 0) {
 #ifdef	WIN32
@@ -3012,48 +2886,44 @@
 	return iax_net_process(buf, res, &sin);
 }
 
-static struct iax_session *iax_txcnt_session(struct ast_iax2_full_hdr *fh, int datalen,
-				struct sockaddr_in *sin, short callno, short dcallno)
-{
+static struct iax_session *iax_txcnt_session(struct ast_iax2_full_hdr *fh, int datalen, struct sockaddr_in *sin, short callno, short dcallno) {
 	int subclass = uncompress_subclass(fh->csub);
-	unsigned char buf[ 65536 ]; /* allocated on stack with same size as iax_net_read() */
+	unsigned char buf[65536];	/* allocated on stack with same size as iax_net_read() */
 	struct iax_ies ies;
 	struct iax_session *cur;
 
 	if ((fh->type != AST_FRAME_IAX) || (subclass != IAX_COMMAND_TXCNT) || (!datalen)) {
-		return NULL; /* special handling for TXCNT only */
+		return NULL;			/* special handling for TXCNT only */
 	}
 	memcpy(buf, fh->iedata, datalen);	/* prepare local buf for iax_parse_ies() */
 
 	if (iax_parse_ies(&ies, buf, datalen)) {
-		return NULL;	/* Unable to parse IE's */
+		return NULL;			/* Unable to parse IE's */
 	}
 	if (!ies.transferid) {
-		return NULL;	/* TXCNT without proper IAX_IE_TRANSFERID */
+		return NULL;			/* TXCNT without proper IAX_IE_TRANSFERID */
 	}
-	iax_mutex_lock(session_mutex); 
-	for( cur=sessions; cur; cur=cur->next ) {
-		if ((cur->transferring) && (cur->transferid == (int)ies.transferid) &&
-		   	(cur->callno == dcallno) && (cur->transfercallno == callno)) {
+	iax_mutex_lock(session_mutex);
+	for (cur = sessions; cur; cur = cur->next) {
+		if ((cur->transferring) && (cur->transferid == (int) ies.transferid) && (cur->callno == dcallno) && (cur->transfercallno == callno)) {
 			/* We're transferring ---
-			 * 	skip address/port checking which would fail while remote peer behind symmetric NAT
-			 * 	verify transferid instead
+			 *  skip address/port checking which would fail while remote peer behind symmetric NAT
+			 *  verify transferid instead
 			 */
 			cur->transfer.sin_addr.s_addr = sin->sin_addr.s_addr;	/* setup for further handling */
 			cur->transfer.sin_port = sin->sin_port;
-			break;		
+			break;
 		}
 	}
-	iax_mutex_unlock(session_mutex); 
+	iax_mutex_unlock(session_mutex);
 	return cur;
 }
 
-struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_in *sin)
-{
-	struct ast_iax2_full_hdr *fh = (struct ast_iax2_full_hdr *)buf;
-	struct ast_iax2_mini_hdr *mh = (struct ast_iax2_mini_hdr *)buf;
+struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_in *sin) {
+	struct ast_iax2_full_hdr *fh = (struct ast_iax2_full_hdr *) buf;
+	struct ast_iax2_mini_hdr *mh = (struct ast_iax2_mini_hdr *) buf;
 	struct iax_session *session;
-	
+
 	if (ntohs(fh->scallno) & IAX_FLAG_FULL) {
 		int subclass = uncompress_subclass(fh->csub);
 		int makenew = 0;
@@ -3066,17 +2936,17 @@
 		}
 		/* Only allow it to make new sessions on types where that makes sense */
 		if ((fh->type == AST_FRAME_IAX) && ((subclass == IAX_COMMAND_NEW) ||
-											(subclass == IAX_COMMAND_POKE) ||
-											(subclass == IAX_COMMAND_REGREL) ||
-											(subclass == IAX_COMMAND_REGREQ))) {
+											(subclass == IAX_COMMAND_POKE) || (subclass == IAX_COMMAND_REGREL) || (subclass == IAX_COMMAND_REGREQ))) {
 			makenew = 1;
 		}
 
 		/* We have a full header, process appropriately */
 		session = iax_find_session(sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, makenew);
 		if (!session)
-			session = iax_txcnt_session(fh, len-sizeof(struct ast_iax2_full_hdr), sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS);
-		if (session) 
+			session =
+				iax_txcnt_session(fh, len - sizeof(struct ast_iax2_full_hdr), sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL,
+								  ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS);
+		if (session)
 			return iax_header_to_event(session, fh, len - sizeof(struct ast_iax2_full_hdr), sin);
 		/* if we get here, the frame was invalid for some reason, we should probably send IAX_COMMAND_INVAL (as long as the subclass was not already IAX_COMMAND_INVAL) */
 		DEBU(G "No session?\n");
@@ -3096,13 +2966,12 @@
 	}
 }
 
-static struct iax_sched *iax_get_sched(time_in_ms_t time_in_ms)
-{
-	struct iax_sched *cur, *prev=NULL;
+static struct iax_sched *iax_get_sched(time_in_ms_t time_in_ms) {
+	struct iax_sched *cur, *prev = NULL;
 	iax_mutex_lock(sched_mutex);
 	cur = schedq;
 	/* Check the event schedule first. */
-	while(cur) {
+	while (cur) {
 		if (time_in_ms > cur->when) {
 			/* Take it out of the event queue */
 			if (prev) {
@@ -3119,20 +2988,19 @@
 	return NULL;
 }
 
-struct iax_event *iax_get_event(int blocking)
-{
+struct iax_event *iax_get_event(int blocking) {
 	struct iax_event *event;
 	struct iax_frame *frame;
 	time_in_ms_t time_in_ms;
 	struct iax_sched *cur;
-	
+
 	if (do_shutdown) {
 		__iax_shutdown();
 		do_shutdown = 0;
 		return NULL;
 	}
 	time_in_ms = current_time_in_ms();
-	while((cur = iax_get_sched(time_in_ms))) {
+	while ((cur = iax_get_sched(time_in_ms))) {
 
 		event = cur->event;
 		frame = cur->frame;
@@ -3144,15 +3012,15 @@
 				free(cur);
 				return event;
 			}
-		} else if(frame) {
+		} else if (frame) {
 			/* It's a frame, transmit it and schedule a retry */
 			if (frame->retries < 0) {
 				/* It's been acked.  No need to send it.   Destroy the old
 				   frame. If final, destroy the session. */
 				if (frame->final) {
-					iax_mutex_lock(session_mutex); 
+					iax_mutex_lock(session_mutex);
 					destroy_session(frame->session);
-					iax_mutex_unlock(session_mutex); 
+					iax_mutex_unlock(session_mutex);
 				}
 				if (frame->data)
 					free(frame->data);
@@ -3170,14 +3038,14 @@
 					/* We haven't been able to get an ACK on this packet. If a 
 					   final frame, destroy the session, otherwise, pass up timeout */
 					if (frame->final) {
-						iax_mutex_lock(session_mutex); 
+						iax_mutex_lock(session_mutex);
 						destroy_session(frame->session);
-						iax_mutex_unlock(session_mutex); 
+						iax_mutex_unlock(session_mutex);
 						if (frame->data)
 							free(frame->data);
 						free(frame);
 					} else {
-						event = (struct iax_event *)malloc(sizeof(struct iax_event));
+						event = (struct iax_event *) malloc(sizeof(struct iax_event));
 						if (event) {
 							event->etype = IAX_EVENT_TIMEOUT;
 							event->session = frame->session;
@@ -3201,7 +3069,7 @@
 						frame->retrytime = MAX_RETRY_TIME;
 				} else if (frame->retrytime > 1000)
 					frame->retrytime = 1000;
-				fh = (struct ast_iax2_full_hdr *)(frame->data);
+				fh = (struct ast_iax2_full_hdr *) (frame->data);
 				fh->dcallno = htons(IAX_FLAG_RETRANS | frame->dcallno);
 				iax_xmit_frame(frame);
 				/* Schedule another retransmission */
@@ -3209,7 +3077,7 @@
 				iax_sched_add(NULL, frame, NULL, NULL, frame->retrytime);
 			}
 		} else if (cur->func) {
-		    cur->func(cur->arg);
+			cur->func(cur->arg);
 		}
 		free(cur);
 	}
@@ -3217,20 +3085,20 @@
 #ifdef NEWJB
 	/* get jitterbuffer-scheduled events */
 	{
-	    struct iax_session *cur;
-	    jb_frame frame;
-		iax_mutex_lock(session_mutex); 
-	    for(cur=sessions; cur; cur=cur->next) {
+		struct iax_session *cur;
+		jb_frame frame;
+		iax_mutex_lock(session_mutex);
+		for (cur = sessions; cur; cur = cur->next) {
 			int ret;
 			time_in_ms_t now;
 			time_in_ms_t next;
 
 			now = time_in_ms - cur->rxcore;
-			if(now > (next = jb_next(cur->jb))) {
-				ret = jb_get(cur->jb,&frame,now,get_interp_len(cur->voiceformat));
-				switch(ret) {
+			if (now > (next = jb_next(cur->jb))) {
+				ret = jb_get(cur->jb, &frame, now, get_interp_len(cur->voiceformat));
+				switch (ret) {
 				case JB_OK:
-					//			    if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
+					//              if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
 					event = frame.data;
 					event = handle_event(event);
 					if (event) {
@@ -3239,25 +3107,25 @@
 					}
 					break;
 				case JB_INTERP:
-					//			    if(next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
+					//              if(next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
 					/* create an interpolation frame */
 					//fprintf(stderr, "Making Interpolation frame\n");
-					event = (struct iax_event *)malloc(sizeof(struct iax_event));
+					event = (struct iax_event *) malloc(sizeof(struct iax_event));
 					if (event) {
-						event->etype    = IAX_EVENT_VOICE;
+						event->etype = IAX_EVENT_VOICE;
 						event->subclass = cur->voiceformat;
-						event->ts	    = now; /* XXX: ??? applications probably ignore this anyway */
-						event->session  = cur;
-						event->datalen  = 0;
+						event->ts = now;	/* XXX: ??? applications probably ignore this anyway */
+						event->session = cur;
+						event->datalen = 0;
 						event = handle_event(event);
-						if(event) {
+						if (event) {
 							iax_mutex_unlock(session_mutex);
 							return event;
 						}
 					}
 					break;
 				case JB_DROP:
-					//			    if(next != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(cur->jb), next);
+					//              if(next != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(cur->jb), next);
 					iax_event_free(frame.data);
 					break;
 				case JB_NOFRAME:
@@ -3269,7 +3137,7 @@
 					break;
 				}
 			}
-	    }
+		}
 		iax_mutex_unlock(session_mutex);
 	}
 
@@ -3279,97 +3147,89 @@
 		/* Block until there is data if desired */
 		fd_set fds;
 		time_in_ms_t nextEventTime;
-		
+
 		FD_ZERO(&fds);
 		FD_SET(netfd, &fds);
 
-		nextEventTime = iax_time_to_next_event(); 
-		if(nextEventTime < 0 && blocking > 1) {
+		nextEventTime = iax_time_to_next_event();
+		if (nextEventTime < 0 && blocking > 1) {
 			nextEventTime = blocking;
 		}
-		if(nextEventTime < 0) 
+		if (nextEventTime < 0)
 			select(netfd + 1, &fds, NULL, NULL, NULL);
-		else 
-		{ 
-			struct timeval nextEvent; 
+		else {
+			struct timeval nextEvent;
 
-			nextEvent.tv_sec = (long)(nextEventTime / 1000); 
-			nextEvent.tv_usec = (long)((nextEventTime % 1000) * 1000);
+			nextEvent.tv_sec = (long) (nextEventTime / 1000);
+			nextEvent.tv_usec = (long) ((nextEventTime % 1000) * 1000);
 
-			select(netfd + 1, &fds, NULL, NULL, &nextEvent); 
-		} 
+			select(netfd + 1, &fds, NULL, NULL, &nextEvent);
+		}
 
 	}
 	event = iax_net_read();
-	
+
 	return handle_event(event);
 }
 
-struct sockaddr_in iax_get_peer_addr(struct iax_session *session)
-{
+struct sockaddr_in iax_get_peer_addr(struct iax_session *session) {
 	return session->peeraddr;
 }
 
-char *iax_get_peer_ip(struct iax_session *session)
-{
+char *iax_get_peer_ip(struct iax_session *session) {
 	return inet_ntoa(session->peeraddr.sin_addr);
 }
 
-char *iax_event_get_apparent_ip(struct iax_event *event)
-{
+char *iax_event_get_apparent_ip(struct iax_event *event) {
 	return inet_ntoa(event->ies.apparent_addr->sin_addr);
 }
 
-void iax_session_destroy(struct iax_session **session) 
-{
-	iax_mutex_lock(session_mutex); 
+void iax_session_destroy(struct iax_session **session) {
+	iax_mutex_lock(session_mutex);
 	destroy_session(*session);
 	*session = NULL;
-	iax_mutex_unlock(session_mutex); 
+	iax_mutex_unlock(session_mutex);
 }
 
-void iax_event_free(struct iax_event *event)
-{
+void iax_event_free(struct iax_event *event) {
 	/* 
 	   We gave the user a chance to play with the session now we need to destroy it 
 	   if you are not calling this function on every event you read you are now going
 	   to leak sessions as well as events!
-	*/
-	switch(event->etype) {
+	 */
+	switch (event->etype) {
 	case IAX_EVENT_REJECT:
 	case IAX_EVENT_HANGUP:
 		/* Destroy this session -- it's no longer valid */
-		if (event->session) { /* maybe the user did it already */
-			iax_mutex_lock(session_mutex); 
+		if (event->session) {	/* maybe the user did it already */
+			iax_mutex_lock(session_mutex);
 			destroy_session(event->session);
-			iax_mutex_unlock(session_mutex); 
+			iax_mutex_unlock(session_mutex);
 		}
 		break;
 	}
 	free(event);
 }
 
-int iax_get_fd(void) 
-{
+int iax_get_fd(void) {
 	/* Return our network file descriptor.  The client can select on this (probably with other
 	   things, or can add it to a network add sort of gtk_input_add for example */
 	return netfd;
 }
 
-int iax_quelch_moh(struct iax_session *session, int MOH)
-{
-	
-	struct iax_ie_data ied;			//IE Data Structure (Stuff To Send)
-	memset(&ied, 0, sizeof(ied));	
-	
+int iax_quelch_moh(struct iax_session *session, int MOH) {
+
+	struct iax_ie_data ied;		//IE Data Structure (Stuff To Send)
+	memset(&ied, 0, sizeof(ied));
+
 	// You can't quelch the quelched
 	if (session->quelch == 1)
 		return -1;
-		
+
 	if (MOH) {
 		iax_ie_append(&ied, IAX_IE_MUSICONHOLD);
 		session->transfer_moh = 1;
 	}
-		
+
 	return send_command(session, AST_FRAME_IAX, IAX_COMMAND_QUELCH, 0, ied.buf, ied.pos, -1);
 }

Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/iax2-parser.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/iax2-parser.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/iax2-parser.c	Tue May 27 00:54:52 2008
@@ -40,12 +40,12 @@
 #ifdef ALIGN32
 static unsigned int get_uint32(unsigned char *p)
 {
-  return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+	return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
 }
 
 static unsigned short get_uint16(unsigned char *p)
 {
-  return (p[0] << 8) | p[1] ;
+	return (p[0] << 8) | p[1];
 }
 
 #else
@@ -64,8 +64,8 @@
 	fprintf(stderr, "WARNING: %s", str);
 }
 
-static void (*outputf)(const char *str) = internaloutput;
-static void (*errorf)(const char *str) = internalerror;
+static void (*outputf) (const char *str) = internaloutput;
+static void (*errorf) (const char *str) = internalerror;
 
 static void dump_addr(char *output, int maxlen, void *value, int len)
 {
@@ -83,21 +83,21 @@
 	maxlen--;
 	if (maxlen > len)
 		maxlen = len;
-	strncpy(output,value, maxlen);
+	strncpy(output, value, maxlen);
 	output[maxlen] = '\0';
 }
 
 static void dump_int(char *output, int maxlen, void *value, int len)
 {
-	if (len == (int)sizeof(unsigned int))
-		snprintf(output, maxlen, "%lu", (unsigned long)ntohl(get_uint32(value)));
+	if (len == (int) sizeof(unsigned int))
+		snprintf(output, maxlen, "%lu", (unsigned long) ntohl(get_uint32(value)));
 	else
 		snprintf(output, maxlen, "Invalid INT");
 }
 
 static void dump_short(char *output, int maxlen, void *value, int len)
 {
-	if (len == (int)sizeof(unsigned short))
+	if (len == (int) sizeof(unsigned short))
 		snprintf(output, maxlen, "%d", ntohs(get_uint16(value)));
 	else
 		snprintf(output, maxlen, "Invalid SHORT");
@@ -105,8 +105,8 @@
 
 static void dump_byte(char *output, int maxlen, void *value, int len)
 {
-	if (len == (int)sizeof(unsigned char))
-		snprintf(output, maxlen, "%d", *((unsigned char *)value));
+	if (len == (int) sizeof(unsigned char))
+		snprintf(output, maxlen, "%d", *((unsigned char *) value));
 	else
 		snprintf(output, maxlen, "Invalid BYTE");
 }
@@ -115,7 +115,7 @@
 static void dump_ipaddr(char *output, int maxlen, void *value, int len)
 {
 	struct sockaddr_in sin;
-	if (len == (int)sizeof(unsigned int)) {
+	if (len == (int) sizeof(unsigned int)) {
 		memcpy(&sin.sin_addr, value, len);
 		snprintf(output, maxlen, "%s", inet_ntoa(sin.sin_addr));
 	} else
@@ -124,9 +124,8 @@
 
 static void dump_prov_flags(char *output, int maxlen, void *value, int len)
 {
-	if (len == (int)sizeof(unsigned int))
-		snprintf(output, maxlen, "%lu (%s)", (unsigned long)ntohl(get_uint32(value)),
-			"PROVISION_PARSING_NOT_IMPLEMENTED");
+	if (len == (int) sizeof(unsigned int))
+		snprintf(output, maxlen, "%lu (%s)", (unsigned long) ntohl(get_uint32(value)), "PROVISION_PARSING_NOT_IMPLEMENTED");
 	else
 		snprintf(output, maxlen, "Invalid INT");
 }
@@ -134,10 +133,10 @@
 
 static void dump_samprate(char *output, int maxlen, void *value, int len)
 {
-	char tmp[256]="";
+	char tmp[256] = "";
 	int sr;
-	if (len == (int)sizeof(unsigned short)) {
-		sr = ntohs(*((unsigned short *)value));
+	if (len == (int) sizeof(unsigned short)) {
+		sr = ntohs(*((unsigned short *) value));
 		if (sr & IAX_RATE_8KHZ)
 			strcat(tmp, ",8khz");
 		if (sr & IAX_RATE_11KHZ)
@@ -170,61 +169,61 @@
 static struct iax2_ie {
 	int ie;
 	char *name;
-	void (*dump)(char *output, int maxlen, void *value, int len);
+	void (*dump) (char *output, int maxlen, void *value, int len);
 } ies[] = {
-	{ IAX_IE_CALLED_NUMBER, "CALLED NUMBER", dump_string },
-	{ IAX_IE_CALLING_NUMBER, "CALLING NUMBER", dump_string },
-	{ IAX_IE_CALLING_ANI, "ANI", dump_string },
-	{ IAX_IE_CALLING_NAME, "CALLING NAME", dump_string },
-	{ IAX_IE_CALLED_CONTEXT, "CALLED CONTEXT", dump_string },
-	{ IAX_IE_USERNAME, "USERNAME", dump_string },
-	{ IAX_IE_PASSWORD, "PASSWORD", dump_string },
-	{ IAX_IE_CAPABILITY, "CAPABILITY", dump_int },
-	{ IAX_IE_FORMAT, "FORMAT", dump_int },
-	{ IAX_IE_LANGUAGE, "LANGUAGE", dump_string },
-	{ IAX_IE_CODEC_PREFS, "CODEC_PREFS", dump_string },
-	{ IAX_IE_VERSION, "VERSION", dump_short },
-	{ IAX_IE_ADSICPE, "ADSICPE", dump_short },
-	{ IAX_IE_DNID, "DNID", dump_string },
-	{ IAX_IE_AUTHMETHODS, "AUTHMETHODS", dump_short },
-	{ IAX_IE_CHALLENGE, "CHALLENGE", dump_string },
-	{ IAX_IE_MD5_RESULT, "MD5 RESULT", dump_string },
-	{ IAX_IE_RSA_RESULT, "RSA RESULT", dump_string },
-	{ IAX_IE_APPARENT_ADDR, "APPARENT ADDRESS", dump_addr },
-	{ IAX_IE_REFRESH, "REFRESH", dump_short },
-	{ IAX_IE_DPSTATUS, "DIALPLAN STATUS", dump_short },
-	{ IAX_IE_CALLNO, "CALL NUMBER", dump_short },
-	{ IAX_IE_CAUSE, "CAUSE", dump_string },
-	{ IAX_IE_IAX_UNKNOWN, "UNKNOWN IAX CMD", dump_byte },
-	{ IAX_IE_MSGCOUNT, "MESSAGE COUNT", dump_short },
-	{ IAX_IE_AUTOANSWER, "AUTO ANSWER REQ" },
-	{ IAX_IE_TRANSFERID, "TRANSFER ID", dump_int },
-	{ IAX_IE_RDNIS, "REFERRING DNIS", dump_string },
-	{ IAX_IE_PROVISIONING, "PROVISIONING", dump_prov },
-	{ IAX_IE_AESPROVISIONING, "AES PROVISIONG" },
-	{ IAX_IE_DATETIME, "DATE TIME", dump_int },
-	{ IAX_IE_DEVICETYPE, "DEVICE TYPE", dump_string },
-	{ IAX_IE_SERVICEIDENT, "SERVICE IDENT", dump_string },
-	{ IAX_IE_FIRMWAREVER, "FIRMWARE VER", dump_short },
-	{ IAX_IE_FWBLOCKDESC, "FW BLOCK DESC", dump_int },
-	{ IAX_IE_FWBLOCKDATA, "FW BLOCK DATA" },
-	{ IAX_IE_PROVVER, "PROVISIONG VER", dump_int },
-	{ IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte },
-	{ IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte },
-	{ IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short },
-	{ IAX_IE_SAMPLINGRATE, "SAMPLINGRATE", dump_samprate },
-	{ IAX_IE_RR_JITTER, "RR_JITTER", dump_int },
-	{ IAX_IE_RR_LOSS, "RR_LOSS", dump_int },
-	{ IAX_IE_RR_PKTS, "RR_PKTS", dump_int },
-	{ IAX_IE_RR_DELAY, "RR_DELAY", dump_short },
-	{ IAX_IE_RR_DROPPED, "RR_DROPPED", dump_int },
-	{ IAX_IE_RR_OOO, "RR_OOO", dump_int },
-};
+	{
+	IAX_IE_CALLED_NUMBER, "CALLED NUMBER", dump_string}, {
+	IAX_IE_CALLING_NUMBER, "CALLING NUMBER", dump_string}, {
+	IAX_IE_CALLING_ANI, "ANI", dump_string}, {
+	IAX_IE_CALLING_NAME, "CALLING NAME", dump_string}, {
+	IAX_IE_CALLED_CONTEXT, "CALLED CONTEXT", dump_string}, {
+	IAX_IE_USERNAME, "USERNAME", dump_string}, {
+	IAX_IE_PASSWORD, "PASSWORD", dump_string}, {
+	IAX_IE_CAPABILITY, "CAPABILITY", dump_int}, {
+	IAX_IE_FORMAT, "FORMAT", dump_int}, {
+	IAX_IE_LANGUAGE, "LANGUAGE", dump_string}, {
+	IAX_IE_CODEC_PREFS, "CODEC_PREFS", dump_string}, {
+	IAX_IE_VERSION, "VERSION", dump_short}, {
+	IAX_IE_ADSICPE, "ADSICPE", dump_short}, {
+	IAX_IE_DNID, "DNID", dump_string}, {
+	IAX_IE_AUTHMETHODS, "AUTHMETHODS", dump_short}, {
+	IAX_IE_CHALLENGE, "CHALLENGE", dump_string}, {
+	IAX_IE_MD5_RESULT, "MD5 RESULT", dump_string}, {
+	IAX_IE_RSA_RESULT, "RSA RESULT", dump_string}, {
+	IAX_IE_APPARENT_ADDR, "APPARENT ADDRESS", dump_addr}, {
+	IAX_IE_REFRESH, "REFRESH", dump_short}, {
+	IAX_IE_DPSTATUS, "DIALPLAN STATUS", dump_short}, {
+	IAX_IE_CALLNO, "CALL NUMBER", dump_short}, {
+	IAX_IE_CAUSE, "CAUSE", dump_string}, {
+	IAX_IE_IAX_UNKNOWN, "UNKNOWN IAX CMD", dump_byte}, {
+	IAX_IE_MSGCOUNT, "MESSAGE COUNT", dump_short}, {
+	IAX_IE_AUTOANSWER, "AUTO ANSWER REQ"}, {
+	IAX_IE_TRANSFERID, "TRANSFER ID", dump_int}, {
+	IAX_IE_RDNIS, "REFERRING DNIS", dump_string}, {
+	IAX_IE_PROVISIONING, "PROVISIONING", dump_prov}, {
+	IAX_IE_AESPROVISIONING, "AES PROVISIONG"}, {
+	IAX_IE_DATETIME, "DATE TIME", dump_int}, {
+	IAX_IE_DEVICETYPE, "DEVICE TYPE", dump_string}, {
+	IAX_IE_SERVICEIDENT, "SERVICE IDENT", dump_string}, {
+	IAX_IE_FIRMWAREVER, "FIRMWARE VER", dump_short}, {
+	IAX_IE_FWBLOCKDESC, "FW BLOCK DESC", dump_int}, {
+	IAX_IE_FWBLOCKDATA, "FW BLOCK DATA"}, {
+	IAX_IE_PROVVER, "PROVISIONG VER", dump_int}, {
+	IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte}, {
+	IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte}, {
+	IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short}, {
+	IAX_IE_SAMPLINGRATE, "SAMPLINGRATE", dump_samprate}, {
+	IAX_IE_RR_JITTER, "RR_JITTER", dump_int}, {
+	IAX_IE_RR_LOSS, "RR_LOSS", dump_int}, {
+	IAX_IE_RR_PKTS, "RR_PKTS", dump_int}, {
+	IAX_IE_RR_DELAY, "RR_DELAY", dump_short}, {
+	IAX_IE_RR_DROPPED, "RR_DROPPED", dump_int}, {
+IAX_IE_RR_OOO, "RR_OOO", dump_int},};
 
 const char *iax_ie2str(int ie)
 {
 	int x;
-	for (x=0;x<(int)sizeof(ies) / (int)sizeof(ies[0]); x++) {
+	for (x = 0; x < (int) sizeof(ies) / (int) sizeof(ies[0]); x++) {
 		if (ies[x].ie == ie)
 			return ies[x].name;
 	}
@@ -240,22 +239,25 @@
 	char tmp[256];
 	if (len < 2)
 		return;
-	strcpy(output, "\n"); 
-	maxlen -= (int)strlen(output); output += strlen(output);
-	while(len > 2) {
+	strcpy(output, "\n");
+	maxlen -= (int) strlen(output);
+	output += strlen(output);
+	while (len > 2) {
 		ie = iedata[0];
 		ielen = iedata[1];
-		if (ielen + 2> len) {
-			snprintf(tmp, (int)sizeof(tmp), "Total Prov IE length of %d bytes exceeds remaining prov frame length of %d bytes\n", ielen + 2, len);
+		if (ielen + 2 > len) {
+			snprintf(tmp, (int) sizeof(tmp), "Total Prov IE length of %d bytes exceeds remaining prov frame length of %d bytes\n", ielen + 2, len);
 			strncpy(output, tmp, maxlen - 1);
-			maxlen -= (int)strlen(output); output += strlen(output);
+			maxlen -= (int) strlen(output);
+			output += strlen(output);
 			return;
 		}
 		found = 0;
 		if (!found) {
-			snprintf(tmp, (int)sizeof(tmp), "       Unknown Prov IE %03d  : Present\n", ie);
+			snprintf(tmp, (int) sizeof(tmp), "       Unknown Prov IE %03d  : Present\n", ie);
 			strncpy(output, tmp, maxlen - 1);
-			maxlen -= (int)strlen(output); output += strlen(output);
+			maxlen -= (int) strlen(output);
+			output += strlen(output);
 		}
 		iedata += (2 + ielen);
 		len -= (2 + ielen);
@@ -272,34 +274,34 @@
 	char tmp[1024];
 	if (len < 2)
 		return;
-	while(len > 2) {
+	while (len > 2) {
 		ie = iedata[0];
 		ielen = iedata[1];
-		if (ielen + 2> len) {
-			snprintf(tmp, (int)sizeof(tmp), "Total IE length of %d bytes exceeds remaining frame length of %d bytes\n", ielen + 2, len);
+		if (ielen + 2 > len) {
+			snprintf(tmp, (int) sizeof(tmp), "Total IE length of %d bytes exceeds remaining frame length of %d bytes\n", ielen + 2, len);
 			outputf(tmp);
 			return;
 		}
 		found = 0;
-		for (x=0;x<(int)sizeof(ies) / (int)sizeof(ies[0]); x++) {
+		for (x = 0; x < (int) sizeof(ies) / (int) sizeof(ies[0]); x++) {
 			if (ies[x].ie == ie) {
 				if (ies[x].dump) {
-					ies[x].dump(interp, (int)sizeof(interp), iedata + 2, ielen);
-					snprintf(tmp, (int)sizeof(tmp), "   %-15.15s : %s\n", ies[x].name, interp);
+					ies[x].dump(interp, (int) sizeof(interp), iedata + 2, ielen);
+					snprintf(tmp, (int) sizeof(tmp), "   %-15.15s : %s\n", ies[x].name, interp);
 					outputf(tmp);
 				} else {
 					if (ielen)
-						snprintf(interp, (int)sizeof(interp), "%d bytes", ielen);
+						snprintf(interp, (int) sizeof(interp), "%d bytes", ielen);
 					else
 						strcpy(interp, "Present");
-					snprintf(tmp, (int)sizeof(tmp), "   %-15.15s : %s\n", ies[x].name, interp);
+					snprintf(tmp, (int) sizeof(tmp), "   %-15.15s : %s\n", ies[x].name, interp);
 					outputf(tmp);
 				}
 				found++;
 			}
 		}
 		if (!found) {
-			snprintf(tmp, (int)sizeof(tmp), "   Unknown IE %03d  : Present\n", ie);
+			snprintf(tmp, (int) sizeof(tmp), "   Unknown IE %03d  : Present\n", ie);
 			outputf(tmp);
 		}
 		iedata += (2 + ielen);
@@ -319,7 +321,8 @@
 		"NULL   ",
 		"IAX    ",
 		"TEXT   ",
-		"IMAGE  " };
+		"IMAGE  "
+	};
 	const char *iaxs[] = {
 		"(0?)",
 		"NEW    ",
@@ -368,7 +371,8 @@
 		"ANSWER ",
 		"BUSY   ",
 		"TKOFFHK ",
-		"OFFHOOK" };
+		"OFFHOOK"
+	};
 	struct ast_iax2_full_hdr *fh;
 	char retries[20];
 	char class2[20];
@@ -379,7 +383,7 @@
 
 	if (f) {
 		fh = f->data;
-		snprintf(retries, (int)sizeof(retries), "%03d", f->retries);
+		snprintf(retries, (int) sizeof(retries), "%03d", f->retries);
 	} else {
 		fh = fhi;
 		if (ntohs(fh->dcallno) & IAX_FLAG_RETRANS)
@@ -391,43 +395,41 @@
 		/* Don't mess with mini-frames */
 		return;
 	}
-	if (fh->type > ((int)sizeof(frames)/(int)sizeof(char *)) - 1) {
-		snprintf(class2, (int)sizeof(class2), "(%d?)", fh->type);
+	if (fh->type > ((int) sizeof(frames) / (int) sizeof(char *)) - 1) {
+		snprintf(class2, (int) sizeof(class2), "(%d?)", fh->type);
 		class = class2;
 	} else {
-		class = frames[(int)fh->type];
+		class = frames[(int) fh->type];
 	}
 	if (fh->type == AST_FRAME_DTMF) {
 		sprintf(subclass2, "%c", fh->csub);
 		subclass = subclass2;
 	} else if (fh->type == AST_FRAME_IAX) {
-		if (fh->csub >= (int)sizeof(iaxs)/(int)sizeof(iaxs[0])) {
-			snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub);
+		if (fh->csub >= (int) sizeof(iaxs) / (int) sizeof(iaxs[0])) {
+			snprintf(subclass2, (int) sizeof(subclass2), "(%d?)", fh->csub);
 			subclass = subclass2;
 		} else {
-			subclass = iaxs[(int)fh->csub];
+			subclass = iaxs[(int) fh->csub];
 		}
 	} else if (fh->type == AST_FRAME_CONTROL) {
-		if (fh->csub > (int)sizeof(cmds)/(int)sizeof(char *)) {
-			snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub);
+		if (fh->csub > (int) sizeof(cmds) / (int) sizeof(char *)) {
+			snprintf(subclass2, (int) sizeof(subclass2), "(%d?)", fh->csub);
 			subclass = subclass2;
 		} else {
-			subclass = cmds[(int)fh->csub];
+			subclass = cmds[(int) fh->csub];
 		}
 	} else {
-		snprintf(subclass2, (int)sizeof(subclass2), "%d", fh->csub);
+		snprintf(subclass2, (int) sizeof(subclass2), "%d", fh->csub);
 		subclass = subclass2;
 	}
-snprintf(tmp, (int)sizeof(tmp), 
-"%s-Frame Retry[%s] -- OSeqno: %3.3d ISeqno: %3.3d Type: %s Subclass: %s\n",
-	(rx ? "Rx" : "Tx"),
-	retries, fh->oseqno, fh->iseqno, class, subclass);
+	snprintf(tmp, (int) sizeof(tmp),
+			 "%s-Frame Retry[%s] -- OSeqno: %3.3d ISeqno: %3.3d Type: %s Subclass: %s\n",
+			 (rx ? "Rx" : "Tx"), retries, fh->oseqno, fh->iseqno, class, subclass);
 	outputf(tmp);
-snprintf(tmp, (int)sizeof(tmp), 
-"   Timestamp: %05lums  SCall: %5.5d  DCall: %5.5d [%s:%d]\n",
-	(unsigned long)ntohl(fh->ts),
-	ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS,
-		inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
+	snprintf(tmp, (int) sizeof(tmp),
+			 "   Timestamp: %05lums  SCall: %5.5d  DCall: %5.5d [%s:%d]\n",
+			 (unsigned long) ntohl(fh->ts),
+			 ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
 	outputf(tmp);
 	if (fh->type == AST_FRAME_IAX)
 		dump_ies(fh->iedata, datalen);
@@ -436,13 +438,14 @@
 int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen)
 {
 	char tmp[256];
-	if (datalen > ((int)sizeof(ied->buf) - ied->pos)) {
-		snprintf(tmp, (int)sizeof(tmp), "Out of space for ie '%s' (%d), need %d have %d\n", iax_ie2str(ie), ie, datalen, (int)sizeof(ied->buf) - ied->pos);
+	if (datalen > ((int) sizeof(ied->buf) - ied->pos)) {
+		snprintf(tmp, (int) sizeof(tmp), "Out of space for ie '%s' (%d), need %d have %d\n", iax_ie2str(ie), ie, datalen,
+				 (int) sizeof(ied->buf) - ied->pos);
 		errorf(tmp);
 		return -1;
 	}
 	ied->buf[ied->pos++] = ie;
-	ied->buf[ied->pos++] = (unsigned char)datalen;
+	ied->buf[ied->pos++] = (unsigned char) datalen;
 	memcpy(ied->buf + ied->pos, data, datalen);
 	ied->pos += datalen;
 	return 0;
@@ -450,26 +453,26 @@
 
 int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin)
 {
-	return iax_ie_append_raw(ied, ie, sin, (int)sizeof(struct sockaddr_in));
+	return iax_ie_append_raw(ied, ie, sin, (int) sizeof(struct sockaddr_in));
 }
 
-int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value) 
+int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value)
 {
 	unsigned int newval;
 	newval = htonl(value);
-	return iax_ie_append_raw(ied, ie, &newval, (int)sizeof(newval));
+	return iax_ie_append_raw(ied, ie, &newval, (int) sizeof(newval));
 }
 
-int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value) 
+int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value)
 {
 	unsigned short newval;
 	newval = htons(value);
-	return iax_ie_append_raw(ied, ie, &newval, (int)sizeof(newval));
+	return iax_ie_append_raw(ied, ie, &newval, (int) sizeof(newval));
 }
 
 int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const unsigned char *str)
 {
-	return iax_ie_append_raw(ied, ie, str, (int)strlen((char *) str));
+	return iax_ie_append_raw(ied, ie, str, (int) strlen((char *) str));
 }
 
 int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat)
@@ -477,17 +480,17 @@
 	return iax_ie_append_raw(ied, ie, &dat, 1);
 }
 
-int iax_ie_append(struct iax_ie_data *ied, unsigned char ie) 
+int iax_ie_append(struct iax_ie_data *ied, unsigned char ie)
 {
 	return iax_ie_append_raw(ied, ie, NULL, 0);
 }
 
-void iax_set_output(void (*func)(const char *))
+void iax_set_output(void (*func) (const char *))
 {
 	outputf = func;
 }
 
-void iax_set_error(void (*func)(const char *))
+void iax_set_error(void (*func) (const char *))
 {
 	errorf = func;
 }
@@ -498,21 +501,21 @@
 	int len;
 	int ie;
 	char tmp[256];
-	memset(my_ies, 0, (int)sizeof(struct iax_ies));
+	memset(my_ies, 0, (int) sizeof(struct iax_ies));
 	my_ies->msgcount = -1;
 	my_ies->firmwarever = -1;
 	my_ies->calling_ton = -1;
 	my_ies->calling_tns = -1;
 	my_ies->calling_pres = -1;
 	my_ies->samprate = IAX_RATE_8KHZ;
-	while(datalen >= 2) {
+	while (datalen >= 2) {
 		ie = data[0];
 		len = data[1];
 		if (len > datalen - 2) {
 			errorf("Information element length exceeds message size\n");
 			return -1;
 		}
-		switch(ie) {
+		switch (ie) {
 		case IAX_IE_CALLED_NUMBER:
 			my_ies->called_number = (char *) data + 2;
 			break;
@@ -535,15 +538,15 @@
 			my_ies->password = (char *) data + 2;
 			break;
 		case IAX_IE_CAPABILITY:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
 				my_ies->capability = ntohl(get_uint32(data + 2));
 			break;
 		case IAX_IE_FORMAT:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
 				my_ies->format = ntohl(get_uint32(data + 2));
@@ -555,22 +558,22 @@
 			my_ies->codec_prefs = (char *) data + 2;
 			break;
 		case IAX_IE_VERSION:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp),  "Expecting version to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting version to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
 				my_ies->version = ntohs(get_uint16(data + 2));
 			break;
 		case IAX_IE_ADSICPE:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting adsicpe to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting adsicpe to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
 				my_ies->adsicpe = ntohs(get_uint16(data + 2));
 			break;
 		case IAX_IE_SAMPLINGRATE:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting samplingrate to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting samplingrate to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
 				my_ies->samprate = ntohs(get_uint16(data + 2));
@@ -582,8 +585,8 @@
 			my_ies->rdnis = (char *) data + 2;
 			break;
 		case IAX_IE_AUTHMETHODS:
-			if (len != (int)sizeof(unsigned short))  {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting authmethods to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting authmethods to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
 				my_ies->authmethods = ntohs(get_uint16(data + 2));
@@ -598,25 +601,25 @@
 			my_ies->rsa_result = (char *) data + 2;
 			break;
 		case IAX_IE_APPARENT_ADDR:
-			my_ies->apparent_addr = ((struct sockaddr_in *)(data + 2));
+			my_ies->apparent_addr = ((struct sockaddr_in *) (data + 2));
 			break;
 		case IAX_IE_REFRESH:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp),  "Expecting refresh to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting refresh to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
 				my_ies->refresh = ntohs(get_uint16(data + 2));
 			break;
 		case IAX_IE_DPSTATUS:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp),  "Expecting dpstatus to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting dpstatus to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
 				my_ies->dpstatus = ntohs(get_uint16(data + 2));
 			break;
 		case IAX_IE_CALLNO:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp),  "Expecting callno to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting callno to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
 				my_ies->callno = ntohs(get_uint16(data + 2));
@@ -626,7 +629,7 @@
 			break;
 		case IAX_IE_CAUSECODE:
 			if (len != 1) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting causecode to be single byte but was %d\n", len);
+				snprintf(tmp, (int) sizeof(tmp), "Expecting causecode to be single byte but was %d\n", len);
 				errorf(tmp);
 			} else {
 				my_ies->causecode = data[2];
@@ -636,16 +639,16 @@
 			if (len == 1)
 				my_ies->iax_unknown = data[2];
 			else {
-				snprintf(tmp, (int)sizeof(tmp), "Expected single byte Unknown command, but was %d long\n", len);
+				snprintf(tmp, (int) sizeof(tmp), "Expected single byte Unknown command, but was %d long\n", len);
 				errorf(tmp);
 			}
 			break;
 		case IAX_IE_MSGCOUNT:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting msgcount to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting msgcount to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				my_ies->msgcount = ntohs(get_uint16(data + 2));	
+				my_ies->msgcount = ntohs(get_uint16(data + 2));
 			break;
 		case IAX_IE_AUTOANSWER:
 			my_ies->autoanswer = 1;
@@ -654,25 +657,25 @@
 			my_ies->musiconhold = 1;
 			break;
 		case IAX_IE_TRANSFERID:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting transferid to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting transferid to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
 				my_ies->transferid = ntohl(get_uint32(data + 2));
 			break;
 		case IAX_IE_DATETIME:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting date/time to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting date/time to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
 				my_ies->datetime = ntohl(get_uint32(data + 2));
 			break;
 		case IAX_IE_FIRMWAREVER:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting firmwarever to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting firmwarever to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				my_ies->firmwarever = ntohs(get_uint16(data + 2));	
+				my_ies->firmwarever = ntohs(get_uint16(data + 2));
 			break;
 		case IAX_IE_DEVICETYPE:
 			my_ies->devicetype = (char *) data + 2;
@@ -681,19 +684,19 @@
 			my_ies->serviceident = (char *) data + 2;
 			break;
 		case IAX_IE_FWBLOCKDESC:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expected block desc to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expected block desc to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else
 				my_ies->fwdesc = ntohl(get_uint32(data + 2));
 			break;
 		case IAX_IE_FWBLOCKDATA:
 			my_ies->fwdata = data + 2;
-			my_ies->fwdatalen = (unsigned char)len;
+			my_ies->fwdatalen = (unsigned char) len;
 			break;
 		case IAX_IE_PROVVER:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expected provisioning version to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expected provisioning version to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else {
 				my_ies->provverpres = 1;
@@ -704,7 +707,7 @@
 			if (len == 1)
 				my_ies->calling_pres = data[2];
 			else {
-				snprintf(tmp, (int)sizeof(tmp), "Expected single byte callingpres, but was %d long\n", len);
+				snprintf(tmp, (int) sizeof(tmp), "Expected single byte callingpres, but was %d long\n", len);
 				errorf(tmp);
 			}
 			break;
@@ -712,67 +715,67 @@
 			if (len == 1)
 				my_ies->calling_ton = data[2];
 			else {
-				snprintf(tmp, (int)sizeof(tmp), "Expected single byte callington, but was %d long\n", len);
+				snprintf(tmp, (int) sizeof(tmp), "Expected single byte callington, but was %d long\n", len);
 				errorf(tmp);
 			}
 			break;
 		case IAX_IE_CALLINGTNS:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else
-				my_ies->calling_tns = ntohs(get_uint16(data + 2));	
+				my_ies->calling_tns = ntohs(get_uint16(data + 2));
 			break;
 		case IAX_IE_RR_JITTER:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expected jitter rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expected jitter rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else {
 				my_ies->rr_jitter = ntohl(get_uint32(data + 2));
 			}
 			break;
 		case IAX_IE_RR_LOSS:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else {
 				my_ies->rr_loss = ntohl(get_uint32(data + 2));
 			}
 			break;
 		case IAX_IE_RR_PKTS:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else {
 				my_ies->rr_pkts = ntohl(get_uint32(data + 2));
 			}
 			break;
 		case IAX_IE_RR_DELAY:
-			if (len != (int)sizeof(unsigned short)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+			if (len != (int) sizeof(unsigned short)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
 				errorf(tmp);
 			} else {
 				my_ies->rr_delay = ntohs(get_uint16(data + 2));
 			}
 			break;
 		case IAX_IE_RR_DROPPED:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else {
 				my_ies->rr_dropped = ntohl(get_uint32(data + 2));
 			}
 			break;
 		case IAX_IE_RR_OOO:
-			if (len != (int)sizeof(unsigned int)) {
-				snprintf(tmp, (int)sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+			if (len != (int) sizeof(unsigned int)) {
+				snprintf(tmp, (int) sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
 				errorf(tmp);
 			} else {
 				my_ies->rr_ooo = ntohl(get_uint32(data + 2));
 			}
 			break;
 		default:
-			snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
+			snprintf(tmp, (int) sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
 			outputf(tmp);
 		}
 		/* Overwrite information element with 0, to null terminate previous portion */
@@ -793,20 +796,20 @@
 {
 	fr->af.frametype = f->frametype;
 	fr->af.subclass = f->subclass;
-	fr->af.mallocd = 0;				/* Our frame is static relative to the container */
+	fr->af.mallocd = 0;			/* Our frame is static relative to the container */
 	fr->af.datalen = f->datalen;
 	fr->af.samples = f->samples;
 	fr->af.offset = AST_FRIENDLY_OFFSET;
 	fr->af.src = f->src;
 	fr->af.data = fr->afdata;
-	if (fr->af.datalen) 
+	if (fr->af.datalen)
 		memcpy(fr->af.data, f->data, fr->af.datalen);
 }
 
 struct iax_frame *iax_frame_new(int direction, int datalen)
 {
 	struct iax_frame *fr;
-	fr = malloc((int)sizeof(struct iax_frame) + datalen);
+	fr = malloc((int) sizeof(struct iax_frame) + datalen);
 	if (fr) {
 		fr->direction = direction;
 		fr->retrans = -1;
@@ -835,6 +838,15 @@
 	frame_count--;
 }
 
-int iax_get_frames(void) { return frame_count; }
-int iax_get_iframes(void) { return iframes; }
-int iax_get_oframes(void) { return oframes; }
+int iax_get_frames(void)
+{
+	return frame_count;
+}
+int iax_get_iframes(void)
+{
+	return iframes;
+}
+int iax_get_oframes(void)
+{
+	return oframes;
+}

Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/jitterbuf.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/jitterbuf.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/jitterbuf.c	Tue May 27 00:54:52 2008
@@ -32,9 +32,9 @@
 #define jb_dbg if (dbgf) dbgf
 
 #ifdef DEEP_DEBUG
-  #define jb_dbg2 if (dbgf) dbgf
+#define jb_dbg2 if (dbgf) dbgf
 #else
-  #define jb_dbg2 if (0) dbgf
+#define jb_dbg2 if (0) dbgf
 #endif
 
 #else
@@ -60,17 +60,17 @@
 	dbgf = dbg;
 }
 
-static void increment_losspct(jitterbuf *jb)
+static void increment_losspct(jitterbuf * jb)
 {
-	jb->info.losspct = (100000 + 499 * jb->info.losspct)/500;
+	jb->info.losspct = (100000 + 499 * jb->info.losspct) / 500;
 }
 
-static void decrement_losspct(jitterbuf *jb)
+static void decrement_losspct(jitterbuf * jb)
 {
-	jb->info.losspct = (499 * jb->info.losspct)/500;
+	jb->info.losspct = (499 * jb->info.losspct) / 500;
 }
 
-void jb_reset(jitterbuf *jb)
+void jb_reset(jitterbuf * jb)
 {
 	/* only save settings */
 	jb_conf s = jb->info.conf;
@@ -82,11 +82,12 @@
 	jb->info.silence_begin_ts = -1;
 }
 
-jitterbuf * jb_new()
+jitterbuf *jb_new()
 {
-	jitterbuf *jb = (jitterbuf *)malloc(sizeof(*jb));
+	jitterbuf *jb = (jitterbuf *) malloc(sizeof(*jb));
 
-	if (!jb) return NULL;
+	if (!jb)
+		return NULL;
 
 	jb->info.conf.target_extra = JB_TARGET_EXTRA;
 
@@ -95,7 +96,7 @@
 	return jb;
 }
 
-void jb_destroy(jitterbuf *jb)
+void jb_destroy(jitterbuf * jb)
 {
 	jb_frame *frame;
 
@@ -116,7 +117,7 @@
 #if 0
 static int longcmp(const void *a, const void *b)
 {
-	return *(long *)a - *(long *)b;
+	return *(long *) a - *(long *) b;
 }
 #endif
 
@@ -124,7 +125,7 @@
 /* maybe later we can make the history buckets variable size, or something? */
 /* drop parameter determines whether we will drop outliers to minimize
  * delay */
-static int history_put(jitterbuf *jb, time_in_ms_t ts, time_in_ms_t now)
+static int history_put(jitterbuf * jb, time_in_ms_t ts, time_in_ms_t now)
 {
 	time_in_ms_t delay = now - (ts - jb->info.resync_offset);
 	time_in_ms_t threshold = 2 * jb->info.jitter + jb->info.conf.resync_threshold;
@@ -144,9 +145,10 @@
 				jb->hist_ptr = 0;
 				jb->hist_maxbuf_valid = 0;
 
-				jb_warn("Resyncing the jb. last_delay %ld, this delay %ld, threshold %ld, new offset %ld\n", jb->info.last_delay, delay, threshold, ts - now);
+				jb_warn("Resyncing the jb. last_delay %ld, this delay %ld, threshold %ld, new offset %ld\n", jb->info.last_delay, delay, threshold,
+						ts - now);
 				jb->info.resync_offset = ts - now;
-				jb->info.last_delay = delay = 0; /* after resync, frame is right on time */
+				jb->info.last_delay = delay = 0;	/* after resync, frame is right on time */
 			} else {
 				return -1;
 			}
@@ -176,18 +178,18 @@
 		goto invalidate;
 
 	/* if the new delay would go into min */
-	if (delay < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1])
+	if (delay < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ - 1])
 		goto invalidate;
 
 	/* or max.. */
-	if (delay > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1])
+	if (delay > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ - 1])
 		goto invalidate;
 
 	/* or the kicked delay would be in min */
-	if (kicked <= jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1])
+	if (kicked <= jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ - 1])
 		goto invalidate;
 
-	if (kicked >= jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1])
+	if (kicked >= jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ - 1])
 		goto invalidate;
 
 	/* if we got here, we don't need to invalidate, 'cause this delay didn't
@@ -196,21 +198,21 @@
 	/* end optimization */
 
 
-invalidate:
+  invalidate:
 	jb->hist_maxbuf_valid = 0;
 	return 0;
 }
 
-static void history_calc_maxbuf(jitterbuf *jb)
+static void history_calc_maxbuf(jitterbuf * jb)
 {
-	int i,j;
+	int i, j;
 
 	if (jb->hist_ptr == 0)
 		return;
 
 
 	/* initialize maxbuf/minbuf to the latest value */
-	for (i=0;i<JB_HISTORY_MAXBUF_SZ;i++) {
+	for (i = 0; i < JB_HISTORY_MAXBUF_SZ; i++) {
 		/*
 		 * jb->hist_maxbuf[i] = jb->history[(jb->hist_ptr-1) % JB_HISTORY_SZ];
 		 * jb->hist_minbuf[i] = jb->history[(jb->hist_ptr-1) % JB_HISTORY_SZ];
@@ -225,14 +227,14 @@
 	/* start at the beginning, or JB_HISTORY_SZ frames ago */
 	i = (jb->hist_ptr > JB_HISTORY_SZ) ? (jb->hist_ptr - JB_HISTORY_SZ) : 0;
 
-	for (;i<jb->hist_ptr;i++) {
-	time_in_ms_t toins = jb->history[i % JB_HISTORY_SZ];
+	for (; i < jb->hist_ptr; i++) {
+		time_in_ms_t toins = jb->history[i % JB_HISTORY_SZ];
 
 		/* if the maxbuf should get this */
-		if (toins > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1])  {
+		if (toins > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ - 1]) {
 
 			/* insertion-sort it into the maxbuf */
-			for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) {
+			for (j = 0; j < JB_HISTORY_MAXBUF_SZ; j++) {
 				/* found where it fits */
 				if (toins > jb->hist_maxbuf[j]) {
 					/* move over */
@@ -246,10 +248,10 @@
 		}
 
 		/* if the minbuf should get this */
-		if (toins < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1])  {
+		if (toins < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ - 1]) {
 
 			/* insertion-sort it into the maxbuf */
-			for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) {
+			for (j = 0; j < JB_HISTORY_MAXBUF_SZ; j++) {
 				/* found where it fits */
 				if (toins < jb->hist_minbuf[j]) {
 					/* move over */
@@ -261,15 +263,14 @@
 				}
 			}
 		}
-
 #if 0
 		int k;
 		fprintf(stderr, "toins = %ld\n", toins);
 		fprintf(stderr, "maxbuf =");
-		for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
+		for (k = 0; k < JB_HISTORY_MAXBUF_SZ; k++)
 			fprintf(stderr, "%ld ", jb->hist_maxbuf[k]);
 		fprintf(stderr, "\nminbuf =");
-		for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
+		for (k = 0; k < JB_HISTORY_MAXBUF_SZ; k++)
 			fprintf(stderr, "%ld ", jb->hist_minbuf[k]);
 		fprintf(stderr, "\n");
 #endif
@@ -278,9 +279,9 @@
 	jb->hist_maxbuf_valid = 1;
 }
 
-static void history_get(jitterbuf *jb)
+static void history_get(jitterbuf * jb)
 {
-    time_in_ms_t max, min, jitter;
+	time_in_ms_t max, min, jitter;
 	int index;
 	int count;
 
@@ -312,16 +313,16 @@
 	/* these debug stmts compare the difference between looking at the absolute jitter, and the
 	 * values we get by throwing away the outliers */
 	/*
-	fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", index, min, max, jitter);
-	fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", 0, jb->hist_minbuf[0], jb->hist_maxbuf[0], jb->hist_maxbuf[0]-jb->hist_minbuf[0]);
-	*/
+	   fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", index, min, max, jitter);
+	   fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", 0, jb->hist_minbuf[0], jb->hist_maxbuf[0], jb->hist_maxbuf[0]-jb->hist_minbuf[0]);
+	 */
 
 	jb->info.min = min;
 	jb->info.jitter = jitter;
 }
 
 /* returns 1 if frame was inserted into head of queue, 0 otherwise */
-static int queue_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, time_in_ms_t ts)
+static int queue_put(jitterbuf * jb, void *data, const enum jb_frame_type type, long ms, time_in_ms_t ts)
 {
 	jb_frame *frame = jb->free;
 	jb_frame *p;
@@ -331,7 +332,7 @@
 	if (frame) {
 		jb->free = frame->next;
 	} else {
-		frame = (jb_frame *)malloc(sizeof(*frame));
+		frame = (jb_frame *) malloc(sizeof(*frame));
 		if (!frame) {
 			jb_err("cannot allocate frame\n");
 			return 0;
@@ -350,7 +351,7 @@
 	 * jb->frames->prev points to the highest ts
 	 */
 
-	if (!jb->frames) {  /* queue is empty */
+	if (!jb->frames) {			/* queue is empty */
 		jb->frames = frame;
 		frame->next = frame;
 		frame->prev = frame;
@@ -371,7 +372,8 @@
 		p = jb->frames;
 
 		/* frame is out of order */
-		if (resync_ts < p->prev->ts) jb->info.frames_ooo++;
+		if (resync_ts < p->prev->ts)
+			jb->info.frames_ooo++;
 
 		while (resync_ts < p->prev->ts && p->prev != jb->frames)
 			p = p->prev;
@@ -385,7 +387,7 @@
 	return head;
 }
 
-static time_in_ms_t queue_next(jitterbuf *jb) 
+static time_in_ms_t queue_next(jitterbuf * jb)
 {
 	if (jb->frames)
 		return jb->frames->ts;
@@ -393,7 +395,7 @@
 		return -1;
 }
 
-static time_in_ms_t queue_last(jitterbuf *jb) 
+static time_in_ms_t queue_last(jitterbuf * jb)
 {
 	if (jb->frames)
 		return jb->frames->prev->ts;
@@ -401,7 +403,7 @@
 		return -1;
 }
 
-static jb_frame *_queue_get(jitterbuf *jb, time_in_ms_t ts, int all) 
+static jb_frame *_queue_get(jitterbuf * jb, time_in_ms_t ts, int all)
 {
 	jb_frame *frame;
 	frame = jb->frames;
@@ -436,46 +438,41 @@
 	return NULL;
 }
 
-static jb_frame *queue_get(jitterbuf *jb, time_in_ms_t ts) 
+static jb_frame *queue_get(jitterbuf * jb, time_in_ms_t ts)
 {
-	return _queue_get(jb,ts,0);
+	return _queue_get(jb, ts, 0);
 }
 
-static jb_frame *queue_getall(jitterbuf *jb)
+static jb_frame *queue_getall(jitterbuf * jb)
 {
-	return _queue_get(jb,0,1);
+	return _queue_get(jb, 0, 1);
 }
 
 #if 0
 /* some diagnostics */
-static void jb_dbginfo(jitterbuf *jb)
+static void jb_dbginfo(jitterbuf * jb)
 {
 	if (dbgf == NULL)
 		return;
 
 	jb_dbg("\njb info: fin=%ld fout=%ld flate=%ld flost=%ld fdrop=%ld fcur=%ld\n",
-		jb->info.frames_in, jb->info.frames_out, jb->info.frames_late, jb->info.frames_lost, jb->info.frames_dropped, jb->info.frames_cur);
+		   jb->info.frames_in, jb->info.frames_out, jb->info.frames_late, jb->info.frames_lost, jb->info.frames_dropped, jb->info.frames_cur);
 
 	jb_dbg("jitter=%ld current=%ld target=%ld min=%ld sil=%d len=%d len/fcur=%ld\n",
-		jb->info.jitter, jb->info.current, jb->info.target, jb->info.min, jb->info.silence_begin_ts, jb->info.current - jb->info.min,
-		jb->info.frames_cur ? (jb->info.current - jb->info.min)/jb->info.frames_cur : -8);
+		   jb->info.jitter, jb->info.current, jb->info.target, jb->info.min, jb->info.silence_begin_ts, jb->info.current - jb->info.min,
+		   jb->info.frames_cur ? (jb->info.current - jb->info.min) / jb->info.frames_cur : -8);
 	if (jb->info.frames_in > 0)
 		jb_dbg("jb info: Loss PCT = %ld%%, Late PCT = %ld%%\n",
-		jb->info.frames_lost * 100/(jb->info.frames_in + jb->info.frames_lost),
-		jb->info.frames_late * 100/jb->info.frames_in);
+			   jb->info.frames_lost * 100 / (jb->info.frames_in + jb->info.frames_lost), jb->info.frames_late * 100 / jb->info.frames_in);
 	jb_dbg("jb info: queue %d -> %d.  last_ts %d (queue len: %d) last_ms %d\n",
-		queue_next(jb),
-		queue_last(jb),
-		jb->info.next_voice_ts,
-		queue_last(jb) - queue_next(jb),
-		jb->info.last_voice_ms);
+		   queue_next(jb), queue_last(jb), jb->info.next_voice_ts, queue_last(jb) - queue_next(jb), jb->info.last_voice_ms);
 }
 #endif
 
 #ifdef DEEP_DEBUG
-static void jb_chkqueue(jitterbuf *jb)
+static void jb_chkqueue(jitterbuf * jb)
 {
-	int i=0;
+	int i = 0;
 	jb_frame *p = jb->frames;
 
 	if (!p) {
@@ -483,17 +480,17 @@
 	}
 
 	do {
-		if (p->next == NULL)  {
+		if (p->next == NULL) {
 			jb_err("Queue is BROKEN at item [%d]", i);
 		}
 		i++;
-		p=p->next;
+		p = p->next;
 	} while (p->next != jb->frames);
 }
 
-static void jb_dbgqueue(jitterbuf *jb)
+static void jb_dbgqueue(jitterbuf * jb)
 {
-	int i=0;
+	int i = 0;
 	jb_frame *p = jb->frames;
 
 	jb_dbg("queue: ");
@@ -505,14 +502,14 @@
 
 	do {
 		jb_dbg("[%d]=%ld ", i++, p->ts);
-		p=p->next;
+		p = p->next;
 	} while (p->next != jb->frames);
 
 	jb_dbg("\n");
 }
 #endif
 
-enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, time_in_ms_t ts, time_in_ms_t now)
+enum jb_return_code jb_put(jitterbuf * jb, void *data, const enum jb_frame_type type, long ms, time_in_ms_t ts, time_in_ms_t now)
 {
 	jb->info.frames_in++;
 
@@ -522,12 +519,12 @@
 		 * sending retransmitted control frames with their awkward
 		 * timestamps through
 		 */
-		if (history_put(jb,ts,now))
+		if (history_put(jb, ts, now))
 			return JB_DROP;
 	}
 
 	/* if put into head of queue, caller needs to reschedule */
-	if (queue_put(jb,data,type,ms,ts)) {
+	if (queue_put(jb, data, type, ms, ts)) {
 		return JB_SCHED;
 	}
 
@@ -535,7 +532,7 @@
 }
 
 
-static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, time_in_ms_t now, long interpl)
+static enum jb_return_code _jb_get(jitterbuf * jb, jb_frame * frameout, time_in_ms_t now, long interpl)
 {
 	jb_frame *frame;
 	time_in_ms_t diff;
@@ -557,7 +554,7 @@
 	diff = jb->info.target - jb->info.current;
 
 	/* jb_warn("diff = %d lms=%d last = %d now = %d\n", diff,  */
-	/*	jb->info.last_voice_ms, jb->info.last_adjustment, now); */
+	/*  jb->info.last_voice_ms, jb->info.last_adjustment, now); */
 
 	/* let's work on non-silent case first */
 	if (!jb->info.silence_begin_ts) {
@@ -565,8 +562,8 @@
 		if ((diff > 0) &&
 			/* we haven't grown in the delay length */
 			(((jb->info.last_adjustment + JB_ADJUST_DELAY) < now) ||
-			/* we need to grow more than the "length" we have left */
-			(diff > queue_last(jb) - queue_next(jb)) ) ) {
+			 /* we need to grow more than the "length" we have left */
+			 (diff > queue_last(jb) - queue_next(jb)))) {
 			/* grow by interp frame length */
 			jb->info.current += interpl;
 			jb->info.next_voice_ts += interpl;
@@ -619,7 +616,7 @@
 				jb->info.frames_lost--;
 				jb_dbg("l");
 				/*jb_warn("\nlate: wanted=%ld, this=%ld, next=%ld\n", jb->info.next_voice_ts - jb->info.current, frame->ts, queue_next(jb));
-				  jb_warninfo(jb); */
+				   jb_warninfo(jb); */
 				return JB_DROP;
 			}
 		}
@@ -633,9 +630,7 @@
 		/* unless we don't have a frame, then shrink 1 frame */
 		/* every 80ms (though perhaps we can shrink even faster */
 		/* in this case) */
-		if (diff < -jb->info.conf.target_extra &&
-				((!frame && jb->info.last_adjustment + 80 < now) ||
-				 (jb->info.last_adjustment + 500 < now))) {
+		if (diff < -jb->info.conf.target_extra && ((!frame && jb->info.last_adjustment + 80 < now) || (jb->info.last_adjustment + 500 < now))) {
 
 			jb->info.last_adjustment = now;
 			jb->info.cnt_contig_interp = 0;
@@ -677,11 +672,11 @@
 			 * lost frame get interpolated two or more times, when there was "room" to grow, so it might
 			 * be a bit of a bad idea overall */
 			/*if (diff > -1 * jb->info.last_voice_ms) {
-				jb->info.current += jb->info.last_voice_ms;
-				jb->info.last_adjustment = now;
-				jb_warn("g");
-				return JB_INTERP;
-			} */
+			   jb->info.current += jb->info.last_voice_ms;
+			   jb->info.last_adjustment = now;
+			   jb_warn("g");
+			   return JB_INTERP;
+			   } */
 			jb->info.frames_lost++;
 			increment_losspct(jb);
 			jb->info.next_voice_ts += interpl;
@@ -712,8 +707,7 @@
 		/* jb->info.silence_begin_ts = 0; */
 
 		/* shrink interpl len every 10ms during silence */
-		if (diff < -jb->info.conf.target_extra &&
-			jb->info.last_adjustment + 10 <= now) {
+		if (diff < -jb->info.conf.target_extra && jb->info.last_adjustment + 10 <= now) {
 			jb->info.current -= interpl;
 			jb->info.last_adjustment = now;
 		}
@@ -736,7 +730,7 @@
 			jb->info.frames_lost--;
 			jb_dbg("l");
 			/*jb_warn("\nlate: wanted=%ld, this=%ld, next=%ld\n", jb->info.next_voice_ts - jb->info.current, frame->ts, queue_next(jb));
-			  jb_warninfo(jb); */
+			   jb_warninfo(jb); */
 			return JB_DROP;
 		} else {
 			/* voice frame */
@@ -754,7 +748,7 @@
 	}
 }
 
-time_in_ms_t jb_next(jitterbuf *jb)
+time_in_ms_t jb_next(jitterbuf * jb)
 {
 	if (jb->info.silence_begin_ts) {
 		if (jb->frames) {
@@ -764,28 +758,28 @@
 			if (jb->info.target - jb->info.current < -jb->info.conf.target_extra)
 				return jb->info.last_adjustment + 10;
 			return next + jb->info.target;
-		}
-		else
+		} else
 			return JB_LONGMAX;
 	} else {
 		return jb->info.next_voice_ts;
 	}
 }
 
-enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frameout, time_in_ms_t now, long interpl)
+enum jb_return_code jb_get(jitterbuf * jb, jb_frame * frameout, time_in_ms_t now, long interpl)
 {
 	enum jb_return_code ret = _jb_get(jb, frameout, now, interpl);
 #if 0
-	static int lastts=0;
+	static int lastts = 0;
 	int thists = ((ret == JB_OK) || (ret == JB_DROP)) ? frameout->ts : 0;
 	jb_warn("jb_get(%x,%x,%ld) = %d (%d)\n", jb, frameout, now, ret, thists);
-	if (thists && thists < lastts) jb_warn("XXXX timestamp roll-back!!!\n");
+	if (thists && thists < lastts)
+		jb_warn("XXXX timestamp roll-back!!!\n");
 	lastts = thists;
 #endif
 	return ret;
 }
 
-enum jb_return_code jb_getall(jitterbuf *jb, jb_frame *frameout)
+enum jb_return_code jb_getall(jitterbuf * jb, jb_frame * frameout)
 {
 	jb_frame *frame;
 	frame = queue_getall(jb);
@@ -799,7 +793,7 @@
 }
 
 
-enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats)
+enum jb_return_code jb_getinfo(jitterbuf * jb, jb_info * stats)
 {
 	history_get(jb);
 
@@ -808,7 +802,7 @@
 	return JB_OK;
 }
 
-enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf)
+enum jb_return_code jb_setconf(jitterbuf * jb, jb_conf * conf)
 {
 	/* take selected settings from the struct */
 
@@ -817,10 +811,8 @@
 	jb->info.conf.max_contig_interp = conf->max_contig_interp;
 
 	/* -1 indicates use of the default JB_TARGET_EXTRA value */
-	jb->info.conf.target_extra = ( conf->target_extra == -1 )
-		? JB_TARGET_EXTRA
-		: conf->target_extra
-		;
+	jb->info.conf.target_extra = (conf->target_extra == -1)
+		? JB_TARGET_EXTRA : conf->target_extra;
 
 	/* update these to match new target_extra setting */
 	jb->info.current = jb->info.conf.target_extra;
@@ -828,5 +820,3 @@
 
 	return JB_OK;
 }
-
-

Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/md5.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/md5.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/md5.c	Tue May 27 00:54:52 2008
@@ -3,13 +3,13 @@
 
 #ifdef FREEBSD
 # include <machine/endian.h>
-#elif defined(LINUX)  
+#elif defined(LINUX)
 # include <endian.h>
 # include <features.h>
 # include <sys/types.h>
 #elif defined(SOLARIS)
   /* each solaris is different -- this won't work on 2.6 or 2.7 */
-# include <sys/isa_defs.h> /* Defines either _LITTLE_ENDIAN or _BIG_ENDIAN */
+# include <sys/isa_defs.h>		/* Defines either _LITTLE_ENDIAN or _BIG_ENDIAN */
 #  define __BIG_ENDIAN		4321
 #  define __LITTLE_ENDIAN	1234
 #  define BIG_ENDIAN		4321
@@ -59,7 +59,7 @@
  * needed on buffers full of bytes, and then call MD5Final, which
  * will fill a supplied 16-byte array with the digest.
  */
-#include <string.h>		/* for memcpy() */
+#include <string.h>				/* for memcpy() */
 #include "md5.h"
 
 #ifndef HIGHFIRST
@@ -73,13 +73,12 @@
  */
 void byteReverse(unsigned char *buf, unsigned longs)
 {
-    uint32 t;
-    do {
-	t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
-	    ((unsigned) buf[1] << 8 | buf[0]);
-	*(uint32 *) buf = t;
-	buf += 4;
-    } while (--longs);
+	uint32 t;
+	do {
+		t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | ((unsigned) buf[1] << 8 | buf[0]);
+		*(uint32 *) buf = t;
+		buf += 4;
+	} while (--longs);
 }
 #endif
 #endif
@@ -90,13 +89,13 @@
  */
 void MD5Init(struct MD5Context *ctx)
 {
-    ctx->buf[0] = 0x67452301;
-    ctx->buf[1] = 0xefcdab89;
-    ctx->buf[2] = 0x98badcfe;
-    ctx->buf[3] = 0x10325476;
+	ctx->buf[0] = 0x67452301;
+	ctx->buf[1] = 0xefcdab89;
+	ctx->buf[2] = 0x98badcfe;
+	ctx->buf[3] = 0x10325476;
 
-    ctx->bits[0] = 0;
-    ctx->bits[1] = 0;
+	ctx->bits[0] = 0;
+	ctx->bits[1] = 0;
 }
 
 /*
@@ -105,46 +104,46 @@
  */
 void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
 {
-    uint32 t;
+	uint32 t;
 
-    /* Update bitcount */
+	/* Update bitcount */
 
-    t = ctx->bits[0];
-    if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
-	ctx->bits[1]++;		/* Carry from low to high */
-    ctx->bits[1] += len >> 29;
-
-    t = (t >> 3) & 0x3f;	/* Bytes already in shsInfo->data */
-
-    /* Handle any leading odd-sized chunks */
-
-    if (t) {
-	unsigned char *p = (unsigned char *) ctx->in + t;
+	t = ctx->bits[0];
+	if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
+		ctx->bits[1]++;			/* Carry from low to high */
+	ctx->bits[1] += len >> 29;
+
+	t = (t >> 3) & 0x3f;		/* Bytes already in shsInfo->data */
+
+	/* Handle any leading odd-sized chunks */
+
+	if (t) {
+		unsigned char *p = (unsigned char *) ctx->in + t;
+
+		t = 64 - t;
+		if (len < t) {
+			memcpy(p, buf, len);
+			return;
+		}
+		memcpy(p, buf, t);
+		byteReverse(ctx->in, 16);
+		MD5Transform(ctx->buf, (uint32 *) ctx->in);
+		buf += t;
+		len -= t;
+	}
+	/* Process data in 64-byte chunks */
 
-	t = 64 - t;
-	if (len < t) {
-	    memcpy(p, buf, len);
-	    return;
+	while (len >= 64) {
+		memcpy(ctx->in, buf, 64);
+		byteReverse(ctx->in, 16);
+		MD5Transform(ctx->buf, (uint32 *) ctx->in);
+		buf += 64;
+		len -= 64;
 	}
-	memcpy(p, buf, t);
-	byteReverse(ctx->in, 16);
-	MD5Transform(ctx->buf, (uint32 *) ctx->in);
-	buf += t;
-	len -= t;
-    }
-    /* Process data in 64-byte chunks */
-
-    while (len >= 64) {
-	memcpy(ctx->in, buf, 64);
-	byteReverse(ctx->in, 16);
-	MD5Transform(ctx->buf, (uint32 *) ctx->in);
-	buf += 64;
-	len -= 64;
-    }
 
-    /* Handle any remaining bytes of data. */
+	/* Handle any remaining bytes of data. */
 
-    memcpy(ctx->in, buf, len);
+	memcpy(ctx->in, buf, len);
 }
 
 /*
@@ -153,43 +152,43 @@
  */
 void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
 {
-    unsigned count;
-    unsigned char *p;
+	unsigned count;
+	unsigned char *p;
 
-    /* Compute number of bytes mod 64 */
-    count = (ctx->bits[0] >> 3) & 0x3F;
+	/* Compute number of bytes mod 64 */
+	count = (ctx->bits[0] >> 3) & 0x3F;
 
-    /* Set the first char of padding to 0x80.  This is safe since there is
-       always at least one byte free */
-    p = ctx->in + count;
-    *p++ = 0x80;
-
-    /* Bytes of padding needed to make 64 bytes */
-    count = 64 - 1 - count;
-
-    /* Pad out to 56 mod 64 */
-    if (count < 8) {
-	/* Two lots of padding:  Pad the first block to 64 bytes */
-	memset(p, 0, count);
-	byteReverse(ctx->in, 16);
-	MD5Transform(ctx->buf, (uint32 *) ctx->in);
+	/* Set the first char of padding to 0x80.  This is safe since there is
+	   always at least one byte free */
+	p = ctx->in + count;
+	*p++ = 0x80;
+
+	/* Bytes of padding needed to make 64 bytes */
+	count = 64 - 1 - count;
+
+	/* Pad out to 56 mod 64 */
+	if (count < 8) {
+		/* Two lots of padding:  Pad the first block to 64 bytes */
+		memset(p, 0, count);
+		byteReverse(ctx->in, 16);
+		MD5Transform(ctx->buf, (uint32 *) ctx->in);
+
+		/* Now fill the next block with 56 bytes */
+		memset(ctx->in, 0, 56);
+	} else {
+		/* Pad block to 56 bytes */
+		memset(p, 0, count - 8);
+	}
+	byteReverse(ctx->in, 14);
 
-	/* Now fill the next block with 56 bytes */
-	memset(ctx->in, 0, 56);
-    } else {
-	/* Pad block to 56 bytes */
-	memset(p, 0, count - 8);
-    }
-    byteReverse(ctx->in, 14);
-
-    /* Append length in bits and transform */
-    ((uint32 *) ctx->in)[14] = ctx->bits[0];
-    ((uint32 *) ctx->in)[15] = ctx->bits[1];
-
-    MD5Transform(ctx->buf, (uint32 *) ctx->in);
-    byteReverse((unsigned char *) ctx->buf, 4);
-    memcpy(digest, ctx->buf, 16);
-    memset(ctx, 0, sizeof(ctx));	/* In case it's sensitive */
+	/* Append length in bits and transform */
+	((uint32 *) ctx->in)[14] = ctx->bits[0];
+	((uint32 *) ctx->in)[15] = ctx->bits[1];
+
+	MD5Transform(ctx->buf, (uint32 *) ctx->in);
+	byteReverse((unsigned char *) ctx->buf, 4);
+	memcpy(digest, ctx->buf, 16);
+	memset(ctx, 0, sizeof(ctx));	/* In case it's sensitive */
 }
 
 #ifndef ASM_MD5
@@ -213,85 +212,85 @@
  */
 void MD5Transform(uint32 buf[4], uint32 const in[16])
 {
-    register uint32 a, b, c, d;
+	register uint32 a, b, c, d;
 
-    a = buf[0];
-    b = buf[1];
-    c = buf[2];
-    d = buf[3];
-
-    MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
-    MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
-    MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
-    MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
-    MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
-    MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
-    MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
-    MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
-    MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
-    MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
-    MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
-    MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
-    MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
-    MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
-    MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
-    MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
-    MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
-    MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
-    MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
-    MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
-    MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
-    MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
-    MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
-    MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
-    MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
-    MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
-    MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
-    MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
-    MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
-    MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
-    MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
-    MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
-    MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
-    MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
-    MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
-    MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
-    MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
-    MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
-    MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
-    MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
-    MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
-    MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
-    MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
-    MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
-    MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
-    MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
-    MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
-    MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
-    MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
-    MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
-    MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
-    MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
-    MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
-    MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
-    MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
-    MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
-    MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
-    MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
-    MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
-    MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
-    MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
-    MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
-    MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
-    MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
-    buf[0] += a;
-    buf[1] += b;
-    buf[2] += c;
-    buf[3] += d;
+	a = buf[0];
+	b = buf[1];
+	c = buf[2];
+	d = buf[3];
+
+	MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
+	MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
+	MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
+	MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
+	MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
+	MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
+	MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
+	MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
+	MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
+	MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
+	MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
+	MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
+	MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
+	MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
+	MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
+	MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
+
+	MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
+	MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
+	MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
+	MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
+	MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
+	MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
+	MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
+	MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
+	MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
+	MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
+	MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
+	MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
+	MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
+	MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
+	MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
+	MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
+
+	MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
+	MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
+	MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
+	MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
+	MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
+	MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
+	MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
+	MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
+	MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
+	MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
+	MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
+	MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
+	MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
+	MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
+	MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
+	MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
+
+	MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
+	MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
+	MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
+	MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
+	MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
+	MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
+	MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
+	MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
+	MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
+	MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
+	MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
+	MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
+	MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
+	MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
+	MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
+	MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
+
+	buf[0] += a;
+	buf[1] += b;
+	buf[2] += c;
+	buf[3] += d;
 }
 
 #endif

Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c	Tue May 27 00:54:52 2008
@@ -110,14 +110,14 @@
 
 
 static char *IAXNAMES[] = { "IAX_EVENT_CONNECT", "IAX_EVENT_ACCEPT", "IAX_EVENT_HANGUP", "IAX_EVENT_REJECT", "IAX_EVENT_VOICE",
-							"IAX_EVENT_DTMF", "IAX_EVENT_TIMEOUT", "IAX_EVENT_LAGRQ", "IAX_EVENT_LAGRP", "IAX_EVENT_RINGA",
-							"IAX_EVENT_PING", "IAX_EVENT_PONG", "IAX_EVENT_BUSY", "IAX_EVENT_ANSWER", "IAX_EVENT_IMAGE",
-							"IAX_EVENT_AUTHRQ", "IAX_EVENT_AUTHRP", "IAX_EVENT_REGREQ", "IAX_EVENT_REGACK",
-							"IAX_EVENT_URL", "IAX_EVENT_LDCOMPLETE", "IAX_EVENT_TRANSFER", "IAX_EVENT_DPREQ",
-							"IAX_EVENT_DPREP", "IAX_EVENT_DIAL", "IAX_EVENT_QUELCH", "IAX_EVENT_UNQUELCH",
-							"IAX_EVENT_UNLINK", "IAX_EVENT_LINKREJECT", "IAX_EVENT_TEXT", "IAX_EVENT_REGREJ",
-							"IAX_EVENT_LINKURL", "IAX_EVENT_CNG", "IAX_EVENT_REREQUEST", "IAX_EVENT_TXREPLY",
-							"IAX_EVENT_TXREJECT", "IAX_EVENT_TXACCEPT", "IAX_EVENT_TXREADY"
+	"IAX_EVENT_DTMF", "IAX_EVENT_TIMEOUT", "IAX_EVENT_LAGRQ", "IAX_EVENT_LAGRP", "IAX_EVENT_RINGA",
+	"IAX_EVENT_PING", "IAX_EVENT_PONG", "IAX_EVENT_BUSY", "IAX_EVENT_ANSWER", "IAX_EVENT_IMAGE",
+	"IAX_EVENT_AUTHRQ", "IAX_EVENT_AUTHRP", "IAX_EVENT_REGREQ", "IAX_EVENT_REGACK",
+	"IAX_EVENT_URL", "IAX_EVENT_LDCOMPLETE", "IAX_EVENT_TRANSFER", "IAX_EVENT_DPREQ",
+	"IAX_EVENT_DPREP", "IAX_EVENT_DIAL", "IAX_EVENT_QUELCH", "IAX_EVENT_UNQUELCH",
+	"IAX_EVENT_UNLINK", "IAX_EVENT_LINKREJECT", "IAX_EVENT_TEXT", "IAX_EVENT_REGREJ",
+	"IAX_EVENT_LINKURL", "IAX_EVENT_CNG", "IAX_EVENT_REREQUEST", "IAX_EVENT_TXREPLY",
+	"IAX_EVENT_TXREJECT", "IAX_EVENT_TXACCEPT", "IAX_EVENT_TXREADY"
 };
 
 
@@ -129,24 +129,24 @@
 
 //999 means it's wrong nad i dont know the real one 
 static struct ast_iana AST_IANA[] = { {AST_FORMAT_G723_1, 4, "g723.1"},
-									  {AST_FORMAT_GSM, 3, "gsm"},
-									  {AST_FORMAT_ULAW, 0, "ulaw"},
-									  {AST_FORMAT_ALAW, 8, "alaw"},
-									  {AST_FORMAT_G726, 999, "g726"},
-									  {AST_FORMAT_ADPCM, 999, "adpcm"},
-									  {AST_FORMAT_SLINEAR, 10, "slinear"},
-									  {AST_FORMAT_LPC10, 7, "lpc10"},
-									  {AST_FORMAT_G729A, 18, "g729"},
-									  {AST_FORMAT_SPEEX, 97, "speex"},
-									  {AST_FORMAT_SPEEX, 98, "speex"},
-									  {AST_FORMAT_ILBC, 102, "ilbc"},
-									  {AST_FORMAT_MAX_AUDIO, 999, ""},
-									  {AST_FORMAT_JPEG, 999, ""},
-									  {AST_FORMAT_PNG, 999, ""},
-									  {AST_FORMAT_H261, 999, ""},
-									  {AST_FORMAT_H263, 999, ""},
-									  {AST_FORMAT_MAX_VIDEO, 999, ""},
-									  {0, 0}
+{AST_FORMAT_GSM, 3, "gsm"},
+{AST_FORMAT_ULAW, 0, "ulaw"},
+{AST_FORMAT_ALAW, 8, "alaw"},
+{AST_FORMAT_G726, 999, "g726"},
+{AST_FORMAT_ADPCM, 999, "adpcm"},
+{AST_FORMAT_SLINEAR, 10, "slinear"},
+{AST_FORMAT_LPC10, 7, "lpc10"},
+{AST_FORMAT_G729A, 18, "g729"},
+{AST_FORMAT_SPEEX, 97, "speex"},
+{AST_FORMAT_SPEEX, 98, "speex"},
+{AST_FORMAT_ILBC, 102, "ilbc"},
+{AST_FORMAT_MAX_AUDIO, 999, ""},
+{AST_FORMAT_JPEG, 999, ""},
+{AST_FORMAT_PNG, 999, ""},
+{AST_FORMAT_H261, 999, ""},
+{AST_FORMAT_H263, 999, ""},
+{AST_FORMAT_MAX_VIDEO, 999, ""},
+{0, 0}
 };
 
 static char *ast2str(int ast)
@@ -214,7 +214,7 @@
 	IAX_QUERY = 2
 } iax_io_t;
 
-static switch_status_t iax_set_codec(private_t * tech_pvt, struct iax_session *iax_session,
+static switch_status_t iax_set_codec(private_t *tech_pvt, struct iax_session *iax_session,
 									 unsigned int *format, unsigned int *cababilities, unsigned short *samprate, iax_io_t io)
 {
 	char *dname = NULL;
@@ -281,8 +281,8 @@
 			char pref_str[256] = "(";
 
 			for (x = 0; x < len; x++) {
-				strncat(pref_str, ast2str(prefs[x]), sizeof(pref_str)-1);
-				strncat(pref_str, x == len - 1 ? ")" : ",", sizeof(pref_str)-1);
+				strncat(pref_str, ast2str(prefs[x]), sizeof(pref_str) - 1);
+				strncat(pref_str, x == len - 1 ? ")" : ",", sizeof(pref_str) - 1);
 			}
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Codec Prefs Detected: %s\n", pref_str);
@@ -439,7 +439,7 @@
 	}
 }
 
-static void tech_init(private_t * tech_pvt, switch_core_session_t *session)
+static void tech_init(private_t *tech_pvt, switch_core_session_t *session)
 {
 	tech_pvt->read_frame.data = tech_pvt->databuf;
 	tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
@@ -619,7 +619,7 @@
 
 	return SWITCH_STATUS_FALSE;
 
- cng:
+  cng:
 	data = (switch_byte_t *) tech_pvt->read_frame.data;
 	data[0] = 65;
 	data[1] = 0;
@@ -791,7 +791,7 @@
 	/*.write_frame */ channel_write_frame,
 	/*.kill_channel */ channel_kill_channel,
 	/*.send_dtmf */ channel_send_dtmf,
-	/*.receive_message*/ channel_receive_message,
+	/*.receive_message */ channel_receive_message,
 	/*.receive_event */ channel_receive_event
 };
 
@@ -867,7 +867,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t tech_media(private_t * tech_pvt, struct iax_event *iaxevent)
+static switch_status_t tech_media(private_t *tech_pvt, struct iax_event *iaxevent)
 {
 	unsigned int cap = iax_session_get_capability(iaxevent->session);
 	unsigned int format = iaxevent->ies.format;
@@ -1025,8 +1025,7 @@
 																				  NULL,
 																				  NULL,
 																				  modname,
-																				  iaxevent->ies.called_context,
-																				  iaxevent->ies.called_number)) != 0) {
+																				  iaxevent->ies.called_context, iaxevent->ies.called_number)) != 0) {
 							char name[128];
 							switch_snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
 							switch_channel_set_name(channel, name);
@@ -1062,7 +1061,7 @@
 					switch_clear_flag(tech_pvt, TFLAG_VOICE);
 					switch_mutex_unlock(tech_pvt->flag_mutex);
 
-					
+
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hangup %s\n", switch_channel_get_name(channel));
 					switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
 					switch_channel_hangup(channel, iaxevent->etype == IAX_EVENT_HANGUP ? SWITCH_CAUSE_NORMAL_CLEARING : SWITCH_CAUSE_FACILITY_REJECTED);
@@ -1102,7 +1101,7 @@
 				break;
 			case IAX_EVENT_DTMF:
 				if (channel) {
-					switch_dtmf_t dtmf = { (char) iaxevent->subclass , switch_core_default_dtmf_duration(0) };
+					switch_dtmf_t dtmf = { (char) iaxevent->subclass, switch_core_default_dtmf_duration(0) };
 					if (globals.debug) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%c DTMF %s\n", dtmf.digit, switch_channel_get_name(channel));
 					}
@@ -1118,7 +1117,7 @@
 				break;
 			}
 			iax_event_free(iaxevent);
-			switch_mutex_unlock(globals.mutex);			
+			switch_mutex_unlock(globals.mutex);
 			if (tech_pvt && tech_pvt->session) {
 				switch_core_session_signal_unlock(tech_pvt->session);
 			}

Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Tue May 27 00:54:52 2008
@@ -136,8 +136,8 @@
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_timer_name, globals.timer_name);
 #define is_master(t) switch_test_flag(t, TFLAG_MASTER)
 
-static void add_pvt(private_t * tech_pvt, int master);
-static void remove_pvt(private_t * tech_pvt);
+static void add_pvt(private_t *tech_pvt, int master);
+static void remove_pvt(private_t *tech_pvt);
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
 static switch_status_t channel_on_routing(switch_core_session_t *session);
@@ -234,7 +234,7 @@
 
 		while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
 			switch_size_t olen = globals.timer.samples;
-				
+
 			if (switch_timestamp_now() - last >= waitsec) {
 				char buf[512];
 				switch_event_t *event;
@@ -250,7 +250,7 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
 				last = switch_timestamp_now();
 			}
-			
+
 			if (ring_file) {
 				if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
 					switch_core_file_close(&fh);
@@ -324,7 +324,7 @@
 
 
 
-static void add_pvt(private_t * tech_pvt, int master)
+static void add_pvt(private_t *tech_pvt, int master)
 {
 	private_t *tp;
 	uint8_t in_list = 0;
@@ -367,7 +367,7 @@
 	switch_mutex_unlock(globals.pvt_lock);
 }
 
-static void remove_pvt(private_t * tech_pvt)
+static void remove_pvt(private_t *tech_pvt)
 {
 	private_t *tp, *last = NULL;
 
@@ -485,8 +485,7 @@
 										  tech_pvt->hold_file,
 										  globals.read_codec.implementation->number_of_channels,
 										  globals.read_codec.implementation->actual_samples_per_second,
-										  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
-										  NULL) != SWITCH_STATUS_SUCCESS) {
+										  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 					tech_pvt->hold_file = NULL;
 					goto cng;
 				}
@@ -500,12 +499,12 @@
 
 			goto hold;
 		}
-	cng:
+	  cng:
 		switch_yield(globals.read_codec.implementation->microseconds_per_frame);
 		*frame = &globals.cng_frame;
 		return SWITCH_STATUS_SUCCESS;
 
-	hold:
+	  hold:
 		{
 			switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
 			if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
@@ -531,13 +530,12 @@
 
 	switch_mutex_lock(globals.device_lock);
 
- get_samples:
+  get_samples:
 
-	if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data, 
-								   globals.read_codec.implementation->samples_per_frame, 
-								   &globals.timer)) == 0) {
-        switch_yield(1000);
-        goto get_samples;
+	if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
+								   globals.read_codec.implementation->samples_per_frame, &globals.timer)) == 0) {
+		switch_yield(1000);
+		goto get_samples;
 	} else {
 		globals.read_frame.datalen = samples * 2;
 		globals.read_frame.samples = samples;
@@ -576,8 +574,7 @@
 
 	if (globals.audio_stream) {
 		if (switch_test_flag((&globals), GFLAG_EAR)) {
-			WriteAudioStream(globals.audio_stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)),
-							 &globals.timer);
+			WriteAudioStream(globals.audio_stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)), &globals.timer);
 		}
 		status = SWITCH_STATUS_SUCCESS;
 	}
@@ -667,7 +664,7 @@
 			if (outbound_profile->destination_number && !strcasecmp(outbound_profile->destination_number, "auto_answer")) {
 				switch_set_flag(tech_pvt, TFLAG_ANSWER);
 			}
-			
+
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
 			switch_core_session_destroy(new_session);
@@ -775,7 +772,7 @@
 					globals.codec_ms = tmp;
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-									  "codec-ms must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL); 
+									  "codec-ms must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
 				}
 			} else if (!strcmp(var, "dialplan")) {
 				set_global_dialplan(val);
@@ -936,7 +933,8 @@
 	int i, printCount, cr = 7;
 	PaError err;
 	static double standardSampleRates[] = { 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0,
-											44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1};
+		44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1
+	};
 
 	printCount = cr;
 	for (i = 0; standardSampleRates[i] > 0; i++) {
@@ -1077,7 +1075,7 @@
 
 	return 0;
 
- error:
+  error:
 	switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "An error occured while using the portaudio stream\n");
 	switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error number: %d\n", err);
 	switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error message: %s\n", Pa_GetErrorText(err));
@@ -1140,7 +1138,7 @@
 		outputParameters.sampleFormat = SAMPLE_TYPE;
 		outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
 		outputParameters.hostApiSpecificStreamInfo = NULL;
-		err = OpenAudioStream(&globals.audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff, 
+		err = OpenAudioStream(&globals.audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,
 							  globals.read_codec.implementation->samples_per_frame);
 		/* UNLOCKED ************************************************************************************************* */
 		switch_mutex_unlock(globals.device_lock);
@@ -1174,8 +1172,7 @@
 		outputParameters.sampleFormat = SAMPLE_TYPE;
 		outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
 		outputParameters.hostApiSpecificStreamInfo = NULL;
-		err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff,
-							  globals.read_codec.implementation->samples_per_frame);
+		err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff, globals.read_codec.implementation->samples_per_frame);
 		/* UNLOCKED ************************************************************************************************* */
 		switch_mutex_unlock(globals.device_lock);
 
@@ -1192,8 +1189,8 @@
 static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
 {
 	char *dtmf_str = argv[0];
-	switch_dtmf_t dtmf = {0, switch_core_default_dtmf_duration(0)};
-	
+	switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
+
 	if (switch_strlen_zero(dtmf_str)) {
 		stream->write_function(stream, "No DTMF Supplied!\n");
 	} else {
@@ -1201,7 +1198,7 @@
 		if (globals.call_list) {
 			switch_channel_t *channel = switch_core_session_get_channel(globals.call_list->session);
 			char *p = dtmf_str;
-			while(p && *p) {
+			while (p && *p) {
 				dtmf.digit = *p;
 				switch_channel_queue_dtmf(channel, &dtmf);
 				p++;
@@ -1253,7 +1250,7 @@
 		stream->write_function(stream, "NO SUCH CALL\n");
 	}
 
- done:
+  done:
 	switch_mutex_unlock(globals.pvt_lock);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -1317,7 +1314,7 @@
 			break;
 		}
 	}
- done:
+  done:
 	switch_mutex_unlock(globals.pvt_lock);
 	stream->write_function(stream, "Answered %d channels.\n", x);
 
@@ -1368,7 +1365,7 @@
 		goto bad;
 	}
 
- desc:
+  desc:
 	x = 0;
 	stream->write_function(stream, "FLAGS: ");
 	if (switch_test_flag((&globals), GFLAG_EAR)) {
@@ -1385,9 +1382,9 @@
 
 	goto done;
 
- bad:
+  bad:
 	stream->write_function(stream, "Usage: flags [on|off] <flags>\n");
- done:
+  done:
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1474,20 +1471,18 @@
 		if (!switch_strlen_zero(argv[4])) {
 			tech_pvt->sample_rate = atoi(argv[4]);
 		}
-		
+
 		if (!switch_strlen_zero(argv[5])) {
 			tech_pvt->codec_ms = atoi(argv[5]);
 		}
-		
+
 		switch_find_local_ip(ip, sizeof(ip), AF_INET);
 
 		if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
-																  NULL, dialplan, cid_name, cid_num,
-																  ip, NULL, NULL, NULL, modname, NULL,
-																  dest)) != 0) {
+																  NULL, dialplan, cid_name, cid_num, ip, NULL, NULL, NULL, modname, NULL, dest)) != 0) {
 			char name[128];
 			switch_snprintf(name, sizeof(name), "PortAudio/%s",
-					 tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
+							tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
 			switch_channel_set_name(channel, name);
 
 			switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
@@ -1498,7 +1493,7 @@
 			switch_channel_mark_answered(channel);
 			switch_channel_set_state(channel, CS_INIT);
 			if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
 				switch_core_session_destroy(&session);
 				stream->write_function(stream, "FAIL:Thread Error!\n");
 			} else {
@@ -1674,7 +1669,7 @@
 		}
 	}
 
- done:
+  done:
 	if (http) {
 		stream->write_function(stream,
 							   "<br><br><table align=center><tr><td><center><form method=post>\n"
@@ -1691,25 +1686,18 @@
 							   "<td><input name=action type=submit value=\"2\"></td>"
 							   "<td><input name=action type=submit value=\"3\"></td>\n"
 							   "<td><input name=action type=submit value=\"A\"></td></tr>\n"
-
 							   "<tr><td><input name=action type=submit value=\"4\"></td>"
 							   "<td><input name=action type=submit value=\"5\"></td>"
 							   "<td><input name=action type=submit value=\"6\"></td>\n"
 							   "<td><input name=action type=submit value=\"B\"></td></tr>\n"
-
 							   "<tr><td><input name=action type=submit value=\"7\"></td>"
 							   "<td><input name=action type=submit value=\"8\"></td>"
 							   "<td><input name=action type=submit value=\"9\"></td>\n"
 							   "<td><input name=action type=submit value=\"C\"></td></tr>\n"
-
 							   "<tr><td><input name=action type=submit value=\"*\"></td>"
 							   "<td><input name=action type=submit value=\"0\"></td>"
 							   "<td><input name=action type=submit value=\"#\"></td>\n"
-							   "<td><input name=action type=submit value=\"D\"></td></tr>\n"
-							   "</table>"
-							   
-							   "</form><br></center></td></tr></table>\n"
-							   );
+							   "<td><input name=action type=submit value=\"D\"></td></tr>\n" "</table>" "</form><br></center></td></tr></table>\n");
 	}
 
 	switch_safe_free(mycmd);

Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c	Tue May 27 00:54:52 2008
@@ -72,7 +72,7 @@
 {
 	PABLIO_Stream *data = (PABLIO_Stream *) userData;
 	long numBytes = data->bytesPerFrame * framesPerBuffer;
-	
+
 	/* This may get called with NULL inputBuffer during initial setup. */
 	if (inputBuffer != NULL) {
 		if (PaUtil_WriteRingBuffer(&data->inFIFO, inputBuffer, numBytes) != numBytes) {
@@ -146,26 +146,26 @@
 	long bytesRead = 0;
 	char *p = (char *) data;
 	long avail, totalBytes = 0, neededBytes = aStream->bytesPerFrame * numFrames;
-	
-	for(;;) {
+
+	for (;;) {
 		avail = PaUtil_GetRingBufferReadAvailable(&aStream->inFIFO);
-		
+
 		if (switch_core_timer_check(timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
 			break;
 		}
-		
-		if (avail >= neededBytes * 6) { 
+
+		if (avail >= neededBytes * 6) {
 			PaUtil_FlushRingBuffer(&aStream->inFIFO);
 			avail = 0;
 		}
-		
+
 		bytesRead = 0;
 
 		if (totalBytes < neededBytes && avail >= neededBytes) {
 			bytesRead = PaUtil_ReadRingBuffer(&aStream->inFIFO, p, neededBytes);
 			totalBytes += bytesRead;
 		}
-		
+
 		if (bytesRead) {
 			p += bytesRead;
 		} else {
@@ -201,7 +201,7 @@
 {
 	long numBits = 0;
 	if (((n - 1) & n) == 0)
-		return n;				
+		return n;
 	while (n > 0) {
 		n = n >> 1;
 		numBits++;
@@ -217,11 +217,8 @@
  *
  */
 PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
-						const PaStreamParameters *inputParameters,
-						const PaStreamParameters *outputParameters,
-						double sampleRate,
-						PaStreamFlags streamFlags,
-						long samples_per_frame)
+						const PaStreamParameters * inputParameters,
+						const PaStreamParameters * outputParameters, double sampleRate, PaStreamFlags streamFlags, long samples_per_frame)
 {
 	long bytesPerSample = 2;
 	PaError err;

Modified: freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c	Tue May 27 00:54:52 2008
@@ -34,7 +34,7 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_reference_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_reference_shutdown);
 //SWITCH_MODULE_RUNTIME_FUNCTION(mod_reference_runtime);
-SWITCH_MODULE_DEFINITION(mod_reference, mod_reference_load, mod_reference_shutdown, NULL);//mod_reference_runtime);
+SWITCH_MODULE_DEFINITION(mod_reference, mod_reference_load, mod_reference_shutdown, NULL);	//mod_reference_runtime);
 
 
 switch_endpoint_interface_t *reference_endpoint_interface;
@@ -112,7 +112,7 @@
 
 
 
-static void tech_init(private_t * tech_pvt, switch_core_session_t *session)
+static void tech_init(private_t *tech_pvt, switch_core_session_t *session)
 {
 	tech_pvt->read_frame.data = tech_pvt->databuf;
 	tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
@@ -140,9 +140,9 @@
 	switch_set_flag_locked(tech_pvt, TFLAG_IO);
 
 	/* Move channel's state machine to ROUTING. This means the call is trying
-       to get from the initial start where the call because, to the point
-       where a destination has been identified. If the channel is simply
-       left in the initial state, nothing will happen. */
+	   to get from the initial start where the call because, to the point
+	   where a destination has been identified. If the channel is simply
+	   left in the initial state, nothing will happen. */
 	switch_channel_set_state(channel, CS_ROUTING);
 	switch_mutex_lock(globals.mutex);
 	globals.calls++;
@@ -315,7 +315,7 @@
 
 	return SWITCH_STATUS_FALSE;
 
- cng:
+  cng:
 	data = (switch_byte_t *) tech_pvt->read_frame.data;
 	data[0] = 65;
 	data[1] = 0;
@@ -346,7 +346,7 @@
 		switch_swap_linear(frame->data, (int) frame->datalen / 2);
 	}
 #endif
-	
+
 
 	return SWITCH_STATUS_SUCCESS;
 
@@ -363,7 +363,7 @@
 	tech_pvt = switch_core_session_get_private(session);
 	assert(tech_pvt != NULL);
 
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -375,7 +375,7 @@
 
 	channel = switch_core_session_get_channel(session);
 	assert(channel != NULL);
-			
+
 	tech_pvt = (private_t *) switch_core_session_get_private(session);
 	assert(tech_pvt != NULL);
 
@@ -471,7 +471,7 @@
 	/*.write_frame */ channel_write_frame,
 	/*.kill_channel */ channel_kill_channel,
 	/*.send_dtmf */ channel_send_dtmf,
-	/*.receive_message*/ channel_receive_message,
+	/*.receive_message */ channel_receive_message,
 	/*.receive_event */ channel_receive_event
 };
 
@@ -531,7 +531,7 @@
 {
 
 	module_pool = pool;
-	
+
 	load_config();
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -540,7 +540,7 @@
 	reference_endpoint_interface->io_routines = &reference_io_routines;
 	reference_endpoint_interface->state_handler = &reference_state_handlers;
 
-	
+
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Tue May 27 00:54:52 2008
@@ -98,14 +98,14 @@
 
 		if (sofia_glue_do_invite(session) != SWITCH_STATUS_SUCCESS) {
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-			assert( switch_channel_get_state(channel) != CS_INIT);
+			assert(switch_channel_get_state(channel) != CS_INIT);
 			return SWITCH_STATUS_FALSE;
 		}
 	}
 
 	/* Move channel's state machine to ROUTING */
 	switch_channel_set_state(channel, CS_ROUTING);
-	assert( switch_channel_get_state(channel) != CS_INIT);
+	assert(switch_channel_get_state(channel) != CS_INIT);
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -115,7 +115,7 @@
 	switch_assert(tech_pvt != NULL);
 
 	switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
@@ -128,7 +128,7 @@
 	switch_assert(tech_pvt != NULL);
 
 	switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
@@ -141,7 +141,7 @@
 	switch_assert(tech_pvt != NULL);
 
 	switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
@@ -160,7 +160,7 @@
 
 /* map QSIG cause codes to SIP from RFC4497 section 8.4.1 */
 static int hangup_cause_to_sip(switch_call_cause_t cause)
-{		
+{
 	switch (cause) {
 	case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET:
 	case SWITCH_CAUSE_NO_ROUTE_DESTINATION:
@@ -223,11 +223,11 @@
 	switch_call_cause_t cause = switch_channel_get_cause(channel);
 	int sip_cause = hangup_cause_to_sip(cause);
 	const char *ps_cause = switch_channel_get_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE);
-	
+
 	if (!switch_strlen_zero(ps_cause) && !strncasecmp(ps_cause, "sip:", 4)) {
 		int new_cause = atoi(ps_cause + 4);
 		if (new_cause) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n", 
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n",
 							  switch_channel_get_name(channel), sip_cause, new_cause);
 			sip_cause = new_cause;
 		}
@@ -262,7 +262,7 @@
 	sofia_glue_deactivate_rtp(tech_pvt);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s hanging up, cause: %s\n",
-		switch_channel_get_name(channel), switch_channel_cause2str(cause));
+					  switch_channel_get_name(channel), switch_channel_cause2str(cause));
 
 	if (tech_pvt->hash_key) {
 		switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->hash_key);
@@ -282,7 +282,7 @@
 
 	switch_mutex_lock(tech_pvt->profile->flag_mutex);
 
-	if (tech_pvt->nh  && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
+	if (tech_pvt->nh && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
 		char reason[128] = "";
 		if (cause > 1 && cause < 128) {
 			switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
@@ -291,7 +291,7 @@
 		} else {
 			switch_snprintf(reason, sizeof(reason), "FreeSWITCH;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
 		}
-			
+
 		if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
 			nua_bye(tech_pvt->nh, SIPTAG_REASON_STR(reason), TAG_END());
@@ -349,7 +349,7 @@
 
 	b_sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE);
 	is_proxy = (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA));
-	
+
 	if (b_sdp && is_proxy) {
 		tech_pvt->local_sdp_str = switch_core_session_strdup(session, b_sdp);
 
@@ -373,7 +373,7 @@
 				const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 				tech_pvt->num_codecs = 0;
 				sofia_glue_tech_prepare_codecs(tech_pvt);
-				
+
 				if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
 					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
 					//nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
@@ -394,8 +394,7 @@
 
 		if (tech_pvt->nh) {
 			if (tech_pvt->local_sdp_str) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel),
-								  tech_pvt->local_sdp_str);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel), tech_pvt->local_sdp_str);
 			}
 		}
 	}
@@ -406,16 +405,16 @@
 			session_timeout = v_session_timeout;
 		}
 	}
-	
+
 	if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
-		(val = switch_channel_get_variable(channel, "sip-force-contact")) || 
+		(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
 		((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
 		sticky = tech_pvt->record_route;
 		session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
 		switch_channel_set_variable(channel, "sip_nat_detected", "true");
 	}
 
-	
+
 
 	nua_respond(tech_pvt->nh, SIP_200_OK,
 				NUTAG_AUTOANSWER(0),
@@ -423,11 +422,7 @@
 				NUTAG_SESSION_TIMER(session_timeout),
 				SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 				SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-				SOATAG_REUSE_REJECTED(1),
-				SOATAG_ORDERED_USER(1),
-				SOATAG_AUDIO_AUX("cn telephone-event"),
-				NUTAG_INCLUDE_EXTRA_SDP(1),
-				TAG_END());
+				SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -474,7 +469,7 @@
 				}
 				return status;
 			}
-			
+
 			payload = tech_pvt->video_read_frame.payload;
 
 			if (tech_pvt->video_read_frame.datalen > 0) {
@@ -524,13 +519,13 @@
 	if (!switch_test_flag(frame, SFF_CNG)) {
 		switch_rtp_write_frame(tech_pvt->video_rtp_session, frame);
 	}
-	
+
 	return status;
 }
 
 static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
 {
-	private_object_t *tech_pvt =  switch_core_session_get_private(session);
+	private_object_t *tech_pvt = switch_core_session_get_private(session);
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	int payload = 0;
 
@@ -558,7 +553,7 @@
 
 	if (switch_test_flag(tech_pvt, TFLAG_IO)) {
 		switch_status_t status;
-		
+
 		if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
 			return SWITCH_STATUS_GENERR;
 		}
@@ -570,22 +565,22 @@
 			tech_pvt->read_frame.flags = SFF_NONE;
 
 			status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags);
-			
+
 			if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 				if (status == SWITCH_STATUS_TIMEOUT) {
 					switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
 				}
 				return status;
 			}
-			
+
 			payload = tech_pvt->read_frame.payload;
 
 			if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
-				switch_dtmf_t dtmf = {0};
+				switch_dtmf_t dtmf = { 0 };
 				switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf);
 				switch_channel_queue_dtmf(channel, &dtmf);
 			}
-			
+
 			if (tech_pvt->read_frame.datalen > 0) {
 				size_t bytes = 0;
 				int frames = 1;
@@ -712,10 +707,7 @@
 
 	case DTMF_INFO:
 		snprintf(message, sizeof(message), "Signal=%c\r\nDuration=%d\r\n", dtmf->digit, dtmf->duration / 8);
-		nua_info(tech_pvt->nh,
-				 SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"),
-				 SIPTAG_PAYLOAD_STR(message),
-				 TAG_END());
+		nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"), SIPTAG_PAYLOAD_STR(message), TAG_END());
 		break;
 	default:
 		break;
@@ -750,18 +742,11 @@
 				" <media_control>\r\n"
 				"  <vc_primitive>\r\n"
 				"   <to_encoder>\r\n"
-				"    <picture_fast_update>\r\n"
-				"    </picture_fast_update>\r\n"
-				"   </to_encoder>\r\n"
-				"  </vc_primitive>\r\n"
-				" </media_control>\r\n";
-			
-			nua_info(tech_pvt->nh,
-					 SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"),
-					 SIPTAG_PAYLOAD_STR(pl),
-					 TAG_END());
+				"    <picture_fast_update>\r\n" "    </picture_fast_update>\r\n" "   </to_encoder>\r\n" "  </vc_primitive>\r\n" " </media_control>\r\n";
+
+			nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
+
 
-			
 		}
 		break;
 	case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY:
@@ -770,31 +755,27 @@
 			switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
 		}
 		break;
-	case SWITCH_MESSAGE_INDICATE_BROADCAST: {
-		const char *ip = NULL, *port = NULL;
-		ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
-		port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
-		if (ip && port) {
-			sofia_glue_set_local_sdp(tech_pvt, ip, atoi(port), msg->string_arg, 1);
-		}
-		nua_respond(tech_pvt->nh, SIP_200_OK,
-					SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-					SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-					SOATAG_REUSE_REJECTED(1),
-					SOATAG_ORDERED_USER(1),
-					SOATAG_AUDIO_AUX("cn telephone-event"),
-					NUTAG_INCLUDE_EXTRA_SDP(1),
-					TAG_END());
-		switch_channel_mark_answered(channel);
-	}
+	case SWITCH_MESSAGE_INDICATE_BROADCAST:{
+			const char *ip = NULL, *port = NULL;
+			ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
+			port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
+			if (ip && port) {
+				sofia_glue_set_local_sdp(tech_pvt, ip, atoi(port), msg->string_arg, 1);
+			}
+			nua_respond(tech_pvt->nh, SIP_200_OK,
+						SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+						SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+						SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
+			switch_channel_mark_answered(channel);
+		}
 		break;
-	case SWITCH_MESSAGE_INDICATE_NOMEDIA: 
+	case SWITCH_MESSAGE_INDICATE_NOMEDIA:
 		{
 			const char *uuid;
 			switch_core_session_t *other_session;
 			switch_channel_t *other_channel;
 			const char *ip = NULL, *port = NULL;
-			
+
 			switch_channel_set_flag(channel, CF_PROXY_MODE);
 			tech_pvt->local_sdp_str = NULL;
 			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
@@ -826,14 +807,14 @@
 	case SWITCH_MESSAGE_INDICATE_MEDIA:
 		{
 			uint32_t send_invite = 1;
-			
+
 			switch_channel_clear_flag(channel, CF_PROXY_MODE);
 			tech_pvt->local_sdp_str = NULL;
 
 			if (!switch_channel_media_ready(channel)) {
 				if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
 					const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
-					
+
 					tech_pvt->num_codecs = 0;
 					sofia_glue_tech_prepare_codecs(tech_pvt);
 					if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
@@ -882,7 +863,7 @@
 			}
 		}
 		break;
-		
+
 	case SWITCH_MESSAGE_INDICATE_UNHOLD:
 		{
 			switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
@@ -890,7 +871,7 @@
 		}
 		break;
 	case SWITCH_MESSAGE_INDICATE_BRIDGE:
-		
+
 		if (switch_test_flag(tech_pvt, TFLAG_XFER)) {
 			switch_clear_flag_locked(tech_pvt, TFLAG_XFER);
 			if (msg->pointer_arg) {
@@ -918,19 +899,19 @@
 			}
 		}
 		/*
-		if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
-			switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
-		}
-		*/
+		   if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
+		   switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+		   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
+		   }
+		 */
 		break;
 	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
 		/*
-		if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
-			switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
-		}
-		*/
+		   if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
+		   switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+		   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
+		   }
+		 */
 		break;
 	case SWITCH_MESSAGE_INDICATE_REDIRECT:
 		if (msg->string_arg) {
@@ -962,7 +943,7 @@
 			if (code) {
 				reason = msg->string_arg;
 			} else {
-				if (!switch_strlen_zero(msg->string_arg)){
+				if (!switch_strlen_zero(msg->string_arg)) {
 					if ((code = atoi(msg->string_arg))) {
 						if ((reason = strchr(msg->string_arg, ' '))) {
 							reason++;
@@ -974,14 +955,14 @@
 			if (!code) {
 				code = 488;
 			}
-			
+
 			if (switch_strlen_zero(reason) && code != 407) {
 				reason = sip_status_phrase(code);
 				if (switch_strlen_zero(reason)) {
 					reason = "Because";
 				}
 			}
-			
+
 			if (code == 407 && !msg->numeric_arg) {
 				const char *to_uri = switch_channel_get_variable(channel, "sip_to_uri");
 				const char *to_host = reason;
@@ -990,14 +971,14 @@
 					to_host = switch_channel_get_variable(channel, "sip_to_host");
 				}
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Challenging call %s\n", to_uri);
-				sofia_reg_auth_challange(NULL, tech_pvt->profile, tech_pvt->nh, REG_INVITE, to_host, 0); 
+				sofia_reg_auth_challange(NULL, tech_pvt->profile, tech_pvt->nh, REG_INVITE, to_host, 0);
 				switch_channel_hangup(channel, SWITCH_CAUSE_USER_CHALLENGE);
 			} else if (code == 484 && msg->numeric_arg) {
 				const char *to = switch_channel_get_variable(channel, "sip_to_uri");
 				const char *max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
-				
+
 				char *to_uri = NULL;
-				
+
 				if (to) {
 					char *p;
 					to_uri = switch_core_session_sprintf(session, "sip:%s", to);
@@ -1015,9 +996,9 @@
 				}
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
-				
-				if (!switch_strlen_zero(((char *)msg->pointer_arg))) {
-					tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, (char *)msg->pointer_arg);
+
+				if (!switch_strlen_zero(((char *) msg->pointer_arg))) {
+					tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, (char *) msg->pointer_arg);
 					if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 						sofia_glue_tech_patch_sdp(tech_pvt);
 						sofia_glue_tech_proxy_remote_addr(tech_pvt);
@@ -1025,10 +1006,7 @@
 					nua_respond(tech_pvt->nh, code, reason, SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 								SOATAG_REUSE_REJECTED(1),
-								SOATAG_ORDERED_USER(1),
-								SOATAG_AUDIO_AUX("cn telephone-event"),
-								NUTAG_INCLUDE_EXTRA_SDP(1),
-								TAG_END());
+								SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
 				} else {
 					nua_respond(tech_pvt->nh, code, reason, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
 				}
@@ -1036,11 +1014,11 @@
 					switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 				}
 			}
-			
+
 		}
 		break;
 	case SWITCH_MESSAGE_INDICATE_RINGING:
-		if (!switch_channel_test_flag(channel, CF_RING_READY) && 
+		if (!switch_channel_test_flag(channel, CF_RING_READY) &&
 			!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
 			nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
 			switch_channel_mark_ring_ready(channel);
@@ -1055,10 +1033,10 @@
 			const char *val = NULL;
 
 			if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
-				
+
 				switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
-				
+
 				/* Transmit 183 Progress with SDP */
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 					const char *sdp = NULL;
@@ -1105,7 +1083,7 @@
 
 
 				if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
-					(val = switch_channel_get_variable(channel, "sip-force-contact")) || 
+					(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
 					((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
 					sticky = tech_pvt->record_route;
 					switch_channel_set_variable(channel, "sip_nat_detected", "true");
@@ -1117,8 +1095,7 @@
 							TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
 							SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 							SOATAG_REUSE_REJECTED(1),
-							SOATAG_ORDERED_USER(1),
-							SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), TAG_END());
+							SOATAG_ORDERED_USER(1), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), TAG_END());
 			}
 		}
 		break;
@@ -1126,10 +1103,10 @@
 		break;
 	}
 
- end:
-	
+  end:
+
 	return status;
-	
+
 }
 
 static switch_status_t sofia_receive_event(switch_core_session_t *session, switch_event_t *event)
@@ -1158,14 +1135,15 @@
 typedef switch_status_t (*sofia_command_t) (char **argv, int argc, switch_stream_handle_t *stream);
 
 static const char *sofia_state_names[] = { "UNREGED",
-										   "TRYING",
-										   "REGISTER",
-										   "REGED",
-										   "UNREGISTER",
-										   "FAILED",
-										   "EXPIRED",
-										   "NOREG",
-										   NULL};
+	"TRYING",
+	"REGISTER",
+	"REGED",
+	"UNREGISTER",
+	"FAILED",
+	"EXPIRED",
+	"NOREG",
+	NULL
+};
 
 struct cb_helper {
 	sofia_profile_t *profile;
@@ -1188,17 +1166,14 @@
 		switch_strftime(exp_buf, &retsize, sizeof(exp_buf), "%Y-%m-%d %T", &tm);
 	}
 
-	cb->stream->write_function(cb->stream, 
+	cb->stream->write_function(cb->stream,
 							   "Call-ID \t%s\n"
 							   "User    \t%s@%s\n"
 							   "Contact \t%s\n"
 							   "Agent   \t%s\n"
-							   "Status  \t%s(%s) EXP(%s)\n\n", 
-							   switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), switch_str_nil(argv[3]), 
-							   switch_str_nil(argv[7]), 
-							   switch_str_nil(argv[4]), 
-							   switch_str_nil(argv[5]), 
-							   exp_buf);
+							   "Status  \t%s(%s) EXP(%s)\n\n",
+							   switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), switch_str_nil(argv[3]),
+							   switch_str_nil(argv[7]), switch_str_nil(argv[4]), switch_str_nil(argv[5]), exp_buf);
 	return 0;
 }
 
@@ -1254,24 +1229,24 @@
 				stream->write_function(stream, "Name       \t%s\n", switch_str_nil(argv[1]));
 				stream->write_function(stream, "Domain Name\t%s\n", switch_str_nil(profile->domain_name));
 				if (strcasecmp(argv[1], profile->name)) {
-				stream->write_function(stream, "Alias Of   \t%s\n", switch_str_nil(profile->name));
+					stream->write_function(stream, "Alias Of   \t%s\n", switch_str_nil(profile->name));
 				}
 				stream->write_function(stream, "DBName     \t%s\n", switch_str_nil(profile->dbname));
 				stream->write_function(stream, "Dialplan   \t%s\n", switch_str_nil(profile->dialplan));
 				stream->write_function(stream, "RTP-IP     \t%s\n", switch_str_nil(profile->rtpip));
 				if (profile->extrtpip) {
-				stream->write_function(stream, "Ext-RTP-IP \t%s\n", profile->extrtpip);
+					stream->write_function(stream, "Ext-RTP-IP \t%s\n", profile->extrtpip);
 				}
-				
+
 				stream->write_function(stream, "SIP-IP     \t%s\n", switch_str_nil(profile->sipip));
 				if (profile->extsipip) {
-				stream->write_function(stream, "Ext-SIP-IP \t%s\n", profile->extsipip);
+					stream->write_function(stream, "Ext-SIP-IP \t%s\n", profile->extsipip);
 				}
 				stream->write_function(stream, "URL        \t%s\n", switch_str_nil(profile->url));
 				stream->write_function(stream, "BIND-URL   \t%s\n", switch_str_nil(profile->bindurl));
 				if (sofia_test_pflag(profile, PFLAG_TLS)) {
-				stream->write_function(stream, "TLS-URL   \t%s\n", switch_str_nil(profile->tls_url));
-				stream->write_function(stream, "TLS-BIND-URL   \t%s\n", switch_str_nil(profile->tls_bindurl));
+					stream->write_function(stream, "TLS-URL   \t%s\n", switch_str_nil(profile->tls_url));
+					stream->write_function(stream, "TLS-BIND-URL   \t%s\n", switch_str_nil(profile->tls_bindurl));
 				}
 				stream->write_function(stream, "HOLD-MUSIC \t%s\n", switch_str_nil(profile->hold_music));
 				stream->write_function(stream, "CODECS     \t%s\n", switch_str_nil(profile->codec_string));
@@ -1283,10 +1258,8 @@
 
 				cb.profile = profile;
 				cb.stream = stream;
-				
-				sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex,
-												"select * from sip_registrations",
-												show_reg_callback, &cb);
+
+				sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, "select * from sip_registrations", show_reg_callback, &cb);
 
 				stream->write_function(stream, "%s\n", line);
 
@@ -1308,7 +1281,7 @@
 		switch_hash_this(hi, &vvar, NULL, &val);
 		profile = (sofia_profile_t *) val;
 		if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
-			
+
 			if (strcmp(vvar, profile->name)) {
 				ac++;
 				stream->write_function(stream, "%25s\t%s\t  %32s\t%s\n", vvar, "  alias", profile->name, "ALIASED");
@@ -1317,8 +1290,8 @@
 									   sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
 
 				if (sofia_test_pflag(profile, PFLAG_TLS)) {
-				stream->write_function(stream, "%25s\t%s\t  %32s\t%s (%u) (TLS)\n", profile->name, "profile", profile->tls_url,
-									   sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
+					stream->write_function(stream, "%25s\t%s\t  %32s\t%s (%u) (TLS)\n", profile->name, "profile", profile->tls_url,
+										   sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
 				}
 
 				c++;
@@ -1366,12 +1339,12 @@
 		}
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	if (switch_strlen_zero(profile_name) || !(profile = sofia_glue_find_profile(profile_name))) {
 		stream->write_function(stream, "Invalid Profile [%s]", switch_str_nil(profile_name));
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	if (!strcasecmp(argv[1], "flush_inbound_reg")) {
 		if (argc > 2) {
 			sofia_reg_expire_call_id(profile, argv[2]);
@@ -1407,7 +1380,7 @@
 		} else {
 			stream->write_function(stream, "Invalid gateway!\n");
 		}
-		
+
 		goto done;
 	}
 
@@ -1442,7 +1415,7 @@
 		int diff = (int) (switch_timestamp(NULL) - profile->started);
 		int remain = rsec - diff;
 		if (diff < rsec) {
-			stream->write_function(stream, "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n", 
+			stream->write_function(stream, "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n",
 								   profile->name, rsec, remain, remain == 1 ? "" : "s");
 		} else {
 
@@ -1467,7 +1440,7 @@
 
 	stream->write_function(stream, "-ERR Unknown command!\n");
 
- done:
+  done:
 	if (profile) {
 		sofia_glue_release_profile(profile);
 	}
@@ -1524,14 +1497,14 @@
 	if ((domain = strchr(user, '@'))) {
 		*domain++ = '\0';
 	}
-	
+
 	if (!profile_name && domain) {
 		profile_name = domain;
 	}
 
 	if (user && profile_name) {
 		char *sql;
-		
+
 		if (!(profile = sofia_glue_find_profile(profile_name))) {
 			profile_name = domain;
 			domain = NULL;
@@ -1544,7 +1517,7 @@
 		if (profile) {
 			struct cb_helper cb;
 			switch_stream_handle_t mystream = { 0 };
-			
+
 			if (!domain || !strchr(domain, '.')) {
 				domain = profile->name;
 			}
@@ -1553,9 +1526,9 @@
 			switch_assert(mystream.data);
 			cb.profile = profile;
 			cb.stream = &mystream;
-			
+
 			if (exclude_contact) {
-				sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q' and contact not like '%%%s%%'", 
+				sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q' and contact not like '%%%s%%'",
 									 user, domain, exclude_contact);
 			} else {
 				sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q'", user, domain);
@@ -1573,7 +1546,7 @@
 			switch_safe_free(mystream.data);
 		}
 	}
-	
+
 	if (reply) {
 		stream->write_function(stream, "%s", reply);
 	}
@@ -1600,13 +1573,12 @@
 		"sofia help\n"
 		"sofia profile <profile_name> [start|stop|restart|flush_inbound_reg [<call_id>]|[register|unregister] [<gateway name>|all]] [reloadxml]\n"
 		"sofia status [[profile | gateway] <name>]\n"
-		"sofia loglevel [0-9]\n"
-		"--------------------------------------------------------------------------------\n";
-		
+		"sofia loglevel [0-9]\n" "--------------------------------------------------------------------------------\n";
+
 	if (session) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "%s", usage_string);
 		goto done;
@@ -1621,7 +1593,7 @@
 		stream->write_function(stream, "%s", usage_string);
 		goto done;
 	}
-	
+
 	if (!strcasecmp(argv[0], "profile")) {
 		func = cmd_profile;
 	} else if (!strcasecmp(argv[0], "status")) {
@@ -1664,9 +1636,9 @@
 	/*.send_dtmf */ sofia_send_dtmf,
 	/*.receive_message */ sofia_receive_message,
 	/*.receive_event */ sofia_receive_event,
-	/*.state_change*/ NULL,
-	/*.read_video_frame*/ sofia_read_video_frame,
-	/*.write_video_frame*/ sofia_write_video_frame
+	/*.state_change */ NULL,
+	/*.read_video_frame */ sofia_read_video_frame,
+	/*.write_video_frame */ sofia_write_video_frame
 };
 
 switch_state_handler_table_t sofia_event_handlers = {
@@ -1677,8 +1649,8 @@
 	/*.on_exchange_media */ sofia_on_exchange_media,
 	/*.on_soft_execute */ sofia_on_soft_execute,
 	/*.on_consume_media */ NULL,
-	/*.on_hibernate*/ sofia_on_hibernate,
-	/*.on_reset*/ sofia_on_reset
+	/*.on_hibernate */ sofia_on_hibernate,
+	/*.on_reset */ sofia_on_reset
 };
 
 static switch_status_t sofia_manage(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen)
@@ -1698,7 +1670,7 @@
 	private_object_t *tech_pvt = NULL;
 	switch_channel_t *nchannel;
 	char *host = NULL, *dest_to = NULL;
-	
+
 	*new_session = NULL;
 
 	if (!(nsession = switch_core_session_request(sofia_endpoint_interface, pool))) {
@@ -1758,14 +1730,14 @@
 		 * invite contact.
 		 *
 		 * TODO:
-		 *	- Add parameters back to destination url?
+		 *  - Add parameters back to destination url?
 		 */
 		if ((params = strchr(dest, ';'))) {
 			char *tp_param;
 
 			*params++ = '\0';
 
-			if ((tp_param = (char *)switch_stristr("port=", params))) {
+			if ((tp_param = (char *) switch_stristr("port=", params))) {
 				tp_param += 5;
 				tech_pvt->transport = sofia_glue_str2transport(tp_param);
 				if (tech_pvt->transport == SOFIA_TRANSPORT_UNKNOWN) {
@@ -1776,7 +1748,8 @@
 		}
 
 		if (tech_pvt->transport != gateway_ptr->register_transport) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You are trying to use a different transport type for this gateway (overriding the register-transport), this is unsupported!\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+							  "You are trying to use a different transport type for this gateway (overriding the register-transport), this is unsupported!\n");
 			cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 			goto error;
 		}
@@ -1860,7 +1833,7 @@
 			tech_pvt->dest_to = switch_core_session_sprintf(nsession, "sip:%s@%s", dest_to, host);
 		}
 	}
-	
+
 
 	if (!tech_pvt->dest_to) {
 		tech_pvt->dest_to = tech_pvt->dest;
@@ -1961,7 +1934,7 @@
 	switch_core_hash_init(&mod_sofia_globals.profile_hash, mod_sofia_globals.pool);
 	switch_core_hash_init(&mod_sofia_globals.gateway_hash, mod_sofia_globals.pool);
 	switch_mutex_init(&mod_sofia_globals.hash_mutex, SWITCH_MUTEX_NESTED, mod_sofia_globals.pool);
-	
+
 	switch_mutex_lock(mod_sofia_globals.mutex);
 	mod_sofia_globals.running = 1;
 	switch_mutex_unlock(mod_sofia_globals.mutex);
@@ -2034,7 +2007,7 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
 {
 	int sanity = 0;
-	
+
 	switch_mutex_lock(mod_sofia_globals.mutex);
 	if (mod_sofia_globals.running == 1) {
 		mod_sofia_globals.running = 0;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Tue May 27 00:54:52 2008
@@ -56,14 +56,15 @@
 
 static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 									 char const *phrase,
-									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									 tagi_t tags[]);
 
 static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status,
-									 char const *phrase,
-									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-static void sofia_handle_sip_r_options(switch_core_session_t *session, int status,
-									 char const *phrase,
-									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+									  char const *phrase,
+									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									  tagi_t tags[]);
+static void sofia_handle_sip_r_options(switch_core_session_t *session, int status, char const *phrase, nua_t *nua, sofia_profile_t *profile,
+									   nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
 
 void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
 							   char const *phrase,
@@ -79,16 +80,11 @@
 }
 
 void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
-							  char const *phrase,
-							  nua_t *nua,
-							  sofia_profile_t *profile,
-							  nua_handle_t *nh,
-							  sofia_private_t *sofia_private,
-							  sip_t const *sip,
-							  tagi_t tags[])
+							   char const *phrase,
+							   nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
 {
 	switch_channel_t *channel = NULL;
-	
+
 	/* make sure we have a proper event */
 	if (!sip || !sip->sip_event) {
 		goto error;
@@ -110,41 +106,36 @@
 	if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
 		switch_channel_answer(channel);
 		switch_channel_set_variable(channel, "auto_answer_destination", switch_channel_get_variable(channel, "destination_number"));
-		switch_ivr_session_transfer(session, "auto_answer", NULL , NULL);
+		switch_ivr_session_transfer(session, "auto_answer", NULL, NULL);
 		nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
 		return;
 	}
 
-error:
+  error:
 	nua_respond(nh, 481, "Subscription Does Not Exist", NUTAG_WITH_THIS(nua), TAG_END());
 	return;
 }
 
 void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
-							  char const *phrase,
-							  nua_t *nua,
-							  sofia_profile_t *profile,
-							  nua_handle_t *nh,
-							  sofia_private_t *sofia_private,
-							  sip_t const *sip,
-							  tagi_t tags[])
+							char const *phrase,
+							nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
 {
 	const char *tmp;
 	switch_channel_t *channel;
 
-	if (!session) return;
+	if (!session)
+		return;
 
-	channel = switch_core_session_get_channel(session); 
+	channel = switch_core_session_get_channel(session);
 
 
-    if (sip->sip_reason && sip->sip_reason->re_protocol && 
-        (!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")) &&
-        sip->sip_reason->re_cause) {
-        private_object_t *tech_pvt = switch_core_session_get_private(session);
-        tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
-    }
+	if (sip->sip_reason && sip->sip_reason->re_protocol &&
+		(!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")) && sip->sip_reason->re_cause) {
+		private_object_t *tech_pvt = switch_core_session_get_private(session);
+		tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
+	}
 
-	if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)){
+	if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
 		switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
 	}
 	if ((tmp = sofia_glue_get_unknown_header(sip, "rtp-txstat"))) {
@@ -163,12 +154,7 @@
 void sofia_event_callback(nua_event_t event,
 						  int status,
 						  char const *phrase,
-						  nua_t *nua,
-						  sofia_profile_t *profile,
-						  nua_handle_t *nh,
-						  sofia_private_t *sofia_private,
-						  sip_t const *sip,
-						  tagi_t tags[])
+						  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
 {
 	struct private_object *tech_pvt = NULL;
 	auth_res_t auth_res = AUTH_FORBIDDEN;
@@ -199,7 +185,7 @@
 			}
 		}
 	}
-	
+
 	if (status != 100 && status != 200) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "event [%s] status [%d][%s] session: %s\n",
 						  nua_event_name(event), status, phrase, session ? switch_channel_get_name(channel) : "n/a");
@@ -216,7 +202,7 @@
 
 	if ((profile->pflags & PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
 		sip_authorization_t const *authorization = NULL;
-		
+
 		if (sip->sip_authorization) {
 			authorization = sip->sip_authorization;
 		} else if (sip->sip_proxy_authorization) {
@@ -226,8 +212,9 @@
 		if (authorization) {
 			char network_ip[80];
 			get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr);
-			auth_res = sofia_reg_parse_auth(profile, authorization, sip, 
-											(char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0, REG_INVITE, NULL);
+			auth_res = sofia_reg_parse_auth(profile, authorization, sip,
+											(char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0,
+											REG_INVITE, NULL);
 		}
 
 		if (auth_res != AUTH_OK) {
@@ -408,9 +395,9 @@
 
 		switch_mutex_lock(profile->ireg_mutex);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
-		
+
 		sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','Registered', '%q', %ld, '%q')",
-							  call_id, from_user, from_host, contact_str, rpid, expires, user_agent);
+							 call_id, from_user, from_host, contact_str, rpid, expires, user_agent);
 
 		if (sql) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -437,9 +424,9 @@
 	gateway_loops = GATEWAY_SECONDS;
 
 	sofia_set_pflag_locked(profile, PFLAG_WORKER_RUNNING);
-	
+
 	switch_queue_create(&profile->sql_queue, 500000, profile->pool);
-	
+
 	qsize = switch_queue_size(profile->sql_queue);
 
 	while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) {
@@ -469,9 +456,9 @@
 		switch_yield(10000);
 		qsize = switch_queue_size(profile->sql_queue);
 	}
-	
+
 	sofia_clear_pflag_locked(profile, PFLAG_WORKER_RUNNING);
-	
+
 	return NULL;
 }
 
@@ -488,7 +475,7 @@
 	switch_threadattr_priority_increase(thd_attr);
 	switch_thread_create(&thread, thd_attr, sofia_profile_worker_thread_run, profile, profile->pool);
 
-	while(!sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
+	while (!sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
 		switch_yield(100000);
 		if (++x >= 100) {
 			break;
@@ -537,16 +524,9 @@
 	}
 
 	profile->nua = nua_create(profile->s_root,	/* Event loop */
-							sofia_event_callback,	/* Callback for processing events */
-							profile,	/* Additional data to pass to callback */
-							NUTAG_URL(profile->bindurl),
-							TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)),
-							TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)),
-							TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)),
-							NTATAG_UDP_MTU(65536),
-							NTATAG_SERVER_RPORT(2),
-							TAG_IF(tportlog, TPTAG_LOG(1)),
-							TAG_END());	/* Last tag should always finish the sequence */
+							  sofia_event_callback,	/* Callback for processing events */
+							  profile,	/* Additional data to pass to callback */
+							  NUTAG_URL(profile->bindurl), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), NTATAG_UDP_MTU(65536), NTATAG_SERVER_RPORT(2), TAG_IF(tportlog, TPTAG_LOG(1)), TAG_END());	/* Last tag should always finish the sequence */
 
 	if (!profile->nua) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s\n", profile->name);
@@ -585,10 +565,9 @@
 
 	for (node = profile->aliases; node; node = node->next) {
 		node->nua = nua_create(profile->s_root,	/* Event loop */
-								sofia_event_callback,	/* Callback for processing events */
-								profile,	/* Additional data to pass to callback */
-								NTATAG_SERVER_RPORT(2),
-								NUTAG_URL(node->url), TAG_END());	/* Last tag should always finish the sequence */
+							   sofia_event_callback,	/* Callback for processing events */
+							   profile,	/* Additional data to pass to callback */
+							   NTATAG_SERVER_RPORT(2), NUTAG_URL(node->url), TAG_END());	/* Last tag should always finish the sequence */
 
 		nua_set_params(node->nua,
 					   NUTAG_APPL_METHOD("OPTIONS"),
@@ -600,8 +579,7 @@
 					   NUTAG_ALLOW("INFO"),
 					   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("PUBLISH")),
 					   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ENABLEMESSAGE(1)),
-					   SIPTAG_SUPPORTED_STR(supported), 
-					   SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
+					   SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "activated db for %s\n", profile->name);
@@ -653,11 +631,11 @@
 	sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "waiting for worker thread\n");
 
-	while(sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
+	while (sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
 		switch_yield(100000);
 	}
 
-	while(profile->inuse) {
+	while (profile->inuse) {
 		switch_yield(100000);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "waiting for %d session(s)\n", profile->inuse);
 	}
@@ -671,7 +649,7 @@
 
 	if (switch_event_create(&s_event, SWITCH_EVENT_UNPUBLISH) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "service", "_sip._udp,_sip._tcp,_sip._sctp%s",
-							(sofia_test_pflag(profile, PFLAG_TLS)) ? ",_sips._tcp" : "");
+								(sofia_test_pflag(profile, PFLAG_TLS)) ? ",_sips._tcp" : "");
 
 		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "port", "%d", profile->sip_port);
 		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "module_name", "%s", "mod_sofia");
@@ -782,12 +760,7 @@
 				*context = "default",
 				*expire_seconds = "3600",
 				*retry_seconds = "30",
-				*from_user = "",
-				*from_domain = "",
-				*register_proxy = NULL,
-				*contact_params = NULL,
-				*params = NULL,
-				*register_transport = NULL;
+				*from_user = "", *from_domain = "", *register_proxy = NULL, *contact_params = NULL, *params = NULL, *register_transport = NULL;
 
 			uint32_t ping_freq = 0;
 
@@ -908,7 +881,7 @@
 			if (switch_true(caller_id_in_from)) {
 				switch_set_flag(gateway, REG_FLAG_CALLERID);
 			}
-			register_transport = (char *)sofia_glue_transport2str(gateway->register_transport);
+			register_transport = (char *) sofia_glue_transport2str(gateway->register_transport);
 			if (contact_params) {
 				if (*contact_params == ';') {
 					params = switch_core_sprintf(gateway->pool, "%s&transport=%s", contact_params, register_transport);
@@ -922,8 +895,9 @@
 			gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s;transport=%s", register_proxy, register_transport);
 			gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", from_user, from_domain, register_transport);
 			gateway->register_contact = switch_core_sprintf(gateway->pool, "<sip:%s@%s:%d%s>", extension,
-												 profile->extsipip ? profile->extsipip : profile->sipip,
-												 sofia_glue_transport_has_tls(gateway->register_transport) ? profile->tls_sip_port : profile->sip_port, params);
+															profile->extsipip ? profile->extsipip : profile->sipip,
+															sofia_glue_transport_has_tls(gateway->register_transport) ? profile->tls_sip_port : profile->
+															sip_port, params);
 
 			if (!strncasecmp(proxy, "sip:", 4)) {
 				gateway->register_proxy = switch_core_strdup(gateway->pool, proxy);
@@ -936,8 +910,7 @@
 			gateway->expires_str = switch_core_strdup(gateway->pool, expire_seconds);
 
 			if ((gateway->freq = atoi(gateway->expires_str)) < 5) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-								   "Invalid Freq: %d.  Setting Register-Frequency to 3600\n", gateway->freq);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Freq: %d.  Setting Register-Frequency to 3600\n", gateway->freq);
 				gateway->freq = 3600;
 			}
 			gateway->freq -= 2;
@@ -947,7 +920,7 @@
 			sofia_reg_add_gateway(gateway->name, gateway);
 		}
 
-	skip:
+	  skip:
 		switch_assert(gateway_tag);
 	}
 }
@@ -960,11 +933,10 @@
 		if (sofia_glue_add_profile(switch_core_strdup(profile->pool, dname), profile) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Alias [%s] for profile [%s]\n", dname, profile->name);
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding Alias [%s] for profile [%s] (name in use)\n", 
-							  dname, profile->name);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding Alias [%s] for profile [%s] (name in use)\n", dname, profile->name);
 		}
 	}
-	
+
 	if (switch_true(parse)) {
 		switch_xml_t ut, gateways_tag;
 		for (ut = switch_xml_child(x_domain_tag, "user"); ut; ut = ut->next) {
@@ -985,7 +957,7 @@
 	char url[512] = "";
 	int profile_found = 0;
 	switch_event_t *params = NULL;;
-	
+
 	if (!reload) {
 		su_init();
 		if (sip_update_default_mclass(sip_extend_mclass(NULL)) < 0) {
@@ -1007,7 +979,7 @@
 	switch_event_create(&params, SWITCH_EVENT_MESSAGE);
 	switch_assert(params);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile", profile_name);
-	
+
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, params))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
 		status = SWITCH_STATUS_FALSE;
@@ -1075,7 +1047,7 @@
 				profile->dtmf_duration = 100;
 				profile->tls_version = 0;
 				profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
-				
+
 				for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 					char *var = (char *) switch_xml_attr_soft(param, "name");
 					char *val = (char *) switch_xml_attr_soft(param, "value");
@@ -1095,7 +1067,6 @@
 								*profile->odbc_pass++ = '\0';
 							}
 						}
-
 #else
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
 #endif
@@ -1345,9 +1316,9 @@
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds!\n");
 						}
 
-					/*
-					 * handle TLS params #1
-					 */
+						/*
+						 * handle TLS params #1
+						 */
 					} else if (!strcasecmp(var, "tls")) {
 						if (switch_true(val)) {
 							sofia_set_pflag(profile, PFLAG_TLS);
@@ -1365,7 +1336,7 @@
 						} else {
 							profile->tls_version = 0;
 						}
- 					}
+					}
 				}
 
 				if (!profile->cng_pt) {
@@ -1432,7 +1403,8 @@
 
 					if (profile->extsipip) {
 						profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->extsipip, profile->tls_sip_port);
-						profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d;maddr=%s", profile->extsipip, profile->tls_sip_port, profile->sipip);
+						profile->tls_bindurl =
+							switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d;maddr=%s", profile->extsipip, profile->tls_sip_port, profile->sipip);
 					} else {
 						profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
 						profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
@@ -1464,12 +1436,12 @@
 						const char *dname = switch_xml_attr_soft(domain_tag, "name");
 						const char *parse = switch_xml_attr_soft(domain_tag, "parse");
 						const char *alias = switch_xml_attr_soft(domain_tag, "alias");
-						
-						if (!switch_strlen_zero(dname)) { 
+
+						if (!switch_strlen_zero(dname)) {
 							if (!strcasecmp(dname, "all")) {
 								switch_xml_t xml_root, x_domains;
 								if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, NULL) == SWITCH_STATUS_SUCCESS) {
-									for(x_domain_tag = switch_xml_child(x_domains, "domain"); x_domain_tag; x_domain_tag = x_domain_tag->next) {
+									for (x_domain_tag = switch_xml_child(x_domains, "domain"); x_domain_tag; x_domain_tag = x_domain_tag->next) {
 										dname = switch_xml_attr_soft(x_domain_tag, "name");
 										parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
 									}
@@ -1477,7 +1449,7 @@
 								}
 							} else if (switch_xml_locate_domain(dname, NULL, &droot, &x_domain_tag) == SWITCH_STATUS_SUCCESS) {
 								parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
-								switch_xml_free(droot);									
+								switch_xml_free(droot);
 							}
 						}
 					}
@@ -1491,8 +1463,8 @@
 							if (sofia_glue_add_profile(switch_core_strdup(profile->pool, aname), profile) == SWITCH_STATUS_SUCCESS) {
 								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Alias [%s] for profile [%s]\n", aname, profile->name);
 							} else {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding Alias [%s] for profile [%s] (name in use)\n", 
-												   aname, profile->name);
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding Alias [%s] for profile [%s] (name in use)\n",
+												  aname, profile->name);
 							}
 						}
 					}
@@ -1529,7 +1501,8 @@
 
 static void sofia_handle_sip_r_options(switch_core_session_t *session, int status,
 									   char const *phrase,
-									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+									   nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									   tagi_t tags[])
 {
 	sofia_gateway_t *gateway = NULL;
 
@@ -1559,16 +1532,11 @@
 	} else if ((profile->pflags & PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
 		char *sql;
 		time_t now = switch_timestamp(NULL);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n", 
-						  sip->sip_to->a_url->url_user,
-						  sip->sip_to->a_url->url_host
-						  );
-
-		sql = switch_mprintf("update sip_registrations set expired=%ld where sip_user='%s' and sip_host='%s'", 
-								   (long)now,
-								   sip->sip_to->a_url->url_user,
-								   sip->sip_to->a_url->url_host
-								   );
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n",
+						  sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
+
+		sql = switch_mprintf("update sip_registrations set expired=%ld where sip_user='%s' and sip_host='%s'",
+							 (long) now, sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 	}
 }
@@ -1576,14 +1544,15 @@
 
 static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status,
 									  char const *phrase,
-									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									  tagi_t tags[])
 {
 	if (sip && session) {
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		const char *uuid;
 		switch_core_session_t *other_session;
 		private_object_t *tech_pvt = switch_core_session_get_private(session);
-		
+
 		switch_channel_clear_flag(channel, CF_REQ_MEDIA);
 
 		if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
@@ -1597,14 +1566,14 @@
 			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
 				const char *r_sdp = NULL;
 				switch_core_session_message_t msg = { 0 };
-			
-				if (sip->sip_payload && sip->sip_payload->pl_data && 
+
+				if (sip->sip_payload && sip->sip_payload->pl_data &&
 					sip->sip_content_type && sip->sip_content_type->c_subtype && switch_stristr("sdp", sip->sip_content_type->c_subtype)) {
 					r_sdp = sip->sip_payload->pl_data;
 				}
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
-				
+
 				msg.message_id = SWITCH_MESSAGE_INDICATE_RESPOND;
 				msg.from = __FILE__;
 				msg.numeric_arg = status;
@@ -1640,7 +1609,7 @@
 				astate = "confirmed";
 			}
 
-			if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED) && 
+			if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED) &&
 				!switch_channel_test_flag(channel, CF_RING_READY)) {
 				const char *from_user = "", *from_host = "", *to_user = "", *to_host = "", *contact_user = "", *contact_host = "";
 				const char *user_agent = "", *call_id = "";
@@ -1670,30 +1639,20 @@
 				}
 
 				if (profile->pflags & PFLAG_PRESENCE) {
-					sql = switch_mprintf(
-										 "insert into sip_dialogs values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
+					sql = switch_mprintf("insert into sip_dialogs values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
 										 call_id,
 										 switch_core_session_get_uuid(session),
-										 to_user,
-										 to_host,
-										 from_user,
-										 from_host,
-										 contact_user,
-										 contact_host,
-										 astate,
-										 "outbound",
-										 user_agent
-										 );
+										 to_user, to_host, from_user, from_host, contact_user, contact_host, astate, "outbound", user_agent);
 
 					switch_assert(sql);
-					
+
 					sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 				}
-			} else if (status == 200 && (profile->pflags & PFLAG_PRESENCE)) { 
+			} else if (status == 200 && (profile->pflags & PFLAG_PRESENCE)) {
 				char *sql = NULL;
 				sql = switch_mprintf("update sip_dialogs set state='%s' where uuid='%s';\n", astate, switch_core_session_get_uuid(session));
-				switch_assert(sql); 
-				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); 
+				switch_assert(sql);
+				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 			}
 		}
 	}
@@ -1701,7 +1660,8 @@
 
 static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 									 char const *phrase,
-									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									 tagi_t tags[])
 {
 	const char *l_sdp = NULL, *r_sdp = NULL;
 	int offer_recv = 0, answer_recv = 0, offer_sent = 0, answer_sent = 0;
@@ -1754,8 +1714,8 @@
 		}
 	}
 
- state_process:
-	
+  state_process:
+
 	switch ((enum nua_callstate) ss_state) {
 	case nua_callstate_init:
 		break;
@@ -1837,18 +1797,18 @@
 					switch_set_flag(tech_pvt, TFLAG_SDP);
 					goto done;
 				} else if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
-                    switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
-                    switch_set_flag_locked(tech_pvt, TFLAG_READY);
-                    if (switch_channel_get_state(channel) == CS_NEW) {
-                        switch_channel_set_state(channel, CS_INIT);
-                    }
+					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
+					switch_set_flag_locked(tech_pvt, TFLAG_READY);
+					if (switch_channel_get_state(channel) == CS_NEW) {
+						switch_channel_set_state(channel, CS_INIT);
+					}
 				} else if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
-                    switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
-                    switch_set_flag_locked(tech_pvt, TFLAG_READY);
-                    if (switch_channel_get_state(channel) == CS_NEW) {
-                        switch_channel_set_state(channel, CS_INIT);
-                    }
-                } else {
+					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
+					switch_set_flag_locked(tech_pvt, TFLAG_READY);
+					if (switch_channel_get_state(channel) == CS_NEW) {
+						switch_channel_set_state(channel, CS_INIT);
+					}
+				} else {
 					sdp_parser_t *parser;
 					sdp_session_t *sdp;
 					uint8_t match = 0;
@@ -1861,7 +1821,7 @@
 							sdp_parser_free(parser);
 						}
 					}
-					
+
 					if (match) {
 						nua_handle_t *bnh;
 						sip_replaces_t *replaces;
@@ -1883,11 +1843,11 @@
 								while (switch_channel_get_state(channel) < CS_EXECUTE) {
 									switch_yield(10000);
 								}
-								
+
 								if ((b_private = nua_handle_magic(bnh))) {
 									const char *br_b = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
 									char *br_a = b_private->uuid;
-									
+
 									if (br_b) {
 										switch_ivr_uuid_bridge(br_a, br_b);
 										switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
@@ -1925,10 +1885,7 @@
 								SIPTAG_CONTACT_STR(tech_pvt->profile->url),
 								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 								SOATAG_REUSE_REJECTED(1),
-								SOATAG_ORDERED_USER(1),
-								SOATAG_AUDIO_AUX("cn telephone-event"),
-								NUTAG_INCLUDE_EXTRA_SDP(1),
-								TAG_END());
+								SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
 					goto done;
 				}
 			}
@@ -1943,11 +1900,11 @@
 		break;
 	case nua_callstate_completed:
 		if (tech_pvt && r_sdp) {
-			sdp_parser_t *parser; 
+			sdp_parser_t *parser;
 			sdp_session_t *sdp;
 			uint8_t match = 0;
 
-			if (r_sdp) { 
+			if (r_sdp) {
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 					if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
 						&& (other_session = switch_core_session_locate(uuid))) {
@@ -1960,7 +1917,7 @@
 						if (switch_core_session_receive_message(other_session, &msg) != SWITCH_STATUS_SUCCESS) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Other leg is not available\n");
 							nua_respond(tech_pvt->nh, 403, "Hangup in progress", TAG_END());
-						}					
+						}
 						switch_core_session_rwunlock(other_session);
 					} else {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Re-INVITE to a no-media channel that is not in a bridge.\n");
@@ -1998,10 +1955,7 @@
 							SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 							SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 							SOATAG_REUSE_REJECTED(1),
-							SOATAG_ORDERED_USER(1),
-							SOATAG_AUDIO_AUX("cn telephone-event"),
-							NUTAG_INCLUDE_EXTRA_SDP(1),
-							TAG_END());
+							SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
 			}
 		}
 		break;
@@ -2026,7 +1980,7 @@
 		if (channel) {
 			if (switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
 				switch_set_flag_locked(tech_pvt, TFLAG_ANS);
-                switch_set_flag(tech_pvt, TFLAG_SDP);
+				switch_set_flag(tech_pvt, TFLAG_SDP);
 				switch_channel_mark_answered(channel);
 				if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
 					&& (other_session = switch_core_session_locate(uuid))) {
@@ -2114,12 +2068,12 @@
 				if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) {
 					switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
 				} else {
-                    int cause;
-                    if (tech_pvt->q850_cause) {
-                        cause = tech_pvt->q850_cause;
-                    } else {
-                        cause = sofia_glue_sip_cause_to_freeswitch(status);
-                    }
+					int cause;
+					if (tech_pvt->q850_cause) {
+						cause = tech_pvt->q850_cause;
+					} else {
+						cause = sofia_glue_sip_cause_to_freeswitch(status);
+					}
 					if (status) {
 						switch_snprintf(st, sizeof(st), "%d", status);
 						switch_channel_set_variable(channel, "sip_term_status", st);
@@ -2131,14 +2085,14 @@
 					switch_channel_hangup(channel, cause);
 				}
 			}
-			
+
 			if (tech_pvt->sofia_private) {
 				sofia_private = tech_pvt->sofia_private;
 				tech_pvt->sofia_private = NULL;
 				sofia_private->destroy_me = 1;
 			}
 
-			tech_pvt->nh = NULL;		
+			tech_pvt->nh = NULL;
 
 
 		} else if (sofia_private) {
@@ -2183,11 +2137,11 @@
 
 	from = sip->sip_from;
 	to = sip->sip_to;
-	
+
 	home = su_home_new(sizeof(*home));
 	switch_assert(home != NULL);
 
-	if (sip->sip_referred_by) {		
+	if (sip->sip_referred_by) {
 		full_ref_by = sip_header_as_string(home, (void *) sip->sip_referred_by);
 	}
 
@@ -2206,13 +2160,12 @@
 			sip_replaces_t *replaces;
 			nua_handle_t *bnh;
 			char *rep;
-			
+
 			if (switch_channel_test_flag(channel_a, CF_PROXY_MODE)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Attended Transfer BYPASS MEDIA CALLS!\n");
 				switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
 				nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-						   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp),
-						   TAG_END());
+						   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
 				goto done;
 			}
 
@@ -2235,7 +2188,7 @@
 					sofia_private_t *b_private = NULL;
 					private_object_t *b_tech_pvt = NULL;
 					switch_core_session_t *b_session = NULL;
-					
+
 
 					switch_channel_set_variable(channel_a, SOFIA_REPLACES_HEADER, rep);
 					if ((b_private = nua_handle_magic(bnh))) {
@@ -2247,12 +2200,13 @@
 
 						br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE);
 						br_b = switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE);
-						
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", switch_str_nil(br_a), switch_str_nil(br_b));
+
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", switch_str_nil(br_a),
+										  switch_str_nil(br_b));
 
 						if (br_a && br_b) {
 							switch_core_session_t *new_b_session = NULL, *a_session = NULL;
-								
+
 							switch_ivr_uuid_bridge(br_b, br_a);
 							switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
 							nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
@@ -2277,12 +2231,10 @@
 								b_tech_pvt->xferto = switch_core_session_strdup(b_session, switch_core_session_get_uuid(session));
 								switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 								nua_notify(tech_pvt->nh,
-											NUTAG_NEWSUB(1),
-											SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-											NUTAG_SUBSTATE(nua_substate_terminated),
-											SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"),
-											SIPTAG_EVENT_STR(etmp),
-											TAG_END());
+										   NUTAG_NEWSUB(1),
+										   SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+										   NUTAG_SUBSTATE(nua_substate_terminated),
+										   SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
 							} else {
 								switch_core_session_t *t_session;
 								switch_channel_t *hup_channel;
@@ -2311,15 +2263,13 @@
 									if (!switch_strlen_zero(full_ref_to)) {
 										switch_channel_set_variable(t_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
 									}
-									
+
 									switch_ivr_session_transfer(t_session, ext, NULL, NULL);
 									nua_notify(tech_pvt->nh,
-												NUTAG_NEWSUB(1),
-												SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-												NUTAG_SUBSTATE(nua_substate_terminated),
-												SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"),
-												SIPTAG_EVENT_STR(etmp),
-												TAG_END());
+											   NUTAG_NEWSUB(1),
+											   SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+											   NUTAG_SUBSTATE(nua_substate_terminated),
+											   SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
 									switch_core_session_rwunlock(t_session);
 									switch_channel_hangup(hup_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
 								} else {
@@ -2356,13 +2306,9 @@
 								port = "5060";
 							}
 							channel = switch_core_session_get_channel(a_session);
-							
-							exten = switch_mprintf("sofia/%s/%s@%s:%s",
-												   profile->name,
-												   refer_to->r_url->url_user,
-												   refer_to->r_url->url_host,
-												   port);
-							
+
+							exten = switch_mprintf("sofia/%s/%s@%s:%s", profile->name, refer_to->r_url->url_user, refer_to->r_url->url_host, port);
+
 							switch_channel_set_variable(channel, SOFIA_REPLACES_HEADER, rep);
 							if (!switch_strlen_zero(full_ref_by)) {
 								switch_channel_set_variable(channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
@@ -2370,20 +2316,19 @@
 							if (!switch_strlen_zero(full_ref_to)) {
 								switch_channel_set_variable(channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
 							}
-							status = switch_ivr_originate(a_session,
-														  &tsession, &cause, exten, timeout, &noop_state_handler, NULL, NULL, NULL, SOF_NONE);
+							status = switch_ivr_originate(a_session, &tsession, &cause, exten, timeout, &noop_state_handler, NULL, NULL, NULL, SOF_NONE);
 
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! [%s]\n", exten);
 							nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("messsage/sipfrag"),
 									   NUTAG_SUBSTATE(nua_substate_terminated),
 									   SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
-							
+
 							switch_core_session_rwunlock(a_session);
 
 							if (status != SWITCH_STATUS_SUCCESS) {
 								goto done;
 							}
-							
+
 							tuuid_str = switch_core_session_get_uuid(tsession);
 							switch_ivr_uuid_bridge(br_a, tuuid_str);
 							switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
@@ -2421,7 +2366,7 @@
 
 		if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
 			switch_core_session_t *b_session;
-			
+
 			if ((b_session = switch_core_session_locate(br))) {
 				switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
 				switch_channel_set_variable(channel, "transfer_fallback_extension", from->a_user);
@@ -2440,17 +2385,13 @@
 
 			switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "BLIND_TRANSFER");
 			nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-			   NUTAG_SUBSTATE(nua_substate_terminated),
-			   SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"),
-			   SIPTAG_EVENT_STR(etmp),
-			   TAG_END());
-			 
+					   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
+
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Blind Transfer 1 Legged calls\n");
 			switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
 			nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-					   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp),
-					   TAG_END());
+					   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
 		}
 	}
 
@@ -2475,7 +2416,7 @@
 	const char *rec_header;
 	const char *clientcode_header;
 	switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
-	
+
 	if (session) {
 		/* Get the channel */
 		switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -2483,7 +2424,7 @@
 		/* Barf if we didn't get our private */
 		assert(switch_core_session_get_private(session));
 
-		if (sip && sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_content_type->c_subtype && 
+		if (sip && sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_content_type->c_subtype &&
 			sip->sip_payload && sip->sip_payload->pl_data) {
 			if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf-relay")) {
 				/* Try and find signal information in the payload */
@@ -2501,7 +2442,7 @@
 					signal_ptr += 9;
 					if ((tmp = atoi(signal_ptr)) <= 0) {
 						tmp = switch_core_default_dtmf_duration(0);
-					} 
+					}
 					dtmf.duration = tmp * 8;
 				}
 			} else if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf")) {
@@ -2509,7 +2450,7 @@
 			} else {
 				goto fail;
 			}
-		
+
 			if (dtmf.digit) {
 				/* queue it up */
 				switch_channel_queue_dtmf(channel, &dtmf);
@@ -2519,7 +2460,7 @@
 
 				/* Send 200 OK response */
 				nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
-	
+
 				return;
 			} else {
 				goto fail;
@@ -2571,7 +2512,7 @@
 	}
 	return;
 
- fail:
+  fail:
 	nua_respond(nh, 488, "Unsupported Request", NUTAG_WITH_THIS(nua), TAG_END());
 }
 
@@ -2664,7 +2605,7 @@
 		nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
 		return;
 	}
-	
+
 	get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
 	network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
 
@@ -2672,7 +2613,7 @@
 		if (sip && sip->sip_via) {
 			const char *port = sip->sip_via->v_port;
 			const char *host = sip->sip_via->v_host;
-			
+
 			if (host && sip->sip_via->v_received) {
 				is_nat = "via received";
 			} else if (host && strcmp(network_ip, host)) {
@@ -2694,13 +2635,13 @@
 		}
 
 		if (!switch_strlen_zero(contact_host)) {
-			for (x = 0 ; x < profile->nat_acl_count; x++) {
+			for (x = 0; x < profile->nat_acl_count; x++) {
 				last_acl = profile->nat_acl[x];
 				if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
 					break;
 				}
 			}
-			
+
 			if (ok) {
 				is_nat = last_acl;
 			}
@@ -2712,7 +2653,7 @@
 		int ok = 1;
 		char *last_acl = NULL;
 
-		for (x = 0 ; x < profile->acl_count; x++) {
+		for (x = 0; x < profile->acl_count; x++) {
 			last_acl = profile->acl[x];
 			if (!(ok = switch_check_network_list_ip(network_ip, last_acl))) {
 				break;
@@ -2721,7 +2662,7 @@
 
 		if (ok) {
 			if ((profile->pflags & PFLAG_AUTH_CALLS)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl %s. Access Granted.\n", 
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl %s. Access Granted.\n",
 								  network_ip, switch_str_nil(last_acl));
 				is_auth = 1;
 			}
@@ -2731,13 +2672,13 @@
 				nua_respond(nh, SIP_403_FORBIDDEN, TAG_END());
 				return;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Rejected by acl %s. Falling back to Digest auth.\n", 
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Rejected by acl %s. Falling back to Digest auth.\n",
 								  network_ip, switch_str_nil(last_acl));
 			}
 		}
 	}
-	
-	if (!is_auth && 
+
+	if (!is_auth &&
 		((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
 		if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
 			calling_myself++;
@@ -2780,10 +2721,8 @@
 
 	if (sip->sip_contact && sip->sip_contact->m_url) {
 		char tmp[35] = "";
-		tech_pvt->record_route = switch_core_session_sprintf(session, "sip:%s@%s:%d", 
-															 sip->sip_contact->m_url->url_user, 
-															 tech_pvt->remote_ip,
-															 tech_pvt->remote_port);
+		tech_pvt->record_route = switch_core_session_sprintf(session, "sip:%s@%s:%d",
+															 sip->sip_contact->m_url->url_user, tech_pvt->remote_ip, tech_pvt->remote_port);
 		switch_channel_set_variable(channel, "sip_received_ip", tech_pvt->remote_ip);
 		snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_port);
 		switch_channel_set_variable(channel, "sip_received_port", tmp);
@@ -2793,7 +2732,7 @@
 		tech_pvt->key = switch_core_session_strdup(session, key);
 	}
 
-	
+
 	if (is_auth) {
 		switch_channel_set_variable(channel, "sip_authorized", "true");
 	}
@@ -2804,8 +2743,8 @@
 
 	if (v_event) {
 		switch_event_header_t *hp;
-		
-		for(hp = v_event->headers; hp; hp = hp->next) {
+
+		for (hp = v_event->headers; hp; hp = hp->next) {
 			switch_channel_set_variable(channel, hp->name, hp->value);
 		}
 		switch_event_destroy(&v_event);
@@ -2901,7 +2840,7 @@
 
 			host = switch_channel_get_variable(channel, "sip_to_host");
 			user = switch_channel_get_variable(channel, "sip_to_user");
-		
+
 			switch_channel_set_variable(channel, "sip_to_comment", sip->sip_to->a_comment);
 
 			if (sip->sip_to->a_params) {
@@ -2914,8 +2853,7 @@
 				port = sofia_glue_transport_has_tls(transport) ? profile->tls_sip_port : profile->sip_port;
 			}
 
-			tech_pvt->to_uri = switch_core_session_sprintf(session, "sip:%s@%s:%d;transport=%s",
-						 user, host, port, sofia_glue_transport2str(transport));
+			tech_pvt->to_uri = switch_core_session_sprintf(session, "sip:%s@%s:%d;transport=%s", user, host, port, sofia_glue_transport2str(transport));
 
 			if (profile->ndlb & PFLAG_NDLB_TO_IN_200_CONTACT) {
 				if (strchr(tech_pvt->to_uri, '>')) {
@@ -3001,8 +2939,8 @@
 	if (sip->sip_subject && sip->sip_subject->g_string) {
 		switch_channel_set_variable(channel, "sip_subject", sip->sip_subject->g_string);
 	}
-	
-	if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)){
+
+	if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
 		switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
 	}
 
@@ -3074,10 +3012,7 @@
 	tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
 														 from_user,
 														 dialplan,
-														 displayname,
-														 from_user,
-														 network_ip,
-														 NULL, NULL, NULL, MODNAME, context, destination_number);
+														 displayname, from_user, network_ip, NULL, NULL, NULL, MODNAME, context, destination_number);
 
 	if (tech_pvt->caller_profile) {
 
@@ -3095,8 +3030,8 @@
 					switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
 					switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NUMBER);
 				}
-			} 
-			
+			}
+
 			if (rpid->rpid_screen && !strcasecmp(rpid->rpid_screen, "no")) {
 				switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_SCREEN);
 			}
@@ -3133,7 +3068,7 @@
 	}
 	memset(sofia_private, 0, sizeof(*sofia_private));
 	tech_pvt->sofia_private = sofia_private;
-	
+
 	if ((profile->pflags & PFLAG_PRESENCE)) {
 		sofia_presence_set_chat_hash(tech_pvt, sip);
 	}
@@ -3183,21 +3118,11 @@
 
 		if (profile->pflags & PFLAG_PRESENCE) {
 
-			sql = switch_mprintf(
-								 "insert into sip_dialogs values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
+			sql = switch_mprintf("insert into sip_dialogs values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
 								 call_id,
 								 tech_pvt->sofia_private->uuid,
-								 to_user,
-								 to_host,
-								 dialog_from_user,
-								 dialog_from_host,
-								 contact_user,
-								 contact_host,
-								 "confirmed",
-								 "inbound",
-								 user_agent
-								 );
-			
+								 to_user, to_host, dialog_from_user, dialog_from_host, contact_user, contact_host, "confirmed", "inbound", user_agent);
+
 			switch_assert(sql);
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 		}
@@ -3207,7 +3132,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting NAT mode based on %s\n", is_nat);
 			switch_channel_set_variable(channel, "sip_nat_detected", "true");
 		}
-		
+
 		return;
 	}
 
@@ -3218,8 +3143,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "LUKE'S VOICE: Artoo, see what you can do with it. Hang on back there....\n"
 						  "Green laserfire moves past the beeping little robot as his head turns.  "
 						  "After a few beeps and a twist of his mechanical arm,\n"
-						  "Artoo reduces the max sessions to %d thus, saving the switch from certian doom.\n", 
-						  sess_count - 10);
+						  "Artoo reduces the max sessions to %d thus, saving the switch from certian doom.\n", sess_count - 10);
 
 		switch_mutex_unlock(profile->flag_mutex);
 	}
@@ -3235,12 +3159,10 @@
 }
 
 void sofia_handle_sip_i_options(int status,
-						  char const *phrase,
-						  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+								char const *phrase,
+								nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
 {
-	nua_respond(nh, SIP_200_OK,
-				NUTAG_WITH_THIS(nua),
-				TAG_END());
+	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
 }
 
 static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)
@@ -3251,7 +3173,7 @@
 	if (aleg && bleg && switch_core_session_compare(aleg, bleg)) {
 		a_tech_pvt = (private_object_t *) switch_core_session_get_private(aleg);
 		b_tech_pvt = (private_object_t *) switch_core_session_get_private(bleg);
-		
+
 		if (b_tech_pvt && a_tech_pvt && a_tech_pvt->caller_profile) {
 			switch_caller_profile_t *acp = a_tech_pvt->caller_profile;
 
@@ -3294,27 +3216,27 @@
 	char var1[] = "sip_";
 	char *cp, *sh, *sh_end, *sh_save;
 
-	/* Build the static part of the sip_header_name variable from	*/
-	/* the header_type. If the header type is "referred_by" then	*/
-	/* sip_header_name = "sip_referred_by_".			*/
+	/* Build the static part of the sip_header_name variable from   */
+	/* the header_type. If the header type is "referred_by" then    */
+	/* sip_header_name = "sip_referred_by_".            */
 	sh = sip_header_name;
 	sh_end = sh + sizeof(sip_header_name) - 1;
-	for (cp=var1; *cp; cp++, sh++) {
+	for (cp = var1; *cp; cp++, sh++) {
 		*sh = *cp;
 	}
 	*sh = '\0';
 
-	/* Copy the header_type to the sip_header_name. Before copying 	*/
+	/* Copy the header_type to the sip_header_name. Before copying  */
 	/* each character, check that we aren't going to overflow the   */
-	/* the sip_header_name buffer.  We have to account for the 	*/
-	/* trailing underscore and NULL that will be added to the end.	*/
-	for (cp=header_type; (*cp && (sh < (sh_end-1))); cp++, sh++) {
+	/* the sip_header_name buffer.  We have to account for the  */
+	/* trailing underscore and NULL that will be added to the end.  */
+	for (cp = header_type; (*cp && (sh < (sh_end - 1))); cp++, sh++) {
 		*sh = *cp;
 	}
 	*sh++ = '_';
 	*sh = '\0';
 
-	/* sh now points to the NULL at the end of the partially built	*/
+	/* sh now points to the NULL at the end of the partially built  */
 	/* sip_header_name variable.  This is also the start of the     */
 	/* variable part of the sip_header_name built from the lvalue   */
 	/* of the parms data.                                           */
@@ -3322,21 +3244,21 @@
 
 	while (params && params[0]) {
 
-		/* Copy the params data to the sip_header_name variable until	*/
-		/* the end of the params string is reached, an '=' is detected	*/
-		/* or until the sip_header_name buffer has been exhausted.	*/
-		for (cp=(char *)(*params); ((*cp != '=') && *cp && (sh < sh_end)); cp++, sh++) {
+		/* Copy the params data to the sip_header_name variable until   */
+		/* the end of the params string is reached, an '=' is detected  */
+		/* or until the sip_header_name buffer has been exhausted.  */
+		for (cp = (char *) (*params); ((*cp != '=') && *cp && (sh < sh_end)); cp++, sh++) {
 			*sh = *cp;
 		}
 
-		/* cp now points to either the end of the parms data or the	*/
-		/* equal (=) sign spearating the lvalue and rvalue.		*/
+		/* cp now points to either the end of the parms data or the */
+		/* equal (=) sign spearating the lvalue and rvalue.     */
 		if (*cp == '=')
-			cp++;	
+			cp++;
 		*sh = '\0';
 		switch_channel_set_variable(channel, sip_header_name, cp);
 
-		/* Bump pointer to next param in the list.  Also reset the	*/
+		/* Bump pointer to next param in the list.  Also reset the  */
 		/* sip_header_name pointer to the beginning of the dynamic area */
 		params++;
 		sh = sh_save;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Tue May 27 00:54:52 2008
@@ -47,12 +47,13 @@
 	const char *pass_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_video_fmtp");
 	const char *ov_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_force_video_fmtp");
 
-	if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPRESS_CNG) || 
+	if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPRESS_CNG) ||
 		((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val))) {
 		use_cng = 0;
 	}
 
-	if (!force && !ip && !sr && (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA))) {
+	if (!force && !ip && !sr
+		&& (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA))) {
 		return;
 	}
 
@@ -76,21 +77,20 @@
 	}
 
 	if (!tech_pvt->session_id) {
-		tech_pvt->session_id = tech_pvt->owner_id ;
+		tech_pvt->session_id = tech_pvt->owner_id;
 	}
 
 	tech_pvt->session_id++;
-	
+
 	switch_snprintf(buf, sizeof(buf),
 					"v=0\n"
 					"o=FreeSWITCH %010u %010u IN IP4 %s\n"
-					"s=FreeSWITCH\n" 
-					"c=IN IP4 %s\n" "t=0 0\n" 
-					"a=%s\n" 
+					"s=FreeSWITCH\n"
+					"c=IN IP4 %s\n" "t=0 0\n"
+					"a=%s\n"
 					"m=audio %d RTP/%sAVP", tech_pvt->owner_id, tech_pvt->session_id, ip, ip, sr, port,
-					(!switch_strlen_zero(tech_pvt->local_crypto_key) && switch_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : ""
-					);
-	
+					(!switch_strlen_zero(tech_pvt->local_crypto_key) && switch_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : "");
+
 
 	if (tech_pvt->rm_encoding) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
@@ -103,7 +103,7 @@
 			if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) {
 				continue;
 			}
-			
+
 			if (imp->ianacode < 128) {
 				if (already_did[imp->ianacode]) {
 					continue;
@@ -122,7 +122,7 @@
 	if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
 	}
-	
+
 	if (tech_pvt->cng_pt && use_cng) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
 	}
@@ -154,12 +154,12 @@
 				if (already_did[imp->ianacode]) {
 					continue;
 				}
-				
+
 				already_did[imp->ianacode] = 1;
 			}
-			
+
 			rate = imp->samples_per_second;
-			
+
 			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rate);
 			if (imp->fmtp) {
 				switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
@@ -188,7 +188,7 @@
 		//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
 #if 0
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=audio %d RTP/AVP", port);
-		
+
 		if (tech_pvt->rm_encoding) {
 			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
 		} else if (tech_pvt->num_codecs) {
@@ -196,16 +196,16 @@
 			int already_did[128] = { 0 };
 			for (i = 0; i < tech_pvt->num_codecs; i++) {
 				const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
-				
+
 				if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) {
 					continue;
 				}
-				
+
 				if (imp->ianacode < 128) {
 					if (already_did[imp->ianacode]) {
 						continue;
 					}
-					
+
 					already_did[imp->ianacode] = 1;
 				}
 
@@ -218,14 +218,14 @@
 	}
 
 	if (switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
-		if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && !switch_channel_test_flag(tech_pvt->channel, CF_EARLY_MEDIA) && 
+		if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && !switch_channel_test_flag(tech_pvt->channel, CF_EARLY_MEDIA) &&
 			!tech_pvt->local_sdp_video_port) {
 			sofia_glue_tech_choose_video_port(tech_pvt, 0);
 		}
 
 		if ((v_port = tech_pvt->adv_sdp_video_port)) {
 			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
-			
+
 			/*****************************/
 			if (tech_pvt->video_rm_encoding) {
 				sofia_glue_tech_set_video_codec(tech_pvt, 0);
@@ -235,18 +235,18 @@
 				int already_did[128] = { 0 };
 				for (i = 0; i < tech_pvt->num_codecs; i++) {
 					const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
-				
+
 					if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
 						continue;
 					}
-				
+
 					if (imp->ianacode < 128) {
 						if (already_did[imp->ianacode]) {
 							continue;
 						}
 						already_did[imp->ianacode] = 1;
 					}
-					
+
 					switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
 					if (!ptime) {
 						ptime = imp->microseconds_per_frame / 1000;
@@ -259,16 +259,17 @@
 			if (tech_pvt->video_rm_encoding) {
 				const char *of;
 				rate = tech_pvt->video_rm_rate;
-				switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate);
-				
+				switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding,
+								tech_pvt->video_rm_rate);
+
 				pass_fmtp = NULL;
 
 				if (switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
 					if ((of = switch_channel_get_variable_partner(tech_pvt->channel, "sip_video_fmtp"))) {
 						pass_fmtp = of;
 					}
-				} 
-				
+				}
+
 				if (ov_fmtp) {
 					pass_fmtp = ov_fmtp;
 				}
@@ -283,7 +284,7 @@
 
 				for (i = 0; i < tech_pvt->num_codecs; i++) {
 					const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
-				
+
 					if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
 						continue;
 					}
@@ -294,12 +295,13 @@
 						}
 						already_did[imp->ianacode] = 1;
 					}
-					
+
 					if (!rate) {
 						rate = imp->samples_per_second;
 					}
 
-					switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, imp->samples_per_second);
+					switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame,
+									imp->samples_per_second);
 					if (imp->fmtp) {
 						switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
 					} else {
@@ -338,7 +340,7 @@
 				codec_string = tech_pvt->profile->codec_string;
 			}
 		}
-		
+
 		if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
 			if (!codec_string || (tech_pvt->profile->pflags & PFLAG_DISABLE_TRANSCODING)) {
 				codec_string = ocodec;
@@ -349,7 +351,7 @@
 			}
 		}
 	}
-	
+
 	if (codec_string) {
 		char *tmp_codec_string;
 		if ((tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string))) {
@@ -358,14 +360,13 @@
 				switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, SWITCH_MAX_CODECS, tech_pvt->codec_order, tech_pvt->codec_order_last);
 		}
 	} else {
-		tech_pvt->num_codecs =
-			switch_loadable_module_get_codecs(tech_pvt->codecs, sizeof(tech_pvt->codecs) / sizeof(tech_pvt->codecs[0]));
+		tech_pvt->num_codecs = switch_loadable_module_get_codecs(tech_pvt->codecs, sizeof(tech_pvt->codecs) / sizeof(tech_pvt->codecs[0]));
 	}
- 
+
 
 }
 
-void sofia_glue_check_video_codecs(private_object_t *tech_pvt) 
+void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
 {
 	if (tech_pvt->num_codecs && !switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
 		int i;
@@ -481,7 +482,7 @@
 	char tmp[50];
 
 	if (!force) {
-		if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || 
+		if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) ||
 			switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) || tech_pvt->adv_sdp_audio_port) {
 			return SWITCH_STATUS_SUCCESS;
 		}
@@ -521,9 +522,10 @@
 	char *ip = tech_pvt->profile->rtpip;
 	switch_port_t sdp_port;
 	char tmp[50];
-	
+
 	if (!force) {
-		if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) || tech_pvt->local_sdp_video_port) {
+		if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)
+			|| tech_pvt->local_sdp_video_port) {
 			return SWITCH_STATUS_SUCCESS;
 		}
 	}
@@ -537,7 +539,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 	sdp_port = tech_pvt->local_sdp_video_port;
-	
+
 
 	if (tech_pvt->profile->extrtpip) {
 		if (sofia_glue_ext_address_lookup(&ip, &sdp_port, tech_pvt->profile->extrtpip, switch_core_session_get_pool(tech_pvt->session)) !=
@@ -559,26 +561,23 @@
 {
 	if (!strncasecmp(str, "udp", 3)) {
 		return SOFIA_TRANSPORT_UDP;
-	}
-	else if (!strncasecmp(str, "tcp", 3)) {
+	} else if (!strncasecmp(str, "tcp", 3)) {
 		return SOFIA_TRANSPORT_TCP;
-	}
-	else if (!strncasecmp(str, "sctp", 4)) {
+	} else if (!strncasecmp(str, "sctp", 4)) {
 		return SOFIA_TRANSPORT_SCTP;
-	}
-	else if (!strncasecmp(str, "tls", 3)) {
+	} else if (!strncasecmp(str, "tls", 3)) {
 		return SOFIA_TRANSPORT_TCP_TLS;
 	}
 
 	return SOFIA_TRANSPORT_UNKNOWN;
 }
 
-char * sofia_glue_find_parameter(const char *str, const char *param)
+char *sofia_glue_find_parameter(const char *str, const char *param)
 {
 	char *ptr = NULL;
 
-	ptr = (char *)str;
-	while(ptr) {
+	ptr = (char *) str;
+	while (ptr) {
 		if (!strncasecmp(ptr, param, strlen(param)))
 			return ptr;
 
@@ -625,14 +624,11 @@
 
 		if (!strncasecmp(ptr, "udp", 3)) {
 			return SOFIA_TRANSPORT_UDP;
-		}
-		else if (!strncasecmp(ptr, "tcp", 3)) {
+		} else if (!strncasecmp(ptr, "tcp", 3)) {
 			return SOFIA_TRANSPORT_TCP;
-		}
-		else if (!strncasecmp(ptr, "tls", 3)) {
+		} else if (!strncasecmp(ptr, "tls", 3)) {
 			return SOFIA_TRANSPORT_TCP_TLS;
-		}
-		else if (!strncasecmp(ptr, "sctp", 4)) {
+		} else if (!strncasecmp(ptr, "sctp", 4)) {
 			return SOFIA_TRANSPORT_SCTP;
 		}
 	}
@@ -642,7 +638,7 @@
 
 const char *sofia_glue_transport2str(const sofia_transport_t tp)
 {
-	switch(tp) {
+	switch (tp) {
 	case SOFIA_TRANSPORT_TCP:
 		return "tcp";
 
@@ -659,7 +655,7 @@
 
 int sofia_glue_transport_has_tls(const sofia_transport_t tp)
 {
-	switch(tp) {
+	switch (tp) {
 	case SOFIA_TRANSPORT_TCP_TLS:
 		return 1;
 
@@ -668,7 +664,8 @@
 	}
 }
 
-char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only, const char *params)
+char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only,
+									  const char *params)
 {
 	char *stripped = switch_core_session_strdup(session, uri);
 	char *new_uri = NULL;
@@ -679,7 +676,7 @@
 		if (switch_stristr("port=", stripped)) {
 			new_uri = switch_core_session_sprintf(session, "%s%s%s", uri_only ? "" : "<", stripped, uri_only ? "" : ">");
 		} else {
-			
+
 			if (strchr(stripped, ';')) {
 				if (params) {
 					new_uri = switch_core_session_sprintf(session, "%s%s&transport=%s;%s%s",
@@ -690,10 +687,10 @@
 				}
 			} else {
 				if (params) {
-					new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s;%s%s", 
+					new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s;%s%s",
 														  uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), params, uri_only ? "" : ">");
 				} else {
-					new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s%s", 
+					new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s%s",
 														  uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), uri_only ? "" : ">");
 				}
 			}
@@ -705,11 +702,11 @@
 			new_uri = stripped;
 		}
 	}
-	
+
 	return new_uri;
 }
 
-switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt) 
+switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
 {
 	const char *err;
 	char rip[128] = "";
@@ -722,39 +719,39 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if ((p = (char *)switch_stristr("c=IN IP4 ", tech_pvt->remote_sdp_str))) {
+	if ((p = (char *) switch_stristr("c=IN IP4 ", tech_pvt->remote_sdp_str))) {
 		ip_ptr = p + 9;
 	}
 
-	if ((p = (char *)switch_stristr("m=audio ", tech_pvt->remote_sdp_str))) {
+	if ((p = (char *) switch_stristr("m=audio ", tech_pvt->remote_sdp_str))) {
 		port_ptr = p + 8;
 	}
 
-	if ((p = (char *)switch_stristr("m=video ", tech_pvt->remote_sdp_str))) {
+	if ((p = (char *) switch_stristr("m=video ", tech_pvt->remote_sdp_str))) {
 		vid_port_ptr = p + 8;
 	}
-	
+
 	if (!(ip_ptr && port_ptr)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
 	p = ip_ptr;
 	x = 0;
-	while(x < sizeof(rip) && p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
+	while (x < sizeof(rip) && p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
 		rip[x++] = *p;
 		p++;
 	}
 
 	p = port_ptr;
 	x = 0;
-	while(x < sizeof(rp) && p && *p && (*p >= '0' && *p <= '9')) {
+	while (x < sizeof(rp) && p && *p && (*p >= '0' && *p <= '9')) {
 		rp[x++] = *p;
 		p++;
 	}
 
 	p = vid_port_ptr;
 	x = 0;
-	while(x < sizeof(rvp) && p && *p && (*p >= '0' && *p <= '9')) {
+	while (x < sizeof(rvp) && p && *p && (*p >= '0' && *p <= '9')) {
 		rvp[x++] = *p;
 		p++;
 	}
@@ -769,10 +766,10 @@
 		tech_pvt->remote_sdp_video_ip = switch_core_session_strdup(tech_pvt->session, rip);
 		tech_pvt->remote_sdp_video_port = (switch_port_t) atoi(rvp);
 	}
-	
+
 	if (tech_pvt->remote_sdp_video_ip && tech_pvt->remote_sdp_video_port) {
 		if (!strcmp(tech_pvt->remote_sdp_video_ip, rip) && atoi(rvp) == tech_pvt->remote_sdp_video_port) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote video address:port [%s:%d] has not changed.\n", 
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote video address:port [%s:%d] has not changed.\n",
 							  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
 		} else {
 			switch_set_flag_locked(tech_pvt, TFLAG_VIDEO);
@@ -792,7 +789,7 @@
 	}
 
 	if (tech_pvt->remote_sdp_audio_ip && !strcmp(tech_pvt->remote_sdp_audio_ip, rip) && atoi(rp) == tech_pvt->remote_sdp_audio_port) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n", 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n",
 						  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -808,7 +805,7 @@
 			switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -824,8 +821,8 @@
 	}
 
 	len = strlen(tech_pvt->local_sdp_str) + 384;
-	
-	if ((p = (char *)switch_stristr("c=IN IP4 ", tech_pvt->local_sdp_str))) {
+
+	if ((p = (char *) switch_stristr("c=IN IP4 ", tech_pvt->local_sdp_str))) {
 		ip_ptr = p + 9;
 	}
 
@@ -834,16 +831,16 @@
 		return;
 	}
 
-	if ((p = (char *)switch_stristr("m=audio ", tech_pvt->local_sdp_str))) {
+	if ((p = (char *) switch_stristr("m=audio ", tech_pvt->local_sdp_str))) {
 		port_ptr = p + 8;
 	}
 
-	if ((p = (char *)switch_stristr("m=video ", tech_pvt->local_sdp_str))) {
+	if ((p = (char *) switch_stristr("m=video ", tech_pvt->local_sdp_str))) {
 		vport_ptr = p + 8;
 	}
-	
+
 	if (!(ip_ptr && port_ptr)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n", 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n",
 						  switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
 		return;
 	}
@@ -867,7 +864,7 @@
 
 	tech_pvt->orig_local_sdp_str = tech_pvt->local_sdp_str;
 	tech_pvt->local_sdp_str = switch_core_session_alloc(tech_pvt->session, len);
-	
+
 	q = tech_pvt->local_sdp_str;
 	p = tech_pvt->orig_local_sdp_str;
 
@@ -876,36 +873,36 @@
 			strncpy(q, tech_pvt->adv_sdp_audio_ip, strlen(tech_pvt->adv_sdp_audio_ip));
 			q += strlen(tech_pvt->adv_sdp_audio_ip);
 			x = 0;
-			while(p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
+			while (p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
 				p++;
 			}
 
 		} else if (p == port_ptr) {
 			char port_buf[25] = "";
-			
+
 			switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_audio_port);
 			strncpy(q, port_buf, strlen(port_buf));
 			q += strlen(port_buf);
 			x = 0;
-			while(p && *p && (*p >= '0' && *p <= '9')) {
+			while (p && *p && (*p >= '0' && *p <= '9')) {
 				p++;
 			}
-		} else if (vport_ptr && tech_pvt->adv_sdp_video_port &&  p == vport_ptr) {
+		} else if (vport_ptr && tech_pvt->adv_sdp_video_port && p == vport_ptr) {
 			char port_buf[25] = "";
-			
+
 			switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_video_port);
 			strncpy(q, port_buf, strlen(port_buf));
 			q += strlen(port_buf);
 			x = 0;
-			while(p && *p && (*p >= '0' && *p <= '9')) {
+			while (p && *p && (*p >= '0' && *p <= '9')) {
 				p++;
 			}
 		}
 
 		*q++ = *p++;
 	}
-	
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Patched SDP\n---\n%s\n+++\n%s\n", 
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Patched SDP\n---\n%s\n+++\n%s\n",
 					  switch_channel_get_name(tech_pvt->channel), tech_pvt->orig_local_sdp_str, tech_pvt->local_sdp_str);
 }
 
@@ -1014,9 +1011,9 @@
 		 * since all of them have been already taken care of in mod_sofia.c:sofia_outgoing_channel()
 		 */
 		if (tech_pvt->transport == SOFIA_TRANSPORT_UNKNOWN && switch_strlen_zero(tech_pvt->gateway_name)) {
-			if ((p = (char *)switch_stristr("port=", url))) {
+			if ((p = (char *) switch_stristr("port=", url))) {
 				p += 5;
-				tech_pvt->transport = sofia_glue_str2transport( p );
+				tech_pvt->transport = sofia_glue_str2transport(p);
 			} else {
 				if ((t_var = switch_channel_get_variable(channel, "sip_transport"))) {
 					tech_pvt->transport = sofia_glue_str2transport(t_var);
@@ -1045,23 +1042,19 @@
 		invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, NULL);
 		from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, 0, SWITCH_FALSE, NULL);
 		to_str = sofia_overcome_sip_uri_weakness(session, tech_pvt->dest_to, 0, SWITCH_FALSE, invite_params);
-												 
+
 
 		/*
 		   Does the "genius" who wanted SIP to be "text-based" so it was "easier to read" even use it now,
 		   or did he just suggest it to make our lives miserable?
-		*/
+		 */
 		use_from_str = from_str;
 		from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", tech_pvt->caller_profile->caller_id_name, use_from_str);
 
 		tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,
-								  NUTAG_URL(url_str),
-								  SIPTAG_TO_STR(to_str),
-								  SIPTAG_FROM_STR(from_str),
-								  SIPTAG_CONTACT_STR(invite_contact),
-								  TAG_END());
+								  NUTAG_URL(url_str), SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END());
+
 
-		
 		if (strstr(tech_pvt->dest, ";nat") || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
 			switch_set_flag(tech_pvt, TFLAG_NAT);
 			tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
@@ -1069,7 +1062,7 @@
 			session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
 			switch_channel_set_variable(channel, "sip_nat_detected", "true");
 		}
-		
+
 		/* TODO: We should use the new tags for making an rpid and add profile options to turn this on/off */
 		if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
 			priv = "name";
@@ -1084,14 +1077,12 @@
 			screen = "yes";
 		}
 
-		tech_pvt->rpid = switch_core_session_sprintf(tech_pvt->session, "Remote-Party-ID: \"%s\"<sip:%s@%s>;screen=%s;privacy=%s", 
-													 tech_pvt->caller_profile->caller_id_name, 
-													 tech_pvt->caller_profile->caller_id_number, 
-													 rpid_domain,
-													 screen, priv);
+		tech_pvt->rpid = switch_core_session_sprintf(tech_pvt->session, "Remote-Party-ID: \"%s\"<sip:%s@%s>;screen=%s;privacy=%s",
+													 tech_pvt->caller_profile->caller_id_name,
+													 tech_pvt->caller_profile->caller_id_number, rpid_domain, screen, priv);
 
 		switch_safe_free(d_url);
-		
+
 		if (!(sofia_private = malloc(sizeof(*sofia_private)))) {
 			abort();
 		}
@@ -1108,7 +1099,7 @@
 		e_dest = strdup(tech_pvt->e_dest);
 		switch_assert(e_dest != NULL);
 		user = e_dest;
-		
+
 		if ((host = strchr(user, '@'))) {
 			*host++ = '\0';
 		}
@@ -1132,7 +1123,7 @@
 		for (; hi; hi = hi->next) {
 			const char *name = (char *) hi->name;
 			char *value = (char *) hi->value;
-			
+
 			if (!strncasecmp(name, SOFIA_SIP_HEADER_PREFIX, strlen(SOFIA_SIP_HEADER_PREFIX))) {
 				const char *hname = name + strlen(SOFIA_SIP_HEADER_PREFIX);
 				stream.write_function(&stream, "%s: %s\r\n", hname, value);
@@ -1144,7 +1135,7 @@
 	if (stream.data) {
 		extra_headers = stream.data;
 	}
-	
+
 	session_timeout = tech_pvt->profile->session_timeout;
 	if ((val = switch_channel_get_variable(channel, SOFIA_SESSION_TIMEOUT))) {
 		int v_session_timeout = atoi(val);
@@ -1198,9 +1189,7 @@
 
 		tech_pvt->nh2 = nua_handle(tech_pvt->profile->nua, NULL,
 								   SIPTAG_TO_STR(tech_pvt->dest),
-								   SIPTAG_FROM_STR(tech_pvt->from_str),
-								   SIPTAG_CONTACT_STR(tech_pvt->profile->url),
-								   TAG_END());
+								   SIPTAG_FROM_STR(tech_pvt->from_str), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END());
 
 		nua_handle_bind(tech_pvt->nh2, tech_pvt->sofia_private);
 
@@ -1329,7 +1318,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set VIDEO Codec %s %s/%ld %d ms\n",
 							  switch_channel_get_name(tech_pvt->channel), tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate, tech_pvt->video_codec_ms);
 			tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec;
-			
+
 			tech_pvt->video_fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->video_write_codec.fmtp_out);
 
 			tech_pvt->video_write_codec.agreed_pt = tech_pvt->video_agreed_pt;
@@ -1378,7 +1367,7 @@
 							   NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
 		return SWITCH_STATUS_FALSE;
-	} 
+	}
 
 	if (switch_core_codec_init(&tech_pvt->write_codec,
 							   tech_pvt->iananame,
@@ -1390,7 +1379,7 @@
 							   NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
 		return SWITCH_STATUS_FALSE;
-	} 
+	}
 
 	tech_pvt->read_frame.rate = tech_pvt->rm_rate;
 	ms = tech_pvt->write_codec.implementation->microseconds_per_frame / 1000;
@@ -1402,10 +1391,9 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Codec %s %s/%ld %d ms %d samples\n",
 					  switch_channel_get_name(tech_pvt->channel), tech_pvt->iananame, tech_pvt->rm_rate, tech_pvt->codec_ms,
-					  tech_pvt->read_codec.implementation->samples_per_frame
-					  );
+					  tech_pvt->read_codec.implementation->samples_per_frame);
 	tech_pvt->read_frame.codec = &tech_pvt->read_codec;
-	
+
 	tech_pvt->write_codec.agreed_pt = tech_pvt->agreed_pt;
 	tech_pvt->read_codec.agreed_pt = tech_pvt->agreed_pt;
 
@@ -1441,12 +1429,12 @@
 		key = tech_pvt->remote_raw_key;
 
 	}
-	
+
 	switch_rtp_get_random(key, SWITCH_RTP_KEY_LEN);
 	switch_b64_encode(key, SWITCH_RTP_KEY_LEN, b64_key, sizeof(b64_key));
-	p = strrchr((char *)b64_key, '=');
+	p = strrchr((char *) b64_key, '=');
 
-	while(p && *p && *p == '=') {
+	while (p && *p && *p == '=') {
 		*p-- = '\0';
 	}
 
@@ -1469,12 +1457,12 @@
 	if (!switch_rtp_ready(tech_pvt->rtp_session)) {
 		goto bad;
 	}
-	
+
 	index = atoi(key_str);
 
 	p = strchr(key_str, ' ');
-	
-	if (p && *p && *(p+1)) {
+
+	if (p && *p && *(p + 1)) {
 		p++;
 		if (!strncasecmp(p, SWITCH_RTP_CRYPTO_KEY_32, strlen(SWITCH_RTP_CRYPTO_KEY_32))) {
 			type = AES_CM_128_HMAC_SHA1_32;
@@ -1486,7 +1474,7 @@
 		}
 
 		p = strchr(p, ' ');
-		if (p && *p && *(p+1)) {
+		if (p && *p && *(p + 1)) {
 			p++;
 			if (strncasecmp(p, "inline:", 7)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error near [%s]\n", p);
@@ -1494,8 +1482,8 @@
 			}
 
 			p += 7;
-			switch_b64_decode(p, (char *)key, sizeof(key));
-			
+			switch_b64_decode(p, (char *) key, sizeof(key));
+
 			if (direction == SWITCH_RTP_CRYPTO_SEND) {
 				tech_pvt->crypto_send_type = type;
 				memcpy(tech_pvt->local_raw_key, key, SWITCH_RTP_KEY_LEN);
@@ -1507,8 +1495,8 @@
 		}
 
 	}
-	
- bad:
+
+  bad:
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error!\n");
 	return SWITCH_STATUS_FALSE;
@@ -1532,7 +1520,7 @@
 	switch_assert(tech_pvt != NULL);
 
 	switch_core_session_signal_lock(tech_pvt->session);
-	
+
 
 	if ((var = switch_channel_get_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
 		switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
@@ -1556,7 +1544,7 @@
 	bw = tech_pvt->read_codec.implementation->bits_per_second;
 	ms = tech_pvt->read_codec.implementation->microseconds_per_frame;
 
-	if (myflags)  {
+	if (myflags) {
 		flags = myflags;
 	} else {
 		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
@@ -1581,7 +1569,7 @@
 		flags |= SWITCH_RTP_FLAG_PASS_RFC2833;
 	}
 
-	if (!((tech_pvt->profile->pflags & PFLAG_REWRITE_TIMESTAMPS) || 
+	if (!((tech_pvt->profile->pflags & PFLAG_REWRITE_TIMESTAMPS) ||
 		  ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_rewrite_timestamps")) && !switch_true(val)))) {
 		flags |= SWITCH_RTP_FLAG_RAW_WRITE;
 	}
@@ -1589,7 +1577,7 @@
 	if (tech_pvt->cng_pt) {
 		flags |= SWITCH_RTP_FLAG_AUTO_CNG;
 	}
-	
+
 	if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
 		const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
 		const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
@@ -1606,9 +1594,7 @@
 						  tech_pvt->local_sdp_audio_ip,
 						  tech_pvt->local_sdp_audio_port,
 						  tech_pvt->remote_sdp_audio_ip,
-						  tech_pvt->remote_sdp_audio_port,
-						  tech_pvt->agreed_pt,
-						  tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+						  tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
 	}
 
 	switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
@@ -1627,9 +1613,9 @@
 			/* Reactivate the NAT buster flag. */
 			switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
 		}
-        goto video;
+		goto video;
 	}
-	
+
 	if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
 		if ((status = sofia_glue_tech_proxy_remote_addr(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
 			goto end;
@@ -1642,9 +1628,7 @@
 						  tech_pvt->local_sdp_audio_ip,
 						  tech_pvt->local_sdp_audio_port,
 						  tech_pvt->remote_sdp_audio_ip,
-						  tech_pvt->remote_sdp_audio_port,
-						  tech_pvt->agreed_pt,
-						  tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+						  tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
 
 	} else {
 		timer_name = tech_pvt->profile->timer_name;
@@ -1657,11 +1641,8 @@
 										   tech_pvt->agreed_pt,
 										   tech_pvt->read_codec.implementation->samples_per_frame,
 										   tech_pvt->codec_ms * 1000,
-										   (switch_rtp_flag_t) flags,
-										   timer_name,
-										   &err,
-										   switch_core_session_get_pool(tech_pvt->session));
-	
+										   (switch_rtp_flag_t) flags, timer_name, &err, switch_core_session_get_pool(tech_pvt->session));
+
 	if (switch_rtp_ready(tech_pvt->rtp_session)) {
 		uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
 		uint8_t vad_out = switch_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
@@ -1694,14 +1675,14 @@
 
 		if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec"))) {
 			int len = atoi(val);
-			
+
 			if (len < 100 || len > 1000) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Jitterbuffer spec [%d] must be between 100 and 1000\n", len);
 			} else {
 				int qlen;
 
 				qlen = len / (tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
-				
+
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", len, qlen);
 				switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen);
 			}
@@ -1720,11 +1701,11 @@
 				rtp_hold_timeout_sec = v;
 			}
 		}
-		
+
 		if (rtp_timeout_sec) {
-			tech_pvt->max_missed_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_timeout_sec) / 
+			tech_pvt->max_missed_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_timeout_sec) /
 				tech_pvt->read_codec.implementation->samples_per_frame;
-			
+
 			switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
 			if (!rtp_hold_timeout_sec) {
 				rtp_hold_timeout_sec = rtp_timeout_sec * 10;
@@ -1732,7 +1713,7 @@
 		}
 
 		if (rtp_hold_timeout_sec) {
-			tech_pvt->max_missed_hold_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_hold_timeout_sec) / 
+			tech_pvt->max_missed_hold_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_hold_timeout_sec) /
 				tech_pvt->read_codec.implementation->samples_per_frame;
 		}
 
@@ -1742,16 +1723,17 @@
 		if (tech_pvt->cng_pt) {
 			switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt);
 		}
-		
+
 		if (tech_pvt->remote_crypto_key && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
 			sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
-			switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->crypto_type, tech_pvt->local_raw_key, SWITCH_RTP_KEY_LEN);
-			switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag, 
-									  tech_pvt->crypto_type, tech_pvt->remote_raw_key, SWITCH_RTP_KEY_LEN);
+			switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->crypto_type, tech_pvt->local_raw_key,
+									  SWITCH_RTP_KEY_LEN);
+			switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag, tech_pvt->crypto_type, tech_pvt->remote_raw_key,
+									  SWITCH_RTP_KEY_LEN);
 			switch_channel_set_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_CONFIRMED_VARIABLE, "true");
 		}
 
-    video:
+	  video:
 
 		sofia_glue_check_video_codecs(tech_pvt);
 
@@ -1760,7 +1742,7 @@
 				sofia_glue_tech_choose_video_port(tech_pvt, 1);
 			}
 
-			flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ | 
+			flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ |
 										 SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE);
 
 			if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
@@ -1774,12 +1756,7 @@
 														 tech_pvt->remote_sdp_video_ip,
 														 tech_pvt->remote_sdp_video_port,
 														 tech_pvt->video_agreed_pt,
-														 1,
-														 10000,
-														 (switch_rtp_flag_t) flags,
-														 NULL,
-														 &err, 
-														 switch_core_session_get_pool(tech_pvt->session));
+														 1, 10000, (switch_rtp_flag_t) flags, NULL, &err, switch_core_session_get_pool(tech_pvt->session));
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%sVIDEO RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
 							  switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) ? "PROXY " : "",
@@ -1788,8 +1765,7 @@
 							  tech_pvt->local_sdp_video_port,
 							  tech_pvt->remote_sdp_video_ip,
 							  tech_pvt->remote_sdp_video_port, tech_pvt->video_agreed_pt,
-							  0,
-							  switch_rtp_ready(tech_pvt->video_rtp_session) ? "SUCCESS" : err);
+							  0, switch_rtp_ready(tech_pvt->video_rtp_session) ? "SUCCESS" : err);
 
 			if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
 				switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
@@ -1809,13 +1785,13 @@
 
 	switch_set_flag(tech_pvt, TFLAG_IO);
 	status = SWITCH_STATUS_SUCCESS;
-	
- end:
+
+  end:
 
 	switch_core_session_signal_unlock(tech_pvt->session);
 
 	return status;
-	
+
 }
 
 switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp)
@@ -1878,7 +1854,7 @@
 	switch_assert(tech_pvt != NULL);
 
 	greedy = !!(tech_pvt->profile->pflags & PFLAG_GREEDY);
-	
+
 	if (!greedy) {
 		if ((val = switch_channel_get_variable(channel, "sip_codec_negotiation")) && !strcasecmp(val, "greedy")) {
 			greedy = 1;
@@ -1893,7 +1869,7 @@
 	}
 
 	if (((m = sdp->sdp_media)) && m->m_mode == sdp_sendonly) {
-		sendonly = 2; /* global sendonly always wins */
+		sendonly = 2;			/* global sendonly always wins */
 	}
 
 	for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
@@ -1924,7 +1900,7 @@
 			if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
 				stream = tech_pvt->profile->hold_music;
 			}
-			
+
 			if (stream && switch_is_moh(stream)) {
 				if (!strcasecmp(stream, "indicate_hold")) {
 					switch_channel_set_flag(tech_pvt->channel, CF_SUSPEND);
@@ -1939,7 +1915,7 @@
 		if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 			const char *uuid;
 			switch_core_session_t *b_session;
-			
+
 			if (tech_pvt->max_missed_packets) {
 				switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
 			}
@@ -1999,7 +1975,7 @@
 
 								if (switch_rtp_ready(tech_pvt->rtp_session) && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
 									sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
-									switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag, 
+									switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag,
 															  tech_pvt->crypto_type, tech_pvt->remote_raw_key, SWITCH_RTP_KEY_LEN);
 								}
 								got_crypto++;
@@ -2012,7 +1988,7 @@
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Remote Key [%s]\n", tech_pvt->remote_crypto_key);
 						tech_pvt->crypto_tag = crypto_tag;
 						got_crypto++;
-						
+
 						if (switch_strlen_zero(tech_pvt->local_crypto_key)) {
 							if (switch_stristr(SWITCH_RTP_CRYPTO_KEY_32, crypto)) {
 								switch_channel_set_variable(tech_pvt->channel, SOFIA_HAS_CRYPTO_VARIABLE, SWITCH_RTP_CRYPTO_KEY_32);
@@ -2043,8 +2019,8 @@
 				match = 0;
 				break;
 			}
-			
-		greed:
+
+		  greed:
 			x = 0;
 
 			if (tech_pvt->rm_encoding) {
@@ -2054,12 +2030,12 @@
 					} else {
 						match = strcasecmp(switch_str_nil(map->rm_encoding), tech_pvt->iananame) ? 0 : 1;
 					}
-				
+
 					if (match) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Our existing codec [%s] is still good, let's keep it\n", 
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Our existing codec [%s] is still good, let's keep it\n",
 										  tech_pvt->rm_encoding);
-                        got_audio = 1;
-                        break;
+						got_audio = 1;
+						break;
 					}
 				}
 			}
@@ -2071,7 +2047,7 @@
 				uint32_t near_rate = 0;
 				const switch_codec_implementation_t *mimp = NULL, *near_match = NULL;
 				const char *rm_encoding;
-				
+
 				if (x++ < skip) {
 					continue;
 				}
@@ -2079,7 +2055,7 @@
 				if (!(rm_encoding = map->rm_encoding)) {
 					rm_encoding = "";
 				}
-				
+
 				if (!te && !strcasecmp(rm_encoding, "telephone-event")) {
 					te = tech_pvt->te = (switch_payload_t) map->rm_pt;
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set 2833 dtmf payload to %u\n", te);
@@ -2096,19 +2072,20 @@
 						switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTO_CNG);
 					}
 				}
-				
+
 				if (match) {
 					if (te && cng_pt) {
 						break;
 					}
 					continue;
 				}
-				
+
 				if (greedy) {
 					first = mine;
 					last = first + 1;
 				} else {
-					first = 0; last = tech_pvt->num_codecs;
+					first = 0;
+					last = tech_pvt->num_codecs;
 				}
 
 				for (i = first; i < last && i < tech_pvt->num_codecs; i++) {
@@ -2119,13 +2096,13 @@
 					}
 
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u]/[%s:%d:%u]\n",
-									  rm_encoding, map->rm_pt, (int)map->rm_rate, imp->iananame, imp->ianacode, codec_rate);
+									  rm_encoding, map->rm_pt, (int) map->rm_rate, imp->iananame, imp->ianacode, codec_rate);
 					if (map->rm_pt < 96) {
 						match = (map->rm_pt == imp->ianacode) ? 1 : 0;
 					} else {
 						match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
 					}
-					
+
 					if (match) {
 						if ((ptime && ptime * 1000 != imp->microseconds_per_frame) || map->rm_rate != codec_rate) {
 							near_rate = map->rm_rate;
@@ -2139,15 +2116,15 @@
 						match = 0;
 					}
 				}
-				
+
 				if (!match && near_match) {
 					const switch_codec_implementation_t *search[1];
 					char *prefs[1];
 					char tmp[80];
 					int num;
-					
+
 					switch_snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_rate ? near_rate : near_match->samples_per_second, ptime);
-					
+
 					prefs[0] = tmp;
 					num = switch_loadable_module_get_codecs_sorted(search, 1, prefs, 1);
 
@@ -2156,7 +2133,7 @@
 					} else {
 						mimp = near_match;
 					}
-					
+
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Substituting codec %s@%ui@%uh\n",
 									  mimp->iananame, mimp->microseconds_per_frame / 1000, mimp->samples_per_second);
 					match = 1;
@@ -2197,14 +2174,14 @@
 				goto greed;
 			}
 
-		} else if (m->m_type == sdp_media_video && m->m_port) { 
+		} else if (m->m_type == sdp_media_video && m->m_port) {
 			sdp_rtpmap_t *map;
 			const char *rm_encoding;
 			int framerate = 0;
 			const switch_codec_implementation_t *mimp = NULL;
 			int vmatch = 0, i;
 			switch_channel_set_variable(tech_pvt->channel, "video_possible", "true");
-			
+
 			connection = sdp->sdp_connection;
 			if (m->m_connections) {
 				connection = m->m_connections;
@@ -2226,7 +2203,7 @@
 				if (!(rm_encoding = map->rm_encoding)) {
 					rm_encoding = "";
 				}
-				
+
 				for (i = 0; i < tech_pvt->num_codecs; i++) {
 					const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
 
@@ -2241,7 +2218,7 @@
 					} else {
 						vmatch = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
 					}
-					
+
 
 					if (vmatch && (map->rm_rate == imp->samples_per_second)) {
 						mimp = imp;
@@ -2251,7 +2228,7 @@
 					}
 				}
 
-                                        
+
 				if (mimp) {
 					if ((tech_pvt->video_rm_encoding = switch_core_session_strdup(session, (char *) rm_encoding))) {
 						char tmp[50];
@@ -2269,7 +2246,7 @@
 						switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->video_agreed_pt);
 						switch_channel_set_variable(tech_pvt->channel, "sip_video_pt", tmp);
 						sofia_glue_check_video_codecs(tech_pvt);
-                        break;
+						break;
 					} else {
 						vmatch = 0;
 					}
@@ -2408,7 +2385,7 @@
 			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is locked\n", profile->name);
 #endif
 			profile = NULL;
-		}		
+		}
 	} else {
 #ifdef SOFIA_DEBUG_RWLOCKS
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is not in the hash\n", key);
@@ -2420,7 +2397,7 @@
 	}
 #endif
 
- done:
+  done:
 	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 
 	return profile;
@@ -2458,7 +2435,7 @@
 	const void *var;
 	void *val;
 	sofia_profile_t *pptr;
-	
+
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	if (mod_sofia_globals.profile_hash) {
 		for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
@@ -2492,12 +2469,9 @@
 		"   call_id         VARCHAR(255),\n"
 		"   sip_user        VARCHAR(255),\n"
 		"   sip_host        VARCHAR(255),\n"
-		"   contact         VARCHAR(1024),\n" 
-		"   status          VARCHAR(255),\n" 
-		"   rpid            VARCHAR(255),\n" 
-		"   expires         INTEGER,\n"
-		"   user_agent      VARCHAR(255)\n"
-		");\n";
+		"   contact         VARCHAR(1024),\n"
+		"   status          VARCHAR(255),\n"
+		"   rpid            VARCHAR(255),\n" "   expires         INTEGER,\n" "   user_agent      VARCHAR(255)\n" ");\n";
 
 	char dialog_sql[] =
 		"CREATE TABLE sip_dialogs (\n"
@@ -2507,12 +2481,9 @@
 		"   sip_to_host     VARCHAR(255),\n"
 		"   sip_from_user   VARCHAR(255),\n"
 		"   sip_from_host   VARCHAR(255),\n"
-		"   contact_user    VARCHAR(255),\n" 
-		"   contact_host    VARCHAR(255),\n" 
-		"   state           VARCHAR(255),\n" 
-		"   direction       VARCHAR(255),\n" 
-		"   user_agent      VARCHAR(255)\n"
-		");\n";
+		"   contact_user    VARCHAR(255),\n"
+		"   contact_host    VARCHAR(255),\n"
+		"   state           VARCHAR(255),\n" "   direction       VARCHAR(255),\n" "   user_agent      VARCHAR(255)\n" ");\n";
 
 	char sub_sql[] =
 		"CREATE TABLE sip_subscriptions (\n"
@@ -2523,21 +2494,14 @@
 		"   sub_to_host     VARCHAR(255),\n"
 		"   event           VARCHAR(255),\n"
 		"   contact         VARCHAR(1024),\n"
-		"   call_id         VARCHAR(255),\n" 
-		"   full_from       VARCHAR(255),\n" 
-		"   full_via        VARCHAR(255),\n" 
-		"   expires         INTEGER,\n"
-		"   user_agent      VARCHAR(255),\n"
-		"   accept          VARCHAR(255)\n" 
-		");\n";
+		"   call_id         VARCHAR(255),\n"
+		"   full_from       VARCHAR(255),\n"
+		"   full_via        VARCHAR(255),\n"
+		"   expires         INTEGER,\n" "   user_agent      VARCHAR(255),\n" "   accept          VARCHAR(255)\n" ");\n";
+
 
+	char auth_sql[] = "CREATE TABLE sip_authentication (\n" "   nonce           VARCHAR(255),\n" "   expires         INTEGER" ");\n";
 
-	char auth_sql[] =
-		"CREATE TABLE sip_authentication (\n"
-		"   nonce           VARCHAR(255),\n" 
-		"   expires         INTEGER"
-		");\n";
-	
 	if (profile->odbc_dsn) {
 #ifdef SWITCH_HAVE_ODBC
 		if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
@@ -2549,13 +2513,14 @@
 		}
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", profile->odbc_dsn);
-			
+
 		if (switch_odbc_handle_exec(profile->master_odbc, "select sip_user,user_agent from sip_registrations", NULL) != SWITCH_ODBC_SUCCESS) {
 			switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_registrations", NULL);
 			switch_odbc_handle_exec(profile->master_odbc, reg_sql, NULL);
 		}
 
-		if (switch_odbc_handle_exec(profile->master_odbc, "delete from sip_subscriptions where sip_user != '' or accept != ''", NULL) != SWITCH_ODBC_SUCCESS) {
+		if (switch_odbc_handle_exec(profile->master_odbc, "delete from sip_subscriptions where sip_user != '' or accept != ''", NULL) !=
+			SWITCH_ODBC_SUCCESS) {
 			switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_subscriptions", NULL);
 			switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL);
 		}
@@ -2578,7 +2543,8 @@
 		}
 
 		switch_core_db_test_reactive(profile->master_db, "select sip_user,user_agent from sip_registrations", "DROP TABLE sip_registrations", reg_sql);
-		switch_core_db_test_reactive(profile->master_db, "delete from sip_subscriptions where sip_user != '' or accept != ''", "DROP TABLE sip_subscriptions", sub_sql);
+		switch_core_db_test_reactive(profile->master_db, "delete from sip_subscriptions where sip_user != '' or accept != ''",
+									 "DROP TABLE sip_subscriptions", sub_sql);
 		switch_core_db_test_reactive(profile->master_db, "delete from sip_dialogs", "DROP TABLE sip_dialogs", dialog_sql);
 		switch_core_db_test_reactive(profile->master_db, "select * from sip_authentication", "DROP TABLE sip_authentication", auth_sql);
 
@@ -2590,13 +2556,13 @@
 	}
 #endif
 
-	return profile->master_db ? 1: 0;
+	return profile->master_db ? 1 : 0;
 }
 
 void sofia_glue_sql_close(sofia_profile_t *profile)
 {
 #ifdef SWITCH_HAVE_ODBC
-    if (profile->odbc_dsn) {
+	if (profile->odbc_dsn) {
 		switch_odbc_handle_destroy(&profile->master_odbc);
 		return;
 	}
@@ -2614,7 +2580,7 @@
 
 	switch_assert(sqlp && *sqlp);
 	sql = *sqlp;
-	
+
 	if (profile->sql_queue) {
 		if (sql_already_dynamic) {
 			d_sql = sql;
@@ -2649,7 +2615,7 @@
 		switch_mutex_lock(mutex);
 	}
 
-    if (profile->odbc_dsn) {
+	if (profile->odbc_dsn) {
 #ifdef SWITCH_HAVE_ODBC
 		SQLHSTMT stmt;
 		if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
@@ -2678,7 +2644,7 @@
 		if (!master) {
 			switch_core_db_close(db);
 		}
-    }
+	}
 
   end:
 	if (mutex) {
@@ -2687,22 +2653,18 @@
 }
 
 switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
-											  switch_bool_t master,
-											  switch_mutex_t *mutex,
-											  char *sql,
-											  switch_core_db_callback_func_t callback,
-											  void *pdata)
+											  switch_bool_t master, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
 	switch_bool_t ret = SWITCH_FALSE;
 	switch_core_db_t *db;
 	char *errmsg = NULL;
-	
+
 	if (mutex) {
-        switch_mutex_lock(mutex);
-    }
+		switch_mutex_lock(mutex);
+	}
 
 
-    if (profile->odbc_dsn) {
+	if (profile->odbc_dsn) {
 #ifdef SWITCH_HAVE_ODBC
 		switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
 #else
@@ -2718,7 +2680,7 @@
 				goto end;
 			}
 		}
-		
+
 		switch_core_db_exec(db, sql, callback, pdata, &errmsg);
 
 		if (errmsg) {
@@ -2729,12 +2691,12 @@
 		if (!master && db) {
 			switch_core_db_close(db);
 		}
-    }
+	}
 
- end:
+  end:
 	if (mutex) {
-        switch_mutex_unlock(mutex);
-    }
+		switch_mutex_unlock(mutex);
+	}
 	return ret;
 }
 
@@ -2760,7 +2722,7 @@
 		}
 
 		SQLDescribeCol(stmt, 1, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
-		SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *)resbuf, (SQLLEN)len, NULL);
+		SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *) resbuf, (SQLLEN) len, NULL);
 		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 		ret = resbuf;
 	}
@@ -2776,7 +2738,7 @@
 	char *ret = NULL;
 
 #ifdef SWITCH_HAVE_ODBC
-    if (profile->odbc_dsn) {
+	if (profile->odbc_dsn) {
 		return sofia_glue_execute_sql2str_odbc(profile, mutex, sql, resbuf, len);
 	}
 #endif

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	Tue May 27 00:54:52 2008
@@ -127,7 +127,8 @@
 	void *val;
 	struct presence_helper helper = { 0 };
 
-	if (!mod_sofia_globals.profile_hash) return;
+	if (!mod_sofia_globals.profile_hash)
+		return;
 
 	if ((sql = switch_mprintf("select *,-1,'unavailable','unavailable' from sip_subscriptions where event='presence'"))) {
 		switch_mutex_lock(mod_sofia_globals.hash_mutex);
@@ -151,16 +152,15 @@
 void sofia_presence_establish_presence(sofia_profile_t *profile)
 {
 
-	if (sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, 
-										"select sip_user,sip_host,'Registered','unknown','' from sip_registrations", 
+	if (sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex,
+										"select sip_user,sip_host,'Registered','unknown','' from sip_registrations",
 										sofia_presence_resub_callback, profile) != SWITCH_TRUE) {
 		return;
 	}
 
 	if (sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex,
 										"select sub_to_user,sub_to_host,'Online','unknown',proto from sip_subscriptions "
-										"where proto='ext' or proto='user' or proto='conf'",
-										sofia_presence_resub_callback, profile) != SWITCH_TRUE) {
+										"where proto='ext' or proto='user' or proto='conf'", sofia_presence_resub_callback, profile) != SWITCH_TRUE) {
 		return;
 	}
 }
@@ -172,7 +172,7 @@
 	if (in && (switch_stristr("null", in))) {
 		in = NULL;
 	}
-	
+
 	if (!in) {
 		in = ext;
 	}
@@ -233,7 +233,7 @@
 			return;
 		}
 	}
-	
+
 	if (profile->domain_name && profile->domain_name != host) {
 		host = profile->domain_name;
 	}
@@ -251,43 +251,32 @@
 			if (!strcasecmp(hp->name, "mwi-message-account") && strncasecmp(hp->value, "sip:", 4)) {
 				tmp = switch_mprintf("sip:%s", hp->value);
 				value = tmp;
-			} 
+			}
 			stream.write_function(&stream, "%s: %s\r\n", hp->name + 4, value);
 			switch_safe_free(tmp);
 		}
 	}
 
 	stream.write_function(&stream, "\r\n");
-	
-	sql = switch_mprintf("select *,'%q' from sip_subscriptions where event='message-summary' and sub_to_user='%q' and sub_to_host='%q'", 
+
+	sql = switch_mprintf("select *,'%q' from sip_subscriptions where event='message-summary' and sub_to_user='%q' and sub_to_host='%q'",
 						 stream.data, user, host);
-	
 
-	switch_assert (sql != NULL);
-	sofia_glue_execute_sql_callback(profile,
-									SWITCH_FALSE,
-									profile->ireg_mutex,
-									sql,
-									sofia_presence_mwi_callback,
-									&h);
+
+	switch_assert(sql != NULL);
+	sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_mwi_callback, &h);
 
 	switch_safe_free(sql);
 
-	
 
-	sql = switch_mprintf("select sip_user,sip_host,contact,'%q' from sip_registrations where sip_user='%q' and sip_host='%q'", 
-						 stream.data, user, host);
-	
 
-		
-	switch_assert (sql != NULL);
-	sofia_glue_execute_sql_callback(profile,
-									SWITCH_FALSE,
-									profile->ireg_mutex,
-									sql,
-									sofia_presence_mwi_callback2,
-									&h);
-	
+	sql = switch_mprintf("select sip_user,sip_host,contact,'%q' from sip_registrations where sip_user='%q' and sip_host='%q'", stream.data, user, host);
+
+
+
+	switch_assert(sql != NULL);
+	sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_mwi_callback2, &h);
+
 	switch_safe_free(sql);
 
 	switch_safe_free(stream.data);
@@ -312,11 +301,11 @@
 	char *sql = NULL;
 	char *euser = NULL, *user = NULL, *host = NULL;
 
-	
+
 	if (!mod_sofia_globals.running) {
 		return;
 	}
-	
+
 	if (rpid && !strcasecmp(rpid, "n/a")) {
 		rpid = NULL;
 	}
@@ -350,8 +339,9 @@
 	if (event->event_id == SWITCH_EVENT_ROSTER) {
 		struct presence_helper helper = { 0 };
 
-		if (!mod_sofia_globals.profile_hash) return;
-		
+		if (!mod_sofia_globals.profile_hash)
+			return;
+
 		if (from) {
 			sql = switch_mprintf("select *,1,'%q','%q' from sip_subscriptions where event='presence' and full_from like '%%%q%%'", status, rpid, from);
 		} else {
@@ -367,13 +357,8 @@
 				continue;
 			}
 			helper.profile = profile;
-            helper.event = NULL;
-			sofia_glue_execute_sql_callback(profile,
-											SWITCH_FALSE,
-											profile->ireg_mutex,
-											sql,
-											sofia_presence_sub_callback,
-											&helper);
+			helper.event = NULL;
+			sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_sub_callback, &helper);
 		}
 		switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 		free(sql);
@@ -387,7 +372,7 @@
 	if (switch_strlen_zero(alt_event_type)) {
 		alt_event_type = "presence";
 	}
-	
+
 	if ((user = strdup(from))) {
 		if ((host = strchr(user, '@'))) {
 			char *p;
@@ -432,15 +417,9 @@
 									 "from sip_registrations left join sip_dialogs on "
 									 "(sip_dialogs.sip_from_user = sip_registrations.sip_user) "
 									 "and sip_dialogs.sip_from_host = sip_registrations.sip_host "
-									 "where sip_registrations.sip_user='%q' and sip_registrations.sip_host='%q'",
-									 probe_euser, probe_host);
+									 "where sip_registrations.sip_user='%q' and sip_registrations.sip_host='%q'", probe_euser, probe_host);
 				switch_assert(sql);
-				sofia_glue_execute_sql_callback(profile,
-												SWITCH_FALSE,
-												profile->ireg_mutex,
-												sql,
-												sofia_presence_resub_callback,
-												profile);
+				sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_resub_callback, profile);
 
 				sofia_glue_release_profile(profile);
 				switch_safe_free(sql);
@@ -465,7 +444,8 @@
 		break;
 	}
 
-	if (!mod_sofia_globals.profile_hash) goto done;
+	if (!mod_sofia_globals.profile_hash)
+		goto done;
 
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
@@ -478,31 +458,27 @@
 		if (sql) {
 			struct presence_helper helper = { 0 };
 			helper.profile = profile;
-            helper.event = event;
+			helper.event = event;
 			SWITCH_STANDARD_STREAM(helper.stream);
 			switch_assert(helper.stream.data);
 
-			sofia_glue_execute_sql_callback(profile,
-											SWITCH_FALSE,
+			sofia_glue_execute_sql_callback(profile, SWITCH_FALSE,
 											//profile->ireg_mutex,
-											NULL,
-											sql,
-											sofia_presence_sub_callback,
-											&helper);
-			
-			if (!switch_strlen_zero((char *)helper.stream.data)) {
-				char *this = (char *)helper.stream.data;
+											NULL, sql, sofia_presence_sub_callback, &helper);
+
+			if (!switch_strlen_zero((char *) helper.stream.data)) {
+				char *this = (char *) helper.stream.data;
 				char *next = NULL;
 				char *last = NULL;
-				
+
 				do {
 					if ((next = strchr(this, ';'))) {
 						*next++ = '\0';
-						while(*next == '\n' || *next == ' ' || *next == '\r') {
+						while (*next == '\n' || *next == ' ' || *next == '\r') {
 							*next++ = '\0';
 						}
 					}
-					
+
 					if (!switch_strlen_zero(this) && (!last || strcmp(last, this))) {
 						sofia_glue_execute_sql(profile, &this, SWITCH_FALSE);
 						last = this;
@@ -516,7 +492,7 @@
 	}
 	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 
-done:
+  done:
 	switch_safe_free(sql);
 	switch_safe_free(user);
 }
@@ -543,10 +519,10 @@
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Thread Started\n");
-	
+
 	while (mod_sofia_globals.running == 1) {
 		int count = 0;
-		
+
 		if (switch_queue_trypop(mod_sofia_globals.presence_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 			switch_event_t *event = (switch_event_t *) pop;
 
@@ -580,7 +556,7 @@
 		switch_event_t *event = (switch_event_t *) pop;
 		switch_event_destroy(&event);
 	}
-	
+
 	while (switch_queue_trypop(mod_sofia_globals.mwi_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 		switch_event_t *event = (switch_event_t *) pop;
 		switch_event_destroy(&event);
@@ -592,7 +568,7 @@
 	mod_sofia_globals.threads--;
 	EVENT_THREAD_RUNNING = EVENT_THREAD_STARTED = 0;
 	switch_mutex_unlock(mod_sofia_globals.mutex);
-	
+
 	return NULL;
 }
 
@@ -728,7 +704,7 @@
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "astate", "%s", state);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-direction", "%s", direction);
 		}
-		
+
 		switch_event_fire(&event);
 	}
 
@@ -738,7 +714,7 @@
 static char *translate_rpid(char *in)
 {
 	char *r = in;
-	
+
 	if (in && (strstr(in, "null") || strstr(in, "NULL"))) {
 		in = NULL;
 	}
@@ -762,7 +738,7 @@
 		r = "busy";
 	}
 
- end:
+  end:
 	return r;
 }
 
@@ -792,17 +768,17 @@
 	char *prpid;
 	int done = 0;
 	const char *ct = "no/idea";
-	time_t exptime = switch_timestamp(NULL) + 3600; 
-	char exp[80] = "";   
+	time_t exptime = switch_timestamp(NULL) + 3600;
+	char exp[80] = "";
 	int is_dialog = 0;
 
-	if (expires) { 
-		long tmp = atol(expires); 
-		if (tmp > 0) { 
-			exptime = tmp - switch_timestamp(NULL); 
+	if (expires) {
+		long tmp = atol(expires);
+		if (tmp > 0) {
+			exptime = tmp - switch_timestamp(NULL);
 		}
 	}
-	
+
 	if (!(nh = nua_handle_by_call_id(profile->nua, call_id))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot find handle for %s\n", call_id);
 		return 0;
@@ -817,7 +793,7 @@
 	if (in < 0) {
 		done = 1;
 		in = 0;
-	} 
+	}
 
 	if (!strcasecmp(proto, SOFIA_CHAT_PROTO)) {
 		clean_id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
@@ -838,7 +814,7 @@
 	to = switch_mprintf("sip:%s@%s", user, host);
 
 	is_dialog = !strcmp(event, "dialog");
-	
+
 	if (helper->event) {
 		switch_stream_handle_t stream = { 0 };
 		const char *direction = switch_str_nil(switch_event_get_header(helper->event, "call-direction"));
@@ -854,7 +830,7 @@
 		const char *clean_to_user = NULL;
 		const char *clean_from_user = NULL;
 
-		
+
 		if (is_dialog) {
 			SWITCH_STANDARD_STREAM(stream);
 		}
@@ -866,43 +842,43 @@
 			direction = "initiator";
 			dft_state = "confirmed";
 		}
-		
+
 		if (!strcasecmp(state, "cs_execute") && !strstr(event_status, "hold")) {
 			goto end;
-		} 
-		
+		}
+
 		if (!strcasecmp(event_status, "Registered")) {
 			answer_state = "resubscribe";
 		}
 
 		if (is_dialog) {
-			stream.write_function(&stream, 
+			stream.write_function(&stream,
 								  "<?xml version=\"1.0\"?>\n"
 								  "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" "
-								  "version=\"%s\" state=\"%s\" entity=\"%s\">\n", 
+								  "version=\"%s\" state=\"%s\" entity=\"%s\">\n",
 								  switch_str_nil(switch_event_get_header(helper->event, "event_count")),
 								  !strcasecmp(answer_state, "resubscribe") ? "partial" : "full", clean_id);
 		}
-		
+
 		if (strcasecmp(answer_state, "resubscribe")) {
 
 			if (!strcasecmp(state, "cs_hangup")) {
 				astate = "terminated";
-			} else if (switch_strlen_zero(astate))  {
+			} else if (switch_strlen_zero(astate)) {
 				astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
-				if (switch_strlen_zero(astate))  {
+				if (switch_strlen_zero(astate)) {
 					astate = dft_state;
 				}
-			} 
-			
+			}
+
 			if (!strcasecmp(event_status, "hold")) {
 				astate = "early";
 			}
-			
+
 			if (!strcasecmp(astate, "answered")) {
 				astate = "confirmed";
 			}
-			
+
 			if (!strcasecmp(astate, "ringing")) {
 				if (!strcasecmp(direction, "recipient")) {
 					astate = "early";
@@ -915,7 +891,7 @@
 				stream.write_function(&stream, "<state>%s</state>\n", astate);
 			}
 			if (!strcasecmp(astate, "early") || !strcasecmp(astate, "confirmed")) {
-				
+
 				clean_to_user = switch_mprintf("%s", sub_to_user ? sub_to_user : to_user);
 				clean_from_user = switch_mprintf("%s", from_id ? from_id : from_user);
 
@@ -923,24 +899,26 @@
 					if (!switch_strlen_zero(clean_to_user) && !switch_strlen_zero(clean_from_user)) {
 						stream.write_function(&stream, "<local>\n<identity display=\"%s\">sip:%s@%s</identity>\n", clean_to_user, clean_to_user, host);
 						stream.write_function(&stream, "<target uri=\"sip:%s@%s\">\n", clean_to_user, host);
-						stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"%s\"/>\n", !strcasecmp(event_status, "hold") ? "no" : "yes" );
-						stream.write_function(&stream, "</target>\n</local>\n");  
-						stream.write_function(&stream, "<remote>\n<identity display=\"%s\">sip:%s@%s</identity>\n", clean_from_user, clean_from_user, host);
+						stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"%s\"/>\n",
+											  !strcasecmp(event_status, "hold") ? "no" : "yes");
+						stream.write_function(&stream, "</target>\n</local>\n");
+						stream.write_function(&stream, "<remote>\n<identity display=\"%s\">sip:%s@%s</identity>\n", clean_from_user, clean_from_user,
+											  host);
 						stream.write_function(&stream, "<target uri=\"sip:**%s@%s\"/>\n", clean_to_user, host);
 						stream.write_function(&stream, "</remote>\n");
 					} else if (!strcasecmp(proto, "park")) {
-						stream.write_function(&stream, "<local>\n<identity display=\"parking\">sip:parking@%s;fifo=%s</identity>\n", 
+						stream.write_function(&stream, "<local>\n<identity display=\"parking\">sip:parking@%s;fifo=%s</identity>\n",
 											  host, !switch_strlen_zero(clean_to_user) ? clean_to_user : "unknown");
 						stream.write_function(&stream, "<target uri=\"sip:parking@%s\">\n", host);
-						stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"no\"/>\n</target>\n</local>\n");  
+						stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"no\"/>\n</target>\n</local>\n");
 						stream.write_function(&stream, "<remote>\n<identity display=\"parking\">sip:%s</identity>\n", uuid);
 						stream.write_function(&stream, "<target uri=\"sip:park+%s\"/>\n", uuid);
 						stream.write_function(&stream, "</remote>\n");
 					} else if (!strcasecmp(proto, "conf")) {
-						stream.write_function(&stream, "<local>\n<identity display=\"conference\">sip:conference@%s;conference=%s</identity>\n", 
+						stream.write_function(&stream, "<local>\n<identity display=\"conference\">sip:conference@%s;conference=%s</identity>\n",
 											  host, !switch_strlen_zero(clean_to_user) ? clean_to_user : "unknown");
 						stream.write_function(&stream, "<target uri=\"sip:conference@%s\">\n", host);
-						stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"yes\"/>\n</target>\n</local>\n");  
+						stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"yes\"/>\n</target>\n</local>\n");
 						stream.write_function(&stream, "<remote>\n<identity display=\"conference\">sip:%s@%s</identity>\n", uuid, host);
 						stream.write_function(&stream, "<target uri=\"sip:conf+%s@%s\"/>\n", uuid, host);
 						stream.write_function(&stream, "</remote>\n");
@@ -948,7 +926,7 @@
 				}
 			}
 			if (is_dialog) {
-				stream.write_function(&stream, "</dialog>\n");			
+				stream.write_function(&stream, "</dialog>\n");
 			}
 		}
 
@@ -957,10 +935,10 @@
 			pl = stream.data;
 			ct = "application/dialog-info+xml";
 		}
-		
+
 		if (!switch_strlen_zero(astate) && !switch_strlen_zero(uuid) && helper && helper->stream.data && strcmp(helper->last_uuid, uuid)) {
 			helper->stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';", astate, uuid);
-			
+
 			switch_copy_string(helper->last_uuid, uuid, sizeof(helper->last_uuid));
 		}
 
@@ -968,7 +946,7 @@
 		if (!is_dialog) {
 			if (in) {
 				char status_line[256] = "";
-				
+
 				if (!strcmp(astate, "early")) {
 					switch_snprintf(status_line, sizeof(status_line), "R %s", switch_str_nil(from_id));
 					rpid = "on-the-phone";
@@ -976,8 +954,8 @@
 					char *dest = switch_event_get_header(helper->event, "Caller-Destination-Number");
 					if (switch_strlen_zero(from_id) && !switch_strlen_zero(dest)) {
 						from_id = dest;
-					} 
-					
+					}
+
 					if (switch_strlen_zero(from_id)) {
 						switch_snprintf(status_line, sizeof(status_line), "Available");
 					} else {
@@ -994,7 +972,7 @@
 				note = NULL;
 				open = "closed";
 			}
-			
+
 			prpid = translate_rpid(rpid);
 			pl = switch_mprintf("<?xml version='1.0' encoding='UTF-8'?>\r\n"
 								"<presence xmlns='urn:ietf:params:xml:ns:pidf'\r\n"
@@ -1017,11 +995,8 @@
 								"</status>\r\n"
 								"</tuple>\r\n"
 								"<dm:person id='p06360c4a'>\r\n"
-								"<rpid:activities>\r\n" "<rpid:%s/>\r\n" 
-								"</rpid:activities>%s</dm:person>\r\n" 
-								"</presence>", id, 
-								id, profile->url, open, status, prpid,
-								open, rpid, note);
+								"<rpid:activities>\r\n" "<rpid:%s/>\r\n"
+								"</rpid:activities>%s</dm:person>\r\n" "</presence>", id, id, profile->url, open, status, prpid, open, rpid, note);
 			ct = "application/pidf+xml";
 		}
 
@@ -1055,21 +1030,16 @@
 							"</status>\r\n"
 							"</tuple>\r\n"
 							"<dm:person id='p06360c4a'>\r\n"
-							"<rpid:activities>\r\n" "<rpid:%s/>\r\n" 
-							"</rpid:activities>%s</dm:person>\r\n" 
-							"</presence>", id, 
-							id, profile->url, open, status, prpid,
-							open, rpid, note);
+							"<rpid:activities>\r\n" "<rpid:%s/>\r\n"
+							"</rpid:activities>%s</dm:person>\r\n" "</presence>", id, id, profile->url, open, status, prpid, open, rpid, note);
 		ct = "application/pidf+xml";
 	}
 
-	switch_snprintf(exp, sizeof(exp), "active;expires=%ld", (long) exptime); 
+	switch_snprintf(exp, sizeof(exp), "active;expires=%ld", (long) exptime);
 	nua_handle_bind(nh, &mod_sofia_globals.keep_private);
-	nua_notify(nh,
-			   SIPTAG_SUBSCRIPTION_STATE_STR(exp),
-			   SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(pl), TAG_END());
+	nua_notify(nh, SIPTAG_SUBSCRIPTION_STATE_STR(exp), SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(pl), TAG_END());
 
- end:
+  end:
 
 	switch_safe_free(id);
 	switch_safe_free(clean_id);
@@ -1101,15 +1071,15 @@
 	int expire_sec = atoi(expires);
 	//int *total = (int *) pArg;
 	struct mwi_helper *h = (struct mwi_helper *) pArg;
-	
-	
+
+
 	if (!(nh = nua_handle_by_call_id(h->profile->nua, call_id))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find handle for %s\n", call_id);
 		return 0;
 	}
 
 	id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
-	expire_sec = (int)(expire_sec - switch_timestamp(NULL));
+	expire_sec = (int) (expire_sec - switch_timestamp(NULL));
 	if (expire_sec < 0) {
 		expire_sec = 3600;
 	}
@@ -1118,7 +1088,7 @@
 	nua_notify(nh,
 			   SIPTAG_SUBSCRIPTION_STATE_STR(exp),
 			   SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
-	
+
 	switch_safe_free(id);
 	switch_safe_free(exp);
 
@@ -1139,33 +1109,29 @@
 	char *id = NULL;
 	nua_handle_t *nh;
 	struct mwi_helper *h = (struct mwi_helper *) pArg;
-	
-	
+
+
 	id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
 
 	contact = sofia_glue_get_url_from_contact(o_contact, 1);
-	
-	nh = nua_handle(h->profile->nua, NULL,
-					NUTAG_URL(contact),
-					SIPTAG_FROM_STR(id),
-					SIPTAG_TO_STR(id),
-					SIPTAG_CONTACT_STR(h->profile->url),
-					TAG_END());
-	
+
+	nh = nua_handle(h->profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(h->profile->url), TAG_END());
+
 	nua_notify(nh,
 			   NUTAG_NEWSUB(1),
 			   TAG_IF(strstr(o_contact, ";nat"), NUTAG_PROXY(contact)),
 			   SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
-	
+
 	switch_safe_free(contact);
 	switch_safe_free(id);
-	
+
 	return 0;
 }
 
 void sofia_presence_handle_sip_i_subscribe(int status,
-							char const *phrase,
-							nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+										   char const *phrase,
+										   nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+										   tagi_t tags[])
 {
 	if (sip) {
 		long exp, exp_raw;
@@ -1205,15 +1171,14 @@
 		get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
 		network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
 
-		tl_gets(tags,
-				NUTAG_SUBSTATE_REF(sub_state), TAG_END());
+		tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
 
 		event = sip_header_as_string(profile->home, (void *) sip->sip_event);
 
 		port = (char *) contact->m_url->url_port;
 		contact_host = sip->sip_contact->m_url->url_host;
 		contact_user = sip->sip_contact->m_url->url_user;
-			
+
 		display = contact->m_display;
 
 		if (switch_strlen_zero(display)) {
@@ -1226,12 +1191,12 @@
 		} else {
 			display = "\"user\"";
 		}
-			
+
 		if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
 			if (sip && sip->sip_via) {
 				const char *v_port = sip->sip_via->v_port;
 				const char *v_host = sip->sip_via->v_host;
-					
+
 				if (v_host && sip->sip_via->v_received) {
 					is_nat = "via received";
 				} else if (v_host && strcmp(network_ip, v_host)) {
@@ -1241,27 +1206,27 @@
 				}
 			}
 		}
-			
+
 		if (!is_nat && profile->nat_acl_count) {
 			uint32_t x = 0;
 			int ok = 1;
 			char *last_acl = NULL;
-				
+
 			if (!switch_strlen_zero(contact_host)) {
-				for (x = 0 ; x < profile->nat_acl_count; x++) {
+				for (x = 0; x < profile->nat_acl_count; x++) {
 					last_acl = profile->nat_acl[x];
 					if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
 						break;
 					}
 				}
-					
+
 				if (ok) {
 					is_nat = last_acl;
 				}
 			}
 		}
-			
-			
+
+
 		if (is_nat) {
 			contact_host = network_ip;
 			switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
@@ -1272,14 +1237,14 @@
 		if (port) {
 			switch_snprintf(new_port, sizeof(new_port), ":%s", port);
 		}
-			
+
 		if (contact->m_url->url_params) {
 			contact_str = switch_mprintf("%s <sip:%s@%s%s;%s>%s",
 										 display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params, is_nat ? ";nat" : "");
 		} else {
 			contact_str = switch_mprintf("%s <sip:%s@%s%s>%s", display, contact->m_url->url_user, contact_host, new_port, is_nat ? ";nat" : "");
 		}
-		
+
 
 		if (to) {
 			to_str = switch_mprintf("sip:%s@%s", to->a_url->url_user, to->a_url->url_host);	//, to->a_url->url_port);
@@ -1306,7 +1271,7 @@
 			if ((p = strchr(protocol, '+'))) {
 				*p = '\0';
 			}
-			
+
 			if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 				switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "proto", protocol);
 				switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "login", "%s", profile->name);
@@ -1315,7 +1280,7 @@
 				switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "status", "Click To Call");
 				switch_event_fire(&sevent);
 			}
-		
+
 		} else {
 			if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
 				switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
@@ -1358,12 +1323,7 @@
 		} else {
 			sql = switch_mprintf("delete from sip_subscriptions where "
 								 "proto='%q' and sip_user='%q' and sip_host='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'",
-								 proto,
-								 from_user,
-								 from_host,
-								 to_user,
-								 to_host, event
-								 );
+								 proto, from_user, from_host, to_user, to_host, event);
 		}
 
 
@@ -1377,34 +1337,30 @@
 			sip_accept_t *ap = sip->sip_accept;
 			char accept[256] = "";
 			full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent);
-			while(ap) {
+			while (ap) {
 				switch_snprintf(accept + strlen(accept), sizeof(accept) - strlen(accept), "%s%s ", ap->ac_type, ap->ac_next ? "," : "");
 				ap = ap->ac_next;
 			}
 			sql = switch_mprintf("insert into sip_subscriptions values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q')",
-								 proto, from_user, from_host, to_user, to_host, event, 
-								 contact_str, call_id, full_from, full_via, exp, full_agent, accept);
-			
+								 proto, from_user, from_host, to_user, to_host, event, contact_str, call_id, full_from, full_via, exp, full_agent, accept);
+
 			switch_assert(sql != NULL);
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 
 			sstr = switch_mprintf("active;expires=%ld", exp_raw);
 		}
-	
+
 		switch_mutex_unlock(profile->ireg_mutex);
 
 
 		if (status < 200) {
 			char *sticky = NULL;
-			
+
 			if (is_nat) {
 				sticky = switch_mprintf("sip:%s@%s:%d", contact_user, network_ip, network_port);
 			}
 
-			nua_respond(nh, SIP_202_ACCEPTED,						
-						NUTAG_WITH_THIS(nua),
-						SIPTAG_SUBSCRIPTION_STATE_STR(sstr), 
-						TAG_IF(sticky, NUTAG_PROXY(sticky)),
+			nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS(nua), SIPTAG_SUBSCRIPTION_STATE_STR(sstr), TAG_IF(sticky, NUTAG_PROXY(sticky)),
 						//SIPTAG_FROM(sip->sip_to),
 						//SIPTAG_TO(sip->sip_from),
 						//SIPTAG_CONTACT_STR(contact_str),
@@ -1413,32 +1369,26 @@
 			switch_safe_free(sticky);
 
 		}
-		
+
 		sent_reply++;
 
 #if 0
 
-		nua_notify(nh, 
+		nua_notify(nh,
 				   NUTAG_NEWSUB(1),
-				   SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR(event), 
+				   SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR(event),
 				   SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"),
-				   SIPTAG_PAYLOAD_STR("Note: Come to ClueCon http://www.cluecon.com\n\n"),
-				   TAG_END());
+				   SIPTAG_PAYLOAD_STR("Note: Come to ClueCon http://www.cluecon.com\n\n"), TAG_END());
 #endif
 
 		switch_safe_free(sstr);
 
 		if ((sql = switch_mprintf("select * from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, to_host))) {
-			sofia_glue_execute_sql_callback(profile,
-											SWITCH_FALSE,
-											profile->ireg_mutex,
-											sql,
-											sofia_presence_sub_reg_callback,
-											profile);
+			sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile);
 
 			switch_safe_free(sql);
 		}
-	end:
+	  end:
 
 		if (event) {
 			su_free(profile->home, event);
@@ -1466,13 +1416,15 @@
 }
 
 void sofia_presence_handle_sip_r_subscribe(int status,
-							char const *phrase,
-							nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+										   char const *phrase,
+										   nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+										   tagi_t tags[])
 {
 
 }
 
-void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+										 tagi_t tags[])
 {
 	if (sip) {
 		sip_from_t const *from = sip->sip_from;
@@ -1573,8 +1525,9 @@
 }
 
 void sofia_presence_handle_sip_i_message(int status,
-						  char const *phrase,
-						  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+										 char const *phrase,
+										 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+										 tagi_t tags[])
 {
 	if (sip) {
 		sip_from_t const *from = sip->sip_from;
@@ -1692,7 +1645,7 @@
 
 	if (sofia_reg_find_reg_url(tech_pvt->profile, sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host, buf, sizeof(buf))) {
 		home = su_home_new(sizeof(*home));
-		switch_assert(home != NULL);		
+		switch_assert(home != NULL);
 		tech_pvt->chat_from = sip_header_as_string(home, (const sip_header_t *) sip->sip_to);
 		tech_pvt->chat_to = switch_core_session_strdup(tech_pvt->session, buf);
 		sofia_presence_set_hash_key(hash_key, sizeof(hash_key), sip);
@@ -1706,6 +1659,7 @@
 	switch_core_hash_insert(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt);
 
 }
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	Tue May 27 00:54:52 2008
@@ -38,21 +38,21 @@
 
 static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr, int unreg)
 {
-    if (gateway_ptr->nh) {
-        if (unreg) {
-            nua_unregister(gateway_ptr->nh,
-                           NUTAG_URL(gateway_ptr->register_url),
-                           SIPTAG_FROM_STR(gateway_ptr->register_from),
-                           SIPTAG_TO_STR(gateway_ptr->register_from),
-                           SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-                           SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
-                           NUTAG_REGISTRAR(gateway_ptr->register_proxy),
-                           NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
-        }
-        nua_handle_bind(gateway_ptr->nh, NULL);
-        nua_handle_destroy(gateway_ptr->nh);
-        gateway_ptr->nh = NULL;
-    }
+	if (gateway_ptr->nh) {
+		if (unreg) {
+			nua_unregister(gateway_ptr->nh,
+						   NUTAG_URL(gateway_ptr->register_url),
+						   SIPTAG_FROM_STR(gateway_ptr->register_from),
+						   SIPTAG_TO_STR(gateway_ptr->register_from),
+						   SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+						   SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
+						   NUTAG_REGISTRAR(gateway_ptr->register_proxy),
+						   NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
+		}
+		nua_handle_bind(gateway_ptr->nh, NULL);
+		nua_handle_destroy(gateway_ptr->nh);
+		gateway_ptr->nh = NULL;
+	}
 
 }
 
@@ -64,7 +64,7 @@
 			free(gateway_ptr->sofia_private);
 			gateway_ptr->sofia_private = NULL;
 		}
-        sofia_reg_kill_reg(gateway_ptr, 1);
+		sofia_reg_kill_reg(gateway_ptr, 1);
 	}
 }
 
@@ -94,7 +94,7 @@
 			gateway_ptr->pinging = 1;
 			nua_options(nh, TAG_END());
 		}
-		
+
 		switch (ostate) {
 		case REG_STATE_NOREG:
 			gateway_ptr->status = SOFIA_GATEWAY_UP;
@@ -107,12 +107,12 @@
 			break;
 
 		case REG_STATE_UNREGISTER:
-            sofia_reg_kill_reg(gateway_ptr, 1);
+			sofia_reg_kill_reg(gateway_ptr, 1);
 			gateway_ptr->state = REG_STATE_NOREG;
 			break;
 		case REG_STATE_UNREGED:
 			gateway_ptr->status = SOFIA_GATEWAY_DOWN;
-            sofia_reg_kill_reg(gateway_ptr, 1);
+			sofia_reg_kill_reg(gateway_ptr, 1);
 
 			if ((gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
 											  NUTAG_URL(gateway_ptr->register_proxy),
@@ -120,10 +120,10 @@
 											  NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "registering %s\n", gateway_ptr->name);
 
-                if (!gateway_ptr->sofia_private) {
-                    gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
-                    switch_assert(gateway_ptr->sofia_private);
-                }
+				if (!gateway_ptr->sofia_private) {
+					gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
+					switch_assert(gateway_ptr->sofia_private);
+				}
 				memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
 
 				gateway_ptr->sofia_private->gateway = gateway_ptr;
@@ -159,7 +159,7 @@
 			break;
 
 		case REG_STATE_FAILED:
-            sofia_reg_kill_reg(gateway_ptr, 0);
+			sofia_reg_kill_reg(gateway_ptr, 0);
 			gateway_ptr->status = SOFIA_GATEWAY_DOWN;
 		case REG_STATE_TRYING:
 			if (gateway_ptr->retry && now >= gateway_ptr->retry) {
@@ -201,7 +201,7 @@
 	nua_options(nh, TAG_END());
 
 	switch_safe_free(contact);
-	
+
 	return 0;
 }
 
@@ -242,15 +242,10 @@
 {
 	char sql[1024];
 	char *psql = sql;
-	
+
 	switch_snprintf(sql, sizeof(sql), "select *,'%s' from sip_registrations where call_id='%s'", profile->name, call_id);
 	switch_mutex_lock(profile->ireg_mutex);
-	sofia_glue_execute_sql_callback(profile,
-									SWITCH_TRUE,
-									NULL,
-									sql,
-									sofia_reg_del_callback,
-									NULL);
+	sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_del_callback, NULL);
 	switch_mutex_unlock(profile->ireg_mutex);
 
 	switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where call_id='%s'", call_id);
@@ -262,19 +257,19 @@
 	char sql[1024];
 
 #ifdef SWITCH_HAVE_ODBC
-    if (profile->odbc_dsn) {
-     	if (!profile->master_odbc) {
+	if (profile->odbc_dsn) {
+		if (!profile->master_odbc) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
 			return;
-		}   
-    } else {
+		}
+	} else {
 #endif
 		if (!profile->master_db) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
 			return;
 		}
 #ifdef SWITCH_HAVE_ODBC
-    }
+	}
 #endif
 
 
@@ -286,12 +281,7 @@
 		switch_snprintf(sql, sizeof(sql), "select *,'%s' from sip_registrations where expires > 0", profile->name);
 	}
 
-	sofia_glue_execute_sql_callback(profile,
-									SWITCH_TRUE,
-									NULL,
-									sql,
-									sofia_reg_del_callback,
-									NULL);
+	sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_del_callback, NULL);
 	if (now) {
 		switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld", (long) now);
 	} else {
@@ -299,7 +289,7 @@
 	}
 
 	sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, NULL);
-	
+
 	if (now) {
 		switch_snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and expires <= %ld", (long) now);
 	} else {
@@ -307,7 +297,7 @@
 	}
 
 	sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, NULL);
-	
+
 
 
 	if (now) {
@@ -316,12 +306,7 @@
 		switch_snprintf(sql, sizeof(sql), "select call_id from sip_subscriptions where expires > 0");
 	}
 
-	sofia_glue_execute_sql_callback(profile,
-									SWITCH_TRUE,
-									NULL,
-									sql,
-									sofia_sub_del_callback,
-									profile);
+	sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_sub_del_callback, profile);
 
 	if (now) {
 		switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0 and expires <= %ld", (long) now);
@@ -330,16 +315,11 @@
 	}
 
 	sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, NULL);
-	
+
 
 	if (now) {
 		switch_snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%AUTO-NAT%%'");
-		sofia_glue_execute_sql_callback(profile,
-										SWITCH_TRUE,
-										NULL,
-										sql,
-										sofia_reg_nat_callback,
-										profile);
+		sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_nat_callback, profile);
 	}
 
 	switch_mutex_unlock(profile->ireg_mutex);
@@ -365,12 +345,7 @@
 	}
 
 
-	sofia_glue_execute_sql_callback(profile,
-									SWITCH_FALSE,
-									profile->ireg_mutex,
-									val,
-									sofia_reg_find_callback,
-									&cbt);
+	sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, val, sofia_reg_find_callback, &cbt);
 
 
 	if (cbt.matches) {
@@ -390,30 +365,24 @@
 	switch_uuid_get(&uuid);
 	switch_uuid_format(uuid_str, &uuid);
 
-	sql = switch_mprintf("insert into sip_authentication (nonce, expires) values('%q', %ld)",
-						 uuid_str, switch_timestamp(NULL) + profile->nonce_ttl);
+	sql = switch_mprintf("insert into sip_authentication (nonce, expires) values('%q', %ld)", uuid_str, switch_timestamp(NULL) + profile->nonce_ttl);
 	switch_assert(sql != NULL);
 	sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
 	switch_safe_free(sql);
 	//sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 
-	auth_str =
-		switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=\"true\"," : "");
+	auth_str = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=\"true\"," : "");
 
 	if (regtype == REG_REGISTER) {
-		nua_respond(nh, 
-					SIP_401_UNAUTHORIZED, 
-					TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
+		nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
 	} else if (regtype == REG_INVITE) {
-		nua_respond(nh, 
-					SIP_407_PROXY_AUTH_REQUIRED, 
-					TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
+		nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
 	}
 
 	switch_safe_free(auth_str);
 }
 
-uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sip_t const *sip, sofia_regtype_t regtype, char *key,
+uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, sofia_regtype_t regtype, char *key,
 								  uint32_t keylen, switch_event_t **v_event, const char *is_nat)
 {
 	sip_to_t const *to = NULL;
@@ -446,7 +415,7 @@
 
 	get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr);
 	network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
-	
+
 	expires = sip->sip_expires;
 	authorization = sip->sip_authorization;
 	contact = sip->sip_contact;
@@ -468,14 +437,14 @@
 		char new_port[25] = "";
 		const char *contact_host = contact->m_url->url_host;
 		display = contact->m_display;
-		
+
 		if (is_nat) {
 			reg_desc = "Registered(AUTO-NAT)";
 			contact_host = network_ip;
 			switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
 			port = NULL;
 		}
-		
+
 		if (switch_strlen_zero(display)) {
 			if (to) {
 				display = to->a_display;
@@ -495,13 +464,10 @@
 
 		if (contact->m_url->url_params) {
 			switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s;%s>%s%s",
-							display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params, 
-							received_data,
-							is_nat ? ";nat" : "");
+							display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params, received_data, is_nat ? ";nat" : "");
 		} else {
-			switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s>%s%s", display, contact->m_url->url_user, contact_host, new_port, 
-							received_data,
-							is_nat ? ";nat" : "");
+			switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s>%s%s", display, contact->m_url->url_user, contact_host, new_port,
+							received_data, is_nat ? ";nat" : "");
 		}
 	}
 
@@ -524,37 +490,38 @@
 
 	if (authorization) {
 		char *v_contact_str;
-		if ((auth_res = sofia_reg_parse_auth(profile, authorization, sip, sip->sip_request->rq_method_name, 
+		if ((auth_res = sofia_reg_parse_auth(profile, authorization, sip, sip->sip_request->rq_method_name,
 											 key, keylen, network_ip, v_event, exptime, regtype, to_user)) == AUTH_STALE) {
 			stale = 1;
 		}
-		
+
 		if (exptime && v_event && *v_event) {
 			char *exp_var;
 
 			register_gateway = switch_event_get_header(*v_event, "sip-register-gateway");
-	
+
 			/* Allow us to force the SIP user to be something specific - needed if 
 			 * we - for example - want to be able to ensure that the username a UA can
 			 * be contacted at is the same one that they used for authentication.
-			 */ 
+			 */
 			if ((force_user = switch_event_get_header(*v_event, "sip-force-user"))) {
 				to_user = force_user;
 			}
-			
+
 			if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
 
 				if (*received_data && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
 					switch_snprintf(received_data, sizeof(received_data), ";received=\"%s:%d\"", network_ip, network_port);
 				}
 
-				if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") || 
+				if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
 					!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
 					if (contact->m_url->url_params) {
 						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>%s;nat",
 										display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params, received_data);
 					} else {
-						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>%s;nat", display, contact->m_url->url_user, network_ip, network_port, received_data);
+						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>%s;nat", display, contact->m_url->url_user, network_ip,
+										network_port, received_data);
 					}
 					if (strstr(v_contact_str, "tls")) {
 						reg_desc = "Registered(TLSHACK)";
@@ -566,14 +533,14 @@
 				} else {
 					char *p;
 					switch_copy_string(contact_str, v_contact_str, sizeof(contact_str));
-					for(p = contact_str; p && *p; p++) {
+					for (p = contact_str; p && *p; p++) {
 						if (*p == '\'' || *p == '[' || *p == ']') {
 							*p = '"';
 						}
 					}
 				}
 			}
-			
+
 			if ((exp_var = switch_event_get_header(*v_event, "sip-force-expires"))) {
 				int tmp = atoi(exp_var);
 				if (tmp > 0) {
@@ -585,13 +552,9 @@
 		if (auth_res != AUTH_OK && !stale) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "send %s for [%s@%s]\n", forbidden ? "forbidden" : "challange", to_user, to_host);
 			if (auth_res == AUTH_FORBIDDEN) {
-				nua_respond(nh, 
-							SIP_403_FORBIDDEN, 
-							NUTAG_WITH_THIS(nua), TAG_END());
+				nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
 			} else {
-				nua_respond(nh, 
-							SIP_401_UNAUTHORIZED, 
-							NUTAG_WITH_THIS(nua), TAG_END());
+				nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
 			}
 			return 1;
 		}
@@ -604,13 +567,13 @@
 		}
 		return 1;
 	}
- reg:
+  reg:
 
 	if (regtype != REG_REGISTER) {
 		return 0;
 	}
 
-	call_id = sip->sip_call_id->i_id; //sip_header_as_string(profile->home, (void *) sip->sip_call_id);
+	call_id = sip->sip_call_id->i_id;	//sip_header_as_string(profile->home, (void *) sip->sip_call_id);
 	switch_assert(call_id);
 
 	if (exptime) {
@@ -627,10 +590,9 @@
 		}
 		switch_mutex_lock(profile->ireg_mutex);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
-		
+
 		sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','%q', '%q', %ld, '%q')", call_id,
-							 to_user, to_host, contact_str, reg_desc,
-							 rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent);
+							 to_user, to_host, contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent);
 		if (sql) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 		}
@@ -647,7 +609,7 @@
 			switch_event_fire(&s_event);
 		}
 
-		
+
 
 		if (profile->debug) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
@@ -676,7 +638,7 @@
 			if ((sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id))) {
 				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 			}
-			
+
 			if ((sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id))) {
 				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 			}
@@ -685,7 +647,7 @@
 			if ((sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, to_host))) {
 				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 			}
-			
+
 			if ((sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, to_host))) {
 				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 			}
@@ -709,22 +671,22 @@
 		switch_event_fire(&event);
 	}
 
-	
+
 	/*
-	  if (call_id) {
-	  su_free(profile->home, call_id);
-	  }
-	*/
+	   if (call_id) {
+	   su_free(profile->home, call_id);
+	   }
+	 */
 
 	if (regtype == REG_REGISTER) {
 		char *new_contact = NULL;
 		char new_port[30] = "";
 		char exp_param[128] = "";
-		
+
 		if (exptime) {
 			switch_snprintf(exp_param, sizeof(exp_param), ";expires=%ld", exptime);
 		}
-			
+
 
 		if (contact->m_url->url_port) {
 			switch_snprintf(new_port, sizeof(new_port), ":%s", contact->m_url->url_port);
@@ -732,17 +694,12 @@
 
 		if (contact->m_url->url_params) {
 			new_contact = switch_mprintf("%s <sip:%s@%s%s;%s>%s",
-										 display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params,
-										 exp_param);
+										 display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params, exp_param);
 		} else {
-			new_contact = switch_mprintf("%s <sip:%s@%s%s>%s",
-										 display, contact->m_url->url_user, contact->m_url->url_host, new_port,
-										 exp_param);
-		}
-			
-		nua_respond(nh,
-					SIP_200_OK, 
-					SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
+			new_contact = switch_mprintf("%s <sip:%s@%s%s>%s", display, contact->m_url->url_user, contact->m_url->url_host, new_port, exp_param);
+		}
+
+		nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
 		switch_safe_free(new_contact);
 
 		if (exptime) {
@@ -763,7 +720,7 @@
 				}
 			}
 		}
-		
+
 
 		return 1;
 	}
@@ -773,7 +730,8 @@
 
 
 
-void sofia_reg_handle_sip_i_register(nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									 tagi_t tags[])
 {
 	char key[128] = "";
 	switch_event_t *v_event = NULL;
@@ -785,7 +743,7 @@
 
 	get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
 	network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
-	
+
 
 	if (!(sip->sip_contact && sip->sip_contact->m_url)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
@@ -794,9 +752,7 @@
 	}
 
 	if (!(profile->mflags & MFLAG_REGISTER)) {
-		nua_respond(nh, 
-					SIP_403_FORBIDDEN, 
-					NUTAG_WITH_THIS(nua), TAG_END());
+		nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
 		goto end;
 	}
 
@@ -804,7 +760,7 @@
 		if (sip && sip->sip_via) {
 			const char *port = sip->sip_via->v_port;
 			const char *host = sip->sip_via->v_host;
-			
+
 			if (host && sip->sip_via->v_received) {
 				is_nat = "via received";
 			} else if (host && strcmp(network_ip, host)) {
@@ -826,13 +782,13 @@
 		}
 
 		if (!switch_strlen_zero(contact_host)) {
-			for (x = 0 ; x < profile->nat_acl_count; x++) {
+			for (x = 0; x < profile->nat_acl_count; x++) {
 				last_acl = profile->nat_acl[x];
 				if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
 					break;
 				}
 			}
-			
+
 			if (ok) {
 				is_nat = last_acl;
 			}
@@ -844,29 +800,25 @@
 		int ok = 1;
 		char *last_acl = NULL;
 
-		for (x = 0 ; x < profile->reg_acl_count; x++) {
+		for (x = 0; x < profile->reg_acl_count; x++) {
 			last_acl = profile->reg_acl[x];
 			if (!(ok = switch_check_network_list_ip(network_ip, last_acl))) {
 				break;
 			}
 		}
-		
+
 		if (ok && !(profile->pflags & PFLAG_BLIND_REG)) {
 			type = REG_AUTO_REGISTER;
 		} else if (!ok) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip,  profile->reg_acl[x]);
-			nua_respond(nh, 
-						SIP_403_FORBIDDEN, 
-						NUTAG_WITH_THIS(nua), TAG_END());
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, profile->reg_acl[x]);
+			nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
 			goto end;
 		}
 	}
-	
+
 	if (!sip || !sip->sip_request || !sip->sip_request->rq_method_name) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received an invalid packet!\n");
-		nua_respond(nh, 
-					SIP_500_INTERNAL_SERVER_ERROR, 
-					TAG_END());
+		nua_respond(nh, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
 		goto end;
 	}
 
@@ -876,7 +828,7 @@
 		switch_event_fire(&v_event);
 	}
 
- end:	
+  end:
 
 	nua_handle_destroy(nh);
 
@@ -885,7 +837,8 @@
 
 void sofia_reg_handle_sip_r_register(int status,
 									 char const *phrase,
-									 nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									 tagi_t tags[])
 {
 	if (sofia_private && sofia_private->gateway) {
 		switch (status) {
@@ -915,7 +868,7 @@
 
 void sofia_reg_handle_sip_r_challenge(int status,
 									  char const *phrase,
-									  nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, 
+									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
 									  switch_core_session_t *session, sofia_gateway_t *gateway, sip_t const *sip, tagi_t tags[])
 {
 	sip_www_authenticate_t const *authenticate = NULL;
@@ -976,17 +929,17 @@
 
 	return;
 
- cancel:
+  cancel:
 
 	if (session) {
 		switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_MANDATORY_IE_MISSING);
 	} else {
 		nua_cancel(nh, TAG_END());
 	}
-	
+
 }
 
-auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr, 
+auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr,
 								char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user)
 {
 	int indexnum;
@@ -1001,13 +954,13 @@
 	const char *a1_hash = NULL;
 	char *sql;
 	char *mailbox = NULL;
-	switch_xml_t domain, xml = NULL, user, param, uparams, dparams;	
+	switch_xml_t domain, xml = NULL, user, param, uparams, dparams;
 	char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1] = "";
 	char *domain_name = NULL;
 	switch_event_t *params = NULL;
 
 	username = realm = nonce = uri = qop = cnonce = nc = response = NULL;
-	
+
 	if (authorization->au_params) {
 		for (indexnum = 0; (cur = authorization->au_params[indexnum]); indexnum++) {
 			char *var, *val, *p, *work;
@@ -1052,7 +1005,7 @@
 		ret = AUTH_STALE;
 		goto end;
 	}
-	
+
 	/* Optional check that auth name == SIP username */
 	if ((regtype == REG_REGISTER) && (profile->pflags & PFLAG_CHECKUSER)) {
 		if (switch_strlen_zero(username) || switch_strlen_zero(to_user) || strcasecmp(to_user, username)) {
@@ -1072,44 +1025,45 @@
 			goto end;
 		}
 		free(sql);
-	} 
-	
+	}
+
 	switch_event_create(&params, SWITCH_EVENT_MESSAGE);
 	switch_assert(params);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "sip_auth");
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_profile", profile->name);
-	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_user_agent", (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown");
+	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_user_agent",
+								   (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown");
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_username", username);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_realm", realm);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_nonce", nonce);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_uri", uri);
-    if (qop) {
-        switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_qop", qop);
-    }
-    if (cnonce) {
-        switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_cnonce", cnonce);
-    }
-    if (nc) {
-        switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_nc", nc);
-    }
+	if (qop) {
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_qop", qop);
+	}
+	if (cnonce) {
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_cnonce", cnonce);
+	}
+	if (nc) {
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_nc", nc);
+	}
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_response", response);
 
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_method", (sip && sip->sip_request) ? sip->sip_request->rq_method_name : NULL);
 
-	
+
 	if (!switch_strlen_zero(profile->reg_domain)) {
 		domain_name = profile->reg_domain;
 	} else {
 		domain_name = realm;
 	}
-	
+
 	if (switch_xml_locate_user("id", username, domain_name, ip, &xml, &domain, &user, params) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", username, domain_name);
 		ret = AUTH_FORBIDDEN;
 		goto end;
 	}
 
-	if (!(mailbox = (char *)switch_xml_attr(user, "mailbox"))) {
+	if (!(mailbox = (char *) switch_xml_attr(user, "mailbox"))) {
 		mailbox = username;
 	}
 
@@ -1125,11 +1079,11 @@
 		for (param = switch_xml_child(dparams, "param"); param; param = param->next) {
 			const char *var = switch_xml_attr_soft(param, "name");
 			const char *val = switch_xml_attr_soft(param, "value");
-			
+
 			if (!strcasecmp(var, "password")) {
 				passwd = val;
 			}
-			
+
 			if (!strcasecmp(var, "a1-hash")) {
 				a1_hash = val;
 			}
@@ -1140,11 +1094,11 @@
 		for (param = switch_xml_child(uparams, "param"); param; param = param->next) {
 			const char *var = switch_xml_attr_soft(param, "name");
 			const char *val = switch_xml_attr_soft(param, "value");
-			
+
 			if (!strcasecmp(var, "password")) {
 				passwd = val;
 			}
-			
+
 			if (!strcasecmp(var, "a1-hash")) {
 				a1_hash = val;
 			}
@@ -1164,10 +1118,10 @@
 		su_md5_deinit(&ctx);
 		switch_safe_free(input);
 		a1_hash = hexdigest;
-			
+
 	}
 
- for_the_sake_of_interop:
+  for_the_sake_of_interop:
 
 	if ((input = switch_mprintf("%s:%q", regstr, uri))) {
 		su_md5_init(&ctx);
@@ -1176,38 +1130,38 @@
 		su_md5_deinit(&ctx);
 	}
 
-    if (nc && cnonce && qop) {
-        input2 = switch_mprintf("%q:%q:%q:%q:%q:%q", a1_hash, nonce, nc, cnonce, qop, uridigest);
-    } else {
-        input2 = switch_mprintf("%q:%q:%q", a1_hash, nonce, uridigest);
-    }
-
-    switch_assert(input2);
-
-    memset(&ctx, 0, sizeof(ctx));
-    su_md5_init(&ctx);
-    su_md5_strupdate(&ctx, input2);
-    su_md5_hexdigest(&ctx, bigdigest);
-    su_md5_deinit(&ctx);
-
-    if (!strcasecmp(bigdigest, response)) {
-        ret = AUTH_OK;
-    } else {
-        if ((profile->ndlb & PFLAG_NDLB_BROKEN_AUTH_HASH) && strcasecmp(regstr, "REGISTER") && strcasecmp(regstr, "INVITE")) {
-            /* some clients send an ACK with the method 'INVITE' in the hash which will break auth so we will
-               try again with INVITE so we don't get people complaining to us when someone else's client has a bug......
-            */
-            switch_safe_free(input);
-            switch_safe_free(input2);
-            regstr = "INVITE";
-            goto for_the_sake_of_interop;
-        }
-
-        ret = AUTH_FORBIDDEN;
-    }
-        
+	if (nc && cnonce && qop) {
+		input2 = switch_mprintf("%q:%q:%q:%q:%q:%q", a1_hash, nonce, nc, cnonce, qop, uridigest);
+	} else {
+		input2 = switch_mprintf("%q:%q:%q", a1_hash, nonce, uridigest);
+	}
 
- skip_auth:
+	switch_assert(input2);
+
+	memset(&ctx, 0, sizeof(ctx));
+	su_md5_init(&ctx);
+	su_md5_strupdate(&ctx, input2);
+	su_md5_hexdigest(&ctx, bigdigest);
+	su_md5_deinit(&ctx);
+
+	if (!strcasecmp(bigdigest, response)) {
+		ret = AUTH_OK;
+	} else {
+		if ((profile->ndlb & PFLAG_NDLB_BROKEN_AUTH_HASH) && strcasecmp(regstr, "REGISTER") && strcasecmp(regstr, "INVITE")) {
+			/* some clients send an ACK with the method 'INVITE' in the hash which will break auth so we will
+			   try again with INVITE so we don't get people complaining to us when someone else's client has a bug......
+			 */
+			switch_safe_free(input);
+			switch_safe_free(input2);
+			regstr = "INVITE";
+			goto for_the_sake_of_interop;
+		}
+
+		ret = AUTH_FORBIDDEN;
+	}
+
+
+  skip_auth:
 
 	if (first && ret == AUTH_OK) {
 		if (v_event) {
@@ -1223,7 +1177,7 @@
 			switch_event_add_header(*v_event, SWITCH_STACK_BOTTOM, "mailbox", "%s", mailbox);
 			switch_event_add_header(*v_event, SWITCH_STACK_BOTTOM, "user_name", "%s", username);
 			switch_event_add_header(*v_event, SWITCH_STACK_BOTTOM, "domain_name", "%s", realm);
-			
+
 			if ((dparams = switch_xml_child(domain, "variables"))) {
 				xparams[i++] = dparams;
 			}
@@ -1243,7 +1197,7 @@
 
 						if (!switch_strlen_zero(var) && !switch_strlen_zero(val)) {
 							switch_event_add_header(*v_event, SWITCH_STACK_BOTTOM, var, "%s", val);
-						
+
 							if (!strcasecmp(var, "register-gateway")) {
 								if (!strcasecmp(val, "all")) {
 									switch_xml_t gateways_tag, gateway_tag;
@@ -1253,7 +1207,7 @@
 											if (switch_strlen_zero(name)) {
 												name = "anonymous";
 											}
-									
+
 											if ((gateway_ptr = sofia_reg_find_gateway(name))) {
 												gateway_ptr->retry = 0;
 												if (exptime) {
@@ -1263,7 +1217,7 @@
 												}
 												sofia_reg_release_gateway(gateway_ptr);
 											}
-	
+
 										}
 									}
 								} else {
@@ -1272,11 +1226,11 @@
 
 									mydata = strdup(val);
 									switch_assert(mydata != NULL);
-								
+
 									argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
 
 									for (x = 0; x < argc; x++) {
-										if ((gateway_ptr = sofia_reg_find_gateway((char *)argv[x]))) {
+										if ((gateway_ptr = sofia_reg_find_gateway((char *) argv[x]))) {
 											gateway_ptr->retry = 0;
 											if (exptime) {
 												gateway_ptr->state = REG_STATE_UNREGED;
@@ -1298,7 +1252,7 @@
 			}
 		}
 	}
- end:
+  end:
 
 	switch_event_destroy(&params);
 
@@ -1329,7 +1283,7 @@
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	if ((gateway = (sofia_gateway_t *) switch_core_hash_find(mod_sofia_globals.gateway_hash, key))) {
 		if (!(gateway->profile->pflags & PFLAG_RUNNING)) {
-			gateway =  NULL;
+			gateway = NULL;
 			goto done;
 		}
 		if (switch_thread_rwlock_tryrdlock(gateway->profile->rwlock) != SWITCH_STATUS_SUCCESS) {
@@ -1343,7 +1297,7 @@
 #endif
 	}
 
- done:
+  done:
 	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 	return gateway;
 }

Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/lib_api.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/lib_api.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/lib_api.c	Tue May 27 00:54:52 2008
@@ -39,16 +39,16 @@
 #define RANGE_CHANNEL	0x1
 
 
-char	read_enable=0;
-char 	write_enable=0;
-char 	primary_enable=0;
-int 	tx_cnt=1;
-int	rx_cnt=0;
-int	tx_size=10;
-int	tx_delay=0;
-int	tx_data=-1;
-int	tx_ss7_type=0;
-int	rx_ss7_timer=0;
+char read_enable = 0;
+char write_enable = 0;
+char primary_enable = 0;
+int tx_cnt = 1;
+int rx_cnt = 0;
+int tx_size = 10;
+int tx_delay = 0;
+int tx_data = -1;
+int tx_ss7_type = 0;
+int rx_ss7_timer = 0;
 
 unsigned char card_name[WAN_IFNAME_SZ];
 unsigned char if_name[WAN_IFNAME_SZ];
@@ -63,343 +63,343 @@
 unsigned char saddr[TX_ADDR_STR_SZ];
 unsigned char udata[TX_ADDR_STR_SZ];
 
-int	files_used=0;
-int	verbose=0;
+int files_used = 0;
+int verbose = 0;
 
-int	tx_connections;
+int tx_connections;
 
-int	ds_prot=0;
-int	ds_prot_opt=0;
-int	ds_max_mult_cnt=0;
-unsigned int ds_active_ch=0;
-int	ds_7bit_hdlc=0;
-int 	direction=-1;
-
-int 	tx_channels=1;
-int	cause=0;
-int 	diagn=0;
+int ds_prot = 0;
+int ds_prot_opt = 0;
+int ds_max_mult_cnt = 0;
+unsigned int ds_active_ch = 0;
+int ds_7bit_hdlc = 0;
+int direction = -1;
+
+int tx_channels = 1;
+int cause = 0;
+int diagn = 0;
 
-int 	card_cnt=0;
-int 	i_cnt=0;
+int card_cnt = 0;
+int i_cnt = 0;
 
-unsigned long parse_active_channel(char* val);
+unsigned long parse_active_channel(char *val);
 
 int init_args(int argc, char *argv[])
 {
 	int i;
-	int c_cnt=0;
+	int c_cnt = 0;
 
-	sprintf(daddr,"111");
-	sprintf(saddr,"222");
-	sprintf(udata,"C9");
-	
-	for (i = 0; i < argc; i++){
-		
-		if (!strcmp(argv[i],"-i")){
+	sprintf(daddr, "111");
+	sprintf(saddr, "222");
+	sprintf(udata, "C9");
 
-			if (i+1 > argc-1){
+	for (i = 0; i < argc; i++) {
+
+		if (!strcmp(argv[i], "-i")) {
+
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid Interface Name!\n");
 				return WAN_FALSE;
 			}
 
-			strncpy(if_name, argv[i+1],WAN_IFNAME_SZ);
-			i_cnt=1;
-		
-		}else if (!strcmp(argv[i],"-si")){
-			if (i+1 > argc-1){
+			strncpy(if_name, argv[i + 1], WAN_IFNAME_SZ);
+			i_cnt = 1;
+
+		} else if (!strcmp(argv[i], "-si")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid Switch Interface Name!\n");
 				return WAN_FALSE;
 			}
-			
-			strncpy(sw_if_name, argv[i+1], WAN_IFNAME_SZ);
 
-		}else if (!strcmp(argv[i],"-c")){
-			if (i+1 > argc-1){
+			strncpy(sw_if_name, argv[i + 1], WAN_IFNAME_SZ);
+
+		} else if (!strcmp(argv[i], "-c")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid Card Name!\n");
 				return WAN_FALSE;
 			}
-			
-			strncpy(card_name, argv[i+1], WAN_IFNAME_SZ);
-			card_cnt=1;
-			
-		}else if (!strcmp(argv[i],"-sc")){
-			if (i+1 > argc-1){
+
+			strncpy(card_name, argv[i + 1], WAN_IFNAME_SZ);
+			card_cnt = 1;
+
+		} else if (!strcmp(argv[i], "-sc")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid Switch Card Name!\n");
 				return WAN_FALSE;
 			}
-			
-			strncpy(sw_card_name, argv[i+1], WAN_IFNAME_SZ);
 
-		}else if (!strcmp(argv[i],"-r")){
-			read_enable=1;
-			c_cnt=1;
-	
-		}else if (!strcmp(argv[i],"-w")){
-			write_enable=1;
-			c_cnt=1;
-
-		}else if (!strcmp(argv[i],"-pri")){
-			primary_enable=1;
-		
-		}else if (!strcmp(argv[i],"-txcnt")){
-			if (i+1 > argc-1){
+			strncpy(sw_card_name, argv[i + 1], WAN_IFNAME_SZ);
+
+		} else if (!strcmp(argv[i], "-r")) {
+			read_enable = 1;
+			c_cnt = 1;
+
+		} else if (!strcmp(argv[i], "-w")) {
+			write_enable = 1;
+			c_cnt = 1;
+
+		} else if (!strcmp(argv[i], "-pri")) {
+			primary_enable = 1;
+
+		} else if (!strcmp(argv[i], "-txcnt")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid tx cnt!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				tx_cnt = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				tx_cnt = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid tx cnt!\n");
 				return WAN_FALSE;
 			}
 
-		}else if (!strcmp(argv[i],"-rxcnt")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-rxcnt")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid rx cnt!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				rx_cnt = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				rx_cnt = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid rx cnt!\n");
 				return WAN_FALSE;
 			}
 
-		}else if (!strcmp(argv[i],"-txsize")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-txsize")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid tx size!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				tx_size = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				tx_size = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid tx size, must be a digit!\n");
 				return WAN_FALSE;
 			}
-		}else if (!strcmp(argv[i],"-txdelay")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-txdelay")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid tx delay!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				tx_delay = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				tx_delay = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid tx delay, must be a digit!\n");
 				return WAN_FALSE;
 			}
-		}else if (!strcmp(argv[i],"-txdata")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-txdata")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid tx data!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				tx_data = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				tx_data = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid tx data, must be a digit!\n");
 				return WAN_FALSE;
 			}
-		}else if (!strcmp(argv[i],"-tx_ss7_type")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-tx_ss7_type")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid tx ss7 type!\n");
 				return WAN_FALSE;
 			}
-	
-			if(isdigit(argv[i+1][0])){
-				tx_ss7_type = atoi(argv[i+1]);
-			}else{
+
+			if (isdigit(argv[i + 1][0])) {
+				tx_ss7_type = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid tx ss7 type, must be a digit!\n");
 				return WAN_FALSE;
 			}
-		 
-		}else if (!strcmp(argv[i],"-rx_ss7_timer")){
-			if (i+1 > argc-1){
+
+		} else if (!strcmp(argv[i], "-rx_ss7_timer")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid rx ss7 timer!\n");
 				return WAN_FALSE;
 			}
-	
-			if(isdigit(argv[i+1][0])){
-				rx_ss7_timer = atoi(argv[i+1]);
-			}else{
+
+			if (isdigit(argv[i + 1][0])) {
+				rx_ss7_timer = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid tx ss7 type, must be a digit!\n");
 				return WAN_FALSE;
 			}
-		 
 
-		}else if (!strcmp(argv[i],"-txfile")){
 
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-txfile")) {
+
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid Tx File Name!\n");
 				return WAN_FALSE;
 			}
 
-			strncpy(tx_file, argv[i+1],WAN_IFNAME_SZ);
+			strncpy(tx_file, argv[i + 1], WAN_IFNAME_SZ);
 			files_used |= TX_FILE_USED;
-			
-		}else if (!strcmp(argv[i],"-rxfile")){
 
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-rxfile")) {
+
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid Rx File Name!\n");
 				return WAN_FALSE;
 			}
 
-			strncpy(rx_file, argv[i+1],WAN_IFNAME_SZ);
+			strncpy(rx_file, argv[i + 1], WAN_IFNAME_SZ);
 			files_used |= RX_FILE_USED;
 
-		}else if (!strcmp(argv[i],"-daddr")){
+		} else if (!strcmp(argv[i], "-daddr")) {
 
-			if (i+1 > argc-1){
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid daddr str!\n");
 				return WAN_FALSE;
 			}
 
-			strncpy(daddr, argv[i+1],TX_ADDR_STR_SZ);
-		
-		}else if (!strcmp(argv[i],"-saddr")){
+			strncpy(daddr, argv[i + 1], TX_ADDR_STR_SZ);
 
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-saddr")) {
+
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid saddr str!\n");
 				return WAN_FALSE;
 			}
 
-			strncpy(saddr, argv[i+1],TX_ADDR_STR_SZ);
-		
-		}else if (!strcmp(argv[i],"-udata")){
+			strncpy(saddr, argv[i + 1], TX_ADDR_STR_SZ);
+
+		} else if (!strcmp(argv[i], "-udata")) {
 
-			if (i+1 > argc-1){
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid udata str!\n");
 				return WAN_FALSE;
 			}
 
-			strncpy(udata, argv[i+1],TX_ADDR_STR_SZ);
+			strncpy(udata, argv[i + 1], TX_ADDR_STR_SZ);
 
-		}else if (!strcmp(argv[i],"-verbose")){
-			verbose=1;
+		} else if (!strcmp(argv[i], "-verbose")) {
+			verbose = 1;
 
-		}else if (!strcmp(argv[i],"-prot")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-prot")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid prot!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				ds_prot = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				ds_prot = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid prot, must be a digit!\n");
 				return WAN_FALSE;
 			}
 
-			
-		}else if (!strcmp(argv[i],"-prot_opt")){
-			if (i+1 > argc-1){
+
+		} else if (!strcmp(argv[i], "-prot_opt")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid prot_opt!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				ds_prot_opt = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				ds_prot_opt = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid prot_opt, must be a digit!\n");
 				return WAN_FALSE;
 			}
-		}else if (!strcmp(argv[i],"-max_mult_cnt")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-max_mult_cnt")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid max_mult_cnt!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				ds_max_mult_cnt = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				ds_max_mult_cnt = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid max_mult_cnt, must be a digit!\n");
 				return WAN_FALSE;
 			}
-		}else if (!strcmp(argv[i],"-active_ch")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-active_ch")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid active ch!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			ds_active_ch = parse_active_channel(argv[i+1]);
-		}else if (!strcmp(argv[i],"-txchan")){
-			if (i+1 > argc-1){
+			ds_active_ch = parse_active_channel(argv[i + 1]);
+		} else if (!strcmp(argv[i], "-txchan")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid channels!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				tx_channels = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				tx_channels = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid channels, must be a digit!\n");
 				return WAN_FALSE;
 			}
-		}else if (!strcmp(argv[i],"-diagn")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-diagn")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid diagn!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				diagn = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				diagn = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid diagn, must be a digit!\n");
 				return WAN_FALSE;
 			}
-			
-		}else if (!strcmp(argv[i],"-cause")){
-			if (i+1 > argc-1){
+
+		} else if (!strcmp(argv[i], "-cause")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid cause!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				cause = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				cause = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid cause, must be a digit!\n");
 				return WAN_FALSE;
 			}
 
-		}else if (!strcmp(argv[i],"-7bit_hdlc")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-7bit_hdlc")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid 7bit hdlc value!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				ds_7bit_hdlc = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				ds_7bit_hdlc = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid 7bit hdlc, must be a digit!\n");
 				return WAN_FALSE;
 			}
 
-		}else if (!strcmp(argv[i],"-dir")){
-			if (i+1 > argc-1){
+		} else if (!strcmp(argv[i], "-dir")) {
+			if (i + 1 > argc - 1) {
 				printf("ERROR: Invalid direction value!\n");
 				return WAN_FALSE;
-			}		
+			}
 
-			if(isdigit(argv[i+1][0])){
-				direction = atoi(argv[i+1]);
-			}else{
+			if (isdigit(argv[i + 1][0])) {
+				direction = atoi(argv[i + 1]);
+			} else {
 				printf("ERROR: Invalid direction, must be a digit!\n");
 				return WAN_FALSE;
 			}
 		}
 	}
 
-	if (!i_cnt){
+	if (!i_cnt) {
 		printf("ERROR: No Interface Name!\n");
 		return WAN_FALSE;
 	}
-	if (!card_cnt){
+	if (!card_cnt) {
 		printf("ERROR: No Card name!\n");
 		return WAN_FALSE;
 	}
-	if (!c_cnt){
+	if (!c_cnt) {
 		printf("ERROR: No Read or Write Command!\n");
 		return WAN_FALSE;
 	}
@@ -407,69 +407,66 @@
 	return WAN_TRUE;
 }
 
-static unsigned char api_usage[]="\n"
-"\n"
-"<options>:\n"
-"	-i  <ifname>     #interface name\n"
-"	-c  <card name>  #card name\n"
-"	-r               #read enable\n"
-"	-w               #write eable\n"
-"\n"
-"<extra options>\n"
-"	-txcnt   <digit>  #number of tx packets  (Dflt: 1)\n"
-"	-txsize  <digit>  #tx packet size        (Dflt: 10)\n"
-"	-txdelay <digit>  #delay in sec after each tx packet (Dflt: 0)\n"
-"	-txdata  <digit>  #data to tx <1-255>\n"
-"\n"
-"	-txfile  <file>   #Use file to tx instead\n"
-"	-rxfile  <file>   #Save all rx data to a file\n"
-"	\n"
-"\n"
-"	-tx_ss7_type  <digit> # 1=FISU   2=LSSU (repeating)\n"
-"	-rx_ss7_timer <digit> #Force receive timeout value \n"
-"\n"
-"	-rxcnt   <digit>  #number of rx packets before exit\n"
-"			  #this number overwrites the txcnt\n"
-"	                  #Thus, app will only exit after it\n"
-"	                  #receives the rxcnt number of packets.\n"
-"	\n"
-"	-verbose	  #Enable verbose mode\n"
-"\n"
-"<datascope options>\n"
-"\n"
-"	-prot		<digit>	  #Protocol Bit map: \n"
-"				  #1=FISU, 2=LSSU, 4=MSU, 8=RAW HDLC\n"
-"	\n"
-"	-prot_opt	<digit>	  #Protocol bit map\n"
-"			          #0=None, 1=Delta, 2=Max Multiple\n"		  
-"\n"
-"	-active_ch	<digit>   #Active channel\n" 
-"                                  #ALL = all channels \n"
-"                                  #1 24 = 1 to 24 \n"
-"                                  #1.24 = 1 and 24 \n"
-"                                  #1-4.7-15 = 1 to 4 and 7 to 15\n"
-"	\n"
-"	-max_mult_cnt 	<digit>   #If Prot_opt == 2 \n"
-"                                  #max_mult_cnt is the number of \n"
-"                                  #consecutive duplicate frames \n"
-"                                  #received before pass up the stack.\n"
-"	\n"
-"	-7bit_hdlc	<digit>   #Enable 7 Bit Hdlc Engine\n"
-"	                          #1=Enable 0=Disable\n"
-"	\n"
-"	-dir		<digit>	  #Direction 0: Rx  1: Tx  none: All\n"
-"\n"
-"<x25 protocol options>\n"
-"\n"
-"	-txchan		<digit>  #Number of channels    (dflt=1)\n"
-"	-cause		<digit>  #disconnect cause      (dflt=0)\n"
-"	-diagn		<digit>  #disconnect diagnostic (dflt=0)\n"
-"\n";
+static unsigned char api_usage[] = "\n"
+	"\n"
+	"<options>:\n"
+	"	-i  <ifname>     #interface name\n"
+	"	-c  <card name>  #card name\n"
+	"	-r               #read enable\n"
+	"	-w               #write eable\n"
+	"\n"
+	"<extra options>\n"
+	"	-txcnt   <digit>  #number of tx packets  (Dflt: 1)\n"
+	"	-txsize  <digit>  #tx packet size        (Dflt: 10)\n"
+	"	-txdelay <digit>  #delay in sec after each tx packet (Dflt: 0)\n"
+	"	-txdata  <digit>  #data to tx <1-255>\n"
+	"\n"
+	"	-txfile  <file>   #Use file to tx instead\n"
+	"	-rxfile  <file>   #Save all rx data to a file\n"
+	"	\n"
+	"\n"
+	"	-tx_ss7_type  <digit> # 1=FISU   2=LSSU (repeating)\n"
+	"	-rx_ss7_timer <digit> #Force receive timeout value \n"
+	"\n"
+	"	-rxcnt   <digit>  #number of rx packets before exit\n"
+	"			  #this number overwrites the txcnt\n"
+	"	                  #Thus, app will only exit after it\n"
+	"	                  #receives the rxcnt number of packets.\n"
+	"	\n"
+	"	-verbose	  #Enable verbose mode\n"
+	"\n"
+	"<datascope options>\n"
+	"\n"
+	"	-prot		<digit>	  #Protocol Bit map: \n"
+	"				  #1=FISU, 2=LSSU, 4=MSU, 8=RAW HDLC\n"
+	"	\n"
+	"	-prot_opt	<digit>	  #Protocol bit map\n"
+	"			          #0=None, 1=Delta, 2=Max Multiple\n"
+	"\n"
+	"	-active_ch	<digit>   #Active channel\n"
+	"                                  #ALL = all channels \n"
+	"                                  #1 24 = 1 to 24 \n"
+	"                                  #1.24 = 1 and 24 \n"
+	"                                  #1-4.7-15 = 1 to 4 and 7 to 15\n"
+	"	\n"
+	"	-max_mult_cnt 	<digit>   #If Prot_opt == 2 \n"
+	"                                  #max_mult_cnt is the number of \n"
+	"                                  #consecutive duplicate frames \n"
+	"                                  #received before pass up the stack.\n"
+	"	\n"
+	"	-7bit_hdlc	<digit>   #Enable 7 Bit Hdlc Engine\n"
+	"	                          #1=Enable 0=Disable\n"
+	"	\n"
+	"	-dir		<digit>	  #Direction 0: Rx  1: Tx  none: All\n"
+	"\n"
+	"<x25 protocol options>\n"
+	"\n"
+	"	-txchan		<digit>  #Number of channels    (dflt=1)\n"
+	"	-cause		<digit>  #disconnect cause      (dflt=0)\n" "	-diagn		<digit>  #disconnect diagnostic (dflt=0)\n" "\n";
 
 void usage(unsigned char *api_name)
 {
-printf ("\n\nAPI %s USAGE:\n\n%s <options> <extra options>\n\n%s\n",
-		api_name,api_name,api_usage);
+	printf("\n\nAPI %s USAGE:\n\n%s <options> <extra options>\n\n%s\n", api_name, api_name, api_usage);
 }
 
 
@@ -483,30 +480,30 @@
 
 	if ((channel_flag & (SINGLE_CHANNEL | RANGE_CHANNEL)) == 0)
 		return tmp;
-	if (channel_flag & RANGE_CHANNEL) { /* Range of channels */
-		for(i = start_channel; i <= stop_channel; i++) {
+	if (channel_flag & RANGE_CHANNEL) {	/* Range of channels */
+		for (i = start_channel; i <= stop_channel; i++) {
 			mask = 1 << (i - 1);
-			tmp |=mask;
+			tmp |= mask;
 		}
-	} else { /* Single channel */ 
+	} else {					/* Single channel */
 		mask = 1 << (stop_channel - 1);
-		tmp |= mask; 
+		tmp |= mask;
 	}
 	return tmp;
 }
 
 
-unsigned long parse_active_channel(char* val)
+unsigned long parse_active_channel(char *val)
 {
 	int channel_flag = 0;
-	char* ptr = val;
+	char *ptr = val;
 	int channel = 0, start_channel = 0;
 	unsigned long tmp = 0;
 
-	if (strcmp(val,"ALL") == 0)
+	if (strcmp(val, "ALL") == 0)
 		return ENABLE_ALL_CHANNELS;
 
-	while(*ptr != '\0') {
+	while (*ptr != '\0') {
 		if (isdigit(*ptr)) {
 			channel = strtoul(ptr, &ptr, 10);
 			channel_flag |= SINGLE_CHANNEL;
@@ -521,7 +518,7 @@
 			ptr++;
 		}
 	}
-	if (channel_flag){
+	if (channel_flag) {
 		tmp |= get_active_channels(channel_flag, start_channel, channel);
 	}
 	return tmp;
@@ -531,7 +528,7 @@
 {
 	struct timeval tv;
 	tv.tv_usec = usec;
-	tv.tv_sec=0;
+	tv.tv_sec = 0;
 
-	select(0,NULL,NULL, NULL, &tv);
+	select(0, NULL, NULL, NULL, &tv);
 }

Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	Tue May 27 00:54:52 2008
@@ -86,8 +86,8 @@
 	switch_mutex_t *mutex;
 };
 
-unsigned int txseq=0;
-unsigned int rxseq=0;
+unsigned int txseq = 0;
+unsigned int rxseq = 0;
 
 #define SETUP_LEN CORE_MAX_CHAN_PER_SPAN*CORE_MAX_SPANS+1
 
@@ -233,19 +233,19 @@
 static int local_sangoma_tdm_read_event(sng_fd_t fd, wp_tdm_api_rx_hdr_t *rx_event)
 {
 	wanpipe_tdm_api_t tdm_api[1];
-	
+
 #if defined(WIN32)
-    rx_event = &last_tdm_api_event_buffer;
+	rx_event = &last_tdm_api_event_buffer;
 #else
-    int err;
+	int err;
 
-    tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
+	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
 
-    if ((err = sangoma_tdm_cmd_exec(fd, tdm_api))) {
-        return err;
-    }
+	if ((err = sangoma_tdm_cmd_exec(fd, tdm_api))) {
+		return err;
+	}
 
-    rx_event = &tdm_api->wp_tdm_cmd.event;
+	rx_event = &tdm_api->wp_tdm_cmd.event;
 #endif
 
 	return 0;
@@ -261,7 +261,7 @@
 {
 	wanpipe_tdm_api_t tdm_api;
 
-	switch(alc->state) {
+	switch (alc->state) {
 	case ANALOG_STATE_DOWN:
 		sangoma_tdm_enable_rxhook_events(alc->sock->fd, &tdm_api);
 		analog_set_state(alc, ANALOG_STATE_ONHOOK);
@@ -275,7 +275,7 @@
 {
 	wp_tdm_api_rx_hdr_t rx_event;
 	int err = local_sangoma_tdm_read_event(alc->sock->fd, &rx_event);
-	
+
 	if (err < 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reading event!\n");
 		return;
@@ -292,18 +292,18 @@
 static void *SWITCH_THREAD_FUNC fxs_thread_run(switch_thread_t *thread, void *obj)
 {
 
-	for(;;) {
+	for (;;) {
 		int i = 0, sel_on = -1;
 		fd_set oob;
 		FD_ZERO(&oob);
-		
-		for(i = 0; i < globals.fxs_index; i++) {
+
+		for (i = 0; i < globals.fxs_index; i++) {
 			int fd;
 			assert(FXS_ANALOG_CHANNELS[i]);
 			assert(FXS_ANALOG_CHANNELS[i]->sock);
 
 			fd = FXS_ANALOG_CHANNELS[i]->sock->fd;
-			
+
 			analog_check_state(FXS_ANALOG_CHANNELS[i]);
 
 			FD_SET(fd, &oob);
@@ -315,7 +315,7 @@
 
 		if (sel_on > -1) {
 			if (select(++sel_on, NULL, NULL, &oob, NULL)) {
-				for(i = 0; i < globals.fxs_index; i++) {
+				for (i = 0; i < globals.fxs_index; i++) {
 					int fd = FXS_ANALOG_CHANNELS[i]->sock->fd;
 					if (FD_ISSET(fd, &oob)) {
 						analog_parse_event(FXS_ANALOG_CHANNELS[i]);
@@ -332,7 +332,7 @@
 	sng_fd_t fd;
 	wpsock_t *sock;
 	char name[25];
-	
+
 	snprintf(name, sizeof(name), "s%dc%d", span, chan);
 
 	switch_mutex_lock(globals.hash_mutex);
@@ -359,7 +359,7 @@
 	wpsock_t *sock;
 	sng_fd_t fd;
 	char name[25];
-	
+
 	snprintf(name, sizeof(name), "s%dc%d", span, chan);
 
 	switch_mutex_lock(globals.hash_mutex);
@@ -375,7 +375,7 @@
 		sangoma_socket_close(&fd);
 		return 0;
 	}
-	
+
 	return -1;
 }
 
@@ -449,7 +449,7 @@
 	if (!strcasecmp(dp, "local"))
 		return PRI_LOCAL_ISDN;
 	if (!strcasecmp(dp, "private"))
-		return PRI_PRIVATE;		
+		return PRI_PRIVATE;
 	if (!strcasecmp(dp, "unknown"))
 		return PRI_UNKNOWN;
 
@@ -468,16 +468,14 @@
 static switch_status_t wanpipe_on_soft_execute(switch_core_session_t *session);
 static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
-static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame,
-										switch_io_flag_t flags, int stream_id);
-static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame,
-										 switch_io_flag_t flags, int stream_id);
-static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
-static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
-static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
+static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
+static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
+static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
+static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
 static int check_flags(struct sangoma_pri *spri);
-static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
-static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
+static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
 static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t *thread, void *obj);
 static switch_status_t config_wanpipe(int reload);
 
@@ -485,7 +483,7 @@
 static switch_status_t wanpipe_codec_init(private_object_t *tech_pvt)
 {
 	int err = 0;
-	wanpipe_tdm_api_t tdm_api = {{0}};
+	wanpipe_tdm_api_t tdm_api = { {0} };
 	unsigned int rate = 8000;
 	switch_channel_t *channel = NULL;
 
@@ -498,7 +496,7 @@
 	assert(channel != NULL);
 
 	err = sangoma_tdm_set_codec(tech_pvt->wpsock->fd, &tdm_api, WP_SLINEAR);
-	
+
 	sangoma_tdm_set_usr_period(tech_pvt->wpsock->fd, &tdm_api, globals.samples_per_frame / 8);
 	tech_pvt->frame_size = sangoma_tdm_get_usr_mtu_mru(tech_pvt->wpsock->fd, &tdm_api);
 
@@ -522,28 +520,28 @@
 	switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
 	switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
 
-#ifdef DOTRACE	
-						tech_pvt->fd = open("/tmp/wp-in.raw", O_WRONLY | O_TRUNC | O_CREAT);
-						tech_pvt->fd2 = open("/tmp/wp-out.raw", O_WRONLY | O_TRUNC | O_CREAT);
+#ifdef DOTRACE
+	tech_pvt->fd = open("/tmp/wp-in.raw", O_WRONLY | O_TRUNC | O_CREAT);
+	tech_pvt->fd2 = open("/tmp/wp-out.raw", O_WRONLY | O_TRUNC | O_CREAT);
 #endif
 
 	/* Setup artificial DTMF stuff */
 	memset(&tech_pvt->tone_session, 0, sizeof(tech_pvt->tone_session));
 	teletone_init_session(&tech_pvt->tone_session, 1024, NULL, NULL);
-	
+
 	if (globals.debug) {
 		tech_pvt->tone_session.debug = globals.debug;
 		tech_pvt->tone_session.debug_stream = stdout;
 	}
-	
+
 	tech_pvt->tone_session.rate = rate;
 	tech_pvt->tone_session.duration = globals.dtmf_on * (tech_pvt->tone_session.rate / 1000);
 	tech_pvt->tone_session.wait = globals.dtmf_off * (tech_pvt->tone_session.rate / 1000);
 
-	if (!globals.ignore_dtmf_tone) {	
-		teletone_dtmf_detect_init (&tech_pvt->dtmf_detect, rate);
+	if (!globals.ignore_dtmf_tone) {
+		teletone_dtmf_detect_init(&tech_pvt->dtmf_detect, rate);
 	}
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio init %s\n", switch_channel_get_name(channel));
 
 	switch_set_flag(tech_pvt, TFLAG_CODEC);
@@ -572,46 +570,46 @@
 
 	tech_pvt->read_frame.data = tech_pvt->databuf;
 
-	if (tech_pvt->ss7boost_handle)  {
+	if (tech_pvt->ss7boost_handle) {
 		if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
 			ss7boost_client_event_t event;
 
 			event.calling_number_presentation = tech_pvt->boost_pres;
 			event.trunk_group = tech_pvt->boost_trunk_group;
-		
+
 			switch_mutex_lock(tech_pvt->ss7boost_handle->mutex);
 			tech_pvt->setup_index = ++tech_pvt->ss7boost_handle->setup_index;
 			if (tech_pvt->ss7boost_handle->setup_index == SETUP_LEN - 1) {
 				tech_pvt->ss7boost_handle->setup_index = 0;
 			}
 			switch_mutex_unlock(tech_pvt->ss7boost_handle->mutex);
-		
+
 			switch_copy_string(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index],
-							   switch_core_session_get_uuid(session), 
-							   sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
-		
-			
-			ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->destination_number, tech_pvt->setup_index);
-			
+							   switch_core_session_get_uuid(session), sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
+
+
+			ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->destination_number,
+									  tech_pvt->setup_index);
+
 			if (ss7boost_client_connection_write(&tech_pvt->ss7boost_handle->mcon, &event) <= 0) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Critical System Error: Failed to tx on ISUP socket [%s]\n", strerror(errno));
 			}
-			
+
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Called Event TG=%d\n", tech_pvt->boost_trunk_group);
 			goto done;
 		}
-	} 
+	}
 
 	if ((status = wanpipe_codec_init(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		return status;
 	}
-	
+
 	if (switch_test_flag(tech_pvt, TFLAG_NOSIG)) {
 		switch_channel_mark_answered(channel);
 	}
 
- done:
+  done:
 
 	/* Move channel's state machine to ROUTING */
 	switch_channel_set_state(channel, CS_ROUTING);
@@ -631,7 +629,7 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE ROUTING\n");
 
-	
+
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -642,7 +640,7 @@
 	switch_channel_t *channel = NULL;
 	struct channel_map *chanmap = NULL;
 
-	
+
 	channel = switch_core_session_get_channel(session);
 	assert(channel != NULL);
 
@@ -661,11 +659,7 @@
 		switch_mutex_unlock(tech_pvt->ss7boost_handle->mutex);
 		if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
 			isup_exec_command(tech_pvt->ss7boost_handle,
-							  tech_pvt->boost_span_number,
-							  tech_pvt->boost_chan_number,
-							  -1,
-							  SIGBOOST_EVENT_CALL_STOPPED,
-							  SIGBOOST_RELEASE_CAUSE_NORMAL);
+							  tech_pvt->boost_span_number, tech_pvt->boost_chan_number, -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_NORMAL);
 		}
 	} else if (tech_pvt->spri) {
 		chanmap = tech_pvt->spri->private_info;
@@ -682,7 +676,7 @@
 		switch_mutex_lock(globals.channel_mutex);
 		*chanmap->map[tech_pvt->callno] = '\0';
 		switch_mutex_unlock(globals.channel_mutex);
-		
+
 	}
 
 	switch_set_flag_locked(tech_pvt, TFLAG_BYE);
@@ -690,7 +684,7 @@
 	teletone_destroy_session(&tech_pvt->tone_session);
 
 	switch_buffer_destroy(&tech_pvt->dtmf_buffer);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -731,19 +725,14 @@
 
 	if (tech_pvt->spri) {
 		struct channel_map *chanmap = tech_pvt->spri->private_info;
-			
+
 		if (switch_test_flag(tech_pvt, TFLAG_INBOUND)) {
 			switch_mutex_lock(chanmap->mutex);
 			pri_answer(tech_pvt->spri->pri, tech_pvt->call, 0, 1);
 			switch_mutex_unlock(chanmap->mutex);
 		}
 	} else if (tech_pvt->ss7boost_handle) {
-		isup_exec_command(tech_pvt->ss7boost_handle,
-						  tech_pvt->boost_span_number,
-						  tech_pvt->boost_chan_number,
-						  -1,
-						  SIGBOOST_EVENT_CALL_ANSWERED,
-						  0);
+		isup_exec_command(tech_pvt->ss7boost_handle, tech_pvt->boost_span_number, tech_pvt->boost_chan_number, -1, SIGBOOST_EVENT_CALL_ANSWERED, 0);
 	}
 
 	return SWITCH_STATUS_SUCCESS;
@@ -751,8 +740,7 @@
 
 
 
-static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame,
-										switch_io_flag_t flags, int stream_id)
+static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
 {
 	private_object_t *tech_pvt;
 	switch_channel_t *channel = NULL;
@@ -785,8 +773,7 @@
 		}
 
 		if ((bread = sangoma_readmsg_socket(tech_pvt->wpsock->fd,
-										  &tech_pvt->hdrframe,
-										  sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
+											&tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
 			if (errno == EBUSY) {
 				continue;
 			} else {
@@ -804,15 +791,15 @@
 
 	tech_pvt->read_frame.datalen = bytes;
 	tech_pvt->read_frame.samples = bytes / 2;
-	
+
 	if (!globals.ignore_dtmf_tone) {
-		teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
+		teletone_dtmf_detect(&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
 		teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str));
-	
+
 		if (digit_str[0]) {
 			char *p = digit_str;
-			switch_dtmf_t dtmf = {0, globals.dtmf_on};
-			while(p && *p) {
+			switch_dtmf_t dtmf = { 0, globals.dtmf_on };
+			while (p && *p) {
 				dtmf.digit = *p;
 				switch_channel_queue_dtmf(channel, &dtmf);
 				p++;
@@ -830,7 +817,7 @@
 			tech_pvt->skip_read_frames--;
 		}
 	}
-#ifdef DOTRACE	
+#ifdef DOTRACE
 	write(tech_pvt->fd2, tech_pvt->read_frame.data, (int) tech_pvt->read_frame.datalen);
 #endif
 	//printf("read %d\n", tech_pvt->read_frame.datalen);
@@ -838,8 +825,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame,
-										 switch_io_flag_t flags, int stream_id)
+static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
 {
 	private_object_t *tech_pvt;
 	uint32_t dtmf_blen;
@@ -856,25 +842,24 @@
 	if (tech_pvt->dtmf_buffer && (dtmf_blen = switch_buffer_inuse(tech_pvt->dtmf_buffer))) {
 		uint32_t len = dtmf_blen > frame->datalen ? frame->datalen : dtmf_blen;
 
-		switch_buffer_read(tech_pvt->dtmf_buffer, tech_pvt->auxbuf, len);		
+		switch_buffer_read(tech_pvt->dtmf_buffer, tech_pvt->auxbuf, len);
 		if (len < frame->datalen) {
 			uint8_t *data = frame->data;
 			memcpy(data + len, tech_pvt->auxbuf + len, frame->datalen - len);
 		}
-		data= tech_pvt->auxbuf;
-	} 
-	
+		data = tech_pvt->auxbuf;
+	}
+
 	if (tech_pvt->skip_write_frames) {
 		tech_pvt->skip_write_frames--;
 		return SWITCH_STATUS_SUCCESS;
 	}
-
 #ifdef DOTRACE
 	write(tech_pvt->fd, data, frame->datalen);
 #endif
 
 	result = sangoma_sendmsg_socket(tech_pvt->wpsock->fd, &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), data, frame->datalen, 0);
-	
+
 	if (result < 0 && errno != EBUSY) {
 		return SWITCH_STATUS_GENERR;
 	}
@@ -910,13 +895,13 @@
 	}
 
 	tech_pvt->tone_session.duration = dtmf.duration * (tech_pvt->tone_session.rate / 1000);
-	if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int)dtmf->digit]))) {
+	if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int) dtmf->digit]))) {
 		switch_buffer_write(tech_pvt->dtmf_buffer, tech_pvt->tone_session.buffer, wrote * 2);
 	}
 
 
 	tech_pvt->skip_read_frames = 200;
-	
+
 	return status;
 }
 
@@ -927,7 +912,7 @@
 
 	channel = switch_core_session_get_channel(session);
 	assert(channel != NULL);
-			
+
 	tech_pvt = (private_object_t *) switch_core_session_get_private(session);
 	assert(tech_pvt != NULL);
 
@@ -975,7 +960,7 @@
 	tech_pvt = switch_core_session_get_private(session);
 	assert(tech_pvt != NULL);
 
-	switch(sig) {
+	switch (sig) {
 	case SWITCH_SIG_KILL:
 		switch_clear_flag_locked(tech_pvt, TFLAG_MEDIA);
 		break;
@@ -993,8 +978,8 @@
 	/*.read_frame */ wanpipe_read_frame,
 	/*.write_frame */ wanpipe_write_frame,
 	/*.kill_channel */ wanpipe_kill_channel,
-	/*.send_dtmf*/ wanpipe_send_dtmf,
-	/*.receive_message*/ wanpipe_receive_message
+	/*.send_dtmf */ wanpipe_send_dtmf,
+	/*.receive_message */ wanpipe_receive_message
 };
 
 switch_state_handler_table_t wanpipe_state_handlers = {
@@ -1023,7 +1008,7 @@
 	int span = 0, autospan = 0, autochan = 0;
 	char *num, *p;
 	struct channel_map *chanmap = NULL;
-	
+
 	if (!outbound_profile) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
 		cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
@@ -1038,7 +1023,7 @@
 		cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 		goto error;
 	}
-	
+
 	*dest++ = '\0';
 
 	if (!strcasecmp(protocol, "raw")) {
@@ -1057,7 +1042,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error No SS7BOOST Spans Configured.\n");
 		}
 	}
-	
+
 	if (!ready) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Continue!\n");
 		cause = SWITCH_CAUSE_NETWORK_OUT_OF_ORDER;
@@ -1068,7 +1053,7 @@
 
 	if (!(*new_session = switch_core_session_request(wanpipe_endpoint_interface, pool))) {
 		cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
-        goto error;
+		goto error;
 	}
 
 	switch_core_session_add_stream(*new_session, NULL);
@@ -1085,7 +1070,7 @@
 		goto error;
 	}
 
-		
+
 	caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
 
 	if (is_pri) {
@@ -1139,7 +1124,7 @@
 	if (is_raw) {
 		int chan, span;
 
-		if (sangoma_span_chan_fromif (bchan, &span, &chan)) {
+		if (sangoma_span_chan_fromif(bchan, &span, &chan)) {
 			if (!(tech_pvt->wpsock = wp_open(span, chan))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n", span, chan, strerror(errno));
 				switch_core_session_destroy(new_session);
@@ -1148,7 +1133,7 @@
 			}
 			switch_set_flag_locked(tech_pvt, TFLAG_NOSIG);
 			snprintf(name, sizeof(name), "wanpipe/%s/nosig", bchan);
-			switch_channel_set_name(channel, name);			
+			switch_channel_set_name(channel, name);
 			switch_channel_set_caller_profile(channel, caller_profile);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid address\n");
@@ -1170,18 +1155,18 @@
 
 			if (SPANS[span] && (spri = &SPANS[span]->spri) && switch_test_flag(spri, SANGOMA_PRI_READY)) {
 				chanmap = spri->private_info;
-						
+
 				if (autochan > 0) {
-					for(callno = 1; callno < SANGOMA_MAX_CHAN_PER_SPAN; callno++) {
-						if ((SPANS[span]->bchans & (1 << callno)) && ! *chanmap->map[callno]) {
+					for (callno = 1; callno < SANGOMA_MAX_CHAN_PER_SPAN; callno++) {
+						if ((SPANS[span]->bchans & (1 << callno)) && !*chanmap->map[callno]) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, callno);
 							goto done;
 						}
 					}
 					callno = 0;
 				} else if (autochan < 0) {
-					for(callno = SANGOMA_MAX_CHAN_PER_SPAN; callno > 0; callno--) {
-						if ((SPANS[span]->bchans & (1 << callno)) && ! *chanmap->map[callno]) {
+					for (callno = SANGOMA_MAX_CHAN_PER_SPAN; callno > 0; callno--) {
+						if ((SPANS[span]->bchans & (1 << callno)) && !*chanmap->map[callno]) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, callno);
 							goto done;
 						}
@@ -1196,7 +1181,7 @@
 				span--;
 			}
 		}
-	done:
+	  done:
 		switch_mutex_unlock(globals.channel_mutex);
 
 		if (!spri || callno == 0 || callno == (SANGOMA_MAX_CHAN_PER_SPAN)) {
@@ -1205,17 +1190,17 @@
 			cause = SWITCH_CAUSE_SWITCH_CONGESTION;
 			goto error;
 		}
-				
+
 		tech_pvt->callno = callno;
-				
+
 		if (spri) {
 			struct channel_map *chanmap = spri->private_info;
 			switch_mutex_lock(chanmap->mutex);
 			if (tech_pvt->call = pri_new_call(spri->pri)) {
 				struct pri_sr *sr;
-					
+
 				snprintf(name, sizeof(name), "wanpipe/pri/s%dc%d/%s", spri->span, callno, caller_profile->destination_number);
-				switch_channel_set_name(channel, name);			
+				switch_channel_set_name(channel, name);
 				switch_channel_set_caller_profile(channel, caller_profile);
 				sr = pri_sr_new();
 				pri_sr_set_channel(sr, callno, 0, 0);
@@ -1223,23 +1208,18 @@
 				pri_sr_set_called(sr, caller_profile->destination_number, SPANS[span]->dp, 1);
 				pri_sr_set_caller(sr,
 								  caller_profile->caller_id_number,
-								  caller_profile->caller_id_name,
-								  SPANS[span]->dp,
-								  PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
+								  caller_profile->caller_id_name, SPANS[span]->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
 				pri_sr_set_redirecting(sr,
-									   caller_profile->caller_id_number,
-									   SPANS[span]->dp,
-									   PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN,
-									   PRI_REDIR_UNCONDITIONAL);
-				
-				if (pri_setup(spri->pri, tech_pvt->call , sr)) {
+									   caller_profile->caller_id_number, SPANS[span]->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
+
+				if (pri_setup(spri->pri, tech_pvt->call, sr)) {
 					switch_core_session_destroy(new_session);
 					pri_sr_free(sr);
 					cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 					switch_mutex_unlock(chanmap->mutex);
 					goto error;
 				}
-				
+
 				if (!(tech_pvt->wpsock = wp_open(spri->span, callno))) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd!\n");
 					switch_core_session_destroy(new_session);
@@ -1249,9 +1229,7 @@
 					goto error;
 				}
 				pri_sr_free(sr);
-				switch_copy_string(chanmap->map[callno],
-								   switch_core_session_get_uuid(*new_session),
-								   sizeof(chanmap->map[callno]));
+				switch_copy_string(chanmap->map[callno], switch_core_session_get_uuid(*new_session), sizeof(chanmap->map[callno]));
 				tech_pvt->spri = spri;
 			}
 			switch_mutex_unlock(chanmap->mutex);
@@ -1262,8 +1240,8 @@
 		if ((p = strchr(caller_profile->destination_number, '/'))) {
 			char *grp = caller_profile->destination_number;
 			*p = '\0';
-			caller_profile->destination_number = p+1;
-			tech_pvt->boost_trunk_group = atoi(grp+1) - 1;
+			caller_profile->destination_number = p + 1;
+			tech_pvt->boost_trunk_group = atoi(grp + 1) - 1;
 			if (tech_pvt->boost_trunk_group < 0) {
 				tech_pvt->boost_trunk_group = 0;
 			}
@@ -1284,9 +1262,9 @@
 	switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
 	switch_channel_set_state(channel, CS_INIT);
 	cause = SWITCH_CAUSE_SUCCESS;
-	
 
- error:
+
+  error:
 	switch_safe_free(protocol);
 	return cause;
 }
@@ -1357,7 +1335,7 @@
 
 /*event Handlers */
 
-static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "number is: %s\n", pevent->ring.callednum);
 	if (strlen(pevent->ring.callednum) > 3) {
@@ -1367,7 +1345,7 @@
 	return 0;
 }
 
-static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 	struct channel_map *chanmap;
 	switch_core_session_t *session;
@@ -1409,7 +1387,7 @@
 	return 0;
 }
 
-static int on_answer(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_answer(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 	switch_core_session_t *session;
 	switch_channel_t *channel;
@@ -1427,12 +1405,12 @@
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Answer on channel s%dc%d but it's not in use?\n", spri->span, pevent->answer.channel);
 	}
-	
+
 	return 0;
 }
 
 
-static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 	switch_core_session_t *session;
 	switch_channel_t *channel;
@@ -1444,16 +1422,16 @@
 		switch_core_session_message_t *msg;
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d\n", spri->span, pevent->proceeding.channel);
-		
+
 		channel = switch_core_session_get_channel(session);
 		assert(channel != NULL);
-		
+
 		switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_PROGRESS);
 		switch_channel_mark_pre_answered(channel);
-		
+
 		switch_core_session_rwunlock(session);
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d but it's not in use?\n", 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d but it's not in use?\n",
 						  spri->span, pevent->proceeding.channel);
 	}
 
@@ -1461,7 +1439,7 @@
 }
 
 
-static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 	switch_core_session_t *session;
 	switch_channel_t *channel;
@@ -1480,34 +1458,34 @@
 
 		switch_core_session_rwunlock(session);
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span, pevent->ringing.channel, chanmap->map[pevent->ringing.channel]);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span,
+						  pevent->ringing.channel, chanmap->map[pevent->ringing.channel]);
 	}
 
 	return 0;
 }
 
 
-static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 	char name[128];
 	switch_core_session_t *session = NULL;
 	switch_channel_t *channel;
 	struct channel_map *chanmap;
 	int ret = 0;
-	
+
 	switch_mutex_lock(globals.channel_mutex);
 
 	chanmap = spri->private_info;
 	if ((session = switch_core_session_locate(chanmap->map[pevent->ring.channel]))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--Duplicate Ring on channel s%dc%d (ignored)\n",
-							  spri->span, pevent->ring.channel);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--Duplicate Ring on channel s%dc%d (ignored)\n", spri->span, pevent->ring.channel);
 		switch_core_session_rwunlock(session);
 		ret = 0;
 		goto done;
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Ring on channel s%dc%d (from %s to %s)\n", spri->span, pevent->ring.channel,
-						  pevent->ring.callingnum, pevent->ring.callednum);
+					  pevent->ring.callingnum, pevent->ring.callednum);
 
 	switch_mutex_unlock(chanmap->mutex);
 	pri_proceeding(spri->pri, pevent->ring.call, pevent->ring.channel, 0);
@@ -1540,21 +1518,14 @@
 		}
 
 		if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
-																  NULL,
-																  globals.dialplan,
-																  "FreeSWITCH",
-																  pevent->ring.callingnum,
+																  NULL, globals.dialplan, "FreeSWITCH", pevent->ring.callingnum,
 #ifdef WIN32
 																  NULL,
 #else
 																  pevent->ring.callingani,
 #endif
 																  switch_strlen_zero(ani2str) ? NULL : ani2str,
-																  NULL,
-																  NULL,
-																  (char *)modname,
-																  globals.context,
-																  pevent->ring.callednum))) {
+																  NULL, NULL, (char *) modname, globals.context, pevent->ring.callednum))) {
 			switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 		}
 
@@ -1565,7 +1536,7 @@
 		if (!tech_pvt->call) {
 			tech_pvt->call = pevent->ring.call;
 		}
-		
+
 		tech_pvt->callno = pevent->ring.channel;
 		tech_pvt->span = spri->span;
 
@@ -1574,7 +1545,7 @@
 		}
 
 		switch_copy_string(chanmap->map[pevent->ring.channel], switch_core_session_get_uuid(session), sizeof(chanmap->map[pevent->ring.channel]));
-		
+
 		switch_channel_set_state(channel, CS_INIT);
 		if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
@@ -1586,9 +1557,9 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create new Inbound Channel!\n");
 	}
 
- done:
+  done:
 	switch_mutex_unlock(globals.channel_mutex);
-	
+
 	return ret;
 }
 
@@ -1598,7 +1569,7 @@
 	return 0;
 }
 
-static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 	switch_core_session_t *session;
 	struct channel_map *chanmap;
@@ -1612,7 +1583,7 @@
 
 
 	chanmap = spri->private_info;
-	
+
 	if ((session = switch_core_session_locate(chanmap->map[pevent->restart.channel]))) {
 		switch_channel_t *channel;
 		channel = switch_core_session_get_channel(session);
@@ -1620,13 +1591,13 @@
 		switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 		switch_core_session_rwunlock(session);
 	}
-	
+
 	wp_restart(spri->span, pevent->restart.channel);
 
 	return 0;
 }
 
-static int on_dchan_up(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_dchan_up(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 
 	if (!switch_test_flag(spri, SANGOMA_PRI_READY)) {
@@ -1637,22 +1608,21 @@
 	return 0;
 }
 
-static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 
 	if (switch_test_flag(spri, SANGOMA_PRI_READY)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Span %d D-Chan DOWN!\n", spri->span);
 		switch_clear_flag(spri, SANGOMA_PRI_READY);
 	}
-	
+
 	return 0;
 }
 
-static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
 {
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span, event_type,
-						  sangoma_pri_event_str(event_type));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span, event_type, sangoma_pri_event_str(event_type));
 	return 0;
 }
 
@@ -1699,7 +1669,7 @@
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
-	
+
 	switch_threadattr_create(&thd_attr, module_pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -1716,12 +1686,12 @@
 	switch_mutex_lock(ss7boost_handle->mutex);
 	ss7boost_client_event_init(&oevent, cmd, chan, span);
 	oevent.release_cause = cause;
-	
+
 	if (id >= 0) {
 		oevent.call_setup_id = id;
 	}
-	
-	if (ss7boost_client_connection_write(&ss7boost_handle->mcon, &oevent) <= 0){
+
+	if (ss7boost_client_connection_write(&ss7boost_handle->mcon, &oevent) <= 0) {
 		r = -1;
 	}
 
@@ -1733,26 +1703,26 @@
 #ifdef USE_WAITFOR_SOCKET
 static int waitfor_socket(int fd, int timeout, int flags)
 {
-    struct pollfd pfds[1];
-    int res;
- 
-    memset(&pfds[0], 0, sizeof(pfds[0]));
-    pfds[0].fd = fd;
-    pfds[0].events = flags;
-    res = poll(pfds, 1, timeout);
-
-    if (res > 0) {
-	if (pfds[0].revents & POLLIN) {
-		res = 1;
-	} else if ((pfds[0].revents & POLLERR)) {
-		res = -1;
-    	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"System Error: Poll Event Error no event!\n");
-		res = -1;
+	struct pollfd pfds[1];
+	int res;
+
+	memset(&pfds[0], 0, sizeof(pfds[0]));
+	pfds[0].fd = fd;
+	pfds[0].events = flags;
+	res = poll(pfds, 1, timeout);
+
+	if (res > 0) {
+		if (pfds[0].revents & POLLIN) {
+			res = 1;
+		} else if ((pfds[0].revents & POLLERR)) {
+			res = -1;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "System Error: Poll Event Error no event!\n");
+			res = -1;
+		}
 	}
-    }
 
-    return res;
+	return res;
 }
 #endif
 
@@ -1780,7 +1750,7 @@
 		if ((session = switch_core_session_locate(uuid))) {
 			private_object_t *tech_pvt;
 			switch_channel_t *channel;
-	
+
 			channel = switch_core_session_get_channel(session);
 			assert(channel != NULL);
 
@@ -1792,14 +1762,9 @@
 		}
 		*uuid = '\0';
 
-	} 
+	}
 
-	isup_exec_command(ss7boost_handle,
-					  event->span, 
-					  event->chan, 
-					  -1,
-					  SIGBOOST_EVENT_CALL_STOPPED_ACK,
-					  0);
+	isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_STOPPED_ACK, 0);
 
 
 }
@@ -1811,16 +1776,11 @@
 	char name[128];
 
 	if (*ss7boost_handle->span_chanmap[event->span].map[event->chan]) {
-		isup_exec_command(ss7boost_handle,
-						  event->span, 
-						  event->chan, 
-						  -1,
-						  SIGBOOST_EVENT_CALL_START_NACK,
-						  SIGBOOST_RELEASE_CAUSE_BUSY);		
+		isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_NACK, SIGBOOST_RELEASE_CAUSE_BUSY);
 		return;
 	}
 
-	
+
 	if ((session = switch_core_session_request(wanpipe_endpoint_interface, NULL))) {
 		private_object_t *tech_pvt;
 
@@ -1830,7 +1790,7 @@
 			switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
 			channel = switch_core_session_get_channel(session);
 			switch_core_session_set_private(session, tech_pvt);
-			sprintf(name, "wanpipe/ss7boost/s%dc%d", event->span+1, event->chan+1);
+			sprintf(name, "wanpipe/ss7boost/s%dc%d", event->span + 1, event->chan + 1);
 			switch_channel_set_name(channel, name);
 			tech_pvt->session = session;
 		} else {
@@ -1840,21 +1800,13 @@
 
 
 		if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
-																  NULL,
-																  globals.dialplan,
-																  "FreeSWITCH(boost)",
-																  (char *)event->calling_number_digits,
+																  NULL, globals.dialplan, "FreeSWITCH(boost)", (char *) event->calling_number_digits,
 #ifdef WIN32
 																  NULL,
 #else
-																  (char *)event->calling_number_digits,
+																  (char *) event->calling_number_digits,
 #endif
-																  NULL,
-																  NULL,
-																  NULL,
-																  (char *)modname,
-																  NULL,
-																  (char *)event->called_number_digits))) {
+																  NULL, NULL, NULL, (char *) modname, NULL, (char *) event->called_number_digits))) {
 			switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 		}
 
@@ -1866,40 +1818,30 @@
 		tech_pvt->boost_span_number = event->span;
 		tech_pvt->boost_chan_number = event->chan;
 		tech_pvt->boost_pres = event->calling_number_presentation;
-		
-		if (!(tech_pvt->wpsock = wp_open(event->span+1, event->chan+1))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open channel %d:%d\n", event->span+1, event->chan+1);
+
+		if (!(tech_pvt->wpsock = wp_open(event->span + 1, event->chan + 1))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open channel %d:%d\n", event->span + 1, event->chan + 1);
 			goto fail;
 		}
 
-		switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session), 
+		switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session),
 						   sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
-		
+
 		switch_channel_set_state(channel, CS_INIT);
-		isup_exec_command(ss7boost_handle,
-						  event->span, 
-						  event->chan, 
-						  -1,
-						  SIGBOOST_EVENT_CALL_START_ACK,
-						  0);
+		isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_ACK, 0);
 		switch_core_session_thread_launch(session);
 		return;
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create new Inbound Channel!\n");
 	}
 
-	
- fail:
+
+  fail:
 	if (session) {
 		switch_core_session_destroy(&session);
 	}
 
-	isup_exec_command(ss7boost_handle,
-					  event->span, 
-					  event->chan, 
-					  -1,
-					  SIGBOOST_EVENT_CALL_STOPPED,
-					  SIGBOOST_RELEASE_CAUSE_BUSY);
+	isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_BUSY);
 
 }
 
@@ -1909,45 +1851,40 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Heartbeat!\n");
 
-	isup_exec_command(ss7boost_handle,
-					  event->span, 
-					  event->chan, 
-					  -1,
-					  SIGBOOST_EVENT_HEARTBEAT,
-					  0);
+	isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_HEARTBEAT, 0);
 }
 
 
 static void handle_call_start_ack(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
 {
 	char *uuid = ss7boost_handle->setup_array[event->call_setup_id];
-	
+
 	if (*uuid) {
 		switch_core_session_t *session;
 
 		if ((session = switch_core_session_locate(uuid))) {
 			private_object_t *tech_pvt;
 			switch_channel_t *channel;
-	
+
 			channel = switch_core_session_get_channel(session);
 			assert(channel != NULL);
-			
+
 			tech_pvt = switch_core_session_get_private(session);
 			assert(tech_pvt != NULL);
-			
+
 			tech_pvt->ss7boost_handle = ss7boost_handle;
 			tech_pvt->boost_span_number = event->span;
 			tech_pvt->boost_chan_number = event->chan;
-			
-			switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session), 
+
+			switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session),
 							   sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
 
 
 
 			if (!tech_pvt->wpsock) {
-				if (!(tech_pvt->wpsock = wp_open(tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1))) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n", 
-									  tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1, strerror(errno));
+				if (!(tech_pvt->wpsock = wp_open(tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1))) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
+									  tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1, strerror(errno));
 					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 					return;
 				}
@@ -1958,7 +1895,7 @@
 			}
 
 			switch_channel_mark_pre_answered(channel);
-			
+
 			switch_core_session_rwunlock(session);
 		}
 		*uuid = '\0';
@@ -1976,11 +1913,11 @@
 
 	if (*uuid) {
 		switch_core_session_t *session;
-		
+
 		if ((session = switch_core_session_locate(uuid))) {
 			private_object_t *tech_pvt;
 			switch_channel_t *channel;
-	
+
 			channel = switch_core_session_get_channel(session);
 			assert(channel != NULL);
 
@@ -1988,9 +1925,9 @@
 			assert(tech_pvt != NULL);
 
 			if (!tech_pvt->wpsock) {
-				if (!(tech_pvt->wpsock=wp_open(tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1))) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n", 
-									  tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1, strerror(errno));
+				if (!(tech_pvt->wpsock = wp_open(tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1))) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
+									  tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1, strerror(errno));
 					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 					return;
 				}
@@ -1999,7 +1936,7 @@
 					return;
 				}
 			}
-			
+
 			switch_channel_mark_answered(channel);
 			switch_core_session_rwunlock(session);
 		} else {
@@ -2021,32 +1958,27 @@
 static void handle_call_start_nack(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
 {
 	char *uuid = ss7boost_handle->setup_array[event->call_setup_id];
-	
+
 	if (*uuid) {
 		switch_core_session_t *session;
 
 		if ((session = switch_core_session_locate(uuid))) {
 			private_object_t *tech_pvt;
 			switch_channel_t *channel;
-	
+
 			channel = switch_core_session_get_channel(session);
 			assert(channel != NULL);
-			
+
 			tech_pvt = switch_core_session_get_private(session);
 			assert(tech_pvt != NULL);
-			
+
 			tech_pvt->ss7boost_handle = ss7boost_handle;
 			tech_pvt->boost_span_number = event->span;
 			tech_pvt->boost_chan_number = event->chan;
-			
+
 			switch_channel_hangup(channel, event->release_cause);
-			
-			isup_exec_command(ss7boost_handle,
-							  event->span,
-							  event->chan, 
-							  event->call_setup_id,
-							  SIGBOOST_EVENT_CALL_START_NACK_ACK,
-							  0);
+
+			isup_exec_command(ss7boost_handle, event->span, event->chan, event->call_setup_id, SIGBOOST_EVENT_CALL_START_NACK_ACK, 0);
 
 			switch_core_session_rwunlock(session);
 		} else {
@@ -2061,9 +1993,9 @@
 	int ret = 0;
 
 	switch_mutex_lock(ss7boost_handle->mutex);
-		
-	validate_number((unsigned char*)event->called_number_digits);
-	validate_number((unsigned char*)event->calling_number_digits);
+
+	validate_number((unsigned char *) event->called_number_digits);
+	validate_number((unsigned char *) event->calling_number_digits);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 					  "\nRX EVENT\n"
@@ -2082,21 +2014,16 @@
 					  "\n",
 					  ss7boost_client_event_id_name(event->event_id),
 					  event->event_id,
-					  event->span+1,
-					  event->chan+1,
+					  event->span + 1,
+					  event->chan + 1,
 					  (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"),
 					  (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"),
 					  switch_channel_cause2str(event->release_cause),
-					  event->span+1,
-					  event->chan+1,
-					  event->event_id,
-					  event->call_setup_id,
-					  event->seqno
-					  );
-	
+					  event->span + 1, event->chan + 1, event->event_id, event->call_setup_id, event->seqno);
+
+
+	switch (event->event_id) {
 
-	switch(event->event_id) {
-	
 	case SIGBOOST_EVENT_CALL_START:
 		handle_call_start(ss7boost_handle, event);
 		break;
@@ -2122,7 +2049,7 @@
 		handle_call_stop_ack(ss7boost_handle, event);
 		break;
 	default:
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning no handler implemented for [%s]\n", 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning no handler implemented for [%s]\n",
 						  ss7boost_client_event_id_name(event->event_id));
 		break;
 	}
@@ -2136,42 +2063,34 @@
 	ss7boost_client_event_t *event;
 
 	if (ss7boost_client_connection_open(&ss7boost_handle->mcon,
-									ss7boost_handle->local_ip, 
-									ss7boost_handle->local_port,
-									ss7boost_handle->remote_ip,
-									ss7boost_handle->remote_port,
-									module_pool) != SWITCH_STATUS_SUCCESS) {
+										ss7boost_handle->local_ip,
+										ss7boost_handle->local_port,
+										ss7boost_handle->remote_ip, ss7boost_handle->remote_port, module_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FATAL ERROR CREATING CLIENT CONNECTION\n");
 		return NULL;
 	}
-			
-	isup_exec_command(ss7boost_handle,
-					  0,
-					  0, 
-					  -1,
-					  SIGBOOST_EVENT_SYSTEM_RESTART,
-					  0);
-	
-	
+
+	isup_exec_command(ss7boost_handle, 0, 0, -1, SIGBOOST_EVENT_SYSTEM_RESTART, 0);
+
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Started\n");
-	
+
 	switch_mutex_lock(globals.hash_mutex);
 	globals.configured_boost_spans++;
 	switch_mutex_unlock(globals.hash_mutex);
 
 	globals.ss7boost_handle = ss7boost_handle;
-	
-	for(;;) {
+
+	for (;;) {
 		if (ss7boost_client_connection_read(&ss7boost_handle->mcon, &event) == SWITCH_STATUS_SUCCESS) {
-				struct timeval current;
-				struct timeval difftime;
-				gettimeofday(&current,NULL);
-				timersub (&current, &event->tv, &difftime);
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket Event [%s] T=%d:%d\n",
-								  ss7boost_client_event_id_name(event->event_id),
-								  (int)difftime.tv_sec, (int)difftime.tv_usec);
-				
-				parse_ss7_event(ss7boost_handle, event);
+			struct timeval current;
+			struct timeval difftime;
+			gettimeofday(&current, NULL);
+			timersub(&current, &event->tv, &difftime);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket Event [%s] T=%d:%d\n",
+							  ss7boost_client_event_id_name(event->event_id), (int) difftime.tv_sec, (int) difftime.tv_usec);
+
+			parse_ss7_event(ss7boost_handle, event);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: Reading from Boost Socket! %s\n", strerror(errno));
 			break;
@@ -2180,8 +2099,8 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Close udp socket\n");
 	ss7boost_client_connection_close(&ss7boost_handle->mcon);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Ended\n");	
-	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Ended\n");
+
 
 	return NULL;
 }
@@ -2190,7 +2109,7 @@
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
-	
+
 	switch_threadattr_create(&thd_attr, module_pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -2251,7 +2170,7 @@
 		for (param = switch_xml_child(span, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
 			char *val = (char *) switch_xml_attr_soft(param, "value");
-			
+
 			if (!strcasecmp(var, "local-ip")) {
 				local_ip = val;
 			} else if (!strcasecmp(var, "local-port")) {
@@ -2282,7 +2201,7 @@
 	}
 
 	analog_channels = switch_xml_child(cfg, "analog_channels");
-	for(channel = switch_xml_child(analog_channels, "channel"); channel; channel = channel->next) {
+	for (channel = switch_xml_child(analog_channels, "channel"); channel; channel = channel->next) {
 		char *c_type = (char *) switch_xml_attr(channel, "type");
 		char *c_dev = (char *) switch_xml_attr(channel, "device");
 		char *user = NULL;
@@ -2292,7 +2211,7 @@
 		analog_type_t a_type = ANALOG_TYPE_UNKNOWN;
 		wpsock_t *sock;
 		int chan, span;
-		
+
 		if (!c_type) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required attribute 'type'\n");
 			continue;
@@ -2312,20 +2231,20 @@
 			continue;
 		}
 
-		if (!sangoma_span_chan_fromif (c_dev, &span, &chan)) {
+		if (!sangoma_span_chan_fromif(c_dev, &span, &chan)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid device name '%s'\n", c_dev);
 			continue;
 		}
-		
+
 		if (!(sock = wp_open(span, chan))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open device '%s' (%s)\n", c_dev, strerror(errno));
 			continue;
 		}
 
 		for (param = switch_xml_child(channel, "param"); param; param = param->next) {
-            char *var = (char *) switch_xml_attr_soft(param, "name");
-            char *val = (char *) switch_xml_attr_soft(param, "value");
-			
+			char *var = (char *) switch_xml_attr_soft(param, "name");
+			char *val = (char *) switch_xml_attr_soft(param, "value");
+
 			if (!strcasecmp(var, "user")) {
 				user = var;
 			} else if (!strcasecmp(var, "domain")) {
@@ -2351,7 +2270,7 @@
 		if (cid_num) {
 			alc->cid_name = strdup(cid_num);
 		}
-		
+
 		alc->a_type = a_type;
 		alc->sock = sock;
 		alc->chan = chan;
@@ -2368,7 +2287,7 @@
 	if (globals.fxs_index) {
 		switch_thread_t *thread;
 		switch_threadattr_t *thd_attr = NULL;
-	
+
 		switch_threadattr_create(&thd_attr, module_pool);
 		switch_threadattr_detach_set(thd_attr, 1);
 		switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -2383,10 +2302,10 @@
 		int32_t i = 0;
 
 		current_span = 0;
-		
+
 		if (id) {
 			char *p;
-			
+
 			min_span = atoi(id);
 			if ((p = strchr(id, '-'))) {
 				p++;
@@ -2402,16 +2321,16 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing SPAN ID!\n");
 			continue;
 		}
-		
+
 		for (i = min_span; i <= max_span; i++) {
 			current_span = i;
-			
+
 			if (current_span <= 0 || current_span > MAX_SPANS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid SPAN %d!\n", current_span);
 				current_span = 0;
 				continue;
 			}
-			
+
 			if (!SPANS[current_span]) {
 				if (!(SPANS[current_span] = switch_core_alloc(module_pool, sizeof(*SPANS[current_span])))) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "MEMORY ERROR\n");
@@ -2419,12 +2338,12 @@
 				}
 				SPANS[current_span]->span = current_span;
 			}
-			
+
 
 			for (param = switch_xml_child(span, "param"); param; param = param->next) {
 				char *var = (char *) switch_xml_attr_soft(param, "name");
 				char *val = (char *) switch_xml_attr_soft(param, "value");
-			
+
 				if (!strcmp(var, "dchan")) {
 					SPANS[current_span]->dchan = atoi(val);
 				} else if (!strcmp(var, "bchan")) {
@@ -2437,7 +2356,7 @@
 						fromi = atoi(from);
 						toi = atoi(to);
 						if (fromi > 0 && toi > 0 && fromi < toi && fromi < MAX_SPANS && toi < MAX_SPANS) {
-							for(x = fromi; x <= toi; x++) {
+							for (x = fromi; x <= toi; x++) {
 								SPANS[current_span]->bchans |= (1 << x);
 							}
 						} else {
@@ -2470,18 +2389,14 @@
 	}
 
 	globals.configured_spans = 0;
-	for(current_span = 1; current_span < MAX_SPANS; current_span++) {
+	for (current_span = 1; current_span < MAX_SPANS; current_span++) {
 		if (SPANS[current_span]) {
 
 			if (!SPANS[current_span]->l1) {
 				SPANS[current_span]->l1 = PRI_LAYER_1_ULAW;
 			}
 			if (sangoma_init_pri(&SPANS[current_span]->spri,
-								 current_span,
-								 SPANS[current_span]->dchan,
-								 SPANS[current_span]->pswitch,
-								 SPANS[current_span]->node,
-								 globals.debug)) {
+								 current_span, SPANS[current_span]->dchan, SPANS[current_span]->pswitch, SPANS[current_span]->node, globals.debug)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot launch span %d\n", current_span);
 				continue;
 			}

Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/ss7boost_client.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/ss7boost_client.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/ss7boost_client.c	Tue May 27 00:54:52 2008
@@ -56,7 +56,7 @@
 
 
 
-static switch_status_t create_udp_socket(ss7boost_client_connection_t * mcon, char *local_ip, int local_port, char *ip, int port)
+static switch_status_t create_udp_socket(ss7boost_client_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
 {
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d->%s:%d\n", local_ip, local_port, ip, port);
@@ -88,7 +88,7 @@
 
 
 
-SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_close(ss7boost_client_connection_t * mcon)
+SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_close(ss7boost_client_connection_t *mcon)
 {
 	switch_socket_close(mcon->socket);
 	mcon->socket = NULL;
@@ -97,7 +97,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_open(ss7boost_client_connection_t * mcon,
+SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_open(ss7boost_client_connection_t *mcon,
 																char *local_ip, int local_port, char *ip, int port, switch_memory_pool_t *pool)
 {
 	memset(mcon, 0, sizeof(*mcon));
@@ -112,7 +112,7 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_read(ss7boost_client_connection_t * mcon, ss7boost_client_event_t ** event)
+SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_read(ss7boost_client_connection_t *mcon, ss7boost_client_event_t **event)
 {
 	unsigned int fromlen = sizeof(struct sockaddr_in);
 	switch_size_t bytes = 0;
@@ -138,7 +138,7 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client_connection_t * mcon, ss7boost_client_event_t * event)
+SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client_connection_t *mcon, ss7boost_client_event_t *event)
 {
 	int err;
 	switch_size_t len;
@@ -200,7 +200,7 @@
 	return err ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(void) ss7boost_client_call_init(ss7boost_client_event_t * event, char *calling, char *called, int setup_id)
+SWITCH_DECLARE(void) ss7boost_client_call_init(ss7boost_client_event_t *event, char *calling, char *called, int setup_id)
 {
 	memset(event, 0, sizeof(ss7boost_client_event_t));
 	event->event_id = SIGBOOST_EVENT_CALL_START;
@@ -219,7 +219,7 @@
 
 }
 
-SWITCH_DECLARE(void) ss7boost_client_event_init(ss7boost_client_event_t * event, ss7boost_client_event_id_t event_id, int chan, int span)
+SWITCH_DECLARE(void) ss7boost_client_event_init(ss7boost_client_event_t *event, ss7boost_client_event_id_t event_id, int chan, int span)
 {
 	memset(event, 0, sizeof(ss7boost_client_event_t));
 	event->event_id = event_id;

Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/testapp.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/testapp.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/testapp.c	Tue May 27 00:54:52 2008
@@ -34,8 +34,8 @@
 #include <libsangoma.h>
 #include "lib_api.h"
 
-#define MAX_TX_DATA     5000	/* Size of tx data */  
-#define MAX_FRAMES 	5000     /* Number of frames to transmit */  
+#define MAX_TX_DATA     5000	/* Size of tx data */
+#define MAX_FRAMES 	5000		/* Number of frames to transmit */
 
 #define MAX_RX_DATA	5000
 
@@ -46,12 +46,12 @@
 
 /* Prototypes */
 int MakeConnection(void);
-void handle_span_chan( void);
+void handle_span_chan(void);
 void sig_end(int sigid);
 
 int dev_fd;
-FILE *tx_fd=NULL,*rx_fd=NULL;	
-wanpipe_tdm_api_t tdm_api; 
+FILE *tx_fd = NULL, *rx_fd = NULL;
+wanpipe_tdm_api_t tdm_api;
 
 
 /***************************************************
@@ -114,263 +114,246 @@
 *
 */
 
-void handle_span_chan(void) 
+void handle_span_chan(void)
 {
-	unsigned int Rx_count,Tx_count,Tx_length;
-	wp_tdm_api_rx_element_t* api_rx_el;
-	wp_tdm_api_tx_element_t * api_tx_el;
-	fd_set 	ready,write,oob;
-	int err,i;
-	
+	unsigned int Rx_count, Tx_count, Tx_length;
+	wp_tdm_api_rx_element_t *api_rx_el;
+	wp_tdm_api_tx_element_t *api_tx_el;
+	fd_set ready, write, oob;
+	int err, i;
+
 #if 0
 	int rlen;
-	int stream_sync=0;
+	int stream_sync = 0;
 #endif
-	
+
 	Rx_count = 0;
 	Tx_count = 0;
 
 	if (tdm_api.wp_tdm_cmd.hdlc) {
-                Tx_length = tx_size;
+		Tx_length = tx_size;
 	} else {
 		Tx_length = tdm_api.wp_tdm_cmd.usr_mtu_mru;
 	}
-	
-	printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i\n",
-			read_enable,write_enable,tx_cnt,tx_size,tx_delay);	
+
+	printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i\n", read_enable, write_enable, tx_cnt, tx_size, tx_delay);
 
 	/* Initialize the Tx Data buffer */
-	memset(&Tx_data[0],0,MAX_TX_DATA + sizeof(wp_tdm_api_rx_hdr_t));
+	memset(&Tx_data[0], 0, MAX_TX_DATA + sizeof(wp_tdm_api_rx_hdr_t));
 
 	/* Cast the Tx data packet with the tx element
 	 * structure.  We must insert a 16 byte
 	 * driver header, which driver will remove 
 	 * before passing packet out the physical port */
-	api_tx_el = (wp_tdm_api_tx_element_t*)&Tx_data[0];
-	
+	api_tx_el = (wp_tdm_api_tx_element_t *) &Tx_data[0];
+
 
 	/* Create a Tx packet based on user info, or
 	 * by deafult incrementing number starting from 0 */
-	for (i=0;i<Tx_length;i++){
-		if (tx_data == -1){
-			api_tx_el->data[i] = (unsigned char)i;
-		}else{
+	for (i = 0; i < Tx_length; i++) {
+		if (tx_data == -1) {
+			api_tx_el->data[i] = (unsigned char) i;
+		} else {
 #if 0
-			api_tx_el->data[i] = (unsigned char)tx_data+(i%4);
+			api_tx_el->data[i] = (unsigned char) tx_data + (i % 4);
 #else
-			api_tx_el->data[i] = (unsigned char)tx_data;
+			api_tx_el->data[i] = (unsigned char) tx_data;
 #endif
 		}
 	}
 
-    	sangoma_tdm_enable_rxhook_events(dev_fd, &tdm_api);
+	sangoma_tdm_enable_rxhook_events(dev_fd, &tdm_api);
 
 	/* Main Rx Tx OOB routine */
-	for(;;) {	
+	for (;;) {
 
 		/* Initialize all select() descriptors */
 		FD_ZERO(&ready);
 		FD_ZERO(&write);
 		FD_ZERO(&oob);
-		FD_SET(dev_fd,&oob);
-		FD_SET(dev_fd,&ready);
+		FD_SET(dev_fd, &oob);
+		FD_SET(dev_fd, &ready);
 
-		if (write_enable){
-		     FD_SET(dev_fd,&write);
+		if (write_enable) {
+			FD_SET(dev_fd, &write);
 		}
 
 		/* Select will block, until:
-		 * 	1: OOB event, link level change
-		 * 	2: Rx data available
-		 * 	3: Interface able to Tx */
-		
-  		if(select(dev_fd + 1,&ready, &write, &oob, NULL)){
-
-			fflush(stdout);	
-		   	if (FD_ISSET(dev_fd,&oob)){
-		
+		 *  1: OOB event, link level change
+		 *  2: Rx data available
+		 *  3: Interface able to Tx */
+
+		if (select(dev_fd + 1, &ready, &write, &oob, NULL)) {
+
+			fflush(stdout);
+			if (FD_ISSET(dev_fd, &oob)) {
+
 				/* An OOB event is pending, usually indicating
 				 * a link level change */
-				
-				err=sangoma_tdm_read_event(dev_fd,&tdm_api);
 
-				if(err < 0 ) {
+				err = sangoma_tdm_read_event(dev_fd, &tdm_api);
+
+				if (err < 0) {
 					printf("Failed to receive OOB %i , %i\n", Rx_count, err);
-					err = ioctl(dev_fd,SIOC_WANPIPE_SOCK_STATE,0);
-					printf("Sock state is %s\n",
-							(err == 0) ? "CONNECTED" : 
-							(err == 1) ? "DISCONNECTED" :
-							 "CONNECTING");
+					err = ioctl(dev_fd, SIOC_WANPIPE_SOCK_STATE, 0);
+					printf("Sock state is %s\n", (err == 0) ? "CONNECTED" : (err == 1) ? "DISCONNECTED" : "CONNECTING");
 					break;
 				}
-					
+
 				printf("GOT OOB EXCEPTION CMD Exiting\n");
 			}
-		  
-			
-          	if (FD_ISSET(dev_fd,&ready)){
+
+
+			if (FD_ISSET(dev_fd, &ready)) {
 
 				/* An Rx packet is pending
-				 * 	1: Read the rx packet into the Rx_data
-				 * 	   buffer. Confirm len > 0
+				 *  1: Read the rx packet into the Rx_data
+				 *     buffer. Confirm len > 0
 				 *
-				 * 	2: Cast Rx_data to the api_rx_element.
-				 * 	   Thus, removing a 16 byte header
-				 * 	   attached by the driver.
+				 *  2: Cast Rx_data to the api_rx_element.
+				 *     Thus, removing a 16 byte header
+				 *     attached by the driver.
 				 *
-				 * 	3. Check error_flag:
-				 * 		CRC,Abort..etc 
+				 *  3. Check error_flag:
+				 *      CRC,Abort..etc 
 				 */
 
 				memset(Rx_data, 0, sizeof(Rx_data));
 
-				err = sangoma_readmsg_tdm(dev_fd,
-							Rx_data, 
-							sizeof(wp_tdm_api_rx_hdr_t),
-							&Rx_data[sizeof(wp_tdm_api_rx_hdr_t)],
-							MAX_RX_DATA, 0);   
+				err = sangoma_readmsg_tdm(dev_fd, Rx_data, sizeof(wp_tdm_api_rx_hdr_t), &Rx_data[sizeof(wp_tdm_api_rx_hdr_t)], MAX_RX_DATA, 0);
 
 
-				if (!read_enable){
+				if (!read_enable) {
 					goto bitstrm_skip_read;
 				}
 
 				/* err indicates bytes received */
-				if(err <= 0) {
+				if (err <= 0) {
 					printf("\nError receiving data\n");
 					break;
 				}
 
-				api_rx_el = (wp_tdm_api_rx_element_t*)&Rx_data[0];
+				api_rx_el = (wp_tdm_api_rx_element_t *) & Rx_data[0];
 
 				/* Check the packet length */
 				Rx_lgth = err;
-				if(Rx_lgth<=0) {
-					printf("\nShort frame received (%d)\n",
-						Rx_lgth);
+				if (Rx_lgth <= 0) {
+					printf("\nShort frame received (%d)\n", Rx_lgth);
 					return;
 				}
-
 #if 0
-				if (api_rx_el->data[0] == tx_data && api_rx_el->data[1] == (tx_data+1)){
-					if (!stream_sync){
-						printf("GOT SYNC %x\n",api_rx_el->data[0]);
+				if (api_rx_el->data[0] == tx_data && api_rx_el->data[1] == (tx_data + 1)) {
+					if (!stream_sync) {
+						printf("GOT SYNC %x\n", api_rx_el->data[0]);
 					}
-					stream_sync=1;
-				}else{
-					if (stream_sync){
-						printf("OUT OF SYNC: %x\n",api_rx_el->data[0]);
+					stream_sync = 1;
+				} else {
+					if (stream_sync) {
+						printf("OUT OF SYNC: %x\n", api_rx_el->data[0]);
 					}
 				}
-#endif					
+#endif
 
 				++Rx_count;
 
-				if (verbose){
+				if (verbose) {
 #if 0
-					printf("Received %i Length = %i\n", 
-							Rx_count,Rx_lgth);
+					printf("Received %i Length = %i\n", Rx_count, Rx_lgth);
 
 					printf("Data: ");
-					for(i=0;i<Rx_lgth; i ++) {
+					for (i = 0; i < Rx_lgth; i++) {
 						printf("0x%02X ", api_rx_el->data[i]);
 					}
 					printf("\n");
 #endif
-				}else{
+				} else {
 					//putchar('R');
 				}
 
 
 #if 0
-				switch(api_rx_el->hdr.wp_api_event_type){
+				switch (api_rx_el->hdr.wp_api_event_type) {
 				case WP_TDM_EVENT_DTMF:
 					printf("DTMV Event: %c (%s:%s)!\n",
-						api_rx_el->hdr.wp_api_event_dtmf_digit,
-						(api_rx_el->hdr.wp_api_event_dtmf_type&WP_TDM_EVENT_DTMF_ROUT)?"ROUT":"SOUT",
-						(api_rx_el->hdr.wp_api_event_dtmf_type&WP_TDM_EVENT_DTMF_PRESET)?"PRESET":"STOP");		
+						   api_rx_el->hdr.wp_api_event_dtmf_digit,
+						   (api_rx_el->hdr.wp_api_event_dtmf_type & WP_TDM_EVENT_DTMF_ROUT) ? "ROUT" : "SOUT",
+						   (api_rx_el->hdr.wp_api_event_dtmf_type & WP_TDM_EVENT_DTMF_PRESET) ? "PRESET" : "STOP");
 					break;
 				case WP_TDM_EVENT_RXHOOK:
-					printf("RXHOOK Event: %s!\n",
-						(api_rx_el->hdr.wp_api_event_rxhook_state&WP_TDM_EVENT_RXHOOK_OFF)?"OFF-HOOK":"ON-HOOK");
+					printf("RXHOOK Event: %s!\n", (api_rx_el->hdr.wp_api_event_rxhook_state & WP_TDM_EVENT_RXHOOK_OFF) ? "OFF-HOOK" : "ON-HOOK");
 					break;
 				case WP_TDM_EVENT_RING:
-					printf("RING Event: %s!\n",
-						(api_rx_el->hdr.wp_api_event_ring_state&WP_TDM_EVENT_RING_PRESENT)?"PRESENT":"STOP");
+					printf("RING Event: %s!\n", (api_rx_el->hdr.wp_api_event_ring_state & WP_TDM_EVENT_RING_PRESENT) ? "PRESENT" : "STOP");
 					break;
 				}
 #endif
 
-				if (rx_cnt > 0  && Rx_count >= rx_cnt){
+				if (rx_cnt > 0 && Rx_count >= rx_cnt) {
 					break;
 				}
-bitstrm_skip_read:
-;
-		   	}
-		
-		   	if (FD_ISSET(dev_fd,&write)){
+			  bitstrm_skip_read:
+				;
+			}
 
+			if (FD_ISSET(dev_fd, &write)) {
 
-				err = sangoma_writemsg_tdm(dev_fd,
-						       Tx_data,16, 
-						       &Tx_data[16], Tx_length, 
-						       0);
-				if (err <= 0){
-					if (errno == EBUSY){
-						if (verbose){
+
+				err = sangoma_writemsg_tdm(dev_fd, Tx_data, 16, &Tx_data[16], Tx_length, 0);
+				if (err <= 0) {
+					if (errno == EBUSY) {
+						if (verbose) {
 							printf("Sock busy try again!\n");
 						}
-						/* Socket busy try sending again !*/
-					}else{
-						printf("Faild to send %i \n",errno);
+						/* Socket busy try sending again ! */
+					} else {
+						printf("Faild to send %i \n", errno);
 						perror("Send: ");
 						break;
 					}
-				}else{
+				} else {
 
 					++Tx_count;
-					
-					if (verbose){
+
+					if (verbose) {
 						//printf("Packet sent: Sent %i : %i\n",
-						//	err,Tx_count);
-					}else{
+						//  err,Tx_count);
+					} else {
 						//putchar('T');
 					}
 				}
-		   	}
+			}
 
-			if (tx_delay){
+			if (tx_delay) {
 				usleep(tx_delay);
 			}
 
-			if (tx_cnt && tx_size && Tx_count >= tx_cnt && !(files_used & TX_FILE_USED)){
-			
-				write_enable=0;
-				if (rx_cnt > 0){
+			if (tx_cnt && tx_size && Tx_count >= tx_cnt && !(files_used & TX_FILE_USED)) {
+
+				write_enable = 0;
+				if (rx_cnt > 0) {
 					/* Dont break let rx finish */
-				}else{
+				} else {
 					break;
 				}
 			}
 		}
 	}
 
-    	sangoma_tdm_disable_rxhook_events(dev_fd, &tdm_api);
-	if (tx_fd){
+	sangoma_tdm_disable_rxhook_events(dev_fd, &tdm_api);
+	if (tx_fd) {
 		fclose(tx_fd);
 	}
-	if (rx_fd){
+	if (rx_fd) {
 		fclose(rx_fd);
 	}
-	close (dev_fd);
+	close(dev_fd);
 	return;
 
-} 
+}
 
-int rxhook_event (int fd, unsigned char state)
+int rxhook_event(int fd, unsigned char state)
 {
-	printf("%d: RXHOOK Event: %s!\n",
-		fd, (state & WAN_EVENT_RXHOOK_OFF)?"OFF-HOOK":"ON-HOOK");
+	printf("%d: RXHOOK Event: %s!\n", fd, (state & WAN_EVENT_RXHOOK_OFF) ? "OFF-HOOK" : "ON-HOOK");
 	return 0;
 }
 
@@ -383,37 +366,34 @@
  **************************************************************/
 
 
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
 {
 	int proceed;
 
-	proceed=init_args(argc,argv);
-	if (proceed != WAN_TRUE){
+	proceed = init_args(argc, argv);
+	if (proceed != WAN_TRUE) {
 		usage(argv[0]);
 		return -1;
 	}
 
-	signal(SIGINT,&sig_end);
-	memset(&tdm_api,0,sizeof(tdm_api));
+	signal(SIGINT, &sig_end);
+	memset(&tdm_api, 0, sizeof(tdm_api));
 	tdm_api.wp_tdm_event.wp_rxhook_event = &rxhook_event;
-	
-	printf("TDM RXHOOK PTR = %p\n",tdm_api.wp_tdm_event.wp_rxhook_event);
-	
-	dev_fd =-1;
-	  
-	dev_fd = sangoma_open_tdmapi_span_chan(atoi(card_name),atoi(if_name));
-	if( dev_fd < 0){
-		printf("Failed to open span chan (%s:%s:%d:%d)\n",
-					card_name, if_name,
-					atoi(card_name),atoi(if_name));
-		exit (1);
+
+	printf("TDM RXHOOK PTR = %p\n", tdm_api.wp_tdm_event.wp_rxhook_event);
+
+	dev_fd = -1;
+
+	dev_fd = sangoma_open_tdmapi_span_chan(atoi(card_name), atoi(if_name));
+	if (dev_fd < 0) {
+		printf("Failed to open span chan (%s:%s:%d:%d)\n", card_name, if_name, atoi(card_name), atoi(if_name));
+		exit(1);
 	}
-	printf("HANDLING SPAN %i CHAN %i FD=%i\n",
-		atoi(card_name),atoi(if_name),dev_fd);
-		
-	sangoma_tdm_set_codec(dev_fd,&tdm_api,WP_NONE);
+	printf("HANDLING SPAN %i CHAN %i FD=%i\n", atoi(card_name), atoi(if_name), dev_fd);
+
+	sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_NONE);
 	sangoma_get_full_cfg(dev_fd, &tdm_api);
-		
+
 	handle_span_chan();
 	close(dev_fd);
 	return 0;
@@ -425,24 +405,21 @@
 void sig_end(int sigid)
 {
 
-	printf("Got Signal %i\n",sigid);
-	
+	printf("Got Signal %i\n", sigid);
+
 	sangoma_tdm_disable_rxhook_events(dev_fd, &tdm_api);
 
-	if (tx_fd){
+	if (tx_fd) {
 		fclose(tx_fd);
 	}
-	if (rx_fd){
+	if (rx_fd) {
 		fclose(rx_fd);
 	}
 
-	if (dev_fd){
-		close (dev_fd);
+	if (dev_fd) {
+		close(dev_fd);
 	}
-    	
+
 
 	exit(1);
 }
-
-
-

Modified: freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c	Tue May 27 00:54:52 2008
@@ -180,16 +180,16 @@
 static switch_status_t woomera_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t woomera_kill_channel(switch_core_session_t *session, int sig);
 static void tech_destroy(private_object * tech_pvt);
-static void woomera_printf(woomera_profile * profile, switch_socket_t * socket, char *fmt, ...);
+static void woomera_printf(woomera_profile * profile, switch_socket_t *socket, char *fmt, ...);
 static char *woomera_message_header(woomera_message * wmsg, char *key);
 static int woomera_enqueue_event(woomera_event_queue * event_queue, woomera_message * wmsg);
 static int woomera_dequeue_event(woomera_event_queue * event_queue, woomera_message * wmsg);
-static int woomera_message_parse(switch_socket_t * fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue);
-static int connect_woomera(switch_socket_t ** new_sock, woomera_profile * profile, int flags);
+static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue);
+static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile, int flags);
 static int woomera_profile_thread_running(woomera_profile * profile, int set, int new);
-static int woomera_locate_socket(woomera_profile * profile, switch_socket_t ** woomera_socket);
+static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **woomera_socket);
 static int tech_create_read_socket(private_object * tech_pvt);
-static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj);
+static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj);
 static void *woomera_thread_run(void *obj);
 static int tech_activate(private_object * tech_pvt);
 
@@ -264,7 +264,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static void woomera_socket_close(switch_socket_t ** socket)
+static void woomera_socket_close(switch_socket_t **socket)
 {
 	if (*socket) {
 		switch_socket_close(*socket);
@@ -330,7 +330,7 @@
 
 	switch_assert(tech_pvt != NULL);
 
-	for(;;) {
+	for (;;) {
 		if (switch_test_flag(tech_pvt, TFLAG_ABORT) || !tech_pvt->udp_socket) {
 			return SWITCH_STATUS_GENERR;
 		}
@@ -364,7 +364,7 @@
 	switch_size_t len;
 
 	switch_assert(tech_pvt != NULL);
-	
+
 	if (switch_test_flag(tech_pvt, TFLAG_ABORT) || !tech_pvt->udp_socket) {
 		return SWITCH_STATUS_GENERR;
 	}
@@ -469,7 +469,7 @@
 }
 
 
-static void woomera_printf(woomera_profile * profile, switch_socket_t * socket, char *fmt, ...)
+static void woomera_printf(woomera_profile * profile, switch_socket_t *socket, char *fmt, ...)
 {
 	char *stuff = NULL;
 	size_t res = 0, len = 0;
@@ -558,7 +558,7 @@
 	return 0;
 }
 
-static int woomera_message_parse(switch_socket_t * fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue)
+static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue)
 {
 	char *cur, *cr, *next = NULL;
 	char buf[2048] = "", *ptr;
@@ -719,7 +719,7 @@
 }
 
 
-static int connect_woomera(switch_socket_t ** new_sock, woomera_profile * profile, int flags)
+static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile, int flags)
 {
 
 	switch_sockaddr_t *sa;
@@ -764,7 +764,7 @@
 
 }
 
-static int woomera_locate_socket(woomera_profile * profile, switch_socket_t ** woomera_socket)
+static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **woomera_socket)
 {
 	woomera_message wmsg;
 
@@ -823,7 +823,7 @@
 	} else {
 		switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
 	}
-	
+
 	return 0;
 }
 
@@ -872,7 +872,7 @@
 
 
 
-static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj)
+static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
 {
 	switch_core_session_t *session = obj;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -976,15 +976,7 @@
 				if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
 																		  NULL,
 																		  tech_pvt->profile->dialplan,
-																		  cid_name,
-																		  cid_num,
-																		  ip,
-																		  NULL,
-																		  NULL,
-																		  NULL,
-																		  modname,
-																		  NULL,
-																		  exten)) != 0) {
+																		  cid_name, cid_num, ip, NULL, NULL, NULL, modname, NULL, exten)) != 0) {
 					char name[128];
 					switch_snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
 					switch_channel_set_name(channel, name);

Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	Tue May 27 00:54:52 2008
@@ -37,7 +37,7 @@
 };
 typedef struct cdr_fd cdr_fd_t;
 
-const char *default_template = 
+const char *default_template =
 	"\"${caller_id_name}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${start_stamp}\","
 	"\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${uuid}\",\"${bleg_uuid}\", \"${accountcode}\"\n";
 
@@ -58,12 +58,12 @@
 
 static off_t fd_size(int fd)
 {
-	struct stat s = {0};
+	struct stat s = { 0 };
 	fstat(fd, &s);
 	return s.st_size;
 }
 
-static void do_reopen(cdr_fd_t *fd) 
+static void do_reopen(cdr_fd_t *fd)
 {
 	int x = 0;
 
@@ -72,7 +72,7 @@
 		fd->fd = -1;
 	}
 
-	for (x = 0 ; x < 10; x++) {
+	for (x = 0; x < 10; x++) {
 		if ((fd->fd = open(fd->path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR)) > -1) {
 			fd->bytes = fd_size(fd->fd);
 			break;
@@ -95,7 +95,7 @@
 	if (globals.rotate) {
 		switch_time_exp_lt(&tm, switch_timestamp_now());
 		switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
-	
+
 		len = strlen(fd->path) + strlen(date) + 2;
 		p = switch_mprintf("%s.%s", fd->path, date);
 		assert(p);
@@ -104,7 +104,7 @@
 	}
 
 	do_reopen(fd);
-	
+
 	if (fd->fd < 0) {
 		switch_event_t *event;
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error opening %s\n", fd->path);
@@ -115,14 +115,14 @@
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s CDR logfile %s\n", globals.rotate ? "Rotated" : "Re-opened", fd->path);
 	}
-	
+
 }
 
 static void write_cdr(const char *path, const char *log_line)
 {
 	cdr_fd_t *fd = NULL;
 	unsigned int bytes_in, bytes_out;
-	
+
 	if (!(fd = switch_core_hash_find(globals.fd_hash, path))) {
 		fd = switch_core_alloc(globals.pool, sizeof(*fd));
 		switch_assert(fd);
@@ -132,10 +132,10 @@
 		fd->path = switch_core_strdup(globals.pool, path);
 		switch_core_hash_insert(globals.fd_hash, path, fd);
 	}
-	
+
 	switch_mutex_lock(fd->mutex);
-	bytes_out = (unsigned)strlen(log_line);
-	
+	bytes_out = (unsigned) strlen(log_line);
+
 	if (fd->fd < 0) {
 		do_reopen(fd);
 		if (fd->fd < 0) {
@@ -143,18 +143,18 @@
 			goto end;
 		}
 	}
-	
+
 	if (fd->bytes + bytes_out > UINT_MAX) {
 		do_rotate(fd);
 	}
-	
+
 	if ((bytes_in = write(fd->fd, log_line, bytes_out)) != bytes_out) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write error to file %s %d/%d\n", path, (int)bytes_in, (int)bytes_out);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write error to file %s %d/%d\n", path, (int) bytes_in, (int) bytes_out);
 	}
 
 	fd->bytes += bytes_in;
 
- end:
+  end:
 
 	switch_mutex_unlock(fd->mutex);
 }
@@ -164,7 +164,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	const char *log_dir = NULL, *accountcode = NULL, *a_template_str = NULL, *g_template_str = NULL;
-	char *log_line, *path = NULL;	
+	char *log_line, *path = NULL;
 
 	if (switch_channel_get_originator_caller_profile(channel)) {
 		return SWITCH_STATUS_SUCCESS;
@@ -173,7 +173,7 @@
 	if (!(log_dir = switch_channel_get_variable(channel, "cdr_csv_base"))) {
 		log_dir = globals.log_dir;
 	}
-	
+
 	if (switch_dir_make_recursive(log_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", log_dir);
 		return SWITCH_STATUS_FALSE;
@@ -193,15 +193,15 @@
 	}
 
 	g_template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template);
-	
+
 	if ((accountcode = switch_channel_get_variable(channel, "ACCOUNTCODE"))) {
 		a_template_str = (const char *) switch_core_hash_find(globals.template_hash, accountcode);
 	}
-	
+
 	if (!a_template_str) {
 		a_template_str = g_template_str;
 	}
-	
+
 	log_line = switch_channel_expand_variables(channel, a_template_str);
 
 	if (accountcode) {
@@ -210,21 +210,21 @@
 		write_cdr(path, log_line);
 		free(path);
 	}
-		
+
 	if (g_template_str != a_template_str) {
 		if (log_line && log_line != a_template_str) {
 			switch_safe_free(log_line);
 		}
 		log_line = switch_channel_expand_variables(channel, g_template_str);
 	}
-	
-		
+
+
 
 	path = switch_mprintf("%s%sMaster.csv", log_dir, SWITCH_PATH_SEPARATOR);
 	assert(path);
 	write_cdr(path, log_line);
 	free(path);
-	
+
 
 	if (log_line && log_line != g_template_str) {
 		free(log_line);
@@ -237,7 +237,7 @@
 static void event_handler(switch_event_t *event)
 {
 	const char *sig = switch_event_get_header(event, "Trapped-Signal");
-    switch_hash_index_t *hi;
+	switch_hash_index_t *hi;
 	void *val;
 	cdr_fd_t *fd;
 
@@ -269,18 +269,18 @@
 	char *cf = "cdr_csv.conf";
 	switch_xml_t cfg, xml, settings, param;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
-	memset(&globals,0,sizeof(globals));
+
+	memset(&globals, 0, sizeof(globals));
 	switch_core_hash_init(&globals.fd_hash, pool);
 	switch_core_hash_init(&globals.template_hash, pool);
-	
+
 	globals.pool = pool;
-	
+
 	switch_core_hash_insert(globals.template_hash, "default", default_template);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding default template.\n");
 
 	if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
-		
+
 		if ((settings = switch_xml_child(cfg, "settings"))) {
 			for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 				char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -317,7 +317,7 @@
 		}
 		switch_xml_free(xml);
 	}
-	
+
 
 	if (switch_strlen_zero(globals.default_template)) {
 		globals.default_template = switch_core_strdup(pool, "default");
@@ -326,7 +326,7 @@
 	if (!globals.log_dir) {
 		globals.log_dir = switch_core_sprintf(pool, "%s%scdr-csv", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
 	}
-	
+
 	return status;
 }
 
@@ -344,20 +344,20 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	load_config(pool);
-	
+
 	if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);
 	}
-	
+
 	return status;
 }
 
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_csv_shutdown)
 {
-	
-	globals.shutdown=1;
-    return SWITCH_STATUS_SUCCESS;
+
+	globals.shutdown = 1;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 

Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	Tue May 27 00:54:52 2008
@@ -283,10 +283,10 @@
 		uint64_t host_hash = 0;
 		switch_status_t status;
 		memset(buf, 0, len);
-		
+
 		switch_sockaddr_ip_get(&myaddr, globals.addr);
 		status = switch_socket_recvfrom(addr, globals.udp_socket, 0, buf, &len);
-		
+
 		if (!len) {
 			if (SWITCH_STATUS_IS_BREAK(status)) {
 				switch_yield(100000);
@@ -334,7 +334,7 @@
 			switch_event_fire(&local_event);
 
 		}
-		
+
 	}
 
 	globals.running = 0;

Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Tue May 27 00:54:52 2008
@@ -103,8 +103,8 @@
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_ip, prefs.ip);
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_pass, prefs.password);
 
-static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj);
-static void launch_listener_thread(listener_t * listener);
+static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj);
+static void launch_listener_thread(listener_t *listener);
 
 static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_level_t level)
 {
@@ -117,7 +117,7 @@
 			if (data) {
 				if (switch_queue_trypush(l->log_queue, data) == SWITCH_STATUS_SUCCESS) {
 					if (l->lost_logs) {
-						int ll =  l->lost_logs;
+						int ll = l->lost_logs;
 						switch_event_t *event;
 						l->lost_logs = 0;
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Lost %d log lines!\n", ll);
@@ -158,7 +158,7 @@
 		if (!switch_test_flag(l, LFLAG_EVENTS)) {
 			continue;
 		}
-		
+
 		if (l->event_list[SWITCH_EVENT_ALL]) {
 			send = 1;
 		} else if ((l->event_list[event->event_id])) {
@@ -300,7 +300,7 @@
 }
 
 
-static void close_socket(switch_socket_t ** sock)
+static void close_socket(switch_socket_t **sock)
 {
 	switch_mutex_lock(listen_list.sock_mutex);
 	if (*sock) {
@@ -320,7 +320,7 @@
 
 	close_socket(&listen_list.sock);
 
-	while(prefs.threads) {
+	while (prefs.threads) {
 		switch_yield(10000);
 		if (++sanity == 1000) {
 			break;
@@ -350,7 +350,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static void add_listener(listener_t * listener)
+static void add_listener(listener_t *listener)
 {
 	/* add me to the listeners so I get events */
 	switch_mutex_lock(listen_list.mutex);
@@ -359,7 +359,7 @@
 	switch_mutex_unlock(listen_list.mutex);
 }
 
-static void remove_listener(listener_t * listener)
+static void remove_listener(listener_t *listener)
 {
 	listener_t *l, *last = NULL;
 
@@ -385,7 +385,7 @@
 	}
 }
 
-static switch_status_t read_packet(listener_t * listener, switch_event_t **event, uint32_t timeout)
+static switch_status_t read_packet(listener_t *listener, switch_event_t **event, uint32_t timeout)
 {
 	switch_size_t mlen, bytes = 0;
 	char mbuf[2048] = "";
@@ -543,8 +543,8 @@
 					switch_socket_send(listener->sock, listener->ebuf, &len);
 
 					switch_safe_free(listener->ebuf);
-					
-				endloop:
+
+				  endloop:
 					switch_event_destroy(&pevent);
 				}
 			}
@@ -569,7 +569,7 @@
 	switch_memory_pool_t *pool;
 };
 
-static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj)
 {
 
 	struct api_command_struct *acs = (struct api_command_struct *) obj;
@@ -630,7 +630,7 @@
 		switch_thread_rwlock_unlock(acs->listener->rwlock);
 	}
 
- done:
+  done:
 	if (acs && acs->bg) {
 		switch_memory_pool_t *pool = acs->pool;
 		acs = NULL;
@@ -640,7 +640,7 @@
 	return NULL;
 
 }
-static switch_status_t parse_command(listener_t * listener, switch_event_t *event, char *reply, uint32_t reply_len)
+static switch_status_t parse_command(listener_t *listener, switch_event_t *event, char *reply, uint32_t reply_len)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *cmd = switch_event_get_header(event, "command");
@@ -866,7 +866,7 @@
 		switch_snprintf(reply, reply_len, "+OK Job-UUID: %s", acs->uuid_str);
 
 		switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
-		
+
 		return SWITCH_STATUS_SUCCESS;
 	} else if (!strncasecmp(cmd, "log", 3)) {
 
@@ -950,7 +950,7 @@
 					}
 				}
 
-			end:
+			  end:
 				cur = next;
 			}
 		}
@@ -1039,7 +1039,7 @@
 		}
 	}
 
- done:
+  done:
 	if (event) {
 		switch_event_destroy(&event);
 	}
@@ -1051,7 +1051,7 @@
 	return status;
 }
 
-static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
 {
 	listener_t *listener = (listener_t *) obj;
 	char buf[1024];
@@ -1071,13 +1071,13 @@
 
 	if (prefs.acl_count && listener->sa && !switch_strlen_zero(listener->remote_ip)) {
 		uint32_t x = 0;
-		
-		for (x = 0 ; x < prefs.acl_count; x++) {
+
+		for (x = 0; x < prefs.acl_count; x++) {
 			if (!switch_check_network_list_ip(listener->remote_ip, prefs.acl[x])) {
 				const char message[] = "Access Denied, go away.\n";
 				int mlen = strlen(message);
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", listener->remote_ip,  prefs.acl[x]);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", listener->remote_ip, prefs.acl[x]);
 
 				switch_snprintf(buf, sizeof(buf), "Content-Type: rude/rejection\nContent-Length %d\n\n", mlen);
 				len = strlen(buf);
@@ -1203,7 +1203,7 @@
 
 	}
 
- done:
+  done:
 
 	remove_listener(listener);
 
@@ -1234,7 +1234,7 @@
 
 
 /* Create a thread for the socket and launch it */
-static void launch_listener_thread(listener_t * listener)
+static void launch_listener_thread(listener_t *listener)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
@@ -1333,7 +1333,7 @@
 			goto sock_fail;
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket up listening on %s:%u\n", prefs.ip, prefs.port);
 		break;
-	sock_fail:
+	  sock_fail:
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", prefs.ip, prefs.port);
 		switch_yield(100000);
 	}
@@ -1348,7 +1348,7 @@
 	switch_log_bind_logger(socket_logger, SWITCH_LOG_DEBUG);
 
 
-	for(;;) {
+	for (;;) {
 		if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
 			goto fail;
@@ -1396,11 +1396,11 @@
 	}
 
 
-	for (x = 0 ; x < prefs.acl_count; x++) {
+	for (x = 0; x < prefs.acl_count; x++) {
 		switch_safe_free(prefs.acl[x]);
 	}
 
- fail:
+  fail:
 	return SWITCH_STATUS_TERM;
 }
 

Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_test/mod_event_test.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_test/mod_event_test.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_test/mod_event_test.c	Tue May 27 00:54:52 2008
@@ -77,7 +77,7 @@
 #define TTHREADS 500
 static int THREADS = 0;
 
-static void *torture_thread(switch_thread_t * thread, void *obj)
+static void *torture_thread(switch_thread_t *thread, void *obj)
 {
 	int y = 0;
 	int z = 0;

Modified: freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	Tue May 27 00:54:52 2008
@@ -38,17 +38,17 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load);
 SWITCH_MODULE_DEFINITION(mod_radius_cdr, mod_radius_cdr_load, NULL, NULL);
 
-static char		cf[] = "mod_radius_cdr.conf";
-static char		my_dictionary[PATH_MAX];
-static char		my_seqfile[PATH_MAX];
-static char *		my_deadtime; /* 0 */
-static char *		my_timeout; /* 5 */
-static char *		my_retries; /* 3 */
-static char		my_servers[SERVER_MAX][255];
+static char cf[] = "mod_radius_cdr.conf";
+static char my_dictionary[PATH_MAX];
+static char my_seqfile[PATH_MAX];
+static char *my_deadtime;		/* 0 */
+static char *my_timeout;		/* 5 */
+static char *my_retries;		/* 3 */
+static char my_servers[SERVER_MAX][255];
 
-static rc_handle *	my_radius_init(void)
+static rc_handle *my_radius_init(void)
 {
-	rc_handle 	*rad_config;
+	rc_handle *rad_config;
 
 	rad_config = rc_new();
 
@@ -63,19 +63,17 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error initializing radius config!\n");
 		rc_destroy(rad_config);
 		return NULL;
-	}	
+	}
 
 	/* Some hardcoded ( for now ) defaults needed to initialize radius */
 	if (rc_add_config(rad_config, "auth_order", "radius", "mod_radius_cdr.c", 0) != 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-					"setting auth_order = radius failed\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting auth_order = radius failed\n");
 		rc_destroy(rad_config);
 		return NULL;
 	}
 
 	if (rc_add_config(rad_config, "seqfile", my_seqfile, "mod_radius_cdr.c", 0) != 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-					"setting seqfile = %s failed\n", my_seqfile);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting seqfile = %s failed\n", my_seqfile);
 		rc_destroy(rad_config);
 		return NULL;
 	}
@@ -92,37 +90,32 @@
 	}
 
 	if (rc_add_config(rad_config, "dictionary", my_dictionary, cf, 0) != 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-					"failed setting dictionary = %s failed\n", my_dictionary);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed setting dictionary = %s failed\n", my_dictionary);
 		rc_destroy(rad_config);
 		return NULL;
 	}
 
 	if (rc_add_config(rad_config, "radius_deadtime", my_deadtime, cf, 0) != 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-				"setting radius_deadtime = %s failed\n", my_deadtime);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_deadtime = %s failed\n", my_deadtime);
 		rc_destroy(rad_config);
 		return NULL;
 	}
 
 	if (rc_add_config(rad_config, "radius_timeout", my_timeout, cf, 0) != 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-				"setting radius_timeout = %s failed\n", my_timeout);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_timeout = %s failed\n", my_timeout);
 		rc_destroy(rad_config);
 		return NULL;
 	}
 
 	if (rc_add_config(rad_config, "radius_retries", my_retries, cf, 0) != 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-				"setting radius_retries = %s failed\n", my_retries);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_retries = %s failed\n", my_retries);
 		rc_destroy(rad_config);
-	        return NULL;
+		return NULL;
 	}
 
 	/* Read the dictionary file(s) */
 	if (rc_read_dictionary(rad_config, rc_conf_str(rad_config, "dictionary")) != 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-				"reading dictionary file(s): %s\n", my_dictionary);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "reading dictionary file(s): %s\n", my_dictionary);
 		rc_destroy(rad_config);
 		return NULL;
 	}
@@ -132,20 +125,20 @@
 
 static switch_status_t my_on_routing(switch_core_session_t *session)
 {
-	switch_xml_t 	cdr;
+	switch_xml_t cdr;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	rc_handle 	*rad_config;
-	int             retval = 0;
-	VALUE_PAIR      *send = NULL;
-	uint32_t           client_port = 0;
-	uint32_t           status_type = PW_STATUS_START;
-	switch_time_t	callstartdate = 0;
-	switch_time_t	callanswerdate = 0;
-	switch_time_t	callenddate = 0;
-	switch_time_t	calltransferdate = 0;
+	rc_handle *rad_config;
+	int retval = 0;
+	VALUE_PAIR *send = NULL;
+	uint32_t client_port = 0;
+	uint32_t status_type = PW_STATUS_START;
+	switch_time_t callstartdate = 0;
+	switch_time_t callanswerdate = 0;
+	switch_time_t callenddate = 0;
+	switch_time_t calltransferdate = 0;
+
+	char *uuid_str;
 
-	char 		*uuid_str;
-    
 	switch_time_exp_t tm;
 	char buffer[32];
 
@@ -162,7 +155,7 @@
 		uuid_str = switch_core_session_get_uuid(session);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n");
-		return SWITCH_STATUS_TERM;		
+		return SWITCH_STATUS_TERM;
 	}
 
 	/* Create the radius packet */
@@ -172,135 +165,122 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed setting Acct-Status-Type: Start\n");
 		rc_destroy(rad_config);
 		return SWITCH_STATUS_TERM;
-	}			
+	}
 
 	if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_ID, uuid_str, -1, 0) == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Acct-Session-ID: %s\n", uuid_str);
 		rc_destroy(rad_config);
 		return SWITCH_STATUS_TERM;
-	}			
+	}
 
 	/* Add VSAs */
 
 	if (channel) {
-		/*switch_call_cause_t	cause;*/
-		switch_caller_profile_t	*profile;
+		/*switch_call_cause_t   cause; */
+		switch_caller_profile_t *profile;
 
 		/*
-		cause = switch_channel_get_cause(channel);
-		if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause);
-			rc_destroy(rad_config);
-			return SWITCH_STATUS_TERM;
-		}
-		*/
-		
+		   cause = switch_channel_get_cause(channel);
+		   if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
+		   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause);
+		   rc_destroy(rad_config);
+		   return SWITCH_STATUS_TERM;
+		   }
+		 */
+
 		profile = switch_channel_get_caller_profile(channel);
-			
+
 		if (profile) {
 
 			callstartdate = profile->times->created;
 			callanswerdate = profile->times->answered;
 			calltransferdate = profile->times->transferred;
 			callenddate = profile->times->hungup;
-		
+
 			if (profile->username) {
-				if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *)profile->username, -1, 0) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding User-Name: %s\n", profile->username);
+				if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *) profile->username, -1, 0) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->caller_id_number) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *)profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
+				if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *) profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->caller_id_name) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *)profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
+				if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *) profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->destination_number) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *)profile->destination_number, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Dst: %s\n", profile->destination_number);
+				if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *) profile->destination_number, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->dialplan) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *)profile->dialplan, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
+				if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *) profile->dialplan, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->network_addr) {
-				if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *)profile->network_addr, -1, 0) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Framed-IP-Address: %s\n", profile->network_addr);
+				if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *) profile->network_addr, -1, 0) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->rdnis) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *)profile->rdnis, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
+				if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *) profile->rdnis, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->context) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *)profile->context, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Context: %s\n", profile->context);
+				if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *) profile->context, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->ani) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *)profile->ani, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-ANI: %s\n", profile->ani);
+				if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *) profile->ani, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->aniii) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *)profile->aniii, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-ANIII: %s\n", profile->aniii);
+				if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *) profile->aniii, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->source) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *)profile->source, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Source: %s\n", profile->source);
+				if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *) profile->source, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (callstartdate > 0) {
 				switch_time_exp_lt(&tm, callstartdate);
 				switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
-					tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
-					tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
-					tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+								tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+								tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
 				if (rc_avpair_add(rad_config, &send, PW_FS_CALLSTARTDATE, &buffer, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-						"failed adding Freeswitch-Callstartdate: %s\n", buffer);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
@@ -309,12 +289,10 @@
 			if (callanswerdate > 0) {
 				switch_time_exp_lt(&tm, callanswerdate);
 				switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
-					tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
-					tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
-					tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+								tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+								tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
 				if (rc_avpair_add(rad_config, &send, PW_FS_CALLANSWERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-						"failed adding Freeswitch-Callanswerdate: %s\n", buffer);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
@@ -323,12 +301,10 @@
 			if (calltransferdate > 0) {
 				switch_time_exp_lt(&tm, calltransferdate);
 				switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
-					tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
-					tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
-					tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+								tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+								tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
 				if (rc_avpair_add(rad_config, &send, PW_FS_CALLTRANSFERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-						"failed adding Freeswitch-Calltransferdate: %s\n", buffer);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
@@ -337,26 +313,23 @@
 			if (callenddate > 0) {
 				switch_time_exp_lt(&tm, callenddate);
 				switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
-					tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
-					tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
-					tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+								tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+								tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
 				if (rc_avpair_add(rad_config, &send, PW_FS_CALLENDDATE, &buffer, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-						"failed adding Freeswitch-Callenddate: %s\n", buffer);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
 			}
 
 			if (profile->caller_extension && profile->caller_extension->last_application->application_name) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP, 
-					(void *)profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Lastapp: %s\n", profile->source);
+				if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
+								  (void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n");
 		}
@@ -371,27 +344,27 @@
 	}
 	rc_avpair_free(send);
 
-	return(retval);
+	return (retval);
 }
 
 static switch_status_t my_on_hangup(switch_core_session_t *session)
 {
-	switch_xml_t 	cdr;
+	switch_xml_t cdr;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	rc_handle 	*rad_config;
-	int             retval = 0;
-	VALUE_PAIR      *send = NULL;
-	uint32_t        client_port = 0;
-	uint32_t        status_type = PW_STATUS_STOP;
-	switch_time_t	callstartdate = 0;
-	switch_time_t	callanswerdate = 0;
-	switch_time_t	callenddate = 0;
-	switch_time_t	calltransferdate = 0;
-	switch_time_t	billusec = 0;
-	uint32_t		billsec = 0;
-	char 		*uuid_str;
-   
-    switch_time_exp_t tm;
+	rc_handle *rad_config;
+	int retval = 0;
+	VALUE_PAIR *send = NULL;
+	uint32_t client_port = 0;
+	uint32_t status_type = PW_STATUS_STOP;
+	switch_time_t callstartdate = 0;
+	switch_time_t callanswerdate = 0;
+	switch_time_t callenddate = 0;
+	switch_time_t calltransferdate = 0;
+	switch_time_t billusec = 0;
+	uint32_t billsec = 0;
+	char *uuid_str;
+
+	switch_time_exp_t tm;
 	char buffer[32] = "";
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_hangup\n");
@@ -407,7 +380,7 @@
 		uuid_str = switch_core_session_get_uuid(session);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n");
-		return SWITCH_STATUS_TERM;		
+		return SWITCH_STATUS_TERM;
 	}
 
 	/* Create the radius packet */
@@ -417,19 +390,19 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str);
 		rc_destroy(rad_config);
 		return SWITCH_STATUS_TERM;
-	}			
+	}
 
 	if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_ID, uuid_str, -1, 0) == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str);
 		rc_destroy(rad_config);
 		return SWITCH_STATUS_TERM;
-	}			
+	}
 
 	/* Add VSAs */
 
 	if (channel) {
-		switch_call_cause_t	cause;
-		switch_caller_profile_t	*profile;
+		switch_call_cause_t cause;
+		switch_caller_profile_t *profile;
 
 		cause = switch_channel_get_cause(channel);
 		if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
@@ -437,7 +410,7 @@
 			rc_destroy(rad_config);
 			return SWITCH_STATUS_TERM;
 		}
-		
+
 		profile = switch_channel_get_caller_profile(channel);
 
 		if (profile) {
@@ -449,16 +422,15 @@
 			callanswerdate = profile->times->answered;
 			calltransferdate = profile->times->transferred;
 			callenddate = profile->times->hungup;
-		
-			if (switch_channel_test_flag(channel,CF_ANSWERED)) {
+
+			if (switch_channel_test_flag(channel, CF_ANSWERED)) {
 				if (callstartdate && callanswerdate) {
 					if (callenddate)
 						billusec = callenddate - callanswerdate;
 					else if (calltransferdate)
 						billusec = calltransferdate - callanswerdate;
 				}
-			}
-			else if (switch_channel_test_flag(channel,CF_TRANSFER)) {
+			} else if (switch_channel_test_flag(channel, CF_TRANSFER)) {
 				if (callanswerdate && calltransferdate)
 					billusec = calltransferdate - callanswerdate;
 			}
@@ -467,105 +439,92 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Finished calculating billable time\n");
 
 			if (profile->username) {
-				if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *)profile->username, -1, 0) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding User-Name: %s\n", profile->username);
+				if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *) profile->username, -1, 0) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->caller_id_number) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *)profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
+				if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *) profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->caller_id_name) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *)profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
+				if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *) profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->destination_number) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *)profile->destination_number, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Dst: %s\n", profile->destination_number);
+				if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *) profile->destination_number, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->dialplan) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *)profile->dialplan, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
+				if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *) profile->dialplan, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->network_addr) {
-				if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *)profile->network_addr, -1, 0) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Framed-IP-Address: %s\n", profile->network_addr);
+				if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *) profile->network_addr, -1, 0) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->rdnis) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *)profile->rdnis, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
+				if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *) profile->rdnis, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->context) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *)profile->context, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Context: %s\n", profile->context);
+				if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *) profile->context, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->ani) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *)profile->ani, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-ANI: %s\n", profile->ani);
+				if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *) profile->ani, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->aniii) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *)profile->aniii, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-ANIII: %s\n", profile->aniii);
+				if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *) profile->aniii, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->source) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *)profile->source, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Source: %s\n", profile->source);
+				if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *) profile->source, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (profile->caller_extension && profile->caller_extension->last_application->application_name) {
-				if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP, 
-					(void *)profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							"failed adding Freeswitch-Lastapp: %s\n", profile->source);
+				if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
+								  (void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
-			} 
+			}
 			if (rc_avpair_add(rad_config, &send, PW_FS_BILLUSEC, &billusec, -1, PW_FS_PEC) == NULL) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-						"failed adding Freeswitch-Billusec: %u\n", (uint32_t)billusec);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Billusec: %u\n", (uint32_t) billusec);
 				rc_destroy(rad_config);
 				return SWITCH_STATUS_TERM;
 			}
@@ -573,12 +532,10 @@
 			if (callstartdate > 0) {
 				switch_time_exp_lt(&tm, callstartdate);
 				switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
-					tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
-					tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
-					tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+								tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+								tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
 				if (rc_avpair_add(rad_config, &send, PW_FS_CALLSTARTDATE, &buffer, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-						"failed adding Freeswitch-Callstartdate: %s\n", buffer);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
@@ -587,12 +544,10 @@
 			if (callanswerdate > 0) {
 				switch_time_exp_lt(&tm, callanswerdate);
 				switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
-					tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
-					tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
-					tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+								tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+								tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
 				if (rc_avpair_add(rad_config, &send, PW_FS_CALLANSWERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-						"failed adding Freeswitch-Callanswerdate: %s\n", buffer);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
@@ -601,12 +556,10 @@
 			if (calltransferdate > 0) {
 				switch_time_exp_lt(&tm, calltransferdate);
 				switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
-					tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
-					tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
-					tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+								tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+								tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
 				if (rc_avpair_add(rad_config, &send, PW_FS_CALLTRANSFERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-						"failed adding Freeswitch-Calltransferdate: %s\n", buffer);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
@@ -615,25 +568,22 @@
 			if (callenddate > 0) {
 				switch_time_exp_lt(&tm, callenddate);
 				switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
-					tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
-					tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
-					tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+								tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+								tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
 				if (rc_avpair_add(rad_config, &send, PW_FS_CALLENDDATE, &buffer, -1, PW_FS_PEC) == NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-						"failed adding Freeswitch-Callenddate: %s\n", buffer);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer);
 					rc_destroy(rad_config);
 					return SWITCH_STATUS_TERM;
 				}
 			}
 
 			if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_TIME, &billsec, -1, 0) == NULL) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-						"failed adding Acct-Session-Time: %u\n", billsec);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Acct-Session-Time: %u\n", billsec);
 				rc_destroy(rad_config);
 				return SWITCH_STATUS_TERM;
 			}
-		} else { /* no profile, can't create data to send */
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n");			
+		} else {				/* no profile, can't create data to send */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n");
 		}
 	}
 
@@ -646,57 +596,52 @@
 	}
 	rc_avpair_free(send);
 
-	return(retval);
+	return (retval);
 }
 
 static switch_status_t load_config(void)
 {
-        switch_xml_t cfg, xml, settings, param;
+	switch_xml_t cfg, xml, settings, param;
 
 	int num_servers = 0;
 
 	my_timeout = "5";
 	my_retries = "3";
 	my_deadtime = "0";
-	strncpy(my_seqfile, "/var/run/radius.seq", PATH_MAX-1);
-	strncpy(my_dictionary, "/usr/local/freeswitch/conf/radius/dictionary", PATH_MAX-1);
+	strncpy(my_seqfile, "/var/run/radius.seq", PATH_MAX - 1);
+	strncpy(my_dictionary, "/usr/local/freeswitch/conf/radius/dictionary", PATH_MAX - 1);
 
-	for( int i = 0; i < SERVER_MAX; i++ ) {
+	for (int i = 0; i < SERVER_MAX; i++) {
 		my_servers[i][0] = '\0';
 	}
 
-        if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
-                return SWITCH_STATUS_TERM;
-        }
+	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+		return SWITCH_STATUS_TERM;
+	}
 
-        if ((settings = switch_xml_child(cfg, "settings"))) {
-                for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+	if ((settings = switch_xml_child(cfg, "settings"))) {
+		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
 			char *val = (char *) switch_xml_attr_soft(param, "value");
 
 			if (!strcmp(var, "acctserver")) {
 				if (num_servers < SERVER_MAX) {
-					strncpy(my_servers[num_servers],val,255-1);
+					strncpy(my_servers[num_servers], val, 255 - 1);
 					num_servers++;
 				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-						"you can only specify %d radius servers, ignoring excess server entry\n", SERVER_MAX);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+									  "you can only specify %d radius servers, ignoring excess server entry\n", SERVER_MAX);
 				}
-			}
-			else if (!strcmp(var, "dictionary")) {
-				strncpy(my_dictionary,val,PATH_MAX-1);
-			}
-			else if (!strcmp(var, "seqfile")) {
-				strncpy(my_seqfile,val,PATH_MAX-1);
-			}
-			else if (!strcmp(var, "radius_timeout")) {
+			} else if (!strcmp(var, "dictionary")) {
+				strncpy(my_dictionary, val, PATH_MAX - 1);
+			} else if (!strcmp(var, "seqfile")) {
+				strncpy(my_seqfile, val, PATH_MAX - 1);
+			} else if (!strcmp(var, "radius_timeout")) {
 				my_timeout = strdup(val);
-			}
-			else if (!strcmp(var, "radius_retries")) {
+			} else if (!strcmp(var, "radius_retries")) {
 				my_retries = strdup(val);
-			}
-			else if (!strcmp(var, "radius_deadtime")) {
+			} else if (!strcmp(var, "radius_deadtime")) {
 				my_deadtime = strdup(val);
 			}
 		}
@@ -705,8 +650,7 @@
 	switch_xml_free(xml);
 
 	if (num_servers < 1) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-				"you must specify at least 1 radius server\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "you must specify at least 1 radius server\n");
 		return SWITCH_STATUS_TERM;
 	}
 
@@ -726,8 +670,8 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load)
 {
 	if (load_config() != SWITCH_STATUS_SUCCESS) {
-                return SWITCH_STATUS_TERM;
-        }
+		return SWITCH_STATUS_TERM;
+	}
 
 	/* test global state handlers */
 	switch_core_add_state_handler(&state_handlers);

Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	Tue May 27 00:54:52 2008
@@ -50,7 +50,7 @@
 	struct local_stream_source *source;
 	switch_mutex_t *audio_mutex;
 	switch_buffer_t *audio_buffer;
-	int err;	
+	int err;
 	const char *file;
 	const char *func;
 	int line;
@@ -86,18 +86,18 @@
 	double r;
 	int index;
 	srand(getpid() + ++S);
-	r = ((double)rand() / ((double)(RAND_MAX)+(double)(1)));
-	index = (int)(r * 9) + 1;
+	r = ((double) rand() / ((double) (RAND_MAX) + (double) (1)));
+	index = (int) (r * 9) + 1;
 	return index;
 }
 
 static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj)
 {
 	local_stream_source_t *source = obj;
-	switch_file_handle_t fh = {0};
+	switch_file_handle_t fh = { 0 };
 	local_stream_context_t *cp;
 	char file_buf[128] = "", path_buf[512] = "";
-	switch_timer_t timer = {0};
+	switch_timer_t timer = { 0 };
 	int fd = -1;
 	switch_buffer_t *audio_buffer;
 	switch_byte_t *dist_buf;
@@ -110,12 +110,12 @@
 
 	switch_buffer_create_dynamic(&audio_buffer, 1024, source->prebuf + 10, 0);
 	dist_buf = switch_core_alloc(source->pool, source->prebuf + 10);
-	
+
 	if (source->shuffle) {
 		skip = do_rand();
 	}
 
-	while(RUNNING) {
+	while (RUNNING) {
 		const char *fname;
 
 		if (switch_dir_open(&source->dir_handle, source->location, source->pool) != SWITCH_STATUS_SUCCESS) {
@@ -125,15 +125,14 @@
 
 		switch_yield(1000000);
 
-		while(RUNNING) {
+		while (RUNNING) {
 			switch_size_t olen;
-			uint8_t abuf[SWITCH_RECOMMENDED_BUFFER_SIZE] =  {0};
+			uint8_t abuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
 
 			if (fd > -1) {
 				char *p;
 				if (switch_fd_read_line(fd, path_buf, sizeof(path_buf))) {
-					if ((p = strchr(path_buf, '\r')) ||
-						(p = strchr(path_buf, '\n'))) {
+					if ((p = strchr(path_buf, '\r')) || (p = strchr(path_buf, '\n'))) {
 						*p = '\0';
 					}
 				} else {
@@ -164,20 +163,18 @@
 
 			fname = path_buf;
 			fh.prebuf = source->prebuf;
-			
+
 			if (switch_core_file_open(&fh,
-									  (char *)fname,
-									  source->channels,
-									  source->rate,
-									  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+									  (char *) fname,
+									  source->channels, source->rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s\n", fname);
 				switch_yield(1000000);
 				continue;
 			}
-			
+
 			source->rate = fh.samplerate;
 			source->samples = switch_samples_per_frame(fh.native_rate, source->interval);
-			
+
 			if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
 				switch_dir_close(source->dir_handle);
@@ -196,11 +193,11 @@
 
 				switch_buffer_write(audio_buffer, abuf, olen * 2);
 				used = switch_buffer_inuse(audio_buffer);
-				
+
 				if (used >= source->prebuf || (source->total && used > source->samples * 2)) {
 					used = switch_buffer_read(audio_buffer, dist_buf, source->samples * 2);
 					if (source->total) {
-						
+
 						switch_mutex_lock(source->mutex);
 						for (cp = source->context_list; cp; cp = cp->next) {
 							if (switch_test_flag(cp->handle, SWITCH_FILE_CALLBACK)) {
@@ -208,7 +205,8 @@
 							}
 							switch_mutex_lock(cp->audio_mutex);
 							if (switch_buffer_inuse(cp->audio_buffer) > source->samples * 768) {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d]\n", cp->func, cp->file, cp->line);
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d]\n", cp->func, cp->file,
+												  cp->line);
 								switch_buffer_zero(cp->audio_buffer);
 							} else {
 								switch_buffer_write(cp->audio_buffer, dist_buf, used);
@@ -230,13 +228,13 @@
 		source->dir_handle = NULL;
 	}
 
-done:
+  done:
 	switch_buffer_destroy(&audio_buffer);
 
 	if (fd > -1) {
 		close(fd);
 	}
-	
+
 	switch_core_destroy_memory_pool(&source->pool);
 
 	return NULL;
@@ -248,12 +246,12 @@
 	local_stream_source_t *source;
 	char *alt_path = NULL;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
+
 	if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	alt_path = switch_mprintf("%s/%d", path, handle->samplerate);
 
 	switch_mutex_lock(globals.mutex);
@@ -273,7 +271,7 @@
 	if ((context = switch_core_alloc(handle->memory_pool, sizeof(*context))) == 0) {
 		status = SWITCH_STATUS_MEMERR;
 		goto end;
-	}	
+	}
 
 	handle->samples = 0;
 	handle->samplerate = source->rate;
@@ -285,14 +283,14 @@
 	handle->private_info = context;
 	handle->interval = source->interval;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening Stream [%s] %dhz\n", path, handle->samplerate);
-	
+
 	switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
 	if (switch_buffer_create_dynamic(&context->audio_buffer, 512, 1024, 0) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
 		status = SWITCH_STATUS_MEMERR;
 		goto end;
 	}
-	
+
 	context->source = source;
 	context->file = handle->file;
 	context->func = handle->func;
@@ -304,7 +302,7 @@
 	source->total++;
 	switch_mutex_unlock(source->mutex);
 
- end:
+  end:
 	switch_safe_free(alt_path);
 	return status;
 }
@@ -328,29 +326,29 @@
 	context->source->total--;
 	switch_mutex_unlock(context->source->mutex);
 	switch_buffer_destroy(&context->audio_buffer);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void *data, size_t *len)
 {
-    local_stream_context_t *context = handle->private_info;
-    switch_size_t bytes = 0;
-    size_t need = *len * 2;
-
-    switch_mutex_lock(context->audio_mutex);
-    if ((bytes = switch_buffer_read(context->audio_buffer, data, need))) {
-        *len = bytes / 2;
-    } else {
-        if (need > 2560) {
-            need = 2560;
-        }
-        memset(data, 255, need);
-        *len = need / 2;
-    }
-    switch_mutex_unlock(context->audio_mutex);
-    handle->sample_count += *len;
-    return SWITCH_STATUS_SUCCESS;
+	local_stream_context_t *context = handle->private_info;
+	switch_size_t bytes = 0;
+	size_t need = *len * 2;
+
+	switch_mutex_lock(context->audio_mutex);
+	if ((bytes = switch_buffer_read(context->audio_buffer, data, need))) {
+		*len = bytes / 2;
+	} else {
+		if (need > 2560) {
+			need = 2560;
+		}
+		memset(data, 255, need);
+		*len = need / 2;
+	}
+	switch_mutex_unlock(context->audio_mutex);
+	handle->sample_count += *len;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 /* Registration */
@@ -374,7 +372,7 @@
 	for (directory = switch_xml_child(cfg, "directory"); directory; directory = directory->next) {
 		char *path = (char *) switch_xml_attr(directory, "path");
 		char *name = (char *) switch_xml_attr(directory, "name");
-		
+
 		if (!(name && path)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid config!\n");
 			continue;
@@ -388,7 +386,7 @@
 		source = switch_core_alloc(pool, sizeof(*source));
 		assert(source != NULL);
 		source->pool = pool;
-		
+
 		source->name = switch_core_strdup(source->pool, name);
 		source->location = switch_core_strdup(source->pool, path);
 		source->rate = 8000;
@@ -396,7 +394,7 @@
 		source->channels = 1;
 		source->timer_name = "soft";
 		source->prebuf = DEFAULT_PREBUFFER_SIZE;
-		
+
 		for (param = switch_xml_child(directory, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
 			char *val = (char *) switch_xml_attr_soft(param, "value");
@@ -416,7 +414,7 @@
 			} else if (!strcasecmp(var, "channels")) {
 				int tmp = atoi(val);
 				if (tmp == 1 || tmp == 2) {
-					source->channels = (uint8_t)tmp;
+					source->channels = (uint8_t) tmp;
 				}
 			} else if (!strcasecmp(var, "interval")) {
 				int tmp = atoi(val);
@@ -424,19 +422,19 @@
 					source->interval = tmp;
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-								  "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL); 
+									  "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
 				}
 			} else if (!strcasecmp(var, "timer-name")) {
 				source->timer_name = switch_core_strdup(source->pool, val);
 			}
 		}
-		
+
 		source->samples = switch_samples_per_frame(source->rate, source->interval);
 
 		switch_core_hash_insert(globals.source_hash, source->name, source);
-		
+
 		switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
-		
+
 		switch_threadattr_create(&thd_attr, source->pool);
 		switch_threadattr_detach_set(thd_attr, 1);
 		switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -450,7 +448,7 @@
 {
 	switch_file_interface_t *file_interface;
 	supported_formats[0] = "local_stream";
-	
+
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
 	file_interface->interface_name = modname;
@@ -463,7 +461,7 @@
 	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, pool);
 	switch_core_hash_init(&globals.source_hash, pool);
 	launch_threads();
-	
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/formats/mod_shout/layer3.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/layer3.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/layer3.c	Tue May 27 00:54:52 2008
@@ -37,7 +37,7 @@
 {
 
 	return (i > 0 && i < 8207) ? __ispow[i] : 1;
-	
+
 }
 
 
@@ -854,9 +854,9 @@
 				if (!mc) {
 					unsigned sanity;
 					mc = *m++;
-					if ((unsigned)*scf < 100 && (unsigned)*pretab < 100) {
+					if ((unsigned) *scf < 100 && (unsigned) *pretab < 100) {
 						sanity = (((*scf++) + (*pretab++)) << shift);
-					
+
 						//v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift];
 						if (sanity < 100) {
 							v = gr_info->pow2gain[sanity];
@@ -993,8 +993,8 @@
 
 #if 0
 static int III_dequantize_sample_ms(real xr[2][SBLIMIT][SSLIMIT], int *scf, struct gr_info_s *gr_info, int sfreq, int part2bits)
-{ma
-	int shift = 1 + gr_info->scalefac_scale;
+{
+	ma int shift = 1 + gr_info->scalefac_scale;
 	real *xrpnt = (real *) xr[1];
 	real *xr0pnt = (real *) xr[0];
 	int l[3], l3;

Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	Tue May 27 00:54:52 2008
@@ -64,15 +64,15 @@
 	int samplerate;
 	uint8_t thread_running;
 	uint8_t shout_init;
-    uint32_t prebuf;
-    int lame_ready;
+	uint32_t prebuf;
+	int lame_ready;
 };
 
 typedef struct shout_context shout_context_t;
 
-static size_t decode_fd(shout_context_t * context, void *data, size_t bytes);
+static size_t decode_fd(shout_context_t *context, void *data, size_t bytes);
 
-static inline void free_context(shout_context_t * context)
+static inline void free_context(shout_context_t *context)
 {
 	int ret;
 
@@ -210,7 +210,7 @@
 	}
 }
 
-static size_t decode_fd(shout_context_t * context, void *data, size_t bytes)
+static size_t decode_fd(shout_context_t *context, void *data, size_t bytes)
 {
 	int decode_status = 0;
 	int dlen = 0;
@@ -278,7 +278,7 @@
 				}
 
 				dlen = 0;
-				continue;				
+				continue;
 			}
 
 			context->mp3err = 0;
@@ -309,7 +309,7 @@
 
 	return 0;
 
- error:
+  error:
 	switch_mutex_lock(context->audio_mutex);
 	context->err++;
 	switch_mutex_unlock(context->audio_mutex);
@@ -340,9 +340,9 @@
 
 	error_check();
 
-    if (context->prebuf) {
-        buf_size = context->prebuf;
-    }
+	if (context->prebuf) {
+		buf_size = context->prebuf;
+	}
 
 	/* make sure we aren't over zealous by slowing down the stream when the buffer is too full */
 	for (;;) {
@@ -358,7 +358,7 @@
 		switch_mutex_unlock(context->audio_mutex);
 
 		if (used < buf_size) {
-            //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Buffered %u/%u!\n", used, buf_size);
+			//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Buffered %u/%u!\n", used, buf_size);
 			break;
 		}
 
@@ -421,7 +421,7 @@
 
 	return realsize;
 
- error:
+  error:
 	switch_mutex_lock(context->audio_mutex);
 	context->err++;
 	switch_mutex_unlock(context->audio_mutex);
@@ -431,7 +431,7 @@
 
 #define MY_BUF_LEN 1024 * 32
 #define MY_BLOCK_SIZE MY_BUF_LEN
-static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj)
 {
 	CURL *curl_handle = NULL;
 	shout_context_t *context = (shout_context_t *) obj;
@@ -451,7 +451,7 @@
 	return NULL;
 }
 
-static void launch_read_stream_thread(shout_context_t * context)
+static void launch_read_stream_thread(shout_context_t *context)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
@@ -467,7 +467,7 @@
 	switch_thread_create(&thread, thd_attr, read_stream_thread, context, context->memory_pool);
 }
 
-static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t *thread, void *obj)
 {
 	shout_context_t *context = (shout_context_t *) obj;
 
@@ -513,13 +513,13 @@
 		switch_yield(100000);
 	}
 
- error:
+  error:
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread Done\n");
 	context->thread_running = 0;
 	return NULL;
 }
 
-static void launch_write_stream_thread(shout_context_t * context)
+static void launch_write_stream_thread(shout_context_t *context)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
@@ -565,7 +565,7 @@
 		InitMP3(&context->mp, OUTSCALE, context->samplerate);
 		if (handle->handler) {
 			context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
-            context->prebuf = handle->prebuf;
+			context->prebuf = handle->prebuf;
 			launch_read_stream_thread(context);
 		} else {
 			if (switch_file_open(&context->fd, path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) !=
@@ -580,25 +580,25 @@
 			goto error;
 		}
 
-        if (!handle->handler) {
-            id3tag_init(context->gfp);
-            id3tag_v2_only(context->gfp);
-            id3tag_pad_v2(context->gfp);
+		if (!handle->handler) {
+			id3tag_init(context->gfp);
+			id3tag_v2_only(context->gfp);
+			id3tag_pad_v2(context->gfp);
 
-        }
+		}
 
 		lame_set_brate(context->gfp, 24 * (handle->samplerate / 8000) * handle->channels);
 		lame_set_num_channels(context->gfp, handle->channels);
 		lame_set_in_samplerate(context->gfp, handle->samplerate);
 		lame_set_out_samplerate(context->gfp, handle->samplerate);
 
-        if (handle->channels == 2) {
-            lame_set_mode(context->gfp, STEREO);
-        } else {
-            lame_set_mode(context->gfp, MONO);
-        }
+		if (handle->channels == 2) {
+			lame_set_mode(context->gfp, STEREO);
+		} else {
+			lame_set_mode(context->gfp, MONO);
+		}
 		lame_set_quality(context->gfp, 2);	/* 2=high  5 = medium  7=low */
-        
+
 		lame_set_errorf(context->gfp, log_error);
 		lame_set_debugf(context->gfp, log_debug);
 		lame_set_msgf(context->gfp, log_msg);
@@ -716,7 +716,7 @@
 
 	return SWITCH_STATUS_SUCCESS;
 
- error:
+  error:
 	if (err) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: %s\n", err);
 	}
@@ -750,8 +750,8 @@
 				*cur_sample = fseek(context->fp, *cur_sample, whence);
 			}
 
-            ExitMP3(&context->mp);
-            InitMP3(&context->mp, OUTSCALE, context->samplerate);
+			ExitMP3(&context->mp);
+			InitMP3(&context->mp, OUTSCALE, context->samplerate);
 			switch_buffer_zero(context->audio_buffer);
 
 		} else {
@@ -833,35 +833,35 @@
 		}
 	} else {
 
-        if (!context->lame_ready) {
-            lame_init_params(context->gfp);
-            lame_print_config(context->gfp);
-            context->lame_ready = 1;
-        }
-
-        if (handle->channels == 2) {
-            int16_t l[4096] = {0};
-            int16_t r[4096] = {0};
-            int i, j = 0;
-            
-            for(i = 0; i < nsamples; i++) {
-                l[i] = audio[j++];
-                r[i] = audio[j++];
-            }
-
-            if ((rlen = lame_encode_buffer(context->gfp, l, r, nsamples, mp3buf, sizeof(mp3buf))) < 0) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
-                return SWITCH_STATUS_FALSE;
-            }
-
-        } else if (handle->channels == 1) {
-            if ((rlen = lame_encode_buffer(context->gfp, audio, NULL, nsamples, mp3buf, sizeof(mp3buf))) < 0) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
-                return SWITCH_STATUS_FALSE;
-            }
-        } else {
-            rlen = 0;
-        }
+		if (!context->lame_ready) {
+			lame_init_params(context->gfp);
+			lame_print_config(context->gfp);
+			context->lame_ready = 1;
+		}
+
+		if (handle->channels == 2) {
+			int16_t l[4096] = { 0 };
+			int16_t r[4096] = { 0 };
+			int i, j = 0;
+
+			for (i = 0; i < nsamples; i++) {
+				l[i] = audio[j++];
+				r[i] = audio[j++];
+			}
+
+			if ((rlen = lame_encode_buffer(context->gfp, l, r, nsamples, mp3buf, sizeof(mp3buf))) < 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
+				return SWITCH_STATUS_FALSE;
+			}
+
+		} else if (handle->channels == 1) {
+			if ((rlen = lame_encode_buffer(context->gfp, audio, NULL, nsamples, mp3buf, sizeof(mp3buf))) < 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
+				return SWITCH_STATUS_FALSE;
+			}
+		} else {
+			rlen = 0;
+		}
 
 		if (rlen) {
 			int ret = fwrite(mp3buf, 1, rlen, context->fp);
@@ -879,55 +879,55 @@
 static switch_status_t shout_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col, const char *string)
 {
 	shout_context_t *context = handle->private_info;
-    switch_status_t status = SWITCH_STATUS_FALSE;
-    
-    if (!context->shout) {
-        switch (col) {
-        case SWITCH_AUDIO_COL_STR_TITLE:
-            id3tag_set_title(context->gfp, string);
-            break;
-        case SWITCH_AUDIO_COL_STR_COMMENT:
-            id3tag_set_comment(context->gfp, string);
-            break;
-        case SWITCH_AUDIO_COL_STR_ARTIST:
-            id3tag_set_artist(context->gfp, string);
-            break;
-        case SWITCH_AUDIO_COL_STR_DATE:
-            id3tag_set_year(context->gfp, string);
-            break;
-        case SWITCH_AUDIO_COL_STR_SOFTWARE:
-            break;
-            id3tag_set_album(context->gfp, string);
-        case SWITCH_AUDIO_COL_STR_COPYRIGHT:
-            id3tag_set_genre(context->gfp, string);
-            break;
-        default:
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Value Ignored\n");
-            break;
-        }
-        
-        return status;
-    }
-    
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (!context->shout) {
+		switch (col) {
+		case SWITCH_AUDIO_COL_STR_TITLE:
+			id3tag_set_title(context->gfp, string);
+			break;
+		case SWITCH_AUDIO_COL_STR_COMMENT:
+			id3tag_set_comment(context->gfp, string);
+			break;
+		case SWITCH_AUDIO_COL_STR_ARTIST:
+			id3tag_set_artist(context->gfp, string);
+			break;
+		case SWITCH_AUDIO_COL_STR_DATE:
+			id3tag_set_year(context->gfp, string);
+			break;
+		case SWITCH_AUDIO_COL_STR_SOFTWARE:
+			break;
+			id3tag_set_album(context->gfp, string);
+		case SWITCH_AUDIO_COL_STR_COPYRIGHT:
+			id3tag_set_genre(context->gfp, string);
+			break;
+		default:
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Value Ignored\n");
+			break;
+		}
+
+		return status;
+	}
+
 	switch (col) {
 	case SWITCH_AUDIO_COL_STR_TITLE:
 		if (shout_set_name(context->shout, string) == SHOUTERR_SUCCESS) {
-            status = SWITCH_STATUS_SUCCESS;
-        } else {
+			status = SWITCH_STATUS_SUCCESS;
+		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
 		}
 		break;
 	case SWITCH_AUDIO_COL_STR_COMMENT:
 		if (shout_set_url(context->shout, string) == SHOUTERR_SUCCESS) {
-            status = SWITCH_STATUS_SUCCESS;
-        } else {
+			status = SWITCH_STATUS_SUCCESS;
+		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
 		}
 		break;
 	case SWITCH_AUDIO_COL_STR_ARTIST:
 		if (shout_set_description(context->shout, string) == SHOUTERR_SUCCESS) {
-            status = SWITCH_STATUS_SUCCESS;
-        } else {
+			status = SWITCH_STATUS_SUCCESS;
+		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
 		}
 		break;
@@ -946,7 +946,7 @@
 
 static switch_bool_t telecast_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
 {
-    switch_buffer_t *buffer = (switch_buffer_t *) user_data;
+	switch_buffer_t *buffer = (switch_buffer_t *) user_data;
 	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_frame_t frame = { 0 };
 
@@ -961,18 +961,18 @@
 	case SWITCH_ABC_TYPE_READ_PING:
 		if (buffer) {
 			if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
-                switch_buffer_lock(buffer);
-                switch_buffer_write(buffer, frame.data, frame.datalen);
-                switch_buffer_unlock(buffer);
+				switch_buffer_lock(buffer);
+				switch_buffer_write(buffer, frame.data, frame.datalen);
+				switch_buffer_unlock(buffer);
 			}
 		} else {
-            return SWITCH_FALSE;
-        }
+			return SWITCH_FALSE;
+		}
 		break;
 
 	case SWITCH_ABC_TYPE_READ:
 	case SWITCH_ABC_TYPE_WRITE:
-        
+
 	default:
 		break;
 	}
@@ -981,357 +981,344 @@
 }
 
 struct holder {
-    switch_stream_handle_t *stream;
-    switch_memory_pool_t *pool;
-    char *host;
-    char *port;
-    char *uri;
+	switch_stream_handle_t *stream;
+	switch_memory_pool_t *pool;
+	char *host;
+	char *port;
+	char *uri;
 };
 
 static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
-    struct holder *holder = (struct holder *) pArg;
-    char title_b4[128] = "";
-    char title_aft[128*3] = "";
-    char *mp3, *m3u;
-
-    /*
-      0  uuid  VARCHAR(255),
-      1  created  VARCHAR(255),
-      2  name  VARCHAR(255),
-      3  state  VARCHAR(255),
-      4  cid_name  VARCHAR(255),
-      5  cid_num  VARCHAR(255),
-      6  ip_addr  VARCHAR(255),
-      7  dest  VARCHAR(255),
-      8  application  VARCHAR(255),
-      9  application_data  VARCHAR(255),
-      10 read_codec  VARCHAR(255),
-      11 read_rate  VARCHAR(255),
-      12 write_codec  VARCHAR(255),
-      13 write_rate  VARCHAR(255)
-    */
-    
-    holder->stream->write_function(holder->stream, 
-                                   "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>", 
-                                   argv[1], argv[4], argv[5], argv[7], argv[8] ? argv[8] : "N/A", argv[9] ? argv[9] : "N/A", argv[10], argv[11]);
-    
-    snprintf(title_b4, sizeof(title_b4), "%s <%s>", argv[4], argv[5]);
-    switch_url_encode(title_b4, title_aft, sizeof(title_aft));
-
-    mp3 = switch_mprintf("http://%s:%s%s/mp3/%s/%s.mp3", holder->host, holder->port, holder->uri, argv[0], argv[5]);
-    m3u = switch_mprintf("http://%s:%s%s/m3u/mp3/%s/%s.mp3.m3u", holder->host, holder->port, holder->uri, argv[0], argv[5]);
-
-    holder->stream->write_function(holder->stream, "[<a href=%s>mp3</a>] ", mp3);
-    holder->stream->write_function(holder->stream, "[<a href=%s>m3u</a>]</td></tr>\n", m3u);
-    
-    switch_safe_free(mp3);
-    switch_safe_free(m3u);
-    return 0;
+	struct holder *holder = (struct holder *) pArg;
+	char title_b4[128] = "";
+	char title_aft[128 * 3] = "";
+	char *mp3, *m3u;
+
+	/*
+	   0  uuid  VARCHAR(255),
+	   1  created  VARCHAR(255),
+	   2  name  VARCHAR(255),
+	   3  state  VARCHAR(255),
+	   4  cid_name  VARCHAR(255),
+	   5  cid_num  VARCHAR(255),
+	   6  ip_addr  VARCHAR(255),
+	   7  dest  VARCHAR(255),
+	   8  application  VARCHAR(255),
+	   9  application_data  VARCHAR(255),
+	   10 read_codec  VARCHAR(255),
+	   11 read_rate  VARCHAR(255),
+	   12 write_codec  VARCHAR(255),
+	   13 write_rate  VARCHAR(255)
+	 */
+
+	holder->stream->write_function(holder->stream,
+								   "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>",
+								   argv[1], argv[4], argv[5], argv[7], argv[8] ? argv[8] : "N/A", argv[9] ? argv[9] : "N/A", argv[10], argv[11]);
+
+	snprintf(title_b4, sizeof(title_b4), "%s <%s>", argv[4], argv[5]);
+	switch_url_encode(title_b4, title_aft, sizeof(title_aft));
+
+	mp3 = switch_mprintf("http://%s:%s%s/mp3/%s/%s.mp3", holder->host, holder->port, holder->uri, argv[0], argv[5]);
+	m3u = switch_mprintf("http://%s:%s%s/m3u/mp3/%s/%s.mp3.m3u", holder->host, holder->port, holder->uri, argv[0], argv[5]);
+
+	holder->stream->write_function(holder->stream, "[<a href=%s>mp3</a>] ", mp3);
+	holder->stream->write_function(holder->stream, "[<a href=%s>m3u</a>]</td></tr>\n", m3u);
+
+	switch_safe_free(mp3);
+	switch_safe_free(m3u);
+	return 0;
 }
 
 void do_telecast(switch_stream_handle_t *stream)
 {
-    char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
-    char *uuid = strdup(path_info + 4);
-    switch_core_session_t *tsession;
-    char *fname = "stream.mp3";
-
-    if ((fname = strchr(uuid, '/'))) {
-        *fname++ = '\0';
-    }
-
-    if (!(tsession = switch_core_session_locate(uuid))) {
-        char *ref = switch_event_get_header(stream->param_event, "http-referer");
-        stream->write_function(stream,"Content-type: text/html\r\n\r\n<h2>Not Found!</h2>\n"
-                               "<META http-equiv=\"refresh\" content=\"1;URL=%s\">",  ref);
-    } else {
-        switch_media_bug_t *bug = NULL;
-        switch_buffer_t *buffer;
-        switch_mutex_t *mutex;
-        switch_channel_t *channel = switch_core_session_get_channel(tsession);
-        lame_global_flags *gfp = NULL;
-        switch_codec_t *read_codec;
-        
-        if (!(gfp = lame_init())) {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
-            goto end;
-        }
-        read_codec = switch_core_session_get_read_codec(tsession);
-            
-        lame_set_num_channels(gfp, read_codec->implementation->number_of_channels);
-        lame_set_in_samplerate(gfp, read_codec->implementation->actual_samples_per_second);
-        lame_set_brate(gfp, 24);
-        lame_set_mode(gfp, 3);
-        lame_set_quality(gfp, 2);
-        lame_set_errorf(gfp, log_error);
-        lame_set_debugf(gfp, log_debug);
-        lame_set_msgf(gfp, log_msg);
-        lame_set_bWriteVbrTag(gfp, 0);
-        lame_mp3_tags_fid(gfp, NULL);
-        lame_init_params(gfp);
-        lame_print_config(gfp);
-            
-        switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(tsession));
-        switch_buffer_create_dynamic(&buffer, 1024, 2048, 0);
-        switch_buffer_add_mutex(buffer, mutex);
-        
-        if (switch_core_media_bug_add(tsession, telecast_callback, buffer, 0, 
-                                      SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING, &bug) != SWITCH_STATUS_SUCCESS) {
-            goto end;
-        }
-
-        stream->write_function(stream, 
-                               "Content-type: audio/mpeg\r\n"
-                               "Content-Disposition: inline; filename=\"%s\"\r\n\r\n", 
-                               fname);
-            
-        while(switch_channel_ready(channel)) {
-            unsigned char mp3buf[TC_BUFFER_SIZE] = "";
-            int rlen;
-            uint8_t buf[1024];
-            switch_size_t bytes = 0;
-
-            if (switch_buffer_inuse(buffer) >= 1024) {
-                switch_buffer_lock(buffer);
-                bytes = switch_buffer_read(buffer, buf, sizeof(buf));
-                switch_buffer_unlock(buffer);
-            } else {
-                if (!bytes) {
-                    switch_yield(1000);
-                    continue;
-                }
-                memset(buf, 0, bytes);
-            }
-            
-            if ((rlen = lame_encode_buffer(gfp, (void *)buf, NULL, bytes / 2, mp3buf, sizeof(mp3buf))) < 0) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
-                goto end;
-            }
-
-            if (rlen) {
-                if (stream->raw_write_function(stream, mp3buf, rlen)) {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
-                    goto end;
-                }
-            }
-        }
-
-    end:
-
-        switch_safe_free(uuid);
-
-        if (gfp) {
-            lame_close(gfp);
-            gfp = NULL;
-        }
-            
-        if (bug) {
-            switch_core_media_bug_remove(tsession, &bug);
-        }
-
-        if (buffer) {
-            switch_buffer_destroy(&buffer);
-        }
+	char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
+	char *uuid = strdup(path_info + 4);
+	switch_core_session_t *tsession;
+	char *fname = "stream.mp3";
+
+	if ((fname = strchr(uuid, '/'))) {
+		*fname++ = '\0';
+	}
+
+	if (!(tsession = switch_core_session_locate(uuid))) {
+		char *ref = switch_event_get_header(stream->param_event, "http-referer");
+		stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>Not Found!</h2>\n" "<META http-equiv=\"refresh\" content=\"1;URL=%s\">", ref);
+	} else {
+		switch_media_bug_t *bug = NULL;
+		switch_buffer_t *buffer;
+		switch_mutex_t *mutex;
+		switch_channel_t *channel = switch_core_session_get_channel(tsession);
+		lame_global_flags *gfp = NULL;
+		switch_codec_t *read_codec;
+
+		if (!(gfp = lame_init())) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
+			goto end;
+		}
+		read_codec = switch_core_session_get_read_codec(tsession);
+
+		lame_set_num_channels(gfp, read_codec->implementation->number_of_channels);
+		lame_set_in_samplerate(gfp, read_codec->implementation->actual_samples_per_second);
+		lame_set_brate(gfp, 24);
+		lame_set_mode(gfp, 3);
+		lame_set_quality(gfp, 2);
+		lame_set_errorf(gfp, log_error);
+		lame_set_debugf(gfp, log_debug);
+		lame_set_msgf(gfp, log_msg);
+		lame_set_bWriteVbrTag(gfp, 0);
+		lame_mp3_tags_fid(gfp, NULL);
+		lame_init_params(gfp);
+		lame_print_config(gfp);
+
+		switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(tsession));
+		switch_buffer_create_dynamic(&buffer, 1024, 2048, 0);
+		switch_buffer_add_mutex(buffer, mutex);
+
+		if (switch_core_media_bug_add(tsession, telecast_callback, buffer, 0,
+									  SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING, &bug) != SWITCH_STATUS_SUCCESS) {
+			goto end;
+		}
+
+		stream->write_function(stream, "Content-type: audio/mpeg\r\n" "Content-Disposition: inline; filename=\"%s\"\r\n\r\n", fname);
+
+		while (switch_channel_ready(channel)) {
+			unsigned char mp3buf[TC_BUFFER_SIZE] = "";
+			int rlen;
+			uint8_t buf[1024];
+			switch_size_t bytes = 0;
+
+			if (switch_buffer_inuse(buffer) >= 1024) {
+				switch_buffer_lock(buffer);
+				bytes = switch_buffer_read(buffer, buf, sizeof(buf));
+				switch_buffer_unlock(buffer);
+			} else {
+				if (!bytes) {
+					switch_yield(1000);
+					continue;
+				}
+				memset(buf, 0, bytes);
+			}
+
+			if ((rlen = lame_encode_buffer(gfp, (void *) buf, NULL, bytes / 2, mp3buf, sizeof(mp3buf))) < 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
+				goto end;
+			}
+
+			if (rlen) {
+				if (stream->raw_write_function(stream, mp3buf, rlen)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
+					goto end;
+				}
+			}
+		}
+
+	  end:
+
+		switch_safe_free(uuid);
+
+		if (gfp) {
+			lame_close(gfp);
+			gfp = NULL;
+		}
+
+		if (bug) {
+			switch_core_media_bug_remove(tsession, &bug);
+		}
+
+		if (buffer) {
+			switch_buffer_destroy(&buffer);
+		}
 
-        switch_core_session_rwunlock(tsession);
-    }
+		switch_core_session_rwunlock(tsession);
+	}
 }
 
 void do_broadcast(switch_stream_handle_t *stream)
 {
-    char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
-    char *file;
-    lame_global_flags *gfp = NULL;
-    switch_file_handle_t fh = {0};
-    unsigned char mp3buf[TC_BUFFER_SIZE] = "";
-    uint8_t buf[1024];
-    int rlen;
-    int is_local = 0;
-    uint32_t interval = 20000;
-
-    if (strstr(path_info + 7, "://")) {
-        file = strdup(path_info + 7);
-        is_local++;
-    } else {
-        file = switch_mprintf("%s/streamfiles/%s", SWITCH_GLOBAL_dirs.base_dir, path_info + 7);
-    }
-    assert(file);
-
-	if (switch_core_file_open(&fh,
-							  file,
-							  0,
-							  0,
-							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
-        memset(&fh, 0, sizeof(fh));
-        stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>File not found</h2>\n");
-        goto end;
-	}
-
-    if (switch_test_flag((&fh), SWITCH_FILE_NATIVE)) {
-        stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>File format not supported</h2>\n");
-        goto end;
-    }
-
-    if (!(gfp = lame_init())) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
-        goto end;
-    }
-            
-    lame_set_num_channels(gfp, fh.channels);
-    lame_set_in_samplerate(gfp, fh.samplerate);
-    lame_set_brate(gfp, 24);
-    lame_set_mode(gfp, 3);
-    lame_set_quality(gfp, 2);
-    lame_set_errorf(gfp, log_error);
-    lame_set_debugf(gfp, log_debug);
-    lame_set_msgf(gfp, log_msg);
-    lame_set_bWriteVbrTag(gfp, 0);
-    lame_mp3_tags_fid(gfp, NULL);
-    lame_init_params(gfp);
-    lame_print_config(gfp);
-    
-    stream->write_function(stream, 
-                           "Content-type: audio/mpeg\r\n"
-                           "Content-Disposition: inline; filename=\"%s.mp3\"\r\n\r\n", 
-                           path_info + 7);
-
-    if (fh.interval) {
-        interval = fh.interval * 1000;
-    }
-
-    for(;;) {
-        switch_size_t samples = sizeof(buf) / 2;
-
-        switch_core_file_read(&fh, buf, &samples);
-
-        if (is_local) {
-            switch_yield(interval);
-        }
-
-        if (!samples) {
-            break;
-        }
-
-        if ((rlen = lame_encode_buffer(gfp, (void *)buf, NULL, samples, mp3buf, sizeof(mp3buf))) < 0) {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
-            goto end;
-        }
-        
-        if (rlen) {
-            if (stream->raw_write_function(stream, mp3buf, rlen)) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
-                goto end;
-            }
-        }
-    }
-
-    while ((rlen = lame_encode_flush(gfp, mp3buf, sizeof(mp3buf))) > 0) {
-        if (stream->raw_write_function(stream, mp3buf, rlen)) {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
-            goto end;
-        }
-    }
-
- end:
-
-    if (fh.channels) {
-        switch_core_file_close(&fh);
-    }
-
-    switch_safe_free(file);
-
-    if (gfp) {
-        lame_close(gfp);
-        gfp = NULL;
-    }            
+	char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
+	char *file;
+	lame_global_flags *gfp = NULL;
+	switch_file_handle_t fh = { 0 };
+	unsigned char mp3buf[TC_BUFFER_SIZE] = "";
+	uint8_t buf[1024];
+	int rlen;
+	int is_local = 0;
+	uint32_t interval = 20000;
+
+	if (strstr(path_info + 7, "://")) {
+		file = strdup(path_info + 7);
+		is_local++;
+	} else {
+		file = switch_mprintf("%s/streamfiles/%s", SWITCH_GLOBAL_dirs.base_dir, path_info + 7);
+	}
+	assert(file);
+
+	if (switch_core_file_open(&fh, file, 0, 0, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+		memset(&fh, 0, sizeof(fh));
+		stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>File not found</h2>\n");
+		goto end;
+	}
+
+	if (switch_test_flag((&fh), SWITCH_FILE_NATIVE)) {
+		stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>File format not supported</h2>\n");
+		goto end;
+	}
+
+	if (!(gfp = lame_init())) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
+		goto end;
+	}
+
+	lame_set_num_channels(gfp, fh.channels);
+	lame_set_in_samplerate(gfp, fh.samplerate);
+	lame_set_brate(gfp, 24);
+	lame_set_mode(gfp, 3);
+	lame_set_quality(gfp, 2);
+	lame_set_errorf(gfp, log_error);
+	lame_set_debugf(gfp, log_debug);
+	lame_set_msgf(gfp, log_msg);
+	lame_set_bWriteVbrTag(gfp, 0);
+	lame_mp3_tags_fid(gfp, NULL);
+	lame_init_params(gfp);
+	lame_print_config(gfp);
+
+	stream->write_function(stream, "Content-type: audio/mpeg\r\n" "Content-Disposition: inline; filename=\"%s.mp3\"\r\n\r\n", path_info + 7);
+
+	if (fh.interval) {
+		interval = fh.interval * 1000;
+	}
+
+	for (;;) {
+		switch_size_t samples = sizeof(buf) / 2;
+
+		switch_core_file_read(&fh, buf, &samples);
+
+		if (is_local) {
+			switch_yield(interval);
+		}
+
+		if (!samples) {
+			break;
+		}
+
+		if ((rlen = lame_encode_buffer(gfp, (void *) buf, NULL, samples, mp3buf, sizeof(mp3buf))) < 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
+			goto end;
+		}
+
+		if (rlen) {
+			if (stream->raw_write_function(stream, mp3buf, rlen)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
+				goto end;
+			}
+		}
+	}
+
+	while ((rlen = lame_encode_flush(gfp, mp3buf, sizeof(mp3buf))) > 0) {
+		if (stream->raw_write_function(stream, mp3buf, rlen)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
+			goto end;
+		}
+	}
+
+  end:
+
+	if (fh.channels) {
+		switch_core_file_close(&fh);
+	}
+
+	switch_safe_free(file);
+
+	if (gfp) {
+		lame_close(gfp);
+		gfp = NULL;
+	}
 }
 
 void do_index(switch_stream_handle_t *stream)
 {
-    switch_core_db_t *db = switch_core_db_handle();
-    const char *sql = "select * from channels";
-    struct holder holder;
-    char *errmsg;
-
-    holder.host = switch_event_get_header(stream->param_event, "http-host");
-    holder.port = switch_event_get_header(stream->param_event, "http-port");
-    holder.uri = switch_event_get_header(stream->param_event, "http-uri");
-    holder.stream = stream;
-    
-    stream->write_function(stream, "Content-type: text/html\r\n\r\n");
-    stream->write_function(stream,
-                           "<table align=center border=1 cellpadding=6 cellspacing=0>"
-                           "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
-                           "Created", "CID Name", "CID Num", "Ext", "App", "Data", "Codec", "Rate", "Listen"
-                           );
-    
-    switch_core_db_exec(db, sql, web_callback, &holder, &errmsg);
-    
-    stream->write_function(stream,
-                           "</table>");
-    
-    if (errmsg) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s]\n", errmsg);    
-        switch_safe_free(errmsg);
-    }
+	switch_core_db_t *db = switch_core_db_handle();
+	const char *sql = "select * from channels";
+	struct holder holder;
+	char *errmsg;
+
+	holder.host = switch_event_get_header(stream->param_event, "http-host");
+	holder.port = switch_event_get_header(stream->param_event, "http-port");
+	holder.uri = switch_event_get_header(stream->param_event, "http-uri");
+	holder.stream = stream;
+
+	stream->write_function(stream, "Content-type: text/html\r\n\r\n");
+	stream->write_function(stream,
+						   "<table align=center border=1 cellpadding=6 cellspacing=0>"
+						   "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
+						   "Created", "CID Name", "CID Num", "Ext", "App", "Data", "Codec", "Rate", "Listen");
+
+	switch_core_db_exec(db, sql, web_callback, &holder, &errmsg);
+
+	stream->write_function(stream, "</table>");
+
+	if (errmsg) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s]\n", errmsg);
+		switch_safe_free(errmsg);
+	}
 }
 
 #define TELECAST_SYNTAX ""
 SWITCH_STANDARD_API(telecast_api_function)
 {
-    char *host = NULL, *port = NULL, *uri = NULL, *path_info = NULL;
+	char *host = NULL, *port = NULL, *uri = NULL, *path_info = NULL;
 
-   	if (session) {
+	if (session) {
 		return SWITCH_STATUS_FALSE;
 	}
 
-    if (stream->param_event) {
-        host = switch_event_get_header(stream->param_event, "http-host");
-        port = switch_event_get_header(stream->param_event, "http-port");
-        uri = switch_event_get_header(stream->param_event, "http-uri");
-        path_info = switch_event_get_header(stream->param_event, "http-path-info");
-    }
-
-    if (!path_info) {
-        return SWITCH_STATUS_FALSE;
-    } else {
-        if (!strncmp(path_info, "index", 5)) {
-            do_index(stream);
-            return SWITCH_STATUS_SUCCESS;
-        }
-
-        if (!strncmp(path_info, "m3u/", 4)) {
-            char *p;
-
-            if ((p = strstr(path_info, ".m3u"))) {
-                *p = '\0';
-            }
-
-            stream->write_function(stream, "Content-type: audio/x-mpegurl\r\n\r\nhttp://%s:%s%s/%s\n", host, port, uri, path_info + 4);
-            return SWITCH_STATUS_SUCCESS;
-        }
-
-        if (!strncmp(path_info, "mp3/", 4)) {
-            do_telecast(stream);
-            return SWITCH_STATUS_SUCCESS;
-        }
-
-        if (!strncmp(path_info, "stream/", 7)) {
-            do_broadcast(stream);
-            return SWITCH_STATUS_SUCCESS;
-        }
-    }
-    
-    stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>Invalid URL</h2>\n");
+	if (stream->param_event) {
+		host = switch_event_get_header(stream->param_event, "http-host");
+		port = switch_event_get_header(stream->param_event, "http-port");
+		uri = switch_event_get_header(stream->param_event, "http-uri");
+		path_info = switch_event_get_header(stream->param_event, "http-path-info");
+	}
 
-    return SWITCH_STATUS_SUCCESS;
+	if (!path_info) {
+		return SWITCH_STATUS_FALSE;
+	} else {
+		if (!strncmp(path_info, "index", 5)) {
+			do_index(stream);
+			return SWITCH_STATUS_SUCCESS;
+		}
+
+		if (!strncmp(path_info, "m3u/", 4)) {
+			char *p;
+
+			if ((p = strstr(path_info, ".m3u"))) {
+				*p = '\0';
+			}
+
+			stream->write_function(stream, "Content-type: audio/x-mpegurl\r\n\r\nhttp://%s:%s%s/%s\n", host, port, uri, path_info + 4);
+			return SWITCH_STATUS_SUCCESS;
+		}
+
+		if (!strncmp(path_info, "mp3/", 4)) {
+			do_telecast(stream);
+			return SWITCH_STATUS_SUCCESS;
+		}
+
+		if (!strncmp(path_info, "stream/", 7)) {
+			do_broadcast(stream);
+			return SWITCH_STATUS_SUCCESS;
+		}
+	}
+
+	stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>Invalid URL</h2>\n");
+
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load)
 {
-    switch_api_interface_t *shout_api_interface;
-    switch_file_interface_t *file_interface;
+	switch_api_interface_t *shout_api_interface;
+	switch_file_interface_t *file_interface;
 
 	supported_formats[0] = "shout";
 	supported_formats[1] = "mp3";
@@ -1339,16 +1326,16 @@
 	curl_global_init(CURL_GLOBAL_ALL);
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-    file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
-    file_interface->interface_name = modname;
-    file_interface->extens = supported_formats;
-    file_interface->file_open = shout_file_open;
-    file_interface->file_close = shout_file_close;
-    file_interface->file_read = shout_file_read;
-    file_interface->file_write = shout_file_write;
-    file_interface->file_seek = shout_file_seek;
-    file_interface->file_set_string = shout_file_set_string;
-    file_interface->file_get_string = shout_file_get_string;
+	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
+	file_interface->interface_name = modname;
+	file_interface->extens = supported_formats;
+	file_interface->file_open = shout_file_open;
+	file_interface->file_close = shout_file_close;
+	file_interface->file_read = shout_file_read;
+	file_interface->file_write = shout_file_write;
+	file_interface->file_seek = shout_file_seek;
+	file_interface->file_set_string = shout_file_set_string;
+	file_interface->file_get_string = shout_file_get_string;
 
 	/* connect my internal structure to the blank pointer passed to me */
 	//*module_interface = &shout_module_interface;
@@ -1356,7 +1343,7 @@
 	shout_init();
 	InitMP3Constants();
 
-    SWITCH_ADD_API(shout_api_interface, "telecast", "telecast", telecast_api_function, TELECAST_SYNTAX);
+	SWITCH_ADD_API(shout_api_interface, "telecast", "telecast", telecast_api_function, TELECAST_SYNTAX);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c	Tue May 27 00:54:52 2008
@@ -147,7 +147,7 @@
 
 	alt_len = strlen(path) + 10;
 	switch_zmalloc(alt_path, alt_len);
-	
+
 	switch_copy_string(alt_path, path, alt_len);
 	if ((last = strrchr(alt_path, '/'))) {
 		next = ++last;
@@ -177,7 +177,6 @@
 			goto end;
 		}
 	}
-
 	//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] rate %dhz\n", path, context->sfinfo.samplerate);
 	handle->samples = (unsigned int) context->sfinfo.frames;
 	handle->samplerate = context->sfinfo.samplerate;
@@ -188,8 +187,8 @@
 	handle->speed = 0;
 	handle->private_info = context;
 
- end:
-	
+  end:
+
 	switch_safe_free(alt_path);
 	switch_safe_free(ldup);
 
@@ -334,7 +333,7 @@
 			char *p;
 			struct format_map *map = switch_core_permanent_alloc(sizeof(*map));
 			switch_assert(map);
-	
+
 			map->ext = switch_core_permanent_strdup(info.extension);
 			map->uext = switch_core_permanent_strdup(info.extension);
 			map->format = info.format;

Modified: freeswitch/trunk/src/mod/formats/mod_tone_stream/mod_tone_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_tone_stream/mod_tone_stream.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_tone_stream/mod_tone_stream.c	Tue May 27 00:54:52 2008
@@ -79,9 +79,9 @@
 	}
 
 	teletone_init_session(&ts, 0, teletone_handler, audio_buffer);
-    ts.rate = handle->samplerate;
-    ts.channels = 1;
-	
+	ts.rate = handle->samplerate;
+	ts.channels = 1;
+
 	if (!strncasecmp(tonespec, "path=", 5)) {
 		tmp = tonespec + 5;
 		if ((fd = open(tmp, O_RDONLY)) < 0) {
@@ -89,7 +89,7 @@
 			return SWITCH_STATUS_FALSE;
 		}
 
-		while((len = switch_fd_read_line(fd, buf, sizeof(buf)))) {
+		while ((len = switch_fd_read_line(fd, buf, sizeof(buf)))) {
 			teletone_run(&ts, buf);
 		}
 		close(fd);
@@ -99,7 +99,7 @@
 	}
 
 	teletone_destroy_session(&ts);
-	
+
 	handle->private_info = audio_buffer;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -108,7 +108,7 @@
 static switch_status_t tone_stream_file_close(switch_file_handle_t *handle)
 {
 	switch_buffer_t *audio_buffer = handle->private_info;
-	
+
 	switch_buffer_destroy(&audio_buffer);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -117,7 +117,7 @@
 {
 	switch_buffer_t *audio_buffer = handle->private_info;
 	switch_size_t bytes;
-	
+
 	if ((bytes = switch_buffer_read_loop(audio_buffer, data, *len * 2)) <= 0) {
 		*len = 0;
 		return SWITCH_STATUS_FALSE;
@@ -135,7 +135,7 @@
 {
 	switch_file_interface_t *file_interface;
 	supported_formats[0] = "tone_stream";
-	
+
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
 	file_interface->interface_name = modname;

Modified: freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	Tue May 27 00:54:52 2008
@@ -3,19 +3,19 @@
 #include "freeswitch_lua.h"
 using namespace LUA;
 
-Session::Session() : CoreSession()
+Session::Session():CoreSession()
 {
 	cb_function = cb_arg = hangup_func_str = hangup_func_arg = NULL;
 	hh = mark = 0;
 }
 
-Session::Session(char *uuid) : CoreSession(uuid)
+Session::Session(char *uuid):CoreSession(uuid)
 {
 	cb_function = cb_arg = hangup_func_str = hangup_func_arg = NULL;
 	hh = mark = 0;
 }
 
-Session::Session(switch_core_session_t *new_session) : CoreSession(new_session)
+Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
 {
 	cb_function = cb_arg = hangup_func_str = hangup_func_arg = NULL;
 	hh = mark = 0;
@@ -30,25 +30,25 @@
 		}
 		free(hangup_func_str);
 	}
-	
+
 	switch_safe_free(hangup_func_arg);
 	switch_safe_free(cb_function);
 	switch_safe_free(cb_arg);
 }
 
-bool Session::begin_allow_threads() 
+bool Session::begin_allow_threads()
 {
 	do_hangup_hook();
 	return true;
 }
 
-bool Session::end_allow_threads() 
+bool Session::end_allow_threads()
 {
 	do_hangup_hook();
 	return true;
 }
 
-void Session::setLUA(lua_State *state)
+void Session::setLUA(lua_State * state)
 {
 	L = state;
 }
@@ -56,30 +56,31 @@
 lua_State *Session::getLUA()
 {
 	if (!L) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");
 	}
 	return L;
 }
 
 
-bool Session::ready() {
+bool Session::ready()
+{
 	bool r;
 
-	sanity_check(false);	
+	sanity_check(false);
 	r = switch_channel_ready(channel) != 0;
 	do_hangup_hook();
 
 	return r;
 }
 
-void Session::check_hangup_hook() 
+void Session::check_hangup_hook()
 {
 	if (hangup_func_str && (hook_state == CS_HANGUP || hook_state == CS_ROUTING)) {
 		hh++;
 	}
 }
 
-void Session::do_hangup_hook() 
+void Session::do_hangup_hook()
 {
 	if (hh && !mark) {
 		const char *err = NULL;
@@ -90,25 +91,25 @@
 			return;
 		}
 
-		lua_getfield(L, LUA_GLOBALSINDEX, (char *)hangup_func_str);
-		
+		lua_getfield(L, LUA_GLOBALSINDEX, (char *) hangup_func_str);
+
 		lua_pushstring(L, hook_state == CS_HANGUP ? "hangup" : "transfer");
 
 		if (hangup_func_arg) {
-			lua_getfield(L, LUA_GLOBALSINDEX, (char *)hangup_func_arg);
+			lua_getfield(L, LUA_GLOBALSINDEX, (char *) hangup_func_arg);
 			arg_count++;
 		}
-		
+
 		lua_call(L, arg_count, 1);
 		err = lua_tostring(L, -1);
 
 		if (!switch_strlen_zero(err)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
 		}
 	}
 }
 
-static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup) 
+static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
 	CoreSession *coresession = NULL;
@@ -125,13 +126,14 @@
 }
 
 
-void Session::setHangupHook(char *func, char *arg) {
+void Session::setHangupHook(char *func, char *arg)
+{
 
 	sanity_check_noreturn;
 
 	switch_safe_free(hangup_func_str);
 	switch_safe_free(hangup_func_arg);
-	
+
 	if (func) {
 		hangup_func_str = strdup(func);
 		if (!switch_strlen_zero(arg)) {
@@ -143,7 +145,8 @@
 	}
 }
 
-void Session::setInputCallback(char *cbfunc, char *funcargs) {
+void Session::setInputCallback(char *cbfunc, char *funcargs)
+{
 
 	sanity_check_noreturn;
 
@@ -156,15 +159,15 @@
 	if (funcargs) {
 		cb_arg = strdup(funcargs);
 	}
-	
+
 	args.buf = this;
 	switch_channel_set_private(channel, "CoreSession", this);
 
-	args.input_callback = dtmf_callback;  
+	args.input_callback = dtmf_callback;
 	ap = &args;
 }
 
-switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype) 
+switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
 {
 	const char *ret;
 
@@ -173,27 +176,27 @@
 	}
 
 	switch (itype) {
-    case SWITCH_INPUT_TYPE_DTMF:
+	case SWITCH_INPUT_TYPE_DTMF:
 		{
 			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
 			char str[2] = "";
 			int arg_count = 2;
 
-			lua_getfield(L, LUA_GLOBALSINDEX, (char *)cb_function);
-			lua_pushstring(L, "dtmf");			
-			
-			lua_newtable(L);		
+			lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_function);
+			lua_pushstring(L, "dtmf");
+
+			lua_newtable(L);
 			lua_pushstring(L, "digit");
 			str[0] = dtmf->digit;
 			lua_pushstring(L, str);
 			lua_rawset(L, -3);
-			
+
 			lua_pushstring(L, "duration");
 			lua_pushnumber(L, dtmf->duration);
 			lua_rawset(L, -3);
 
 			if (cb_arg) {
-				lua_getfield(L, LUA_GLOBALSINDEX, (char *)cb_arg);
+				lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_arg);
 				arg_count++;
 			}
 
@@ -201,30 +204,30 @@
 			ret = lua_tostring(L, -1);
 			lua_pop(L, 1);
 
-			return process_callback_result((char *)ret);
+			return process_callback_result((char *) ret);
 		}
 		break;
-    case SWITCH_INPUT_TYPE_EVENT:
+	case SWITCH_INPUT_TYPE_EVENT:
 		{
 			switch_event_t *event = (switch_event_t *) input;
 			int arg_count = 2;
 
-			lua_getfield(L, LUA_GLOBALSINDEX, (char *)cb_function);
+			lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_function);
 			lua_pushstring(L, "event");
 			mod_lua_conjure_event(L, event, "__Input_Event__", 1);
 			lua_getfield(L, LUA_GLOBALSINDEX, "__Input_Event__");
 
 			if (cb_arg) {
-				lua_getfield(L, LUA_GLOBALSINDEX, (char *)cb_arg);
+				lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_arg);
 				arg_count++;
 			}
 
 			lua_call(L, 2, 1);
 
-            ret = lua_tostring(L, -1);
+			ret = lua_tostring(L, -1);
 			lua_pop(L, 1);
-			
-            return process_callback_result((char *)ret);			
+
+			return process_callback_result((char *) ret);
 		}
 		break;
 	}

Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp	Tue May 27 00:54:52 2008
@@ -45,23 +45,23 @@
 	char *xml_handler;
 } globals;
 
-int luaopen_freeswitch(lua_State* L);
+int luaopen_freeswitch(lua_State * L);
 
-static int panic (lua_State *L) 
+static int panic(lua_State * L)
 {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "unprotected error in call to Lua API (%s)\n",
-					  lua_tostring(L, -1));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "unprotected error in call to Lua API (%s)\n", lua_tostring(L, -1));
 
 	return 0;
 }
 
-static void lua_uninit(lua_State *L) 
+static void lua_uninit(lua_State * L)
 {
 	lua_gc(L, LUA_GCCOLLECT, 0);
 	lua_close(L);
 }
 
-static int traceback (lua_State *L) {
+static int traceback(lua_State * L)
+{
 	lua_getfield(L, LUA_GLOBALSINDEX, "debug");
 	if (!lua_istable(L, -1)) {
 		lua_pop(L, 1);
@@ -72,30 +72,32 @@
 		lua_pop(L, 2);
 		return 1;
 	}
-	lua_pushvalue(L, 1);  /* pass error message */
-	lua_pushinteger(L, 2);	/* skip this function and traceback */
-	lua_call(L, 2, 1);	/* call debug.traceback */
+	lua_pushvalue(L, 1);		/* pass error message */
+	lua_pushinteger(L, 2);		/* skip this function and traceback */
+	lua_call(L, 2, 1);			/* call debug.traceback */
 	return 1;
 }
 
-static int docall (lua_State *L, int narg, int clear) {
+static int docall(lua_State * L, int narg, int clear)
+{
 	int status;
-	int base = lua_gettop(L) - narg;  /* function index */
- 
-	lua_pushcfunction(L, traceback);  /* push traceback function */
-	lua_insert(L, base);  /* put it under chunk and args */
+	int base = lua_gettop(L) - narg;	/* function index */
+
+	lua_pushcfunction(L, traceback);	/* push traceback function */
+	lua_insert(L, base);		/* put it under chunk and args */
 
 	status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);
 
-	lua_remove(L, base);  /* remove traceback function */
+	lua_remove(L, base);		/* remove traceback function */
 	/* force a complete garbage collection in case of errors */
-	if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0);
+	if (status != 0)
+		lua_gc(L, LUA_GCCOLLECT, 0);
 	return status;
 }
 
 
 
-static lua_State *lua_init(void) 
+static lua_State *lua_init(void)
 {
 	lua_State *L = lua_open();
 	int error = 0;
@@ -108,12 +110,12 @@
 		lua_gc(L, LUA_GCRESTART, 0);
 		lua_atpanic(L, panic);
 		error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 1);
- 	}
+	}
 	return L;
 }
 
 
-static int lua_parse_and_execute(lua_State *L, char *input_code)
+static int lua_parse_and_execute(lua_State * L, char *input_code)
 {
 	int error = 0;
 
@@ -124,7 +126,7 @@
 
 	if (*input_code == '~') {
 		char *buff = input_code + 1;
-		error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 1); //lua_pcall(L, 0, 0, 0);
+		error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 1);	//lua_pcall(L, 0, 0, 0);
 	} else {
 		char *args = strchr(input_code, ' ');
 		if (args) {
@@ -136,13 +138,13 @@
 			if ((argc = switch_separate_string(args, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 				switch_stream_handle_t stream = { 0 };
 				SWITCH_STANDARD_STREAM(stream);
-				
+
 				stream.write_function(&stream, " argv = { ");
 				for (x = 0; x < argc; x++) {
-					stream.write_function(&stream, "'%s'%s", argv[x], x == argc-1 ? "" : ", ");
+					stream.write_function(&stream, "'%s'%s", argv[x], x == argc - 1 ? "" : ", ");
 				}
 				stream.write_function(&stream, " };");
-				code = (char *)stream.data;
+				code = (char *) stream.data;
 			} else {
 				code = switch_mprintf("argv = {};");
 			}
@@ -154,7 +156,7 @@
 		}
 		if (!error) {
 			char *file = input_code, *fdup = NULL;
-			
+
 			if (!switch_is_file_path(file)) {
 				fdup = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.script_dir, file);
 				switch_assert(fdup);
@@ -170,7 +172,7 @@
 		if (!switch_strlen_zero(err)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
 		}
-		lua_pop(L, 1);	/* pop error message from the stack */
+		lua_pop(L, 1);			/* pop error message from the stack */
 	}
 
 	return error;
@@ -179,10 +181,10 @@
 static void *SWITCH_THREAD_FUNC lua_thread_run(switch_thread_t *thread, void *obj)
 {
 	char *input_code = (char *) obj;
-	lua_State *L = lua_init();	 /* opens Lua */
+	lua_State *L = lua_init();	/* opens Lua */
 
 	lua_parse_and_execute(L, input_code);
-	
+
 	if (input_code) {
 		free(input_code);
 	}
@@ -193,12 +195,8 @@
 }
 
 
-static switch_xml_t lua_fetch(const char *section, 
-							  const char *tag_name, 
-							  const char *key_name, 
-							  const char *key_value, 
-							  switch_event_t *params,
-							  void *user_data)
+static switch_xml_t lua_fetch(const char *section,
+							  const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
 {
 
 	switch_xml_t xml = NULL;
@@ -238,11 +236,11 @@
 		if (str) {
 			if (switch_strlen_zero(str)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
-			} else if (!(xml = switch_xml_parse_str((char *)str, strlen(str)))) {
+			} else if (!(xml = switch_xml_parse_str((char *) str, strlen(str)))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
 			}
 		}
-		
+
 		lua_uninit(L);
 		free(mycmd);
 	}
@@ -304,13 +302,13 @@
 
 	if (switch_strlen_zero(data)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no args specified!\n");
-        return;
-    }
+		return;
+	}
 
 	snprintf(code, sizeof(code), "~session = freeswitch.Session(\"%s\");", switch_core_session_get_uuid(session));
 	error = lua_parse_and_execute(L, code);
 
-	mycmd = strdup((char *)data);
+	mycmd = strdup((char *) data);
 	switch_assert(mycmd);
 
 	lua_parse_and_execute(L, mycmd);
@@ -319,8 +317,9 @@
 
 }
 
-SWITCH_STANDARD_API(luarun_api_function) {
-	
+SWITCH_STANDARD_API(luarun_api_function)
+{
+
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "-ERR no args specified!\n");
 	} else {
@@ -332,7 +331,8 @@
 }
 
 
-SWITCH_STANDARD_API(lua_api_function) {
+SWITCH_STANDARD_API(lua_api_function)
+{
 
 	lua_State *L = lua_init();
 	char *mycmd;
@@ -370,13 +370,13 @@
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-	
+
 	SWITCH_ADD_API(api_interface, "luarun", "run a script", luarun_api_function, "<script>");
 	SWITCH_ADD_API(api_interface, "lua", "run a script as an api function", lua_api_function, "<script>");
 	SWITCH_ADD_APP(app_interface, "lua", "Launch LUA ivr", "Run a lua ivr on a channel", lua_function, "<script>", SAF_SUPPORT_NOMEDIA);
 
 
-	
+
 	globals.pool = pool;
 	do_config();
 
@@ -385,7 +385,6 @@
 }
 
 SWITCH_END_EXTERN_C
-
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_extra.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_extra.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_extra.c	Tue May 27 00:54:52 2008
@@ -1,18 +1,15 @@
-SWITCH_BEGIN_EXTERN_C
-
-
-void mod_lua_conjure_event(lua_State *L, switch_event_t *event, const char *name, int destroy_me)
+SWITCH_BEGIN_EXTERN_C void mod_lua_conjure_event(lua_State * L, switch_event_t *event, const char *name, int destroy_me)
 {
 	Event *result = new Event(event);
-	SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event, destroy_me);
+	SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, destroy_me);
 	lua_setglobal(L, name);
 }
 
 
-void mod_lua_conjure_stream(lua_State *L, switch_stream_handle_t *stream, const char *name, int destroy_me)
+void mod_lua_conjure_stream(lua_State * L, switch_stream_handle_t *stream, const char *name, int destroy_me)
 {
 	Stream *result = new Stream(stream);
-	SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream, destroy_me);
+	SWIG_NewPointerObj(L, result, SWIGTYPE_p_Stream, destroy_me);
 	lua_setglobal(L, name);
 }
 

Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp	Tue May 27 00:54:52 2008
@@ -10,22 +10,35 @@
 
 
 #ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
-    T *tt;
-public:
-    SwigValueWrapper() : tt(0) { }
-    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
-    SwigValueWrapper(const T& t) : tt(new T(t)) { }
-    ~SwigValueWrapper() { delete tt; } 
-    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
-    operator T&() const { return *tt; }
-    T *operator&() { return tt; }
-private:
-    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+template < typename T > class SwigValueWrapper {
+	T *tt;
+  public:
+  SwigValueWrapper():tt(0) {
+	}
+  SwigValueWrapper(const SwigValueWrapper < T > &rhs):tt(new T(*rhs.tt)) {
+	}
+	SwigValueWrapper(const T & t):tt(new T(t)) {
+	}
+	~SwigValueWrapper() {
+		delete tt;
+	}
+	SwigValueWrapper & operator=(const T & t) {
+		delete tt;
+		tt = new T(t);
+		return *this;
+	}
+	operator  T & () const {
+		return *tt;
+	} T *operator&() {
+		return tt;
+	}
+  private:
+	SwigValueWrapper & operator=(const SwigValueWrapper < T > &rhs);
 };
 
-template <typename T> T SwigValueInit() {
-  return T();
+template < typename T > T SwigValueInit()
+{
+	return T();
 }
 #endif
 
@@ -60,14 +73,14 @@
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
@@ -75,7 +88,7 @@
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -118,7 +131,7 @@
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -262,10 +275,10 @@
 
 
  */
-#define SWIG_OK                    (0) 
+#define SWIG_OK                    (0)
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -292,16 +305,18 @@
 #  ifndef SWIG_TypeRank
 #    define SWIG_TypeRank             unsigned long
 #  endif
-#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#  ifndef SWIG_MAXCASTRANK		/* Default cast allowed */
 #    define SWIG_MAXCASTRANK          (2)
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
-  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+SWIGINTERNINLINE int SWIG_AddCast(int r)
+{
+	return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+SWIGINTERNINLINE int SWIG_CheckState(int r)
+{
+	return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
 }
 #else /* no cast-rank mode */
 #  define SWIG_AddCast
@@ -317,38 +332,38 @@
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *, int *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
+	typedef void *(*swig_converter_func) (void *, int *);
+	typedef struct swig_type_info *(*swig_dycast_func) (void **);
 
 /* Structure to store information on one type */
-typedef struct swig_type_info {
-  const char             *name;			/* mangled name of this type */
-  const char             *str;			/* human readable name of this type */
-  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
-  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
-  void                   *clientdata;		/* language specific type data */
-  int                    owndata;		/* flag if the structure owns the clientdata */
-} swig_type_info;
+	typedef struct swig_type_info {
+		const char *name;		/* mangled name of this type */
+		const char *str;		/* human readable name of this type */
+		swig_dycast_func dcast;	/* dynamic cast function down a hierarchy */
+		struct swig_cast_info *cast;	/* linked list of types that can cast into this type */
+		void *clientdata;		/* language specific type data */
+		int owndata;			/* flag if the structure owns the clientdata */
+	} swig_type_info;
 
 /* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
-  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
-  swig_converter_func     converter;		/* function to cast the void pointers */
-  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
-  struct swig_cast_info  *prev;			/* pointer to the previous cast */
-} swig_cast_info;
+	typedef struct swig_cast_info {
+		swig_type_info *type;	/* pointer to type that is equivalent to this type */
+		swig_converter_func converter;	/* function to cast the void pointers */
+		struct swig_cast_info *next;	/* pointer to next cast in linked list */
+		struct swig_cast_info *prev;	/* pointer to the previous cast */
+	} swig_cast_info;
 
 /* Structure used to store module information
  * Each module generates one structure like this, and the runtime collects
  * all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
-  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
-  size_t                 size;		        /* Number of types in this module */
-  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
-  swig_type_info         **type_initial;	/* Array of initially generated type structures */
-  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
-  void                    *clientdata;		/* Language specific module data */
-} swig_module_info;
+	typedef struct swig_module_info {
+		swig_type_info **types;	/* Array of pointers to swig_type_info structures that are in this module */
+		size_t size;			/* Number of types in this module */
+		struct swig_module_info *next;	/* Pointer to next element in circularly linked list */
+		swig_type_info **type_initial;	/* Array of initially generated type structures */
+		swig_cast_info **cast_initial;	/* Array of initially generated casting structures */
+		void *clientdata;		/* Language specific module data */
+	} swig_module_info;
 
 /* 
   Compare two type names skipping the space characters, therefore
@@ -357,54 +372,56 @@
   Return 0 when the two name types are equivalent, as in
   strncmp, but skipping ' '.
 */
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
-		  const char *f2, const char *l2) {
-  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
-    while ((*f1 == ' ') && (f1 != l1)) ++f1;
-    while ((*f2 == ' ') && (f2 != l2)) ++f2;
-    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
-  }
-  return (int)((l1 - f1) - (l2 - f2));
-}
+	SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) {
+		for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
+			while ((*f1 == ' ') && (f1 != l1))
+				++f1;
+			while ((*f2 == ' ') && (f2 != l2))
+				++f2;
+			if (*f1 != *f2)
+				return (*f1 > *f2) ? 1 : -1;
+		} return (int) ((l1 - f1) - (l2 - f2));
+	}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if not equal, 1 if equal
 */
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
+	SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) {
+		int equiv = 0;
+		const char *te = tb + strlen(tb);
+		const char *ne = nb;
+		while (!equiv && *ne) {
+			for (nb = ne; *ne; ++ne) {
+				if (*ne == '|')
+					break;
+			}
+			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+			if (*ne)
+				++ne;
+		}
+		return equiv;
+	}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
+	SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) {
+		int equiv = 0;
+		const char *te = tb + strlen(tb);
+		const char *ne = nb;
+		while (!equiv && *ne) {
+			for (nb = ne; *ne; ++ne) {
+				if (*ne == '|')
+					break;
+			}
+			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+			if (*ne)
+				++ne;
+		}
+		return equiv;
+	}
 
 
 /* think of this as a c++ template<> or a scheme macro */
@@ -432,94 +449,89 @@
 /*
   Check the typename
 */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
+	SWIGRUNTIME swig_cast_info *SWIG_TypeCheck(const char *c, swig_type_info * ty) {
+		SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+	}
 
 /* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
-  SWIG_TypeCheck_Template(iter->type == from, into);
-}
+	SWIGRUNTIME swig_cast_info *SWIG_TypeCheckStruct(swig_type_info * from, swig_type_info * into) {
+		SWIG_TypeCheck_Template(iter->type == from, into);
+	}
 
 /*
   Cast a pointer up an inheritance hierarchy
 */
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
-}
+	SWIGRUNTIMEINLINE void *SWIG_TypeCast(swig_cast_info * ty, void *ptr, int *newmemory) {
+		return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter) (ptr, newmemory);
+	}
 
 /* 
    Dynamic pointer casting. Down an inheritance hierarchy
 */
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
-  swig_type_info *lastty = ty;
-  if (!ty || !ty->dcast) return ty;
-  while (ty && (ty->dcast)) {
-    ty = (*ty->dcast)(ptr);
-    if (ty) lastty = ty;
-  }
-  return lastty;
-}
+	SWIGRUNTIME swig_type_info *SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
+		swig_type_info *lastty = ty;
+		if (!ty || !ty->dcast)
+			return ty;
+		while (ty && (ty->dcast)) {
+			ty = (*ty->dcast) (ptr);
+			if (ty)
+				lastty = ty;
+		}
+		return lastty;
+	}
 
 /*
   Return the name associated with this type
 */
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
-  return ty->name;
-}
+	SWIGRUNTIMEINLINE const char *SWIG_TypeName(const swig_type_info * ty) {
+		return ty->name;
+	}
 
 /*
   Return the pretty name associated with this type,
   that is an unmangled type name in a form presentable to the user.
 */
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
-  /* The "str" field contains the equivalent pretty names of the
-     type, separated by vertical-bar characters.  We choose
-     to print the last name, as it is often (?) the most
-     specific. */
-  if (!type) return NULL;
-  if (type->str != NULL) {
-    const char *last_name = type->str;
-    const char *s;
-    for (s = type->str; *s; s++)
-      if (*s == '|') last_name = s+1;
-    return last_name;
-  }
-  else
-    return type->name;
-}
+	SWIGRUNTIME const char *SWIG_TypePrettyName(const swig_type_info * type) {
+		/* The "str" field contains the equivalent pretty names of the
+		   type, separated by vertical-bar characters.  We choose
+		   to print the last name, as it is often (?) the most
+		   specific. */
+		if (!type)
+			return NULL;
+		if (type->str != NULL) {
+			const char *last_name = type->str;
+			const char *s;
+			for (s = type->str; *s; s++)
+				if (*s == '|')
+					last_name = s + 1;
+			return last_name;
+		} else
+			return type->name;
+	}
 
 /* 
    Set the clientdata field for a type
 */
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
-  swig_cast_info *cast = ti->cast;
-  /* if (ti->clientdata == clientdata) return; */
-  ti->clientdata = clientdata;
-  
-  while (cast) {
-    if (!cast->converter) {
-      swig_type_info *tc = cast->type;
-      if (!tc->clientdata) {
-	SWIG_TypeClientData(tc, clientdata);
-      }
-    }    
-    cast = cast->next;
-  }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
-  SWIG_TypeClientData(ti, clientdata);
-  ti->owndata = 1;
-}
-  
+	SWIGRUNTIME void SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
+		swig_cast_info *cast = ti->cast;
+		/* if (ti->clientdata == clientdata) return; */
+		ti->clientdata = clientdata;
+
+		while (cast) {
+			if (!cast->converter) {
+				swig_type_info *tc = cast->type;
+				if (!tc->clientdata) {
+					SWIG_TypeClientData(tc, clientdata);
+				}
+			}
+			cast = cast->next;
+		}
+	}
+	SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info * ti, void *clientdata) {
+		SWIG_TypeClientData(ti, clientdata);
+		ti->owndata = 1;
+	}
+
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
@@ -528,41 +540,38 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
-		            const char *name) {
-  swig_module_info *iter = start;
-  do {
-    if (iter->size) {
-      register size_t l = 0;
-      register size_t r = iter->size - 1;
-      do {
-	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-	register size_t i = (l + r) >> 1; 
-	const char *iname = iter->types[i]->name;
-	if (iname) {
-	  register int compare = strcmp(name, iname);
-	  if (compare == 0) {	    
-	    return iter->types[i];
-	  } else if (compare < 0) {
-	    if (i) {
-	      r = i - 1;
-	    } else {
-	      break;
-	    }
-	  } else if (compare > 0) {
-	    l = i + 1;
-	  }
-	} else {
-	  break; /* should never happen */
+	SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+		swig_module_info *iter = start;
+		do {
+			if (iter->size) {
+				register size_t l = 0;
+				register size_t r = iter->size - 1;
+				do {
+					/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+					register size_t i = (l + r) >> 1;
+					const char *iname = iter->types[i]->name;
+					if (iname) {
+						register int compare = strcmp(name, iname);
+						if (compare == 0) {
+							return iter->types[i];
+						} else if (compare < 0) {
+							if (i) {
+								r = i - 1;
+							} else {
+								break;
+							}
+						} else if (compare > 0) {
+							l = i + 1;
+						}
+					} else {
+						break;	/* should never happen */
+					}
+				} while (l <= r);
+			}
+			iter = iter->next;
+		} while (iter != end);
+		return 0;
 	}
-      } while (l <= r);
-    }
-    iter = iter->next;
-  } while (iter != end);
-  return 0;
-}
 
 /*
   Search for a swig_type_info structure for either a mangled name or a human readable name.
@@ -573,130 +582,124 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
-		     const char *name) {
-  /* STEP 1: Search the name field using binary search */
-  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
-  if (ret) {
-    return ret;
-  } else {
-    /* STEP 2: If the type hasn't been found, do a complete search
-       of the str field (the human readable name) */
-    swig_module_info *iter = start;
-    do {
-      register size_t i = 0;
-      for (; i < iter->size; ++i) {
-	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
-	  return iter->types[i];
-      }
-      iter = iter->next;
-    } while (iter != end);
-  }
-  
-  /* neither found a match */
-  return 0;
-}
+	SWIGRUNTIME swig_type_info *SWIG_TypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+		/* STEP 1: Search the name field using binary search */
+		swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+		if (ret) {
+			return ret;
+		} else {
+			/* STEP 2: If the type hasn't been found, do a complete search
+			   of the str field (the human readable name) */
+			swig_module_info *iter = start;
+			do {
+				register size_t i = 0;
+				for (; i < iter->size; ++i) {
+					if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+						return iter->types[i];
+				}
+				iter = iter->next;
+			} while (iter != end);
+		}
+
+		/* neither found a match */
+		return 0;
+	}
 
 /* 
    Pack binary data into a string
 */
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
-  static const char hex[17] = "0123456789abcdef";
-  register const unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu =  u + sz;
-  for (; u != eu; ++u) {
-    register unsigned char uu = *u;
-    *(c++) = hex[(uu & 0xf0) >> 4];
-    *(c++) = hex[uu & 0xf];
-  }
-  return c;
-}
+	SWIGRUNTIME char *SWIG_PackData(char *c, void *ptr, size_t sz) {
+		static const char hex[17] = "0123456789abcdef";
+		register const unsigned char *u = (unsigned char *) ptr;
+		register const unsigned char *eu = u + sz;
+		for (; u != eu; ++u) {
+			register unsigned char uu = *u;
+			*(c++) = hex[(uu & 0xf0) >> 4];
+			*(c++) = hex[uu & 0xf];
+		}
+		return c;
+	}
 
 /* 
    Unpack binary data from a string
 */
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
-  register unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu = u + sz;
-  for (; u != eu; ++u) {
-    register char d = *(c++);
-    register unsigned char uu;
-    if ((d >= '0') && (d <= '9'))
-      uu = ((d - '0') << 4);
-    else if ((d >= 'a') && (d <= 'f'))
-      uu = ((d - ('a'-10)) << 4);
-    else 
-      return (char *) 0;
-    d = *(c++);
-    if ((d >= '0') && (d <= '9'))
-      uu |= (d - '0');
-    else if ((d >= 'a') && (d <= 'f'))
-      uu |= (d - ('a'-10));
-    else 
-      return (char *) 0;
-    *u = uu;
-  }
-  return c;
-}
+	SWIGRUNTIME const char *SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+		register unsigned char *u = (unsigned char *) ptr;
+		register const unsigned char *eu = u + sz;
+		for (; u != eu; ++u) {
+			register char d = *(c++);
+			register unsigned char uu;
+			if ((d >= '0') && (d <= '9'))
+				uu = ((d - '0') << 4);
+			else if ((d >= 'a') && (d <= 'f'))
+				uu = ((d - ('a' - 10)) << 4);
+			else
+				return (char *) 0;
+			d = *(c++);
+			if ((d >= '0') && (d <= '9'))
+				uu |= (d - '0');
+			else if ((d >= 'a') && (d <= 'f'))
+				uu |= (d - ('a' - 10));
+			else
+				return (char *) 0;
+			*u = uu;
+		}
+		return c;
+	}
 
 /* 
    Pack 'void *' into a string buffer.
 */
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
-  char *r = buff;
-  if ((2*sizeof(void *) + 2) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,&ptr,sizeof(void *));
-  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
-  strcpy(r,name);
-  return buff;
-}
+	SWIGRUNTIME char *SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+		char *r = buff;
+		if ((2 * sizeof(void *) + 2) > bsz)
+			return 0;
+		*(r++) = '_';
+		r = SWIG_PackData(r, &ptr, sizeof(void *));
+		if (strlen(name) + 1 > (bsz - (r - buff)))
+			return 0;
+		strcpy(r, name);
+		return buff;
+	}
 
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      *ptr = (void *) 0;
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
+	SWIGRUNTIME const char *SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+		if (*c != '_') {
+			if (strcmp(c, "NULL") == 0) {
+				*ptr = (void *) 0;
+				return name;
+			} else {
+				return 0;
+			}
+		}
+		return SWIG_UnpackData(++c, ptr, sizeof(void *));
+	}
 
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
-  char *r = buff;
-  size_t lname = (name ? strlen(name) : 0);
-  if ((2*sz + 2 + lname) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,ptr,sz);
-  if (lname) {
-    strncpy(r,name,lname+1);
-  } else {
-    *r = 0;
-  }
-  return buff;
-}
+	SWIGRUNTIME char *SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+		char *r = buff;
+		size_t lname = (name ? strlen(name) : 0);
+		if ((2 * sz + 2 + lname) > bsz)
+			return 0;
+		*(r++) = '_';
+		r = SWIG_PackData(r, ptr, sz);
+		if (lname) {
+			strncpy(r, name, lname + 1);
+		} else {
+			*r = 0;
+		}
+		return buff;
+	}
 
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      memset(ptr,0,sz);
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sz);
-}
+	SWIGRUNTIME const char *SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+		if (*c != '_') {
+			if (strcmp(c, "NULL") == 0) {
+				memset(ptr, 0, sz);
+				return name;
+			} else {
+				return 0;
+			}
+		}
+		return SWIG_UnpackData(++c, ptr, sz);
+	}
 
 #ifdef __cplusplus
 }
@@ -719,8 +722,8 @@
 
 #include "lua.h"
 #include "lauxlib.h"
-#include <stdlib.h>  /* for malloc */
-#include <assert.h>  /* for a few sanity tests */
+#include <stdlib.h>				/* for malloc */
+#include <assert.h>				/* for a few sanity tests */
 
 /* -----------------------------------------------------------------------------
  * global swig types
@@ -734,62 +737,62 @@
 #define SWIG_LUA_CHAR    6
 
 /* Structure for variable linking table */
-typedef struct {
-  const char *name;
-  lua_CFunction get;
-  lua_CFunction set;
-} swig_lua_var_info;
+	typedef struct {
+		const char *name;
+		lua_CFunction get;
+		lua_CFunction set;
+	} swig_lua_var_info;
 
 /* Constant information structure */
-typedef struct {
-    int type;
-    char *name;
-    long lvalue;
-    double dvalue;
-    void   *pvalue;
-    swig_type_info **ptype;
-} swig_lua_const_info;
-
-typedef struct {
-  const char     *name;
-  lua_CFunction   method;
-} swig_lua_method;
-
-typedef struct {
-  const char     *name;
-  lua_CFunction   getmethod;
-  lua_CFunction   setmethod;
-} swig_lua_attribute;
-
-typedef struct swig_lua_class {
-  const char    *name;
-  swig_type_info   **type;
-  lua_CFunction  constructor;
-  void    (*destructor)(void *);
-  swig_lua_method   *methods;
-  swig_lua_attribute     *attributes;
-  struct swig_lua_class **bases;
-  const char **base_names;
-} swig_lua_class;
+	typedef struct {
+		int type;
+		char *name;
+		long lvalue;
+		double dvalue;
+		void *pvalue;
+		swig_type_info **ptype;
+	} swig_lua_const_info;
+
+	typedef struct {
+		const char *name;
+		lua_CFunction method;
+	} swig_lua_method;
+
+	typedef struct {
+		const char *name;
+		lua_CFunction getmethod;
+		lua_CFunction setmethod;
+	} swig_lua_attribute;
+
+	typedef struct swig_lua_class {
+		const char *name;
+		swig_type_info **type;
+		lua_CFunction constructor;
+		void (*destructor) (void *);
+		swig_lua_method *methods;
+		swig_lua_attribute *attributes;
+		struct swig_lua_class **bases;
+		const char **base_names;
+	} swig_lua_class;
 
 /* this is the struct for wrappering all pointers in SwigLua
 */
-typedef struct {
-  swig_type_info   *type;
-  int     own;  /* 1 if owned & must be destroyed */
-  void        *ptr;
-} swig_lua_userdata;
+	typedef struct {
+		swig_type_info *type;
+		int own;				/* 1 if owned & must be destroyed */
+		void *ptr;
+	} swig_lua_userdata;
 
 /* this is the struct for wrapping arbitary packed binary data
 (currently it is only used for member function pointers)
 the data ordering is similar to swig_lua_userdata, but it is currently not possible
 to tell the two structures apart within Swig, other than by looking at the type
 */
-typedef struct {
-  swig_type_info   *type;
-  int     own;  /* 1 if owned & must be destroyed */
-  char data[1];       /* arbitary amount of data */    
-} swig_lua_rawdata;
+	typedef struct {
+		swig_type_info *type;
+		int own;				/* 1 if owned & must be destroyed */
+		char data[1];			/* arbitary amount of data */
+	} swig_lua_rawdata;
 
 /* Common SWIG API */
 #define SWIG_NewPointerObj(L, ptr, type, owner)       SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
@@ -840,24 +843,20 @@
 #endif
 
 /* storing/access of swig_module_info */
-SWIGRUNTIME swig_module_info *
-SWIG_Lua_GetModule(lua_State* L) {
-  swig_module_info *ret = 0;
-  lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
-  lua_rawget(L,LUA_REGISTRYINDEX);
-  if (lua_islightuserdata(L,-1))
-    ret=(swig_module_info*)lua_touserdata(L,-1);
-  lua_pop(L,1);  /* tidy */
-  return ret;
-}
-
-SWIGRUNTIME void
-SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) {
-  /* add this all into the Lua registry: */
-  lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
-  lua_pushlightuserdata(L,(void*)module);
-  lua_rawset(L,LUA_REGISTRYINDEX);
-}
+	SWIGRUNTIME swig_module_info *SWIG_Lua_GetModule(lua_State * L) {
+		swig_module_info *ret = 0;
+		                 lua_pushstring(L, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+		                 lua_rawget(L, LUA_REGISTRYINDEX);
+		if               (lua_islightuserdata(L, -1))
+			                 ret = (swig_module_info *) lua_touserdata(L, -1);
+		                 lua_pop(L, 1);	/* tidy */
+		                 return ret;
+	} SWIGRUNTIME void SWIG_Lua_SetModule(lua_State * L, swig_module_info * module) {
+		/* add this all into the Lua registry: */
+		lua_pushstring(L, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+		lua_pushlightuserdata(L, (void *) module);
+		lua_rawset(L, LUA_REGISTRYINDEX);
+	}
 
 /* -----------------------------------------------------------------------------
  * global variable support code: modules
@@ -866,20 +865,18 @@
 /* this function is called when trying to set an immutable.
 default value is to print an error.
 This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
-SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L)
-{
+	SWIGINTERN int SWIG_Lua_set_immutable(lua_State * L) {
 /*  there should be 1 param passed in: the new value */
 #ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
-  lua_pop(L,1);  /* remove it */
-  lua_pushstring(L,"This variable is immutable");
-  lua_error(L);
+		lua_pop(L, 1);			/* remove it */
+		lua_pushstring(L, "This variable is immutable");
+		lua_error(L);
 #endif
-    return 0;   /* should not return anything */
-}
+		return 0;				/* should not return anything */
+	}
 
 /* the module.get method used for getting linked data */
-SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
-{
+	SWIGINTERN int SWIG_Lua_module_get(lua_State * L) {
 /*  there should be 2 params passed in
   (1) table (not the meta table)
   (2) string name of the attribute
@@ -887,173 +884,158 @@
    lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
    lua_tostring(L,2));
 */
-  /* get the metatable */
-  assert(lua_istable(L,1));  /* just in case */
-  lua_getmetatable(L,1);  /* get the metatable */
-  assert(lua_istable(L,-1));  /* just in case */
-  SWIG_Lua_get_table(L,".get");  /* get the .get table */
-  lua_remove(L,3);  /* remove metatable */
-  if (lua_istable(L,-1))
-  {
-    /* look for the key in the .get table */
-    lua_pushvalue(L,2);  /* key */
-    lua_rawget(L,-2);
-    lua_remove(L,3);  /* remove .get */
-    if (lua_iscfunction(L,-1))
-    {  /* found it so call the fn & return its value */
-      lua_call(L,0,1);
-      return 1;
-    }
-    lua_pop(L,1);  /* remove the top */
-  }
-  lua_pop(L,1);  /* remove the .get */
-  lua_pushnil(L);  /* return a nil */
-    return 1;
-}
+		/* get the metatable */
+		assert(lua_istable(L, 1));	/* just in case */
+		lua_getmetatable(L, 1);	/* get the metatable */
+		assert(lua_istable(L, -1));	/* just in case */
+		SWIG_Lua_get_table(L, ".get");	/* get the .get table */
+		lua_remove(L, 3);		/* remove metatable */
+		if (lua_istable(L, -1)) {
+			/* look for the key in the .get table */
+			lua_pushvalue(L, 2);	/* key */
+			lua_rawget(L, -2);
+			lua_remove(L, 3);	/* remove .get */
+			if (lua_iscfunction(L, -1)) {	/* found it so call the fn & return its value */
+				lua_call(L, 0, 1);
+				return 1;
+			}
+			lua_pop(L, 1);		/* remove the top */
+		}
+		lua_pop(L, 1);			/* remove the .get */
+		lua_pushnil(L);			/* return a nil */
+		return 1;
+	}
 
 /* the module.set method used for setting linked data */
-SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
-{
+	SWIGINTERN int SWIG_Lua_module_set(lua_State * L) {
 /*  there should be 3 params passed in
   (1) table (not the meta table)
   (2) string name of the attribute
   (3) any for the new value
 */
-  /* get the metatable */
-  assert(lua_istable(L,1));  /* just in case */
-  lua_getmetatable(L,1);  /* get the metatable */
-  assert(lua_istable(L,-1));  /* just in case */
-  SWIG_Lua_get_table(L,".set");  /* get the .set table */
-  lua_remove(L,4);  /* remove metatable */
-  if (lua_istable(L,-1))
-  {
-    /* look for the key in the .set table */
-    lua_pushvalue(L,2);  /* key */
-    lua_rawget(L,-2);
-    lua_remove(L,4);  /* remove .set */
-    if (lua_iscfunction(L,-1))
-    {  /* found it so call the fn & return its value */
-      lua_pushvalue(L,3);  /* value */
-      lua_call(L,1,0);
-      return 0;
-    }
-  }
-  lua_settop(L,3);  /* reset back to start */
-  /* we now have the table, key & new value, so just set directly */
-  lua_rawset(L,1);  /* add direct */
-  return 0;
-}
+		/* get the metatable */
+		assert(lua_istable(L, 1));	/* just in case */
+		lua_getmetatable(L, 1);	/* get the metatable */
+		assert(lua_istable(L, -1));	/* just in case */
+		SWIG_Lua_get_table(L, ".set");	/* get the .set table */
+		lua_remove(L, 4);		/* remove metatable */
+		if (lua_istable(L, -1)) {
+			/* look for the key in the .set table */
+			lua_pushvalue(L, 2);	/* key */
+			lua_rawget(L, -2);
+			lua_remove(L, 4);	/* remove .set */
+			if (lua_iscfunction(L, -1)) {	/* found it so call the fn & return its value */
+				lua_pushvalue(L, 3);	/* value */
+				lua_call(L, 1, 0);
+				return 0;
+			}
+		}
+		lua_settop(L, 3);		/* reset back to start */
+		/* we now have the table, key & new value, so just set directly */
+		lua_rawset(L, 1);		/* add direct */
+		return 0;
+	}
 
 /* registering a module in lua */
-SWIGINTERN void  SWIG_Lua_module_begin(lua_State* L,const char* name)
-{
-  assert(lua_istable(L,-1));  /* just in case */
-  lua_pushstring(L,name);
-  lua_newtable(L);   /* the table */
-  /* add meta table */
-  lua_newtable(L);    /* the meta table */
-  SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get);
-  SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set);
-  lua_pushstring(L,".get");
-  lua_newtable(L);    /* the .get table */
-  lua_rawset(L,-3);  /* add .get into metatable */
-  lua_pushstring(L,".set");
-  lua_newtable(L);    /* the .set table */
-  lua_rawset(L,-3);  /* add .set into metatable */
-  lua_setmetatable(L,-2);  /* sets meta table in module */
-  lua_rawset(L,-3);        /* add module into parent */
-  SWIG_Lua_get_table(L,name);   /* get the table back out */
-}
+	SWIGINTERN void SWIG_Lua_module_begin(lua_State * L, const char *name) {
+		assert(lua_istable(L, -1));	/* just in case */
+		lua_pushstring(L, name);
+		lua_newtable(L);		/* the table */
+		/* add meta table */
+		lua_newtable(L);		/* the meta table */
+		SWIG_Lua_add_function(L, "__index", SWIG_Lua_module_get);
+		SWIG_Lua_add_function(L, "__newindex", SWIG_Lua_module_set);
+		lua_pushstring(L, ".get");
+		lua_newtable(L);		/* the .get table */
+		lua_rawset(L, -3);		/* add .get into metatable */
+		lua_pushstring(L, ".set");
+		lua_newtable(L);		/* the .set table */
+		lua_rawset(L, -3);		/* add .set into metatable */
+		lua_setmetatable(L, -2);	/* sets meta table in module */
+		lua_rawset(L, -3);		/* add module into parent */
+		SWIG_Lua_get_table(L, name);	/* get the table back out */
+	}
 
 /* ending the register */
-SWIGINTERN void  SWIG_Lua_module_end(lua_State* L)
-{
-  lua_pop(L,1);       /* tidy stack (remove module) */
-}
+	SWIGINTERN void SWIG_Lua_module_end(lua_State * L) {
+		lua_pop(L, 1);			/* tidy stack (remove module) */
+	}
 
 /* adding a linked variable to the module */
-SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
-{
-  assert(lua_istable(L,-1));  /* just in case */
-  lua_getmetatable(L,-1);  /* get the metatable */
-  assert(lua_istable(L,-1));  /* just in case */
-  SWIG_Lua_get_table(L,".get"); /* find the .get table */
-  assert(lua_istable(L,-1));  /* should be a table: */
-  SWIG_Lua_add_function(L,name,getFn);
-  lua_pop(L,1);       /* tidy stack (remove table) */
-  if (setFn)  /* if there is a set fn */
-  {
-    SWIG_Lua_get_table(L,".set"); /* find the .set table */
-    assert(lua_istable(L,-1));  /* should be a table: */
-    SWIG_Lua_add_function(L,name,setFn);
-    lua_pop(L,1);       /* tidy stack (remove table) */
-  }
-  lua_pop(L,1);       /* tidy stack (remove meta) */
-}
+	SWIGINTERN void SWIG_Lua_module_add_variable(lua_State * L, const char *name, lua_CFunction getFn, lua_CFunction setFn) {
+		assert(lua_istable(L, -1));	/* just in case */
+		lua_getmetatable(L, -1);	/* get the metatable */
+		assert(lua_istable(L, -1));	/* just in case */
+		SWIG_Lua_get_table(L, ".get");	/* find the .get table */
+		assert(lua_istable(L, -1));	/* should be a table: */
+		SWIG_Lua_add_function(L, name, getFn);
+		lua_pop(L, 1);			/* tidy stack (remove table) */
+		if (setFn) {			/* if there is a set fn */
+			SWIG_Lua_get_table(L, ".set");	/* find the .set table */
+			assert(lua_istable(L, -1));	/* should be a table: */
+			SWIG_Lua_add_function(L, name, setFn);
+			lua_pop(L, 1);		/* tidy stack (remove table) */
+		}
+		lua_pop(L, 1);			/* tidy stack (remove meta) */
+	}
 
 /* adding a function module */
-SWIGINTERN void  SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn)
-{
-  SWIG_Lua_add_function(L,name,fn);
-}
+	SWIGINTERN void SWIG_Lua_module_add_function(lua_State * L, const char *name, lua_CFunction fn) {
+		SWIG_Lua_add_function(L, name, fn);
+	}
 
 /* -----------------------------------------------------------------------------
  * global variable support code: classes
  * ----------------------------------------------------------------------------- */
 
 /* the class.get method, performs the lookup of class attributes */
-SWIGINTERN int  SWIG_Lua_class_get(lua_State* L)
-{
+	SWIGINTERN int SWIG_Lua_class_get(lua_State * L) {
 /*  there should be 2 params passed in
   (1) userdata (not the meta table)
   (2) string name of the attribute
 */
-  assert(lua_isuserdata(L,-2));  /* just in case */
-  lua_getmetatable(L,-2);    /* get the meta table */
-  assert(lua_istable(L,-1));  /* just in case */
-  SWIG_Lua_get_table(L,".get"); /* find the .get table */
-  assert(lua_istable(L,-1));  /* just in case */
-  /* look for the key in the .get table */
-  lua_pushvalue(L,2);  /* key */
-  lua_rawget(L,-2);
-  lua_remove(L,-2); /* stack tidy, remove .get table */
-  if (lua_iscfunction(L,-1))
-  {  /* found it so call the fn & return its value */
-    lua_pushvalue(L,1);  /* the userdata */
-    lua_call(L,1,1);  /* 1 value in (userdata),1 out (result) */
-    lua_remove(L,-2); /* stack tidy, remove metatable */
-    return 1;
-  }
-  lua_pop(L,1);  /* remove whatever was there */
-  /* ok, so try the .fn table */
-  SWIG_Lua_get_table(L,".fn"); /* find the .get table */
-  assert(lua_istable(L,-1));  /* just in case */
-  lua_pushvalue(L,2);  /* key */
-  lua_rawget(L,-2);  /* look for the fn */
-  lua_remove(L,-2); /* stack tidy, remove .fn table */
-  if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
-  {  /* found it so return the fn & let lua call it */
-    lua_remove(L,-2); /* stack tidy, remove metatable */
-    return 1;
-  }
-  lua_pop(L,1);  /* remove whatever was there */
-  /* NEW: looks for the __getitem() fn
-  this is a user provided get fn */
-  SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
-  if (lua_iscfunction(L,-1))  /* if its there */
-  {  /* found it so call the fn & return its value */
-    lua_pushvalue(L,1);  /* the userdata */
-    lua_pushvalue(L,2);  /* the parameter */
-    lua_call(L,2,1);  /* 2 value in (userdata),1 out (result) */
-    lua_remove(L,-2); /* stack tidy, remove metatable */
-    return 1;
-  }
-  return 0;  /* sorry not known */
-}
+		assert(lua_isuserdata(L, -2));	/* just in case */
+		lua_getmetatable(L, -2);	/* get the meta table */
+		assert(lua_istable(L, -1));	/* just in case */
+		SWIG_Lua_get_table(L, ".get");	/* find the .get table */
+		assert(lua_istable(L, -1));	/* just in case */
+		/* look for the key in the .get table */
+		lua_pushvalue(L, 2);	/* key */
+		lua_rawget(L, -2);
+		lua_remove(L, -2);		/* stack tidy, remove .get table */
+		if (lua_iscfunction(L, -1)) {	/* found it so call the fn & return its value */
+			lua_pushvalue(L, 1);	/* the userdata */
+			lua_call(L, 1, 1);	/* 1 value in (userdata),1 out (result) */
+			lua_remove(L, -2);	/* stack tidy, remove metatable */
+			return 1;
+		}
+		lua_pop(L, 1);			/* remove whatever was there */
+		/* ok, so try the .fn table */
+		SWIG_Lua_get_table(L, ".fn");	/* find the .get table */
+		assert(lua_istable(L, -1));	/* just in case */
+		lua_pushvalue(L, 2);	/* key */
+		lua_rawget(L, -2);		/* look for the fn */
+		lua_remove(L, -2);		/* stack tidy, remove .fn table */
+		if (lua_isfunction(L, -1)) {	/* note: if its a C function or lua function *//* found it so return the fn & let lua call it */
+			lua_remove(L, -2);	/* stack tidy, remove metatable */
+			return 1;
+		}
+		lua_pop(L, 1);			/* remove whatever was there */
+		/* NEW: looks for the __getitem() fn
+		   this is a user provided get fn */
+		SWIG_Lua_get_table(L, "__getitem");	/* find the __getitem fn */
+		if (lua_iscfunction(L, -1)) {	/* if its there *//* found it so call the fn & return its value */
+			lua_pushvalue(L, 1);	/* the userdata */
+			lua_pushvalue(L, 2);	/* the parameter */
+			lua_call(L, 2, 1);	/* 2 value in (userdata),1 out (result) */
+			lua_remove(L, -2);	/* stack tidy, remove metatable */
+			return 1;
+		}
+		return 0;				/* sorry not known */
+	}
 
 /* the class.set method, performs the lookup of class attributes */
-SWIGINTERN int  SWIG_Lua_class_set(lua_State* L)
-{
+	SWIGINTERN int SWIG_Lua_class_set(lua_State * L) {
 /*  there should be 3 params passed in
   (1) table (not the meta table)
   (2) string name of the attribute
@@ -1063,136 +1045,123 @@
       lua_tostring(L,2),
       lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/
 
-  assert(lua_isuserdata(L,1));  /* just in case */
-  lua_getmetatable(L,1);    /* get the meta table */
-  assert(lua_istable(L,-1));  /* just in case */
-
-  SWIG_Lua_get_table(L,".set"); /* find the .set table */
-  if (lua_istable(L,-1))
-  {
-    /* look for the key in the .set table */
-    lua_pushvalue(L,2);  /* key */
-    lua_rawget(L,-2);
-    if (lua_iscfunction(L,-1))
-    {  /* found it so call the fn & return its value */
-      lua_pushvalue(L,1);  /* userdata */
-      lua_pushvalue(L,3);  /* value */
-      lua_call(L,2,0);
-      return 0;
-    }
-    lua_pop(L,1);  /* remove the value */
-  }
-  lua_pop(L,1);  /* remove the value .set table */
-  /* NEW: looks for the __setitem() fn
-  this is a user provided set fn */
-  SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
-  if (lua_iscfunction(L,-1))  /* if its there */
-  {  /* found it so call the fn & return its value */
-    lua_pushvalue(L,1);  /* the userdata */
-    lua_pushvalue(L,2);  /* the parameter */
-    lua_pushvalue(L,3);  /* the value */
-    lua_call(L,3,0);  /* 3 values in ,0 out */
-    lua_remove(L,-2); /* stack tidy, remove metatable */
-    return 1;
-  }
-  return 0;
-}
+		assert(lua_isuserdata(L, 1));	/* just in case */
+		lua_getmetatable(L, 1);	/* get the meta table */
+		assert(lua_istable(L, -1));	/* just in case */
+
+		SWIG_Lua_get_table(L, ".set");	/* find the .set table */
+		if (lua_istable(L, -1)) {
+			/* look for the key in the .set table */
+			lua_pushvalue(L, 2);	/* key */
+			lua_rawget(L, -2);
+			if (lua_iscfunction(L, -1)) {	/* found it so call the fn & return its value */
+				lua_pushvalue(L, 1);	/* userdata */
+				lua_pushvalue(L, 3);	/* value */
+				lua_call(L, 2, 0);
+				return 0;
+			}
+			lua_pop(L, 1);		/* remove the value */
+		}
+		lua_pop(L, 1);			/* remove the value .set table */
+		/* NEW: looks for the __setitem() fn
+		   this is a user provided set fn */
+		SWIG_Lua_get_table(L, "__setitem");	/* find the fn */
+		if (lua_iscfunction(L, -1)) {	/* if its there *//* found it so call the fn & return its value */
+			lua_pushvalue(L, 1);	/* the userdata */
+			lua_pushvalue(L, 2);	/* the parameter */
+			lua_pushvalue(L, 3);	/* the value */
+			lua_call(L, 3, 0);	/* 3 values in ,0 out */
+			lua_remove(L, -2);	/* stack tidy, remove metatable */
+			return 1;
+		}
+		return 0;
+	}
 
 /* the class.destruct method called by the interpreter */
-SWIGINTERN int  SWIG_Lua_class_destruct(lua_State* L)
-{
+	SWIGINTERN int SWIG_Lua_class_destruct(lua_State * L) {
 /*  there should be 1 params passed in
   (1) userdata (not the meta table) */
-  swig_lua_userdata* usr;
-  swig_lua_class* clss;
-  assert(lua_isuserdata(L,-1));  /* just in case */
-  usr=(swig_lua_userdata*)lua_touserdata(L,-1);  /* get it */
-  /* if must be destroyed & has a destructor */
-  if (usr->own) /* if must be destroyed */
-  {
-    clss=(swig_lua_class*)usr->type->clientdata;  /* get the class */
-    if (clss && clss->destructor)  /* there is a destroy fn */
-    {
-      clss->destructor(usr->ptr);  /* bye bye */
-    }
-  }
-  return 0;
-}
+		swig_lua_userdata *usr;
+		swig_lua_class *clss;
+		assert(lua_isuserdata(L, -1));	/* just in case */
+		usr = (swig_lua_userdata *) lua_touserdata(L, -1);	/* get it */
+		/* if must be destroyed & has a destructor */
+		if (usr->own) {			/* if must be destroyed */
+			clss = (swig_lua_class *) usr->type->clientdata;	/* get the class */
+			if (clss && clss->destructor) {	/* there is a destroy fn */
+				clss->destructor(usr->ptr);	/* bye bye */
+			}
+		}
+		return 0;
+	}
 
 /* gets the swig class registry (or creates it) */
-SWIGINTERN void  SWIG_Lua_get_class_registry(lua_State* L)
-{
-  /* add this all into the swig registry: */
-  lua_pushstring(L,"SWIG");
-  lua_rawget(L,LUA_REGISTRYINDEX);  /* get the registry */
-  if (!lua_istable(L,-1))  /* not there */
-  {  /* must be first time, so add it */
-    lua_pop(L,1);  /* remove the result */
-    lua_pushstring(L,"SWIG");
-    lua_newtable(L);
-    lua_rawset(L,LUA_REGISTRYINDEX);
-    /* then get it */
-    lua_pushstring(L,"SWIG");
-    lua_rawget(L,LUA_REGISTRYINDEX);
-  }
-}
+	SWIGINTERN void SWIG_Lua_get_class_registry(lua_State * L) {
+		/* add this all into the swig registry: */
+		lua_pushstring(L, "SWIG");
+		lua_rawget(L, LUA_REGISTRYINDEX);	/* get the registry */
+		if (!lua_istable(L, -1)) {	/* not there *//* must be first time, so add it */
+			lua_pop(L, 1);		/* remove the result */
+			lua_pushstring(L, "SWIG");
+			lua_newtable(L);
+			lua_rawset(L, LUA_REGISTRYINDEX);
+			/* then get it */
+			lua_pushstring(L, "SWIG");
+			lua_rawget(L, LUA_REGISTRYINDEX);
+		}
+	}
 
 /* helper fn to get the classes metatable from the register */
-SWIGINTERN void  SWIG_Lua_get_class_metatable(lua_State* L,const char* cname)
-{
-  SWIG_Lua_get_class_registry(L);  /* get the registry */
-  lua_pushstring(L,cname);  /* get the name */
-  lua_rawget(L,-2);    /* get it */
-  lua_remove(L,-2);    /* tidy up (remove registry) */
-}
+	SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State * L, const char *cname) {
+		SWIG_Lua_get_class_registry(L);	/* get the registry */
+		lua_pushstring(L, cname);	/* get the name */
+		lua_rawget(L, -2);		/* get it */
+		lua_remove(L, -2);		/* tidy up (remove registry) */
+	}
 
 /* helper add a variable to a registered class */
-SWIGINTERN void  SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
-{
-  assert(lua_istable(L,-1));  /* just in case */
-  SWIG_Lua_get_table(L,".get"); /* find the .get table */
-  assert(lua_istable(L,-1));  /* just in case */
-  SWIG_Lua_add_function(L,name,getFn);
-  lua_pop(L,1);       /* tidy stack (remove table) */
-  if (setFn)
-  {
-    SWIG_Lua_get_table(L,".set"); /* find the .set table */
-    assert(lua_istable(L,-1));  /* just in case */
-    SWIG_Lua_add_function(L,name,setFn);
-    lua_pop(L,1);       /* tidy stack (remove table) */
-  }
-}
+	SWIGINTERN void SWIG_Lua_add_class_variable(lua_State * L, const char *name, lua_CFunction getFn, lua_CFunction setFn) {
+		assert(lua_istable(L, -1));	/* just in case */
+		SWIG_Lua_get_table(L, ".get");	/* find the .get table */
+		assert(lua_istable(L, -1));	/* just in case */
+		SWIG_Lua_add_function(L, name, getFn);
+		lua_pop(L, 1);			/* tidy stack (remove table) */
+		if (setFn) {
+			SWIG_Lua_get_table(L, ".set");	/* find the .set table */
+			assert(lua_istable(L, -1));	/* just in case */
+			SWIG_Lua_add_function(L, name, setFn);
+			lua_pop(L, 1);		/* tidy stack (remove table) */
+		}
+	}
 
 /* helper to recursively add class details (attributes & operations) */
-SWIGINTERN void  SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss)
-{
-  int i;
-  /* call all the base classes first: we can then override these later: */
-  for(i=0;clss->bases[i];i++)
-  {
-    SWIG_Lua_add_class_details(L,clss->bases[i]);
-  }
-  /* add fns */
-  for(i=0;clss->attributes[i].name;i++){
-    SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
-  }
-  /* add methods to the metatable */
-  SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
-  assert(lua_istable(L,-1));  /* just in case */
-  for(i=0;clss->methods[i].name;i++){
-    SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
-  }
-  lua_pop(L,1);       /* tidy stack (remove table) */
-  /*   add operator overloads
-    these look ANY method which start with "__" and assume they
-    are operator overloads & add them to the metatable
-    (this might mess up is someone defines a method __gc (the destructor)*/
-  for(i=0;clss->methods[i].name;i++){
-    if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){
-      SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
-    }
-  }
-}
+	SWIGINTERN void SWIG_Lua_add_class_details(lua_State * L, swig_lua_class * clss) {
+		int i;
+		/* call all the base classes first: we can then override these later: */
+		for (i = 0; clss->bases[i]; i++) {
+			SWIG_Lua_add_class_details(L, clss->bases[i]);
+		}
+		/* add fns */
+		for (i = 0; clss->attributes[i].name; i++) {
+			SWIG_Lua_add_class_variable(L, clss->attributes[i].name, clss->attributes[i].getmethod, clss->attributes[i].setmethod);
+		}
+		/* add methods to the metatable */
+		SWIG_Lua_get_table(L, ".fn");	/* find the .fn table */
+		assert(lua_istable(L, -1));	/* just in case */
+		for (i = 0; clss->methods[i].name; i++) {
+			SWIG_Lua_add_function(L, clss->methods[i].name, clss->methods[i].method);
+		}
+		lua_pop(L, 1);			/* tidy stack (remove table) */
+		/*   add operator overloads
+		   these look ANY method which start with "__" and assume they
+		   are operator overloads & add them to the metatable
+		   (this might mess up is someone defines a method __gc (the destructor) */
+		for (i = 0; clss->methods[i].name; i++) {
+			if (clss->methods[i].name[0] == '_' && clss->methods[i].name[1] == '_') {
+				SWIG_Lua_add_function(L, clss->methods[i].name, clss->methods[i].method);
+			}
+		}
+	}
 
 /* set up the base classes pointers.
 Each class structure has a list of pointers to the base class structures.
@@ -1201,256 +1170,237 @@
 spread over more than one swig file. 
 Therefore it must be done at runtime, querying the SWIG type system.
 */
-SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss)
-{
-  int i=0;
-  swig_module_info* module=SWIG_GetModule(L);
-  for(i=0;clss->base_names[i];i++)
-  {
-    if (clss->bases[i]==0) /* not found yet */
-    {
-      /* lookup and cache the base class */
-      swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
-      if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
-    }
-  }	
-}
+	SWIGINTERN void SWIG_Lua_init_base_class(lua_State * L, swig_lua_class * clss) {
+		int i = 0;
+		swig_module_info *module = SWIG_GetModule(L);
+		for (i = 0; clss->base_names[i]; i++) {
+			if (clss->bases[i] == 0) {	/* not found yet */
+				/* lookup and cache the base class */
+				swig_type_info *info = SWIG_TypeQueryModule(module, module, clss->base_names[i]);
+				if (info)
+					clss->bases[i] = (swig_lua_class *) info->clientdata;
+			}
+		}
+	}
 
 /* performs the entire class registration process */
-SWIGINTERN void  SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss)
-{
-  /*  add its constructor to module with the name of the class
-  so you can do MyClass(...) as well as new_MyClass(...)
-  BUT only if a constructor is defined
-  (this overcomes the problem of pure virtual classes without constructors)*/
-  if (clss->constructor)
-    SWIG_Lua_add_function(L,clss->name,clss->constructor);
-
-  SWIG_Lua_get_class_registry(L);  /* get the registry */
-  lua_pushstring(L,clss->name);  /* get the name */
-  lua_newtable(L);    /* create the metatable */
-  /* add string of class name called ".type" */
-  lua_pushstring(L,".type");
-  lua_pushstring(L,clss->name);
-  lua_rawset(L,-3);
-  /* add a table called ".get" */
-  lua_pushstring(L,".get");
-  lua_newtable(L);
-  lua_rawset(L,-3);
-  /* add a table called ".set" */
-  lua_pushstring(L,".set");
-  lua_newtable(L);
-  lua_rawset(L,-3);
-  /* add a table called ".fn" */
-  lua_pushstring(L,".fn");
-  lua_newtable(L);
-  lua_rawset(L,-3);
-  /* add accessor fns for using the .get,.set&.fn */
-  SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
-  SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
-  SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
-  /* add it */
-  lua_rawset(L,-3);  /* metatable into registry */
-  lua_pop(L,1);      /* tidy stack (remove registry) */
-
-  SWIG_Lua_get_class_metatable(L,clss->name);
-  SWIG_Lua_add_class_details(L,clss);  /* recursive adding of details (atts & ops) */
-  lua_pop(L,1);      /* tidy stack (remove class metatable) */
-}
+	SWIGINTERN void SWIG_Lua_class_register(lua_State * L, swig_lua_class * clss) {
+		/*  add its constructor to module with the name of the class
+		   so you can do MyClass(...) as well as new_MyClass(...)
+		   BUT only if a constructor is defined
+		   (this overcomes the problem of pure virtual classes without constructors) */
+		if (clss->constructor)
+			SWIG_Lua_add_function(L, clss->name, clss->constructor);
+
+		SWIG_Lua_get_class_registry(L);	/* get the registry */
+		lua_pushstring(L, clss->name);	/* get the name */
+		lua_newtable(L);		/* create the metatable */
+		/* add string of class name called ".type" */
+		lua_pushstring(L, ".type");
+		lua_pushstring(L, clss->name);
+		lua_rawset(L, -3);
+		/* add a table called ".get" */
+		lua_pushstring(L, ".get");
+		lua_newtable(L);
+		lua_rawset(L, -3);
+		/* add a table called ".set" */
+		lua_pushstring(L, ".set");
+		lua_newtable(L);
+		lua_rawset(L, -3);
+		/* add a table called ".fn" */
+		lua_pushstring(L, ".fn");
+		lua_newtable(L);
+		lua_rawset(L, -3);
+		/* add accessor fns for using the .get,.set&.fn */
+		SWIG_Lua_add_function(L, "__index", SWIG_Lua_class_get);
+		SWIG_Lua_add_function(L, "__newindex", SWIG_Lua_class_set);
+		SWIG_Lua_add_function(L, "__gc", SWIG_Lua_class_destruct);
+		/* add it */
+		lua_rawset(L, -3);		/* metatable into registry */
+		lua_pop(L, 1);			/* tidy stack (remove registry) */
+
+		SWIG_Lua_get_class_metatable(L, clss->name);
+		SWIG_Lua_add_class_details(L, clss);	/* recursive adding of details (atts & ops) */
+		lua_pop(L, 1);			/* tidy stack (remove class metatable) */
+	}
 
 /* -----------------------------------------------------------------------------
  * Class/structure conversion fns
  * ----------------------------------------------------------------------------- */
 
 /* helper to add metatable to new lua object */
-SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type)
-{
-  if (type->clientdata)  /* there is clientdata: so add the metatable */
-  {
-    SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name);
-    if (lua_istable(L,-1))
-    {
-      lua_setmetatable(L,-2);
-    }
-    else
-    {
-      lua_pop(L,1);
-    }
-  }
-}
+	SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State * L, swig_type_info * type) {
+		if (type->clientdata) {	/* there is clientdata: so add the metatable */
+			SWIG_Lua_get_class_metatable(L, ((swig_lua_class *) (type->clientdata))->name);
+			if (lua_istable(L, -1)) {
+				lua_setmetatable(L, -2);
+			} else {
+				lua_pop(L, 1);
+			}
+		}
+	}
 
 /* pushes a new object into the lua stack */
-SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own)
-{
-  swig_lua_userdata* usr;
-  if (!ptr){
-    lua_pushnil(L);
-    return;
-  }
-  usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata));  /* get data */
-  usr->ptr=ptr;  /* set the ptr */
-  usr->type=type;
-  usr->own=own;
-  _SWIG_Lua_AddMetatable(L,type); /* add metatable */
-}
+	SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State * L, void *ptr, swig_type_info * type, int own) {
+		swig_lua_userdata *usr;
+		if (!ptr) {
+			lua_pushnil(L);
+			return;
+		}
+		usr = (swig_lua_userdata *) lua_newuserdata(L, sizeof(swig_lua_userdata));	/* get data */
+		usr->ptr = ptr;			/* set the ptr */
+		usr->type = type;
+		usr->own = own;
+		_SWIG_Lua_AddMetatable(L, type);	/* add metatable */
+	}
 
 /* takes a object from the lua stack & converts it into an object of the correct type
  (if possible) */
-SWIGRUNTIME int  SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags)
-{
-  swig_lua_userdata* usr;
-  swig_cast_info *cast;
-  if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;}    /* special case: lua nil => NULL pointer */
-  usr=(swig_lua_userdata*)lua_touserdata(L,index);  /* get data */
-  if (usr)
-  {
-    if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
-    {
-        usr->own=0;
-    }
-    if (!type)            /* special cast void*, no casting fn */
-    {
-      *ptr=usr->ptr;
-      return SWIG_OK; /* ok */
-    }
-    cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
-    if (cast)
-    {
-      int newmemory = 0;
-      *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
-      assert(!newmemory); /* newmemory handling not yet implemented */
-      return SWIG_OK;  /* ok */
-    }
-  }
-  return SWIG_ERROR;  /* error */
-}
+	SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State * L, int index, void **ptr, swig_type_info * type, int flags) {
+		swig_lua_userdata *usr;
+		swig_cast_info *cast;
+		if (lua_isnil(L, index)) {
+			*ptr = 0;
+			return SWIG_OK;
+		}						/* special case: lua nil => NULL pointer */
+		usr = (swig_lua_userdata *) lua_touserdata(L, index);	/* get data */
+		if (usr) {
+			if (flags & SWIG_POINTER_DISOWN) {	/* must disown the object */
+				usr->own = 0;
+			}
+			if (!type) {		/* special cast void*, no casting fn */
+				*ptr = usr->ptr;
+				return SWIG_OK;	/* ok */
+			}
+			cast = SWIG_TypeCheckStruct(usr->type, type);	/* performs normal type checking */
+			if (cast) {
+				int newmemory = 0;
+				*ptr = SWIG_TypeCast(cast, usr->ptr, &newmemory);
+				assert(!newmemory);	/* newmemory handling not yet implemented */
+				return SWIG_OK;	/* ok */
+			}
+		}
+		return SWIG_ERROR;		/* error */
+	}
 
-SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags,
-       int argnum,const char* func_name){
-  void* result;
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
-    lua_pushfstring(L,"Error in %s, expected a %s at argument number %d\n",
-      func_name,(type && type->str)?type->str:"void*",argnum);
-    lua_error(L);
-  }
-  return result;
-}
+	SWIGRUNTIME void *SWIG_Lua_MustGetPtr(lua_State * L, int index, swig_type_info * type, int flags, int argnum, const char *func_name) {
+		void *result;
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, index, &result, type, flags))) {
+			lua_pushfstring(L, "Error in %s, expected a %s at argument number %d\n", func_name, (type && type->str) ? type->str : "void*", argnum);
+			lua_error(L);
+		}
+		return result;
+	}
 
 /* pushes a packed userdata. user for member fn pointers only */
-SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type)
-{
-  swig_lua_rawdata* raw;
-  assert(ptr); /* not acceptable to pass in a NULL value */
-  raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size);  /* alloc data */
-  raw->type=type;
-  raw->own=0;
-  memcpy(raw->data,ptr,size); /* copy the data */
-  _SWIG_Lua_AddMetatable(L,type); /* add metatable */
-}
-    
+	SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State * L, void *ptr, size_t size, swig_type_info * type) {
+		swig_lua_rawdata *raw;
+		assert(ptr);			/* not acceptable to pass in a NULL value */
+		raw = (swig_lua_rawdata *) lua_newuserdata(L, sizeof(swig_lua_rawdata) - 1 + size);	/* alloc data */
+		raw->type = type;
+		raw->own = 0;
+		memcpy(raw->data, ptr, size);	/* copy the data */
+		_SWIG_Lua_AddMetatable(L, type);	/* add metatable */
+	}
+
 /* converts a packed userdata. user for member fn pointers only */
-SWIGRUNTIME int  SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type)
-{
-  swig_lua_rawdata* raw;
-  raw=(swig_lua_rawdata*)lua_touserdata(L,index);  /* get data */
-  if (!raw) return SWIG_ERROR;  /* error */
-  if (type==0 || type==raw->type) /* void* or identical type */
-  {
-    memcpy(ptr,raw->data,size); /* copy it */
-    return SWIG_OK; /* ok */
-  }
-  return SWIG_ERROR;  /* error */
-}
+	SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State * L, int index, void *ptr, size_t size, swig_type_info * type) {
+		swig_lua_rawdata *raw;
+		raw = (swig_lua_rawdata *) lua_touserdata(L, index);	/* get data */
+		if (!raw)
+			return SWIG_ERROR;	/* error */
+		if (type == 0 || type == raw->type) {	/* void* or identical type */
+			memcpy(ptr, raw->data, size);	/* copy it */
+			return SWIG_OK;		/* ok */
+		}
+		return SWIG_ERROR;		/* error */
+	}
 
 /* a function to get the typestring of a piece of data */
-SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
-{
-  swig_lua_userdata* usr;
-  if (lua_isuserdata(L,tp))
-  {
-    usr=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
-    if (usr && usr->type && usr->type->str)
-      return usr->type->str;
-    return "userdata (unknown type)";
-  }
-  return lua_typename(L,lua_type(L,tp));
-}
+	SWIGRUNTIME const char *SWIG_Lua_typename(lua_State * L, int tp) {
+		swig_lua_userdata *usr;
+		if (lua_isuserdata(L, tp)) {
+			usr = (swig_lua_userdata *) lua_touserdata(L, 1);	/* get data */
+			if (usr && usr->type && usr->type->str)
+				return usr->type->str;
+			return "userdata (unknown type)";
+		}
+		return lua_typename(L, lua_type(L, tp));
+	}
 
 /* lua callable function to get the userdata's type */
-SWIGRUNTIME int SWIG_Lua_type(lua_State* L)
-{
-  lua_pushstring(L,SWIG_Lua_typename(L,1));
-  return 1;
-}
+	SWIGRUNTIME int SWIG_Lua_type(lua_State * L) {
+		lua_pushstring(L, SWIG_Lua_typename(L, 1));
+		return 1;
+	}
 
 /* lua callable function to compare userdata's value
 the issue is that two userdata may point to the same thing
 but to lua, they are different objects */
-SWIGRUNTIME int SWIG_Lua_equal(lua_State* L)
-{
-  int result;
-  swig_lua_userdata *usr1,*usr2;
-  if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2))  /* just in case */
-    return 0;  /* nil reply */
-  usr1=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
-  usr2=(swig_lua_userdata*)lua_touserdata(L,2);  /* get data */
-  /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
-  result=(usr1->ptr==usr2->ptr);
-   lua_pushboolean(L,result);
-  return 1;
-}
+	SWIGRUNTIME int SWIG_Lua_equal(lua_State * L) {
+		int result;
+		swig_lua_userdata *usr1, *usr2;
+		if (!lua_isuserdata(L, 1) || !lua_isuserdata(L, 2))	/* just in case */
+			return 0;			/* nil reply */
+		usr1 = (swig_lua_userdata *) lua_touserdata(L, 1);	/* get data */
+		usr2 = (swig_lua_userdata *) lua_touserdata(L, 2);	/* get data */
+		/*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same */
+		result = (usr1->ptr == usr2->ptr);
+		lua_pushboolean(L, result);
+		return 1;
+	}
 
 /* -----------------------------------------------------------------------------
  * global variable support code: class/struct typemap functions
  * ----------------------------------------------------------------------------- */
 
 /* Install Constants */
-SWIGINTERN void
-SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
-  int i;
-  for (i = 0; constants[i].type; i++) {
-    switch(constants[i].type) {
-    case SWIG_LUA_INT:
-      lua_pushstring(L,constants[i].name);
-      lua_pushnumber(L,(lua_Number)constants[i].lvalue);
-      lua_rawset(L,-3);
-      break;
-    case SWIG_LUA_FLOAT:
-      lua_pushstring(L,constants[i].name);
-      lua_pushnumber(L,(lua_Number)constants[i].dvalue);
-      lua_rawset(L,-3);
-      break;
-    case SWIG_LUA_CHAR:
-      lua_pushstring(L,constants[i].name);
-      lua_pushfstring(L,"%c",(char)constants[i].lvalue);
-      lua_rawset(L,-3);
-      break;
-    case SWIG_LUA_STRING:
-      lua_pushstring(L,constants[i].name);
-      lua_pushstring(L,(char *) constants[i].pvalue);
-      lua_rawset(L,-3);
-      break;
-    case SWIG_LUA_POINTER:
-      lua_pushstring(L,constants[i].name);
-      SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
-      lua_rawset(L,-3);
-      break;
-    case SWIG_LUA_BINARY:
-      lua_pushstring(L,constants[i].name);
-      SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
-      lua_rawset(L,-3);
-      break;
-    default:
-      break;
-    }
-  }
-}
+	SWIGINTERN void
+	     SWIG_Lua_InstallConstants(lua_State * L, swig_lua_const_info constants[]) {
+		int i;
+		for (i = 0; constants[i].type; i++) {
+			switch (constants[i].type) {
+			case SWIG_LUA_INT:
+				lua_pushstring(L, constants[i].name);
+				lua_pushnumber(L, (lua_Number) constants[i].lvalue);
+				lua_rawset(L, -3);
+				break;
+			case SWIG_LUA_FLOAT:
+				lua_pushstring(L, constants[i].name);
+				lua_pushnumber(L, (lua_Number) constants[i].dvalue);
+				lua_rawset(L, -3);
+				break;
+			case SWIG_LUA_CHAR:
+				lua_pushstring(L, constants[i].name);
+				lua_pushfstring(L, "%c", (char) constants[i].lvalue);
+				lua_rawset(L, -3);
+				break;
+			case SWIG_LUA_STRING:
+				lua_pushstring(L, constants[i].name);
+				lua_pushstring(L, (char *) constants[i].pvalue);
+				lua_rawset(L, -3);
+				break;
+			case SWIG_LUA_POINTER:
+				lua_pushstring(L, constants[i].name);
+				SWIG_NewPointerObj(L, constants[i].pvalue, *(constants[i]).ptype, 0);
+				lua_rawset(L, -3);
+				break;
+			case SWIG_LUA_BINARY:
+				lua_pushstring(L, constants[i].name);
+				SWIG_NewMemberObj(L, constants[i].pvalue, constants[i].lvalue, *(constants[i]).ptype);
+				lua_rawset(L, -3);
+				break;
+			default:
+				break;
+			}
+		}
+	}
 
 /* -----------------------------------------------------------------------------
  * executing lua code from within the wrapper
  * ----------------------------------------------------------------------------- */
 
-#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
+#ifndef SWIG_DOSTRING_FAIL		/* Allows redefining of error function */
 #define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
 #endif
 /* Executes a C string in Lua a really simple way of calling lua from C
@@ -1458,22 +1408,23 @@
 In lua 5.0.X its lua_dostring()
 In lua 5.1.X its luaL_dostring()
 */
-SWIGINTERN int 
-SWIG_Lua_dostring(lua_State *L, const char* str) {
-  int ok,top;
-  if (str==0 || str[0]==0) return 0; /* nothing to do */
-  top=lua_gettop(L); /* save stack */
+	SWIGINTERN int
+	    SWIG_Lua_dostring(lua_State * L, const char *str) {
+		int ok, top;
+		if (str == 0 || str[0] == 0)
+			return 0;			/* nothing to do */
+		top = lua_gettop(L);	/* save stack */
 #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
-  ok=luaL_dostring(L,str);	/* looks like this is lua 5.1.X or later, good */
+		ok = luaL_dostring(L, str);	/* looks like this is lua 5.1.X or later, good */
 #else
-  ok=lua_dostring(L,str);	/* might be lua 5.0.x, using lua_dostring */
+		ok = lua_dostring(L, str);	/* might be lua 5.0.x, using lua_dostring */
 #endif
-  if (ok!=0) {
-    SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
-  }
-  lua_settop(L,top); /* restore the stack */
-  return ok;
-}    
+		if (ok != 0) {
+			SWIG_DOSTRING_FAIL(lua_tostring(L, -1));
+		}
+		lua_settop(L, top);		/* restore the stack */
+		return ok;
+	}
 
 #ifdef __cplusplus
 }
@@ -1504,7 +1455,8 @@
 #define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
 #define SWIGTYPE_p_void swig_types[18]
 static swig_type_info *swig_types[20];
-static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
+static swig_module_info swig_module = { swig_types, 19, 0, 0, 0, 0 };
+
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -1518,4782 +1470,5297 @@
 
 
 namespace swig {
-typedef struct{} LANGUAGE_OBJ;
+	typedef struct {
+	} LANGUAGE_OBJ;
 }
-
-
 #include "switch.h"
 #include "switch_cpp.h"
 #include "freeswitch_lua.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
-static int _wrap_consoleLog(lua_State* L) {
-  int SWIG_arg = -1;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("consoleLog",2,2)
-  if(!lua_isstring(L,1)) SWIG_fail_arg("consoleLog",1,"char *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("consoleLog",2,"char *");
-  arg1 = (char *)lua_tostring(L, 1);
-  arg2 = (char *)lua_tostring(L, 2);
-  consoleLog(arg1,arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_consoleLog(lua_State * L) {
+		int SWIG_arg = -1;
+		char *arg1 = (char *) 0;
+		char *arg2 = (char *) 0;
+
+		     SWIG_check_num_args("consoleLog", 2, 2)
+		if   (!lua_isstring(L, 1))
+			     SWIG_fail_arg("consoleLog", 1, "char *");
+		if   (!lua_isstring(L, 2))
+			     SWIG_fail_arg("consoleLog", 2, "char *");
+		     arg1 = (char *) lua_tostring(L, 1);
+		     arg2 = (char *) lua_tostring(L, 2);
+		     consoleLog(arg1, arg2);
+		     SWIG_arg = 0;
+
+		     return SWIG_arg;
+
+		if   (0)
+			     SWIG_fail;
+
+		     fail:lua_error(L);
+		     return SWIG_arg;
+	} static int _wrap_consoleCleanLog(lua_State * L) {
+		int SWIG_arg = -1;
+		char *arg1 = (char *) 0;
+
+		SWIG_check_num_args("consoleCleanLog", 1, 1)
+			if (!lua_isstring(L, 1))
+			SWIG_fail_arg("consoleCleanLog", 1, "char *");
+		arg1 = (char *) lua_tostring(L, 1);
+		consoleCleanLog(arg1);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_consoleCleanLog(lua_State* L) {
-  int SWIG_arg = -1;
-  char *arg1 = (char *) 0 ;
-  
-  SWIG_check_num_args("consoleCleanLog",1,1)
-  if(!lua_isstring(L,1)) SWIG_fail_arg("consoleCleanLog",1,"char *");
-  arg1 = (char *)lua_tostring(L, 1);
-  consoleCleanLog(arg1);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_new_IVRMenu(lua_State * L) {
+		int SWIG_arg = -1;
+		IVRMenu *arg1 = (IVRMenu *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+		char *arg5 = (char *) 0;
+		char *arg6 = (char *) 0;
+		char *arg7 = (char *) 0;
+		char *arg8 = (char *) 0;
+		int arg9;
+		int arg10;
+		int arg11;
+		int arg12;
+		int arg13;
+		IVRMenu *result = 0;
+
+		SWIG_check_num_args("IVRMenu", 13, 13)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("IVRMenu", 1, "IVRMenu *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("IVRMenu", 2, "char const *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("IVRMenu", 3, "char const *");
+		if (!lua_isstring(L, 4))
+			SWIG_fail_arg("IVRMenu", 4, "char const *");
+		if (!lua_isstring(L, 5))
+			SWIG_fail_arg("IVRMenu", 5, "char const *");
+		if (!lua_isstring(L, 6))
+			SWIG_fail_arg("IVRMenu", 6, "char const *");
+		if (!lua_isstring(L, 7))
+			SWIG_fail_arg("IVRMenu", 7, "char const *");
+		if (!lua_isstring(L, 8))
+			SWIG_fail_arg("IVRMenu", 8, "char const *");
+		if (!lua_isnumber(L, 9))
+			SWIG_fail_arg("IVRMenu", 9, "int");
+		if (!lua_isnumber(L, 10))
+			SWIG_fail_arg("IVRMenu", 10, "int");
+		if (!lua_isnumber(L, 11))
+			SWIG_fail_arg("IVRMenu", 11, "int");
+		if (!lua_isnumber(L, 12))
+			SWIG_fail_arg("IVRMenu", 12, "int");
+		if (!lua_isnumber(L, 13))
+			SWIG_fail_arg("IVRMenu", 13, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, 0))) {
+			SWIG_fail_ptr("new_IVRMenu", 1, SWIGTYPE_p_IVRMenu);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		arg4 = (char *) lua_tostring(L, 4);
+		arg5 = (char *) lua_tostring(L, 5);
+		arg6 = (char *) lua_tostring(L, 6);
+		arg7 = (char *) lua_tostring(L, 7);
+		arg8 = (char *) lua_tostring(L, 8);
+		arg9 = (int) lua_tonumber(L, 9);
+		arg10 = (int) lua_tonumber(L, 10);
+		arg11 = (int) lua_tonumber(L, 11);
+		arg12 = (int) lua_tonumber(L, 12);
+		arg13 = (int) lua_tonumber(L, 13);
+		result =
+			(IVRMenu *) new IVRMenu(arg1, (char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5, (char const *) arg6,
+									(char const *) arg7, (char const *) arg8, arg9, arg10, arg11, arg12, arg13);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_IVRMenu, 1);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_new_IVRMenu(lua_State* L) {
-  int SWIG_arg = -1;
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  int arg9 ;
-  int arg10 ;
-  int arg11 ;
-  int arg12 ;
-  int arg13 ;
-  IVRMenu *result = 0 ;
-  
-  SWIG_check_num_args("IVRMenu",13,13)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *");
-  if(!lua_isstring(L,4)) SWIG_fail_arg("IVRMenu",4,"char const *");
-  if(!lua_isstring(L,5)) SWIG_fail_arg("IVRMenu",5,"char const *");
-  if(!lua_isstring(L,6)) SWIG_fail_arg("IVRMenu",6,"char const *");
-  if(!lua_isstring(L,7)) SWIG_fail_arg("IVRMenu",7,"char const *");
-  if(!lua_isstring(L,8)) SWIG_fail_arg("IVRMenu",8,"char const *");
-  if(!lua_isnumber(L,9)) SWIG_fail_arg("IVRMenu",9,"int");
-  if(!lua_isnumber(L,10)) SWIG_fail_arg("IVRMenu",10,"int");
-  if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int");
-  if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int");
-  if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
-    SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  arg4 = (char *)lua_tostring(L, 4);
-  arg5 = (char *)lua_tostring(L, 5);
-  arg6 = (char *)lua_tostring(L, 6);
-  arg7 = (char *)lua_tostring(L, 7);
-  arg8 = (char *)lua_tostring(L, 8);
-  arg9 = (int)lua_tonumber(L, 9);
-  arg10 = (int)lua_tonumber(L, 10);
-  arg11 = (int)lua_tonumber(L, 11);
-  arg12 = (int)lua_tonumber(L, 12);
-  arg13 = (int)lua_tonumber(L, 13);
-  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_delete_IVRMenu(lua_State * L) {
+		int SWIG_arg = -1;
+		IVRMenu *arg1 = (IVRMenu *) 0;
 
+		SWIG_check_num_args("IVRMenu", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("IVRMenu", 1, "IVRMenu *");
 
-static int _wrap_delete_IVRMenu(lua_State* L) {
-  int SWIG_arg = -1;
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  
-  SWIG_check_num_args("IVRMenu",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("delete_IVRMenu",1,SWIGTYPE_p_IVRMenu);
-  }
-  
-  delete arg1;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("delete_IVRMenu", 1, SWIGTYPE_p_IVRMenu);
+		}
 
+		delete arg1;
 
-static int _wrap_IVRMenu_bindAction(lua_State* L) {
-  int SWIG_arg = -1;
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  
-  SWIG_check_num_args("bindAction",4,4)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bindAction",1,"IVRMenu *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("bindAction",2,"char *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("bindAction",3,"char const *");
-  if(!lua_isstring(L,4)) SWIG_fail_arg("bindAction",4,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
-    SWIG_fail_ptr("IVRMenu_bindAction",1,SWIGTYPE_p_IVRMenu);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  arg4 = (char *)lua_tostring(L, 4);
-  (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_arg = 0;
 
+		return SWIG_arg;
 
-static int _wrap_IVRMenu_execute(lua_State* L) {
-  int SWIG_arg = -1;
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  CoreSession *arg2 = (CoreSession *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  SWIG_check_num_args("execute",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"IVRMenu *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("execute",2,"CoreSession *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
-    SWIG_fail_ptr("IVRMenu_execute",1,SWIGTYPE_p_IVRMenu);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("IVRMenu_execute",2,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->execute(arg2,(char const *)arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (0)
+			SWIG_fail;
 
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static void swig_delete_IVRMenu(void *obj) {
-IVRMenu *arg1 = (IVRMenu *) obj;
-delete arg1;
-}
-static swig_lua_method swig_IVRMenu_methods[] = {
-    {"bindAction", _wrap_IVRMenu_bindAction}, 
-    {"execute", _wrap_IVRMenu_execute}, 
-    {0,0}
-};
-static swig_lua_attribute swig_IVRMenu_attributes[] = {
-    {0,0,0}
-};
-static swig_lua_class *swig_IVRMenu_bases[] = {0};
-static const char *swig_IVRMenu_base_names[] = {0};
-static swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases, swig_IVRMenu_base_names };
-
-static int _wrap_new_API(lua_State* L) {
-  int SWIG_arg = -1;
-  API *result = 0 ;
-  
-  SWIG_check_num_args("API",0,0)
-  result = (API *)new API();
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_API,1); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_IVRMenu_bindAction(lua_State * L) {
+		int SWIG_arg = -1;
+		IVRMenu *arg1 = (IVRMenu *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+
+		SWIG_check_num_args("bindAction", 4, 4)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("bindAction", 1, "IVRMenu *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("bindAction", 2, "char *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("bindAction", 3, "char const *");
+		if (!lua_isstring(L, 4))
+			SWIG_fail_arg("bindAction", 4, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, 0))) {
+			SWIG_fail_ptr("IVRMenu_bindAction", 1, SWIGTYPE_p_IVRMenu);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		arg4 = (char *) lua_tostring(L, 4);
+		(arg1)->bindAction(arg2, (char const *) arg3, (char const *) arg4);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_delete_API(lua_State* L) {
-  int SWIG_arg = -1;
-  API *arg1 = (API *) 0 ;
-  
-  SWIG_check_num_args("API",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("API",1,"API *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("delete_API",1,SWIGTYPE_p_API);
-  }
-  
-  delete arg1;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_IVRMenu_execute(lua_State * L) {
+		int SWIG_arg = -1;
+		IVRMenu *arg1 = (IVRMenu *) 0;
+		CoreSession *arg2 = (CoreSession *) 0;
+		char *arg3 = (char *) 0;
+
+		SWIG_check_num_args("execute", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("execute", 1, "IVRMenu *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("execute", 2, "CoreSession *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("execute", 3, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, 0))) {
+			SWIG_fail_ptr("IVRMenu_execute", 1, SWIGTYPE_p_IVRMenu);
+		}
+
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("IVRMenu_execute", 2, SWIGTYPE_p_CoreSession);
+		}
+
+		arg3 = (char *) lua_tostring(L, 3);
+		(arg1)->execute(arg2, (char const *) arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_API_execute(lua_State* L) {
-  int SWIG_arg = -1;
-  API *arg1 = (API *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("execute",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"API *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){
-    SWIG_fail_ptr("API_execute",1,SWIGTYPE_p_API);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static void swig_delete_IVRMenu(void *obj) {
+		IVRMenu *arg1 = (IVRMenu *) obj;
+		delete arg1;
+	}
+	static swig_lua_method swig_IVRMenu_methods[] = {
+		{"bindAction", _wrap_IVRMenu_bindAction},
+		{"execute", _wrap_IVRMenu_execute},
+		{0, 0}
+	};
+	static swig_lua_attribute swig_IVRMenu_attributes[] = {
+		{0, 0, 0}
+	};
+	static swig_lua_class *swig_IVRMenu_bases[] = { 0 };
+	static const char *swig_IVRMenu_base_names[] = { 0 };
+	static swig_lua_class _wrap_class_IVRMenu =
+		{ "IVRMenu", &SWIGTYPE_p_IVRMenu, _wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases,
+swig_IVRMenu_base_names };
+
+	static int _wrap_new_API(lua_State * L) {
+		int SWIG_arg = -1;
+		API *result = 0;
+
+		SWIG_check_num_args("API", 0, 0)
+		result = (API *) new API();
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_API, 1);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_API_executeString(lua_State* L) {
-  int SWIG_arg = -1;
-  API *arg1 = (API *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("executeString",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("executeString",1,"API *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("executeString",2,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){
-    SWIG_fail_ptr("API_executeString",1,SWIGTYPE_p_API);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (char *)(arg1)->executeString((char const *)arg2);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_delete_API(lua_State * L) {
+		int SWIG_arg = -1;
+		API *arg1 = (API *) 0;
 
-static void swig_delete_API(void *obj) {
-API *arg1 = (API *) obj;
-delete arg1;
-}
-static swig_lua_method swig_API_methods[] = {
-    {"execute", _wrap_API_execute}, 
-    {"executeString", _wrap_API_executeString}, 
-    {0,0}
-};
-static swig_lua_attribute swig_API_attributes[] = {
-    {0,0,0}
-};
-static swig_lua_class *swig_API_bases[] = {0};
-static const char *swig_API_base_names[] = {0};
-static swig_lua_class _wrap_class_API = { "API", &SWIGTYPE_p_API,_wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases, swig_API_base_names };
-
-static int _wrap_input_callback_state_t_function_set(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  SWIG_check_num_args("function",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("function",2,"void *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
-    SWIG_fail_ptr("input_callback_state_t_function_set",1,SWIGTYPE_p_input_callback_state);
-  }
-  
-  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_function_set");
-  if (arg1) (arg1)->function = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_check_num_args("API", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("API", 1, "API *");
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_API, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("delete_API", 1, SWIGTYPE_p_API);
+		}
 
-static int _wrap_input_callback_state_t_function_get(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *result = 0 ;
-  
-  SWIG_check_num_args("function",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
-    SWIG_fail_ptr("input_callback_state_t_function_get",1,SWIGTYPE_p_input_callback_state);
-  }
-  
-  result = (void *) ((arg1)->function);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		delete arg1;
 
+		SWIG_arg = 0;
 
-static int _wrap_input_callback_state_t_threadState_set(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  SWIG_check_num_args("threadState",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("threadState",2,"void *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
-    SWIG_fail_ptr("input_callback_state_t_threadState_set",1,SWIGTYPE_p_input_callback_state);
-  }
-  
-  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_threadState_set");
-  if (arg1) (arg1)->threadState = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		return SWIG_arg;
 
+		if (0)
+			SWIG_fail;
 
-static int _wrap_input_callback_state_t_threadState_get(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *result = 0 ;
-  
-  SWIG_check_num_args("threadState",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
-    SWIG_fail_ptr("input_callback_state_t_threadState_get",1,SWIGTYPE_p_input_callback_state);
-  }
-  
-  result = (void *) ((arg1)->threadState);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_input_callback_state_t_extra_set(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  SWIG_check_num_args("extra",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("extra",2,"void *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
-    SWIG_fail_ptr("input_callback_state_t_extra_set",1,SWIGTYPE_p_input_callback_state);
-  }
-  
-  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_extra_set");
-  if (arg1) (arg1)->extra = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_API_execute(lua_State * L) {
+		int SWIG_arg = -1;
+		API *arg1 = (API *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("execute", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("execute", 1, "API *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("execute", 2, "char const *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("execute", 3, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_API, 0))) {
+			SWIG_fail_ptr("API_execute", 1, SWIGTYPE_p_API);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		result = (char *) (arg1)->execute((char const *) arg2, (char const *) arg3);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_input_callback_state_t_extra_get(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *result = 0 ;
-  
-  SWIG_check_num_args("extra",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
-    SWIG_fail_ptr("input_callback_state_t_extra_get",1,SWIGTYPE_p_input_callback_state);
-  }
-  
-  result = (void *) ((arg1)->extra);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_API_executeString(lua_State * L) {
+		int SWIG_arg = -1;
+		API *arg1 = (API *) 0;
+		char *arg2 = (char *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("executeString", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("executeString", 1, "API *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("executeString", 2, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_API, 0))) {
+			SWIG_fail_ptr("API_executeString", 1, SWIGTYPE_p_API);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (char *) (arg1)->executeString((char const *) arg2);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_input_callback_state_t_funcargs_set(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("funcargs",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("funcargs",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
-    SWIG_fail_ptr("input_callback_state_t_funcargs_set",1,SWIGTYPE_p_input_callback_state);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  {
-    if (arg1->funcargs) delete [] arg1->funcargs;
-    if (arg2) {
-      arg1->funcargs = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->funcargs, (const char *)arg2);
-    } else {
-      arg1->funcargs = 0;
-    }
-  }
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static void swig_delete_API(void *obj) {
+		API *arg1 = (API *) obj;
+		delete arg1;
+	}
+	static swig_lua_method swig_API_methods[] = {
+		{"execute", _wrap_API_execute},
+		{"executeString", _wrap_API_executeString},
+		{0, 0}
+	};
+	static swig_lua_attribute swig_API_attributes[] = {
+		{0, 0, 0}
+	};
+	static swig_lua_class *swig_API_bases[] = { 0 };
+	static const char *swig_API_base_names[] = { 0 };
+	static swig_lua_class _wrap_class_API =
+		{ "API", &SWIGTYPE_p_API, _wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases, swig_API_base_names };
+
+	static int _wrap_input_callback_state_t_function_set(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *arg2 = (void *) 0;
+
+		SWIG_check_num_args("function", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("function", 1, "input_callback_state_t *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("function", 2, "void *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+			SWIG_fail_ptr("input_callback_state_t_function_set", 1, SWIGTYPE_p_input_callback_state);
+		}
+
+		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "input_callback_state_t_function_set");
+		if (arg1)
+			(arg1)->function = arg2;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_input_callback_state_t_funcargs_get(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("funcargs",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
-    SWIG_fail_ptr("input_callback_state_t_funcargs_get",1,SWIGTYPE_p_input_callback_state);
-  }
-  
-  result = (char *) ((arg1)->funcargs);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_input_callback_state_t_function_get(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *result = 0;
+
+		SWIG_check_num_args("function", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("function", 1, "input_callback_state_t *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+			SWIG_fail_ptr("input_callback_state_t_function_get", 1, SWIGTYPE_p_input_callback_state);
+		}
+
+		result = (void *) ((arg1)->function);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_new_input_callback_state_t(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *result = 0 ;
-  
-  SWIG_check_num_args("input_callback_state_t::input_callback_state_t",0,0)
-  result = (input_callback_state_t *)new input_callback_state_t();
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,1); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_input_callback_state_t_threadState_set(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *arg2 = (void *) 0;
+
+		SWIG_check_num_args("threadState", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("threadState", 1, "input_callback_state_t *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("threadState", 2, "void *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+			SWIG_fail_ptr("input_callback_state_t_threadState_set", 1, SWIGTYPE_p_input_callback_state);
+		}
+
+		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "input_callback_state_t_threadState_set");
+		if (arg1)
+			(arg1)->threadState = arg2;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_delete_input_callback_state_t(lua_State* L) {
-  int SWIG_arg = -1;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  
-  SWIG_check_num_args("input_callback_state_t::~input_callback_state_t",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("input_callback_state_t::~input_callback_state_t",1,"input_callback_state_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("delete_input_callback_state_t",1,SWIGTYPE_p_input_callback_state);
-  }
-  
-  delete arg1;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_input_callback_state_t_threadState_get(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *result = 0;
+
+		SWIG_check_num_args("threadState", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("threadState", 1, "input_callback_state_t *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+			SWIG_fail_ptr("input_callback_state_t_threadState_get", 1, SWIGTYPE_p_input_callback_state);
+		}
+
+		result = (void *) ((arg1)->threadState);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static void swig_delete_input_callback_state_t(void *obj) {
-input_callback_state_t *arg1 = (input_callback_state_t *) obj;
-delete arg1;
-}
-static swig_lua_method swig_input_callback_state_t_methods[] = {
-    {0,0}
-};
-static swig_lua_attribute swig_input_callback_state_t_attributes[] = {
-    { "function", _wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set},
-    { "threadState", _wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set},
-    { "extra", _wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set},
-    { "funcargs", _wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set},
-    {0,0,0}
-};
-static swig_lua_class *swig_input_callback_state_t_bases[] = {0};
-static const char *swig_input_callback_state_t_base_names[] = {0};
-static swig_lua_class _wrap_class_input_callback_state_t = { "input_callback_state_t", &SWIGTYPE_p_input_callback_state,_wrap_new_input_callback_state_t, swig_delete_input_callback_state_t, swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases, swig_input_callback_state_t_base_names };
-
-static int _wrap_new_Stream__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  Stream *result = 0 ;
-  
-  SWIG_check_num_args("Stream",0,0)
-  result = (Stream *)new Stream();
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_input_callback_state_t_extra_set(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *arg2 = (void *) 0;
+
+		SWIG_check_num_args("extra", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("extra", 1, "input_callback_state_t *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("extra", 2, "void *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+			SWIG_fail_ptr("input_callback_state_t_extra_set", 1, SWIGTYPE_p_input_callback_state);
+		}
+
+		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "input_callback_state_t_extra_set");
+		if (arg1)
+			(arg1)->extra = arg2;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_new_Stream__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
-  Stream *result = 0 ;
-  
-  SWIG_check_num_args("Stream",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"switch_stream_handle_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_stream_handle_t,0))){
-    SWIG_fail_ptr("new_Stream",1,SWIGTYPE_p_switch_stream_handle_t);
-  }
-  
-  result = (Stream *)new Stream(arg1);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_input_callback_state_t_extra_get(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *result = 0;
+
+		SWIG_check_num_args("extra", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("extra", 1, "input_callback_state_t *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+			SWIG_fail_ptr("input_callback_state_t_extra_get", 1, SWIGTYPE_p_input_callback_state);
+		}
+
+		result = (void *) ((arg1)->extra);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_new_Stream(lua_State* L) {
-  int argc;
-  int argv[2]={
-    1,2
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 0) {
-    return _wrap_new_Stream__SWIG_0(L);
-  }
-  if (argc == 1) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      return _wrap_new_Stream__SWIG_1(L);
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'new_Stream'");
-  lua_error(L);return 0;
-}
+	static int _wrap_input_callback_state_t_funcargs_set(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("funcargs", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("funcargs", 1, "input_callback_state_t *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("funcargs", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+			SWIG_fail_ptr("input_callback_state_t_funcargs_set", 1, SWIGTYPE_p_input_callback_state);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		{
+			if (arg1->funcargs)
+				delete[]arg1->funcargs;
+			if (arg2) {
+				arg1->funcargs = (char *) (new char[strlen((const char *)arg2) + 1]);
+				strcpy((char *) arg1->funcargs, (const char *) arg2);
+			} else {
+				arg1->funcargs = 0;
+			}
+		}
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_delete_Stream(lua_State* L) {
-  int SWIG_arg = -1;
-  Stream *arg1 = (Stream *) 0 ;
-  
-  SWIG_check_num_args("Stream",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"Stream *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("delete_Stream",1,SWIGTYPE_p_Stream);
-  }
-  
-  delete arg1;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_input_callback_state_t_funcargs_get(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("funcargs", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("funcargs", 1, "input_callback_state_t *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+			SWIG_fail_ptr("input_callback_state_t_funcargs_get", 1, SWIGTYPE_p_input_callback_state);
+		}
+
+		result = (char *) ((arg1)->funcargs);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Stream_write(lua_State* L) {
-  int SWIG_arg = -1;
-  Stream *arg1 = (Stream *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("write",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("write",1,"Stream *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("write",2,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
-    SWIG_fail_ptr("Stream_write",1,SWIGTYPE_p_Stream);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  (arg1)->write((char const *)arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_new_input_callback_state_t(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *result = 0;
+
+		SWIG_check_num_args("input_callback_state_t::input_callback_state_t", 0, 0)
+		result = (input_callback_state_t *) new input_callback_state_t();
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_input_callback_state, 1);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Stream_get_data(lua_State* L) {
-  int SWIG_arg = -1;
-  Stream *arg1 = (Stream *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("get_data",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_data",1,"Stream *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
-    SWIG_fail_ptr("Stream_get_data",1,SWIGTYPE_p_Stream);
-  }
-  
-  result = (char *)(arg1)->get_data();
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_delete_input_callback_state_t(lua_State * L) {
+		int SWIG_arg = -1;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
 
+		SWIG_check_num_args("input_callback_state_t::~input_callback_state_t", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("input_callback_state_t::~input_callback_state_t", 1, "input_callback_state_t *");
 
-static void swig_delete_Stream(void *obj) {
-Stream *arg1 = (Stream *) obj;
-delete arg1;
-}
-static swig_lua_method swig_Stream_methods[] = {
-    {"write", _wrap_Stream_write}, 
-    {"get_data", _wrap_Stream_get_data}, 
-    {0,0}
-};
-static swig_lua_attribute swig_Stream_attributes[] = {
-    {0,0,0}
-};
-static swig_lua_class *swig_Stream_bases[] = {0};
-static const char *swig_Stream_base_names[] = {0};
-static swig_lua_class _wrap_class_Stream = { "Stream", &SWIGTYPE_p_Stream,_wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases, swig_Stream_base_names };
-
-static int _wrap_Event_event_set(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  
-  SWIG_check_num_args("event",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("event",2,"switch_event_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_event_set",1,SWIGTYPE_p_Event);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_event_t,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("Event_event_set",2,SWIGTYPE_p_switch_event_t);
-  }
-  
-  if (arg1) (arg1)->event = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("delete_input_callback_state_t", 1, SWIGTYPE_p_input_callback_state);
+		}
 
+		delete arg1;
 
-static int _wrap_Event_event_get(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  switch_event_t *result = 0 ;
-  
-  SWIG_check_num_args("event",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_event_get",1,SWIGTYPE_p_Event);
-  }
-  
-  result = (switch_event_t *) ((arg1)->event);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_event_t,0); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_arg = 0;
 
+		return SWIG_arg;
 
-static int _wrap_Event_serialized_string_set(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("serialized_string",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("serialized_string",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_serialized_string_set",1,SWIGTYPE_p_Event);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  {
-    if (arg1->serialized_string) delete [] arg1->serialized_string;
-    if (arg2) {
-      arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->serialized_string, (const char *)arg2);
-    } else {
-      arg1->serialized_string = 0;
-    }
-  }
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (0)
+			SWIG_fail;
 
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_Event_serialized_string_get(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("serialized_string",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_serialized_string_get",1,SWIGTYPE_p_Event);
-  }
-  
-  result = (char *) ((arg1)->serialized_string);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static void swig_delete_input_callback_state_t(void *obj) {
+		input_callback_state_t *arg1 = (input_callback_state_t *) obj;
+		delete arg1;
+	}
+	static swig_lua_method swig_input_callback_state_t_methods[] = {
+		{0, 0}
+	};
+	static swig_lua_attribute swig_input_callback_state_t_attributes[] = {
+		{"function", _wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set},
+		{"threadState", _wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set},
+		{"extra", _wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set},
+		{"funcargs", _wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set},
+		{0, 0, 0}
+	};
+	static swig_lua_class *swig_input_callback_state_t_bases[] = { 0 };
+	static const char *swig_input_callback_state_t_base_names[] = { 0 };
+	static swig_lua_class _wrap_class_input_callback_state_t =
+		{ "input_callback_state_t", &SWIGTYPE_p_input_callback_state, _wrap_new_input_callback_state_t, swig_delete_input_callback_state_t,
+swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases, swig_input_callback_state_t_base_names };
+
+	static int _wrap_new_Stream__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		Stream *result = 0;
+
+		SWIG_check_num_args("Stream", 0, 0)
+		result = (Stream *) new Stream();
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Stream, 1);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_Event_mine_set(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  int arg2 ;
-  
-  SWIG_check_num_args("mine",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *");
-  if(!lua_isnumber(L,2)) SWIG_fail_arg("mine",2,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_mine_set",1,SWIGTYPE_p_Event);
-  }
-  
-  arg2 = (int)lua_tonumber(L, 2);
-  if (arg1) (arg1)->mine = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_new_Stream__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0;
+		Stream *result = 0;
+
+		SWIG_check_num_args("Stream", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("Stream", 1, "switch_stream_handle_t *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_stream_handle_t, 0))) {
+			SWIG_fail_ptr("new_Stream", 1, SWIGTYPE_p_switch_stream_handle_t);
+		}
+
+		result = (Stream *) new Stream(arg1);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Stream, 1);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_Event_mine_get(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("mine",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_mine_get",1,SWIGTYPE_p_Event);
-  }
-  
-  result = (int) ((arg1)->mine);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_new_Stream(lua_State * L) {
+		int argc;
+		int argv[2] = {
+			1, 2
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 0) {
+			return _wrap_new_Stream__SWIG_0(L);
+		}
+		if (argc == 1) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				return _wrap_new_Stream__SWIG_1(L);
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'new_Stream'");
+		lua_error(L);
+		return 0;
+	}
 
-static int _wrap_new_Event__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  Event *result = 0 ;
-  
-  SWIG_check_num_args("Event",2,2)
-  if(!lua_isstring(L,1)) SWIG_fail_arg("Event",1,"char const *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("Event",2,"char const *");
-  arg1 = (char *)lua_tostring(L, 1);
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (Event *)new Event((char const *)arg1,(char const *)arg2);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_delete_Stream(lua_State * L) {
+		int SWIG_arg = -1;
+		Stream *arg1 = (Stream *) 0;
 
-static int _wrap_new_Event__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  char *arg1 = (char *) 0 ;
-  Event *result = 0 ;
-  
-  SWIG_check_num_args("Event",1,1)
-  if(!lua_isstring(L,1)) SWIG_fail_arg("Event",1,"char const *");
-  arg1 = (char *)lua_tostring(L, 1);
-  result = (Event *)new Event((char const *)arg1);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_check_num_args("Stream", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("Stream", 1, "Stream *");
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("delete_Stream", 1, SWIGTYPE_p_Stream);
+		}
 
-static int _wrap_new_Event__SWIG_2(lua_State* L) {
-  int SWIG_arg = -1;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  int arg2 ;
-  Event *result = 0 ;
-  
-  SWIG_check_num_args("Event",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"switch_event_t *");
-  if(!lua_isnumber(L,2)) SWIG_fail_arg("Event",2,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_event_t,0))){
-    SWIG_fail_ptr("new_Event",1,SWIGTYPE_p_switch_event_t);
-  }
-  
-  arg2 = (int)lua_tonumber(L, 2);
-  result = (Event *)new Event(arg1,arg2);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		delete arg1;
 
+		SWIG_arg = 0;
 
-static int _wrap_new_Event__SWIG_3(lua_State* L) {
-  int SWIG_arg = -1;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  Event *result = 0 ;
-  
-  SWIG_check_num_args("Event",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"switch_event_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_event_t,0))){
-    SWIG_fail_ptr("new_Event",1,SWIGTYPE_p_switch_event_t);
-  }
-  
-  result = (Event *)new Event(arg1);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		return SWIG_arg;
 
+		if (0)
+			SWIG_fail;
 
-static int _wrap_new_Event(lua_State* L) {
-  int argc;
-  int argv[3]={
-    1,2,3
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 1) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      return _wrap_new_Event__SWIG_3(L);
-    }
-  }
-  if (argc == 1) {
-    int _v;
-    {
-      _v = lua_isstring(L,argv[0]);
-    }
-    if (_v) {
-      return _wrap_new_Event__SWIG_1(L);
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isnumber(L,argv[1]);
-      }
-      if (_v) {
-        return _wrap_new_Event__SWIG_2(L);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    {
-      _v = lua_isstring(L,argv[0]);
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        return _wrap_new_Event__SWIG_0(L);
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'new_Event'");
-  lua_error(L);return 0;
-}
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_delete_Event(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  
-  SWIG_check_num_args("Event",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("delete_Event",1,SWIGTYPE_p_Event);
-  }
-  
-  delete arg1;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Stream_write(lua_State * L) {
+		int SWIG_arg = -1;
+		Stream *arg1 = (Stream *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("write", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("write", 1, "Stream *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("write", 2, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Stream, 0))) {
+			SWIG_fail_ptr("Stream_write", 1, SWIGTYPE_p_Stream);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		(arg1)->write((char const *) arg2);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_serialize__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("serialize",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialize",1,"Event *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("serialize",2,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_serialize",1,SWIGTYPE_p_Event);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (char *)(arg1)->serialize((char const *)arg2);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Stream_get_data(lua_State * L) {
+		int SWIG_arg = -1;
+		Stream *arg1 = (Stream *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("get_data", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("get_data", 1, "Stream *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Stream, 0))) {
+			SWIG_fail_ptr("Stream_get_data", 1, SWIGTYPE_p_Stream);
+		}
+
+		result = (char *) (arg1)->get_data();
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_serialize__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("serialize",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialize",1,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_serialize",1,SWIGTYPE_p_Event);
-  }
-  
-  result = (char *)(arg1)->serialize();
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static void swig_delete_Stream(void *obj) {
+		Stream *arg1 = (Stream *) obj;
+		delete arg1;
+	}
+	static swig_lua_method swig_Stream_methods[] = {
+		{"write", _wrap_Stream_write},
+		{"get_data", _wrap_Stream_get_data},
+		{0, 0}
+	};
+	static swig_lua_attribute swig_Stream_attributes[] = {
+		{0, 0, 0}
+	};
+	static swig_lua_class *swig_Stream_bases[] = { 0 };
+	static const char *swig_Stream_base_names[] = { 0 };
+	static swig_lua_class _wrap_class_Stream =
+		{ "Stream", &SWIGTYPE_p_Stream, _wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases,
+swig_Stream_base_names };
+
+	static int _wrap_Event_event_set(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		switch_event_t *arg2 = (switch_event_t *) 0;
+
+		SWIG_check_num_args("event", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("event", 1, "Event *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("event", 2, "switch_event_t *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_event_set", 1, SWIGTYPE_p_Event);
+		}
+
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("Event_event_set", 2, SWIGTYPE_p_switch_event_t);
+		}
+
+		if (arg1)
+			(arg1)->event = arg2;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_serialize(lua_State* L) {
-  int argc;
-  int argv[3]={
-    1,2,3
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 1) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      return _wrap_Event_serialize__SWIG_1(L);
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        return _wrap_Event_serialize__SWIG_0(L);
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'Event_serialize'");
-  lua_error(L);return 0;
-}
+	static int _wrap_Event_event_get(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		switch_event_t *result = 0;
+
+		SWIG_check_num_args("event", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("event", 1, "Event *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_event_get", 1, SWIGTYPE_p_Event);
+		}
+
+		result = (switch_event_t *) ((arg1)->event);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_event_t, 0);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_setPriority__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  switch_priority_t arg2 ;
-  bool result;
-  switch_priority_t *argp2 ;
-  
-  SWIG_check_num_args("setPriority",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPriority",1,"Event *");
-  if(!lua_isuserdata(L,2)) SWIG_fail_arg("setPriority",2,"switch_priority_t");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_setPriority",1,SWIGTYPE_p_Event);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_priority_t,0))){
-    SWIG_fail_ptr("Event_setPriority",2,SWIGTYPE_p_switch_priority_t);
-  }
-  arg2 = *argp2;
-  
-  result = (bool)(arg1)->setPriority(arg2);
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Event_serialized_string_set(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("serialized_string", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("serialized_string", 1, "Event *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("serialized_string", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_serialized_string_set", 1, SWIGTYPE_p_Event);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		{
+			if (arg1->serialized_string)
+				delete[]arg1->serialized_string;
+			if (arg2) {
+				arg1->serialized_string = (char *) (new char[strlen((const char *)arg2) + 1]);
+				strcpy((char *) arg1->serialized_string, (const char *) arg2);
+			} else {
+				arg1->serialized_string = 0;
+			}
+		}
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_setPriority__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("setPriority",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPriority",1,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_setPriority",1,SWIGTYPE_p_Event);
-  }
-  
-  result = (bool)(arg1)->setPriority();
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Event_serialized_string_get(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("serialized_string", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("serialized_string", 1, "Event *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_serialized_string_get", 1, SWIGTYPE_p_Event);
+		}
+
+		result = (char *) ((arg1)->serialized_string);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_setPriority(lua_State* L) {
-  int argc;
-  int argv[3]={
-    1,2,3
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 1) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      return _wrap_Event_setPriority__SWIG_1(L);
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        void *ptr;
-        if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_switch_priority_t, 0)) {
-          _v = 0;
-        } else {
-          _v = 1;
-        }
-      }
-      if (_v) {
-        return _wrap_Event_setPriority__SWIG_0(L);
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'Event_setPriority'");
-  lua_error(L);return 0;
-}
+	static int _wrap_Event_mine_set(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		int arg2;
+
+		SWIG_check_num_args("mine", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("mine", 1, "Event *");
+		if (!lua_isnumber(L, 2))
+			SWIG_fail_arg("mine", 2, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_mine_set", 1, SWIGTYPE_p_Event);
+		}
+
+		arg2 = (int) lua_tonumber(L, 2);
+		if (arg1)
+			(arg1)->mine = arg2;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_getHeader(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("getHeader",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getHeader",1,"Event *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("getHeader",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_getHeader",1,SWIGTYPE_p_Event);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (char *)(arg1)->getHeader(arg2);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Event_mine_get(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		int result;
+
+		SWIG_check_num_args("mine", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("mine", 1, "Event *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_mine_get", 1, SWIGTYPE_p_Event);
+		}
+
+		result = (int) ((arg1)->mine);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_getBody(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("getBody",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getBody",1,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_getBody",1,SWIGTYPE_p_Event);
-  }
-  
-  result = (char *)(arg1)->getBody();
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_new_Event__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		char *arg1 = (char *) 0;
+		char *arg2 = (char *) 0;
+		Event *result = 0;
+
+		SWIG_check_num_args("Event", 2, 2)
+			if (!lua_isstring(L, 1))
+			SWIG_fail_arg("Event", 1, "char const *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("Event", 2, "char const *");
+		arg1 = (char *) lua_tostring(L, 1);
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (Event *) new Event((char const *) arg1, (char const *) arg2);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_getType(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("getType",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getType",1,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_getType",1,SWIGTYPE_p_Event);
-  }
-  
-  result = (char *)(arg1)->getType();
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_new_Event__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		char *arg1 = (char *) 0;
+		Event *result = 0;
+
+		SWIG_check_num_args("Event", 1, 1)
+			if (!lua_isstring(L, 1))
+			SWIG_fail_arg("Event", 1, "char const *");
+		arg1 = (char *) lua_tostring(L, 1);
+		result = (Event *) new Event((char const *) arg1);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_addBody(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("addBody",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addBody",1,"Event *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("addBody",2,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_addBody",1,SWIGTYPE_p_Event);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (bool)(arg1)->addBody((char const *)arg2);
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_new_Event__SWIG_2(lua_State * L) {
+		int SWIG_arg = -1;
+		switch_event_t *arg1 = (switch_event_t *) 0;
+		int arg2;
+		Event *result = 0;
+
+		SWIG_check_num_args("Event", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("Event", 1, "switch_event_t *");
+		if (!lua_isnumber(L, 2))
+			SWIG_fail_arg("Event", 2, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_event_t, 0))) {
+			SWIG_fail_ptr("new_Event", 1, SWIGTYPE_p_switch_event_t);
+		}
+
+		arg2 = (int) lua_tonumber(L, 2);
+		result = (Event *) new Event(arg1, arg2);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_addHeader(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("addHeader",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addHeader",1,"Event *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("addHeader",2,"char const *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("addHeader",3,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_addHeader",1,SWIGTYPE_p_Event);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_new_Event__SWIG_3(lua_State * L) {
+		int SWIG_arg = -1;
+		switch_event_t *arg1 = (switch_event_t *) 0;
+		Event *result = 0;
+
+		SWIG_check_num_args("Event", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("Event", 1, "switch_event_t *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_event_t, 0))) {
+			SWIG_fail_ptr("new_Event", 1, SWIGTYPE_p_switch_event_t);
+		}
+
+		result = (Event *) new Event(arg1);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Event_delHeader(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("delHeader",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("delHeader",1,"Event *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("delHeader",2,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_delHeader",1,SWIGTYPE_p_Event);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (bool)(arg1)->delHeader((char const *)arg2);
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_new_Event(lua_State * L) {
+		int argc;
+		int argv[3] = {
+			1, 2, 3
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 1) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				return _wrap_new_Event__SWIG_3(L);
+			}
+		}
+		if (argc == 1) {
+			int _v;
+			{
+				_v = lua_isstring(L, argv[0]);
+			}
+			if (_v) {
+				return _wrap_new_Event__SWIG_1(L);
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isnumber(L, argv[1]);
+				}
+				if (_v) {
+					return _wrap_new_Event__SWIG_2(L);
+				}
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			{
+				_v = lua_isstring(L, argv[0]);
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					return _wrap_new_Event__SWIG_0(L);
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'new_Event'");
+		lua_error(L);
+		return 0;
+	}
 
 
-static int _wrap_Event_fire(lua_State* L) {
-  int SWIG_arg = -1;
-  Event *arg1 = (Event *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("fire",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("fire",1,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("Event_fire",1,SWIGTYPE_p_Event);
-  }
-  
-  result = (bool)(arg1)->fire();
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_delete_Event(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
 
+		SWIG_check_num_args("Event", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("Event", 1, "Event *");
 
-static void swig_delete_Event(void *obj) {
-Event *arg1 = (Event *) obj;
-delete arg1;
-}
-static swig_lua_method swig_Event_methods[] = {
-    {"serialize", _wrap_Event_serialize}, 
-    {"setPriority", _wrap_Event_setPriority}, 
-    {"getHeader", _wrap_Event_getHeader}, 
-    {"getBody", _wrap_Event_getBody}, 
-    {"getType", _wrap_Event_getType}, 
-    {"addBody", _wrap_Event_addBody}, 
-    {"addHeader", _wrap_Event_addHeader}, 
-    {"delHeader", _wrap_Event_delHeader}, 
-    {"fire", _wrap_Event_fire}, 
-    {0,0}
-};
-static swig_lua_attribute swig_Event_attributes[] = {
-    { "event", _wrap_Event_event_get, _wrap_Event_event_set},
-    { "serialized_string", _wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set},
-    { "mine", _wrap_Event_mine_get, _wrap_Event_mine_set},
-    {0,0,0}
-};
-static swig_lua_class *swig_Event_bases[] = {0};
-static const char *swig_Event_base_names[] = {0};
-static swig_lua_class _wrap_class_Event = { "Event", &SWIGTYPE_p_Event,_wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases, swig_Event_base_names };
-
-static int _wrap_delete_CoreSession(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  
-  SWIG_check_num_args("CoreSession",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("CoreSession",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("delete_CoreSession",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  delete arg1;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("delete_Event", 1, SWIGTYPE_p_Event);
+		}
 
+		delete arg1;
 
-static int _wrap_CoreSession_session_set(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  
-  SWIG_check_num_args("session",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("session",2,"switch_core_session_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_session_set",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("CoreSession_session_set",2,SWIGTYPE_p_switch_core_session_t);
-  }
-  
-  if (arg1) (arg1)->session = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_arg = 0;
 
+		return SWIG_arg;
 
-static int _wrap_CoreSession_session_get(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_core_session_t *result = 0 ;
-  
-  SWIG_check_num_args("session",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_session_get",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (switch_core_session_t *) ((arg1)->session);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_core_session_t,0); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (0)
+			SWIG_fail;
 
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_channel_set(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-  
-  SWIG_check_num_args("channel",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("channel",2,"switch_channel_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_channel_set",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_channel_t,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("CoreSession_channel_set",2,SWIGTYPE_p_switch_channel_t);
-  }
-  
-  if (arg1) (arg1)->channel = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_serialize__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("serialize", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("serialize", 1, "Event *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("serialize", 2, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_serialize", 1, SWIGTYPE_p_Event);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (char *) (arg1)->serialize((char const *) arg2);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_channel_get(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_t *result = 0 ;
-  
-  SWIG_check_num_args("channel",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_channel_get",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (switch_channel_t *) ((arg1)->channel);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_channel_t,0); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_serialize__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("serialize", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("serialize", 1, "Event *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_serialize", 1, SWIGTYPE_p_Event);
+		}
+
+		result = (char *) (arg1)->serialize();
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_flags_set(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  unsigned int arg2 ;
-  
-  SWIG_check_num_args("flags",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *");
-  if(!lua_isnumber(L,2)) SWIG_fail_arg("flags",2,"unsigned int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_flags_set",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (unsigned int)lua_tonumber(L, 2);
-  if (arg1) (arg1)->flags = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_serialize(lua_State * L) {
+		int argc;
+		int argv[3] = {
+			1, 2, 3
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 1) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				return _wrap_Event_serialize__SWIG_1(L);
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					return _wrap_Event_serialize__SWIG_0(L);
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'Event_serialize'");
+		lua_error(L);
+		return 0;
+	}
 
-static int _wrap_CoreSession_flags_get(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  unsigned int result;
-  
-  SWIG_check_num_args("flags",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_flags_get",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (unsigned int) ((arg1)->flags);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_setPriority__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		switch_priority_t arg2;
+		bool result;
+		switch_priority_t *argp2;
+
+		SWIG_check_num_args("setPriority", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setPriority", 1, "Event *");
+		if (!lua_isuserdata(L, 2))
+			SWIG_fail_arg("setPriority", 2, "switch_priority_t");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_setPriority", 1, SWIGTYPE_p_Event);
+		}
+
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &argp2, SWIGTYPE_p_switch_priority_t, 0))) {
+			SWIG_fail_ptr("Event_setPriority", 2, SWIGTYPE_p_switch_priority_t);
+		}
+		arg2 = *argp2;
+
+		result = (bool) (arg1)->setPriority(arg2);
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_allocated_set(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  
-  SWIG_check_num_args("allocated",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *");
-  if(!lua_isnumber(L,2)) SWIG_fail_arg("allocated",2,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_allocated_set",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (int)lua_tonumber(L, 2);
-  if (arg1) (arg1)->allocated = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_setPriority__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		bool result;
+
+		SWIG_check_num_args("setPriority", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setPriority", 1, "Event *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_setPriority", 1, SWIGTYPE_p_Event);
+		}
+
+		result = (bool) (arg1)->setPriority();
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_allocated_get(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("allocated",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_allocated_get",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (int) ((arg1)->allocated);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_setPriority(lua_State * L) {
+		int argc;
+		int argv[3] = {
+			1, 2, 3
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 1) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				return _wrap_Event_setPriority__SWIG_1(L);
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					void *ptr;
+					if (lua_isuserdata(L, argv[1]) == 0 || SWIG_ConvertPtr(L, argv[1], (void **) &ptr, SWIGTYPE_p_switch_priority_t, 0)) {
+						_v = 0;
+					} else {
+						_v = 1;
+					}
+				}
+				if (_v) {
+					return _wrap_Event_setPriority__SWIG_0(L);
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'Event_setPriority'");
+		lua_error(L);
+		return 0;
+	}
 
-static int _wrap_CoreSession_cb_state_set(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  input_callback_state *arg2 = (input_callback_state *) 0 ;
-  
-  SWIG_check_num_args("cb_state",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cb_state",2,"input_callback_state *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_cb_state_set",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_input_callback_state,0))){
-    SWIG_fail_ptr("CoreSession_cb_state_set",2,SWIGTYPE_p_input_callback_state);
-  }
-  
-  if (arg1) (arg1)->cb_state = *arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_getHeader(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("getHeader", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("getHeader", 1, "Event *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("getHeader", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_getHeader", 1, SWIGTYPE_p_Event);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (char *) (arg1)->getHeader(arg2);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_cb_state_get(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  input_callback_state *result = 0 ;
-  
-  SWIG_check_num_args("cb_state",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_cb_state_get",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (input_callback_state *)& ((arg1)->cb_state);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,0); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_getBody(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("getBody", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("getBody", 1, "Event *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_getBody", 1, SWIGTYPE_p_Event);
+		}
+
+		result = (char *) (arg1)->getBody();
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_hook_state_set(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_state_t arg2 ;
-  switch_channel_state_t *argp2 ;
-  
-  SWIG_check_num_args("hook_state",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *");
-  if(!lua_isuserdata(L,2)) SWIG_fail_arg("hook_state",2,"switch_channel_state_t");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_hook_state_set",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_channel_state_t,0))){
-    SWIG_fail_ptr("CoreSession_hook_state_set",2,SWIGTYPE_p_switch_channel_state_t);
-  }
-  arg2 = *argp2;
-  
-  if (arg1) (arg1)->hook_state = arg2;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_getType(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("getType", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("getType", 1, "Event *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_getType", 1, SWIGTYPE_p_Event);
+		}
+
+		result = (char *) (arg1)->getType();
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_hook_state_get(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_state_t result;
-  
-  SWIG_check_num_args("hook_state",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_hook_state_get",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result =  ((arg1)->hook_state);
-  SWIG_arg=0;
-  {
-    switch_channel_state_t * resultptr = new switch_channel_state_t((switch_channel_state_t &) result);
-    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_channel_state_t,1); SWIG_arg++;
-  }
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_addBody(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		bool result;
+
+		SWIG_check_num_args("addBody", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("addBody", 1, "Event *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("addBody", 2, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_addBody", 1, SWIGTYPE_p_Event);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (bool) (arg1)->addBody((char const *) arg2);
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_answer(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("answer",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("answer",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_answer",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (int)(arg1)->answer();
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_addHeader(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		bool result;
+
+		SWIG_check_num_args("addHeader", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("addHeader", 1, "Event *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("addHeader", 2, "char const *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("addHeader", 3, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_addHeader", 1, SWIGTYPE_p_Event);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		result = (bool) (arg1)->addHeader((char const *) arg2, (char const *) arg3);
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_preAnswer(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("preAnswer",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("preAnswer",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_preAnswer",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (int)(arg1)->preAnswer();
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_delHeader(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		bool result;
+
+		SWIG_check_num_args("delHeader", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("delHeader", 1, "Event *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("delHeader", 2, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_delHeader", 1, SWIGTYPE_p_Event);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (bool) (arg1)->delHeader((char const *) arg2);
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_hangup__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("hangup",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("hangup",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_hangup",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  (arg1)->hangup(arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_Event_fire(lua_State * L) {
+		int SWIG_arg = -1;
+		Event *arg1 = (Event *) 0;
+		bool result;
+
+		SWIG_check_num_args("fire", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("fire", 1, "Event *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("Event_fire", 1, SWIGTYPE_p_Event);
+		}
+
+		result = (bool) (arg1)->fire();
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_hangup__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  
-  SWIG_check_num_args("hangup",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_hangup",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  (arg1)->hangup();
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static void swig_delete_Event(void *obj) {
+		Event *arg1 = (Event *) obj;
+		delete arg1;
+	}
+	static swig_lua_method swig_Event_methods[] = {
+		{"serialize", _wrap_Event_serialize},
+		{"setPriority", _wrap_Event_setPriority},
+		{"getHeader", _wrap_Event_getHeader},
+		{"getBody", _wrap_Event_getBody},
+		{"getType", _wrap_Event_getType},
+		{"addBody", _wrap_Event_addBody},
+		{"addHeader", _wrap_Event_addHeader},
+		{"delHeader", _wrap_Event_delHeader},
+		{"fire", _wrap_Event_fire},
+		{0, 0}
+	};
+	static swig_lua_attribute swig_Event_attributes[] = {
+		{"event", _wrap_Event_event_get, _wrap_Event_event_set},
+		{"serialized_string", _wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set},
+		{"mine", _wrap_Event_mine_get, _wrap_Event_mine_set},
+		{0, 0, 0}
+	};
+	static swig_lua_class *swig_Event_bases[] = { 0 };
+	static const char *swig_Event_base_names[] = { 0 };
+	static swig_lua_class _wrap_class_Event =
+		{ "Event", &SWIGTYPE_p_Event, _wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases,
+swig_Event_base_names };
+
+	static int _wrap_delete_CoreSession(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+
+		SWIG_check_num_args("CoreSession", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("CoreSession", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("delete_CoreSession", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		delete arg1;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_hangup(lua_State* L) {
-  int argc;
-  int argv[3]={
-    1,2,3
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 1) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      return _wrap_CoreSession_hangup__SWIG_1(L);
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        return _wrap_CoreSession_hangup__SWIG_0(L);
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'CoreSession_hangup'");
-  lua_error(L);return 0;
-}
 
+	static int _wrap_CoreSession_session_set(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_core_session_t *arg2 = (switch_core_session_t *) 0;
 
-static int _wrap_CoreSession_setVariable(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  SWIG_check_num_args("setVariable",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setVariable",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("setVariable",2,"char *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("setVariable",3,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_setVariable",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->setVariable(arg2,arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_check_num_args("session", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("session", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("session", 2, "switch_core_session_t *");
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_session_set", 1, SWIGTYPE_p_CoreSession);
+		}
 
-static int _wrap_CoreSession_setPrivate(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = (void *) 0 ;
-  
-  SWIG_check_num_args("setPrivate",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPrivate",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("setPrivate",2,"char *");
-  if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("setPrivate",3,"void *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_setPrivate",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3=(void *)SWIG_MustGetPtr(L,3,0,0,3,"CoreSession_setPrivate");
-  (arg1)->setPrivate(arg2,arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("CoreSession_session_set", 2, SWIGTYPE_p_switch_core_session_t);
+		}
 
-static int _wrap_CoreSession_getPrivate(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *result = 0 ;
-  
-  SWIG_check_num_args("getPrivate",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getPrivate",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("getPrivate",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_getPrivate",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (void *)(arg1)->getPrivate(arg2);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (arg1)
+			(arg1)->session = arg2;
 
+		SWIG_arg = 0;
 
-static int _wrap_CoreSession_getVariable(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("getVariable",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getVariable",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("getVariable",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_getVariable",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (char *)(arg1)->getVariable(arg2);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		return SWIG_arg;
 
+		if (0)
+			SWIG_fail;
 
-static int _wrap_CoreSession_process_callback_result(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  SWIG_check_num_args("process_callback_result",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("process_callback_result",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("process_callback_result",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_process_callback_result",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (arg1)->process_callback_result(arg2);
-  SWIG_arg=0;
-  {
-    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
-    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
-  }
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_CoreSession_say(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  
-  SWIG_check_num_args("say",5,5)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("say",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("say",2,"char const *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("say",3,"char const *");
-  if(!lua_isstring(L,4)) SWIG_fail_arg("say",4,"char const *");
-  if(!lua_isstring(L,5)) SWIG_fail_arg("say",5,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_say",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  arg4 = (char *)lua_tostring(L, 4);
-  arg5 = (char *)lua_tostring(L, 5);
-  (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_CoreSession_session_get(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_core_session_t *result = 0;
+
+		SWIG_check_num_args("session", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("session", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_session_get", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (switch_core_session_t *) ((arg1)->session);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_core_session_t, 0);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_CoreSession_sayPhrase__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  
-  SWIG_check_num_args("sayPhrase",4,4)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *");
-  if(!lua_isstring(L,4)) SWIG_fail_arg("sayPhrase",4,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  arg4 = (char *)lua_tostring(L, 4);
-  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_CoreSession_channel_set(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_channel_t *arg2 = (switch_channel_t *) 0;
 
+		SWIG_check_num_args("channel", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("channel", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("channel", 2, "switch_channel_t *");
 
-static int _wrap_CoreSession_sayPhrase__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  SWIG_check_num_args("sayPhrase",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_channel_set", 1, SWIGTYPE_p_CoreSession);
+		}
 
 
-static int _wrap_CoreSession_sayPhrase__SWIG_2(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("sayPhrase",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  (arg1)->sayPhrase((char const *)arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("CoreSession_channel_set", 2, SWIGTYPE_p_switch_channel_t);
+		}
 
+		if (arg1)
+			(arg1)->channel = arg2;
 
-static int _wrap_CoreSession_sayPhrase(lua_State* L) {
-  int argc;
-  int argv[5]={
-    1,2,3,4,5
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 2) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        return _wrap_CoreSession_sayPhrase__SWIG_2(L);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        {
-          _v = lua_isstring(L,argv[2]);
-        }
-        if (_v) {
-          return _wrap_CoreSession_sayPhrase__SWIG_1(L);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        {
-          _v = lua_isstring(L,argv[2]);
-        }
-        if (_v) {
-          {
-            _v = lua_isstring(L,argv[3]);
-          }
-          if (_v) {
-            return _wrap_CoreSession_sayPhrase__SWIG_0(L);
-          }
-        }
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'CoreSession_sayPhrase'");
-  lua_error(L);return 0;
-}
+		SWIG_arg = 0;
 
+		return SWIG_arg;
 
-static int _wrap_CoreSession_recordFile__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int arg4 ;
-  int arg5 ;
-  int result;
-  
-  SWIG_check_num_args("recordFile",5,5)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
-  if(!lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int");
-  if(!lua_isnumber(L,4)) SWIG_fail_arg("recordFile",4,"int");
-  if(!lua_isnumber(L,5)) SWIG_fail_arg("recordFile",5,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (int)lua_tonumber(L, 3);
-  arg4 = (int)lua_tonumber(L, 4);
-  arg5 = (int)lua_tonumber(L, 5);
-  result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (0)
+			SWIG_fail;
 
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_recordFile__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int arg4 ;
-  int result;
-  
-  SWIG_check_num_args("recordFile",4,4)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
-  if(!lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int");
-  if(!lua_isnumber(L,4)) SWIG_fail_arg("recordFile",4,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (int)lua_tonumber(L, 3);
-  arg4 = (int)lua_tonumber(L, 4);
-  result = (int)(arg1)->recordFile(arg2,arg3,arg4);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_channel_get(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_channel_t *result = 0;
+
+		SWIG_check_num_args("channel", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("channel", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_channel_get", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (switch_channel_t *) ((arg1)->channel);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_channel_t, 0);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_recordFile__SWIG_2(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int result;
-  
-  SWIG_check_num_args("recordFile",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
-  if(!lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (int)lua_tonumber(L, 3);
-  result = (int)(arg1)->recordFile(arg2,arg3);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_flags_set(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		unsigned int arg2;
+
+		SWIG_check_num_args("flags", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("flags", 1, "CoreSession *");
+		if (!lua_isnumber(L, 2))
+			SWIG_fail_arg("flags", 2, "unsigned int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_flags_set", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (unsigned int) lua_tonumber(L, 2);
+		if (arg1)
+			(arg1)->flags = arg2;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_recordFile__SWIG_3(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("recordFile",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (int)(arg1)->recordFile(arg2);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_flags_get(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		unsigned int result;
+
+		SWIG_check_num_args("flags", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("flags", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_flags_get", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (unsigned int) ((arg1)->flags);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_recordFile(lua_State* L) {
-  int argc;
-  int argv[6]={
-    1,2,3,4,5,6
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 2) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        return _wrap_CoreSession_recordFile__SWIG_3(L);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        {
-          _v = lua_isnumber(L,argv[2]);
-        }
-        if (_v) {
-          return _wrap_CoreSession_recordFile__SWIG_2(L);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        {
-          _v = lua_isnumber(L,argv[2]);
-        }
-        if (_v) {
-          {
-            _v = lua_isnumber(L,argv[3]);
-          }
-          if (_v) {
-            return _wrap_CoreSession_recordFile__SWIG_1(L);
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        {
-          _v = lua_isnumber(L,argv[2]);
-        }
-        if (_v) {
-          {
-            _v = lua_isnumber(L,argv[3]);
-          }
-          if (_v) {
-            {
-              _v = lua_isnumber(L,argv[4]);
-            }
-            if (_v) {
-              return _wrap_CoreSession_recordFile__SWIG_0(L);
-            }
-          }
-        }
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'CoreSession_recordFile'");
-  lua_error(L);return 0;
-}
 
+	static int _wrap_CoreSession_allocated_set(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+
+		SWIG_check_num_args("allocated", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("allocated", 1, "CoreSession *");
+		if (!lua_isnumber(L, 2))
+			SWIG_fail_arg("allocated", 2, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_allocated_set", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (int) lua_tonumber(L, 2);
+		if (arg1)
+			(arg1)->allocated = arg2;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_allocated_get(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+
+		SWIG_check_num_args("allocated", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("allocated", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_allocated_get", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (int) ((arg1)->allocated);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_cb_state_set(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		input_callback_state *arg2 = (input_callback_state *) 0;
+
+		SWIG_check_num_args("cb_state", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("cb_state", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("cb_state", 2, "input_callback_state *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_cb_state_set", 1, SWIGTYPE_p_CoreSession);
+		}
+
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_input_callback_state, 0))) {
+			SWIG_fail_ptr("CoreSession_cb_state_set", 2, SWIGTYPE_p_input_callback_state);
+		}
+
+		if (arg1)
+			(arg1)->cb_state = *arg2;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_cb_state_get(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		input_callback_state *result = 0;
+
+		SWIG_check_num_args("cb_state", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("cb_state", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_cb_state_get", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (input_callback_state *) & ((arg1)->cb_state);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_input_callback_state, 0);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_hook_state_set(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_channel_state_t arg2;
+		switch_channel_state_t *argp2;
+
+		SWIG_check_num_args("hook_state", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("hook_state", 1, "CoreSession *");
+		if (!lua_isuserdata(L, 2))
+			SWIG_fail_arg("hook_state", 2, "switch_channel_state_t");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_hook_state_set", 1, SWIGTYPE_p_CoreSession);
+		}
+
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &argp2, SWIGTYPE_p_switch_channel_state_t, 0))) {
+			SWIG_fail_ptr("CoreSession_hook_state_set", 2, SWIGTYPE_p_switch_channel_state_t);
+		}
+		arg2 = *argp2;
+
+		if (arg1)
+			(arg1)->hook_state = arg2;
+
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_setCallerData(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  SWIG_check_num_args("setCallerData",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setCallerData",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("setCallerData",2,"char *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("setCallerData",3,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_setCallerData",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->setCallerData(arg2,arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_hook_state_get(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_channel_state_t result;
+
+		SWIG_check_num_args("hook_state", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("hook_state", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_hook_state_get", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = ((arg1)->hook_state);
+		SWIG_arg = 0;
+		{
+			switch_channel_state_t *resultptr = new switch_channel_state_t ((switch_channel_state_t &) result);
+			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_channel_state_t, 1);
+			SWIG_arg++;
+		}
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_answer(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+
+		SWIG_check_num_args("answer", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("answer", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_answer", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (int) (arg1)->answer();
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_preAnswer(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+
+		SWIG_check_num_args("preAnswer", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("preAnswer", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_preAnswer", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (int) (arg1)->preAnswer();
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_hangup__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("hangup", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("hangup", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("hangup", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_hangup", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		(arg1)->hangup(arg2);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_hangup__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+
+		SWIG_check_num_args("hangup", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("hangup", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_hangup", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		(arg1)->hangup();
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_hangup(lua_State * L) {
+		int argc;
+		int argv[3] = {
+			1, 2, 3
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 1) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				return _wrap_CoreSession_hangup__SWIG_1(L);
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					return _wrap_CoreSession_hangup__SWIG_0(L);
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'CoreSession_hangup'");
+		lua_error(L);
+		return 0;
+	}
+
+
+	static int _wrap_CoreSession_setVariable(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+
+		SWIG_check_num_args("setVariable", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setVariable", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("setVariable", 2, "char *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("setVariable", 3, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_setVariable", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		(arg1)->setVariable(arg2, arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_setPrivate(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		void *arg3 = (void *) 0;
+
+		SWIG_check_num_args("setPrivate", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setPrivate", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("setPrivate", 2, "char *");
+		if (!SWIG_isptrtype(L, 3))
+			SWIG_fail_arg("setPrivate", 3, "void *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_setPrivate", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (void *) SWIG_MustGetPtr(L, 3, 0, 0, 3, "CoreSession_setPrivate");
+		(arg1)->setPrivate(arg2, arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_getPrivate(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		void *result = 0;
+
+		SWIG_check_num_args("getPrivate", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("getPrivate", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("getPrivate", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_getPrivate", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (void *) (arg1)->getPrivate(arg2);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_getVariable(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("getVariable", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("getVariable", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("getVariable", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_getVariable", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (char *) (arg1)->getVariable(arg2);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_process_callback_result(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		switch_status_t result;
+
+		SWIG_check_num_args("process_callback_result", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("process_callback_result", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("process_callback_result", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_process_callback_result", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (arg1)->process_callback_result(arg2);
+		SWIG_arg = 0;
+		{
+			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+			SWIG_arg++;
+		}
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_say(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+		char *arg5 = (char *) 0;
+
+		SWIG_check_num_args("say", 5, 5)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("say", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("say", 2, "char const *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("say", 3, "char const *");
+		if (!lua_isstring(L, 4))
+			SWIG_fail_arg("say", 4, "char const *");
+		if (!lua_isstring(L, 5))
+			SWIG_fail_arg("say", 5, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_say", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		arg4 = (char *) lua_tostring(L, 4);
+		arg5 = (char *) lua_tostring(L, 5);
+		(arg1)->say((char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_sayPhrase__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+
+		SWIG_check_num_args("sayPhrase", 4, 4)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("sayPhrase", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("sayPhrase", 2, "char const *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("sayPhrase", 3, "char const *");
+		if (!lua_isstring(L, 4))
+			SWIG_fail_arg("sayPhrase", 4, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_sayPhrase", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		arg4 = (char *) lua_tostring(L, 4);
+		(arg1)->sayPhrase((char const *) arg2, (char const *) arg3, (char const *) arg4);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_sayPhrase__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+
+		SWIG_check_num_args("sayPhrase", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("sayPhrase", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("sayPhrase", 2, "char const *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("sayPhrase", 3, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_sayPhrase", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		(arg1)->sayPhrase((char const *) arg2, (char const *) arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_sayPhrase__SWIG_2(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("sayPhrase", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("sayPhrase", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("sayPhrase", 2, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_sayPhrase", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		(arg1)->sayPhrase((char const *) arg2);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_sayPhrase(lua_State * L) {
+		int argc;
+		int argv[5] = {
+			1, 2, 3, 4, 5
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 2) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					return _wrap_CoreSession_sayPhrase__SWIG_2(L);
+				}
+			}
+		}
+		if (argc == 3) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					{
+						_v = lua_isstring(L, argv[2]);
+					}
+					if (_v) {
+						return _wrap_CoreSession_sayPhrase__SWIG_1(L);
+					}
+				}
+			}
+		}
+		if (argc == 4) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					{
+						_v = lua_isstring(L, argv[2]);
+					}
+					if (_v) {
+						{
+							_v = lua_isstring(L, argv[3]);
+						}
+						if (_v) {
+							return _wrap_CoreSession_sayPhrase__SWIG_0(L);
+						}
+					}
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'CoreSession_sayPhrase'");
+		lua_error(L);
+		return 0;
+	}
+
+
+	static int _wrap_CoreSession_recordFile__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int arg3;
+		int arg4;
+		int arg5;
+		int result;
+
+		SWIG_check_num_args("recordFile", 5, 5)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("recordFile", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("recordFile", 2, "char *");
+		if (!lua_isnumber(L, 3))
+			SWIG_fail_arg("recordFile", 3, "int");
+		if (!lua_isnumber(L, 4))
+			SWIG_fail_arg("recordFile", 4, "int");
+		if (!lua_isnumber(L, 5))
+			SWIG_fail_arg("recordFile", 5, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (int) lua_tonumber(L, 3);
+		arg4 = (int) lua_tonumber(L, 4);
+		arg5 = (int) lua_tonumber(L, 5);
+		result = (int) (arg1)->recordFile(arg2, arg3, arg4, arg5);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_recordFile__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int arg3;
+		int arg4;
+		int result;
+
+		SWIG_check_num_args("recordFile", 4, 4)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("recordFile", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("recordFile", 2, "char *");
+		if (!lua_isnumber(L, 3))
+			SWIG_fail_arg("recordFile", 3, "int");
+		if (!lua_isnumber(L, 4))
+			SWIG_fail_arg("recordFile", 4, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (int) lua_tonumber(L, 3);
+		arg4 = (int) lua_tonumber(L, 4);
+		result = (int) (arg1)->recordFile(arg2, arg3, arg4);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_recordFile__SWIG_2(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int arg3;
+		int result;
+
+		SWIG_check_num_args("recordFile", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("recordFile", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("recordFile", 2, "char *");
+		if (!lua_isnumber(L, 3))
+			SWIG_fail_arg("recordFile", 3, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (int) lua_tonumber(L, 3);
+		result = (int) (arg1)->recordFile(arg2, arg3);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_recordFile__SWIG_3(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int result;
+
+		SWIG_check_num_args("recordFile", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("recordFile", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("recordFile", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (int) (arg1)->recordFile(arg2);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_recordFile(lua_State * L) {
+		int argc;
+		int argv[6] = {
+			1, 2, 3, 4, 5, 6
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 2) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					return _wrap_CoreSession_recordFile__SWIG_3(L);
+				}
+			}
+		}
+		if (argc == 3) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					{
+						_v = lua_isnumber(L, argv[2]);
+					}
+					if (_v) {
+						return _wrap_CoreSession_recordFile__SWIG_2(L);
+					}
+				}
+			}
+		}
+		if (argc == 4) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					{
+						_v = lua_isnumber(L, argv[2]);
+					}
+					if (_v) {
+						{
+							_v = lua_isnumber(L, argv[3]);
+						}
+						if (_v) {
+							return _wrap_CoreSession_recordFile__SWIG_1(L);
+						}
+					}
+				}
+			}
+		}
+		if (argc == 5) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					{
+						_v = lua_isnumber(L, argv[2]);
+					}
+					if (_v) {
+						{
+							_v = lua_isnumber(L, argv[3]);
+						}
+						if (_v) {
+							{
+								_v = lua_isnumber(L, argv[4]);
+							}
+							if (_v) {
+								return _wrap_CoreSession_recordFile__SWIG_0(L);
+							}
+						}
+					}
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'CoreSession_recordFile'");
+		lua_error(L);
+		return 0;
+	}
+
+
+	static int _wrap_CoreSession_setCallerData(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+
+		SWIG_check_num_args("setCallerData", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setCallerData", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("setCallerData", 2, "char *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("setCallerData", 3, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_setCallerData", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		(arg1)->setCallerData(arg2, arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_originate__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		CoreSession *arg2 = (CoreSession *) 0;
+		char *arg3 = (char *) 0;
+		int arg4;
+		int result;
+
+		SWIG_check_num_args("originate", 4, 4)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("originate", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("originate", 2, "CoreSession *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("originate", 3, "char *");
+		if (!lua_isnumber(L, 4))
+			SWIG_fail_arg("originate", 4, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_originate", 1, SWIGTYPE_p_CoreSession);
+		}
+
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_originate", 2, SWIGTYPE_p_CoreSession);
+		}
+
+		arg3 = (char *) lua_tostring(L, 3);
+		arg4 = (int) lua_tonumber(L, 4);
+		result = (int) (arg1)->originate(arg2, arg3, arg4);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_originate__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		CoreSession *arg2 = (CoreSession *) 0;
+		char *arg3 = (char *) 0;
+		int result;
+
+		SWIG_check_num_args("originate", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("originate", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("originate", 2, "CoreSession *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("originate", 3, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_originate", 1, SWIGTYPE_p_CoreSession);
+		}
+
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_originate", 2, SWIGTYPE_p_CoreSession);
+		}
+
+		arg3 = (char *) lua_tostring(L, 3);
+		result = (int) (arg1)->originate(arg2, arg3);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_originate(lua_State * L) {
+		int argc;
+		int argv[5] = {
+			1, 2, 3, 4, 5
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 3) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					void *ptr;
+					if (SWIG_isptrtype(L, argv[1]) == 0 || SWIG_ConvertPtr(L, argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+						_v = 0;
+					} else {
+						_v = 1;
+					}
+				}
+				if (_v) {
+					{
+						_v = lua_isstring(L, argv[2]);
+					}
+					if (_v) {
+						return _wrap_CoreSession_originate__SWIG_1(L);
+					}
+				}
+			}
+		}
+		if (argc == 4) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					void *ptr;
+					if (SWIG_isptrtype(L, argv[1]) == 0 || SWIG_ConvertPtr(L, argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+						_v = 0;
+					} else {
+						_v = 1;
+					}
+				}
+				if (_v) {
+					{
+						_v = lua_isstring(L, argv[2]);
+					}
+					if (_v) {
+						{
+							_v = lua_isnumber(L, argv[3]);
+						}
+						if (_v) {
+							return _wrap_CoreSession_originate__SWIG_0(L);
+						}
+					}
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'CoreSession_originate'");
+		lua_error(L);
+		return 0;
+	}
+
+
+	static int _wrap_CoreSession_setDTMFCallback(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		void *arg2 = (void *) 0;
+		char *arg3 = (char *) 0;
+
+		SWIG_check_num_args("setDTMFCallback", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setDTMFCallback", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("setDTMFCallback", 2, "void *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("setDTMFCallback", 3, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_setDTMFCallback", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "CoreSession_setDTMFCallback");
+		arg3 = (char *) lua_tostring(L, 3);
+		(arg1)->setDTMFCallback(arg2, arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_speak(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int result;
+
+		SWIG_check_num_args("speak", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("speak", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("speak", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_speak", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (int) (arg1)->speak(arg2);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_set_tts_parms(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+
+		SWIG_check_num_args("set_tts_parms", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("set_tts_parms", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("set_tts_parms", 2, "char *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("set_tts_parms", 3, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_set_tts_parms", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		(arg1)->set_tts_parms(arg2, arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_collectDigits(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+		int result;
+
+		SWIG_check_num_args("collectDigits", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("collectDigits", 1, "CoreSession *");
+		if (!lua_isnumber(L, 2))
+			SWIG_fail_arg("collectDigits", 2, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_collectDigits", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (int) lua_tonumber(L, 2);
+		result = (int) (arg1)->collectDigits(arg2);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_getDigits(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+		char *arg3 = (char *) 0;
+		int arg4;
+		char *result = 0;
+
+		SWIG_check_num_args("getDigits", 4, 4)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("getDigits", 1, "CoreSession *");
+		if (!lua_isnumber(L, 2))
+			SWIG_fail_arg("getDigits", 2, "int");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("getDigits", 3, "char *");
+		if (!lua_isnumber(L, 4))
+			SWIG_fail_arg("getDigits", 4, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_getDigits", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (int) lua_tonumber(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		arg4 = (int) lua_tonumber(L, 4);
+		result = (char *) (arg1)->getDigits(arg2, arg3, arg4);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_transfer(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+		int result;
+
+		SWIG_check_num_args("transfer", 4, 4)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("transfer", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("transfer", 2, "char *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("transfer", 3, "char *");
+		if (!lua_isstring(L, 4))
+			SWIG_fail_arg("transfer", 4, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_transfer", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		arg4 = (char *) lua_tostring(L, 4);
+		result = (int) (arg1)->transfer(arg2, arg3, arg4);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_read(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+		int arg3;
+		char *arg4 = (char *) 0;
+		int arg5;
+		char *arg6 = (char *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("read", 6, 6)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("read", 1, "CoreSession *");
+		if (!lua_isnumber(L, 2))
+			SWIG_fail_arg("read", 2, "int");
+		if (!lua_isnumber(L, 3))
+			SWIG_fail_arg("read", 3, "int");
+		if (!lua_isstring(L, 4))
+			SWIG_fail_arg("read", 4, "char const *");
+		if (!lua_isnumber(L, 5))
+			SWIG_fail_arg("read", 5, "int");
+		if (!lua_isstring(L, 6))
+			SWIG_fail_arg("read", 6, "char const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_read", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (int) lua_tonumber(L, 2);
+		arg3 = (int) lua_tonumber(L, 3);
+		arg4 = (char *) lua_tostring(L, 4);
+		arg5 = (int) lua_tonumber(L, 5);
+		arg6 = (char *) lua_tostring(L, 6);
+		result = (char *) (arg1)->read(arg2, arg3, (char const *) arg4, arg5, (char const *) arg6);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_playAndGetDigits(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+		int arg3;
+		int arg4;
+		int arg5;
+		char *arg6 = (char *) 0;
+		char *arg7 = (char *) 0;
+		char *arg8 = (char *) 0;
+		char *arg9 = (char *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("playAndGetDigits", 9, 9)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("playAndGetDigits", 1, "CoreSession *");
+		if (!lua_isnumber(L, 2))
+			SWIG_fail_arg("playAndGetDigits", 2, "int");
+		if (!lua_isnumber(L, 3))
+			SWIG_fail_arg("playAndGetDigits", 3, "int");
+		if (!lua_isnumber(L, 4))
+			SWIG_fail_arg("playAndGetDigits", 4, "int");
+		if (!lua_isnumber(L, 5))
+			SWIG_fail_arg("playAndGetDigits", 5, "int");
+		if (!lua_isstring(L, 6))
+			SWIG_fail_arg("playAndGetDigits", 6, "char *");
+		if (!lua_isstring(L, 7))
+			SWIG_fail_arg("playAndGetDigits", 7, "char *");
+		if (!lua_isstring(L, 8))
+			SWIG_fail_arg("playAndGetDigits", 8, "char *");
+		if (!lua_isstring(L, 9))
+			SWIG_fail_arg("playAndGetDigits", 9, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_playAndGetDigits", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (int) lua_tonumber(L, 2);
+		arg3 = (int) lua_tonumber(L, 3);
+		arg4 = (int) lua_tonumber(L, 4);
+		arg5 = (int) lua_tonumber(L, 5);
+		arg6 = (char *) lua_tostring(L, 6);
+		arg7 = (char *) lua_tostring(L, 7);
+		arg8 = (char *) lua_tostring(L, 8);
+		arg9 = (char *) lua_tostring(L, 9);
+		result = (char *) (arg1)->playAndGetDigits(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_streamFile__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int arg3;
+		int result;
+
+		SWIG_check_num_args("streamFile", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("streamFile", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("streamFile", 2, "char *");
+		if (!lua_isnumber(L, 3))
+			SWIG_fail_arg("streamFile", 3, "int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_streamFile", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (int) lua_tonumber(L, 3);
+		result = (int) (arg1)->streamFile(arg2, arg3);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_streamFile__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int result;
+
+		SWIG_check_num_args("streamFile", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("streamFile", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("streamFile", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_streamFile", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		result = (int) (arg1)->streamFile(arg2);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_streamFile(lua_State * L) {
+		int argc;
+		int argv[4] = {
+			1, 2, 3, 4
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 2) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					return _wrap_CoreSession_streamFile__SWIG_1(L);
+				}
+			}
+		}
+		if (argc == 3) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					{
+						_v = lua_isnumber(L, argv[2]);
+					}
+					if (_v) {
+						return _wrap_CoreSession_streamFile__SWIG_0(L);
+					}
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'CoreSession_streamFile'");
+		lua_error(L);
+		return 0;
+	}
+
+
+	static int _wrap_CoreSession_flushEvents(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+
+		SWIG_check_num_args("flushEvents", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("flushEvents", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_flushEvents", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (int) (arg1)->flushEvents();
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_flushDigits(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+
+		SWIG_check_num_args("flushDigits", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("flushDigits", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_flushDigits", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (int) (arg1)->flushDigits();
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_setAutoHangup(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		bool arg2;
+		int result;
+
+		SWIG_check_num_args("setAutoHangup", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setAutoHangup", 1, "CoreSession *");
+		if (!lua_isboolean(L, 2))
+			SWIG_fail_arg("setAutoHangup", 2, "bool");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_setAutoHangup", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (lua_toboolean(L, 2) != 0);
+		result = (int) (arg1)->setAutoHangup(arg2);
+		SWIG_arg = 0;
+		lua_pushnumber(L, (lua_Number) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_setHangupHook(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		void *arg2 = (void *) 0;
+
+		SWIG_check_num_args("setHangupHook", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setHangupHook", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("setHangupHook", 2, "void *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_setHangupHook", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "CoreSession_setHangupHook");
+		(arg1)->setHangupHook(arg2);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_ready(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		bool result;
+
+		SWIG_check_num_args("ready", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("ready", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_ready", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (bool) (arg1)->ready();
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_execute__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+
+		SWIG_check_num_args("execute", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("execute", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("execute", 2, "char *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("execute", 3, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_execute", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		(arg1)->execute(arg2, arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_execute__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("execute", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("execute", 1, "CoreSession *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("execute", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_execute", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		(arg1)->execute(arg2);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
+
+
+	static int _wrap_CoreSession_execute(lua_State * L) {
+		int argc;
+		int argv[4] = {
+			1, 2, 3, 4
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 2) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					return _wrap_CoreSession_execute__SWIG_1(L);
+				}
+			}
+		}
+		if (argc == 3) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					{
+						_v = lua_isstring(L, argv[2]);
+					}
+					if (_v) {
+						return _wrap_CoreSession_execute__SWIG_0(L);
+					}
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'CoreSession_execute'");
+		lua_error(L);
+		return 0;
+	}
 
-static int _wrap_CoreSession_originate__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  CoreSession *arg2 = (CoreSession *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  int result;
-  
-  SWIG_check_num_args("originate",4,4)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *");
-  if(!lua_isnumber(L,4)) SWIG_fail_arg("originate",4,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_originate",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_originate",2,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg3 = (char *)lua_tostring(L, 3);
-  arg4 = (int)lua_tonumber(L, 4);
-  result = (int)(arg1)->originate(arg2,arg3,arg4);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_sendEvent(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		Event *arg2 = (Event *) 0;
 
-static int _wrap_CoreSession_originate__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  CoreSession *arg2 = (CoreSession *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("originate",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_originate",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_originate",2,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg3 = (char *)lua_tostring(L, 3);
-  result = (int)(arg1)->originate(arg2,arg3);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_check_num_args("sendEvent", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("sendEvent", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("sendEvent", 2, "Event *");
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_sendEvent", 1, SWIGTYPE_p_CoreSession);
+		}
 
-static int _wrap_CoreSession_originate(lua_State* L) {
-  int argc;
-  int argv[5]={
-    1,2,3,4,5
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 3) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        void *ptr;
-        if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-          _v = 0;
-        } else {
-          _v = 1;
-        }
-      }
-      if (_v) {
-        {
-          _v = lua_isstring(L,argv[2]);
-        }
-        if (_v) {
-          return _wrap_CoreSession_originate__SWIG_1(L);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        void *ptr;
-        if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-          _v = 0;
-        } else {
-          _v = 1;
-        }
-      }
-      if (_v) {
-        {
-          _v = lua_isstring(L,argv[2]);
-        }
-        if (_v) {
-          {
-            _v = lua_isnumber(L,argv[3]);
-          }
-          if (_v) {
-            return _wrap_CoreSession_originate__SWIG_0(L);
-          }
-        }
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'CoreSession_originate'");
-  lua_error(L);return 0;
-}
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("CoreSession_sendEvent", 2, SWIGTYPE_p_Event);
+		}
 
-static int _wrap_CoreSession_setDTMFCallback(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  void *arg2 = (void *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  SWIG_check_num_args("setDTMFCallback",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setDTMFCallback",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setDTMFCallback",2,"void *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("setDTMFCallback",3,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_setDTMFCallback",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setDTMFCallback");
-  arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->setDTMFCallback(arg2,arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		(arg1)->sendEvent(arg2);
+		SWIG_arg = 0;
 
+		return SWIG_arg;
 
-static int _wrap_CoreSession_speak(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("speak",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("speak",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("speak",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_speak",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (int)(arg1)->speak(arg2);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (0)
+			SWIG_fail;
 
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_set_tts_parms(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  SWIG_check_num_args("set_tts_parms",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("set_tts_parms",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("set_tts_parms",2,"char *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("set_tts_parms",3,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_set_tts_parms",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->set_tts_parms(arg2,arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_setEventData(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		Event *arg2 = (Event *) 0;
 
-static int _wrap_CoreSession_collectDigits(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int result;
-  
-  SWIG_check_num_args("collectDigits",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("collectDigits",1,"CoreSession *");
-  if(!lua_isnumber(L,2)) SWIG_fail_arg("collectDigits",2,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_collectDigits",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (int)lua_tonumber(L, 2);
-  result = (int)(arg1)->collectDigits(arg2);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_check_num_args("setEventData", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setEventData", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("setEventData", 2, "Event *");
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_setEventData", 1, SWIGTYPE_p_CoreSession);
+		}
 
-static int _wrap_CoreSession_getDigits(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("getDigits",4,4)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getDigits",1,"CoreSession *");
-  if(!lua_isnumber(L,2)) SWIG_fail_arg("getDigits",2,"int");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("getDigits",3,"char *");
-  if(!lua_isnumber(L,4)) SWIG_fail_arg("getDigits",4,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (int)lua_tonumber(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  arg4 = (int)lua_tonumber(L, 4);
-  result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_Event, 0))) {
+			SWIG_fail_ptr("CoreSession_setEventData", 2, SWIGTYPE_p_Event);
+		}
 
-static int _wrap_CoreSession_transfer(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("transfer",4,4)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("transfer",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("transfer",2,"char *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("transfer",3,"char *");
-  if(!lua_isstring(L,4)) SWIG_fail_arg("transfer",4,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_transfer",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  arg4 = (char *)lua_tostring(L, 4);
-  result = (int)(arg1)->transfer(arg2,arg3,arg4);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		(arg1)->setEventData(arg2);
+		SWIG_arg = 0;
 
+		return SWIG_arg;
 
-static int _wrap_CoreSession_read(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int arg3 ;
-  char *arg4 = (char *) 0 ;
-  int arg5 ;
-  char *arg6 = (char *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("read",6,6)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("read",1,"CoreSession *");
-  if(!lua_isnumber(L,2)) SWIG_fail_arg("read",2,"int");
-  if(!lua_isnumber(L,3)) SWIG_fail_arg("read",3,"int");
-  if(!lua_isstring(L,4)) SWIG_fail_arg("read",4,"char const *");
-  if(!lua_isnumber(L,5)) SWIG_fail_arg("read",5,"int");
-  if(!lua_isstring(L,6)) SWIG_fail_arg("read",6,"char const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_read",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (int)lua_tonumber(L, 2);
-  arg3 = (int)lua_tonumber(L, 3);
-  arg4 = (char *)lua_tostring(L, 4);
-  arg5 = (int)lua_tonumber(L, 5);
-  arg6 = (char *)lua_tostring(L, 6);
-  result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (0)
+			SWIG_fail;
 
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_playAndGetDigits(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int arg3 ;
-  int arg4 ;
-  int arg5 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  char *arg9 = (char *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("playAndGetDigits",9,9)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("playAndGetDigits",1,"CoreSession *");
-  if(!lua_isnumber(L,2)) SWIG_fail_arg("playAndGetDigits",2,"int");
-  if(!lua_isnumber(L,3)) SWIG_fail_arg("playAndGetDigits",3,"int");
-  if(!lua_isnumber(L,4)) SWIG_fail_arg("playAndGetDigits",4,"int");
-  if(!lua_isnumber(L,5)) SWIG_fail_arg("playAndGetDigits",5,"int");
-  if(!lua_isstring(L,6)) SWIG_fail_arg("playAndGetDigits",6,"char *");
-  if(!lua_isstring(L,7)) SWIG_fail_arg("playAndGetDigits",7,"char *");
-  if(!lua_isstring(L,8)) SWIG_fail_arg("playAndGetDigits",8,"char *");
-  if(!lua_isstring(L,9)) SWIG_fail_arg("playAndGetDigits",9,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_playAndGetDigits",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (int)lua_tonumber(L, 2);
-  arg3 = (int)lua_tonumber(L, 3);
-  arg4 = (int)lua_tonumber(L, 4);
-  arg5 = (int)lua_tonumber(L, 5);
-  arg6 = (char *)lua_tostring(L, 6);
-  arg7 = (char *)lua_tostring(L, 7);
-  arg8 = (char *)lua_tostring(L, 8);
-  arg9 = (char *)lua_tostring(L, 9);
-  result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_getXMLCDR(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("getXMLCDR", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("getXMLCDR", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_getXMLCDR", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (char *) (arg1)->getXMLCDR();
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_streamFile__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int result;
-  
-  SWIG_check_num_args("streamFile",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("streamFile",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("streamFile",2,"char *");
-  if(!lua_isnumber(L,3)) SWIG_fail_arg("streamFile",3,"int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_streamFile",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (int)lua_tonumber(L, 3);
-  result = (int)(arg1)->streamFile(arg2,arg3);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_begin_allow_threads(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		bool result;
+
+		SWIG_check_num_args("begin_allow_threads", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("begin_allow_threads", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_begin_allow_threads", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (bool) (arg1)->begin_allow_threads();
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_streamFile__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("streamFile",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("streamFile",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("streamFile",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_streamFile",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  result = (int)(arg1)->streamFile(arg2);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_end_allow_threads(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		bool result;
+
+		SWIG_check_num_args("end_allow_threads", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("end_allow_threads", 1, "CoreSession *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_end_allow_threads", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (bool) (arg1)->end_allow_threads();
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_streamFile(lua_State* L) {
-  int argc;
-  int argv[4]={
-    1,2,3,4
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 2) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        return _wrap_CoreSession_streamFile__SWIG_1(L);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        {
-          _v = lua_isnumber(L,argv[2]);
-        }
-        if (_v) {
-          return _wrap_CoreSession_streamFile__SWIG_0(L);
-        }
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'CoreSession_streamFile'");
-  lua_error(L);return 0;
-}
 
+	static int _wrap_CoreSession_get_uuid(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("get_uuid", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("get_uuid", 1, "CoreSession const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_get_uuid", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		result = (char *) ((CoreSession const *) arg1)->get_uuid();
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_flushEvents(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("flushEvents",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushEvents",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_flushEvents",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (int)(arg1)->flushEvents();
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_get_cb_args(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_input_args_t *result = 0;
+
+		SWIG_check_num_args("get_cb_args", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("get_cb_args", 1, "CoreSession const *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_get_cb_args", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		{
+			switch_input_args_t const &_result_ref = ((CoreSession const *) arg1)->get_cb_args();
+			result = (switch_input_args_t *) &_result_ref;
+		}
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_input_args_t, 0);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_flushDigits(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  SWIG_check_num_args("flushDigits",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushDigits",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_flushDigits",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (int)(arg1)->flushDigits();
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_check_hangup_hook(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
 
-static int _wrap_CoreSession_setAutoHangup(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool arg2 ;
-  int result;
-  
-  SWIG_check_num_args("setAutoHangup",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setAutoHangup",1,"CoreSession *");
-  if(!lua_isboolean(L,2)) SWIG_fail_arg("setAutoHangup",2,"bool");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_setAutoHangup",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (lua_toboolean(L, 2)!=0);
-  result = (int)(arg1)->setAutoHangup(arg2);
-  SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_check_num_args("check_hangup_hook", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("check_hangup_hook", 1, "CoreSession *");
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_check_hangup_hook", 1, SWIGTYPE_p_CoreSession);
+		}
 
-static int _wrap_CoreSession_setHangupHook(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  SWIG_check_num_args("setHangupHook",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setHangupHook",2,"void *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_setHangupHook",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setHangupHook");
-  (arg1)->setHangupHook(arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		(arg1)->check_hangup_hook();
+		SWIG_arg = 0;
 
+		return SWIG_arg;
 
-static int _wrap_CoreSession_ready(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("ready",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_ready",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (bool)(arg1)->ready();
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (0)
+			SWIG_fail;
 
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_execute__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  SWIG_check_num_args("execute",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->execute(arg2,arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_CoreSession_run_dtmf_callback(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = (CoreSession *) 0;
+		void *arg2 = (void *) 0;
+		switch_input_type_t arg3;
+		switch_status_t result;
+		switch_input_type_t *argp3;
+
+		SWIG_check_num_args("run_dtmf_callback", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("run_dtmf_callback", 1, "CoreSession *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("run_dtmf_callback", 2, "void *");
+		if (!lua_isuserdata(L, 3))
+			SWIG_fail_arg("run_dtmf_callback", 3, "switch_input_type_t");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("CoreSession_run_dtmf_callback", 1, SWIGTYPE_p_CoreSession);
+		}
+
+		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "CoreSession_run_dtmf_callback");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 3, (void **) &argp3, SWIGTYPE_p_switch_input_type_t, 0))) {
+			SWIG_fail_ptr("CoreSession_run_dtmf_callback", 3, SWIGTYPE_p_switch_input_type_t);
+		}
+		arg3 = *argp3;
+
+		result = (arg1)->run_dtmf_callback(arg2, arg3);
+		SWIG_arg = 0;
+		{
+			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+			SWIG_arg++;
+		}
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_execute__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("execute",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  (arg1)->execute(arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static void swig_delete_CoreSession(void *obj) {
+		CoreSession *arg1 = (CoreSession *) obj;
+		delete arg1;
+	}
+	static swig_lua_method swig_CoreSession_methods[] = {
+		{"answer", _wrap_CoreSession_answer},
+		{"preAnswer", _wrap_CoreSession_preAnswer},
+		{"hangup", _wrap_CoreSession_hangup},
+		{"setVariable", _wrap_CoreSession_setVariable},
+		{"setPrivate", _wrap_CoreSession_setPrivate},
+		{"getPrivate", _wrap_CoreSession_getPrivate},
+		{"getVariable", _wrap_CoreSession_getVariable},
+		{"process_callback_result", _wrap_CoreSession_process_callback_result},
+		{"say", _wrap_CoreSession_say},
+		{"sayPhrase", _wrap_CoreSession_sayPhrase},
+		{"recordFile", _wrap_CoreSession_recordFile},
+		{"setCallerData", _wrap_CoreSession_setCallerData},
+		{"originate", _wrap_CoreSession_originate},
+		{"setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
+		{"speak", _wrap_CoreSession_speak},
+		{"set_tts_parms", _wrap_CoreSession_set_tts_parms},
+		{"collectDigits", _wrap_CoreSession_collectDigits},
+		{"getDigits", _wrap_CoreSession_getDigits},
+		{"transfer", _wrap_CoreSession_transfer},
+		{"read", _wrap_CoreSession_read},
+		{"playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
+		{"streamFile", _wrap_CoreSession_streamFile},
+		{"flushEvents", _wrap_CoreSession_flushEvents},
+		{"flushDigits", _wrap_CoreSession_flushDigits},
+		{"setAutoHangup", _wrap_CoreSession_setAutoHangup},
+		{"setHangupHook", _wrap_CoreSession_setHangupHook},
+		{"ready", _wrap_CoreSession_ready},
+		{"execute", _wrap_CoreSession_execute},
+		{"sendEvent", _wrap_CoreSession_sendEvent},
+		{"setEventData", _wrap_CoreSession_setEventData},
+		{"getXMLCDR", _wrap_CoreSession_getXMLCDR},
+		{"begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
+		{"end_allow_threads", _wrap_CoreSession_end_allow_threads},
+		{"get_uuid", _wrap_CoreSession_get_uuid},
+		{"get_cb_args", _wrap_CoreSession_get_cb_args},
+		{"check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
+		{"run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
+		{0, 0}
+	};
+	static swig_lua_attribute swig_CoreSession_attributes[] = {
+		{"session", _wrap_CoreSession_session_get, _wrap_CoreSession_session_set},
+		{"channel", _wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set},
+		{"flags", _wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set},
+		{"allocated", _wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set},
+		{"cb_state", _wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set},
+		{"hook_state", _wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set},
+		{0, 0, 0}
+	};
+	static swig_lua_class *swig_CoreSession_bases[] = { 0 };
+	static const char *swig_CoreSession_base_names[] = { 0 };
+	static swig_lua_class _wrap_class_CoreSession =
+		{ "CoreSession", &SWIGTYPE_p_CoreSession, 0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes,
+swig_CoreSession_bases, swig_CoreSession_base_names };
+
+	static int _wrap_console_log(lua_State * L) {
+		int SWIG_arg = -1;
+		char *arg1 = (char *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("console_log", 2, 2)
+			if (!lua_isstring(L, 1))
+			SWIG_fail_arg("console_log", 1, "char *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("console_log", 2, "char *");
+		arg1 = (char *) lua_tostring(L, 1);
+		arg2 = (char *) lua_tostring(L, 2);
+		console_log(arg1, arg2);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_execute(lua_State* L) {
-  int argc;
-  int argv[4]={
-    1,2,3,4
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 2) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        return _wrap_CoreSession_execute__SWIG_1(L);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        {
-          _v = lua_isstring(L,argv[2]);
-        }
-        if (_v) {
-          return _wrap_CoreSession_execute__SWIG_0(L);
-        }
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'CoreSession_execute'");
-  lua_error(L);return 0;
-}
 
+	static int _wrap_console_clean_log(lua_State * L) {
+		int SWIG_arg = -1;
+		char *arg1 = (char *) 0;
+
+		SWIG_check_num_args("console_clean_log", 1, 1)
+			if (!lua_isstring(L, 1))
+			SWIG_fail_arg("console_clean_log", 1, "char *");
+		arg1 = (char *) lua_tostring(L, 1);
+		console_clean_log(arg1);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_sendEvent(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  Event *arg2 = (Event *) 0 ;
-  
-  SWIG_check_num_args("sendEvent",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sendEvent",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("sendEvent",2,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_sendEvent",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("CoreSession_sendEvent",2,SWIGTYPE_p_Event);
-  }
-  
-  (arg1)->sendEvent(arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_bridge(lua_State * L) {
+		int SWIG_arg = -1;
+		CoreSession *arg1 = 0;
+		CoreSession *arg2 = 0;
 
-static int _wrap_CoreSession_setEventData(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  Event *arg2 = (Event *) 0 ;
-  
-  SWIG_check_num_args("setEventData",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setEventData",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setEventData",2,"Event *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_setEventData",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){
-    SWIG_fail_ptr("CoreSession_setEventData",2,SWIGTYPE_p_Event);
-  }
-  
-  (arg1)->setEventData(arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_check_num_args("bridge", 2, 2)
+			if (!lua_isuserdata(L, 1))
+			SWIG_fail_arg("bridge", 1, "CoreSession &");
+		if (!lua_isuserdata(L, 2))
+			SWIG_fail_arg("bridge", 2, "CoreSession &");
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("bridge", 1, SWIGTYPE_p_CoreSession);
+		}
 
-static int _wrap_CoreSession_getXMLCDR(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("getXMLCDR",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getXMLCDR",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_getXMLCDR",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (char *)(arg1)->getXMLCDR();
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
+			SWIG_fail_ptr("bridge", 2, SWIGTYPE_p_CoreSession);
+		}
 
-static int _wrap_CoreSession_begin_allow_threads(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("begin_allow_threads",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_begin_allow_threads",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (bool)(arg1)->begin_allow_threads();
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		bridge(*arg1, *arg2);
+		SWIG_arg = 0;
 
+		return SWIG_arg;
 
-static int _wrap_CoreSession_end_allow_threads(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("end_allow_threads",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_end_allow_threads",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (bool)(arg1)->end_allow_threads();
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (0)
+			SWIG_fail;
 
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_get_uuid(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("get_uuid",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_uuid",1,"CoreSession const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_get_uuid",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  result = (char *)((CoreSession const *)arg1)->get_uuid();
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_hanguphook(lua_State * L) {
+		int SWIG_arg = -1;
+		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+		switch_status_t result;
+
+		SWIG_check_num_args("hanguphook", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("hanguphook", 1, "switch_core_session_t *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0))) {
+			SWIG_fail_ptr("hanguphook", 1, SWIGTYPE_p_switch_core_session_t);
+		}
+
+		result = hanguphook(arg1);
+		SWIG_arg = 0;
+		{
+			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+			SWIG_arg++;
+		}
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_get_cb_args(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_input_args_t *result = 0 ;
-  
-  SWIG_check_num_args("get_cb_args",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_cb_args",1,"CoreSession const *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_get_cb_args",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  {
-    switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
-    result = (switch_input_args_t *) &_result_ref;
-  }
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_input_args_t,0); SWIG_arg++; 
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_dtmf_callback(lua_State * L) {
+		int SWIG_arg = -1;
+		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+		void *arg2 = (void *) 0;
+		switch_input_type_t arg3;
+		void *arg4 = (void *) 0;
+		unsigned int arg5;
+		switch_status_t result;
+		switch_input_type_t *argp3;
+
+		SWIG_check_num_args("dtmf_callback", 5, 5)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("dtmf_callback", 1, "switch_core_session_t *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("dtmf_callback", 2, "void *");
+		if (!lua_isuserdata(L, 3))
+			SWIG_fail_arg("dtmf_callback", 3, "switch_input_type_t");
+		if (!SWIG_isptrtype(L, 4))
+			SWIG_fail_arg("dtmf_callback", 4, "void *");
+		if (!lua_isnumber(L, 5))
+			SWIG_fail_arg("dtmf_callback", 5, "unsigned int");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0))) {
+			SWIG_fail_ptr("dtmf_callback", 1, SWIGTYPE_p_switch_core_session_t);
+		}
+
+		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "dtmf_callback");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 3, (void **) &argp3, SWIGTYPE_p_switch_input_type_t, 0))) {
+			SWIG_fail_ptr("dtmf_callback", 3, SWIGTYPE_p_switch_input_type_t);
+		}
+		arg3 = *argp3;
+
+		arg4 = (void *) SWIG_MustGetPtr(L, 4, 0, 0, 4, "dtmf_callback");
+		arg5 = (unsigned int) lua_tonumber(L, 5);
+		result = dtmf_callback(arg1, arg2, arg3, arg4, arg5);
+		SWIG_arg = 0;
+		{
+			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+			SWIG_arg++;
+		}
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_check_hangup_hook(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  
-  SWIG_check_num_args("check_hangup_hook",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"CoreSession *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_check_hangup_hook",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  (arg1)->check_hangup_hook();
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_new_Session__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * result = 0;
+
+		SWIG_check_num_args("LUA::Session", 0, 0)
+		result = (LUA::Session *) new LUA::Session();
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_LUA__Session, 1);
+		SWIG_arg++;
+		result->setLUA(L);
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_CoreSession_run_dtmf_callback(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_input_type_t arg3 ;
-  switch_status_t result;
-  switch_input_type_t *argp3 ;
-  
-  SWIG_check_num_args("run_dtmf_callback",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"CoreSession *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *");
-  if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("CoreSession_run_dtmf_callback",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_run_dtmf_callback");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){
-    SWIG_fail_ptr("CoreSession_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t);
-  }
-  arg3 = *argp3;
-  
-  result = (arg1)->run_dtmf_callback(arg2,arg3);
-  SWIG_arg=0;
-  {
-    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
-    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
-  }
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_new_Session__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		char *arg1 = (char *) 0;
+		LUA::Session * result = 0;
+
+		SWIG_check_num_args("LUA::Session", 1, 1)
+			if (!lua_isstring(L, 1))
+			SWIG_fail_arg("LUA::Session", 1, "char *");
+		arg1 = (char *) lua_tostring(L, 1);
+		result = (LUA::Session *) new LUA::Session(arg1);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_LUA__Session, 1);
+		SWIG_arg++;
+		result->setLUA(L);
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static void swig_delete_CoreSession(void *obj) {
-CoreSession *arg1 = (CoreSession *) obj;
-delete arg1;
-}
-static swig_lua_method swig_CoreSession_methods[] = {
-    {"answer", _wrap_CoreSession_answer}, 
-    {"preAnswer", _wrap_CoreSession_preAnswer}, 
-    {"hangup", _wrap_CoreSession_hangup}, 
-    {"setVariable", _wrap_CoreSession_setVariable}, 
-    {"setPrivate", _wrap_CoreSession_setPrivate}, 
-    {"getPrivate", _wrap_CoreSession_getPrivate}, 
-    {"getVariable", _wrap_CoreSession_getVariable}, 
-    {"process_callback_result", _wrap_CoreSession_process_callback_result}, 
-    {"say", _wrap_CoreSession_say}, 
-    {"sayPhrase", _wrap_CoreSession_sayPhrase}, 
-    {"recordFile", _wrap_CoreSession_recordFile}, 
-    {"setCallerData", _wrap_CoreSession_setCallerData}, 
-    {"originate", _wrap_CoreSession_originate}, 
-    {"setDTMFCallback", _wrap_CoreSession_setDTMFCallback}, 
-    {"speak", _wrap_CoreSession_speak}, 
-    {"set_tts_parms", _wrap_CoreSession_set_tts_parms}, 
-    {"collectDigits", _wrap_CoreSession_collectDigits}, 
-    {"getDigits", _wrap_CoreSession_getDigits}, 
-    {"transfer", _wrap_CoreSession_transfer}, 
-    {"read", _wrap_CoreSession_read}, 
-    {"playAndGetDigits", _wrap_CoreSession_playAndGetDigits}, 
-    {"streamFile", _wrap_CoreSession_streamFile}, 
-    {"flushEvents", _wrap_CoreSession_flushEvents}, 
-    {"flushDigits", _wrap_CoreSession_flushDigits}, 
-    {"setAutoHangup", _wrap_CoreSession_setAutoHangup}, 
-    {"setHangupHook", _wrap_CoreSession_setHangupHook}, 
-    {"ready", _wrap_CoreSession_ready}, 
-    {"execute", _wrap_CoreSession_execute}, 
-    {"sendEvent", _wrap_CoreSession_sendEvent}, 
-    {"setEventData", _wrap_CoreSession_setEventData}, 
-    {"getXMLCDR", _wrap_CoreSession_getXMLCDR}, 
-    {"begin_allow_threads", _wrap_CoreSession_begin_allow_threads}, 
-    {"end_allow_threads", _wrap_CoreSession_end_allow_threads}, 
-    {"get_uuid", _wrap_CoreSession_get_uuid}, 
-    {"get_cb_args", _wrap_CoreSession_get_cb_args}, 
-    {"check_hangup_hook", _wrap_CoreSession_check_hangup_hook}, 
-    {"run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback}, 
-    {0,0}
-};
-static swig_lua_attribute swig_CoreSession_attributes[] = {
-    { "session", _wrap_CoreSession_session_get, _wrap_CoreSession_session_set},
-    { "channel", _wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set},
-    { "flags", _wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set},
-    { "allocated", _wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set},
-    { "cb_state", _wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set},
-    { "hook_state", _wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set},
-    {0,0,0}
-};
-static swig_lua_class *swig_CoreSession_bases[] = {0};
-static const char *swig_CoreSession_base_names[] = {0};
-static swig_lua_class _wrap_class_CoreSession = { "CoreSession", &SWIGTYPE_p_CoreSession,0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes, swig_CoreSession_bases, swig_CoreSession_base_names };
-
-static int _wrap_console_log(lua_State* L) {
-  int SWIG_arg = -1;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("console_log",2,2)
-  if(!lua_isstring(L,1)) SWIG_fail_arg("console_log",1,"char *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("console_log",2,"char *");
-  arg1 = (char *)lua_tostring(L, 1);
-  arg2 = (char *)lua_tostring(L, 2);
-  console_log(arg1,arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_new_Session__SWIG_2(lua_State * L) {
+		int SWIG_arg = -1;
+		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+		LUA::Session * result = 0;
+
+		SWIG_check_num_args("LUA::Session", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("LUA::Session", 1, "switch_core_session_t *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0))) {
+			SWIG_fail_ptr("new_Session", 1, SWIGTYPE_p_switch_core_session_t);
+		}
+
+		result = (LUA::Session *) new LUA::Session(arg1);
+		SWIG_arg = 0;
+		SWIG_NewPointerObj(L, result, SWIGTYPE_p_LUA__Session, 1);
+		SWIG_arg++;
+		result->setLUA(L);
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
-static int _wrap_console_clean_log(lua_State* L) {
-  int SWIG_arg = -1;
-  char *arg1 = (char *) 0 ;
-  
-  SWIG_check_num_args("console_clean_log",1,1)
-  if(!lua_isstring(L,1)) SWIG_fail_arg("console_clean_log",1,"char *");
-  arg1 = (char *)lua_tostring(L, 1);
-  console_clean_log(arg1);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_new_Session(lua_State * L) {
+		int argc;
+		int argv[2] = {
+			1, 2
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 0) {
+			return _wrap_new_Session__SWIG_0(L);
+		}
+		if (argc == 1) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				return _wrap_new_Session__SWIG_2(L);
+			}
+		}
+		if (argc == 1) {
+			int _v;
+			{
+				_v = lua_isstring(L, argv[0]);
+			}
+			if (_v) {
+				return _wrap_new_Session__SWIG_1(L);
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'new_Session'");
+		lua_error(L);
+		return 0;
+	}
 
-static int _wrap_bridge(lua_State* L) {
-  int SWIG_arg = -1;
-  CoreSession *arg1 = 0 ;
-  CoreSession *arg2 = 0 ;
-  
-  SWIG_check_num_args("bridge",2,2)
-  if(!lua_isuserdata(L,1)) SWIG_fail_arg("bridge",1,"CoreSession &");
-  if(!lua_isuserdata(L,2)) SWIG_fail_arg("bridge",2,"CoreSession &");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("bridge",1,SWIGTYPE_p_CoreSession);
-  }
-  
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
-    SWIG_fail_ptr("bridge",2,SWIGTYPE_p_CoreSession);
-  }
-  
-  bridge(*arg1,*arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
 
+	static int _wrap_delete_Session(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
 
-static int _wrap_hanguphook(lua_State* L) {
-  int SWIG_arg = -1;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  SWIG_check_num_args("hanguphook",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hanguphook",1,"switch_core_session_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){
-    SWIG_fail_ptr("hanguphook",1,SWIGTYPE_p_switch_core_session_t);
-  }
-  
-  result = hanguphook(arg1);
-  SWIG_arg=0;
-  {
-    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
-    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
-  }
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		SWIG_check_num_args("LUA::~Session", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("LUA::~Session", 1, "LUA::Session *");
 
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, SWIG_POINTER_DISOWN))) {
+			SWIG_fail_ptr("delete_Session", 1, SWIGTYPE_p_LUA__Session);
+		}
 
-static int _wrap_dtmf_callback(lua_State* L) {
-  int SWIG_arg = -1;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_input_type_t arg3 ;
-  void *arg4 = (void *) 0 ;
-  unsigned int arg5 ;
-  switch_status_t result;
-  switch_input_type_t *argp3 ;
-  
-  SWIG_check_num_args("dtmf_callback",5,5)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("dtmf_callback",1,"switch_core_session_t *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("dtmf_callback",2,"void *");
-  if(!lua_isuserdata(L,3)) SWIG_fail_arg("dtmf_callback",3,"switch_input_type_t");
-  if(!SWIG_isptrtype(L,4)) SWIG_fail_arg("dtmf_callback",4,"void *");
-  if(!lua_isnumber(L,5)) SWIG_fail_arg("dtmf_callback",5,"unsigned int");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){
-    SWIG_fail_ptr("dtmf_callback",1,SWIGTYPE_p_switch_core_session_t);
-  }
-  
-  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"dtmf_callback");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){
-    SWIG_fail_ptr("dtmf_callback",3,SWIGTYPE_p_switch_input_type_t);
-  }
-  arg3 = *argp3;
-  
-  arg4=(void *)SWIG_MustGetPtr(L,4,0,0,4,"dtmf_callback");
-  arg5 = (unsigned int)lua_tonumber(L, 5);
-  result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
-  SWIG_arg=0;
-  {
-    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
-    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
-  }
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		delete arg1;
 
+		SWIG_arg = 0;
 
-static int _wrap_new_Session__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *result = 0 ;
-  
-  SWIG_check_num_args("LUA::Session",0,0)
-  result = (LUA::Session *)new LUA::Session();
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		return SWIG_arg;
 
+		if (0)
+			SWIG_fail;
 
-static int _wrap_new_Session__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  char *arg1 = (char *) 0 ;
-  LUA::Session *result = 0 ;
-  
-  SWIG_check_num_args("LUA::Session",1,1)
-  if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Session",1,"char *");
-  arg1 = (char *)lua_tostring(L, 1);
-  result = (LUA::Session *)new LUA::Session(arg1);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_new_Session__SWIG_2(lua_State* L) {
-  int SWIG_arg = -1;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  LUA::Session *result = 0 ;
-  
-  SWIG_check_num_args("LUA::Session",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::Session",1,"switch_core_session_t *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){
-    SWIG_fail_ptr("new_Session",1,SWIGTYPE_p_switch_core_session_t);
-  }
-  
-  result = (LUA::Session *)new LUA::Session(arg1);
-  SWIG_arg=0;
-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_begin_allow_threads(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		bool result;
+
+		SWIG_check_num_args("begin_allow_threads", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("begin_allow_threads", 1, "LUA::Session *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_begin_allow_threads", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		result = (bool) (arg1)->begin_allow_threads();
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_new_Session(lua_State* L) {
-  int argc;
-  int argv[2]={
-    1,2
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 0) {
-    return _wrap_new_Session__SWIG_0(L);
-  }
-  if (argc == 1) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      return _wrap_new_Session__SWIG_2(L);
-    }
-  }
-  if (argc == 1) {
-    int _v;
-    {
-      _v = lua_isstring(L,argv[0]);
-    }
-    if (_v) {
-      return _wrap_new_Session__SWIG_1(L);
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'new_Session'");
-  lua_error(L);return 0;
-}
+	static int _wrap_Session_end_allow_threads(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		bool result;
+
+		SWIG_check_num_args("end_allow_threads", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("end_allow_threads", 1, "LUA::Session *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_end_allow_threads", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		result = (bool) (arg1)->end_allow_threads();
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_delete_Session(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  
-  SWIG_check_num_args("LUA::~Session",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::~Session",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,SWIG_POINTER_DISOWN))){
-    SWIG_fail_ptr("delete_Session",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  delete arg1;
-  
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_check_hangup_hook(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
 
+		SWIG_check_num_args("check_hangup_hook", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("check_hangup_hook", 1, "LUA::Session *");
 
-static int _wrap_Session_begin_allow_threads(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("begin_allow_threads",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_begin_allow_threads",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  result = (bool)(arg1)->begin_allow_threads();
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_check_hangup_hook", 1, SWIGTYPE_p_LUA__Session);
+		}
 
+		(arg1)->check_hangup_hook();
+		SWIG_arg = 0;
 
-static int _wrap_Session_end_allow_threads(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("end_allow_threads",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_end_allow_threads",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  result = (bool)(arg1)->end_allow_threads();
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+		return SWIG_arg;
 
+		if (0)
+			SWIG_fail;
 
-static int _wrap_Session_check_hangup_hook(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  
-  SWIG_check_num_args("check_hangup_hook",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_check_hangup_hook",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  (arg1)->check_hangup_hook();
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_run_dtmf_callback(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_input_type_t arg3 ;
-  switch_status_t result;
-  switch_input_type_t *argp3 ;
-  
-  SWIG_check_num_args("run_dtmf_callback",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"LUA::Session *");
-  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *");
-  if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_run_dtmf_callback",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"Session_run_dtmf_callback");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){
-    SWIG_fail_ptr("Session_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t);
-  }
-  arg3 = *argp3;
-  
-  result = (arg1)->run_dtmf_callback(arg2,arg3);
-  SWIG_arg=0;
-  {
-    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
-    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
-  }
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_run_dtmf_callback(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		void *arg2 = (void *) 0;
+		switch_input_type_t arg3;
+		switch_status_t result;
+		switch_input_type_t *argp3;
+
+		SWIG_check_num_args("run_dtmf_callback", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("run_dtmf_callback", 1, "LUA::Session *");
+		if (!SWIG_isptrtype(L, 2))
+			SWIG_fail_arg("run_dtmf_callback", 2, "void *");
+		if (!lua_isuserdata(L, 3))
+			SWIG_fail_arg("run_dtmf_callback", 3, "switch_input_type_t");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_run_dtmf_callback", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "Session_run_dtmf_callback");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 3, (void **) &argp3, SWIGTYPE_p_switch_input_type_t, 0))) {
+			SWIG_fail_ptr("Session_run_dtmf_callback", 3, SWIGTYPE_p_switch_input_type_t);
+		}
+		arg3 = *argp3;
+
+		result = (arg1)->run_dtmf_callback(arg2, arg3);
+		SWIG_arg = 0;
+		{
+			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+			SWIG_arg++;
+		}
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_setInputCallback(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  SWIG_check_num_args("setInputCallback",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setInputCallback",1,"LUA::Session *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("setInputCallback",2,"char *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("setInputCallback",3,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_setInputCallback",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->setInputCallback(arg2,arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_setInputCallback(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+
+		SWIG_check_num_args("setInputCallback", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setInputCallback", 1, "LUA::Session *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("setInputCallback", 2, "char *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("setInputCallback", 3, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_setInputCallback", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		(arg1)->setInputCallback(arg2, arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_setHangupHook__SWIG_0(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  SWIG_check_num_args("setHangupHook",3,3)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *");
-  if(!lua_isstring(L,3)) SWIG_fail_arg("setHangupHook",3,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  arg3 = (char *)lua_tostring(L, 3);
-  (arg1)->setHangupHook(arg2,arg3);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_setHangupHook__SWIG_0(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+
+		SWIG_check_num_args("setHangupHook", 3, 3)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setHangupHook", 1, "LUA::Session *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("setHangupHook", 2, "char *");
+		if (!lua_isstring(L, 3))
+			SWIG_fail_arg("setHangupHook", 3, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_setHangupHook", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		arg3 = (char *) lua_tostring(L, 3);
+		(arg1)->setHangupHook(arg2, arg3);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_setHangupHook__SWIG_1(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("setHangupHook",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  (arg1)->setHangupHook(arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_setHangupHook__SWIG_1(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("setHangupHook", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setHangupHook", 1, "LUA::Session *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("setHangupHook", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_setHangupHook", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		(arg1)->setHangupHook(arg2);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_setHangupHook(lua_State* L) {
-  int argc;
-  int argv[4]={
-    1,2,3,4
-  };
-  
-  argc = lua_gettop(L);
-  if (argc == 2) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        return _wrap_Session_setHangupHook__SWIG_1(L);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    {
-      void *ptr;
-      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
-        _v = 0;
-      } else {
-        _v = 1;
-      }
-    }
-    if (_v) {
-      {
-        _v = lua_isstring(L,argv[1]);
-      }
-      if (_v) {
-        {
-          _v = lua_isstring(L,argv[2]);
-        }
-        if (_v) {
-          return _wrap_Session_setHangupHook__SWIG_0(L);
-        }
-      }
-    }
-  }
-  
-  lua_pushstring(L,"No matching function for overloaded 'Session_setHangupHook'");
-  lua_error(L);return 0;
-}
+	static int _wrap_Session_setHangupHook(lua_State * L) {
+		int argc;
+		int argv[4] = {
+			1, 2, 3, 4
+		};
+
+		argc = lua_gettop(L);
+		if (argc == 2) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					return _wrap_Session_setHangupHook__SWIG_1(L);
+				}
+			}
+		}
+		if (argc == 3) {
+			int _v;
+			{
+				void *ptr;
+				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+					_v = 0;
+				} else {
+					_v = 1;
+				}
+			}
+			if (_v) {
+				{
+					_v = lua_isstring(L, argv[1]);
+				}
+				if (_v) {
+					{
+						_v = lua_isstring(L, argv[2]);
+					}
+					if (_v) {
+						return _wrap_Session_setHangupHook__SWIG_0(L);
+					}
+				}
+			}
+		}
+
+		lua_pushstring(L, "No matching function for overloaded 'Session_setHangupHook'");
+		lua_error(L);
+		return 0;
+	}
 
 
-static int _wrap_Session_ready(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  bool result;
-  
-  SWIG_check_num_args("ready",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_ready",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  result = (bool)(arg1)->ready();
-  SWIG_arg=0;
-  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_ready(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		bool result;
+
+		SWIG_check_num_args("ready", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("ready", 1, "LUA::Session *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_ready", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		result = (bool) (arg1)->ready();
+		SWIG_arg = 0;
+		lua_pushboolean(L, (int) (result == true));
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_cb_function_set(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("cb_function",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("cb_function",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_cb_function_set",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  {
-    if (arg1->cb_function) delete [] arg1->cb_function;
-    if (arg2) {
-      arg1->cb_function = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->cb_function, (const char *)arg2);
-    } else {
-      arg1->cb_function = 0;
-    }
-  }
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_cb_function_set(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("cb_function", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("cb_function", 1, "LUA::Session *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("cb_function", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_cb_function_set", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		{
+			if (arg1->cb_function)
+				delete[]arg1->cb_function;
+			if (arg2) {
+				arg1->cb_function = (char *) (new char[strlen((const char *)arg2) + 1]);
+				strcpy((char *) arg1->cb_function, (const char *) arg2);
+			} else {
+				arg1->cb_function = 0;
+			}
+		}
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_cb_function_get(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("cb_function",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_cb_function_get",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  result = (char *) ((arg1)->cb_function);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_cb_function_get(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("cb_function", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("cb_function", 1, "LUA::Session *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_cb_function_get", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		result = (char *) ((arg1)->cb_function);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_cb_arg_set(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("cb_arg",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("cb_arg",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_cb_arg_set",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  {
-    if (arg1->cb_arg) delete [] arg1->cb_arg;
-    if (arg2) {
-      arg1->cb_arg = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->cb_arg, (const char *)arg2);
-    } else {
-      arg1->cb_arg = 0;
-    }
-  }
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_cb_arg_set(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("cb_arg", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("cb_arg", 1, "LUA::Session *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("cb_arg", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_cb_arg_set", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		{
+			if (arg1->cb_arg)
+				delete[]arg1->cb_arg;
+			if (arg2) {
+				arg1->cb_arg = (char *) (new char[strlen((const char *)arg2) + 1]);
+				strcpy((char *) arg1->cb_arg, (const char *) arg2);
+			} else {
+				arg1->cb_arg = 0;
+			}
+		}
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_cb_arg_get(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("cb_arg",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_cb_arg_get",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  result = (char *) ((arg1)->cb_arg);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_cb_arg_get(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("cb_arg", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("cb_arg", 1, "LUA::Session *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_cb_arg_get", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		result = (char *) ((arg1)->cb_arg);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_hangup_func_str_set(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("hangup_func_str",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_str",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_hangup_func_str_set",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  {
-    if (arg1->hangup_func_str) delete [] arg1->hangup_func_str;
-    if (arg2) {
-      arg1->hangup_func_str = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->hangup_func_str, (const char *)arg2);
-    } else {
-      arg1->hangup_func_str = 0;
-    }
-  }
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_hangup_func_str_set(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("hangup_func_str", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("hangup_func_str", 1, "LUA::Session *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("hangup_func_str", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_hangup_func_str_set", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		{
+			if (arg1->hangup_func_str)
+				delete[]arg1->hangup_func_str;
+			if (arg2) {
+				arg1->hangup_func_str = (char *) (new char[strlen((const char *)arg2) + 1]);
+				strcpy((char *) arg1->hangup_func_str, (const char *) arg2);
+			} else {
+				arg1->hangup_func_str = 0;
+			}
+		}
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_hangup_func_str_get(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("hangup_func_str",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_hangup_func_str_get",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  result = (char *) ((arg1)->hangup_func_str);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_hangup_func_str_get(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("hangup_func_str", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("hangup_func_str", 1, "LUA::Session *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_hangup_func_str_get", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		result = (char *) ((arg1)->hangup_func_str);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_hangup_func_arg_set(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  SWIG_check_num_args("hangup_func_arg",2,2)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_arg",2,"char *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_hangup_func_arg_set",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  arg2 = (char *)lua_tostring(L, 2);
-  {
-    if (arg1->hangup_func_arg) delete [] arg1->hangup_func_arg;
-    if (arg2) {
-      arg1->hangup_func_arg = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->hangup_func_arg, (const char *)arg2);
-    } else {
-      arg1->hangup_func_arg = 0;
-    }
-  }
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_hangup_func_arg_set(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *arg2 = (char *) 0;
+
+		SWIG_check_num_args("hangup_func_arg", 2, 2)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("hangup_func_arg", 1, "LUA::Session *");
+		if (!lua_isstring(L, 2))
+			SWIG_fail_arg("hangup_func_arg", 2, "char *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_hangup_func_arg_set", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		arg2 = (char *) lua_tostring(L, 2);
+		{
+			if (arg1->hangup_func_arg)
+				delete[]arg1->hangup_func_arg;
+			if (arg2) {
+				arg1->hangup_func_arg = (char *) (new char[strlen((const char *)arg2) + 1]);
+				strcpy((char *) arg1->hangup_func_arg, (const char *) arg2);
+			} else {
+				arg1->hangup_func_arg = 0;
+			}
+		}
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_hangup_func_arg_get(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  char *result = 0 ;
-  
-  SWIG_check_num_args("hangup_func_arg",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_hangup_func_arg_get",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  result = (char *) ((arg1)->hangup_func_arg);
-  SWIG_arg=0;
-  lua_pushstring(L,(const char*)result); SWIG_arg++;
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_hangup_func_arg_get(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		char *result = 0;
+
+		SWIG_check_num_args("hangup_func_arg", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("hangup_func_arg", 1, "LUA::Session *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_hangup_func_arg_get", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		result = (char *) ((arg1)->hangup_func_arg);
+		SWIG_arg = 0;
+		lua_pushstring(L, (const char *) result);
+		SWIG_arg++;
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static int _wrap_Session_setLUA(lua_State* L) {
-  int SWIG_arg = -1;
-  LUA::Session *arg1 = (LUA::Session *) 0 ;
-  lua_State *arg2 = (lua_State *) 0 ;
-  
-  arg2 = L;
-  SWIG_check_num_args("setLUA",1,1)
-  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setLUA",1,"LUA::Session *");
-  
-  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
-    SWIG_fail_ptr("Session_setLUA",1,SWIGTYPE_p_LUA__Session);
-  }
-  
-  (arg1)->setLUA(arg2);
-  SWIG_arg=0;
-  
-  return SWIG_arg;
-  
-  if(0) SWIG_fail;
-  
-fail:
-  lua_error(L);
-  return SWIG_arg;
-}
+	static int _wrap_Session_setLUA(lua_State * L) {
+		int SWIG_arg = -1;
+		LUA::Session * arg1 = (LUA::Session *) 0;
+		lua_State *arg2 = (lua_State *) 0;
+
+		arg2 = L;
+		SWIG_check_num_args("setLUA", 1, 1)
+			if (!SWIG_isptrtype(L, 1))
+			SWIG_fail_arg("setLUA", 1, "LUA::Session *");
+
+		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+			SWIG_fail_ptr("Session_setLUA", 1, SWIGTYPE_p_LUA__Session);
+		}
+
+		(arg1)->setLUA(arg2);
+		SWIG_arg = 0;
+
+		return SWIG_arg;
+
+		if (0)
+			SWIG_fail;
+
+	  fail:
+		lua_error(L);
+		return SWIG_arg;
+	}
 
 
-static void swig_delete_Session(void *obj) {
-LUA::Session *arg1 = (LUA::Session *) obj;
-delete arg1;
-}
-static swig_lua_method swig_LUA_Session_methods[] = {
-    {"begin_allow_threads", _wrap_Session_begin_allow_threads}, 
-    {"end_allow_threads", _wrap_Session_end_allow_threads}, 
-    {"check_hangup_hook", _wrap_Session_check_hangup_hook}, 
-    {"run_dtmf_callback", _wrap_Session_run_dtmf_callback}, 
-    {"setInputCallback", _wrap_Session_setInputCallback}, 
-    {"setHangupHook", _wrap_Session_setHangupHook}, 
-    {"ready", _wrap_Session_ready}, 
-    {"setLUA", _wrap_Session_setLUA}, 
-    {0,0}
-};
-static swig_lua_attribute swig_LUA_Session_attributes[] = {
-    { "cb_function", _wrap_Session_cb_function_get, _wrap_Session_cb_function_set},
-    { "cb_arg", _wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set},
-    { "hangup_func_str", _wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set},
-    { "hangup_func_arg", _wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set},
-    {0,0,0}
-};
-static swig_lua_class *swig_LUA_Session_bases[] = {0,0};
-static const char *swig_LUA_Session_base_names[] = {"CoreSession *",0};
-static swig_lua_class _wrap_class_LUA_Session = { "Session", &SWIGTYPE_p_LUA__Session,_wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes, swig_LUA_Session_bases, swig_LUA_Session_base_names };
+	static void swig_delete_Session(void *obj) {
+		LUA::Session * arg1 = (LUA::Session *) obj;
+		delete arg1;
+	}
+	static swig_lua_method swig_LUA_Session_methods[] = {
+		{"begin_allow_threads", _wrap_Session_begin_allow_threads},
+		{"end_allow_threads", _wrap_Session_end_allow_threads},
+		{"check_hangup_hook", _wrap_Session_check_hangup_hook},
+		{"run_dtmf_callback", _wrap_Session_run_dtmf_callback},
+		{"setInputCallback", _wrap_Session_setInputCallback},
+		{"setHangupHook", _wrap_Session_setHangupHook},
+		{"ready", _wrap_Session_ready},
+		{"setLUA", _wrap_Session_setLUA},
+		{0, 0}
+	};
+	static swig_lua_attribute swig_LUA_Session_attributes[] = {
+		{"cb_function", _wrap_Session_cb_function_get, _wrap_Session_cb_function_set},
+		{"cb_arg", _wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set},
+		{"hangup_func_str", _wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set},
+		{"hangup_func_arg", _wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set},
+		{0, 0, 0}
+	};
+	static swig_lua_class *swig_LUA_Session_bases[] = { 0, 0 };
+	static const char *swig_LUA_Session_base_names[] = { "CoreSession *", 0 };
+	static swig_lua_class _wrap_class_LUA_Session =
+		{ "Session", &SWIGTYPE_p_LUA__Session, _wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes,
+swig_LUA_Session_bases, swig_LUA_Session_base_names };
 
 #ifdef __cplusplus
 }
 #endif
 
 static const struct luaL_reg swig_commands[] = {
-    { "consoleLog", _wrap_consoleLog},
-    { "consoleCleanLog", _wrap_consoleCleanLog},
-    { "console_log", _wrap_console_log},
-    { "console_clean_log", _wrap_console_clean_log},
-    { "bridge", _wrap_bridge},
-    { "hanguphook", _wrap_hanguphook},
-    { "dtmf_callback", _wrap_dtmf_callback},
-    {0,0}
+	{"consoleLog", _wrap_consoleLog},
+	{"consoleCleanLog", _wrap_consoleCleanLog},
+	{"console_log", _wrap_console_log},
+	{"console_clean_log", _wrap_console_clean_log},
+	{"bridge", _wrap_bridge},
+	{"hanguphook", _wrap_hanguphook},
+	{"dtmf_callback", _wrap_dtmf_callback},
+	{0, 0}
 };
 
 static swig_lua_var_info swig_variables[] = {
-    {0,0,0}
+	{0, 0, 0}
 };
 
 static swig_lua_const_info swig_constants[] = {
-{ SWIG_LUA_INT,     (char *)"S_HUP", (long) S_HUP, 0, 0, 0},
-{ SWIG_LUA_INT,     (char *)"S_FREE", (long) S_FREE, 0, 0, 0},
-{ SWIG_LUA_INT,     (char *)"S_RDLOCK", (long) S_RDLOCK, 0, 0, 0},
-    {0,0,0,0,0,0}
+	{SWIG_LUA_INT, (char *) "S_HUP", (long) S_HUP, 0, 0, 0},
+	{SWIG_LUA_INT, (char *) "S_FREE", (long) S_FREE, 0, 0, 0},
+	{SWIG_LUA_INT, (char *) "S_RDLOCK", (long) S_RDLOCK, 0, 0, 0},
+	{0, 0, 0, 0, 0, 0}
 };
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
-static void *_p_LUA__SessionTo_p_CoreSession(void *x, int *newmemory) {
-    return (void *)((CoreSession *)  ((LUA::Session *) x));
+static void *_p_LUA__SessionTo_p_CoreSession(void *x, int *newmemory)
+{
+	return (void *) ((CoreSession *) ((LUA::Session *) x));
 }
-static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)&_wrap_class_API, 0};
-static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)&_wrap_class_CoreSession, 0};
-static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)&_wrap_class_Event, 0};
-static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0};
-static swig_type_info _swigt__p_LUA__Session = {"_p_LUA__Session", "LUA::Session *", 0, 0, (void*)&_wrap_class_LUA_Session, 0};
-static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0};
-static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0};
-static swig_type_info _swigt__p_lua_State = {"_p_lua_State", "lua_State *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_API = { "_p_API", "API *", 0, 0, (void *) &_wrap_class_API, 0 };
+static swig_type_info _swigt__p_CoreSession = { "_p_CoreSession", "CoreSession *", 0, 0, (void *) &_wrap_class_CoreSession, 0 };
+static swig_type_info _swigt__p_Event = { "_p_Event", "Event *", 0, 0, (void *) &_wrap_class_Event, 0 };
+static swig_type_info _swigt__p_IVRMenu = { "_p_IVRMenu", "IVRMenu *", 0, 0, (void *) &_wrap_class_IVRMenu, 0 };
+static swig_type_info _swigt__p_LUA__Session = { "_p_LUA__Session", "LUA::Session *", 0, 0, (void *) &_wrap_class_LUA_Session, 0 };
+static swig_type_info _swigt__p_Stream = { "_p_Stream", "Stream *", 0, 0, (void *) &_wrap_class_Stream, 0 };
+static swig_type_info _swigt__p_input_callback_state =
+	{ "_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void *) &_wrap_class_input_callback_state_t, 0 };
+static swig_type_info _swigt__p_lua_State = { "_p_lua_State", "lua_State *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_session_flag_t = { "_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_event_t = { "_p_switch_event_t", "switch_event_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_input_args_t = { "_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_input_type_t = { "_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_priority_t = { "_p_switch_priority_t", "switch_priority_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_status_t = { "_p_switch_status_t", "switch_status_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_stream_handle_t = { "_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_void = { "_p_void", "void *", 0, 0, (void *) 0, 0 };
 
 static swig_type_info *swig_type_initial[] = {
-  &_swigt__p_API,
-  &_swigt__p_CoreSession,
-  &_swigt__p_Event,
-  &_swigt__p_IVRMenu,
-  &_swigt__p_LUA__Session,
-  &_swigt__p_Stream,
-  &_swigt__p_input_callback_state,
-  &_swigt__p_lua_State,
-  &_swigt__p_session_flag_t,
-  &_swigt__p_switch_channel_state_t,
-  &_swigt__p_switch_channel_t,
-  &_swigt__p_switch_core_session_t,
-  &_swigt__p_switch_event_t,
-  &_swigt__p_switch_input_args_t,
-  &_swigt__p_switch_input_type_t,
-  &_swigt__p_switch_priority_t,
-  &_swigt__p_switch_status_t,
-  &_swigt__p_switch_stream_handle_t,
-  &_swigt__p_void,
+	&_swigt__p_API,
+	&_swigt__p_CoreSession,
+	&_swigt__p_Event,
+	&_swigt__p_IVRMenu,
+	&_swigt__p_LUA__Session,
+	&_swigt__p_Stream,
+	&_swigt__p_input_callback_state,
+	&_swigt__p_lua_State,
+	&_swigt__p_session_flag_t,
+	&_swigt__p_switch_channel_state_t,
+	&_swigt__p_switch_channel_t,
+	&_swigt__p_switch_core_session_t,
+	&_swigt__p_switch_event_t,
+	&_swigt__p_switch_input_args_t,
+	&_swigt__p_switch_input_type_t,
+	&_swigt__p_switch_priority_t,
+	&_swigt__p_switch_status_t,
+	&_swigt__p_switch_stream_handle_t,
+	&_swigt__p_void,
 };
 
-static swig_cast_info _swigc__p_API[] = {  {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_LUA__Session, _p_LUA__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Event[] = {  {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_IVRMenu[] = {  {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_LUA__Session[] = {  {&_swigt__p_LUA__Session, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Stream[] = {  {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_input_callback_state[] = {  {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_lua_State[] = {  {&_swigt__p_lua_State, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_session_flag_t[] = {  {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_state_t[] = {  {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_t[] = {  {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_core_session_t[] = {  {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_event_t[] = {  {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_args_t[] = {  {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_type_t[] = {  {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_priority_t[] = {  {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_status_t[] = {  {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_stream_handle_t[] = {  {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_CoreSession[] =
+	{ {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_LUA__Session, _p_LUA__SessionTo_p_CoreSession, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_lua_State[] = { {&_swigt__p_lua_State, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0}, {0, 0, 0, 0} };
 
 static swig_cast_info *swig_cast_initial[] = {
-  _swigc__p_API,
-  _swigc__p_CoreSession,
-  _swigc__p_Event,
-  _swigc__p_IVRMenu,
-  _swigc__p_LUA__Session,
-  _swigc__p_Stream,
-  _swigc__p_input_callback_state,
-  _swigc__p_lua_State,
-  _swigc__p_session_flag_t,
-  _swigc__p_switch_channel_state_t,
-  _swigc__p_switch_channel_t,
-  _swigc__p_switch_core_session_t,
-  _swigc__p_switch_event_t,
-  _swigc__p_switch_input_args_t,
-  _swigc__p_switch_input_type_t,
-  _swigc__p_switch_priority_t,
-  _swigc__p_switch_status_t,
-  _swigc__p_switch_stream_handle_t,
-  _swigc__p_void,
+	_swigc__p_API,
+	_swigc__p_CoreSession,
+	_swigc__p_Event,
+	_swigc__p_IVRMenu,
+	_swigc__p_LUA__Session,
+	_swigc__p_Stream,
+	_swigc__p_input_callback_state,
+	_swigc__p_lua_State,
+	_swigc__p_session_flag_t,
+	_swigc__p_switch_channel_state_t,
+	_swigc__p_switch_channel_t,
+	_swigc__p_switch_core_session_t,
+	_swigc__p_switch_event_t,
+	_swigc__p_switch_input_args_t,
+	_swigc__p_switch_input_type_t,
+	_swigc__p_switch_priority_t,
+	_swigc__p_switch_status_t,
+	_swigc__p_switch_stream_handle_t,
+	_swigc__p_void,
 };
 
 
@@ -6343,161 +6810,163 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-} /* c-mode */
+}								/* c-mode */
 #endif
 #endif
-
 #if 0
 #define SWIGRUNTIME_DEBUG
 #endif
+SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
+{
+	size_t i;
+	swig_module_info *module_head, *iter;
+	int found, init;
+
+	clientdata = clientdata;
+
+	/* check to see if the circular list has been setup, if not, set it up */
+	if (swig_module.next == 0) {
+		/* Initialize the swig_module */
+		swig_module.type_initial = swig_type_initial;
+		swig_module.cast_initial = swig_cast_initial;
+		swig_module.next = &swig_module;
+		init = 1;
+	} else {
+		init = 0;
+	}
 
+	/* Try and load any already created modules */
+	module_head = SWIG_GetModule(clientdata);
+	if (!module_head) {
+		/* This is the first module loaded for this interpreter */
+		/* so set the swig module into the interpreter */
+		SWIG_SetModule(clientdata, &swig_module);
+		module_head = &swig_module;
+	} else {
+		/* the interpreter has loaded a SWIG module, but has it loaded this one? */
+		found = 0;
+		iter = module_head;
+		do {
+			if (iter == &swig_module) {
+				found = 1;
+				break;
+			}
+			iter = iter->next;
+		} while (iter != module_head);
+
+		/* if the is found in the list, then all is done and we may leave */
+		if (found)
+			return;
+		/* otherwise we must add out module into the list */
+		swig_module.next = module_head->next;
+		module_head->next = &swig_module;
+	}
 
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
-  size_t i;
-  swig_module_info *module_head, *iter;
-  int found, init;
-
-  clientdata = clientdata;
-
-  /* check to see if the circular list has been setup, if not, set it up */
-  if (swig_module.next==0) {
-    /* Initialize the swig_module */
-    swig_module.type_initial = swig_type_initial;
-    swig_module.cast_initial = swig_cast_initial;
-    swig_module.next = &swig_module;
-    init = 1;
-  } else {
-    init = 0;
-  }
-
-  /* Try and load any already created modules */
-  module_head = SWIG_GetModule(clientdata);
-  if (!module_head) {
-    /* This is the first module loaded for this interpreter */
-    /* so set the swig module into the interpreter */
-    SWIG_SetModule(clientdata, &swig_module);
-    module_head = &swig_module;
-  } else {
-    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
-    found=0;
-    iter=module_head;
-    do {
-      if (iter==&swig_module) {
-        found=1;
-        break;
-      }
-      iter=iter->next;
-    } while (iter!= module_head);
-
-    /* if the is found in the list, then all is done and we may leave */
-    if (found) return;
-    /* otherwise we must add out module into the list */
-    swig_module.next = module_head->next;
-    module_head->next = &swig_module;
-  }
-
-  /* When multiple interpeters are used, a module could have already been initialized in
-     a different interpreter, but not yet have a pointer in this interpreter.
-     In this case, we do not want to continue adding types... everything should be
-     set up already */
-  if (init == 0) return;
+	/* When multiple interpeters are used, a module could have already been initialized in
+	   a different interpreter, but not yet have a pointer in this interpreter.
+	   In this case, we do not want to continue adding types... everything should be
+	   set up already */
+	if (init == 0)
+		return;
 
-  /* Now work on filling in swig_module.types */
+	/* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
-  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+	printf("SWIG_InitializeModule: size %d\n", swig_module.size);
 #endif
-  for (i = 0; i < swig_module.size; ++i) {
-    swig_type_info *type = 0;
-    swig_type_info *ret;
-    swig_cast_info *cast;
-  
+	for (i = 0; i < swig_module.size; ++i) {
+		swig_type_info *type = 0;
+		swig_type_info *ret;
+		swig_cast_info *cast;
+
 #ifdef SWIGRUNTIME_DEBUG
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
 #endif
 
-    /* if there is another module already loaded */
-    if (swig_module.next != &swig_module) {
-      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
-    }
-    if (type) {
-      /* Overwrite clientdata field */
+		/* if there is another module already loaded */
+		if (swig_module.next != &swig_module) {
+			type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+		}
+		if (type) {
+			/* Overwrite clientdata field */
 #ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: found type %s\n", type->name);
+			printf("SWIG_InitializeModule: found type %s\n", type->name);
 #endif
-      if (swig_module.type_initial[i]->clientdata) {
-	type->clientdata = swig_module.type_initial[i]->clientdata;
+			if (swig_module.type_initial[i]->clientdata) {
+				type->clientdata = swig_module.type_initial[i]->clientdata;
 #ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+				printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
 #endif
-      }
-    } else {
-      type = swig_module.type_initial[i];
-    }
+			}
+		} else {
+			type = swig_module.type_initial[i];
+		}
+
+		/* Insert casting types */
+		cast = swig_module.cast_initial[i];
+		while (cast->type) {
 
-    /* Insert casting types */
-    cast = swig_module.cast_initial[i];
-    while (cast->type) {
-    
-      /* Don't need to add information already in the list */
-      ret = 0;
+			/* Don't need to add information already in the list */
+			ret = 0;
 #ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+			printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
 #endif
-      if (swig_module.next != &swig_module) {
-        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+			if (swig_module.next != &swig_module) {
+				ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
 #ifdef SWIGRUNTIME_DEBUG
-	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+				if (ret)
+					printf("SWIG_InitializeModule: found cast %s\n", ret->name);
 #endif
-      }
-      if (ret) {
-	if (type == swig_module.type_initial[i]) {
+			}
+			if (ret) {
+				if (type == swig_module.type_initial[i]) {
 #ifdef SWIGRUNTIME_DEBUG
-	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+					printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
 #endif
-	  cast->type = ret;
-	  ret = 0;
-	} else {
-	  /* Check for casting already in the list */
-	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+					cast->type = ret;
+					ret = 0;
+				} else {
+					/* Check for casting already in the list */
+					swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
 #ifdef SWIGRUNTIME_DEBUG
-	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+					if (ocast)
+						printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
 #endif
-	  if (!ocast) ret = 0;
-	}
-      }
+					if (!ocast)
+						ret = 0;
+				}
+			}
 
-      if (!ret) {
+			if (!ret) {
 #ifdef SWIGRUNTIME_DEBUG
-	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+				printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
 #endif
-        if (type->cast) {
-          type->cast->prev = cast;
-          cast->next = type->cast;
-        }
-        type->cast = cast;
-      }
-      cast++;
-    }
-    /* Set entry in modules->types array equal to the type */
-    swig_module.types[i] = type;
-  }
-  swig_module.types[i] = 0;
+				if (type->cast) {
+					type->cast->prev = cast;
+					cast->next = type->cast;
+				}
+				type->cast = cast;
+			}
+			cast++;
+		}
+		/* Set entry in modules->types array equal to the type */
+		swig_module.types[i] = type;
+	}
+	swig_module.types[i] = 0;
 
 #ifdef SWIGRUNTIME_DEBUG
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
-  for (i = 0; i < swig_module.size; ++i) {
-    int j = 0;
-    swig_cast_info *cast = swig_module.cast_initial[i];
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-    while (cast->type) {
-      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
-      cast++;
-      ++j;
-    }
-  printf("---- Total casts: %d\n",j);
-  }
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
+	printf("**** SWIG_InitializeModule: Cast List ******\n");
+	for (i = 0; i < swig_module.size; ++i) {
+		int j = 0;
+		swig_cast_info *cast = swig_module.cast_initial[i];
+		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+		while (cast->type) {
+			printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+			cast++;
+			++j;
+		}
+		printf("---- Total casts: %d\n", j);
+	}
+	printf("**** SWIG_InitializeModule: Cast List ******\n");
 #endif
 }
 
@@ -6506,32 +6975,33 @@
 * of equivalent types.  It is like calling
 * SWIG_TypeClientData(type, clientdata) a second time.
 */
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
-  size_t i;
-  swig_cast_info *equiv;
-  static int init_run = 0;
-
-  if (init_run) return;
-  init_run = 1;
-
-  for (i = 0; i < swig_module.size; i++) {
-    if (swig_module.types[i]->clientdata) {
-      equiv = swig_module.types[i]->cast;
-      while (equiv) {
-        if (!equiv->converter) {
-          if (equiv->type && !equiv->type->clientdata)
-            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
-        }
-        equiv = equiv->next;
-      }
-    }
-  }
+SWIGRUNTIME void SWIG_PropagateClientData(void)
+{
+	size_t i;
+	swig_cast_info *equiv;
+	static int init_run = 0;
+
+	if (init_run)
+		return;
+	init_run = 1;
+
+	for (i = 0; i < swig_module.size; i++) {
+		if (swig_module.types[i]->clientdata) {
+			equiv = swig_module.types[i]->cast;
+			while (equiv) {
+				if (!equiv->converter) {
+					if (equiv->type && !equiv->type->clientdata)
+						SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+				}
+				equiv = equiv->next;
+			}
+		}
+	}
 }
 
 #ifdef __cplusplus
 #if 0
-{ /* c-mode */
+{								/* c-mode */
 #endif
 }
 #endif
@@ -6539,8 +7009,8 @@
 
 
 /* Forward declaration of where the user's %init{} gets inserted */
-void SWIG_init_user(lua_State* L );
-    
+void SWIG_init_user(lua_State * L);
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -6548,61 +7018,58 @@
   added at the very end of the code
   the function is always called SWIG_init, but an eariler #define will rename it
 */
-SWIGEXPORT int SWIG_init(lua_State* L)
-{
-  int i;
-  /* start with global table */
-  lua_pushvalue(L,LUA_GLOBALSINDEX);
-  /* SWIG's internal initalisation */
-  SWIG_InitializeModule((void*)L);
-  SWIG_PropagateClientData();
-  /* add a global fn */
-  SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
-  SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
-  /* begin the module (its a table with the same name as the module) */
-  SWIG_Lua_module_begin(L,SWIG_name);
-  /* add commands/functions */
-  for (i = 0; swig_commands[i].name; i++){
-    SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
-  }
-  /* add variables */
-  for (i = 0; swig_variables[i].name; i++){
-    SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
-  }
-  /* set up base class pointers (the hierachy) */
-  for (i = 0; swig_types[i]; i++){
-    if (swig_types[i]->clientdata){
-      SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
-    }
-  }
-  /* additional registration structs & classes in lua */
-  for (i = 0; swig_types[i]; i++){
-    if (swig_types[i]->clientdata){
-      SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
-    }
-  }
-  /* constants */
-  SWIG_Lua_InstallConstants(L,swig_constants);
-  /* invoke user-specific initialization */
-  SWIG_init_user(L);
-  /* end module */
-  lua_pop(L,1);  /* tidy stack (remove module table)*/
-  lua_pop(L,1);  /* tidy stack (remove global table)*/
-  return 1;
-}
+	SWIGEXPORT int SWIG_init(lua_State * L) {
+		int i;
+		/* start with global table */
+		    lua_pushvalue(L, LUA_GLOBALSINDEX);
+		/* SWIG's internal initalisation */
+		    SWIG_InitializeModule((void *) L);
+		    SWIG_PropagateClientData();
+		/* add a global fn */
+		    SWIG_Lua_add_function(L, "swig_type", SWIG_Lua_type);
+		    SWIG_Lua_add_function(L, "swig_equals", SWIG_Lua_equal);
+		/* begin the module (its a table with the same name as the module) */
+		    SWIG_Lua_module_begin(L, SWIG_name);
+		/* add commands/functions */
+		for (i = 0; swig_commands[i].name; i++) {
+			SWIG_Lua_module_add_function(L, swig_commands[i].name, swig_commands[i].func);
+		}
+		/* add variables */ for (i = 0; swig_variables[i].name; i++) {
+			SWIG_Lua_module_add_variable(L, swig_variables[i].name, swig_variables[i].get, swig_variables[i].set);
+		}
+		/* set up base class pointers (the hierachy) */
+		for (i = 0; swig_types[i]; i++) {
+			if (swig_types[i]->clientdata) {
+				SWIG_Lua_init_base_class(L, (swig_lua_class *) (swig_types[i]->clientdata));
+			}
+		}
+		/* additional registration structs & classes in lua */
+		for (i = 0; swig_types[i]; i++) {
+			if (swig_types[i]->clientdata) {
+				SWIG_Lua_class_register(L, (swig_lua_class *) (swig_types[i]->clientdata));
+			}
+		}
+		/* constants */
+		SWIG_Lua_InstallConstants(L, swig_constants);
+		/* invoke user-specific initialization */
+		SWIG_init_user(L);
+		/* end module */
+		lua_pop(L, 1);			/* tidy stack (remove module table) */
+		lua_pop(L, 1);			/* tidy stack (remove global table) */
+		return 1;
+	}
 
 #ifdef __cplusplus
 }
 #endif
 
 
-const char* SWIG_LUACODE=
-  "";
+const char *SWIG_LUACODE = "";
 
-void SWIG_init_user(lua_State* L)
+void SWIG_init_user(lua_State * L)
 {
-  /* exec Lua code if applicable */
-  SWIG_Lua_dostring(L,SWIG_LUACODE);
+	/* exec Lua code if applicable */
+	SWIG_Lua_dostring(L, SWIG_LUACODE);
 }
 
 #include "mod_lua_extra.c"

Modified: freeswitch/trunk/src/mod/languages/mod_mono/freeswitch_mono.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_mono/freeswitch_mono.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_mono/freeswitch_mono.cpp	Tue May 27 00:54:52 2008
@@ -27,8 +27,8 @@
  * 
  * freeswitch_mono.cpp -- Mono-specific CoreSession subclass
  *
- */
-
+ */  
+	
 #include <switch.h>
 #include <switch_cpp.h>
 #include <glib.h>
@@ -38,77 +38,71 @@
 #include <mono/metadata/threads.h>
 #include <mono/metadata/metadata.h>
 #include "freeswitch_mono.h"
+
MonoSession::MonoSession():CoreSession() 
+{
+
} 

MonoSession::MonoSession(char *uuid):CoreSession(uuid) 
+{
+
} 

MonoSession::MonoSession(switch_core_session_t *session):CoreSession(session) 
+{
+
} 

MonoSession::~MonoSession() 
+{
+	
mono_thread_attach(globals.domain);
+	
if (dtmfDelegateHandle)
+		mono_gchandle_free(dtmfDelegateHandle);
+	
if (hangupDelegateHandle)
+		mono_gchandle_free(hangupDelegateHandle);
+
}
+
+

bool MonoSession::begin_allow_threads() 
+{
+	
return true;
+
}
+
+

bool MonoSession::end_allow_threads() 
+{
+	
return true;
+
}
+

void MonoSession::check_hangup_hook() 
+{
+	
mono_thread_attach(globals.domain);
+	
if (!hangupDelegateHandle) {
+		
return;
+	
}
+	
MonoObject * hangupDelegate = mono_gchandle_get_target(hangupDelegateHandle);
+	
if (!hangupDelegate) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegateHandle didn't get an object.");
+		
return;
+	
}
+	
MonoObject * ex = NULL;
+	
mono_runtime_delegate_invoke(hangupDelegate, NULL, &ex);
+	
if (ex) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegate threw an exception.");
+	
}
+
}
+

switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype) 
+{
+	
mono_thread_attach(globals.domain);
+	
if (!dtmfDelegateHandle) {
+		
return SWITCH_STATUS_SUCCESS;
+	
}
+	
MonoObject * dtmfDelegate = mono_gchandle_get_target(dtmfDelegateHandle);
+	
if (!dtmfDelegate) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegateHandle didn't get an object.");
+		
return SWITCH_STATUS_SUCCESS;
+	
}
+	
void *args[2];
+	
args[0] = &input;
+	
args[1] = &itype;
+	
MonoObject * ex = NULL;
+	
MonoObject * res = mono_runtime_delegate_invoke(dtmfDelegate, args, &ex);
+	
if (ex) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegate threw an exception.");
+		
return SWITCH_STATUS_FALSE;
+	
}
+	
char *resPtr = mono_string_to_utf8((MonoString *) res);
+	
switch_status_t status = process_callback_result(resPtr);
+	

g_free(resPtr);
+	
return status;
+
}
+
 
-MonoSession::MonoSession() : CoreSession() 
-{
-}
-
-MonoSession::MonoSession(char *uuid) : CoreSession(uuid)
-{
-}
-
-MonoSession::MonoSession(switch_core_session_t *session) : CoreSession(session)
-{
-}
-
-MonoSession::~MonoSession()
-{
-	mono_thread_attach(globals.domain);
-	if (dtmfDelegateHandle) mono_gchandle_free(dtmfDelegateHandle);
-	if (hangupDelegateHandle) mono_gchandle_free(hangupDelegateHandle);
-}
-
-bool MonoSession::begin_allow_threads()
-{
-    return true;
-}
-
-bool MonoSession::end_allow_threads()
-{
-    return true;
-}
-
-void MonoSession::check_hangup_hook()  
-{
-	mono_thread_attach(globals.domain);
-	if (!hangupDelegateHandle) {
-		return;
-	}
-	MonoObject *hangupDelegate = mono_gchandle_get_target(hangupDelegateHandle);
-	if (!hangupDelegate) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegateHandle didn't get an object.");
-		return;
-	}
-	MonoObject *ex = NULL;
-	mono_runtime_delegate_invoke(hangupDelegate, NULL, &ex);
-	if (ex) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegate threw an exception.");
-	}
-}
-
-switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype)
-{
-	mono_thread_attach(globals.domain);
-	if (!dtmfDelegateHandle) {
-		return SWITCH_STATUS_SUCCESS;
-	}
-	MonoObject *dtmfDelegate = mono_gchandle_get_target(dtmfDelegateHandle);
-	if (!dtmfDelegate) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegateHandle didn't get an object.");
-		return SWITCH_STATUS_SUCCESS;
-	}
-	void *args[2];
-	args[0] = &input;
-	args[1] = &itype;
-	MonoObject *ex = NULL;
-	MonoObject *res = mono_runtime_delegate_invoke(dtmfDelegate, args, &ex);
-	if (ex) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegate threw an exception.");
-		return SWITCH_STATUS_FALSE;
-	}
-	char *resPtr = mono_string_to_utf8((MonoString*)res);
-	switch_status_t status = process_callback_result(resPtr);
-
-	g_free(resPtr);
-	return status;
-}

Modified: freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.cpp	Tue May 27 00:54:52 2008
@@ -30,13 +30,10 @@
  * Most of mod_mono is implmented in the mod_mono_managed Loader class. 
  * The native code just handles getting the Mono runtime up and down
  * and passing pointers into managed code.
- */
-
+ */  
+	
 #include <switch.h>
-
-
-SWITCH_BEGIN_EXTERN_C
-
+	

SWITCH_BEGIN_EXTERN_C 
 
 #include "freeswitch_mono.h"
 #include <glib.h>
 #include <mono/jit/jit.h>
@@ -44,284 +41,278 @@
 #include <mono/metadata/environment.h>
 #include <mono/metadata/threads.h>
 #include <mono/metadata/debug-helpers.h>
-
+	
 #ifdef WIN32
 #include <shlobj.h>
 #define EXPORT __declspec(dllexport)
 #elif
 #define EXPORT 
-#endif
-
+#endif	/* 
 */
+	
 #define MOD_MONO_MANAGED_DLL "mod_mono_managed.dll"
-
-mod_mono_globals globals = { 0 };
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load);
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown);
-SWITCH_MODULE_DEFINITION(mod_mono, mod_mono_load, mod_mono_shutdown, NULL);
-
-SWITCH_STANDARD_API(monorun_api_function); /* ExecuteBackground */
-SWITCH_STANDARD_API(mono_api_function); /* Execute */
-SWITCH_STANDARD_APP(mono_app_function); /* Run */
-
-
+	
mod_mono_globals globals = {
+0};
+
+

SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load);
+
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown);
+
SWITCH_MODULE_DEFINITION(mod_mono, mod_mono_load, mod_mono_shutdown, NULL);
+

SWITCH_STANDARD_API(monorun_api_function);	/* ExecuteBackground */
+
SWITCH_STANDARD_API(mono_api_function);	/* Execute */
+
SWITCH_STANDARD_APP(mono_app_function);	/* Run */
+


 // Sets up delegates (and anything else needed) on the MonoSession object
 // Called via internalcall
-SWITCH_MOD_DECLARE(void) InitMonoSession(MonoSession *session, MonoObject *dtmfDelegate, MonoObject *hangupDelegate)
-{
-	switch_assert(session);
-	if (!session) return;
-	session->setDTMFCallback(NULL, "");
-	session->setHangupHook(NULL);
-	session->dtmfDelegateHandle = mono_gchandle_new(dtmfDelegate, FALSE);
-	session->hangupDelegateHandle = mono_gchandle_new(hangupDelegate, FALSE);
-}
-
-switch_status_t setMonoDirs() 
-{
+	SWITCH_MOD_DECLARE(void) InitMonoSession(MonoSession * session, MonoObject * dtmfDelegate, MonoObject * hangupDelegate) 
+{
+	
switch_assert(session);
+	
if (!session)
+		return;
+	
session->setDTMFCallback(NULL, "");
+	
session->setHangupHook(NULL);
+	
session->dtmfDelegateHandle = mono_gchandle_new(dtmfDelegate, FALSE);
+	
session->hangupDelegateHandle = mono_gchandle_new(hangupDelegate, FALSE);
+
}
+

switch_status_t setMonoDirs() 
+{
+	
 #ifdef WIN32	
-	/* Win32 Mono installs can't figure out their own path
-	// Guys in #mono say we should just deploy all the libs we need
-	// I think it's much nicer to let the user deal with installing Mono
-	// and we'll just look for it in program files. */
-	HANDLE hFind;
-	WIN32_FIND_DATA findData;
-	char progFilesPath[MAX_PATH];
-	char findPath[MAX_PATH];
-	SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, progFilesPath);
-	switch_snprintf(findPath, MAX_PATH, "%s\\Mono-*", progFilesPath);
-	hFind = FindFirstFile(findPath, &findData);
-	if (hFind == INVALID_HANDLE_VALUE) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error looking for Mono in Program Files.\n");
-		return SWITCH_STATUS_FALSE;
-	}
-	while((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) {
-		if (FindNextFile(hFind, &findData) == 0) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find Mono directory in Program Files.\n");
-			FindClose(hFind);
-			return SWITCH_STATUS_FALSE;
-		}
-	}
-	/* Got it */
-	{
-		char libPath[MAX_PATH];
-		char etcPath[MAX_PATH];
-		switch_snprintf(libPath, MAX_PATH, "%s\\%s\\lib", progFilesPath, findData.cFileName);
-		switch_snprintf(etcPath, MAX_PATH, "%s\\%s\\etc", progFilesPath, findData.cFileName);
-		FindClose(hFind);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Using Mono paths '%s' and '%s'.\n", libPath, etcPath);
-		mono_set_dirs(libPath, etcPath);
-		return SWITCH_STATUS_SUCCESS;
-	}
+		/* Win32 Mono installs can't figure out their own path
+		   // Guys in #mono say we should just deploy all the libs we need
+		   // I think it's much nicer to let the user deal with installing Mono
+		   // and we'll just look for it in program files. */ 
+		HANDLE hFind;
+	
WIN32_FIND_DATA findData;
+	
char progFilesPath[MAX_PATH];
+	
char findPath[MAX_PATH];
+	
SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, progFilesPath);
+	
switch_snprintf(findPath, MAX_PATH, "%s\\Mono-*", progFilesPath);
+	
hFind = FindFirstFile(findPath, &findData);
+	
if (hFind == INVALID_HANDLE_VALUE) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error looking for Mono in Program Files.\n");
+		
return SWITCH_STATUS_FALSE;
+	
}
+	
while ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) {
+		
if (FindNextFile(hFind, &findData) == 0) {
+			
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find Mono directory in Program Files.\n");
+			
FindClose(hFind);
+			
return SWITCH_STATUS_FALSE;
+		
}
+	
}
+	
+		/* Got it */ 
+	{
+		
char libPath[MAX_PATH];
+		
char etcPath[MAX_PATH];
+		
switch_snprintf(libPath, MAX_PATH, "%s\\%s\\lib", progFilesPath, findData.cFileName);
+		
switch_snprintf(etcPath, MAX_PATH, "%s\\%s\\etc", progFilesPath, findData.cFileName);
+		
FindClose(hFind);
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Using Mono paths '%s' and '%s'.\n", libPath, etcPath);
+		
mono_set_dirs(libPath, etcPath);
+		
return SWITCH_STATUS_SUCCESS;
+	
}
+	
 #elif
-	// On other platforms, it should just work if it hasn't been relocated
-	mono_set_dirs(NULL, NULL);
-	return SWITCH_STATUS_SUCCESS;
-#endif
-}
-
-switch_status_t loadModMonoManaged() 
-{ 
-	/* Find and load mod_mono_managed.exe */
-	char filename[256];
-	switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MONO_MANAGED_DLL);
-	globals.domain = mono_jit_init(filename);
-
-	if (!globals.domain) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_jit_init failed.\n");
-		return SWITCH_STATUS_FALSE;
-	}
-
-	/* Open the assembly */
-	globals.mod_mono_asm = mono_domain_assembly_open(globals.domain, filename);
-	if (!globals.mod_mono_asm) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_domain_assembly_open failed.\n");
-		return SWITCH_STATUS_FALSE;
-	}
-	return SWITCH_STATUS_SUCCESS;
-}
-
-MonoMethod *getMethod(const char *name, MonoClass *klass) 
-{
-	MonoMethodDesc *desc;
-	MonoMethod *method;
-	desc = mono_method_desc_new(name, TRUE);
-	method = mono_method_desc_search_in_class(desc, klass);
-	if (!method) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find %s method.\n", name);
-		return NULL;
-	}
-	return method;
-}
-
-switch_status_t findLoader() 
-{
-	/* Find loader class and methods*/
-	MonoImage* img;
-	MonoClass* loaderClass;
-	img = mono_assembly_get_image(globals.mod_mono_asm);
-	loaderClass = mono_class_from_name(img, "FreeSWITCH", "Loader");
-	if (!loaderClass) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find FreeSWITCH.Loader class.\n");
-		return SWITCH_STATUS_FALSE;
-	}
-
-	globals.loadMethod = getMethod("FreeSWITCH.Loader:Load()", loaderClass);
-	if (!globals.loadMethod) return SWITCH_STATUS_FALSE;
-
-	globals.unloadMethod = getMethod("FreeSWITCH.Loader:Unload()", loaderClass);
-	if (!globals.unloadMethod) return SWITCH_STATUS_FALSE;
-
-	globals.runMethod = getMethod("FreeSWITCH.Loader:Run(string,intptr)", loaderClass);
-	if (!globals.runMethod) return SWITCH_STATUS_FALSE;
-
-	globals.executeMethod = getMethod("FreeSWITCH.Loader:Execute(string,intptr,intptr)", loaderClass);
-	if (!globals.executeMethod) return SWITCH_STATUS_FALSE;
-	
-	globals.executeBackgroundMethod = getMethod("FreeSWITCH.Loader:ExecuteBackground(string)", loaderClass);
-	if (!globals.executeBackgroundMethod) return SWITCH_STATUS_FALSE;
-
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found all loader functions.\n");
-	return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load) 
-{
-	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-	globals.pool = pool;
-
-	if (setMonoDirs() != SWITCH_STATUS_SUCCESS) {
-		return SWITCH_STATUS_FALSE;
-	}
-	if (loadModMonoManaged() != SWITCH_STATUS_SUCCESS) {
-		return SWITCH_STATUS_FALSE;
-	}
-	if (findLoader() != SWITCH_STATUS_SUCCESS) {
-		return SWITCH_STATUS_FALSE;
-	}
-		
-	/* Not sure if this is necesary on the loading thread */
-	mono_thread_attach(globals.domain);
-	mono_add_internal_call("FreeSWITCH.Native.MonoSession::InitMonoSession", InitMonoSession);
-
-	/* Run loader */
-	MonoObject *objResult;
-	MonoObject *exception = NULL;
-	objResult = mono_runtime_invoke(globals.loadMethod, NULL, NULL, &exception);
-	if (exception) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load threw an exception.\n");
-		mono_print_unhandled_exception(exception);
-		return SWITCH_STATUS_FALSE;
-	}
-	if (*(int*)mono_object_unbox(objResult)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Load completed successfully.\n");
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load did not return true.\n");
-		return SWITCH_STATUS_FALSE;
-	}
-
-
-	/* We're good to register */
-	switch_api_interface_t *api_interface;
-	switch_application_interface_t *app_interface;
-
-	SWITCH_ADD_API(api_interface, "monorun", "Run a module (ExecuteBackground)", monorun_api_function, "<module> [<args>]");
-	SWITCH_ADD_API(api_interface, "mono", "Run a module as an API function (Execute)", mono_api_function, "<module> [<args>]");
-	SWITCH_ADD_APP(app_interface, "mono", "Run Mono IVR", "Run a Mono IVR on a channel", mono_app_function, "<modulename> [<args>]", SAF_NONE);
-	
-	return SWITCH_STATUS_SUCCESS;	
-}
-
-SWITCH_STANDARD_API(monorun_api_function) 
-{
-	// TODO: Should we be detaching after all this?
-	mono_thread_attach(globals.domain);
-	if (switch_strlen_zero(cmd)) {
-		stream->write_function(stream, "-ERR no args specified!\n");
-		return SWITCH_STATUS_SUCCESS;
-	}
-
-	// ExecuteBackground(string command)
-	void *args[1];
-	args[0] = mono_string_new(globals.domain, cmd);
-	MonoObject *exception = NULL;
-	MonoObject *objResult = mono_runtime_invoke(globals.executeBackgroundMethod, NULL, args, &exception);
-	if (exception) {
-		stream->write_function(stream, "-ERR FreeSWITCH.Loader.ExecuteBackground threw an exception.\n");
-		mono_print_unhandled_exception(exception);
-		return SWITCH_STATUS_SUCCESS;
-	}
-	if (*(int*)mono_object_unbox(objResult)) {
-		stream->write_function(stream, "+OK\n");
-	} else {
-		stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module?).\n");
-	}
-	return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_STANDARD_API(mono_api_function)
-{
-	mono_thread_attach(globals.domain);
-	if (switch_strlen_zero(cmd)) {
-		stream->write_function(stream, "-ERR no args specified!\n");
-		return SWITCH_STATUS_SUCCESS;
-	}
-	
-	// Method is: Execute(string command, IntPtr streamPtr, IntPtr eventPtr)
-	void *args[3];
-	args[0] = mono_string_new(globals.domain, cmd);
-	args[1] = &stream; // Address of the arguments
-	args[2] = &(stream->param_event);
-	
-	MonoObject *exception = NULL;
-	MonoObject *objResult = mono_runtime_invoke(globals.executeMethod, NULL, args, &exception);
-	if (exception) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute mono %s.\n", cmd);
-		mono_print_unhandled_exception(exception);
-	}
-	if (!(*(int*)mono_object_unbox(objResult))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module?).\n", cmd);
-	}
-	return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_STANDARD_APP(mono_app_function)
-{
-	mono_thread_attach(globals.domain);
-	if (switch_strlen_zero(data)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");
-	}
-
-	// bool Run(string command, IntPtr sessionHandle)
-	void *args[2];
-	args[0] = mono_string_new(globals.domain, data);
-	args[1] = &session;
-
-	MonoObject *exception = NULL;
-	MonoObject *objResult = mono_runtime_invoke(globals.runMethod, NULL, args, &exception);
-	if (exception) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute application mono %s.\n", data);
-		mono_print_unhandled_exception(exception);
-	}
-	if (!(*(int*)mono_object_unbox(objResult))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application run failed for %s (unknown module?).\n", data);
-	}
-}
-
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown)
-{
-	mono_thread_attach(globals.domain);
-	MonoObject *ex;
-	mono_runtime_invoke(globals.unloadMethod, NULL, NULL, &ex);
-	if (ex) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception occurred in Loader::Unload.\n");
-		mono_print_unhandled_exception(ex);
-	}
-	mono_runtime_set_shutting_down();
-	mono_runtime_cleanup(globals.domain);
-	mono_runtime_quit();
-	return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_END_EXTERN_C
\ No newline at end of file
+		// On other platforms, it should just work if it hasn't been relocated
+		mono_set_dirs(NULL, NULL);
+	
return SWITCH_STATUS_SUCCESS;
+	
+#endif	/* 
 */
+}
+

switch_status_t loadModMonoManaged() 
+{
+	
+		/* Find and load mod_mono_managed.exe */ 
+	char filename[256];
+	
switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MONO_MANAGED_DLL);
+	
globals.domain = mono_jit_init(filename);
+	

if (!globals.domain) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_jit_init failed.\n");
+		
return SWITCH_STATUS_FALSE;
+	
}
+	

+		/* Open the assembly */ 
+		globals.mod_mono_asm = mono_domain_assembly_open(globals.domain, filename);
+	
if (!globals.mod_mono_asm) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_domain_assembly_open failed.\n");
+		
return SWITCH_STATUS_FALSE;
+	
}
+	
return SWITCH_STATUS_SUCCESS;
+
}
+
+

MonoMethod * getMethod(const char *name, MonoClass * klass) 
+{
+	
MonoMethodDesc * desc;
+	
MonoMethod * method;
+	
desc = mono_method_desc_new(name, TRUE);
+	
method = mono_method_desc_search_in_class(desc, klass);
+	
if (!method) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find %s method.\n", name);
+		
return NULL;
+	
}
+	
return method;
+
}
+

switch_status_t findLoader() 
+{
+	
+		/* Find loader class and methods */ 
+		MonoImage * img;
+	
MonoClass * loaderClass;
+	
img = mono_assembly_get_image(globals.mod_mono_asm);
+	
loaderClass = mono_class_from_name(img, "FreeSWITCH", "Loader");
+	
if (!loaderClass) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find FreeSWITCH.Loader class.\n");
+		
return SWITCH_STATUS_FALSE;
+	
}
+	

globals.loadMethod = getMethod("FreeSWITCH.Loader:Load()", loaderClass);
+	
if (!globals.loadMethod)
+		return SWITCH_STATUS_FALSE;
+	

globals.unloadMethod = getMethod("FreeSWITCH.Loader:Unload()", loaderClass);
+	
if (!globals.unloadMethod)
+		return SWITCH_STATUS_FALSE;
+	

globals.runMethod = getMethod("FreeSWITCH.Loader:Run(string,intptr)", loaderClass);
+	
if (!globals.runMethod)
+		return SWITCH_STATUS_FALSE;
+	

globals.executeMethod = getMethod("FreeSWITCH.Loader:Execute(string,intptr,intptr)", loaderClass);
+	
if (!globals.executeMethod)
+		return SWITCH_STATUS_FALSE;
+	

globals.executeBackgroundMethod = getMethod("FreeSWITCH.Loader:ExecuteBackground(string)", loaderClass);
+	
if (!globals.executeBackgroundMethod)
+		return SWITCH_STATUS_FALSE;
+	

switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found all loader functions.\n");
+	
return SWITCH_STATUS_SUCCESS;
+
}
+
+

SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load) 
+{
+	
+		/* connect my internal structure to the blank pointer passed to me */ 
+		*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	
globals.pool = pool;
+	

if (setMonoDirs() != SWITCH_STATUS_SUCCESS) {
+		
return SWITCH_STATUS_FALSE;
+	
}
+	
if (loadModMonoManaged() != SWITCH_STATUS_SUCCESS) {
+		
return SWITCH_STATUS_FALSE;
+	
}
+	
if (findLoader() != SWITCH_STATUS_SUCCESS) {
+		
return SWITCH_STATUS_FALSE;
+	
}
+	

+		/* Not sure if this is necesary on the loading thread */ 
+		mono_thread_attach(globals.domain);
+	
mono_add_internal_call("FreeSWITCH.Native.MonoSession::InitMonoSession", InitMonoSession);
+	

+		/* Run loader */ 
+		MonoObject * objResult;
+	
MonoObject * exception = NULL;
+	
objResult = mono_runtime_invoke(globals.loadMethod, NULL, NULL, &exception);
+	
if (exception) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load threw an exception.\n");
+		
mono_print_unhandled_exception(exception);
+		
return SWITCH_STATUS_FALSE;
+	
}
+	
if (*(int *) mono_object_unbox(objResult)) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Load completed successfully.\n");
+	
} else {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load did not return true.\n");
+		
return SWITCH_STATUS_FALSE;
+	
}
+	


+		/* We're good to register */ 
+	switch_api_interface_t *api_interface;
+	
switch_application_interface_t *app_interface;
+	

SWITCH_ADD_API(api_interface, "monorun", "Run a module (ExecuteBackground)", monorun_api_function, "<module> [<args>]");
+	
SWITCH_ADD_API(api_interface, "mono", "Run a module as an API function (Execute)", mono_api_function, "<module> [<args>]");
+	
SWITCH_ADD_APP(app_interface, "mono", "Run Mono IVR", "Run a Mono IVR on a channel", mono_app_function, "<modulename> [<args>]", SAF_NONE);
+	

return SWITCH_STATUS_SUCCESS;
+
}
+
+

SWITCH_STANDARD_API(monorun_api_function) 
+{
+	
+		// TODO: Should we be detaching after all this?
+		mono_thread_attach(globals.domain);
+	
if (switch_strlen_zero(cmd)) {
+		
stream->write_function(stream, "-ERR no args specified!\n");
+		
return SWITCH_STATUS_SUCCESS;
+	
}
+	

+		// ExecuteBackground(string command)
+	void *args[1];
+	
args[0] = mono_string_new(globals.domain, cmd);
+	
MonoObject * exception = NULL;
+	
MonoObject * objResult = mono_runtime_invoke(globals.executeBackgroundMethod, NULL, args, &exception);
+	
if (exception) {
+		
stream->write_function(stream, "-ERR FreeSWITCH.Loader.ExecuteBackground threw an exception.\n");
+		
mono_print_unhandled_exception(exception);
+		
return SWITCH_STATUS_SUCCESS;
+	
}
+	
if (*(int *) mono_object_unbox(objResult)) {
+		
stream->write_function(stream, "+OK\n");
+	
} else {
+		
stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module?).\n");
+	
}
+	
return SWITCH_STATUS_SUCCESS;
+
}
+
+

SWITCH_STANDARD_API(mono_api_function) 
+{
+	
mono_thread_attach(globals.domain);
+	
if (switch_strlen_zero(cmd)) {
+		
stream->write_function(stream, "-ERR no args specified!\n");
+		
return SWITCH_STATUS_SUCCESS;
+	
}
+	

+		// Method is: Execute(string command, IntPtr streamPtr, IntPtr eventPtr)
+	void *args[3];
+	
args[0] = mono_string_new(globals.domain, cmd);
+	
args[1] = &stream;			// Address of the arguments
+	args[2] = &(stream->param_event);
+	

MonoObject * exception = NULL;
+	
MonoObject * objResult = mono_runtime_invoke(globals.executeMethod, NULL, args, &exception);
+	
if (exception) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute mono %s.\n", cmd);
+		
mono_print_unhandled_exception(exception);
+	
}
+	
if (!(*(int *) mono_object_unbox(objResult))) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module?).\n", cmd);
+	
}
+	
return SWITCH_STATUS_SUCCESS;
+
}
+
+

SWITCH_STANDARD_APP(mono_app_function) 
+{
+	
mono_thread_attach(globals.domain);
+	
if (switch_strlen_zero(data)) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");
+	
}
+	

+		// bool Run(string command, IntPtr sessionHandle)
+	void *args[2];
+	
args[0] = mono_string_new(globals.domain, data);
+	
args[1] = &session;
+	

MonoObject * exception = NULL;
+	
MonoObject * objResult = mono_runtime_invoke(globals.runMethod, NULL, args, &exception);
+	
if (exception) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute application mono %s.\n", data);
+		
mono_print_unhandled_exception(exception);
+	
}
+	
if (!(*(int *) mono_object_unbox(objResult))) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application run failed for %s (unknown module?).\n", data);
+	
}
+
} 

SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown) 
+{
+	
mono_thread_attach(globals.domain);
+	
MonoObject * ex;
+	
mono_runtime_invoke(globals.unloadMethod, NULL, NULL, &ex);
+	
if (ex) {
+		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception occurred in Loader::Unload.\n");
+		
mono_print_unhandled_exception(ex);
+	
}
+	
mono_runtime_set_shutting_down();
+	
mono_runtime_cleanup(globals.domain);
+	
mono_runtime_quit();
+	
return SWITCH_STATUS_SUCCESS;
+
}
+
+

SWITCH_END_EXTERN_C

Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp	Tue May 27 00:54:52 2008
@@ -8,17 +8,17 @@
 
 using namespace PERL;
 
-Session::Session() : CoreSession()
+Session::Session():CoreSession()
 {
 	init_me();
 }
 
-Session::Session(char *uuid) : CoreSession(uuid)
+Session::Session(char *uuid):CoreSession(uuid)
 {
 	init_me();
 }
 
-Session::Session(switch_core_session_t *new_session) : CoreSession(new_session)
+Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
 {
 	init_me();
 }
@@ -37,19 +37,19 @@
 
 }
 
-bool Session::begin_allow_threads() 
+bool Session::begin_allow_threads()
 {
 	do_hangup_hook();
 	return true;
 }
 
-bool Session::end_allow_threads() 
+bool Session::end_allow_threads()
 {
 	do_hangup_hook();
 	return true;
 }
 
-void Session::setPERL(PerlInterpreter *pi)
+void Session::setPERL(PerlInterpreter * pi)
 {
 	my_perl = pi;
 }
@@ -57,30 +57,31 @@
 PerlInterpreter *Session::getPERL()
 {
 	if (!my_perl) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");
 	}
 	return my_perl;
 }
 
 
-bool Session::ready() {
+bool Session::ready()
+{
 	bool r;
 
-	sanity_check(false);	
+	sanity_check(false);
 	r = switch_channel_ready(channel) != 0;
 	do_hangup_hook();
 
 	return r;
 }
 
-void Session::check_hangup_hook() 
+void Session::check_hangup_hook()
 {
 	if (hangup_func_str && (hook_state == CS_HANGUP || hook_state == CS_ROUTING)) {
 		hh++;
 	}
 }
 
-void Session::do_hangup_hook() 
+void Session::do_hangup_hook()
 {
 	if (hh && !mark) {
 		const char *err = NULL;
@@ -101,7 +102,7 @@
 	}
 }
 
-static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup) 
+static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
 	CoreSession *coresession = NULL;
@@ -118,7 +119,8 @@
 }
 
 
-void Session::setHangupHook(char *func, char *arg) {
+void Session::setHangupHook(char *func, char *arg)
+{
 
 	sanity_check_noreturn;
 
@@ -135,7 +137,8 @@
 	}
 }
 
-void Session::setInputCallback(char *cbfunc, char *funcargs) {
+void Session::setInputCallback(char *cbfunc, char *funcargs)
+{
 
 	sanity_check_noreturn;
 
@@ -148,22 +151,22 @@
 	if (funcargs) {
 		cb_arg = strdup(funcargs);
 	}
-	
+
 	args.buf = this;
 	switch_channel_set_private(channel, "CoreSession", this);
 
-	args.input_callback = dtmf_callback;  
+	args.input_callback = dtmf_callback;
 	ap = &args;
 }
 
-switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype) 
+switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
 {
 	if (!getPERL()) {
 		return SWITCH_STATUS_FALSE;;
 	}
 
 	switch (itype) {
-    case SWITCH_INPUT_TYPE_DTMF:
+	case SWITCH_INPUT_TYPE_DTMF:
 		{
 			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
 			char str[32] = "";
@@ -177,14 +180,14 @@
 			}
 
 			str[0] = dtmf->digit;
-			this_sv = newSV(strlen(str)+1);
+			this_sv = newSV(strlen(str) + 1);
 			sv_setpv(this_sv, str);
 			hv_store(hash, "digit", 5, this_sv, 0);
 
 			switch_snprintf(str, sizeof(str), "%d", dtmf->duration);
-			this_sv = newSV(strlen(str)+1);
+			this_sv = newSV(strlen(str) + 1);
 			sv_setpv(this_sv, str);
-			hv_store(hash, "duration", 8, this_sv, 0);			
+			hv_store(hash, "duration", 8, this_sv, 0);
 
 			code = switch_mprintf("$__RV = %s('dtmf', \\%%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
 			Perl_eval_pv(my_perl, code, FALSE);
@@ -193,18 +196,18 @@
 			return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
 		}
 		break;
-    case SWITCH_INPUT_TYPE_EVENT:
+	case SWITCH_INPUT_TYPE_EVENT:
 		{
 			switch_event_t *event = (switch_event_t *) input;
 			int arg_count = 2;
 			char *code;
 
 			mod_perl_conjure_event(my_perl, event, "__Input_Event__");
-			
+
 			code = switch_mprintf("$__RV = %s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
 			Perl_eval_pv(my_perl, code, TRUE);
 			free(code);
-			
+
 			return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
 		}
 		break;

Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c	Tue May 27 00:54:52 2008
@@ -58,7 +58,7 @@
 
 
 
-static int Perl_safe_eval(PerlInterpreter *my_perl, const char *string)
+static int Perl_safe_eval(PerlInterpreter * my_perl, const char *string)
 {
 	char *err = NULL;
 
@@ -73,7 +73,7 @@
 
 
 
-static int perl_parse_and_execute(PerlInterpreter *my_perl, char *input_code, char *setup_code)
+static int perl_parse_and_execute(PerlInterpreter * my_perl, char *input_code, char *setup_code)
 {
 	int error = 0;
 
@@ -103,10 +103,10 @@
 			if ((argc = switch_separate_string(args, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 				switch_stream_handle_t stream = { 0 };
 				SWITCH_STANDARD_STREAM(stream);
-				
+
 				stream.write_function(&stream, " @ARGV = ( ");
 				for (x = 0; x < argc; x++) {
-					stream.write_function(&stream, "'%s'%s", argv[x], x == argc-1 ? "" : ", ");
+					stream.write_function(&stream, "'%s'%s", argv[x], x == argc - 1 ? "" : ", ");
 				}
 				stream.write_function(&stream, " );");
 				code = stream.data;
@@ -130,7 +130,7 @@
 				file = switch_mprintf("require '%s';", file);
 				switch_assert(file);
 			}
-			
+
 			error = Perl_safe_eval(my_perl, file);
 			switch_safe_free(file);
 		}
@@ -154,14 +154,15 @@
 }
 
 #if 0
-static perl_parse_and_execute (PerlInterpreter *my_perl, char *input_code, char *setup_code)
+static perl_parse_and_execute(PerlInterpreter * my_perl, char *input_code, char *setup_code)
 {
 	int error = 0;
 
 	if (*input_code == '~') {
 		char *buff = input_code + 1;
 		perl_parse(my_perl, xs_init, 3, embedding, NULL);
-		if (setup_code) Perl_safe_eval(my_perl, setup_code);
+		if (setup_code)
+			Perl_safe_eval(my_perl, setup_code);
 		Perl_safe_eval(my_perl, buff);
 	} else {
 		int argc = 0;
@@ -169,43 +170,38 @@
 		char *err;
 		argv[0] = "FreeSWITCH";
 		argc++;
-		
+
 		argc += switch_separate_string(input_code, ' ', &argv[1], (sizeof(argv) / sizeof(argv[0])) - 1);
-		if (!perl_parse(my_perl, xs_init, argc, argv, (char **)NULL)) {
+		if (!perl_parse(my_perl, xs_init, argc, argv, (char **) NULL)) {
 			if (setup_code) {
 				if (!Perl_safe_eval(my_perl, setup_code)) {
 					perl_run(my_perl);
 				}
 			}
 		}
-		
+
 		if ((err = SvPV(get_sv("@", TRUE), n_a)) && !switch_strlen_zero(err)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
 		}
-		
+
 
 	}
 }
-#endif 
+#endif
 
 static void perl_function(switch_core_session_t *session, char *data)
 {
 	char *uuid = switch_core_session_get_uuid(session);
 	PerlInterpreter *my_perl = clone_perl();
 	char code[1024];
-	
+
 	perl_parse(my_perl, xs_init, 3, embedding, NULL);
 	Perl_safe_eval(my_perl, code);
 
-	switch_snprintf(code, sizeof(code), 
-			"use lib '%s/perl';\n"
-			"use freeswitch;\n"
-			"$SWITCH_ENV{UUID} = \"%s\";\n"
-			"$session = new freeswitch::Session(\"%s\")"
-			, 
-			SWITCH_GLOBAL_dirs.base_dir,
-			uuid,
-			uuid);
+	switch_snprintf(code, sizeof(code),
+					"use lib '%s/perl';\n"
+					"use freeswitch;\n"
+					"$SWITCH_ENV{UUID} = \"%s\";\n" "$session = new freeswitch::Session(\"%s\")", SWITCH_GLOBAL_dirs.base_dir, uuid, uuid);
 
 	perl_parse_and_execute(my_perl, data, code);
 	Perl_safe_eval(my_perl, "undef $session;");
@@ -244,16 +240,10 @@
 	if (session) {
 		uuid = switch_core_session_get_uuid(session);
 	}
-	
-	switch_snprintf(code, sizeof(code), 
-					"use lib '%s/perl';\n"
-					"use freeswitch;\n"			
-					"$SWITCH_ENV{UUID} = \"%s\";\n"
-					,
-
-					SWITCH_GLOBAL_dirs.base_dir,
-					switch_str_nil(uuid)
-					);
+
+	switch_snprintf(code, sizeof(code),
+					"use lib '%s/perl';\n" "use freeswitch;\n" "$SWITCH_ENV{UUID} = \"%s\";\n", SWITCH_GLOBAL_dirs.base_dir, switch_str_nil(uuid)
+		);
 
 	perl_parse(my_perl, xs_init, 3, embedding, NULL);
 	Perl_safe_eval(my_perl, code);
@@ -273,7 +263,7 @@
 		//Perl_safe_eval(my_perl, cmd);
 		perl_parse_and_execute(my_perl, cmd, NULL);
 	}
-	
+
 	if (uuid) {
 		switch_snprintf(code, sizeof(code), "undef $session;", uuid);
 		Perl_safe_eval(my_perl, code);
@@ -301,7 +291,7 @@
 	memset(po, 0, sizeof(*po));
 	po->cmd = strdup(text);
 	po->d = 1;
-	
+
 	switch_threadattr_create(&thd_attr, globals.pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -310,7 +300,8 @@
 	return 0;
 }
 
-SWITCH_STANDARD_API(perlrun_api_function) {
+SWITCH_STANDARD_API(perlrun_api_function)
+{
 
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "-ERR Missing args.\n");
@@ -322,7 +313,8 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_STANDARD_API(perl_api_function) {
+SWITCH_STANDARD_API(perl_api_function)
+{
 
 	struct perl_o po = { 0 };
 
@@ -337,12 +329,8 @@
 	perl_thread_run(NULL, &po);
 }
 
-static switch_xml_t perl_fetch(const char *section, 
-							   const char *tag_name, 
-							   const char *key_name, 
-							   const char *key_value, 
-							   switch_event_t *params,
-							   void *user_data)
+static switch_xml_t perl_fetch(const char *section,
+							   const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
 {
 
 	char *argv[128] = { 0 };
@@ -359,10 +347,10 @@
 
 		argv[argc++] = "FreeSWITCH";
 		argv[argc++] = globals.xml_handler;
-		
+
 		PERL_SET_CONTEXT(my_perl);
-		
-		if (perl_parse(my_perl, xs_init, argc, argv, (char **)NULL)) {
+
+		if (perl_parse(my_perl, xs_init, argc, argv, (char **) NULL)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");
 			return NULL;
 		}
@@ -375,15 +363,15 @@
 			section = "";
 		}
 
-		this = newSV(strlen(section)+1);
+		this = newSV(strlen(section) + 1);
 		sv_setpv(this, section);
 		hv_store(hash, "section", 7, this, 0);
-		
+
 		if (switch_strlen_zero(tag_name)) {
 			tag_name = "";
 		}
 
-		this = newSV(strlen(tag_name)+1);
+		this = newSV(strlen(tag_name) + 1);
 		sv_setpv(this, tag_name);
 		hv_store(hash, "tag_name", 8, this, 0);
 
@@ -391,7 +379,7 @@
 			key_name = "";
 		}
 
-		this = newSV(strlen(key_name)+1);
+		this = newSV(strlen(key_name) + 1);
 		sv_setpv(this, key_name);
 		hv_store(hash, "key_name", 8, this, 0);
 
@@ -399,28 +387,23 @@
 			key_value = "";
 		}
 
-		this = newSV(strlen(key_value)+1);
+		this = newSV(strlen(key_value) + 1);
 		sv_setpv(this, key_value);
 		hv_store(hash, "key_value", 9, this, 0);
-		
+
 		if (!(hash = get_hv("XML_DATA", TRUE))) {
 			abort();
 		}
 
 		if (params) {
 			for (hp = params->headers; hp; hp = hp->next) {
-				this = newSV(strlen(hp->value)+1);
+				this = newSV(strlen(hp->value) + 1);
 				sv_setpv(this, hp->value);
 				hv_store(hash, hp->name, strlen(hp->name), this, 0);
 			}
 		}
 
-		switch_snprintf(code, sizeof(code), 
-						"use lib '%s/perl';\n"
-						"use freeswitch;\n"			
-						,
-						SWITCH_GLOBAL_dirs.base_dir
-						);
+		switch_snprintf(code, sizeof(code), "use lib '%s/perl';\n" "use freeswitch;\n", SWITCH_GLOBAL_dirs.base_dir);
 		Perl_safe_eval(my_perl, code);
 
 		if (params) {
@@ -437,7 +420,7 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
 			}
 		}
-		
+
 		destroy_perl(&my_perl);
 	}
 

Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.c	Tue May 27 00:54:52 2008
@@ -1,24 +1,21 @@
-SWITCH_BEGIN_EXTERN_C
-
-
-void mod_perl_conjure_event(PerlInterpreter *my_perl, switch_event_t *event, const char *name)
+SWITCH_BEGIN_EXTERN_C void mod_perl_conjure_event(PerlInterpreter * my_perl, switch_event_t *event, const char *name)
 {
-    Event *result = 0 ;
+	Event *result = 0;
 	SV *sv;
 	PERL_SET_CONTEXT(my_perl);
-	sv =  sv_2mortal(get_sv(name, TRUE));
-	result = (Event *)new Event(event);
+	sv = sv_2mortal(get_sv(name, TRUE));
+	result = (Event *) new Event(event);
 	SWIG_Perl_MakePtr(sv, result, SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
 }
 
 
-void mod_perl_conjure_stream(PerlInterpreter *my_perl, switch_stream_handle_t *stream, const char *name)
+void mod_perl_conjure_stream(PerlInterpreter * my_perl, switch_stream_handle_t *stream, const char *name)
 {
-    Stream *result = 0 ;
+	Stream *result = 0;
 	SV *sv;
 	PERL_SET_CONTEXT(my_perl);
-	sv =  sv_2mortal(get_sv(name, TRUE));
-	result = (Stream *)new Stream(stream);
+	sv = sv_2mortal(get_sv(name, TRUE));
+	result = (Stream *) new Stream(stream);
 	SWIG_Perl_MakePtr(sv, result, SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW);
 }
 

Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp	Tue May 27 00:54:52 2008
@@ -12,22 +12,35 @@
 #define SWIG_CASTRANK_MODE
 
 #ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
-    T *tt;
-public:
-    SwigValueWrapper() : tt(0) { }
-    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
-    SwigValueWrapper(const T& t) : tt(new T(t)) { }
-    ~SwigValueWrapper() { delete tt; } 
-    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
-    operator T&() const { return *tt; }
-    T *operator&() { return tt; }
-private:
-    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+template < typename T > class SwigValueWrapper {
+	T *tt;
+  public:
+  SwigValueWrapper():tt(0) {
+	}
+	SwigValueWrapper(const SwigValueWrapper < T > &rhs):tt(new T(*rhs.tt)) {
+	}
+	SwigValueWrapper(const T & t):tt(new T(t)) {
+	}
+	~SwigValueWrapper() {
+		delete tt;
+	}
+	SwigValueWrapper & operator=(const T & t) {
+		delete tt;
+		tt = new T(t);
+		return *this;
+	}
+	operator  T & () const {
+		return *tt;
+	} T *operator&() {
+		return tt;
+	}
+  private:
+	SwigValueWrapper & operator=(const SwigValueWrapper < T > &rhs);
 };
 
-template <typename T> T SwigValueInit() {
-  return T();
+template < typename T > T SwigValueInit()
+{
+	return T();
 }
 #endif
 
@@ -62,14 +75,14 @@
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
@@ -77,7 +90,7 @@
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -120,7 +133,7 @@
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -264,10 +277,10 @@
 
 
  */
-#define SWIG_OK                    (0) 
+#define SWIG_OK                    (0)
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -294,16 +307,18 @@
 #  ifndef SWIG_TypeRank
 #    define SWIG_TypeRank             unsigned long
 #  endif
-#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#  ifndef SWIG_MAXCASTRANK		/* Default cast allowed */
 #    define SWIG_MAXCASTRANK          (2)
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
-  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+SWIGINTERNINLINE int SWIG_AddCast(int r)
+{
+	return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+SWIGINTERNINLINE int SWIG_CheckState(int r)
+{
+	return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
 }
 #else /* no cast-rank mode */
 #  define SWIG_AddCast
@@ -319,38 +334,38 @@
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *, int *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
+	typedef void *(*swig_converter_func) (void *, int *);
+	typedef struct swig_type_info *(*swig_dycast_func) (void **);
 
 /* Structure to store information on one type */
-typedef struct swig_type_info {
-  const char             *name;			/* mangled name of this type */
-  const char             *str;			/* human readable name of this type */
-  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
-  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
-  void                   *clientdata;		/* language specific type data */
-  int                    owndata;		/* flag if the structure owns the clientdata */
-} swig_type_info;
+	typedef struct swig_type_info {
+		const char *name;		/* mangled name of this type */
+		const char *str;		/* human readable name of this type */
+		swig_dycast_func dcast;	/* dynamic cast function down a hierarchy */
+		struct swig_cast_info *cast;	/* linked list of types that can cast into this type */
+		void *clientdata;		/* language specific type data */
+		int owndata;			/* flag if the structure owns the clientdata */
+	} swig_type_info;
 
 /* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
-  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
-  swig_converter_func     converter;		/* function to cast the void pointers */
-  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
-  struct swig_cast_info  *prev;			/* pointer to the previous cast */
-} swig_cast_info;
+	typedef struct swig_cast_info {
+		swig_type_info *type;	/* pointer to type that is equivalent to this type */
+		swig_converter_func converter;	/* function to cast the void pointers */
+		struct swig_cast_info *next;	/* pointer to next cast in linked list */
+		struct swig_cast_info *prev;	/* pointer to the previous cast */
+	} swig_cast_info;
 
 /* Structure used to store module information
  * Each module generates one structure like this, and the runtime collects
  * all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
-  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
-  size_t                 size;		        /* Number of types in this module */
-  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
-  swig_type_info         **type_initial;	/* Array of initially generated type structures */
-  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
-  void                    *clientdata;		/* Language specific module data */
-} swig_module_info;
+	typedef struct swig_module_info {
+		swig_type_info **types;	/* Array of pointers to swig_type_info structures that are in this module */
+		size_t size;			/* Number of types in this module */
+		struct swig_module_info *next;	/* Pointer to next element in circularly linked list */
+		swig_type_info **type_initial;	/* Array of initially generated type structures */
+		swig_cast_info **cast_initial;	/* Array of initially generated casting structures */
+		void *clientdata;		/* Language specific module data */
+	} swig_module_info;
 
 /* 
   Compare two type names skipping the space characters, therefore
@@ -359,54 +374,56 @@
   Return 0 when the two name types are equivalent, as in
   strncmp, but skipping ' '.
 */
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
-		  const char *f2, const char *l2) {
-  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
-    while ((*f1 == ' ') && (f1 != l1)) ++f1;
-    while ((*f2 == ' ') && (f2 != l2)) ++f2;
-    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
-  }
-  return (int)((l1 - f1) - (l2 - f2));
-}
+	SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) {
+		for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
+			while ((*f1 == ' ') && (f1 != l1))
+				++f1;
+			while ((*f2 == ' ') && (f2 != l2))
+				++f2;
+			if (*f1 != *f2)
+				return (*f1 > *f2) ? 1 : -1;
+		} return (int) ((l1 - f1) - (l2 - f2));
+	}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if not equal, 1 if equal
 */
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
+	SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) {
+		int equiv = 0;
+		const char *te = tb + strlen(tb);
+		const char *ne = nb;
+		while (!equiv && *ne) {
+			for (nb = ne; *ne; ++ne) {
+				if (*ne == '|')
+					break;
+			}
+			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+			if (*ne)
+				++ne;
+		}
+		return equiv;
+	}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
+	SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) {
+		int equiv = 0;
+		const char *te = tb + strlen(tb);
+		const char *ne = nb;
+		while (!equiv && *ne) {
+			for (nb = ne; *ne; ++ne) {
+				if (*ne == '|')
+					break;
+			}
+			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+			if (*ne)
+				++ne;
+		}
+		return equiv;
+	}
 
 
 /* think of this as a c++ template<> or a scheme macro */
@@ -434,94 +451,89 @@
 /*
   Check the typename
 */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
+	SWIGRUNTIME swig_cast_info *SWIG_TypeCheck(const char *c, swig_type_info * ty) {
+		SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+	}
 
 /* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
-  SWIG_TypeCheck_Template(iter->type == from, into);
-}
+	SWIGRUNTIME swig_cast_info *SWIG_TypeCheckStruct(swig_type_info * from, swig_type_info * into) {
+		SWIG_TypeCheck_Template(iter->type == from, into);
+	}
 
 /*
   Cast a pointer up an inheritance hierarchy
 */
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
-}
+	SWIGRUNTIMEINLINE void *SWIG_TypeCast(swig_cast_info * ty, void *ptr, int *newmemory) {
+		return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter) (ptr, newmemory);
+	}
 
 /* 
    Dynamic pointer casting. Down an inheritance hierarchy
 */
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
-  swig_type_info *lastty = ty;
-  if (!ty || !ty->dcast) return ty;
-  while (ty && (ty->dcast)) {
-    ty = (*ty->dcast)(ptr);
-    if (ty) lastty = ty;
-  }
-  return lastty;
-}
+	SWIGRUNTIME swig_type_info *SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
+		swig_type_info *lastty = ty;
+		if (!ty || !ty->dcast)
+			return ty;
+		while (ty && (ty->dcast)) {
+			ty = (*ty->dcast) (ptr);
+			if (ty)
+				lastty = ty;
+		}
+		return lastty;
+	}
 
 /*
   Return the name associated with this type
 */
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
-  return ty->name;
-}
+	SWIGRUNTIMEINLINE const char *SWIG_TypeName(const swig_type_info * ty) {
+		return ty->name;
+	}
 
 /*
   Return the pretty name associated with this type,
   that is an unmangled type name in a form presentable to the user.
 */
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
-  /* The "str" field contains the equivalent pretty names of the
-     type, separated by vertical-bar characters.  We choose
-     to print the last name, as it is often (?) the most
-     specific. */
-  if (!type) return NULL;
-  if (type->str != NULL) {
-    const char *last_name = type->str;
-    const char *s;
-    for (s = type->str; *s; s++)
-      if (*s == '|') last_name = s+1;
-    return last_name;
-  }
-  else
-    return type->name;
-}
+	SWIGRUNTIME const char *SWIG_TypePrettyName(const swig_type_info * type) {
+		/* The "str" field contains the equivalent pretty names of the
+		   type, separated by vertical-bar characters.  We choose
+		   to print the last name, as it is often (?) the most
+		   specific. */
+		if (!type)
+			return NULL;
+		if (type->str != NULL) {
+			const char *last_name = type->str;
+			const char *s;
+			for (s = type->str; *s; s++)
+				if (*s == '|')
+					last_name = s + 1;
+			return last_name;
+		} else
+			return type->name;
+	}
 
 /* 
    Set the clientdata field for a type
 */
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
-  swig_cast_info *cast = ti->cast;
-  /* if (ti->clientdata == clientdata) return; */
-  ti->clientdata = clientdata;
-  
-  while (cast) {
-    if (!cast->converter) {
-      swig_type_info *tc = cast->type;
-      if (!tc->clientdata) {
-	SWIG_TypeClientData(tc, clientdata);
-      }
-    }    
-    cast = cast->next;
-  }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
-  SWIG_TypeClientData(ti, clientdata);
-  ti->owndata = 1;
-}
-  
+	SWIGRUNTIME void SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
+		swig_cast_info *cast = ti->cast;
+		/* if (ti->clientdata == clientdata) return; */
+		ti->clientdata = clientdata;
+
+		while (cast) {
+			if (!cast->converter) {
+				swig_type_info *tc = cast->type;
+				if (!tc->clientdata) {
+					SWIG_TypeClientData(tc, clientdata);
+				}
+			}
+			cast = cast->next;
+		}
+	}
+	SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info * ti, void *clientdata) {
+		SWIG_TypeClientData(ti, clientdata);
+		ti->owndata = 1;
+	}
+
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
@@ -530,41 +542,38 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
-		            const char *name) {
-  swig_module_info *iter = start;
-  do {
-    if (iter->size) {
-      register size_t l = 0;
-      register size_t r = iter->size - 1;
-      do {
-	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-	register size_t i = (l + r) >> 1; 
-	const char *iname = iter->types[i]->name;
-	if (iname) {
-	  register int compare = strcmp(name, iname);
-	  if (compare == 0) {	    
-	    return iter->types[i];
-	  } else if (compare < 0) {
-	    if (i) {
-	      r = i - 1;
-	    } else {
-	      break;
-	    }
-	  } else if (compare > 0) {
-	    l = i + 1;
-	  }
-	} else {
-	  break; /* should never happen */
+	SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+		swig_module_info *iter = start;
+		do {
+			if (iter->size) {
+				register size_t l = 0;
+				register size_t r = iter->size - 1;
+				do {
+					/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+					register size_t i = (l + r) >> 1;
+					const char *iname = iter->types[i]->name;
+					if (iname) {
+						register int compare = strcmp(name, iname);
+						if (compare == 0) {
+							return iter->types[i];
+						} else if (compare < 0) {
+							if (i) {
+								r = i - 1;
+							} else {
+								break;
+							}
+						} else if (compare > 0) {
+							l = i + 1;
+						}
+					} else {
+						break;	/* should never happen */
+					}
+				} while (l <= r);
+			}
+			iter = iter->next;
+		} while (iter != end);
+		return 0;
 	}
-      } while (l <= r);
-    }
-    iter = iter->next;
-  } while (iter != end);
-  return 0;
-}
 
 /*
   Search for a swig_type_info structure for either a mangled name or a human readable name.
@@ -575,148 +584,142 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
-		     const char *name) {
-  /* STEP 1: Search the name field using binary search */
-  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
-  if (ret) {
-    return ret;
-  } else {
-    /* STEP 2: If the type hasn't been found, do a complete search
-       of the str field (the human readable name) */
-    swig_module_info *iter = start;
-    do {
-      register size_t i = 0;
-      for (; i < iter->size; ++i) {
-	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
-	  return iter->types[i];
-      }
-      iter = iter->next;
-    } while (iter != end);
-  }
-  
-  /* neither found a match */
-  return 0;
-}
+	SWIGRUNTIME swig_type_info *SWIG_TypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+		/* STEP 1: Search the name field using binary search */
+		swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+		if (ret) {
+			return ret;
+		} else {
+			/* STEP 2: If the type hasn't been found, do a complete search
+			   of the str field (the human readable name) */
+			swig_module_info *iter = start;
+			do {
+				register size_t i = 0;
+				for (; i < iter->size; ++i) {
+					if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+						return iter->types[i];
+				}
+				iter = iter->next;
+			} while (iter != end);
+		}
+
+		/* neither found a match */
+		return 0;
+	}
 
 /* 
    Pack binary data into a string
 */
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
-  static const char hex[17] = "0123456789abcdef";
-  register const unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu =  u + sz;
-  for (; u != eu; ++u) {
-    register unsigned char uu = *u;
-    *(c++) = hex[(uu & 0xf0) >> 4];
-    *(c++) = hex[uu & 0xf];
-  }
-  return c;
-}
+	SWIGRUNTIME char *SWIG_PackData(char *c, void *ptr, size_t sz) {
+		static const char hex[17] = "0123456789abcdef";
+		register const unsigned char *u = (unsigned char *) ptr;
+		register const unsigned char *eu = u + sz;
+		for (; u != eu; ++u) {
+			register unsigned char uu = *u;
+			*(c++) = hex[(uu & 0xf0) >> 4];
+			*(c++) = hex[uu & 0xf];
+		}
+		return c;
+	}
 
 /* 
    Unpack binary data from a string
 */
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
-  register unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu = u + sz;
-  for (; u != eu; ++u) {
-    register char d = *(c++);
-    register unsigned char uu;
-    if ((d >= '0') && (d <= '9'))
-      uu = ((d - '0') << 4);
-    else if ((d >= 'a') && (d <= 'f'))
-      uu = ((d - ('a'-10)) << 4);
-    else 
-      return (char *) 0;
-    d = *(c++);
-    if ((d >= '0') && (d <= '9'))
-      uu |= (d - '0');
-    else if ((d >= 'a') && (d <= 'f'))
-      uu |= (d - ('a'-10));
-    else 
-      return (char *) 0;
-    *u = uu;
-  }
-  return c;
-}
+	SWIGRUNTIME const char *SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+		register unsigned char *u = (unsigned char *) ptr;
+		register const unsigned char *eu = u + sz;
+		for (; u != eu; ++u) {
+			register char d = *(c++);
+			register unsigned char uu;
+			if ((d >= '0') && (d <= '9'))
+				uu = ((d - '0') << 4);
+			else if ((d >= 'a') && (d <= 'f'))
+				uu = ((d - ('a' - 10)) << 4);
+			else
+				return (char *) 0;
+			d = *(c++);
+			if ((d >= '0') && (d <= '9'))
+				uu |= (d - '0');
+			else if ((d >= 'a') && (d <= 'f'))
+				uu |= (d - ('a' - 10));
+			else
+				return (char *) 0;
+			*u = uu;
+		}
+		return c;
+	}
 
 /* 
    Pack 'void *' into a string buffer.
 */
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
-  char *r = buff;
-  if ((2*sizeof(void *) + 2) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,&ptr,sizeof(void *));
-  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
-  strcpy(r,name);
-  return buff;
-}
+	SWIGRUNTIME char *SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+		char *r = buff;
+		if ((2 * sizeof(void *) + 2) > bsz)
+			return 0;
+		*(r++) = '_';
+		r = SWIG_PackData(r, &ptr, sizeof(void *));
+		if (strlen(name) + 1 > (bsz - (r - buff)))
+			return 0;
+		strcpy(r, name);
+		return buff;
+	}
 
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      *ptr = (void *) 0;
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
+	SWIGRUNTIME const char *SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+		if (*c != '_') {
+			if (strcmp(c, "NULL") == 0) {
+				*ptr = (void *) 0;
+				return name;
+			} else {
+				return 0;
+			}
+		}
+		return SWIG_UnpackData(++c, ptr, sizeof(void *));
+	}
 
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
-  char *r = buff;
-  size_t lname = (name ? strlen(name) : 0);
-  if ((2*sz + 2 + lname) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,ptr,sz);
-  if (lname) {
-    strncpy(r,name,lname+1);
-  } else {
-    *r = 0;
-  }
-  return buff;
-}
+	SWIGRUNTIME char *SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+		char *r = buff;
+		size_t lname = (name ? strlen(name) : 0);
+		if ((2 * sz + 2 + lname) > bsz)
+			return 0;
+		*(r++) = '_';
+		r = SWIG_PackData(r, ptr, sz);
+		if (lname) {
+			strncpy(r, name, lname + 1);
+		} else {
+			*r = 0;
+		}
+		return buff;
+	}
 
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      memset(ptr,0,sz);
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sz);
-}
+	SWIGRUNTIME const char *SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+		if (*c != '_') {
+			if (strcmp(c, "NULL") == 0) {
+				memset(ptr, 0, sz);
+				return name;
+			} else {
+				return 0;
+			}
+		}
+		return SWIG_UnpackData(++c, ptr, sz);
+	}
 
 #ifdef __cplusplus
 }
 #endif
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
@@ -774,7 +777,7 @@
 #  ifdef LONGSIZE
 #    define IVSIZE LONGSIZE
 #  else
-#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#    define IVSIZE 4			/* A bold guess, but the best we can make. */
 #  endif
 #endif
 
@@ -801,7 +804,7 @@
 #  else
 #    define PTR2ul(p)     INT2PTR(unsigned long,p)
 #  endif
-#endif /* !INT2PTR */
+#endif							/* !INT2PTR */
 
 #ifndef SvPV_nolen
 # define SvPV_nolen(x) SvPV(x,PL_na)
@@ -817,58 +820,56 @@
 
 #ifndef pTHX_
 #define pTHX_
-#endif   
+#endif
 
 #include <string.h>
 #ifdef __cplusplus
 }
 #endif
-
 /* -----------------------------------------------------------------------------
  * error manipulation
- * ----------------------------------------------------------------------------- */
-
-SWIGINTERN const char*
-SWIG_Perl_ErrorType(int code) {
-  const char* type = 0;
-  switch(code) {
-  case SWIG_MemoryError:
-    type = "MemoryError";
-    break;
-  case SWIG_IOError:
-    type = "IOError";
-    break;
-  case SWIG_RuntimeError:
-    type = "RuntimeError";
-    break;
-  case SWIG_IndexError:
-    type = "IndexError";
-    break;
-  case SWIG_TypeError:
-    type = "TypeError";
-    break;
-  case SWIG_DivisionByZero:
-    type = "ZeroDivisionError";
-    break;
-  case SWIG_OverflowError:
-    type = "OverflowError";
-    break;
-  case SWIG_SyntaxError:
-    type = "SyntaxError";
-    break;
-  case SWIG_ValueError:
-    type = "ValueError";
-    break;
-  case SWIG_SystemError:
-    type = "SystemError";
-    break;
-  case SWIG_AttributeError:
-    type = "AttributeError";
-    break;
-  default:
-    type = "RuntimeError";
-  }
-  return type;
+ * ----------------------------------------------------------------------------- */ SWIGINTERN const char *
+SWIG_Perl_ErrorType(int code)
+{
+	const char *type = 0;
+	switch (code) {
+	case SWIG_MemoryError:
+		type = "MemoryError";
+		break;
+	case SWIG_IOError:
+		type = "IOError";
+		break;
+	case SWIG_RuntimeError:
+		type = "RuntimeError";
+		break;
+	case SWIG_IndexError:
+		type = "IndexError";
+		break;
+	case SWIG_TypeError:
+		type = "TypeError";
+		break;
+	case SWIG_DivisionByZero:
+		type = "ZeroDivisionError";
+		break;
+	case SWIG_OverflowError:
+		type = "OverflowError";
+		break;
+	case SWIG_SyntaxError:
+		type = "SyntaxError";
+		break;
+	case SWIG_ValueError:
+		type = "ValueError";
+		break;
+	case SWIG_SystemError:
+		type = "SystemError";
+		break;
+	case SWIG_AttributeError:
+		type = "AttributeError";
+		break;
+	default:
+		type = "RuntimeError";
+	}
+	return type;
 }
 
 
@@ -921,9 +922,9 @@
 
 /* Error manipulation */
 
-#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)
 #define SWIG_Error(code, msg)            		sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
-#define SWIG_fail                        		goto fail						    
+#define SWIG_fail                        		goto fail
 
 /* Perl-specific SWIG API */
 
@@ -961,31 +962,29 @@
 #endif
 
 /* Macro to call an XS function */
-#ifdef PERL_OBJECT 
-#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
-#else 
-#  ifndef MULTIPLICITY 
-#    define SWIG_CALLXS(_name) _name(cv) 
-#  else 
-#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
-#  endif 
-#endif 
+#ifdef PERL_OBJECT
+#  define SWIG_CALLXS(_name) _name(cv,pPerl)
+#else
+#  ifndef MULTIPLICITY
+#    define SWIG_CALLXS(_name) _name(cv)
+#  else
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
+#  endif
+#endif
 
 #ifdef PERL_OBJECT
 #define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
 
 #ifdef __cplusplus
-extern "C" {
+	extern "C" {
 #endif
-typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+		typedef int (CPerlObj::*SwigMagicFunc) (SV *, MAGIC *);
 #ifdef __cplusplus
-}
+	}
 #endif
-
 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
 #define SWIGCLASS_STATIC
-
-#else /* PERL_OBJECT */
+#else							/* PERL_OBJECT */
 
 #define MAGIC_PPERL
 #define SWIGCLASS_STATIC static SWIGUNUSED
@@ -994,50 +993,46 @@
 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
 
 #ifdef __cplusplus
-extern "C" {
+	extern "C" {
 #endif
-typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+		typedef int (*SwigMagicFunc) (SV *, MAGIC *);
 #ifdef __cplusplus
-}
+	}
 #endif
-
-#else /* MULTIPLICITY */
+#else							/* MULTIPLICITY */
 
 #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
 
 #ifdef __cplusplus
-extern "C" {
+	extern "C" {
 #endif
-typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+		typedef int (*SwigMagicFunc) (struct interpreter *, SV *, MAGIC *);
 #ifdef __cplusplus
-}
+	}
 #endif
-
-#endif /* MULTIPLICITY */
-#endif /* PERL_OBJECT */
-
+#endif							/* MULTIPLICITY */
+#endif							/* PERL_OBJECT */
 /* Workaround for bug in perl 5.6.x croak and earlier */
 #if (PERL_VERSION < 8)
 #  ifdef PERL_OBJECT
 #    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
-static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+	static void SWIG_Perl_croak_null(CPerlObj * pPerl)
 #  else
-static void SWIG_croak_null()
+	static void SWIG_croak_null()
 #  endif
-{
-  SV *err=ERRSV;
+	{
+		SV *err = ERRSV;
 #  if (PERL_VERSION < 6)
-  croak("%_", err);
+		   croak("%_", err);
 #  else
-  if (SvOK(err) && !SvROK(err)) croak("%_", err);
-  croak(Nullch);
+		if (SvOK(err) && !SvROK(err))
+			   croak("%_", err);
+		   croak(Nullch);
 #  endif
-}
+	}
 #else
 #  define SWIG_croak_null() croak(Nullch)
 #endif
-
-
 /* 
    Define how strict is the cast between strings and integers/doubles
    when overloading between these types occurs.
@@ -1060,206 +1055,201 @@
 #endif
 #ifdef SWIG_PERL_STRICT_STR2NUM
 /* string takes precedence */
-#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)
 #else
 /* number takes precedence */
 #define SWIG_Str2NumCast(x) x
 #endif
-
-
-
 #include <stdlib.h>
+	SWIGRUNTIME const char *SWIG_Perl_TypeProxyName(const swig_type_info * type) {
+		if (!type)
+			return NULL;
+		if (type->clientdata != NULL) {
+			return (const char *) type->clientdata;
+		} else {
+			return type->name;
+		}
+	}
 
-SWIGRUNTIME const char *
-SWIG_Perl_TypeProxyName(const swig_type_info *type) {
-  if (!type) return NULL;
-  if (type->clientdata != NULL) {
-    return (const char*) type->clientdata;
-  } 
-  else {
-    return type->name;
-  }
-}
-
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
-			    || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
-}
+	SWIGRUNTIME swig_cast_info *SWIG_TypeProxyCheck(const char *c, swig_type_info * ty) {
+		SWIG_TypeCheck_Template(((!iter->type->clientdata && (strcmp(iter->type->name, c) == 0))
+								 || (iter->type->clientdata && (strcmp((char *) iter->type->clientdata, c) == 0))), ty);
+	}
 
 
 /* Function for getting a pointer value */
 
-SWIGRUNTIME int
-SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
-  swig_cast_info *tc;
-  void *voidptr = (void *)0;
-  SV *tsv = 0;
-  /* If magical, apply more magic */
-  if (SvGMAGICAL(sv))
-    mg_get(sv);
-
-  /* Check to see if this is an object */
-  if (sv_isobject(sv)) {
-    IV tmp = 0;
-    tsv = (SV*) SvRV(sv);
-    if ((SvTYPE(tsv) == SVt_PVHV)) {
-      MAGIC *mg;
-      if (SvMAGICAL(tsv)) {
-        mg = mg_find(tsv,'P');
-        if (mg) {
-          sv = mg->mg_obj;
-          if (sv_isobject(sv)) {
-	    tsv = (SV*)SvRV(sv);
-            tmp = SvIV(tsv);
-          }
-        }
-      } else {
-        return SWIG_ERROR;
-      }
-    } else {
-      tmp = SvIV(tsv);
-    }
-    voidptr = INT2PTR(void *,tmp);
-  } else if (! SvOK(sv)) {            /* Check for undef */
-    *(ptr) = (void *) 0;
-    return SWIG_OK;
-  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
-    if (!SvROK(sv)) {
-      *(ptr) = (void *) 0;
-      return SWIG_OK;
-    } else {
-      return SWIG_ERROR;
-    }
-  } else {                            /* Don't know what it is */
-    return SWIG_ERROR;
-  }
-  if (_t) {
-    /* Now see if the types match */
-    char *_c = HvNAME(SvSTASH(SvRV(sv)));
-    tc = SWIG_TypeProxyCheck(_c,_t);
-    if (!tc) {
-      return SWIG_ERROR;
-    }
-    {
-      int newmemory = 0;
-      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
-      assert(!newmemory); /* newmemory handling not yet implemented */
-    }
-  } else {
-    *ptr = voidptr;
-  }
-
-  /* 
-   *  DISOWN implementation: we need a perl guru to check this one.
-   */
-  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
-    /* 
-     *  almost copy paste code from below SWIG_POINTER_OWN setting
-     */
-    SV *obj = sv;
-    HV *stash = SvSTASH(SvRV(obj));
-    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
-    if (isGV(gv)) {
-      HV *hv = GvHVn(gv);
-      /*
-       * To set ownership (see below), a newSViv(1) entry is added. 
-       * Hence, to remove ownership, we delete the entry.
-       */
-      if (hv_exists_ent(hv, obj, 0)) {
-	hv_delete_ent(hv, obj, 0, 0);
-      }
-    }
-  }
-  return SWIG_OK;
-}
+	SWIGRUNTIME int
+	    SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void **ptr, swig_type_info * _t, int flags) {
+		swig_cast_info *tc;
+		void *voidptr = (void *) 0;
+		SV *tsv = 0;
+		/* If magical, apply more magic */
+		if (SvGMAGICAL(sv))
+			mg_get(sv);
+
+		/* Check to see if this is an object */
+		if (sv_isobject(sv)) {
+			IV tmp = 0;
+			tsv = (SV *) SvRV(sv);
+			if ((SvTYPE(tsv) == SVt_PVHV)) {
+				MAGIC *mg;
+				if (SvMAGICAL(tsv)) {
+					mg = mg_find(tsv, 'P');
+					if (mg) {
+						sv = mg->mg_obj;
+						if (sv_isobject(sv)) {
+							tsv = (SV *) SvRV(sv);
+							tmp = SvIV(tsv);
+						}
+					}
+				} else {
+					return SWIG_ERROR;
+				}
+			} else {
+				tmp = SvIV(tsv);
+			}
+			voidptr = INT2PTR(void *, tmp);
+		} else if (!SvOK(sv)) {	/* Check for undef */
+			*(ptr) = (void *) 0;
+			return SWIG_OK;
+		} else if (SvTYPE(sv) == SVt_RV) {	/* Check for NULL pointer */
+			if (!SvROK(sv)) {
+				*(ptr) = (void *) 0;
+				return SWIG_OK;
+			} else {
+				return SWIG_ERROR;
+			}
+		} else {				/* Don't know what it is */
+			return SWIG_ERROR;
+		}
+		if (_t) {
+			/* Now see if the types match */
+			char *_c = HvNAME(SvSTASH(SvRV(sv)));
+			tc = SWIG_TypeProxyCheck(_c, _t);
+			if (!tc) {
+				return SWIG_ERROR;
+			}
+			{
+				int newmemory = 0;
+				*ptr = SWIG_TypeCast(tc, voidptr, &newmemory);
+				assert(!newmemory);	/* newmemory handling not yet implemented */
+			}
+		} else {
+			*ptr = voidptr;
+		}
+
+		/* 
+		 *  DISOWN implementation: we need a perl guru to check this one.
+		 */
+		if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+			/* 
+			 *  almost copy paste code from below SWIG_POINTER_OWN setting
+			 */
+			SV *obj = sv;
+			HV *stash = SvSTASH(SvRV(obj));
+			GV *gv = *(GV **) hv_fetch(stash, "OWNER", 5, TRUE);
+			if (isGV(gv)) {
+				HV *hv = GvHVn(gv);
+				/*
+				 * To set ownership (see below), a newSViv(1) entry is added. 
+				 * Hence, to remove ownership, we delete the entry.
+				 */
+				if (hv_exists_ent(hv, obj, 0)) {
+					hv_delete_ent(hv, obj, 0, 0);
+				}
+			}
+		}
+		return SWIG_OK;
+	}
 
-SWIGRUNTIME void
-SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
-  if (ptr && (flags & SWIG_SHADOW)) {
-    SV *self;
-    SV *obj=newSV(0);
-    HV *hash=newHV();
-    HV *stash;
-    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
-    stash=SvSTASH(SvRV(obj));
-    if (flags & SWIG_POINTER_OWN) {
-      HV *hv;
-      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
-      if (!isGV(gv))
-        gv_init(gv, stash, "OWNER", 5, FALSE);
-      hv=GvHVn(gv);
-      hv_store_ent(hv, obj, newSViv(1), 0);
-    }
-    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
-    SvREFCNT_dec(obj);
-    self=newRV_noinc((SV *)hash);
-    sv_setsv(sv, self);
-    SvREFCNT_dec((SV *)self);
-    sv_bless(sv, stash);
-  }
-  else {
-    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
-  }
-}
+	SWIGRUNTIME void
+	     SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, swig_type_info * t, int flags) {
+		if (ptr && (flags & SWIG_SHADOW)) {
+			SV *self;
+			SV *obj = newSV(0);
+			HV *hash = newHV();
+			HV *stash;
+			sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+			stash = SvSTASH(SvRV(obj));
+			if (flags & SWIG_POINTER_OWN) {
+				HV *hv;
+				GV *gv = *(GV **) hv_fetch(stash, "OWNER", 5, TRUE);
+				if (!isGV(gv))
+					gv_init(gv, stash, "OWNER", 5, FALSE);
+				hv = GvHVn(gv);
+				hv_store_ent(hv, obj, newSViv(1), 0);
+			}
+			sv_magic((SV *) hash, (SV *) obj, 'P', Nullch, 0);
+			SvREFCNT_dec(obj);
+			self = newRV_noinc((SV *) hash);
+			sv_setsv(sv, self);
+			SvREFCNT_dec((SV *) self);
+			sv_bless(sv, stash);
+		} else {
+			sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+		}
+	}
 
-SWIGRUNTIMEINLINE SV *
-SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
-  SV *result = sv_newmortal();
-  SWIG_MakePtr(result, ptr, t, flags);
-  return result;
-}
+	SWIGRUNTIMEINLINE SV *SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info * t, int flags) {
+		SV *result = sv_newmortal();
+		SWIG_MakePtr(result, ptr, t, flags);
+		return result;
+	}
 
-SWIGRUNTIME void
-SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
-  char result[1024];
-  char *r = result;
-  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
-  *(r++) = '_';
-  r = SWIG_PackData(r,ptr,sz);
-  strcpy(r,SWIG_Perl_TypeProxyName(type));
-  sv_setpv(sv, result);
-}
+	SWIGRUNTIME void
+	     SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, int sz, swig_type_info * type) {
+		char result[1024];
+		char *r = result;
+		if ((2 * sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000)
+			return;
+		*(r++) = '_';
+		r = SWIG_PackData(r, ptr, sz);
+		strcpy(r, SWIG_Perl_TypeProxyName(type));
+		sv_setpv(sv, result);
+	}
 
-SWIGRUNTIME SV *
-SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
-  SV *result = sv_newmortal();
-  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
-  return result;
-}
+	SWIGRUNTIME SV *SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info * type) {
+		SV *result = sv_newmortal();
+		SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+		return result;
+	}
 
 /* Convert a packed value value */
-SWIGRUNTIME int
-SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
-  swig_cast_info *tc;
-  const char  *c = 0;
-
-  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
-  c = SvPV_nolen(obj);
-  /* Pointer values must start with leading underscore */
-  if (*c != '_') return SWIG_ERROR;
-  c++;
-  c = SWIG_UnpackData(c,ptr,sz);
-  if (ty) {
-    tc = SWIG_TypeCheck(c,ty);
-    if (!tc) return SWIG_ERROR;
-  }
-  return SWIG_OK;
-}
+	SWIGRUNTIME int
+	    SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV * obj, void *ptr, int sz, swig_type_info * ty) {
+		swig_cast_info *tc;
+		const char *c = 0;
+
+		if ((!obj) || (!SvOK(obj)))
+			return SWIG_ERROR;
+		c = SvPV_nolen(obj);
+		/* Pointer values must start with leading underscore */
+		if (*c != '_')
+			return SWIG_ERROR;
+		c++;
+		c = SWIG_UnpackData(c, ptr, sz);
+		if (ty) {
+			tc = SWIG_TypeCheck(c, ty);
+			if (!tc)
+				return SWIG_ERROR;
+		}
+		return SWIG_OK;
+	}
 
 
 /* Macros for low-level exception handling */
 #define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
 
 
-typedef XSPROTO(SwigPerlWrapper);
-typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+	typedef XSPROTO(SwigPerlWrapper);
+	typedef SwigPerlWrapper *SwigPerlWrapperPtr;
 
 /* Structure for command table */
-typedef struct {
-  const char         *name;
-  SwigPerlWrapperPtr  wrapper;
-} swig_command_info;
+	typedef struct {
+		const char *name;
+		SwigPerlWrapperPtr wrapper;
+	} swig_command_info;
 
 /* Information for constant table */
 
@@ -1270,73 +1260,74 @@
 #define SWIG_BINARY  5
 
 /* Constant information structure */
-typedef struct swig_constant_info {
-    int              type;
-    const char      *name;
-    long             lvalue;
-    double           dvalue;
-    void            *pvalue;
-    swig_type_info **ptype;
-} swig_constant_info;
+	typedef struct swig_constant_info {
+		int type;
+		const char *name;
+		long lvalue;
+		double dvalue;
+		void *pvalue;
+		swig_type_info **ptype;
+	} swig_constant_info;
 
 
 /* Structure for variable table */
-typedef struct {
-  const char   *name;
-  SwigMagicFunc   set;
-  SwigMagicFunc   get;
-  swig_type_info  **type;
-} swig_variable_info;
+	typedef struct {
+		const char *name;
+		SwigMagicFunc set;
+		SwigMagicFunc get;
+		swig_type_info **type;
+	} swig_variable_info;
 
 /* Magic variable code */
 #ifndef PERL_OBJECT
 #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
-  #ifndef MULTIPLICITY
-     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
-  #else
-     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
-  #endif
+#ifndef MULTIPLICITY
+	SWIGRUNTIME void _swig_create_magic(SV * sv, char *name, int (*set) (SV *, MAGIC *), int (*get) (SV *, MAGIC *))
+#else
+	SWIGRUNTIME void _swig_create_magic(SV * sv, char *name, int (*set) (struct interpreter *, SV *, MAGIC *),
+										int (*get) (struct interpreter *, SV *, MAGIC *))
+#endif
 #else
 #  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
-SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+	SWIGRUNTIME void _swig_create_magic(CPerlObj * pPerl, SV * sv, const char *name, int (CPerlObj::*set) (SV *, MAGIC *),
+										int (CPerlObj::*get) (SV *, MAGIC *))
 #endif
-{
-  MAGIC *mg;
-  sv_magic(sv,sv,'U',(char *) name,strlen(name));
-  mg = mg_find(sv,'U');
-  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
-  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
-  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
-  mg->mg_virtual->svt_len = 0;
-  mg->mg_virtual->svt_clear = 0;
-  mg->mg_virtual->svt_free = 0;
-}
+	{
+		MAGIC *mg;
+		sv_magic(sv, sv, 'U', (char *) name, strlen(name));
+		mg = mg_find(sv, 'U');
+		mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+		mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+		mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+		mg->mg_virtual->svt_len = 0;
+		mg->mg_virtual->svt_clear = 0;
+		mg->mg_virtual->svt_free = 0;
+	}
 
 
-SWIGRUNTIME swig_module_info *
-SWIG_Perl_GetModule(void) {
-  static void *type_pointer = (void *)0;
-  SV *pointer;
-
-  /* first check if pointer already created */
-  if (!type_pointer) {
-    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
-    if (pointer && SvOK(pointer)) {
-      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
-    }
-  }
+	SWIGRUNTIME swig_module_info *SWIG_Perl_GetModule(void) {
+		static void *type_pointer = (void *) 0;
+		SV *pointer;
+
+		/* first check if pointer already created */
+		if (!type_pointer) {
+			pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+			if (pointer && SvOK(pointer)) {
+				type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+			}
+		}
 
-  return (swig_module_info *) type_pointer;
-}
+		return (swig_module_info *) type_pointer;
+	}
 
-SWIGRUNTIME void
-SWIG_Perl_SetModule(swig_module_info *module) {
-  SV *pointer;
-
-  /* create a new pointer */
-  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
-  sv_setiv(pointer, PTR2IV(module));
-}
+	SWIGRUNTIME void
+	     SWIG_Perl_SetModule(swig_module_info * module) {
+		SV *pointer;
+
+		/* create a new pointer */
+		pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+		sv_setiv(pointer, PTR2IV(module));
+	}
 
 #ifdef __cplusplus
 }
@@ -1346,101 +1337,101 @@
  * functions like fopen will not solve the problem on all platforms as fopen
  * might be a macro on Windows but not necessarily on other operating systems. */
 #ifdef do_open
-  #undef do_open
+#undef do_open
 #endif
 #ifdef do_close
-  #undef do_close
+#undef do_close
 #endif
 #ifdef scalar
-  #undef scalar
+#undef scalar
 #endif
 #ifdef list
-  #undef list
+#undef list
 #endif
 #ifdef apply
-  #undef apply
+#undef apply
 #endif
 #ifdef convert
-  #undef convert
+#undef convert
 #endif
 #ifdef Error
-  #undef Error
+#undef Error
 #endif
 #ifdef form
-  #undef form
+#undef form
 #endif
 #ifdef vform
-  #undef vform
+#undef vform
 #endif
 #ifdef LABEL
-  #undef LABEL
+#undef LABEL
 #endif
 #ifdef METHOD
-  #undef METHOD
+#undef METHOD
 #endif
 #ifdef Move
-  #undef Move
+#undef Move
 #endif
 #ifdef yylex
-  #undef yylex
+#undef yylex
 #endif
 #ifdef yyparse
-  #undef yyparse
+#undef yyparse
 #endif
 #ifdef yyerror
-  #undef yyerror
+#undef yyerror
 #endif
 #ifdef invert
-  #undef invert
+#undef invert
 #endif
 #ifdef ref
-  #undef ref
+#undef ref
 #endif
 #ifdef read
-  #undef read
+#undef read
 #endif
 #ifdef write
-  #undef write
+#undef write
 #endif
 #ifdef eof
-  #undef eof
+#undef eof
 #endif
 #ifdef bool
-  #undef bool
+#undef bool
 #endif
 #ifdef close
-  #undef close
+#undef close
 #endif
 #ifdef rewind
-  #undef rewind
+#undef rewind
 #endif
 #ifdef free
-  #undef free
+#undef free
 #endif
 #ifdef malloc
-  #undef malloc
+#undef malloc
 #endif
 #ifdef calloc
-  #undef calloc
+#undef calloc
 #endif
 #ifdef Stat
-  #undef Stat
+#undef Stat
 #endif
 #ifdef check
-  #undef check
+#undef check
 #endif
 #ifdef seekdir
-  #undef seekdir
+#undef seekdir
 #endif
 #ifdef open
-  #undef open
+#undef open
 #endif
 
 
 
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
 
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
 
 
 
@@ -1467,7 +1458,8 @@
 #define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
 #define SWIGTYPE_p_void swig_types[19]
 static swig_type_info *swig_types[21];
-static swig_module_info swig_module = {swig_types, 20, 0, 0, 0, 0};
+static swig_module_info swig_module = { swig_types, 20, 0, 0, 0, 0 };
+
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -1478,12 +1470,12 @@
 #define SWIG_name   "freeswitchc::boot_freeswitch"
 #define SWIG_prefix "freeswitchc::"
 
-#define SWIGVERSION 0x010335 
+#define SWIGVERSION 0x010335
 #define SWIG_VERSION SWIGVERSION
 
 
-#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
 
 
 #include <stdexcept>
@@ -1494,12 +1486,12 @@
 #endif
 #ifndef PERL_OBJECT
 #ifndef MULTIPLICITY
-SWIGEXPORT void SWIG_init (CV* cv);
+       SWIGEXPORT void SWIG_init(CV * cv);
 #else
-SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+     SWIGEXPORT void SWIG_init(pTHXo_ CV * cv);
 #endif
 #else
-SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+     SWIGEXPORT void SWIG_init(CV * cv, CPerlObj *);
 #endif
 
 
@@ -1507,51 +1499,53 @@
 #include "freeswitch_perl.h"
 
 
-SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
+SWIGINTERN swig_type_info *SWIG_pchar_descriptor(void)
 {
-  static int init = 0;
-  static swig_type_info* info = 0;
-  if (!init) {
-    info = SWIG_TypeQuery("_p_char");
-    init = 1;
-  }
-  return info;
+	static int init = 0;
+	static swig_type_info *info = 0;
+	if (!init) {
+		info = SWIG_TypeQuery("_p_char");
+		init = 1;
+	}
+	return info;
 }
 
 
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+SWIGINTERN int SWIG_AsCharPtrAndSize(SV * obj, char **cptr, size_t *psize, int *alloc)
 {
-  if (SvPOK(obj)) {
-    STRLEN len = 0;
-    char *cstr = SvPV(obj, len); 
-    size_t size = len + 1;
-    if (cptr)  {
-      if (alloc) {
-	if (*alloc == SWIG_NEWOBJ) {
-	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
+	if (SvPOK(obj)) {
+		STRLEN len = 0;
+		char *cstr = SvPV(obj, len);
+		size_t size = len + 1;
+		if (cptr) {
+			if (alloc) {
+				if (*alloc == SWIG_NEWOBJ) {
+					*cptr = reinterpret_cast < char *>(memcpy((new char[size]), cstr, sizeof(char) * (size)));
+				} else {
+					*cptr = cstr;
+					*alloc = SWIG_OLDOBJ;
+				}
+			}
+		}
+		if (psize)
+			*psize = size;
+		return SWIG_OK;
 	} else {
-	  *cptr = cstr;
-	  *alloc = SWIG_OLDOBJ;
+		swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
+		if (pchar_descriptor) {
+			char *vptr = 0;
+			if (SWIG_ConvertPtr(obj, (void **) &vptr, pchar_descriptor, 0) == SWIG_OK) {
+				if (cptr)
+					*cptr = vptr;
+				if (psize)
+					*psize = vptr ? (strlen(vptr) + 1) : 0;
+				if (alloc)
+					*alloc = SWIG_OLDOBJ;
+				return SWIG_OK;
+			}
+		}
 	}
-      }
-    }
-    if (psize) *psize = size;
-    return SWIG_OK;
-  } else {
-    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
-    if (pchar_descriptor) {
-      char* vptr = 0; 
-      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
-	if (cptr) *cptr = vptr;
-	if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
-	if (alloc) *alloc = SWIG_OLDOBJ;
-	return SWIG_OK;
-      }
-    }
-  }
-  return SWIG_TypeError;
+	return SWIG_TypeError;
 }
 
 
@@ -1569,31 +1563,34 @@
 
 
 SWIGINTERN int
-SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV * obj, double *val)
 {
-  if (SvNIOK(obj)) {
-    if (val) *val = SvNV(obj);
-    return SWIG_OK;
-  } else if (SvIOK(obj)) {
-    if (val) *val = (double) SvIV(obj);
-    return SWIG_AddCast(SWIG_OK);
-  } else {
-    const char *nptr = SvPV_nolen(obj);
-    if (nptr) {
-      char *endptr;
-      double v = strtod(nptr, &endptr);
-      if (errno == ERANGE) {
-	errno = 0;
-	return SWIG_OverflowError;
-      } else {
-	if (*endptr == '\0') {
-	  if (val) *val = v;
-	  return SWIG_Str2NumCast(SWIG_OK);
+	if (SvNIOK(obj)) {
+		if (val)
+			*val = SvNV(obj);
+		return SWIG_OK;
+	} else if (SvIOK(obj)) {
+		if (val)
+			*val = (double) SvIV(obj);
+		return SWIG_AddCast(SWIG_OK);
+	} else {
+		const char *nptr = SvPV_nolen(obj);
+		if (nptr) {
+			char *endptr;
+			double v = strtod(nptr, &endptr);
+			if (errno == ERANGE) {
+				errno = 0;
+				return SWIG_OverflowError;
+			} else {
+				if (*endptr == '\0') {
+					if (val)
+						*val = v;
+					return SWIG_Str2NumCast(SWIG_OK);
+				}
+			}
+		}
 	}
-      }
-    }
-  }
-  return SWIG_TypeError;
+	return SWIG_TypeError;
 }
 
 
@@ -1603,229 +1600,234 @@
 #include <math.h>
 
 
-SWIGINTERNINLINE int
-SWIG_CanCastAsInteger(double *d, double min, double max) {
-  double x = *d;
-  if ((min <= x && x <= max)) {
-   double fx = floor(x);
-   double cx = ceil(x);
-   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
-   if ((errno == EDOM) || (errno == ERANGE)) {
-     errno = 0;
-   } else {
-     double summ, reps, diff;
-     if (rd < x) {
-       diff = x - rd;
-     } else if (rd > x) {
-       diff = rd - x;
-     } else {
-       return 1;
-     }
-     summ = rd + x;
-     reps = diff/summ;
-     if (reps < 8*DBL_EPSILON) {
-       *d = rd;
-       return 1;
-     }
-   }
-  }
-  return 0;
+SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max)
+{
+	double x = *d;
+	if ((min <= x && x <= max)) {
+		double fx = floor(x);
+		double cx = ceil(x);
+		double rd = ((x - fx) < 0.5) ? fx : cx;	/* simple rint */
+		if ((errno == EDOM) || (errno == ERANGE)) {
+			errno = 0;
+		} else {
+			double summ, reps, diff;
+			if (rd < x) {
+				diff = x - rd;
+			} else if (rd > x) {
+				diff = rd - x;
+			} else {
+				return 1;
+			}
+			summ = rd + x;
+			reps = diff / summ;
+			if (reps < 8 * DBL_EPSILON) {
+				*d = rd;
+				return 1;
+			}
+		}
+	}
+	return 0;
 }
 
 
 SWIGINTERN int
-SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV * obj, long *val)
 {
-  if (SvIOK(obj)) {
-    if (val) *val = SvIV(obj);
-    return SWIG_OK;
-  } else {
-    int dispatch = 0;
-    const char *nptr = SvPV_nolen(obj);
-    if (nptr) {
-      char *endptr;
-      long v;
-      errno = 0;
-      v = strtol(nptr, &endptr,0);
-      if (errno == ERANGE) {
-	errno = 0;
-	return SWIG_OverflowError;
-      } else {
-	if (*endptr == '\0') {
-	  if (val) *val = v;
-	  return SWIG_Str2NumCast(SWIG_OK);
+	if (SvIOK(obj)) {
+		if (val)
+			*val = SvIV(obj);
+		return SWIG_OK;
+	} else {
+		int dispatch = 0;
+		const char *nptr = SvPV_nolen(obj);
+		if (nptr) {
+			char *endptr;
+			long v;
+			errno = 0;
+			v = strtol(nptr, &endptr, 0);
+			if (errno == ERANGE) {
+				errno = 0;
+				return SWIG_OverflowError;
+			} else {
+				if (*endptr == '\0') {
+					if (val)
+						*val = v;
+					return SWIG_Str2NumCast(SWIG_OK);
+				}
+			}
+		}
+		if (!dispatch) {
+			double d;
+			int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj, &d));
+			if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+				if (val)
+					*val = (long) (d);
+				return res;
+			}
+		}
 	}
-      }
-    }
-    if (!dispatch) {
-      double d;
-      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
-      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
-	if (val) *val = (long)(d);
-	return res;
-      }
-    }
-  }
-  return SWIG_TypeError;
+	return SWIG_TypeError;
 }
 
 
 SWIGINTERN int
 SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
 {
-  long v;
-  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
-  if (SWIG_IsOK(res)) {
-    if ((v < INT_MIN || v > INT_MAX)) {
-      return SWIG_OverflowError;
-    } else {
-      if (val) *val = static_cast< int >(v);
-    }
-  }  
-  return res;
+	long v;
+	int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+	if (SWIG_IsOK(res)) {
+		if ((v < INT_MIN || v > INT_MAX)) {
+			return SWIG_OverflowError;
+		} else {
+			if (val)
+				*val = static_cast < int >(v);
+		}
+	}
+	return res;
 }
 
 
-SWIGINTERNINLINE SV *
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+SWIGINTERNINLINE SV *SWIG_FromCharPtrAndSize(const char *carray, size_t size)
 {
-  SV *obj = sv_newmortal();
-  if (carray) {
-    sv_setpvn(obj, carray, size);
-  } else {
-    sv_setsv(obj, &PL_sv_undef);
-  }
-  return obj;
+	SV *obj = sv_newmortal();
+	if (carray) {
+		sv_setpvn(obj, carray, size);
+	} else {
+		sv_setsv(obj, &PL_sv_undef);
+	}
+	return obj;
 }
 
 
-SWIGINTERNINLINE SV * 
-SWIG_FromCharPtr(const char *cptr)
-{ 
-  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+SWIGINTERNINLINE SV *SWIG_FromCharPtr(const char *cptr)
+{
+	return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
 }
 
 
-SWIGINTERNINLINE SV *
-SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
-{    
-  SV *obj = sv_newmortal();
-  sv_setiv(obj, (IV) value);
-  return obj;
+SWIGINTERNINLINE SV *SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value)
+{
+	SV *obj = sv_newmortal();
+	sv_setiv(obj, (IV) value);
+	return obj;
 }
 
 
-SWIGINTERNINLINE SV *
-SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
-{    
-  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
+SWIGINTERNINLINE SV *SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value)
+{
+	return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value);
 }
 
 
-SWIGINTERNINLINE SV *
-SWIG_From_bool  SWIG_PERL_DECL_ARGS_1(bool value)
-{    
-  SV *obj = sv_newmortal();
-  if (value) {
-    sv_setsv(obj, &PL_sv_yes);
-  } else {
-    sv_setsv(obj, &PL_sv_no); 
-  }
-  return obj;
+SWIGINTERNINLINE SV *SWIG_From_bool SWIG_PERL_DECL_ARGS_1(bool value)
+{
+	SV *obj = sv_newmortal();
+	if (value) {
+		sv_setsv(obj, &PL_sv_yes);
+	} else {
+		sv_setsv(obj, &PL_sv_no);
+	}
+	return obj;
 }
 
 
 SWIGINTERN int
-SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
+SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned long *val)
 {
-  if (SvUOK(obj)) {
-    if (val) *val = SvUV(obj);
-    return SWIG_OK;
-  } else  if (SvIOK(obj)) {
-    long v = SvIV(obj);
-    if (v >= 0) {
-      if (val) *val = v;
-      return SWIG_OK;
-    } else {
-      return SWIG_OverflowError;
-    }
-  } else {
-    int dispatch = 0;
-    const char *nptr = SvPV_nolen(obj);
-    if (nptr) {
-      char *endptr;
-      unsigned long v;
-      errno = 0;
-      v = strtoul(nptr, &endptr,0);
-      if (errno == ERANGE) {
-	errno = 0;
-	return SWIG_OverflowError;
-      } else {
-	if (*endptr == '\0') {
-	  if (val) *val = v;
-	  return SWIG_Str2NumCast(SWIG_OK);
+	if (SvUOK(obj)) {
+		if (val)
+			*val = SvUV(obj);
+		return SWIG_OK;
+	} else if (SvIOK(obj)) {
+		long v = SvIV(obj);
+		if (v >= 0) {
+			if (val)
+				*val = v;
+			return SWIG_OK;
+		} else {
+			return SWIG_OverflowError;
+		}
+	} else {
+		int dispatch = 0;
+		const char *nptr = SvPV_nolen(obj);
+		if (nptr) {
+			char *endptr;
+			unsigned long v;
+			errno = 0;
+			v = strtoul(nptr, &endptr, 0);
+			if (errno == ERANGE) {
+				errno = 0;
+				return SWIG_OverflowError;
+			} else {
+				if (*endptr == '\0') {
+					if (val)
+						*val = v;
+					return SWIG_Str2NumCast(SWIG_OK);
+				}
+			}
+		}
+		if (!dispatch) {
+			double d;
+			int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj, &d));
+			if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+				if (val)
+					*val = (unsigned long) (d);
+				return res;
+			}
+		}
 	}
-      }
-    }
-    if (!dispatch) {
-      double d;
-      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
-      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
-	if (val) *val = (unsigned long)(d);
-	return res;
-      }
-    }
-  }
-  return SWIG_TypeError;
+	return SWIG_TypeError;
 }
 
 
 SWIGINTERN int
 SWIG_AsVal_unsigned_SS_int SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned int *val)
 {
-  unsigned long v;
-  int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
-  if (SWIG_IsOK(res)) {
-    if ((v > UINT_MAX)) {
-      return SWIG_OverflowError;
-    } else {
-      if (val) *val = static_cast< unsigned int >(v);
-    }
-  }  
-  return res;
+	unsigned long v;
+	int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+	if (SWIG_IsOK(res)) {
+		if ((v > UINT_MAX)) {
+			return SWIG_OverflowError;
+		} else {
+			if (val)
+				*val = static_cast < unsigned int >(v);
+		}
+	}
+	return res;
 }
 
 
-SWIGINTERNINLINE SV *
-SWIG_From_unsigned_SS_long  SWIG_PERL_DECL_ARGS_1(unsigned long value)
-{    
-  SV *obj = sv_newmortal();
-  sv_setuv(obj, (UV) value);
-  return obj;
+SWIGINTERNINLINE SV *SWIG_From_unsigned_SS_long SWIG_PERL_DECL_ARGS_1(unsigned long value)
+{
+	SV *obj = sv_newmortal();
+	sv_setuv(obj, (UV) value);
+	return obj;
 }
 
 
-SWIGINTERNINLINE SV *
-SWIG_From_unsigned_SS_int  SWIG_PERL_DECL_ARGS_1(unsigned int value)
-{    
-  return SWIG_From_unsigned_SS_long  SWIG_PERL_CALL_ARGS_1(value);
+SWIGINTERNINLINE SV *SWIG_From_unsigned_SS_int SWIG_PERL_DECL_ARGS_1(unsigned int value)
+{
+	return SWIG_From_unsigned_SS_long SWIG_PERL_CALL_ARGS_1(value);
 }
 
 
 SWIGINTERN int
-SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV *obj, bool* val)
+SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV * obj, bool * val)
 {
-  if (obj == &PL_sv_yes) {
-    if (val) *val = true;
-    return SWIG_OK;
-  } else if (obj == &PL_sv_no) { 
-    if (val) *val = false;
-    return SWIG_OK;
-  } else {
-    if (val) *val = SvTRUE(obj) ? true: false;
-    return SWIG_AddCast(SWIG_OK);    
-  }
-  return SWIG_TypeError;
+	if (obj == &PL_sv_yes) {
+		if (val)
+			*val = true;
+		return SWIG_OK;
+	} else if (obj == &PL_sv_no) {
+		if (val)
+			*val = false;
+		return SWIG_OK;
+	} else {
+		if (val)
+			*val = SvTRUE(obj) ? true : false;
+		return SWIG_AddCast(SWIG_OK);
+	}
+	return SWIG_TypeError;
 }
 
 #ifdef __cplusplus
@@ -1834,18 +1836,15 @@
 
 #ifdef PERL_OBJECT
 #define MAGIC_CLASS _wrap_freeswitch_var::
-class _wrap_freeswitch_var : public CPerlObj {
-public:
+	class _wrap_freeswitch_var:public CPerlObj {
+	  public:
 #else
 #define MAGIC_CLASS
 #endif
-SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
-    MAGIC_PPERL
-    croak("Value is read-only.");
-    return 0;
-}
-
-
+	SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV * SWIGUNUSEDPARM(sv), MAGIC * SWIGUNUSEDPARM(mg)) {
+		MAGIC_PPERL croak("Value is read-only.");
+		return 0;
+	}
 #ifdef PERL_OBJECT
 };
 #endif
@@ -1857,6474 +1856,6984 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-XS(_wrap_consoleLog) {
-  {
-    char *arg1 = (char *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: consoleLog(level_str,msg);");
-    }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1"" of type '" "char *""'");
-    }
-    arg1 = reinterpret_cast< char * >(buf1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    consoleLog(arg1,arg2);
-    
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_consoleLog) {
+		{
+			char *arg1 = (char *) 0;
+			char *arg2 = (char *) 0;
+			int res1;
+			char *buf1 = 0;
+			int alloc1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			    dXSARGS;
+
+			if  ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: consoleLog(level_str,msg);");
+			}
+			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1" " of type '" "char *" "'");
+			}
+			arg1 = reinterpret_cast < char *>(buf1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			consoleLog(arg1, arg2);
+
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_consoleCleanLog) {
-  {
-    char *arg1 = (char *) 0 ;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: consoleCleanLog(msg);");
-    }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1"" of type '" "char *""'");
-    }
-    arg1 = reinterpret_cast< char * >(buf1);
-    consoleCleanLog(arg1);
-    
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    XSRETURN(argvi);
-  fail:
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_consoleCleanLog) {
+		{
+			char *arg1 = (char *) 0;
+			int res1;
+			char *buf1 = 0;
+			int alloc1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: consoleCleanLog(msg);");
+			}
+			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1" " of type '" "char *" "'");
+			}
+			arg1 = reinterpret_cast < char *>(buf1);
+			consoleCleanLog(arg1);
+
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			XSRETURN(argvi);
+		  fail:
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_new_IVRMenu) {
-  {
-    IVRMenu *arg1 = (IVRMenu *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    char *arg4 = (char *) 0 ;
-    char *arg5 = (char *) 0 ;
-    char *arg6 = (char *) 0 ;
-    char *arg7 = (char *) 0 ;
-    char *arg8 = (char *) 0 ;
-    int arg9 ;
-    int arg10 ;
-    int arg11 ;
-    int arg12 ;
-    int arg13 ;
-    IVRMenu *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int res4 ;
-    char *buf4 = 0 ;
-    int alloc4 = 0 ;
-    int res5 ;
-    char *buf5 = 0 ;
-    int alloc5 = 0 ;
-    int res6 ;
-    char *buf6 = 0 ;
-    int alloc6 = 0 ;
-    int res7 ;
-    char *buf7 = 0 ;
-    int alloc7 = 0 ;
-    int res8 ;
-    char *buf8 = 0 ;
-    int alloc8 = 0 ;
-    int val9 ;
-    int ecode9 = 0 ;
-    int val10 ;
-    int ecode10 = 0 ;
-    int val11 ;
-    int ecode11 = 0 ;
-    int val12 ;
-    int ecode12 = 0 ;
-    int val13 ;
-    int ecode13 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 13) || (items > 13)) {
-      SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); 
-    }
-    arg1 = reinterpret_cast< IVRMenu * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3"" of type '" "char const *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-    if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4"" of type '" "char const *""'");
-    }
-    arg4 = reinterpret_cast< char * >(buf4);
-    res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
-    if (!SWIG_IsOK(res5)) {
-      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5"" of type '" "char const *""'");
-    }
-    arg5 = reinterpret_cast< char * >(buf5);
-    res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
-    if (!SWIG_IsOK(res6)) {
-      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6"" of type '" "char const *""'");
-    }
-    arg6 = reinterpret_cast< char * >(buf6);
-    res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
-    if (!SWIG_IsOK(res7)) {
-      SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7"" of type '" "char const *""'");
-    }
-    arg7 = reinterpret_cast< char * >(buf7);
-    res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
-    if (!SWIG_IsOK(res8)) {
-      SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
-    }
-    arg8 = reinterpret_cast< char * >(buf8);
-    ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
-    if (!SWIG_IsOK(ecode9)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
-    } 
-    arg9 = static_cast< int >(val9);
-    ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(9), &val10);
-    if (!SWIG_IsOK(ecode10)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
-    } 
-    arg10 = static_cast< int >(val10);
-    ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11);
-    if (!SWIG_IsOK(ecode11)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
-    } 
-    arg11 = static_cast< int >(val11);
-    ecode12 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(11), &val12);
-    if (!SWIG_IsOK(ecode12)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'");
-    } 
-    arg12 = static_cast< int >(val12);
-    ecode13 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(12), &val13);
-    if (!SWIG_IsOK(ecode13)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
-    } 
-    arg13 = static_cast< int >(val13);
-    result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
-    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
-    if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-    
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
-    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
-    if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-    
-    
-    
-    
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_new_IVRMenu) {
+		{
+			IVRMenu *arg1 = (IVRMenu *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			char *arg4 = (char *) 0;
+			char *arg5 = (char *) 0;
+			char *arg6 = (char *) 0;
+			char *arg7 = (char *) 0;
+			char *arg8 = (char *) 0;
+			int arg9;
+			int arg10;
+			int arg11;
+			int arg12;
+			int arg13;
+			IVRMenu *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int res4;
+			char *buf4 = 0;
+			int alloc4 = 0;
+			int res5;
+			char *buf5 = 0;
+			int alloc5 = 0;
+			int res6;
+			char *buf6 = 0;
+			int alloc6 = 0;
+			int res7;
+			char *buf7 = 0;
+			int alloc7 = 0;
+			int res8;
+			char *buf8 = 0;
+			int alloc8 = 0;
+			int val9;
+			int ecode9 = 0;
+			int val10;
+			int ecode10 = 0;
+			int val11;
+			int ecode11 = 0;
+			int val12;
+			int ecode12 = 0;
+			int val13;
+			int ecode13 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 13) || (items > 13)) {
+				SWIG_croak
+					("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
+			}
+			arg1 = reinterpret_cast < IVRMenu * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3" " of type '" "char const *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+			if (!SWIG_IsOK(res4)) {
+				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4" " of type '" "char const *" "'");
+			}
+			arg4 = reinterpret_cast < char *>(buf4);
+			res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
+			if (!SWIG_IsOK(res5)) {
+				SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5" " of type '" "char const *" "'");
+			}
+			arg5 = reinterpret_cast < char *>(buf5);
+			res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+			if (!SWIG_IsOK(res6)) {
+				SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6" " of type '" "char const *" "'");
+			}
+			arg6 = reinterpret_cast < char *>(buf6);
+			res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+			if (!SWIG_IsOK(res7)) {
+				SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7" " of type '" "char const *" "'");
+			}
+			arg7 = reinterpret_cast < char *>(buf7);
+			res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
+			if (!SWIG_IsOK(res8)) {
+				SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8" " of type '" "char const *" "'");
+			}
+			arg8 = reinterpret_cast < char *>(buf8);
+			ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
+			if (!SWIG_IsOK(ecode9)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9" " of type '" "int" "'");
+			}
+			arg9 = static_cast < int >(val9);
+			ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(9), &val10);
+			if (!SWIG_IsOK(ecode10)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10" " of type '" "int" "'");
+			}
+			arg10 = static_cast < int >(val10);
+			ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11);
+			if (!SWIG_IsOK(ecode11)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11" " of type '" "int" "'");
+			}
+			arg11 = static_cast < int >(val11);
+			ecode12 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(11), &val12);
+			if (!SWIG_IsOK(ecode12)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12" " of type '" "int" "'");
+			}
+			arg12 = static_cast < int >(val12);
+			ecode13 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(12), &val13);
+			if (!SWIG_IsOK(ecode13)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13" " of type '" "int" "'");
+			}
+			arg13 = static_cast < int >(val13);
+			result =
+				(IVRMenu *) new IVRMenu(arg1, (char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5, (char const *) arg6,
+										(char const *) arg7, (char const *) arg8, arg9, arg10, arg11, arg12, arg13);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			if (alloc5 == SWIG_NEWOBJ)
+				delete[]buf5;
+			if (alloc6 == SWIG_NEWOBJ)
+				delete[]buf6;
+			if (alloc7 == SWIG_NEWOBJ)
+				delete[]buf7;
+			if (alloc8 == SWIG_NEWOBJ)
+				delete[]buf8;
 
 
-XS(_wrap_delete_IVRMenu) {
-  {
-    IVRMenu *arg1 = (IVRMenu *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: delete_IVRMenu(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); 
-    }
-    arg1 = reinterpret_cast< IVRMenu * >(argp1);
-    delete arg1;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_IVRMenu_bindAction) {
-  {
-    IVRMenu *arg1 = (IVRMenu *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    char *arg4 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int res4 ;
-    char *buf4 = 0 ;
-    int alloc4 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 4) || (items > 4)) {
-      SWIG_croak("Usage: IVRMenu_bindAction(self,action,arg,bind);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1"" of type '" "IVRMenu *""'"); 
-    }
-    arg1 = reinterpret_cast< IVRMenu * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3"" of type '" "char const *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-    if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4"" of type '" "char const *""'");
-    }
-    arg4 = reinterpret_cast< char * >(buf4);
-    (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			if (alloc5 == SWIG_NEWOBJ)
+				delete[]buf5;
+			if (alloc6 == SWIG_NEWOBJ)
+				delete[]buf6;
+			if (alloc7 == SWIG_NEWOBJ)
+				delete[]buf7;
+			if (alloc8 == SWIG_NEWOBJ)
+				delete[]buf8;
 
-XS(_wrap_IVRMenu_execute) {
-  {
-    IVRMenu *arg1 = (IVRMenu *) 0 ;
-    CoreSession *arg2 = (CoreSession *) 0 ;
-    char *arg3 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: IVRMenu_execute(self,session,name);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1"" of type '" "IVRMenu *""'"); 
-    }
-    arg1 = reinterpret_cast< IVRMenu * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2"" of type '" "CoreSession *""'"); 
-    }
-    arg2 = reinterpret_cast< CoreSession * >(argp2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3"" of type '" "char const *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->execute(arg2,(char const *)arg3);
-    
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_new_API) {
-  {
-    API *result = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: new_API();");
-    }
-    result = (API *)new API();
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    XSRETURN(argvi);
-  fail:
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_delete_API) {
-  {
-    API *arg1 = (API *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: delete_API(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1"" of type '" "API *""'"); 
-    }
-    arg1 = reinterpret_cast< API * >(argp1);
-    delete arg1;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_API_execute) {
-  {
-    API *arg1 = (API *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: API_execute(self,command,data);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1"" of type '" "API *""'"); 
-    }
-    arg1 = reinterpret_cast< API * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3"" of type '" "char const *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_delete_IVRMenu) {
+		{
+			IVRMenu *arg1 = (IVRMenu *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: delete_IVRMenu(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
+			}
+			arg1 = reinterpret_cast < IVRMenu * >(argp1);
+			delete arg1;
 
 
-XS(_wrap_API_executeString) {
-  {
-    API *arg1 = (API *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: API_executeString(self,command);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1"" of type '" "API *""'"); 
-    }
-    arg1 = reinterpret_cast< API * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (char *)(arg1)->executeString((char const *)arg2);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_input_callback_state_t_function_set) {
-  {
-    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-    void *arg2 = (void *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: input_callback_state_t_function_set(self,function);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-    }
-    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2"" of type '" "void *""'"); 
-    }
-    if (arg1) (arg1)->function = arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_input_callback_state_t_function_get) {
-  {
-    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-    void *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: input_callback_state_t_function_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-    }
-    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-    result = (void *) ((arg1)->function);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_IVRMenu_bindAction) {
+		{
+			IVRMenu *arg1 = (IVRMenu *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			char *arg4 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int res4;
+			char *buf4 = 0;
+			int alloc4 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 4) || (items > 4)) {
+				SWIG_croak("Usage: IVRMenu_bindAction(self,action,arg,bind);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1" " of type '" "IVRMenu *" "'");
+			}
+			arg1 = reinterpret_cast < IVRMenu * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3" " of type '" "char const *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+			if (!SWIG_IsOK(res4)) {
+				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4" " of type '" "char const *" "'");
+			}
+			arg4 = reinterpret_cast < char *>(buf4);
+			(arg1)->bindAction(arg2, (char const *) arg3, (char const *) arg4);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_input_callback_state_t_threadState_set) {
-  {
-    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-    void *arg2 = (void *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: input_callback_state_t_threadState_set(self,threadState);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-    }
-    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2"" of type '" "void *""'"); 
-    }
-    if (arg1) (arg1)->threadState = arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_IVRMenu_execute) {
+		{
+			IVRMenu *arg1 = (IVRMenu *) 0;
+			CoreSession *arg2 = (CoreSession *) 0;
+			char *arg3 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: IVRMenu_execute(self,session,name);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1" " of type '" "IVRMenu *" "'");
+			}
+			arg1 = reinterpret_cast < IVRMenu * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2" " of type '" "CoreSession *" "'");
+			}
+			arg2 = reinterpret_cast < CoreSession * >(argp2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3" " of type '" "char const *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			(arg1)->execute(arg2, (char const *) arg3);
 
 
-XS(_wrap_input_callback_state_t_threadState_get) {
-  {
-    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-    void *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: input_callback_state_t_threadState_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-    }
-    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-    result = (void *) ((arg1)->threadState);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_input_callback_state_t_extra_set) {
-  {
-    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-    void *arg2 = (void *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: input_callback_state_t_extra_set(self,extra);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-    }
-    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2"" of type '" "void *""'"); 
-    }
-    if (arg1) (arg1)->extra = arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_new_API) {
+		{
+			API *result = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 0) || (items > 0)) {
+				SWIG_croak("Usage: new_API();");
+			}
+			result = (API *) new API();
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
+			XSRETURN(argvi);
+		  fail:
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_input_callback_state_t_extra_get) {
-  {
-    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-    void *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: input_callback_state_t_extra_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-    }
-    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-    result = (void *) ((arg1)->extra);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_delete_API) {
+		{
+			API *arg1 = (API *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: delete_API(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1" " of type '" "API *" "'");
+			}
+			arg1 = reinterpret_cast < API * >(argp1);
+			delete arg1;
 
-XS(_wrap_input_callback_state_t_funcargs_set) {
-  {
-    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: input_callback_state_t_funcargs_set(self,funcargs);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-    }
-    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    if (arg1->funcargs) delete[] arg1->funcargs;
-    if (arg2) {
-      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
-      arg1->funcargs = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
-    } else {
-      arg1->funcargs = 0;
-    }
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_input_callback_state_t_funcargs_get) {
-  {
-    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: input_callback_state_t_funcargs_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-    }
-    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-    result = (char *) ((arg1)->funcargs);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_new_input_callback_state_t) {
-  {
-    input_callback_state_t *result = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: new_input_callback_state_t();");
-    }
-    result = (input_callback_state_t *)new input_callback_state_t();
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    XSRETURN(argvi);
-  fail:
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_API_execute) {
+		{
+			API *arg1 = (API *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: API_execute(self,command,data);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_API, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1" " of type '" "API *" "'");
+			}
+			arg1 = reinterpret_cast < API * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3" " of type '" "char const *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			result = (char *) (arg1)->execute((char const *) arg2, (char const *) arg3);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_delete_input_callback_state_t) {
-  {
-    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: delete_input_callback_state_t(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state_t" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-    }
-    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-    delete arg1;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_API_executeString) {
+		{
+			API *arg1 = (API *) 0;
+			char *arg2 = (char *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: API_executeString(self,command);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_API, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1" " of type '" "API *" "'");
+			}
+			arg1 = reinterpret_cast < API * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (char *) (arg1)->executeString((char const *) arg2);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_new_Stream__SWIG_0) {
-  {
-    Stream *result = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: new_Stream();");
-    }
-    result = (Stream *)new Stream();
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    XSRETURN(argvi);
-  fail:
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_input_callback_state_t_function_set) {
+		{
+			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+			void *arg2 = (void *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: input_callback_state_t_function_set(self,function);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "input_callback_state_t_function_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+			}
+			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2" " of type '" "void *" "'");
+			}
+			if (arg1)
+				(arg1)->function = arg2;
 
-XS(_wrap_new_Stream__SWIG_1) {
-  {
-    switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
-    Stream *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: new_Stream(switch_stream_handle_t *);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_stream_handle_t, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1"" of type '" "switch_stream_handle_t *""'"); 
-    }
-    arg1 = reinterpret_cast< switch_stream_handle_t * >(argp1);
-    result = (Stream *)new Stream(arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_new_Stream) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 0) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-    if (items == 1) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Stream__SWIG_0); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Stream__SWIG_1); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'new_Stream'");
-  XSRETURN(0);
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_delete_Stream) {
-  {
-    Stream *arg1 = (Stream *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: delete_Stream(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1"" of type '" "Stream *""'"); 
-    }
-    arg1 = reinterpret_cast< Stream * >(argp1);
-    delete arg1;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Stream_write) {
-  {
-    Stream *arg1 = (Stream *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Stream_write(self,data);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1"" of type '" "Stream *""'"); 
-    }
-    arg1 = reinterpret_cast< Stream * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    (arg1)->write((char const *)arg2);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_input_callback_state_t_function_get) {
+		{
+			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+			void *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: input_callback_state_t_function_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "input_callback_state_t_function_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+			}
+			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+			result = (void *) ((arg1)->function);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+			argvi++;
 
-XS(_wrap_Stream_get_data) {
-  {
-    Stream *arg1 = (Stream *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Stream_get_data(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1"" of type '" "Stream *""'"); 
-    }
-    arg1 = reinterpret_cast< Stream * >(argp1);
-    result = (char *)(arg1)->get_data();
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Event_event_set) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    switch_event_t *arg2 = (switch_event_t *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Event_event_set(self,event);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2"" of type '" "switch_event_t *""'"); 
-    }
-    arg2 = reinterpret_cast< switch_event_t * >(argp2);
-    if (arg1) (arg1)->event = arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_input_callback_state_t_threadState_set) {
+		{
+			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+			void *arg2 = (void *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: input_callback_state_t_threadState_set(self,threadState);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "input_callback_state_t_threadState_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+			}
+			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2),
+									"in method '" "input_callback_state_t_threadState_set" "', argument " "2" " of type '" "void *" "'");
+			}
+			if (arg1)
+				(arg1)->threadState = arg2;
 
-XS(_wrap_Event_event_get) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    switch_event_t *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Event_event_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    result = (switch_event_t *) ((arg1)->event);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_Event_serialized_string_set) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Event_serialized_string_set(self,serialized_string);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    if (arg1->serialized_string) delete[] arg1->serialized_string;
-    if (arg2) {
-      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
-      arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
-    } else {
-      arg1->serialized_string = 0;
-    }
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_Event_serialized_string_get) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Event_serialized_string_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    result = (char *) ((arg1)->serialized_string);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Event_mine_set) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    int arg2 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int val2 ;
-    int ecode2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Event_mine_set(self,mine);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-    if (!SWIG_IsOK(ecode2)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2"" of type '" "int""'");
-    } 
-    arg2 = static_cast< int >(val2);
-    if (arg1) (arg1)->mine = arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_input_callback_state_t_threadState_get) {
+		{
+			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+			void *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: input_callback_state_t_threadState_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "input_callback_state_t_threadState_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+			}
+			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+			result = (void *) ((arg1)->threadState);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+			argvi++;
 
-XS(_wrap_Event_mine_get) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Event_mine_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    result = (int) ((arg1)->mine);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_new_Event__SWIG_0) {
-  {
-    char *arg1 = (char *) 0 ;
-    char *arg2 = (char *) 0 ;
-    Event *result = 0 ;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: new_Event(type,subclass_name);");
-    }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
-    }
-    arg1 = reinterpret_cast< char * >(buf1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (Event *)new Event((char const *)arg1,(char const *)arg2);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_input_callback_state_t_extra_set) {
+		{
+			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+			void *arg2 = (void *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: input_callback_state_t_extra_set(self,extra);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "input_callback_state_t_extra_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+			}
+			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2" " of type '" "void *" "'");
+			}
+			if (arg1)
+				(arg1)->extra = arg2;
 
-XS(_wrap_new_Event__SWIG_1) {
-  {
-    char *arg1 = (char *) 0 ;
-    Event *result = 0 ;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: new_Event(type);");
-    }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
-    }
-    arg1 = reinterpret_cast< char * >(buf1);
-    result = (Event *)new Event((char const *)arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    XSRETURN(argvi);
-  fail:
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_new_Event__SWIG_2) {
-  {
-    switch_event_t *arg1 = (switch_event_t *) 0 ;
-    int arg2 ;
-    Event *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int val2 ;
-    int ecode2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: new_Event(wrap_me,free_me);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_event_t, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'"); 
-    }
-    arg1 = reinterpret_cast< switch_event_t * >(argp1);
-    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-    if (!SWIG_IsOK(ecode2)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2"" of type '" "int""'");
-    } 
-    arg2 = static_cast< int >(val2);
-    result = (Event *)new Event(arg1,arg2);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_new_Event__SWIG_3) {
-  {
-    switch_event_t *arg1 = (switch_event_t *) 0 ;
-    Event *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: new_Event(wrap_me);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_event_t, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'"); 
-    }
-    arg1 = reinterpret_cast< switch_event_t * >(argp1);
-    result = (Event *)new Event(arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_new_Event) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 1) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 1) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        {
-          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
-          _v = SWIG_CheckState(res);
-        }
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 3;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_3:
-    
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_4;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_4;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 4;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_4:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_3); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_1); return;
-    case 3:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_2); return;
-    case 4:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'new_Event'");
-  XSRETURN(0);
-}
 
+	XS(_wrap_input_callback_state_t_extra_get) {
+		{
+			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+			void *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: input_callback_state_t_extra_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "input_callback_state_t_extra_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+			}
+			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+			result = (void *) ((arg1)->extra);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+			argvi++;
 
-XS(_wrap_delete_Event) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: delete_Event(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    delete arg1;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Event_serialize__SWIG_0) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Event_serialize(self,format);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (char *)(arg1)->serialize((char const *)arg2);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_input_callback_state_t_funcargs_set) {
+		{
+			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: input_callback_state_t_funcargs_set(self,funcargs);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "input_callback_state_t_funcargs_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+			}
+			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			if (arg1->funcargs)
+				delete[]arg1->funcargs;
+			if (arg2) {
+				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+				arg1->funcargs =
+					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+			} else {
+				arg1->funcargs = 0;
+			}
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Event_serialize__SWIG_1) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Event_serialize(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    result = (char *)(arg1)->serialize();
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_input_callback_state_t_funcargs_get) {
+		{
+			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: input_callback_state_t_funcargs_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "input_callback_state_t_funcargs_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+			}
+			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+			result = (char *) ((arg1)->funcargs);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
 
-XS(_wrap_Event_serialize) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 1) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_serialize__SWIG_1); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_serialize__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'Event_serialize'");
-  XSRETURN(0);
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Event_setPriority__SWIG_0) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    switch_priority_t arg2 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Event_setPriority(self,priority);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    {
-      res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_priority_t,  0 );
-      if (!SWIG_IsOK(res2)) {
-        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'"); 
-      }  
-      if (!argp2) {
-        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'");
-      } else {
-        arg2 = *(reinterpret_cast< switch_priority_t * >(argp2));
-      }
-    }
-    result = (bool)(arg1)->setPriority(arg2);
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_new_input_callback_state_t) {
+		{
+			input_callback_state_t *result = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 0) || (items > 0)) {
+				SWIG_croak("Usage: new_input_callback_state_t();");
+			}
+			result = (input_callback_state_t *) new input_callback_state_t();
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
+			XSRETURN(argvi);
+		  fail:
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Event_setPriority__SWIG_1) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Event_setPriority(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    result = (bool)(arg1)->setPriority();
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_delete_input_callback_state_t) {
+		{
+			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: delete_input_callback_state_t(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "delete_input_callback_state_t" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+			}
+			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+			delete arg1;
 
-XS(_wrap_Event_setPriority) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 1) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_switch_priority_t, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_setPriority__SWIG_1); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_setPriority__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'Event_setPriority'");
-  XSRETURN(0);
-}
 
 
-XS(_wrap_Event_getHeader) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Event_getHeader(self,header_name);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (char *)(arg1)->getHeader(arg2);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Event_getBody) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Event_getBody(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    result = (char *)(arg1)->getBody();
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_new_Stream__SWIG_0) {
+		{
+			Stream *result = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 0) || (items > 0)) {
+				SWIG_croak("Usage: new_Stream();");
+			}
+			result = (Stream *) new Stream();
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
+			XSRETURN(argvi);
+		  fail:
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Event_getType) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Event_getType(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    result = (char *)(arg1)->getType();
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_new_Stream__SWIG_1) {
+		{
+			switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0;
+			Stream *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: new_Stream(switch_stream_handle_t *);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_stream_handle_t, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1" " of type '" "switch_stream_handle_t *" "'");
+			}
+			arg1 = reinterpret_cast < switch_stream_handle_t *>(argp1);
+			result = (Stream *) new Stream(arg1);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
 
-XS(_wrap_Event_addBody) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *arg2 = (char *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Event_addBody(self,value);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (bool)(arg1)->addBody((char const *)arg2);
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_Event_addHeader) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: Event_addHeader(self,header_name,value);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3"" of type '" "char const *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_new_Stream) {
+		dXSARGS;
 
-XS(_wrap_Event_delHeader) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    char *arg2 = (char *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Event_delHeader(self,header_name);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (bool)(arg1)->delHeader((char const *)arg2);
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 0) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+			if (items == 1) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_new_Stream__SWIG_0);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_new_Stream__SWIG_1);
+				return;
+			}
+		}
 
+		croak("No matching function for overloaded 'new_Stream'");
+		XSRETURN(0);
+	}
 
-XS(_wrap_Event_fire) {
-  {
-    Event *arg1 = (Event *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Event_fire(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1"" of type '" "Event *""'"); 
-    }
-    arg1 = reinterpret_cast< Event * >(argp1);
-    result = (bool)(arg1)->fire();
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_delete_Stream) {
+		{
+			Stream *arg1 = (Stream *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: delete_Stream(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1" " of type '" "Stream *" "'");
+			}
+			arg1 = reinterpret_cast < Stream * >(argp1);
+			delete arg1;
 
-XS(_wrap_delete_CoreSession) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: delete_CoreSession(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    delete arg1;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_CoreSession_session_set) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_session_set(self,session);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_session_set" "', argument " "2"" of type '" "switch_core_session_t *""'"); 
-    }
-    arg2 = reinterpret_cast< switch_core_session_t * >(argp2);
-    if (arg1) (arg1)->session = arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_session_get) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    switch_core_session_t *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_session_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (switch_core_session_t *) ((arg1)->session);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Stream_write) {
+		{
+			Stream *arg1 = (Stream *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Stream_write(self,data);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Stream, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1" " of type '" "Stream *" "'");
+			}
+			arg1 = reinterpret_cast < Stream * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			(arg1)->write((char const *) arg2);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_channel_set) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_channel_set(self,channel);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2"" of type '" "switch_channel_t *""'"); 
-    }
-    arg2 = reinterpret_cast< switch_channel_t * >(argp2);
-    if (arg1) (arg1)->channel = arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Stream_get_data) {
+		{
+			Stream *arg1 = (Stream *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Stream_get_data(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Stream, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1" " of type '" "Stream *" "'");
+			}
+			arg1 = reinterpret_cast < Stream * >(argp1);
+			result = (char *) (arg1)->get_data();
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
 
-XS(_wrap_CoreSession_channel_get) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    switch_channel_t *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_channel_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (switch_channel_t *) ((arg1)->channel);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_flags_set) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    unsigned int arg2 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    unsigned int val2 ;
-    int ecode2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_flags_set(self,flags);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-    if (!SWIG_IsOK(ecode2)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2"" of type '" "unsigned int""'");
-    } 
-    arg2 = static_cast< unsigned int >(val2);
-    if (arg1) (arg1)->flags = arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_event_set) {
+		{
+			Event *arg1 = (Event *) 0;
+			switch_event_t *arg2 = (switch_event_t *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Event_event_set(self,event);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2" " of type '" "switch_event_t *" "'");
+			}
+			arg2 = reinterpret_cast < switch_event_t *>(argp2);
+			if (arg1)
+				(arg1)->event = arg2;
 
-XS(_wrap_CoreSession_flags_get) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    unsigned int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_flags_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (unsigned int) ((arg1)->flags);
-    ST(argvi) = SWIG_From_unsigned_SS_int  SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_CoreSession_allocated_set) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int arg2 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int val2 ;
-    int ecode2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_allocated_set(self,allocated);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-    if (!SWIG_IsOK(ecode2)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2"" of type '" "int""'");
-    } 
-    arg2 = static_cast< int >(val2);
-    if (arg1) (arg1)->allocated = arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_CoreSession_allocated_get) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_allocated_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (int) ((arg1)->allocated);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_cb_state_set) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    input_callback_state *arg2 = (input_callback_state *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_cb_state_set(self,cb_state);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_input_callback_state, 0 |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_cb_state_set" "', argument " "2"" of type '" "input_callback_state *""'"); 
-    }
-    arg2 = reinterpret_cast< input_callback_state * >(argp2);
-    if (arg1) (arg1)->cb_state = *arg2;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_event_get) {
+		{
+			Event *arg1 = (Event *) 0;
+			switch_event_t *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Event_event_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			result = (switch_event_t *) ((arg1)->event);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0);
+			argvi++;
 
-XS(_wrap_CoreSession_cb_state_get) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    input_callback_state *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_cb_state_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (input_callback_state *)& ((arg1)->cb_state);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | SWIG_SHADOW); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_hook_state_set) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    switch_channel_state_t arg2 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_hook_state_set(self,hook_state);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    {
-      res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_channel_state_t,  0 );
-      if (!SWIG_IsOK(res2)) {
-        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'"); 
-      }  
-      if (!argp2) {
-        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'");
-      } else {
-        arg2 = *(reinterpret_cast< switch_channel_state_t * >(argp2));
-      }
-    }
-    if (arg1) (arg1)->hook_state = arg2;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_serialized_string_set) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Event_serialized_string_set(self,serialized_string);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			if (arg1->serialized_string)
+				delete[]arg1->serialized_string;
+			if (arg2) {
+				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+				arg1->serialized_string =
+					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+			} else {
+				arg1->serialized_string = 0;
+			}
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_hook_state_get) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    switch_channel_state_t result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_hook_state_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result =  ((arg1)->hook_state);
-    ST(argvi) = SWIG_NewPointerObj((new switch_channel_state_t(static_cast< const switch_channel_state_t& >(result))), SWIGTYPE_p_switch_channel_state_t, SWIG_POINTER_OWN | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_serialized_string_get) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Event_serialized_string_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			result = (char *) ((arg1)->serialized_string);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
 
-XS(_wrap_CoreSession_answer) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_answer(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (int)(arg1)->answer();
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_preAnswer) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_preAnswer(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (int)(arg1)->preAnswer();
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_mine_set) {
+		{
+			Event *arg1 = (Event *) 0;
+			int arg2;
+			void *argp1 = 0;
+			int res1 = 0;
+			int val2;
+			int ecode2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Event_mine_set(self,mine);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+			if (!SWIG_IsOK(ecode2)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2" " of type '" "int" "'");
+			}
+			arg2 = static_cast < int >(val2);
+			if (arg1)
+				(arg1)->mine = arg2;
 
-XS(_wrap_CoreSession_hangup__SWIG_0) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_hangup(self,cause);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    (arg1)->hangup(arg2);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_CoreSession_hangup__SWIG_1) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_hangup(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    (arg1)->hangup();
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_CoreSession_hangup) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 1) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_1); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'CoreSession_hangup'");
-  XSRETURN(0);
-}
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_setVariable) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_setVariable(self,var,val);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->setVariable(arg2,arg3);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_mine_get) {
+		{
+			Event *arg1 = (Event *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Event_mine_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			result = (int) ((arg1)->mine);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
 
-XS(_wrap_CoreSession_setPrivate) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *arg3 = (void *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_setPrivate(self,var,val);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_ConvertPtr(ST(2),SWIG_as_voidptrptr(&arg3), 0, 0);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3"" of type '" "void *""'"); 
-    }
-    (arg1)->setPrivate(arg2,arg3);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_getPrivate) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_getPrivate(self,var);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (void *)(arg1)->getPrivate(arg2);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_new_Event__SWIG_0) {
+		{
+			char *arg1 = (char *) 0;
+			char *arg2 = (char *) 0;
+			Event *result = 0;
+			int res1;
+			char *buf1 = 0;
+			int alloc1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: new_Event(type,subclass_name);");
+			}
+			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
+			}
+			arg1 = reinterpret_cast < char *>(buf1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (Event *) new Event((char const *) arg1, (char const *) arg2);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_getVariable) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_getVariable(self,var);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (char *)(arg1)->getVariable(arg2);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_new_Event__SWIG_1) {
+		{
+			char *arg1 = (char *) 0;
+			Event *result = 0;
+			int res1;
+			char *buf1 = 0;
+			int alloc1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: new_Event(type);");
+			}
+			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
+			}
+			arg1 = reinterpret_cast < char *>(buf1);
+			result = (Event *) new Event((char const *) arg1);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			XSRETURN(argvi);
+		  fail:
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_process_callback_result) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    switch_status_t result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_process_callback_result(self,result);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_process_callback_result" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (arg1)->process_callback_result(arg2);
-    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_new_Event__SWIG_2) {
+		{
+			switch_event_t *arg1 = (switch_event_t *) 0;
+			int arg2;
+			Event *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int val2;
+			int ecode2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: new_Event(wrap_me,free_me);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
+			}
+			arg1 = reinterpret_cast < switch_event_t *>(argp1);
+			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+			if (!SWIG_IsOK(ecode2)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2" " of type '" "int" "'");
+			}
+			arg2 = static_cast < int >(val2);
+			result = (Event *) new Event(arg1, arg2);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
 
-XS(_wrap_CoreSession_say) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    char *arg4 = (char *) 0 ;
-    char *arg5 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int res4 ;
-    char *buf4 = 0 ;
-    int alloc4 = 0 ;
-    int res5 ;
-    char *buf5 = 0 ;
-    int alloc5 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 5) || (items > 5)) {
-      SWIG_croak("Usage: CoreSession_say(self,tosay,module_name,say_type,say_method);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-    if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
-    }
-    arg4 = reinterpret_cast< char * >(buf4);
-    res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
-    if (!SWIG_IsOK(res5)) {
-      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
-    }
-    arg5 = reinterpret_cast< char * >(buf5);
-    (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_CoreSession_sayPhrase__SWIG_0) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    char *arg4 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int res4 ;
-    char *buf4 = 0 ;
-    int alloc4 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 4) || (items > 4)) {
-      SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data,phrase_lang);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-    if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
-    }
-    arg4 = reinterpret_cast< char * >(buf4);
-    (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    SWIG_croak_null();
-  }
-}
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_sayPhrase__SWIG_1) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_new_Event__SWIG_3) {
+		{
+			switch_event_t *arg1 = (switch_event_t *) 0;
+			Event *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: new_Event(wrap_me);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
+			}
+			arg1 = reinterpret_cast < switch_event_t *>(argp1);
+			result = (Event *) new Event(arg1);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
 
-XS(_wrap_CoreSession_sayPhrase__SWIG_2) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    (arg1)->sayPhrase((char const *)arg2);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_sayPhrase) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 3) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-    if (items == 4) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 3;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_3:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_2); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_1); return;
-    case 3:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'CoreSession_sayPhrase'");
-  XSRETURN(0);
-}
 
+	XS(_wrap_new_Event) {
+		dXSARGS;
 
-XS(_wrap_CoreSession_recordFile__SWIG_0) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int arg3 ;
-    int arg4 ;
-    int arg5 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int val3 ;
-    int ecode3 = 0 ;
-    int val4 ;
-    int ecode4 = 0 ;
-    int val5 ;
-    int ecode5 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 5) || (items > 5)) {
-      SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold,silence_secs);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-    if (!SWIG_IsOK(ecode3)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
-    } 
-    arg3 = static_cast< int >(val3);
-    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-    if (!SWIG_IsOK(ecode4)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
-    } 
-    arg4 = static_cast< int >(val4);
-    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
-    if (!SWIG_IsOK(ecode5)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5"" of type '" "int""'");
-    } 
-    arg5 = static_cast< int >(val5);
-    result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    
-    
-    SWIG_croak_null();
-  }
-}
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 1) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 1) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					{
+						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+						_v = SWIG_CheckState(res);
+					}
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 3;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_3:
+
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_4;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_4;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 4;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_4:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_new_Event__SWIG_3);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_new_Event__SWIG_1);
+				return;
+			case 3:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_new_Event__SWIG_2);
+				return;
+			case 4:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_new_Event__SWIG_0);
+				return;
+			}
+		}
 
+		croak("No matching function for overloaded 'new_Event'");
+		XSRETURN(0);
+	}
 
-XS(_wrap_CoreSession_recordFile__SWIG_1) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int arg3 ;
-    int arg4 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int val3 ;
-    int ecode3 = 0 ;
-    int val4 ;
-    int ecode4 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 4) || (items > 4)) {
-      SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-    if (!SWIG_IsOK(ecode3)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
-    } 
-    arg3 = static_cast< int >(val3);
-    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-    if (!SWIG_IsOK(ecode4)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
-    } 
-    arg4 = static_cast< int >(val4);
-    result = (int)(arg1)->recordFile(arg2,arg3,arg4);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_delete_Event) {
+		{
+			Event *arg1 = (Event *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: delete_Event(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			delete arg1;
 
-XS(_wrap_CoreSession_recordFile__SWIG_2) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int arg3 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int val3 ;
-    int ecode3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-    if (!SWIG_IsOK(ecode3)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
-    } 
-    arg3 = static_cast< int >(val3);
-    result = (int)(arg1)->recordFile(arg2,arg3);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_CoreSession_recordFile__SWIG_3) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_recordFile(self,file_name);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (int)(arg1)->recordFile(arg2);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_recordFile) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 3) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        {
-          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
-          _v = SWIG_CheckState(res);
-        }
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-    if (items == 4) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        {
-          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
-          _v = SWIG_CheckState(res);
-        }
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        {
-          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
-          _v = SWIG_CheckState(res);
-        }
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 3;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_3:
-    
-    if (items == 5) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_4;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_4;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        {
-          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
-          _v = SWIG_CheckState(res);
-        }
-      }
-      if (!_v) goto check_4;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        {
-          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
-          _v = SWIG_CheckState(res);
-        }
-      }
-      if (!_v) goto check_4;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        {
-          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
-          _v = SWIG_CheckState(res);
-        }
-      }
-      if (!_v) goto check_4;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 4;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_4:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_3); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_2); return;
-    case 3:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_1); return;
-    case 4:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'CoreSession_recordFile'");
-  XSRETURN(0);
-}
 
+	XS(_wrap_Event_serialize__SWIG_0) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *arg2 = (char *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Event_serialize(self,format);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (char *) (arg1)->serialize((char const *) arg2);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_setCallerData) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_setCallerData(self,var,val);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->setCallerData(arg2,arg3);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_serialize__SWIG_1) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Event_serialize(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			result = (char *) (arg1)->serialize();
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
 
-XS(_wrap_CoreSession_originate__SWIG_0) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    CoreSession *arg2 = (CoreSession *) 0 ;
-    char *arg3 = (char *) 0 ;
-    int arg4 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int val4 ;
-    int ecode4 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 4) || (items > 4)) {
-      SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest,timeout);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'"); 
-    }
-    arg2 = reinterpret_cast< CoreSession * >(argp2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-    if (!SWIG_IsOK(ecode4)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4"" of type '" "int""'");
-    } 
-    arg4 = static_cast< int >(val4);
-    result = (int)(arg1)->originate(arg2,arg3,arg4);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_originate__SWIG_1) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    CoreSession *arg2 = (CoreSession *) 0 ;
-    char *arg3 = (char *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'"); 
-    }
-    arg2 = reinterpret_cast< CoreSession * >(argp2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    result = (int)(arg1)->originate(arg2,arg3);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_serialize) {
+		dXSARGS;
 
-XS(_wrap_CoreSession_originate) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 3) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 4) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        {
-          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
-          _v = SWIG_CheckState(res);
-        }
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_1); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'CoreSession_originate'");
-  XSRETURN(0);
-}
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 1) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_Event_serialize__SWIG_1);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_Event_serialize__SWIG_0);
+				return;
+			}
+		}
 
+		croak("No matching function for overloaded 'Event_serialize'");
+		XSRETURN(0);
+	}
 
-XS(_wrap_CoreSession_setDTMFCallback) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    void *arg2 = (void *) 0 ;
-    char *arg3 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_setDTMFCallback(self,cbfunc,funcargs);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "void *""'"); 
-    }
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->setDTMFCallback(arg2,arg3);
-    
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_setPriority__SWIG_0) {
+		{
+			Event *arg1 = (Event *) 0;
+			switch_priority_t arg2;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Event_setPriority(self,priority);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			{
+				res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_priority_t, 0);
+				if (!SWIG_IsOK(res2)) {
+					SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t" "'");
+				}
+				if (!argp2) {
+					SWIG_exception_fail(SWIG_ValueError,
+										"invalid null reference " "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t"
+										"'");
+				} else {
+					arg2 = *(reinterpret_cast < switch_priority_t *>(argp2));
+				}
+			}
+			result = (bool) (arg1)->setPriority(arg2);
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
 
-XS(_wrap_CoreSession_speak) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_speak(self,text);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (int)(arg1)->speak(arg2);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_set_tts_parms) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_set_tts_parms(self,tts_name,voice_name);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->set_tts_parms(arg2,arg3);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_setPriority__SWIG_1) {
+		{
+			Event *arg1 = (Event *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Event_setPriority(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			result = (bool) (arg1)->setPriority();
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
 
-XS(_wrap_CoreSession_collectDigits) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int arg2 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int val2 ;
-    int ecode2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_collectDigits(self,timeout);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-    if (!SWIG_IsOK(ecode2)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'");
-    } 
-    arg2 = static_cast< int >(val2);
-    result = (int)(arg1)->collectDigits(arg2);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_getDigits) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int arg2 ;
-    char *arg3 = (char *) 0 ;
-    int arg4 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int val2 ;
-    int ecode2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int val4 ;
-    int ecode4 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 4) || (items > 4)) {
-      SWIG_croak("Usage: CoreSession_getDigits(self,maxdigits,terminators,timeout);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-    if (!SWIG_IsOK(ecode2)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
-    } 
-    arg2 = static_cast< int >(val2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-    if (!SWIG_IsOK(ecode4)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
-    } 
-    arg4 = static_cast< int >(val4);
-    result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Event_setPriority) {
+		dXSARGS;
 
-XS(_wrap_CoreSession_transfer) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    char *arg4 = (char *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int res4 ;
-    char *buf4 = 0 ;
-    int alloc4 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 4) || (items > 4)) {
-      SWIG_croak("Usage: CoreSession_transfer(self,extensions,dialplan,context);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-    if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'");
-    }
-    arg4 = reinterpret_cast< char * >(buf4);
-    result = (int)(arg1)->transfer(arg2,arg3,arg4);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    SWIG_croak_null();
-  }
-}
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 1) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_switch_priority_t, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_Event_setPriority__SWIG_1);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_Event_setPriority__SWIG_0);
+				return;
+			}
+		}
 
+		croak("No matching function for overloaded 'Event_setPriority'");
+		XSRETURN(0);
+	}
+
+
+	XS(_wrap_Event_getHeader) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *arg2 = (char *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Event_getHeader(self,header_name);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (char *) (arg1)->getHeader(arg2);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_Event_getBody) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Event_getBody(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			result = (char *) (arg1)->getBody();
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_Event_getType) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Event_getType(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			result = (char *) (arg1)->getType();
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_Event_addBody) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *arg2 = (char *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Event_addBody(self,value);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (bool) (arg1)->addBody((char const *) arg2);
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_Event_addHeader) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: Event_addHeader(self,header_name,value);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3" " of type '" "char const *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			result = (bool) (arg1)->addHeader((char const *) arg2, (char const *) arg3);
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_Event_delHeader) {
+		{
+			Event *arg1 = (Event *) 0;
+			char *arg2 = (char *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Event_delHeader(self,header_name);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (bool) (arg1)->delHeader((char const *) arg2);
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_Event_fire) {
+		{
+			Event *arg1 = (Event *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Event_fire(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1" " of type '" "Event *" "'");
+			}
+			arg1 = reinterpret_cast < Event * >(argp1);
+			result = (bool) (arg1)->fire();
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_delete_CoreSession) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: delete_CoreSession(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			delete arg1;
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_session_set) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			switch_core_session_t *arg2 = (switch_core_session_t *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_session_set(self,session);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2),
+									"in method '" "CoreSession_session_set" "', argument " "2" " of type '" "switch_core_session_t *" "'");
+			}
+			arg2 = reinterpret_cast < switch_core_session_t *>(argp2);
+			if (arg1)
+				(arg1)->session = arg2;
+
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_session_get) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			switch_core_session_t *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_session_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (switch_core_session_t *) ((arg1)->session);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0);
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_channel_set) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			switch_channel_t *arg2 = (switch_channel_t *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_channel_set(self,channel);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2" " of type '" "switch_channel_t *" "'");
+			}
+			arg2 = reinterpret_cast < switch_channel_t *>(argp2);
+			if (arg1)
+				(arg1)->channel = arg2;
+
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_channel_get) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			switch_channel_t *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_channel_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (switch_channel_t *) ((arg1)->channel);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0);
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_flags_set) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			unsigned int arg2;
+			void *argp1 = 0;
+			int res1 = 0;
+			unsigned int val2;
+			int ecode2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_flags_set(self,flags);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+			if (!SWIG_IsOK(ecode2)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2" " of type '" "unsigned int" "'");
+			}
+			arg2 = static_cast < unsigned int >(val2);
+			if (arg1)
+				(arg1)->flags = arg2;
+
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_flags_get) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			unsigned int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_flags_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (unsigned int) ((arg1)->flags);
+			ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast < unsigned int >(result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_allocated_set) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int arg2;
+			void *argp1 = 0;
+			int res1 = 0;
+			int val2;
+			int ecode2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_allocated_set(self,allocated);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+			if (!SWIG_IsOK(ecode2)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2" " of type '" "int" "'");
+			}
+			arg2 = static_cast < int >(val2);
+			if (arg1)
+				(arg1)->allocated = arg2;
+
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_allocated_get) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_allocated_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (int) ((arg1)->allocated);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_cb_state_set) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			input_callback_state *arg2 = (input_callback_state *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_cb_state_set(self,cb_state);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_input_callback_state, 0 | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2),
+									"in method '" "CoreSession_cb_state_set" "', argument " "2" " of type '" "input_callback_state *" "'");
+			}
+			arg2 = reinterpret_cast < input_callback_state * >(argp2);
+			if (arg1)
+				(arg1)->cb_state = *arg2;
+
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_cb_state_get) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			input_callback_state *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_cb_state_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (input_callback_state *) & ((arg1)->cb_state);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | SWIG_SHADOW);
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_hook_state_set) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			switch_channel_state_t arg2;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_hook_state_set(self,hook_state);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			{
+				res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_channel_state_t, 0);
+				if (!SWIG_IsOK(res2)) {
+					SWIG_exception_fail(SWIG_ArgError(res2),
+										"in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '" "switch_channel_state_t" "'");
+				}
+				if (!argp2) {
+					SWIG_exception_fail(SWIG_ValueError,
+										"invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '"
+										"switch_channel_state_t" "'");
+				} else {
+					arg2 = *(reinterpret_cast < switch_channel_state_t *>(argp2));
+				}
+			}
+			if (arg1)
+				(arg1)->hook_state = arg2;
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_hook_state_get) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			switch_channel_state_t result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_hook_state_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = ((arg1)->hook_state);
+			ST(argvi) =
+				SWIG_NewPointerObj((new switch_channel_state_t (static_cast < const switch_channel_state_t &>(result))), SWIGTYPE_p_switch_channel_state_t,
+								   SWIG_POINTER_OWN | 0);
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_answer) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_answer(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (int) (arg1)->answer();
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_preAnswer) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_preAnswer(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (int) (arg1)->preAnswer();
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_hangup__SWIG_0) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_hangup(self,cause);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			(arg1)->hangup(arg2);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_hangup__SWIG_1) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_hangup(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			(arg1)->hangup();
+
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_hangup) {
+		dXSARGS;
+
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 1) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_1);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_0);
+				return;
+			}
+		}
+
+		croak("No matching function for overloaded 'CoreSession_hangup'");
+		XSRETURN(0);
+	}
+
+
+	XS(_wrap_CoreSession_setVariable) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_setVariable(self,var,val);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			(arg1)->setVariable(arg2, arg3);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_setPrivate) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			void *arg3 = (void *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_setPrivate(self,var,val);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_ConvertPtr(ST(2), SWIG_as_voidptrptr(&arg3), 0, 0);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3" " of type '" "void *" "'");
+			}
+			(arg1)->setPrivate(arg2, arg3);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_getPrivate) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			void *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_getPrivate(self,var);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (void *) (arg1)->getPrivate(arg2);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_getVariable) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_getVariable(self,var);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (char *) (arg1)->getVariable(arg2);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_process_callback_result) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			switch_status_t result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_process_callback_result(self,result);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "CoreSession_process_callback_result" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (arg1)->process_callback_result(arg2);
+			ST(argvi) =
+				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+								   SWIG_POINTER_OWN | 0);
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_say) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			char *arg4 = (char *) 0;
+			char *arg5 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int res4;
+			char *buf4 = 0;
+			int alloc4 = 0;
+			int res5;
+			char *buf5 = 0;
+			int alloc5 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 5) || (items > 5)) {
+				SWIG_croak("Usage: CoreSession_say(self,tosay,module_name,say_type,say_method);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3" " of type '" "char const *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+			if (!SWIG_IsOK(res4)) {
+				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4" " of type '" "char const *" "'");
+			}
+			arg4 = reinterpret_cast < char *>(buf4);
+			res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
+			if (!SWIG_IsOK(res5)) {
+				SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5" " of type '" "char const *" "'");
+			}
+			arg5 = reinterpret_cast < char *>(buf5);
+			(arg1)->say((char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			if (alloc5 == SWIG_NEWOBJ)
+				delete[]buf5;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			if (alloc5 == SWIG_NEWOBJ)
+				delete[]buf5;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_sayPhrase__SWIG_0) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			char *arg4 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int res4;
+			char *buf4 = 0;
+			int alloc4 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 4) || (items > 4)) {
+				SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data,phrase_lang);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+			if (!SWIG_IsOK(res4)) {
+				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4" " of type '" "char const *" "'");
+			}
+			arg4 = reinterpret_cast < char *>(buf4);
+			(arg1)->sayPhrase((char const *) arg2, (char const *) arg3, (char const *) arg4);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_sayPhrase__SWIG_1) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			(arg1)->sayPhrase((char const *) arg2, (char const *) arg3);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_sayPhrase__SWIG_2) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			(arg1)->sayPhrase((char const *) arg2);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_sayPhrase) {
+		dXSARGS;
+
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 3) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+			if (items == 4) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 3;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_3:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_2);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_1);
+				return;
+			case 3:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_0);
+				return;
+			}
+		}
+
+		croak("No matching function for overloaded 'CoreSession_sayPhrase'");
+		XSRETURN(0);
+	}
+
+
+	XS(_wrap_CoreSession_recordFile__SWIG_0) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			int arg3;
+			int arg4;
+			int arg5;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int val3;
+			int ecode3 = 0;
+			int val4;
+			int ecode4 = 0;
+			int val5;
+			int ecode5 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 5) || (items > 5)) {
+				SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold,silence_secs);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+			if (!SWIG_IsOK(ecode3)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+			}
+			arg3 = static_cast < int >(val3);
+			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+			if (!SWIG_IsOK(ecode4)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
+			}
+			arg4 = static_cast < int >(val4);
+			ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+			if (!SWIG_IsOK(ecode5)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5" " of type '" "int" "'");
+			}
+			arg5 = static_cast < int >(val5);
+			result = (int) (arg1)->recordFile(arg2, arg3, arg4, arg5);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_recordFile__SWIG_1) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			int arg3;
+			int arg4;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int val3;
+			int ecode3 = 0;
+			int val4;
+			int ecode4 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 4) || (items > 4)) {
+				SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+			if (!SWIG_IsOK(ecode3)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+			}
+			arg3 = static_cast < int >(val3);
+			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+			if (!SWIG_IsOK(ecode4)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
+			}
+			arg4 = static_cast < int >(val4);
+			result = (int) (arg1)->recordFile(arg2, arg3, arg4);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_recordFile__SWIG_2) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			int arg3;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int val3;
+			int ecode3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+			if (!SWIG_IsOK(ecode3)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+			}
+			arg3 = static_cast < int >(val3);
+			result = (int) (arg1)->recordFile(arg2, arg3);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_recordFile__SWIG_3) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_recordFile(self,file_name);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (int) (arg1)->recordFile(arg2);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_recordFile) {
+		dXSARGS;
+
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 3) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					{
+						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+						_v = SWIG_CheckState(res);
+					}
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+			if (items == 4) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					{
+						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+						_v = SWIG_CheckState(res);
+					}
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					{
+						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+						_v = SWIG_CheckState(res);
+					}
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 3;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_3:
+
+			if (items == 5) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_4;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_4;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					{
+						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+						_v = SWIG_CheckState(res);
+					}
+				}
+				if (!_v)
+					goto check_4;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					{
+						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+						_v = SWIG_CheckState(res);
+					}
+				}
+				if (!_v)
+					goto check_4;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					{
+						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
+						_v = SWIG_CheckState(res);
+					}
+				}
+				if (!_v)
+					goto check_4;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 4;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_4:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_3);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_2);
+				return;
+			case 3:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_1);
+				return;
+			case 4:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_0);
+				return;
+			}
+		}
+
+		croak("No matching function for overloaded 'CoreSession_recordFile'");
+		XSRETURN(0);
+	}
+
+
+	XS(_wrap_CoreSession_setCallerData) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_setCallerData(self,var,val);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			(arg1)->setCallerData(arg2, arg3);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_originate__SWIG_0) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			CoreSession *arg2 = (CoreSession *) 0;
+			char *arg3 = (char *) 0;
+			int arg4;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int val4;
+			int ecode4 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 4) || (items > 4)) {
+				SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest,timeout);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
+			}
+			arg2 = reinterpret_cast < CoreSession * >(argp2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+			if (!SWIG_IsOK(ecode4)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4" " of type '" "int" "'");
+			}
+			arg4 = static_cast < int >(val4);
+			result = (int) (arg1)->originate(arg2, arg3, arg4);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_originate__SWIG_1) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			CoreSession *arg2 = (CoreSession *) 0;
+			char *arg3 = (char *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
+			}
+			arg2 = reinterpret_cast < CoreSession * >(argp2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			result = (int) (arg1)->originate(arg2, arg3);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_originate) {
+		dXSARGS;
+
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 3) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 4) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					{
+						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+						_v = SWIG_CheckState(res);
+					}
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_1);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_0);
+				return;
+			}
+		}
+
+		croak("No matching function for overloaded 'CoreSession_originate'");
+		XSRETURN(0);
+	}
+
+
+	XS(_wrap_CoreSession_setDTMFCallback) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			void *arg2 = (void *) 0;
+			char *arg3 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_setDTMFCallback(self,cbfunc,funcargs);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2" " of type '" "void *" "'");
+			}
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			(arg1)->setDTMFCallback(arg2, arg3);
+
+
+
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_speak) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_speak(self,text);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (int) (arg1)->speak(arg2);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_set_tts_parms) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_set_tts_parms(self,tts_name,voice_name);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			(arg1)->set_tts_parms(arg2, arg3);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_collectDigits) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int arg2;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int val2;
+			int ecode2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_collectDigits(self,timeout);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+			if (!SWIG_IsOK(ecode2)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2" " of type '" "int" "'");
+			}
+			arg2 = static_cast < int >(val2);
+			result = (int) (arg1)->collectDigits(arg2);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_getDigits) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int arg2;
+			char *arg3 = (char *) 0;
+			int arg4;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int val2;
+			int ecode2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int val4;
+			int ecode4 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 4) || (items > 4)) {
+				SWIG_croak("Usage: CoreSession_getDigits(self,maxdigits,terminators,timeout);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+			if (!SWIG_IsOK(ecode2)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2" " of type '" "int" "'");
+			}
+			arg2 = static_cast < int >(val2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+			if (!SWIG_IsOK(ecode4)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4" " of type '" "int" "'");
+			}
+			arg4 = static_cast < int >(val4);
+			result = (char *) (arg1)->getDigits(arg2, arg3, arg4);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_transfer) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			char *arg4 = (char *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int res4;
+			char *buf4 = 0;
+			int alloc4 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 4) || (items > 4)) {
+				SWIG_croak("Usage: CoreSession_transfer(self,extensions,dialplan,context);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+			if (!SWIG_IsOK(res4)) {
+				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4" " of type '" "char *" "'");
+			}
+			arg4 = reinterpret_cast < char *>(buf4);
+			result = (int) (arg1)->transfer(arg2, arg3, arg4);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_read) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int arg2;
+			int arg3;
+			char *arg4 = (char *) 0;
+			int arg5;
+			char *arg6 = (char *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int val2;
+			int ecode2 = 0;
+			int val3;
+			int ecode3 = 0;
+			int res4;
+			char *buf4 = 0;
+			int alloc4 = 0;
+			int val5;
+			int ecode5 = 0;
+			int res6;
+			char *buf6 = 0;
+			int alloc6 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 6) || (items > 6)) {
+				SWIG_croak("Usage: CoreSession_read(self,min_digits,max_digits,prompt_audio_file,timeout,valid_terminators);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+			if (!SWIG_IsOK(ecode2)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2" " of type '" "int" "'");
+			}
+			arg2 = static_cast < int >(val2);
+			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+			if (!SWIG_IsOK(ecode3)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3" " of type '" "int" "'");
+			}
+			arg3 = static_cast < int >(val3);
+			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+			if (!SWIG_IsOK(res4)) {
+				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4" " of type '" "char const *" "'");
+			}
+			arg4 = reinterpret_cast < char *>(buf4);
+			ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+			if (!SWIG_IsOK(ecode5)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5" " of type '" "int" "'");
+			}
+			arg5 = static_cast < int >(val5);
+			res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+			if (!SWIG_IsOK(res6)) {
+				SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6" " of type '" "char const *" "'");
+			}
+			arg6 = reinterpret_cast < char *>(buf6);
+			result = (char *) (arg1)->read(arg2, arg3, (char const *) arg4, arg5, (char const *) arg6);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+
+
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+
+			if (alloc6 == SWIG_NEWOBJ)
+				delete[]buf6;
+			XSRETURN(argvi);
+		  fail:
+
+
+
+			if (alloc4 == SWIG_NEWOBJ)
+				delete[]buf4;
+
+			if (alloc6 == SWIG_NEWOBJ)
+				delete[]buf6;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_playAndGetDigits) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int arg2;
+			int arg3;
+			int arg4;
+			int arg5;
+			char *arg6 = (char *) 0;
+			char *arg7 = (char *) 0;
+			char *arg8 = (char *) 0;
+			char *arg9 = (char *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int val2;
+			int ecode2 = 0;
+			int val3;
+			int ecode3 = 0;
+			int val4;
+			int ecode4 = 0;
+			int val5;
+			int ecode5 = 0;
+			int res6;
+			char *buf6 = 0;
+			int alloc6 = 0;
+			int res7;
+			char *buf7 = 0;
+			int alloc7 = 0;
+			int res8;
+			char *buf8 = 0;
+			int alloc8 = 0;
+			int res9;
+			char *buf9 = 0;
+			int alloc9 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 9) || (items > 9)) {
+				SWIG_croak
+					("Usage: CoreSession_playAndGetDigits(self,min_digits,max_digits,max_tries,timeout,terminators,audio_files,bad_input_audio_files,digits_regex);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+			if (!SWIG_IsOK(ecode2)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2" " of type '" "int" "'");
+			}
+			arg2 = static_cast < int >(val2);
+			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+			if (!SWIG_IsOK(ecode3)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3" " of type '" "int" "'");
+			}
+			arg3 = static_cast < int >(val3);
+			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+			if (!SWIG_IsOK(ecode4)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4" " of type '" "int" "'");
+			}
+			arg4 = static_cast < int >(val4);
+			ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+			if (!SWIG_IsOK(ecode5)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5" " of type '" "int" "'");
+			}
+			arg5 = static_cast < int >(val5);
+			res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+			if (!SWIG_IsOK(res6)) {
+				SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6" " of type '" "char *" "'");
+			}
+			arg6 = reinterpret_cast < char *>(buf6);
+			res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+			if (!SWIG_IsOK(res7)) {
+				SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7" " of type '" "char *" "'");
+			}
+			arg7 = reinterpret_cast < char *>(buf7);
+			res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
+			if (!SWIG_IsOK(res8)) {
+				SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8" " of type '" "char *" "'");
+			}
+			arg8 = reinterpret_cast < char *>(buf8);
+			res9 = SWIG_AsCharPtrAndSize(ST(8), &buf9, NULL, &alloc9);
+			if (!SWIG_IsOK(res9)) {
+				SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9" " of type '" "char *" "'");
+			}
+			arg9 = reinterpret_cast < char *>(buf9);
+			result = (char *) (arg1)->playAndGetDigits(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+
+
+
+
+			if (alloc6 == SWIG_NEWOBJ)
+				delete[]buf6;
+			if (alloc7 == SWIG_NEWOBJ)
+				delete[]buf7;
+			if (alloc8 == SWIG_NEWOBJ)
+				delete[]buf8;
+			if (alloc9 == SWIG_NEWOBJ)
+				delete[]buf9;
+			XSRETURN(argvi);
+		  fail:
+
+
+
+
+
+			if (alloc6 == SWIG_NEWOBJ)
+				delete[]buf6;
+			if (alloc7 == SWIG_NEWOBJ)
+				delete[]buf7;
+			if (alloc8 == SWIG_NEWOBJ)
+				delete[]buf8;
+			if (alloc9 == SWIG_NEWOBJ)
+				delete[]buf9;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_streamFile__SWIG_0) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			int arg3;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int val3;
+			int ecode3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_streamFile(self,file,starting_sample_count);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+			if (!SWIG_IsOK(ecode3)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3" " of type '" "int" "'");
+			}
+			arg3 = static_cast < int >(val3);
+			result = (int) (arg1)->streamFile(arg2, arg3);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_streamFile__SWIG_1) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_streamFile(self,file);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			result = (int) (arg1)->streamFile(arg2);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_streamFile) {
+		dXSARGS;
+
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 3) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					{
+						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+						_v = SWIG_CheckState(res);
+					}
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_1);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_0);
+				return;
+			}
+		}
+
+		croak("No matching function for overloaded 'CoreSession_streamFile'");
+		XSRETURN(0);
+	}
+
+
+	XS(_wrap_CoreSession_flushEvents) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_flushEvents(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (int) (arg1)->flushEvents();
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_flushDigits) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_flushDigits(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (int) (arg1)->flushDigits();
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_setAutoHangup) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			bool arg2;
+			int result;
+			void *argp1 = 0;
+			int res1 = 0;
+			bool val2;
+			int ecode2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_setAutoHangup(self,val);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			ecode2 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+			if (!SWIG_IsOK(ecode2)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2" " of type '" "bool" "'");
+			}
+			arg2 = static_cast < bool > (val2);
+			result = (int) (arg1)->setAutoHangup(arg2);
+			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+			argvi++;
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_setHangupHook) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			void *arg2 = (void *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_setHangupHook(self,hangup_func);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2" " of type '" "void *" "'");
+			}
+			(arg1)->setHangupHook(arg2);
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_ready) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_ready(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (bool) (arg1)->ready();
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_execute__SWIG_0) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_execute(self,app,data);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			(arg1)->execute(arg2, arg3);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_execute__SWIG_1) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_execute(self,app);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			(arg1)->execute(arg2);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_execute) {
+		dXSARGS;
+
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 3) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_1);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_0);
+				return;
+			}
+		}
+
+		croak("No matching function for overloaded 'CoreSession_execute'");
+		XSRETURN(0);
+	}
+
+
+	XS(_wrap_CoreSession_sendEvent) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			Event *arg2 = (Event *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_sendEvent(self,sendME);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2" " of type '" "Event *" "'");
+			}
+			arg2 = reinterpret_cast < Event * >(argp2);
+			(arg1)->sendEvent(arg2);
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_setEventData) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			Event *arg2 = (Event *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: CoreSession_setEventData(self,e);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_Event, 0 | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2" " of type '" "Event *" "'");
+			}
+			arg2 = reinterpret_cast < Event * >(argp2);
+			(arg1)->setEventData(arg2);
+
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_getXMLCDR) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_getXMLCDR(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (char *) (arg1)->getXMLCDR();
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_begin_allow_threads) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_begin_allow_threads(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "CoreSession_begin_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (bool) (arg1)->begin_allow_threads();
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_end_allow_threads) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_end_allow_threads(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "CoreSession_end_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (bool) (arg1)->end_allow_threads();
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_get_uuid) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_get_uuid(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1" " of type '" "CoreSession const *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			result = (char *) ((CoreSession const *) arg1)->get_uuid();
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_get_cb_args) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			switch_input_args_t *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_get_cb_args(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "CoreSession_get_cb_args" "', argument " "1" " of type '" "CoreSession const *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			{
+				switch_input_args_t const &_result_ref = ((CoreSession const *) arg1)->get_cb_args();
+				result = (switch_input_args_t *) &_result_ref;
+			}
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0);
+			argvi++;
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_check_hangup_hook) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: CoreSession_check_hangup_hook(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "CoreSession_check_hangup_hook" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			(arg1)->check_hangup_hook();
+
+
+			XSRETURN(argvi);
+		  fail:
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_CoreSession_run_dtmf_callback) {
+		{
+			CoreSession *arg1 = (CoreSession *) 0;
+			void *arg2 = (void *) 0;
+			switch_input_type_t arg3;
+			switch_status_t result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			void *argp3;
+			int res3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: CoreSession_run_dtmf_callback(self,input,itype);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "CoreSession_run_dtmf_callback" "', argument " "1" " of type '" "CoreSession *" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+			}
+			{
+				res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0);
+				if (!SWIG_IsOK(res3)) {
+					SWIG_exception_fail(SWIG_ArgError(res3),
+										"in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+				}
+				if (!argp3) {
+					SWIG_exception_fail(SWIG_ValueError,
+										"invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '"
+										"switch_input_type_t" "'");
+				} else {
+					arg3 = *(reinterpret_cast < switch_input_type_t *>(argp3));
+				}
+			}
+			result = (arg1)->run_dtmf_callback(arg2, arg3);
+			ST(argvi) =
+				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+								   SWIG_POINTER_OWN | 0);
+			argvi++;
+
+
+			XSRETURN(argvi);
+		  fail:
+
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_console_log) {
+		{
+			char *arg1 = (char *) 0;
+			char *arg2 = (char *) 0;
+			int res1;
+			char *buf1 = 0;
+			int alloc1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: console_log(level_str,msg);");
+			}
+			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1" " of type '" "char *" "'");
+			}
+			arg1 = reinterpret_cast < char *>(buf1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			console_log(arg1, arg2);
+
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_console_clean_log) {
+		{
+			char *arg1 = (char *) 0;
+			int res1;
+			char *buf1 = 0;
+			int alloc1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: console_clean_log(msg);");
+			}
+			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1" " of type '" "char *" "'");
+			}
+			arg1 = reinterpret_cast < char *>(buf1);
+			console_clean_log(arg1);
+
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			XSRETURN(argvi);
+		  fail:
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_CoreSession_read) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int arg2 ;
-    int arg3 ;
-    char *arg4 = (char *) 0 ;
-    int arg5 ;
-    char *arg6 = (char *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int val2 ;
-    int ecode2 = 0 ;
-    int val3 ;
-    int ecode3 = 0 ;
-    int res4 ;
-    char *buf4 = 0 ;
-    int alloc4 = 0 ;
-    int val5 ;
-    int ecode5 = 0 ;
-    int res6 ;
-    char *buf6 = 0 ;
-    int alloc6 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 6) || (items > 6)) {
-      SWIG_croak("Usage: CoreSession_read(self,min_digits,max_digits,prompt_audio_file,timeout,valid_terminators);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-    if (!SWIG_IsOK(ecode2)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2"" of type '" "int""'");
-    } 
-    arg2 = static_cast< int >(val2);
-    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-    if (!SWIG_IsOK(ecode3)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3"" of type '" "int""'");
-    } 
-    arg3 = static_cast< int >(val3);
-    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-    if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4"" of type '" "char const *""'");
-    }
-    arg4 = reinterpret_cast< char * >(buf4);
-    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
-    if (!SWIG_IsOK(ecode5)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5"" of type '" "int""'");
-    } 
-    arg5 = static_cast< int >(val5);
-    res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
-    if (!SWIG_IsOK(res6)) {
-      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6"" of type '" "char const *""'");
-    }
-    arg6 = reinterpret_cast< char * >(buf6);
-    result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    
-    
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    
-    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-    XSRETURN(argvi);
-  fail:
-    
-    
-    
-    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-    
-    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_bridge) {
+		{
+			CoreSession *arg1 = 0;
+			CoreSession *arg2 = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: bridge(session_a,session_b);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
+			}
+			if (!argp1) {
+				SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
+			}
+			arg1 = reinterpret_cast < CoreSession * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
+			}
+			if (!argp2) {
+				SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
+			}
+			arg2 = reinterpret_cast < CoreSession * >(argp2);
+			bridge(*arg1, *arg2);
 
-XS(_wrap_CoreSession_playAndGetDigits) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int arg2 ;
-    int arg3 ;
-    int arg4 ;
-    int arg5 ;
-    char *arg6 = (char *) 0 ;
-    char *arg7 = (char *) 0 ;
-    char *arg8 = (char *) 0 ;
-    char *arg9 = (char *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int val2 ;
-    int ecode2 = 0 ;
-    int val3 ;
-    int ecode3 = 0 ;
-    int val4 ;
-    int ecode4 = 0 ;
-    int val5 ;
-    int ecode5 = 0 ;
-    int res6 ;
-    char *buf6 = 0 ;
-    int alloc6 = 0 ;
-    int res7 ;
-    char *buf7 = 0 ;
-    int alloc7 = 0 ;
-    int res8 ;
-    char *buf8 = 0 ;
-    int alloc8 = 0 ;
-    int res9 ;
-    char *buf9 = 0 ;
-    int alloc9 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 9) || (items > 9)) {
-      SWIG_croak("Usage: CoreSession_playAndGetDigits(self,min_digits,max_digits,max_tries,timeout,terminators,audio_files,bad_input_audio_files,digits_regex);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-    if (!SWIG_IsOK(ecode2)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2"" of type '" "int""'");
-    } 
-    arg2 = static_cast< int >(val2);
-    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-    if (!SWIG_IsOK(ecode3)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3"" of type '" "int""'");
-    } 
-    arg3 = static_cast< int >(val3);
-    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-    if (!SWIG_IsOK(ecode4)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4"" of type '" "int""'");
-    } 
-    arg4 = static_cast< int >(val4);
-    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
-    if (!SWIG_IsOK(ecode5)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5"" of type '" "int""'");
-    } 
-    arg5 = static_cast< int >(val5);
-    res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
-    if (!SWIG_IsOK(res6)) {
-      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'");
-    }
-    arg6 = reinterpret_cast< char * >(buf6);
-    res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
-    if (!SWIG_IsOK(res7)) {
-      SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'");
-    }
-    arg7 = reinterpret_cast< char * >(buf7);
-    res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
-    if (!SWIG_IsOK(res8)) {
-      SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
-    }
-    arg8 = reinterpret_cast< char * >(buf8);
-    res9 = SWIG_AsCharPtrAndSize(ST(8), &buf9, NULL, &alloc9);
-    if (!SWIG_IsOK(res9)) {
-      SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *""'");
-    }
-    arg9 = reinterpret_cast< char * >(buf9);
-    result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    
-    
-    
-    
-    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
-    if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-    if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
-    XSRETURN(argvi);
-  fail:
-    
-    
-    
-    
-    
-    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
-    if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-    if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_CoreSession_streamFile__SWIG_0) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int arg3 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int val3 ;
-    int ecode3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_streamFile(self,file,starting_sample_count);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-    if (!SWIG_IsOK(ecode3)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3"" of type '" "int""'");
-    } 
-    arg3 = static_cast< int >(val3);
-    result = (int)(arg1)->streamFile(arg2,arg3);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
 
-XS(_wrap_CoreSession_streamFile__SWIG_1) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_streamFile(self,file);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    result = (int)(arg1)->streamFile(arg2);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_CoreSession_streamFile) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 3) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        {
-          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
-          _v = SWIG_CheckState(res);
-        }
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_1); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'CoreSession_streamFile'");
-  XSRETURN(0);
-}
+	XS(_wrap_hanguphook) {
+		{
+			switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+			switch_status_t result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: hanguphook(session);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+			}
+			arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+			result = hanguphook(arg1);
+			ST(argvi) =
+				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+								   SWIG_POINTER_OWN | 0);
+			argvi++;
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_CoreSession_flushEvents) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_flushEvents(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (int)(arg1)->flushEvents();
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_CoreSession_flushDigits) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_flushDigits(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (int)(arg1)->flushDigits();
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_dtmf_callback) {
+		{
+			switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+			void *arg2 = (void *) 0;
+			switch_input_type_t arg3;
+			void *arg4 = (void *) 0;
+			unsigned int arg5;
+			switch_status_t result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			void *argp3;
+			int res3 = 0;
+			int res4;
+			unsigned int val5;
+			int ecode5 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 5) || (items > 5)) {
+				SWIG_croak("Usage: dtmf_callback(session,input,itype,buf,buflen);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+			}
+			arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+			}
+			{
+				res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0);
+				if (!SWIG_IsOK(res3)) {
+					SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+				}
+				if (!argp3) {
+					SWIG_exception_fail(SWIG_ValueError,
+										"invalid null reference " "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+				} else {
+					arg3 = *(reinterpret_cast < switch_input_type_t *>(argp3));
+				}
+			}
+			res4 = SWIG_ConvertPtr(ST(3), SWIG_as_voidptrptr(&arg4), 0, 0);
+			if (!SWIG_IsOK(res4)) {
+				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4" " of type '" "void *" "'");
+			}
+			ecode5 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+			if (!SWIG_IsOK(ecode5)) {
+				SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5" " of type '" "unsigned int" "'");
+			}
+			arg5 = static_cast < unsigned int >(val5);
+			result = dtmf_callback(arg1, arg2, arg3, arg4, arg5);
+			ST(argvi) =
+				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+								   SWIG_POINTER_OWN | 0);
+			argvi++;
 
 
-XS(_wrap_CoreSession_setAutoHangup) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    bool arg2 ;
-    int result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    bool val2 ;
-    int ecode2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_setAutoHangup(self,val);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    ecode2 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-    if (!SWIG_IsOK(ecode2)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2"" of type '" "bool""'");
-    } 
-    arg2 = static_cast< bool >(val2);
-    result = (int)(arg1)->setAutoHangup(arg2);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_CoreSession_setHangupHook) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    void *arg2 = (void *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_setHangupHook(self,hangup_func);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2"" of type '" "void *""'"); 
-    }
-    (arg1)->setHangupHook(arg2);
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
 
-XS(_wrap_CoreSession_ready) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_ready(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (bool)(arg1)->ready();
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
 
-XS(_wrap_CoreSession_execute__SWIG_0) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_execute(self,app,data);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->execute(arg2,arg3);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_CoreSession_execute__SWIG_1) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_execute(self,app);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    (arg1)->execute(arg2);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_new_Session__SWIG_0) {
+		{
+			PERL::Session * result = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 0) || (items > 0)) {
+				SWIG_croak("Usage: new_Session();");
+			}
+			result = (PERL::Session *) new PERL::Session();
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
+			XSRETURN(argvi);
+		  fail:
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_CoreSession_execute) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 3) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_1); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'CoreSession_execute'");
-  XSRETURN(0);
-}
+	XS(_wrap_new_Session__SWIG_1) {
+		{
+			char *arg1 = (char *) 0;
+			PERL::Session * result = 0;
+			int res1;
+			char *buf1 = 0;
+			int alloc1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: new_Session(uuid);");
+			}
+			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1" " of type '" "char *" "'");
+			}
+			arg1 = reinterpret_cast < char *>(buf1);
+			result = (PERL::Session *) new PERL::Session(arg1);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			XSRETURN(argvi);
+		  fail:
+			if (alloc1 == SWIG_NEWOBJ)
+				delete[]buf1;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_CoreSession_sendEvent) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    Event *arg2 = (Event *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_sendEvent(self,sendME);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2"" of type '" "Event *""'"); 
-    }
-    arg2 = reinterpret_cast< Event * >(argp2);
-    (arg1)->sendEvent(arg2);
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_new_Session__SWIG_2) {
+		{
+			switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+			PERL::Session * result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: new_Session(session);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+			}
+			arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+			result = (PERL::Session *) new PERL::Session(arg1);
+			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+			argvi++;
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_CoreSession_setEventData) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    Event *arg2 = (Event *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: CoreSession_setEventData(self,e);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_Event, 0 |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2"" of type '" "Event *""'"); 
-    }
-    arg2 = reinterpret_cast< Event * >(argp2);
-    (arg1)->setEventData(arg2);
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_CoreSession_getXMLCDR) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_getXMLCDR(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (char *)(arg1)->getXMLCDR();
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_new_Session) {
+		dXSARGS;
 
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 0) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+			if (items == 1) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_core_session_t, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+			if (items == 1) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_3;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 3;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_3:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_new_Session__SWIG_0);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_new_Session__SWIG_2);
+				return;
+			case 3:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_new_Session__SWIG_1);
+				return;
+			}
+		}
 
-XS(_wrap_CoreSession_begin_allow_threads) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_begin_allow_threads(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (bool)(arg1)->begin_allow_threads();
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+		croak("No matching function for overloaded 'new_Session'");
+		XSRETURN(0);
+	}
 
 
-XS(_wrap_CoreSession_end_allow_threads) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_end_allow_threads(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (bool)(arg1)->end_allow_threads();
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_delete_Session) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: delete_Session(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, SWIG_POINTER_DISOWN | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Session" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			delete arg1;
 
 
-XS(_wrap_CoreSession_get_uuid) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_get_uuid(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1"" of type '" "CoreSession const *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    result = (char *)((CoreSession const *)arg1)->get_uuid();
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_CoreSession_get_cb_args) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    switch_input_args_t *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_get_cb_args(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1"" of type '" "CoreSession const *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    {
-      switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
-      result = (switch_input_args_t *) &_result_ref;
-    }
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_CoreSession_check_hangup_hook) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: CoreSession_check_hangup_hook(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    (arg1)->check_hangup_hook();
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_begin_allow_threads) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Session_begin_allow_threads(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "Session_begin_allow_threads" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			result = (bool) (arg1)->begin_allow_threads();
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_CoreSession_run_dtmf_callback) {
-  {
-    CoreSession *arg1 = (CoreSession *) 0 ;
-    void *arg2 = (void *) 0 ;
-    switch_input_type_t arg3 ;
-    switch_status_t result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    void *argp3 ;
-    int res3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: CoreSession_run_dtmf_callback(self,input,itype);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1"" of type '" "CoreSession *""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
-    }
-    {
-      res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t,  0 );
-      if (!SWIG_IsOK(res3)) {
-        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
-      }  
-      if (!argp3) {
-        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
-      } else {
-        arg3 = *(reinterpret_cast< switch_input_type_t * >(argp3));
-      }
-    }
-    result = (arg1)->run_dtmf_callback(arg2,arg3);
-    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_console_log) {
-  {
-    char *arg1 = (char *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: console_log(level_str,msg);");
-    }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1"" of type '" "char *""'");
-    }
-    arg1 = reinterpret_cast< char * >(buf1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    console_log(arg1,arg2);
-    
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_end_allow_threads) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Session_end_allow_threads(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_end_allow_threads" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			result = (bool) (arg1)->end_allow_threads();
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_console_clean_log) {
-  {
-    char *arg1 = (char *) 0 ;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: console_clean_log(msg);");
-    }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1"" of type '" "char *""'");
-    }
-    arg1 = reinterpret_cast< char * >(buf1);
-    console_clean_log(arg1);
-    
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    XSRETURN(argvi);
-  fail:
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_bridge) {
-  {
-    CoreSession *arg1 = 0 ;
-    CoreSession *arg2 = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: bridge(session_a,session_b);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession,  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); 
-    }
-    if (!argp1) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); 
-    }
-    arg1 = reinterpret_cast< CoreSession * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession,  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); 
-    }
-    if (!argp2) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); 
-    }
-    arg2 = reinterpret_cast< CoreSession * >(argp2);
-    bridge(*arg1,*arg2);
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_check_hangup_hook) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Session_check_hangup_hook(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_check_hangup_hook" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			(arg1)->check_hangup_hook();
 
 
-XS(_wrap_hanguphook) {
-  {
-    switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-    switch_status_t result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: hanguphook(session);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
-    }
-    arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
-    result = hanguphook(arg1);
-    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			XSRETURN(argvi);
+		  fail:
 
+			SWIG_croak_null();
+		}
+	}
 
-XS(_wrap_dtmf_callback) {
-  {
-    switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-    void *arg2 = (void *) 0 ;
-    switch_input_type_t arg3 ;
-    void *arg4 = (void *) 0 ;
-    unsigned int arg5 ;
-    switch_status_t result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    void *argp3 ;
-    int res3 = 0 ;
-    int res4 ;
-    unsigned int val5 ;
-    int ecode5 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 5) || (items > 5)) {
-      SWIG_croak("Usage: dtmf_callback(session,input,itype,buf,buflen);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
-    }
-    arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
-    }
-    {
-      res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t,  0 );
-      if (!SWIG_IsOK(res3)) {
-        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
-      }  
-      if (!argp3) {
-        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
-      } else {
-        arg3 = *(reinterpret_cast< switch_input_type_t * >(argp3));
-      }
-    }
-    res4 = SWIG_ConvertPtr(ST(3),SWIG_as_voidptrptr(&arg4), 0, 0);
-    if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4"" of type '" "void *""'"); 
-    }
-    ecode5 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
-    if (!SWIG_IsOK(ecode5)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5"" of type '" "unsigned int""'");
-    } 
-    arg5 = static_cast< unsigned int >(val5);
-    result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
-    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-    
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+	XS(_wrap_Session_run_dtmf_callback) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			void *arg2 = (void *) 0;
+			switch_input_type_t arg3;
+			switch_status_t result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			void *argp3;
+			int res3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: Session_run_dtmf_callback(self,input,itype);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_run_dtmf_callback" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+			}
+			{
+				res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0);
+				if (!SWIG_IsOK(res3)) {
+					SWIG_exception_fail(SWIG_ArgError(res3),
+										"in method '" "Session_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+				}
+				if (!argp3) {
+					SWIG_exception_fail(SWIG_ValueError,
+										"invalid null reference " "in method '" "Session_run_dtmf_callback" "', argument " "3" " of type '"
+										"switch_input_type_t" "'");
+				} else {
+					arg3 = *(reinterpret_cast < switch_input_type_t *>(argp3));
+				}
+			}
+			result = (arg1)->run_dtmf_callback(arg2, arg3);
+			ST(argvi) =
+				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+								   SWIG_POINTER_OWN | 0);
+			argvi++;
 
-XS(_wrap_new_Session__SWIG_0) {
-  {
-    PERL::Session *result = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: new_Session();");
-    }
-    result = (PERL::Session *)new PERL::Session();
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    XSRETURN(argvi);
-  fail:
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_new_Session__SWIG_1) {
-  {
-    char *arg1 = (char *) 0 ;
-    PERL::Session *result = 0 ;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: new_Session(uuid);");
-    }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
-    }
-    arg1 = reinterpret_cast< char * >(buf1);
-    result = (PERL::Session *)new PERL::Session(arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    XSRETURN(argvi);
-  fail:
-    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    SWIG_croak_null();
-  }
-}
+
+			SWIG_croak_null();
+		}
+	}
+
+
+	XS(_wrap_Session_setInputCallback) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: Session_setInputCallback(self,cbfunc,funcargs);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setInputCallback" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setInputCallback" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			(arg1)->setInputCallback(arg2, arg3);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_new_Session__SWIG_2) {
-  {
-    switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-    PERL::Session *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: new_Session(session);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
-    }
-    arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
-    result = (PERL::Session *)new PERL::Session(arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_setHangupHook__SWIG_0) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *arg2 = (char *) 0;
+			char *arg3 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int res3;
+			char *buf3 = 0;
+			int alloc3 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 3) || (items > 3)) {
+				SWIG_croak("Usage: Session_setHangupHook(self,func,arg);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setHangupHook" "', argument " "3" " of type '" "char *" "'");
+			}
+			arg3 = reinterpret_cast < char *>(buf3);
+			(arg1)->setHangupHook(arg2, arg3);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			if (alloc3 == SWIG_NEWOBJ)
+				delete[]buf3;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_new_Session) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 0) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-    if (items == 1) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_core_session_t, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-    if (items == 1) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_3;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 3;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_3:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_0); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_2); return;
-    case 3:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_1); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'new_Session'");
-  XSRETURN(0);
-}
+	XS(_wrap_Session_setHangupHook__SWIG_1) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Session_setHangupHook(self,func);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			(arg1)->setHangupHook(arg2);
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_delete_Session) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: delete_Session(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, SWIG_POINTER_DISOWN |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Session" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    delete arg1;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_setHangupHook) {
+		dXSARGS;
 
+		{
+			unsigned long _index = 0;
+			SWIG_TypeRank _rank = 0;
+			if (items == 2) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_1;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 1;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_1:
+
+			if (items == 3) {
+				SWIG_TypeRank _ranki = 0;
+				SWIG_TypeRank _rankm = 0;
+				SWIG_TypeRank _pi = 1;
+				int _v = 0;
+				{
+					void *vptr = 0;
+					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				{
+					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+				}
+				if (!_v)
+					goto check_2;
+				_ranki += _v * _pi;
+				_rankm += _pi;
+				_pi *= SWIG_MAXCASTRANK;
+				if (!_index || (_ranki < _rank)) {
+					_rank = _ranki;
+					_index = 2;
+					if (_rank == _rankm)
+						goto dispatch;
+				}
+			}
+		  check_2:
+
+		  dispatch:
+			switch (_index) {
+			case 1:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_1);
+				return;
+			case 2:
+				++PL_markstack_ptr;
+				SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_0);
+				return;
+			}
+		}
 
-XS(_wrap_Session_begin_allow_threads) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Session_begin_allow_threads(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_begin_allow_threads" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    result = (bool)(arg1)->begin_allow_threads();
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+		croak("No matching function for overloaded 'Session_setHangupHook'");
+		XSRETURN(0);
+	}
 
 
-XS(_wrap_Session_end_allow_threads) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Session_end_allow_threads(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_end_allow_threads" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    result = (bool)(arg1)->end_allow_threads();
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_ready) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			bool result;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Session_ready(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_ready" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			result = (bool) (arg1)->ready();
+			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+			argvi++;
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_Session_check_hangup_hook) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Session_check_hangup_hook(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_check_hangup_hook" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    (arg1)->check_hangup_hook();
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_Session_run_dtmf_callback) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    void *arg2 = (void *) 0 ;
-    switch_input_type_t arg3 ;
-    switch_status_t result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    void *argp3 ;
-    int res3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: Session_run_dtmf_callback(self,input,itype);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_run_dtmf_callback" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
-    }
-    {
-      res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t,  0 );
-      if (!SWIG_IsOK(res3)) {
-        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
-      }  
-      if (!argp3) {
-        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
-      } else {
-        arg3 = *(reinterpret_cast< switch_input_type_t * >(argp3));
-      }
-    }
-    result = (arg1)->run_dtmf_callback(arg2,arg3);
-    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_cb_function_set) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Session_cb_function_set(self,cb_function);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_set" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_function_set" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			if (arg1->cb_function)
+				delete[]arg1->cb_function;
+			if (arg2) {
+				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+				arg1->cb_function =
+					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+			} else {
+				arg1->cb_function = 0;
+			}
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_Session_setInputCallback) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: Session_setInputCallback(self,cbfunc,funcargs);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setInputCallback" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setInputCallback" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->setInputCallback(arg2,arg3);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_cb_function_get) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Session_cb_function_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_get" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			result = (char *) ((arg1)->cb_function);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_Session_setHangupHook__SWIG_0) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int res3 ;
-    char *buf3 = 0 ;
-    int alloc3 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: Session_setHangupHook(self,func,arg);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setHangupHook" "', argument " "3"" of type '" "char *""'");
-    }
-    arg3 = reinterpret_cast< char * >(buf3);
-    (arg1)->setHangupHook(arg2,arg3);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_Session_setHangupHook__SWIG_1) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Session_setHangupHook(self,func);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    (arg1)->setHangupHook(arg2);
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_cb_arg_set) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Session_cb_arg_set(self,cb_arg);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_set" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_arg_set" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			if (arg1->cb_arg)
+				delete[]arg1->cb_arg;
+			if (arg2) {
+				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+				arg1->cb_arg =
+					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+			} else {
+				arg1->cb_arg = 0;
+			}
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_Session_setHangupHook) {
-  dXSARGS;
-  
-  {
-    unsigned long _index = 0;
-    SWIG_TypeRank _rank = 0; 
-    if (items == 2) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_1;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 1;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_1:
-    
-    if (items == 3) {
-      SWIG_TypeRank _ranki = 0;
-      SWIG_TypeRank _rankm = 0;
-      SWIG_TypeRank _pi = 1;
-      int _v = 0;
-      {
-        void *vptr = 0;
-        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      {
-        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-      }
-      if (!_v) goto check_2;
-      _ranki += _v*_pi;
-      _rankm += _pi;
-      _pi *= SWIG_MAXCASTRANK;
-      if (!_index || (_ranki < _rank)) {
-        _rank = _ranki; _index = 2;
-        if (_rank == _rankm) goto dispatch;
-      }
-    }
-  check_2:
-    
-  dispatch:
-    switch(_index) {
-    case 1:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_1); return;
-    case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_0); return;
-    }
-  }
-  
-  croak("No matching function for overloaded 'Session_setHangupHook'");
-  XSRETURN(0);
-}
+	XS(_wrap_Session_cb_arg_get) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Session_cb_arg_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_get" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			result = (char *) ((arg1)->cb_arg);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_Session_ready) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    bool result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Session_ready(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_ready" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    result = (bool)(arg1)->ready();
-    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_Session_cb_function_set) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Session_cb_function_set(self,cb_function);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_function_set" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    if (arg1->cb_function) delete[] arg1->cb_function;
-    if (arg2) {
-      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
-      arg1->cb_function = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
-    } else {
-      arg1->cb_function = 0;
-    }
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_hangup_func_str_set) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Session_hangup_func_str_set(self,hangup_func_str);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "Session_hangup_func_str_set" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_str_set" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			if (arg1->hangup_func_str)
+				delete[]arg1->hangup_func_str;
+			if (arg2) {
+				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+				arg1->hangup_func_str =
+					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+			} else {
+				arg1->hangup_func_str = 0;
+			}
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_Session_cb_function_get) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Session_cb_function_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    result = (char *) ((arg1)->cb_function);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_hangup_func_str_get) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Session_hangup_func_str_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "Session_hangup_func_str_get" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			result = (char *) ((arg1)->hangup_func_str);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_Session_cb_arg_set) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Session_cb_arg_set(self,cb_arg);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_arg_set" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    if (arg1->cb_arg) delete[] arg1->cb_arg;
-    if (arg2) {
-      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
-      arg1->cb_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
-    } else {
-      arg1->cb_arg = 0;
-    }
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_Session_cb_arg_get) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Session_cb_arg_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    result = (char *) ((arg1)->cb_arg);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_hangup_func_arg_set) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *arg2 = (char *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int res2;
+			char *buf2 = 0;
+			int alloc2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Session_hangup_func_arg_set(self,hangup_func_arg);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "Session_hangup_func_arg_set" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_arg_set" "', argument " "2" " of type '" "char *" "'");
+			}
+			arg2 = reinterpret_cast < char *>(buf2);
+			if (arg1->hangup_func_arg)
+				delete[]arg1->hangup_func_arg;
+			if (arg2) {
+				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+				arg1->hangup_func_arg =
+					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+			} else {
+				arg1->hangup_func_arg = 0;
+			}
+
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			XSRETURN(argvi);
+		  fail:
+
+			if (alloc2 == SWIG_NEWOBJ)
+				delete[]buf2;
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_Session_hangup_func_str_set) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Session_hangup_func_str_set(self,hangup_func_str);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_str_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_str_set" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    if (arg1->hangup_func_str) delete[] arg1->hangup_func_str;
-    if (arg2) {
-      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
-      arg1->hangup_func_str = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
-    } else {
-      arg1->hangup_func_str = 0;
-    }
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_hangup_func_arg_get) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			char *result = 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 1) || (items > 1)) {
+				SWIG_croak("Usage: Session_hangup_func_arg_get(self);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1),
+									"in method '" "Session_hangup_func_arg_get" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			result = (char *) ((arg1)->hangup_func_arg);
+			ST(argvi) = SWIG_FromCharPtr((const char *) result);
+			argvi++;
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_Session_hangup_func_str_get) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Session_hangup_func_str_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_str_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    result = (char *) ((arg1)->hangup_func_str);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
+			SWIG_croak_null();
+		}
+	}
 
 
-XS(_wrap_Session_hangup_func_arg_set) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *arg2 = (char *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Session_hangup_func_arg_set(self,hangup_func_arg);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_arg_set" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = reinterpret_cast< char * >(buf2);
-    if (arg1->hangup_func_arg) delete[] arg1->hangup_func_arg;
-    if (arg2) {
-      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
-      arg1->hangup_func_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
-    } else {
-      arg1->hangup_func_arg = 0;
-    }
-    
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-    SWIG_croak_null();
-  }
-}
+	XS(_wrap_Session_setPERL) {
+		{
+			PERL::Session * arg1 = (PERL::Session *) 0;
+			PerlInterpreter *arg2 = (PerlInterpreter *) 0;
+			void *argp1 = 0;
+			int res1 = 0;
+			void *argp2 = 0;
+			int res2 = 0;
+			int argvi = 0;
+			dXSARGS;
+
+			if ((items < 2) || (items > 2)) {
+				SWIG_croak("Usage: Session_setPERL(self,pi);");
+			}
+			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+			if (!SWIG_IsOK(res1)) {
+				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setPERL" "', argument " "1" " of type '" "PERL::Session *" "'");
+			}
+			arg1 = reinterpret_cast < PERL::Session * >(argp1);
+			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_PerlInterpreter, 0 | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setPERL" "', argument " "2" " of type '" "PerlInterpreter *" "'");
+			}
+			arg2 = reinterpret_cast < PerlInterpreter * >(argp2);
+			(arg1)->setPERL(arg2);
 
 
-XS(_wrap_Session_hangup_func_arg_get) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    char *result = 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Session_hangup_func_arg_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    result = (char *) ((arg1)->hangup_func_arg);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
 
+			XSRETURN(argvi);
+		  fail:
 
-XS(_wrap_Session_setPERL) {
-  {
-    PERL::Session *arg1 = (PERL::Session *) 0 ;
-    PerlInterpreter *arg2 = (PerlInterpreter *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    void *argp2 = 0 ;
-    int res2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Session_setPERL(self,pi);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setPERL" "', argument " "1"" of type '" "PERL::Session *""'"); 
-    }
-    arg1 = reinterpret_cast< PERL::Session * >(argp1);
-    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_PerlInterpreter, 0 |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setPERL" "', argument " "2"" of type '" "PerlInterpreter *""'"); 
-    }
-    arg2 = reinterpret_cast< PerlInterpreter * >(argp2);
-    (arg1)->setPERL(arg2);
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
 
+			SWIG_croak_null();
+		}
+	}
 
 
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
-static void *_p_PERL__SessionTo_p_CoreSession(void *x, int *newmemory) {
-    return (void *)((CoreSession *)  ((PERL::Session *) x));
-}
-static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)"freeswitch::API", 0};
-static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)"freeswitch::CoreSession", 0};
-static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)"freeswitch::Event", 0};
-static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)"freeswitch::IVRMenu", 0};
-static swig_type_info _swigt__p_PERL__Session = {"_p_PERL__Session", "PERL::Session *", 0, 0, (void*)"freeswitch::Session", 0};
-static swig_type_info _swigt__p_PerlInterpreter = {"_p_PerlInterpreter", "PerlInterpreter *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)"freeswitch::Stream", 0};
-static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)"freeswitch::input_callback_state_t", 0};
-static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
-
-static swig_type_info *swig_type_initial[] = {
-  &_swigt__p_API,
-  &_swigt__p_CoreSession,
-  &_swigt__p_Event,
-  &_swigt__p_IVRMenu,
-  &_swigt__p_PERL__Session,
-  &_swigt__p_PerlInterpreter,
-  &_swigt__p_Stream,
-  &_swigt__p_char,
-  &_swigt__p_input_callback_state,
-  &_swigt__p_session_flag_t,
-  &_swigt__p_switch_channel_state_t,
-  &_swigt__p_switch_channel_t,
-  &_swigt__p_switch_core_session_t,
-  &_swigt__p_switch_event_t,
-  &_swigt__p_switch_input_args_t,
-  &_swigt__p_switch_input_type_t,
-  &_swigt__p_switch_priority_t,
-  &_swigt__p_switch_status_t,
-  &_swigt__p_switch_stream_handle_t,
-  &_swigt__p_void,
-};
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
-static swig_cast_info _swigc__p_API[] = {  {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_PERL__Session, _p_PERL__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Event[] = {  {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_IVRMenu[] = {  {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_PERL__Session[] = {  {&_swigt__p_PERL__Session, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_PerlInterpreter[] = {  {&_swigt__p_PerlInterpreter, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Stream[] = {  {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_input_callback_state[] = {  {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_session_flag_t[] = {  {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_state_t[] = {  {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_t[] = {  {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_core_session_t[] = {  {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_event_t[] = {  {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_args_t[] = {  {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_type_t[] = {  {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_priority_t[] = {  {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_status_t[] = {  {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_stream_handle_t[] = {  {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
-
-static swig_cast_info *swig_cast_initial[] = {
-  _swigc__p_API,
-  _swigc__p_CoreSession,
-  _swigc__p_Event,
-  _swigc__p_IVRMenu,
-  _swigc__p_PERL__Session,
-  _swigc__p_PerlInterpreter,
-  _swigc__p_Stream,
-  _swigc__p_char,
-  _swigc__p_input_callback_state,
-  _swigc__p_session_flag_t,
-  _swigc__p_switch_channel_state_t,
-  _swigc__p_switch_channel_t,
-  _swigc__p_switch_core_session_t,
-  _swigc__p_switch_event_t,
-  _swigc__p_switch_input_args_t,
-  _swigc__p_switch_input_type_t,
-  _swigc__p_switch_priority_t,
-  _swigc__p_switch_status_t,
-  _swigc__p_switch_stream_handle_t,
-  _swigc__p_void,
-};
+	static void *_p_PERL__SessionTo_p_CoreSession(void *x, int *newmemory) {
+		return (void *) ((CoreSession *) ((PERL::Session *) x));
+	}
+	static swig_type_info _swigt__p_API = { "_p_API", "API *", 0, 0, (void *) "freeswitch::API", 0 };
+	static swig_type_info _swigt__p_CoreSession = { "_p_CoreSession", "CoreSession *", 0, 0, (void *) "freeswitch::CoreSession", 0 };
+	static swig_type_info _swigt__p_Event = { "_p_Event", "Event *", 0, 0, (void *) "freeswitch::Event", 0 };
+	static swig_type_info _swigt__p_IVRMenu = { "_p_IVRMenu", "IVRMenu *", 0, 0, (void *) "freeswitch::IVRMenu", 0 };
+	static swig_type_info _swigt__p_PERL__Session = { "_p_PERL__Session", "PERL::Session *", 0, 0, (void *) "freeswitch::Session", 0 };
+	static swig_type_info _swigt__p_PerlInterpreter = { "_p_PerlInterpreter", "PerlInterpreter *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_Stream = { "_p_Stream", "Stream *", 0, 0, (void *) "freeswitch::Stream", 0 };
+	static swig_type_info _swigt__p_char = { "_p_char", "char *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_input_callback_state =
+		{ "_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void *) "freeswitch::input_callback_state_t", 0 };
+	static swig_type_info _swigt__p_session_flag_t = { "_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_event_t = { "_p_switch_event_t", "switch_event_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_input_args_t = { "_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_input_type_t = { "_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_priority_t = { "_p_switch_priority_t", "switch_priority_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_status_t = { "_p_switch_status_t", "switch_status_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_stream_handle_t = { "_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_void = { "_p_void", "void *", 0, 0, (void *) 0, 0 };
+
+	static swig_type_info *swig_type_initial[] = {
+		&_swigt__p_API,
+		&_swigt__p_CoreSession,
+		&_swigt__p_Event,
+		&_swigt__p_IVRMenu,
+		&_swigt__p_PERL__Session,
+		&_swigt__p_PerlInterpreter,
+		&_swigt__p_Stream,
+		&_swigt__p_char,
+		&_swigt__p_input_callback_state,
+		&_swigt__p_session_flag_t,
+		&_swigt__p_switch_channel_state_t,
+		&_swigt__p_switch_channel_t,
+		&_swigt__p_switch_core_session_t,
+		&_swigt__p_switch_event_t,
+		&_swigt__p_switch_input_args_t,
+		&_swigt__p_switch_input_type_t,
+		&_swigt__p_switch_priority_t,
+		&_swigt__p_switch_status_t,
+		&_swigt__p_switch_stream_handle_t,
+		&_swigt__p_void,
+	};
+
+	static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_CoreSession[] =
+		{ {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PERL__Session, _p_PERL__SessionTo_p_CoreSession, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_PERL__Session[] = { {&_swigt__p_PERL__Session, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_PerlInterpreter[] = { {&_swigt__p_PerlInterpreter, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0}, {0, 0, 0, 0} };
+
+	static swig_cast_info *swig_cast_initial[] = {
+		_swigc__p_API,
+		_swigc__p_CoreSession,
+		_swigc__p_Event,
+		_swigc__p_IVRMenu,
+		_swigc__p_PERL__Session,
+		_swigc__p_PerlInterpreter,
+		_swigc__p_Stream,
+		_swigc__p_char,
+		_swigc__p_input_callback_state,
+		_swigc__p_session_flag_t,
+		_swigc__p_switch_channel_state_t,
+		_swigc__p_switch_channel_t,
+		_swigc__p_switch_core_session_t,
+		_swigc__p_switch_event_t,
+		_swigc__p_switch_input_args_t,
+		_swigc__p_switch_input_type_t,
+		_swigc__p_switch_priority_t,
+		_swigc__p_switch_status_t,
+		_swigc__p_switch_stream_handle_t,
+		_swigc__p_void,
+	};
 
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
 
-static swig_constant_info swig_constants[] = {
-{0,0,0,0,0,0}
-};
+	static swig_constant_info swig_constants[] = {
+		{0, 0, 0, 0, 0, 0}
+	};
 #ifdef __cplusplus
 }
 #endif
 static swig_variable_info swig_variables[] = {
-{0,0,0,0}
+	{0, 0, 0, 0}
 };
 static swig_command_info swig_commands[] = {
-{"freeswitchc::consoleLog", _wrap_consoleLog},
-{"freeswitchc::consoleCleanLog", _wrap_consoleCleanLog},
-{"freeswitchc::new_IVRMenu", _wrap_new_IVRMenu},
-{"freeswitchc::delete_IVRMenu", _wrap_delete_IVRMenu},
-{"freeswitchc::IVRMenu_bindAction", _wrap_IVRMenu_bindAction},
-{"freeswitchc::IVRMenu_execute", _wrap_IVRMenu_execute},
-{"freeswitchc::new_API", _wrap_new_API},
-{"freeswitchc::delete_API", _wrap_delete_API},
-{"freeswitchc::API_execute", _wrap_API_execute},
-{"freeswitchc::API_executeString", _wrap_API_executeString},
-{"freeswitchc::input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set},
-{"freeswitchc::input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get},
-{"freeswitchc::input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set},
-{"freeswitchc::input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get},
-{"freeswitchc::input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set},
-{"freeswitchc::input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get},
-{"freeswitchc::input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set},
-{"freeswitchc::input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get},
-{"freeswitchc::new_input_callback_state_t", _wrap_new_input_callback_state_t},
-{"freeswitchc::delete_input_callback_state_t", _wrap_delete_input_callback_state_t},
-{"freeswitchc::new_Stream", _wrap_new_Stream},
-{"freeswitchc::delete_Stream", _wrap_delete_Stream},
-{"freeswitchc::Stream_write", _wrap_Stream_write},
-{"freeswitchc::Stream_get_data", _wrap_Stream_get_data},
-{"freeswitchc::Event_event_set", _wrap_Event_event_set},
-{"freeswitchc::Event_event_get", _wrap_Event_event_get},
-{"freeswitchc::Event_serialized_string_set", _wrap_Event_serialized_string_set},
-{"freeswitchc::Event_serialized_string_get", _wrap_Event_serialized_string_get},
-{"freeswitchc::Event_mine_set", _wrap_Event_mine_set},
-{"freeswitchc::Event_mine_get", _wrap_Event_mine_get},
-{"freeswitchc::new_Event", _wrap_new_Event},
-{"freeswitchc::delete_Event", _wrap_delete_Event},
-{"freeswitchc::Event_serialize", _wrap_Event_serialize},
-{"freeswitchc::Event_setPriority", _wrap_Event_setPriority},
-{"freeswitchc::Event_getHeader", _wrap_Event_getHeader},
-{"freeswitchc::Event_getBody", _wrap_Event_getBody},
-{"freeswitchc::Event_getType", _wrap_Event_getType},
-{"freeswitchc::Event_addBody", _wrap_Event_addBody},
-{"freeswitchc::Event_addHeader", _wrap_Event_addHeader},
-{"freeswitchc::Event_delHeader", _wrap_Event_delHeader},
-{"freeswitchc::Event_fire", _wrap_Event_fire},
-{"freeswitchc::delete_CoreSession", _wrap_delete_CoreSession},
-{"freeswitchc::CoreSession_session_set", _wrap_CoreSession_session_set},
-{"freeswitchc::CoreSession_session_get", _wrap_CoreSession_session_get},
-{"freeswitchc::CoreSession_channel_set", _wrap_CoreSession_channel_set},
-{"freeswitchc::CoreSession_channel_get", _wrap_CoreSession_channel_get},
-{"freeswitchc::CoreSession_flags_set", _wrap_CoreSession_flags_set},
-{"freeswitchc::CoreSession_flags_get", _wrap_CoreSession_flags_get},
-{"freeswitchc::CoreSession_allocated_set", _wrap_CoreSession_allocated_set},
-{"freeswitchc::CoreSession_allocated_get", _wrap_CoreSession_allocated_get},
-{"freeswitchc::CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set},
-{"freeswitchc::CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get},
-{"freeswitchc::CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set},
-{"freeswitchc::CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get},
-{"freeswitchc::CoreSession_answer", _wrap_CoreSession_answer},
-{"freeswitchc::CoreSession_preAnswer", _wrap_CoreSession_preAnswer},
-{"freeswitchc::CoreSession_hangup", _wrap_CoreSession_hangup},
-{"freeswitchc::CoreSession_setVariable", _wrap_CoreSession_setVariable},
-{"freeswitchc::CoreSession_setPrivate", _wrap_CoreSession_setPrivate},
-{"freeswitchc::CoreSession_getPrivate", _wrap_CoreSession_getPrivate},
-{"freeswitchc::CoreSession_getVariable", _wrap_CoreSession_getVariable},
-{"freeswitchc::CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result},
-{"freeswitchc::CoreSession_say", _wrap_CoreSession_say},
-{"freeswitchc::CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase},
-{"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
-{"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
-{"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
-{"freeswitchc::CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
-{"freeswitchc::CoreSession_speak", _wrap_CoreSession_speak},
-{"freeswitchc::CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms},
-{"freeswitchc::CoreSession_collectDigits", _wrap_CoreSession_collectDigits},
-{"freeswitchc::CoreSession_getDigits", _wrap_CoreSession_getDigits},
-{"freeswitchc::CoreSession_transfer", _wrap_CoreSession_transfer},
-{"freeswitchc::CoreSession_read", _wrap_CoreSession_read},
-{"freeswitchc::CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
-{"freeswitchc::CoreSession_streamFile", _wrap_CoreSession_streamFile},
-{"freeswitchc::CoreSession_flushEvents", _wrap_CoreSession_flushEvents},
-{"freeswitchc::CoreSession_flushDigits", _wrap_CoreSession_flushDigits},
-{"freeswitchc::CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup},
-{"freeswitchc::CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook},
-{"freeswitchc::CoreSession_ready", _wrap_CoreSession_ready},
-{"freeswitchc::CoreSession_execute", _wrap_CoreSession_execute},
-{"freeswitchc::CoreSession_sendEvent", _wrap_CoreSession_sendEvent},
-{"freeswitchc::CoreSession_setEventData", _wrap_CoreSession_setEventData},
-{"freeswitchc::CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR},
-{"freeswitchc::CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
-{"freeswitchc::CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads},
-{"freeswitchc::CoreSession_get_uuid", _wrap_CoreSession_get_uuid},
-{"freeswitchc::CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args},
-{"freeswitchc::CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
-{"freeswitchc::CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
-{"freeswitchc::console_log", _wrap_console_log},
-{"freeswitchc::console_clean_log", _wrap_console_clean_log},
-{"freeswitchc::bridge", _wrap_bridge},
-{"freeswitchc::hanguphook", _wrap_hanguphook},
-{"freeswitchc::dtmf_callback", _wrap_dtmf_callback},
-{"freeswitchc::new_Session", _wrap_new_Session},
-{"freeswitchc::delete_Session", _wrap_delete_Session},
-{"freeswitchc::Session_begin_allow_threads", _wrap_Session_begin_allow_threads},
-{"freeswitchc::Session_end_allow_threads", _wrap_Session_end_allow_threads},
-{"freeswitchc::Session_check_hangup_hook", _wrap_Session_check_hangup_hook},
-{"freeswitchc::Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback},
-{"freeswitchc::Session_setInputCallback", _wrap_Session_setInputCallback},
-{"freeswitchc::Session_setHangupHook", _wrap_Session_setHangupHook},
-{"freeswitchc::Session_ready", _wrap_Session_ready},
-{"freeswitchc::Session_cb_function_set", _wrap_Session_cb_function_set},
-{"freeswitchc::Session_cb_function_get", _wrap_Session_cb_function_get},
-{"freeswitchc::Session_cb_arg_set", _wrap_Session_cb_arg_set},
-{"freeswitchc::Session_cb_arg_get", _wrap_Session_cb_arg_get},
-{"freeswitchc::Session_hangup_func_str_set", _wrap_Session_hangup_func_str_set},
-{"freeswitchc::Session_hangup_func_str_get", _wrap_Session_hangup_func_str_get},
-{"freeswitchc::Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set},
-{"freeswitchc::Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get},
-{"freeswitchc::Session_setPERL", _wrap_Session_setPERL},
-{0,0}
+	{"freeswitchc::consoleLog", _wrap_consoleLog},
+	{"freeswitchc::consoleCleanLog", _wrap_consoleCleanLog},
+	{"freeswitchc::new_IVRMenu", _wrap_new_IVRMenu},
+	{"freeswitchc::delete_IVRMenu", _wrap_delete_IVRMenu},
+	{"freeswitchc::IVRMenu_bindAction", _wrap_IVRMenu_bindAction},
+	{"freeswitchc::IVRMenu_execute", _wrap_IVRMenu_execute},
+	{"freeswitchc::new_API", _wrap_new_API},
+	{"freeswitchc::delete_API", _wrap_delete_API},
+	{"freeswitchc::API_execute", _wrap_API_execute},
+	{"freeswitchc::API_executeString", _wrap_API_executeString},
+	{"freeswitchc::input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set},
+	{"freeswitchc::input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get},
+	{"freeswitchc::input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set},
+	{"freeswitchc::input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get},
+	{"freeswitchc::input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set},
+	{"freeswitchc::input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get},
+	{"freeswitchc::input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set},
+	{"freeswitchc::input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get},
+	{"freeswitchc::new_input_callback_state_t", _wrap_new_input_callback_state_t},
+	{"freeswitchc::delete_input_callback_state_t", _wrap_delete_input_callback_state_t},
+	{"freeswitchc::new_Stream", _wrap_new_Stream},
+	{"freeswitchc::delete_Stream", _wrap_delete_Stream},
+	{"freeswitchc::Stream_write", _wrap_Stream_write},
+	{"freeswitchc::Stream_get_data", _wrap_Stream_get_data},
+	{"freeswitchc::Event_event_set", _wrap_Event_event_set},
+	{"freeswitchc::Event_event_get", _wrap_Event_event_get},
+	{"freeswitchc::Event_serialized_string_set", _wrap_Event_serialized_string_set},
+	{"freeswitchc::Event_serialized_string_get", _wrap_Event_serialized_string_get},
+	{"freeswitchc::Event_mine_set", _wrap_Event_mine_set},
+	{"freeswitchc::Event_mine_get", _wrap_Event_mine_get},
+	{"freeswitchc::new_Event", _wrap_new_Event},
+	{"freeswitchc::delete_Event", _wrap_delete_Event},
+	{"freeswitchc::Event_serialize", _wrap_Event_serialize},
+	{"freeswitchc::Event_setPriority", _wrap_Event_setPriority},
+	{"freeswitchc::Event_getHeader", _wrap_Event_getHeader},
+	{"freeswitchc::Event_getBody", _wrap_Event_getBody},
+	{"freeswitchc::Event_getType", _wrap_Event_getType},
+	{"freeswitchc::Event_addBody", _wrap_Event_addBody},
+	{"freeswitchc::Event_addHeader", _wrap_Event_addHeader},
+	{"freeswitchc::Event_delHeader", _wrap_Event_delHeader},
+	{"freeswitchc::Event_fire", _wrap_Event_fire},
+	{"freeswitchc::delete_CoreSession", _wrap_delete_CoreSession},
+	{"freeswitchc::CoreSession_session_set", _wrap_CoreSession_session_set},
+	{"freeswitchc::CoreSession_session_get", _wrap_CoreSession_session_get},
+	{"freeswitchc::CoreSession_channel_set", _wrap_CoreSession_channel_set},
+	{"freeswitchc::CoreSession_channel_get", _wrap_CoreSession_channel_get},
+	{"freeswitchc::CoreSession_flags_set", _wrap_CoreSession_flags_set},
+	{"freeswitchc::CoreSession_flags_get", _wrap_CoreSession_flags_get},
+	{"freeswitchc::CoreSession_allocated_set", _wrap_CoreSession_allocated_set},
+	{"freeswitchc::CoreSession_allocated_get", _wrap_CoreSession_allocated_get},
+	{"freeswitchc::CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set},
+	{"freeswitchc::CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get},
+	{"freeswitchc::CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set},
+	{"freeswitchc::CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get},
+	{"freeswitchc::CoreSession_answer", _wrap_CoreSession_answer},
+	{"freeswitchc::CoreSession_preAnswer", _wrap_CoreSession_preAnswer},
+	{"freeswitchc::CoreSession_hangup", _wrap_CoreSession_hangup},
+	{"freeswitchc::CoreSession_setVariable", _wrap_CoreSession_setVariable},
+	{"freeswitchc::CoreSession_setPrivate", _wrap_CoreSession_setPrivate},
+	{"freeswitchc::CoreSession_getPrivate", _wrap_CoreSession_getPrivate},
+	{"freeswitchc::CoreSession_getVariable", _wrap_CoreSession_getVariable},
+	{"freeswitchc::CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result},
+	{"freeswitchc::CoreSession_say", _wrap_CoreSession_say},
+	{"freeswitchc::CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase},
+	{"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
+	{"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
+	{"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
+	{"freeswitchc::CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
+	{"freeswitchc::CoreSession_speak", _wrap_CoreSession_speak},
+	{"freeswitchc::CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms},
+	{"freeswitchc::CoreSession_collectDigits", _wrap_CoreSession_collectDigits},
+	{"freeswitchc::CoreSession_getDigits", _wrap_CoreSession_getDigits},
+	{"freeswitchc::CoreSession_transfer", _wrap_CoreSession_transfer},
+	{"freeswitchc::CoreSession_read", _wrap_CoreSession_read},
+	{"freeswitchc::CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
+	{"freeswitchc::CoreSession_streamFile", _wrap_CoreSession_streamFile},
+	{"freeswitchc::CoreSession_flushEvents", _wrap_CoreSession_flushEvents},
+	{"freeswitchc::CoreSession_flushDigits", _wrap_CoreSession_flushDigits},
+	{"freeswitchc::CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup},
+	{"freeswitchc::CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook},
+	{"freeswitchc::CoreSession_ready", _wrap_CoreSession_ready},
+	{"freeswitchc::CoreSession_execute", _wrap_CoreSession_execute},
+	{"freeswitchc::CoreSession_sendEvent", _wrap_CoreSession_sendEvent},
+	{"freeswitchc::CoreSession_setEventData", _wrap_CoreSession_setEventData},
+	{"freeswitchc::CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR},
+	{"freeswitchc::CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
+	{"freeswitchc::CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads},
+	{"freeswitchc::CoreSession_get_uuid", _wrap_CoreSession_get_uuid},
+	{"freeswitchc::CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args},
+	{"freeswitchc::CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
+	{"freeswitchc::CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
+	{"freeswitchc::console_log", _wrap_console_log},
+	{"freeswitchc::console_clean_log", _wrap_console_clean_log},
+	{"freeswitchc::bridge", _wrap_bridge},
+	{"freeswitchc::hanguphook", _wrap_hanguphook},
+	{"freeswitchc::dtmf_callback", _wrap_dtmf_callback},
+	{"freeswitchc::new_Session", _wrap_new_Session},
+	{"freeswitchc::delete_Session", _wrap_delete_Session},
+	{"freeswitchc::Session_begin_allow_threads", _wrap_Session_begin_allow_threads},
+	{"freeswitchc::Session_end_allow_threads", _wrap_Session_end_allow_threads},
+	{"freeswitchc::Session_check_hangup_hook", _wrap_Session_check_hangup_hook},
+	{"freeswitchc::Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback},
+	{"freeswitchc::Session_setInputCallback", _wrap_Session_setInputCallback},
+	{"freeswitchc::Session_setHangupHook", _wrap_Session_setHangupHook},
+	{"freeswitchc::Session_ready", _wrap_Session_ready},
+	{"freeswitchc::Session_cb_function_set", _wrap_Session_cb_function_set},
+	{"freeswitchc::Session_cb_function_get", _wrap_Session_cb_function_get},
+	{"freeswitchc::Session_cb_arg_set", _wrap_Session_cb_arg_set},
+	{"freeswitchc::Session_cb_arg_get", _wrap_Session_cb_arg_get},
+	{"freeswitchc::Session_hangup_func_str_set", _wrap_Session_hangup_func_str_set},
+	{"freeswitchc::Session_hangup_func_str_get", _wrap_Session_hangup_func_str_get},
+	{"freeswitchc::Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set},
+	{"freeswitchc::Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get},
+	{"freeswitchc::Session_setPERL", _wrap_Session_setPERL},
+	{0, 0}
 };
+
 /* -----------------------------------------------------------------------------
  * Type initialization:
  * This problem is tough by the requirement that no dynamic 
@@ -8369,160 +8878,162 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-} /* c-mode */
+}								/* c-mode */
 #endif
 #endif
-
 #if 0
 #define SWIGRUNTIME_DEBUG
 #endif
+SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
+{
+	size_t i;
+	swig_module_info *module_head, *iter;
+	int found, init;
+
+	clientdata = clientdata;
+
+	/* check to see if the circular list has been setup, if not, set it up */
+	if (swig_module.next == 0) {
+		/* Initialize the swig_module */
+		swig_module.type_initial = swig_type_initial;
+		swig_module.cast_initial = swig_cast_initial;
+		swig_module.next = &swig_module;
+		init = 1;
+	} else {
+		init = 0;
+	}
 
+	/* Try and load any already created modules */
+	module_head = SWIG_GetModule(clientdata);
+	if (!module_head) {
+		/* This is the first module loaded for this interpreter */
+		/* so set the swig module into the interpreter */
+		SWIG_SetModule(clientdata, &swig_module);
+		module_head = &swig_module;
+	} else {
+		/* the interpreter has loaded a SWIG module, but has it loaded this one? */
+		found = 0;
+		iter = module_head;
+		do {
+			if (iter == &swig_module) {
+				found = 1;
+				break;
+			}
+			iter = iter->next;
+		} while (iter != module_head);
+
+		/* if the is found in the list, then all is done and we may leave */
+		if (found)
+			return;
+		/* otherwise we must add out module into the list */
+		swig_module.next = module_head->next;
+		module_head->next = &swig_module;
+	}
 
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
-  size_t i;
-  swig_module_info *module_head, *iter;
-  int found, init;
-  
-  clientdata = clientdata;
-  
-  /* check to see if the circular list has been setup, if not, set it up */
-  if (swig_module.next==0) {
-    /* Initialize the swig_module */
-    swig_module.type_initial = swig_type_initial;
-    swig_module.cast_initial = swig_cast_initial;
-    swig_module.next = &swig_module;
-    init = 1;
-  } else {
-    init = 0;
-  }
-  
-  /* Try and load any already created modules */
-  module_head = SWIG_GetModule(clientdata);
-  if (!module_head) {
-    /* This is the first module loaded for this interpreter */
-    /* so set the swig module into the interpreter */
-    SWIG_SetModule(clientdata, &swig_module);
-    module_head = &swig_module;
-  } else {
-    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
-    found=0;
-    iter=module_head;
-    do {
-      if (iter==&swig_module) {
-        found=1;
-        break;
-      }
-      iter=iter->next;
-    } while (iter!= module_head);
-    
-    /* if the is found in the list, then all is done and we may leave */
-    if (found) return;
-    /* otherwise we must add out module into the list */
-    swig_module.next = module_head->next;
-    module_head->next = &swig_module;
-  }
-  
-  /* When multiple interpeters are used, a module could have already been initialized in
-       a different interpreter, but not yet have a pointer in this interpreter.
-       In this case, we do not want to continue adding types... everything should be
-       set up already */
-  if (init == 0) return;
-  
-  /* Now work on filling in swig_module.types */
+	/* When multiple interpeters are used, a module could have already been initialized in
+	   a different interpreter, but not yet have a pointer in this interpreter.
+	   In this case, we do not want to continue adding types... everything should be
+	   set up already */
+	if (init == 0)
+		return;
+
+	/* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
-  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+	printf("SWIG_InitializeModule: size %d\n", swig_module.size);
 #endif
-  for (i = 0; i < swig_module.size; ++i) {
-    swig_type_info *type = 0;
-    swig_type_info *ret;
-    swig_cast_info *cast;
-    
+	for (i = 0; i < swig_module.size; ++i) {
+		swig_type_info *type = 0;
+		swig_type_info *ret;
+		swig_cast_info *cast;
+
 #ifdef SWIGRUNTIME_DEBUG
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
 #endif
-    
-    /* if there is another module already loaded */
-    if (swig_module.next != &swig_module) {
-      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
-    }
-    if (type) {
-      /* Overwrite clientdata field */
+
+		/* if there is another module already loaded */
+		if (swig_module.next != &swig_module) {
+			type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+		}
+		if (type) {
+			/* Overwrite clientdata field */
 #ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: found type %s\n", type->name);
+			printf("SWIG_InitializeModule: found type %s\n", type->name);
 #endif
-      if (swig_module.type_initial[i]->clientdata) {
-        type->clientdata = swig_module.type_initial[i]->clientdata;
+			if (swig_module.type_initial[i]->clientdata) {
+				type->clientdata = swig_module.type_initial[i]->clientdata;
 #ifdef SWIGRUNTIME_DEBUG
-        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+				printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
 #endif
-      }
-    } else {
-      type = swig_module.type_initial[i];
-    }
-    
-    /* Insert casting types */
-    cast = swig_module.cast_initial[i];
-    while (cast->type) {
-      /* Don't need to add information already in the list */
-      ret = 0;
+			}
+		} else {
+			type = swig_module.type_initial[i];
+		}
+
+		/* Insert casting types */
+		cast = swig_module.cast_initial[i];
+		while (cast->type) {
+			/* Don't need to add information already in the list */
+			ret = 0;
 #ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+			printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
 #endif
-      if (swig_module.next != &swig_module) {
-        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+			if (swig_module.next != &swig_module) {
+				ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
 #ifdef SWIGRUNTIME_DEBUG
-        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+				if (ret)
+					printf("SWIG_InitializeModule: found cast %s\n", ret->name);
 #endif
-      }
-      if (ret) {
-        if (type == swig_module.type_initial[i]) {
+			}
+			if (ret) {
+				if (type == swig_module.type_initial[i]) {
 #ifdef SWIGRUNTIME_DEBUG
-          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+					printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
 #endif
-          cast->type = ret;
-          ret = 0;
-        } else {
-          /* Check for casting already in the list */
-          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+					cast->type = ret;
+					ret = 0;
+				} else {
+					/* Check for casting already in the list */
+					swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
 #ifdef SWIGRUNTIME_DEBUG
-          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+					if (ocast)
+						printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
 #endif
-          if (!ocast) ret = 0;
-        }
-      }
-      
-      if (!ret) {
+					if (!ocast)
+						ret = 0;
+				}
+			}
+
+			if (!ret) {
 #ifdef SWIGRUNTIME_DEBUG
-        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+				printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
 #endif
-        if (type->cast) {
-          type->cast->prev = cast;
-          cast->next = type->cast;
-        }
-        type->cast = cast;
-      }
-      cast++;
-    }
-    /* Set entry in modules->types array equal to the type */
-    swig_module.types[i] = type;
-  }
-  swig_module.types[i] = 0;
-  
+				if (type->cast) {
+					type->cast->prev = cast;
+					cast->next = type->cast;
+				}
+				type->cast = cast;
+			}
+			cast++;
+		}
+		/* Set entry in modules->types array equal to the type */
+		swig_module.types[i] = type;
+	}
+	swig_module.types[i] = 0;
+
 #ifdef SWIGRUNTIME_DEBUG
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
-  for (i = 0; i < swig_module.size; ++i) {
-    int j = 0;
-    swig_cast_info *cast = swig_module.cast_initial[i];
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-    while (cast->type) {
-      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
-      cast++;
-      ++j;
-    }
-    printf("---- Total casts: %d\n",j);
-  }
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
+	printf("**** SWIG_InitializeModule: Cast List ******\n");
+	for (i = 0; i < swig_module.size; ++i) {
+		int j = 0;
+		swig_cast_info *cast = swig_module.cast_initial[i];
+		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+		while (cast->type) {
+			printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+			cast++;
+			++j;
+		}
+		printf("---- Total casts: %d\n", j);
+	}
+	printf("**** SWIG_InitializeModule: Cast List ******\n");
 #endif
 }
 
@@ -8531,33 +9042,34 @@
 * of equivalent types.  It is like calling
 * SWIG_TypeClientData(type, clientdata) a second time.
 */
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
-  size_t i;
-  swig_cast_info *equiv;
-  static int init_run = 0;
-  
-  if (init_run) return;
-  init_run = 1;
-  
-  for (i = 0; i < swig_module.size; i++) {
-    if (swig_module.types[i]->clientdata) {
-      equiv = swig_module.types[i]->cast;
-      while (equiv) {
-        if (!equiv->converter) {
-          if (equiv->type && !equiv->type->clientdata)
-          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
-        }
-        equiv = equiv->next;
-      }
-    }
-  }
+SWIGRUNTIME void SWIG_PropagateClientData(void)
+{
+	size_t i;
+	swig_cast_info *equiv;
+	static int init_run = 0;
+
+	if (init_run)
+		return;
+	init_run = 1;
+
+	for (i = 0; i < swig_module.size; i++) {
+		if (swig_module.types[i]->clientdata) {
+			equiv = swig_module.types[i]->cast;
+			while (equiv) {
+				if (!equiv->converter) {
+					if (equiv->type && !equiv->type->clientdata)
+						SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+				}
+				equiv = equiv->next;
+			}
+		}
+	}
 }
 
 #ifdef __cplusplus
 #if 0
 {
-  /* c-mode */
+	/* c-mode */
 #endif
 }
 #endif
@@ -8567,80 +9079,86 @@
 #ifdef __cplusplus
 extern "C"
 #endif
+ XS(SWIG_init)
+{
+	dXSARGS;
+	int i;
 
-XS(SWIG_init) {
-  dXSARGS;
-  int i;
-  
-  SWIG_InitializeModule(0);
-  
-  /* Install commands */
-  for (i = 0; swig_commands[i].name; i++) {
-    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
-  }
-  
-  /* Install variables */
-  for (i = 0; swig_variables[i].name; i++) {
-    SV *sv;
-    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
-    if (swig_variables[i].type) {
-      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
-    } else {
-      sv_setiv(sv,(IV) 0);
-    }
-    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
-  }
-  
-  /* Install constant */
-  for (i = 0; swig_constants[i].type; i++) {
-    SV *sv;
-    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
-    switch(swig_constants[i].type) {
-    case SWIG_INT:
-      sv_setiv(sv, (IV) swig_constants[i].lvalue);
-      break;
-    case SWIG_FLOAT:
-      sv_setnv(sv, (double) swig_constants[i].dvalue);
-      break;
-    case SWIG_STRING:
-      sv_setpv(sv, (char *) swig_constants[i].pvalue);
-      break;
-    case SWIG_POINTER:
-      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
-      break;
-    case SWIG_BINARY:
-      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
-      break;
-    default:
-      break;
-    }
-    SvREADONLY_on(sv);
-  }
-  
-  SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
-  SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
-  SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
-  /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  SWIG_TypeClientData(SWIGTYPE_p_Stream, (void*) "freeswitch::Stream");
-  SWIG_TypeClientData(SWIGTYPE_p_Event, (void*) "freeswitch::Event");
-  SWIG_TypeClientData(SWIGTYPE_p_CoreSession, (void*) "freeswitch::CoreSession");
-  SWIG_TypeClientData(SWIGTYPE_p_PERL__Session, (void*) "freeswitch::Session");
-  ST(0) = &PL_sv_yes;
-  XSRETURN(1);
+	SWIG_InitializeModule(0);
+
+	/* Install commands */
+	for (i = 0; swig_commands[i].name; i++) {
+		newXS((char *) swig_commands[i].name, swig_commands[i].wrapper, (char *) __FILE__);
+	}
+
+	/* Install variables */
+	for (i = 0; swig_variables[i].name; i++) {
+		SV *sv;
+		sv = get_sv((char *) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+		if (swig_variables[i].type) {
+			SWIG_MakePtr(sv, (void *) 1, *swig_variables[i].type, 0);
+		} else {
+			sv_setiv(sv, (IV) 0);
+		}
+		swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
+	}
+
+	/* Install constant */
+	for (i = 0; swig_constants[i].type; i++) {
+		SV *sv;
+		sv = get_sv((char *) swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+		switch (swig_constants[i].type) {
+		case SWIG_INT:
+			sv_setiv(sv, (IV) swig_constants[i].lvalue);
+			break;
+		case SWIG_FLOAT:
+			sv_setnv(sv, (double) swig_constants[i].dvalue);
+			break;
+		case SWIG_STRING:
+			sv_setpv(sv, (char *) swig_constants[i].pvalue);
+			break;
+		case SWIG_POINTER:
+			SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype), 0);
+			break;
+		case SWIG_BINARY:
+			SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+			break;
+		default:
+			break;
+		}
+		SvREADONLY_on(sv);
+	}
+
+	SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void *) "freeswitch::IVRMenu");
+	SWIG_TypeClientData(SWIGTYPE_p_API, (void *) "freeswitch::API");
+	SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void *) "freeswitch::input_callback_state_t");
+	/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@ */
+	do {
+		SV *sv = get_sv((char *) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
+		sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(S_HUP)));
+		SvREADONLY_on(sv);
+	} while (0)					/*@SWIG@ */
+	;
+	/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@ */
+	do {
+		SV *sv = get_sv((char *) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
+		sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(S_FREE)));
+		SvREADONLY_on(sv);
+	} while (0)					/*@SWIG@ */
+	;
+	/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@ */
+	do {
+		SV *sv = get_sv((char *) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
+		sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(S_RDLOCK)));
+		SvREADONLY_on(sv);
+	} while (0)					/*@SWIG@ */
+	;
+	SWIG_TypeClientData(SWIGTYPE_p_Stream, (void *) "freeswitch::Stream");
+	SWIG_TypeClientData(SWIGTYPE_p_Event, (void *) "freeswitch::Event");
+	SWIG_TypeClientData(SWIGTYPE_p_CoreSession, (void *) "freeswitch::CoreSession");
+	SWIG_TypeClientData(SWIGTYPE_p_PERL__Session, (void *) "freeswitch::Session");
+	ST(0) = &PL_sv_yes;
+	XSRETURN(1);
 }
 
 #include "mod_perl_extra.c"

Modified: freeswitch/trunk/src/mod/languages/mod_perl/perlxsi.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/perlxsi.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/perlxsi.c	Tue May 27 00:54:52 2008
@@ -1,13 +1,12 @@
 #include <EXTERN.h>
 #include <perl.h>
 
-EXTERN_C void xs_init (pTHX);
+EXTERN_C void xs_init(pTHX);
 
-EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
-EXTERN_C void boot_freeswitch (pTHX_ CV* cv);
+EXTERN_C void boot_DynaLoader(pTHX_ CV * cv);
+EXTERN_C void boot_freeswitch(pTHX_ CV * cv);
 
-EXTERN_C void
-xs_init(pTHX)
+EXTERN_C void xs_init(pTHX)
 {
 	char *file = __FILE__;
 	dXSUB_SYS;

Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp	Tue May 27 00:54:52 2008
@@ -3,336 +3,317 @@
 #define sanity_check(x) do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
 #define init_vars() do { caller_profile.source = "mod_python"; swapstate = S_SWAPPED_IN; } while(0)
 
-PySession::PySession() : CoreSession()
+PySession::PySession():CoreSession()
 {
 	init_vars();
 }
 
-PySession::PySession(char *uuid) : CoreSession(uuid)
+PySession::PySession(char *uuid):CoreSession(uuid)
 {
 	init_vars();
 }
 
-PySession::PySession(switch_core_session_t *new_session) : CoreSession(new_session)
+PySession::PySession(switch_core_session_t *new_session):CoreSession(new_session)
 {
 	init_vars();
 }
 
 
-void PySession::setDTMFCallback(PyObject *pyfunc, char *funcargs)
+void PySession::setDTMFCallback(PyObject * pyfunc, char *funcargs)
 {
-    sanity_check();
+	sanity_check();
 
-    if (!PyCallable_Check(pyfunc)) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF function is not a python function.\n");
-	return;
-    }
-    Py_XINCREF(pyfunc);  
-    CoreSession::setDTMFCallback((void *) pyfunc, funcargs);
+	if (!PyCallable_Check(pyfunc)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF function is not a python function.\n");
+		return;
+	}
+	Py_XINCREF(pyfunc);
+	CoreSession::setDTMFCallback((void *) pyfunc, funcargs);
 
 
 }
 
-void PySession::setHangupHook(PyObject *pyfunc) {
+void PySession::setHangupHook(PyObject * pyfunc)
+{
+
+	if (!PyCallable_Check(pyfunc)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
+		return;
+	}
+	// without this Py_XINCREF, there will be segfaults.  basically the python
+	// interpreter will not know that it should not GC this object.
+	// callback example: http://docs.python.org/ext/callingPython.html
+	Py_XINCREF(pyfunc);
+	CoreSession::setHangupHook((void *) pyfunc);
+
+}
+
+
+void PySession::check_hangup_hook()
+{
+	PyObject *func;
+	PyObject *result;
+	char *resultStr;
+	bool did_swap_in = false;
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+					  "check_hangup_hook has been DISABLED, please do not use hangup hooks in python code until further notice!\n");
+
+	if (!session) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
+		return;
+	}
 
-    if (!PyCallable_Check(pyfunc)) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
 	return;
-    }
 
-    // without this Py_XINCREF, there will be segfaults.  basically the python
-    // interpreter will not know that it should not GC this object.
-    // callback example: http://docs.python.org/ext/callingPython.html
-    Py_XINCREF(pyfunc);  
-    CoreSession::setHangupHook((void *) pyfunc);
+	/*! NEEDS TO BE FIXED:
+
+	   // The did_swap_in boolean was added to fix the following problem:
+	   // Design flaw - we swap in threadstate based on the assumption that thread state 
+	   // is currently _swapped out_ when this hangup hook is called.  However, nothing known to 
+	   // guarantee that, and  if thread state is already swapped in when this is invoked, 
+	   // bad things will happen.
+	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook end_allow_threads\n");
+	   did_swap_in = end_allow_threads();
+
+	   if (on_hangup == NULL) {
+	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "on_hangup is null\n");
+	   return;
+	   }
+
+	   func = (PyObject *) on_hangup;
+
+	   // TODO: to match js implementation, should pass the _python_ PySession 
+	   // object instance wrapping this C++ PySession instance. but how do we do that?
+	   // for now, pass the uuid since its better than nothing
+	   PyObject* func_arg = Py_BuildValue("(s)", uuid);
+
+	   result = PyEval_CallObject(func, func_arg);
+	   Py_XDECREF(func_arg);
+
+	   if (result) {
+	   resultStr = (char *) PyString_AsString(result);
+	   // currently just ignore the result
+	   }
+	   else {
+	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to call python hangup callback\n");
+	   PyErr_Print();
+	   PyErr_Clear();
+	   }
+
+	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook begin_allow_threads\n");
+	   if (did_swap_in) {
+	   begin_allow_threads();
+	   }
 
+	   Py_XDECREF(result);
+	 */
 }
 
+switch_status_t PySession::run_dtmf_callback(void *input, switch_input_type_t itype)
+{
+
+	PyObject *func, *arglist;
+	PyObject *pyresult;
+	PyObject *headerdict;
 
-void PySession::check_hangup_hook() {
-   PyObject *func;
-   PyObject *result;
-   char *resultStr;
-   bool did_swap_in = false;
+	char *resultStr;
+	char *funcargs;
+	switch_file_handle_t *fh = NULL;
+	bool did_swap_in = false;
 
-   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "check_hangup_hook has been DISABLED, please do not use hangup hooks in python code until further notice!\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback\n");
+
+
+	if (!cb_state.function) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	func = (PyObject *) cb_state.function;
+	if (!func) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
+		return SWITCH_STATUS_FALSE;
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state->function is NOT null\n");
+	}
+	if (!PyCallable_Check(func)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	funcargs = (char *) cb_state.funcargs;
+
+	if (itype == SWITCH_INPUT_TYPE_DTMF) {
+
+		arglist = Py_BuildValue("(sis)", input, itype, funcargs);
+	} else if (itype == SWITCH_INPUT_TYPE_EVENT) {
+		// DUNNO if this is correct in the case we have an event
+		// will be of type switch_event_t *event;
+		// http://www.freeswitch.org/docs/structswitch__event.html
+		switch_event_t *event = (switch_event_t *) input;
+		arglist = Py_BuildValue("({s:s}is)", "body", event->body, itype, funcargs);
+
+		// build a dictionary with all the headers
+
+		switch_event_header_t *hp;
+		headerdict = PyDict_New();
+		for (hp = event->headers; hp; hp = hp->next) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding event header to result");
+
+			// TODO: create PyObject pointers for name and value
+			// and explicitly decref them.  all ref counting stuff is 
+			// a mess and needs to be tested and looked at closer.
+			PyDict_SetItem(headerdict, Py_BuildValue("s", hp->name), Py_BuildValue("s", hp->value));
+
+		}
+
+		// add it to the main event dictionary (first arg in list)
+		// under key 'headers'
+		PyObject *dict = PyTuple_GetItem(arglist, 0);
+		PyDict_SetItemString(dict, "headers", headerdict);
+
+		Py_XDECREF(headerdict);
+
+
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown input type: %d\n", itype);
+		return SWITCH_STATUS_FALSE;
+	}
 
-   if (!session) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
-	return;
-   }
 
-   return;
+	if (!arglist) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error building arglist");
+		return SWITCH_STATUS_FALSE;
+	}
 
-   /*! NEEDS TO BE FIXED:
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback end_allow_threads\n");
+	did_swap_in = end_allow_threads();
+
+	pyresult = PyEval_CallObject(func, arglist);
+
+
+	Py_XDECREF(arglist);		// Trash arglist
+
+	if (pyresult && pyresult != Py_None) {
+		resultStr = (char *) PyString_AsString(pyresult);
+		switch_status_t cbresult = process_callback_result(resultStr);
+		return cbresult;
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Python callback\n returned None");
+		PyErr_Print();
+		PyErr_Clear();
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback begin_allow_threads\n");
+	if (did_swap_in) {
+		begin_allow_threads();
+	}
+
+	Py_XDECREF(pyresult);
+
+	return SWITCH_STATUS_SUCCESS;
 
-   // The did_swap_in boolean was added to fix the following problem:
-   // Design flaw - we swap in threadstate based on the assumption that thread state 
-   // is currently _swapped out_ when this hangup hook is called.  However, nothing known to 
-   // guarantee that, and  if thread state is already swapped in when this is invoked, 
-   // bad things will happen.
-   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook end_allow_threads\n");
-   did_swap_in = end_allow_threads();
- 
-   if (on_hangup == NULL) {
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "on_hangup is null\n");
-       return;
-   }
-
-   func = (PyObject *) on_hangup;
-
-   // TODO: to match js implementation, should pass the _python_ PySession 
-   // object instance wrapping this C++ PySession instance. but how do we do that?
-   // for now, pass the uuid since its better than nothing
-   PyObject* func_arg = Py_BuildValue("(s)", uuid);
-
-   result = PyEval_CallObject(func, func_arg);
-   Py_XDECREF(func_arg);
-
-   if (result) {
-       resultStr = (char *) PyString_AsString(result);
-       // currently just ignore the result
-   }
-   else {
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to call python hangup callback\n");
-       PyErr_Print();
-       PyErr_Clear();
-   }
-
-   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook begin_allow_threads\n");
-   if (did_swap_in) {
-       begin_allow_threads();
-   }
-
-   Py_XDECREF(result);
-   */
-}
-
-switch_status_t PySession::run_dtmf_callback(void *input, 
-											 switch_input_type_t itype) {
-
-   PyObject *func, *arglist;
-   PyObject *pyresult;
-   PyObject *headerdict;
-
-   char *resultStr;
-   char *funcargs;
-   switch_file_handle_t *fh = NULL;	
-   bool did_swap_in = false;
- 
-   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback\n");	
-
-
-   if (!cb_state.function) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");	
-	return SWITCH_STATUS_FALSE;
-   }
-
-   func = (PyObject *) cb_state.function;
-   if (!func) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");	
-	return SWITCH_STATUS_FALSE;
-   }
-   else {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state->function is NOT null\n");	
-   }
-   if (!PyCallable_Check(func)) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");	
-	return SWITCH_STATUS_FALSE;
-   }
-
-   funcargs = (char *) cb_state.funcargs;
-
-   if (itype == SWITCH_INPUT_TYPE_DTMF) {
-
-	 arglist = Py_BuildValue("(sis)", input, itype, funcargs);
-   }
-   else if (itype == SWITCH_INPUT_TYPE_EVENT) {
-	 // DUNNO if this is correct in the case we have an event
-	 // will be of type switch_event_t *event;
-	 // http://www.freeswitch.org/docs/structswitch__event.html
-	 switch_event_t *event = (switch_event_t *) input;
-	 arglist = Py_BuildValue("({s:s}is)",
-							 "body", event->body, 
-							 itype, 
-							 funcargs);
-
-	 // build a dictionary with all the headers
-
-	 switch_event_header_t *hp;
-	 headerdict = PyDict_New();	
-	 for (hp = event->headers; hp; hp = hp->next) {
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding event header to result");	
-	
-	   // TODO: create PyObject pointers for name and value
-	   // and explicitly decref them.  all ref counting stuff is 
-	   // a mess and needs to be tested and looked at closer.
-	   PyDict_SetItem(headerdict, 
-					  Py_BuildValue("s", hp->name),
-					  Py_BuildValue("s", hp->value));
-
-	 }
-
-	 // add it to the main event dictionary (first arg in list)
-	 // under key 'headers'
-	 PyObject *dict = PyTuple_GetItem(arglist, 0);
-	 PyDict_SetItemString(dict,
-						  "headers",
-						  headerdict);
-
-	 Py_XDECREF(headerdict);                          
-
-
-   }
-   else {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown input type: %d\n", itype);	
-	return SWITCH_STATUS_FALSE;
-   }
-
-
-   if (!arglist) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error building arglist");	
-	return SWITCH_STATUS_FALSE;
-   }
-
-   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback end_allow_threads\n");
-   did_swap_in = end_allow_threads();
-	
-   pyresult = PyEval_CallObject(func, arglist);    
-
-
-   Py_XDECREF(arglist);                           // Trash arglist
-
-   if (pyresult && pyresult != Py_None) {                       
-       resultStr = (char *) PyString_AsString(pyresult);
-       switch_status_t cbresult = process_callback_result(resultStr);
-       return cbresult;
-   }
-   else {
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Python callback\n returned None");
-       PyErr_Print();
-       PyErr_Clear();
-   }
-
-   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback begin_allow_threads\n");
-   if (did_swap_in) {
-       begin_allow_threads();
-   }
-
-   Py_XDECREF(pyresult);
-
-   return SWITCH_STATUS_SUCCESS;	
-
-}
-
-bool PySession::begin_allow_threads(void) { 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::begin_allow_threads() called\n");
-
-    if (!session) {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");	
-	return false;
-    }
-
-    // swap out threadstate and store in instance variable 
-    switch_channel_t *channel = switch_core_session_get_channel(session);
-    PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
-    // so lets assume the thread state was swapped in when the python script was started,
-    // therefore swapin_tstate will be NULL (because there is nothing to swap in, since its 
-    // _already_ swapped in.)
-    if (swapin_tstate == NULL) {
-	// currently swapped in
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-out!\n");	
-	swapin_tstate = PyEval_SaveThread();
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);	
-	// give future swapper-inners something to actually swap in
-	switch_channel_set_private(channel, "SwapInThreadState", (void *) swapin_tstate); 
-	cb_state.threadState = threadState;  // TODO: get rid of this
-	args.buf = &cb_state;     
-	ap = &args;
-	return true;
-
-    }
-    else {
-	// currently swapped out
-	return false;
-    }
-
-}
-
-bool PySession::end_allow_threads(void) { 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::end_allow_threads() called\n");
-    // swap in threadstate from instance variable saved earlier
-    if (!session) {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");	
-	return false;
-    }
-
-    switch_channel_t *channel = switch_core_session_get_channel(session);
-    PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
-    if (swapin_tstate == NULL) {
-	// currently swapped in
-	return false;
-    }
-    else {
-	// currently swapped out
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-in!\n");	
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);	
-	PyEval_RestoreThread(swapin_tstate);
-	// dont give any swapper-inners the opportunity to do a double swap
-	switch_channel_set_private(channel, "SwapInThreadState", NULL);
-	return true;
-    }
-
-
-}
-
-void PySession::hangup(char *cause) {
-
-
-    // since we INCREF'd this function pointer earlier (so the py gc didnt reclaim it)
-    // we have to DECREF it, or else the PySession dtor will never get called and
-    // a zombie channel will be left over using up resources
-    
-    if (cb_state.function != NULL) {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "xdecref on cb_state_function\n");	
-	PyObject * func = (PyObject *) cb_state.function;
-	Py_XDECREF(func);
-    }
-    else {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state.function is null\n");	
-    }
-    
-
-    CoreSession::hangup(cause);
-
-}
-
-
-PySession::~PySession() {
-    // Should we do any cleanup here?
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession started\n");
-
-    if (on_hangup) {
-	PyObject * func = (PyObject *) on_hangup;
-	Py_XDECREF(func);
-    }
-
-    
-    if (cb_state.function != NULL) {
-	PyObject * func = (PyObject *) cb_state.function;
-	Py_XDECREF(func);
-    }
-    
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession finished\n");
-    
 }
 
+bool PySession::begin_allow_threads(void)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::begin_allow_threads() called\n");
+
+	if (!session) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
+		return false;
+	}
+	// swap out threadstate and store in instance variable 
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
+	// so lets assume the thread state was swapped in when the python script was started,
+	// therefore swapin_tstate will be NULL (because there is nothing to swap in, since its 
+	// _already_ swapped in.)
+	if (swapin_tstate == NULL) {
+		// currently swapped in
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-out!\n");
+		swapin_tstate = PyEval_SaveThread();
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
+		// give future swapper-inners something to actually swap in
+		switch_channel_set_private(channel, "SwapInThreadState", (void *) swapin_tstate);
+		cb_state.threadState = threadState;	// TODO: get rid of this
+		args.buf = &cb_state;
+		ap = &args;
+		return true;
+
+	} else {
+		// currently swapped out
+		return false;
+	}
 
+}
 
+bool PySession::end_allow_threads(void)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::end_allow_threads() called\n");
+	// swap in threadstate from instance variable saved earlier
+	if (!session) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
+		return false;
+	}
+
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
+	if (swapin_tstate == NULL) {
+		// currently swapped in
+		return false;
+	} else {
+		// currently swapped out
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-in!\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
+		PyEval_RestoreThread(swapin_tstate);
+		// dont give any swapper-inners the opportunity to do a double swap
+		switch_channel_set_private(channel, "SwapInThreadState", NULL);
+		return true;
+	}
 
 
+}
 
+void PySession::hangup(char *cause)
+{
 
 
+	// since we INCREF'd this function pointer earlier (so the py gc didnt reclaim it)
+	// we have to DECREF it, or else the PySession dtor will never get called and
+	// a zombie channel will be left over using up resources
 
+	if (cb_state.function != NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "xdecref on cb_state_function\n");
+		PyObject *func = (PyObject *) cb_state.function;
+		Py_XDECREF(func);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state.function is null\n");
+	}
 
+
+	CoreSession::hangup(cause);
+
+}
+
+
+PySession::~PySession()
+{
+	// Should we do any cleanup here?
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession started\n");
+
+	if (on_hangup) {
+		PyObject *func = (PyObject *) on_hangup;
+		Py_XDECREF(func);
+	}
+
+
+	if (cb_state.function != NULL) {
+		PyObject *func = (PyObject *) cb_state.function;
+		Py_XDECREF(func);
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession finished\n");
+
+}

Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python.c	Tue May 27 00:54:52 2008
@@ -58,7 +58,7 @@
 {
 	PyThreadState *tstate = NULL;
 	char *dupargs = NULL;
-	char *argv[128] = {0};
+	char *argv[128] = { 0 };
 	int argc;
 	int lead = 0;
 	char *script = NULL;
@@ -68,16 +68,16 @@
 	PyObject *result = NULL;
 
 	if (args) {
-	    dupargs = strdup(args);
+		dupargs = strdup(args);
 	} else {
-	    return;
+		return;
 	}
 
 	assert(dupargs != NULL);
-	
+
 	if (!(argc = switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
-	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No module name specified!\n");
-	    goto done;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No module name specified!\n");
+		goto done;
 	}
 
 	script = argv[0];
@@ -87,80 +87,76 @@
 
 	tstate = PyThreadState_New(mainThreadState->interp);
 	if (!tstate) {
-	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
-	    goto done;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
+		goto done;
 	}
-
 	// swap in thread state
 	PyEval_AcquireThread(tstate);
 	if (session) {
-	    // record the fact that thread state is swapped in
-	    switch_channel_t *channel = switch_core_session_get_channel(session);
-	    switch_channel_set_private(channel, "SwapInThreadState", NULL);
+		// record the fact that thread state is swapped in
+		switch_channel_t *channel = switch_core_session_get_channel(session);
+		switch_channel_set_private(channel, "SwapInThreadState", NULL);
 	}
-	init_freeswitch(); 
+	init_freeswitch();
 
 	// import the module
-	module = PyImport_ImportModule( (char *) script);
+	module = PyImport_ImportModule((char *) script);
 	if (!module) {
-	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error importing module\n");
-	    PyErr_Print();
-	    PyErr_Clear();
-	    goto done_swap_out;
-	}	        
-
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error importing module\n");
+		PyErr_Print();
+		PyErr_Clear();
+		goto done_swap_out;
+	}
 	// reload the module
 	module = PyImport_ReloadModule(module);
 	if (!module) {
-	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reloading module\n");
-	    PyErr_Print();
-	    PyErr_Clear();
-	    goto done_swap_out;
-	}	        
-
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reloading module\n");
+		PyErr_Print();
+		PyErr_Clear();
+		goto done_swap_out;
+	}
 	// get the handler function to be called
 	function = PyObject_GetAttrString(module, "handler");
 	if (!function) {
-	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Module does not define handler(uuid)\n");
-	    PyErr_Print();
-	    PyErr_Clear();
-	    goto done_swap_out;
-	}	        
-
-	if (uuid) {
-	    // build a tuple to pass the args, the uuid of session
-	    arg = Py_BuildValue("(s)", uuid);
-	    if (!arg) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error building args\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Module does not define handler(uuid)\n");
 		PyErr_Print();
 		PyErr_Clear();
 		goto done_swap_out;
-	    }
 	}
-	else {
-	    arg = PyTuple_New(1);
-	    PyObject *nada = Py_BuildValue("");
-	    PyTuple_SetItem(arg, 0, nada);
+
+	if (uuid) {
+		// build a tuple to pass the args, the uuid of session
+		arg = Py_BuildValue("(s)", uuid);
+		if (!arg) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error building args\n");
+			PyErr_Print();
+			PyErr_Clear();
+			goto done_swap_out;
+		}
+	} else {
+		arg = PyTuple_New(1);
+		PyObject *nada = Py_BuildValue("");
+		PyTuple_SetItem(arg, 0, nada);
 	}
 
 	// invoke the handler 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call python script \n");
-	result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *)NULL);
+	result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Finished calling python script \n");
 
 	// check the result and print out any errors
 	if (!result) {
-	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n");
-	    PyErr_Print();
-	    PyErr_Clear();
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n");
+		PyErr_Print();
+		PyErr_Clear();
 	}
 
 	goto done_swap_out;
 
- done:
+  done:
 	switch_safe_free(dupargs);
 
- done_swap_out:
+  done_swap_out:
 	// decrement ref counts 
 	Py_XDECREF(module);
 	Py_XDECREF(function);
@@ -183,14 +179,12 @@
 			PyThreadState *cur_tstate = PyThreadState_Get();
 			PyThreadState_Clear(cur_tstate);
 			PyEval_ReleaseThread(cur_tstate);
-			PyThreadState_Delete(cur_tstate); 
-		}
-		else {
+			PyThreadState_Delete(cur_tstate);
+		} else {
 			// thread state is already swapped out, so, nothing for us to do
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "according to chan priv data, already swapped out \n");
 		}
-	}
-	else {
+	} else {
 		// they ran python script from cmd line, behave a bit differently (untested)
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No session: Threadstate mod_python.c swap-out! \n");
 		PyEval_ReleaseThread(tstate);
@@ -203,8 +197,8 @@
 
 SWITCH_STANDARD_APP(python_function)
 {
-	eval_some_python(switch_core_session_get_uuid(session), (char *)data, session);
-	
+	eval_some_python(switch_core_session_get_uuid(session), (char *) data, session);
+
 }
 
 struct switch_py_thread {
@@ -228,7 +222,7 @@
 SWITCH_STANDARD_API(launch_python)
 {
 	switch_thread_t *thread;
-    switch_threadattr_t *thd_attr = NULL;
+	switch_threadattr_t *thd_attr = NULL;
 	switch_memory_pool_t *pool;
 	struct switch_py_thread *pt;
 
@@ -236,7 +230,7 @@
 		stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax);
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	switch_core_new_memory_pool(&pool);
 	assert(pool != NULL);
 
@@ -245,11 +239,11 @@
 
 	pt->pool = pool;
 	pt->args = switch_core_strdup(pt->pool, cmd);
-	
-    switch_threadattr_create(&thd_attr, pt->pool);
-    switch_threadattr_detach_set(thd_attr, 1);
-    switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-    switch_thread_create(&thread, thd_attr, py_thread_run, pt, pt->pool);
+
+	switch_threadattr_create(&thd_attr, pt->pool);
+	switch_threadattr_detach_set(thd_attr, 1);
+	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+	switch_thread_create(&thread, thd_attr, py_thread_run, pt, pt->pool);
 
 	stream->write_function(stream, "OK\n");
 	return SWITCH_STATUS_SUCCESS;
@@ -290,7 +284,7 @@
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = &python_module_interface;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Python Framework Loading...\n");
-	
+
 	if (!Py_IsInitialized()) {
 
 		// initialize python system
@@ -302,13 +296,13 @@
 		// save threadstate since it's interp field will be needed
 		// to create new threadstates, and will be needed for shutdown
 		mainThreadState = PyThreadState_Get();
-	    
+
 		// swap out threadstate since the call threads will create
 		// their own and swap in their threadstate
-		PyThreadState_Swap(NULL); 
+		PyThreadState_Swap(NULL);
 
 		// release GIL
-		PyEval_ReleaseLock();	
+		PyEval_ReleaseLock();
 	}
 
 	/* indicate that the module should continue to be loaded */
@@ -319,18 +313,18 @@
   Called when the system shuts down*/
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown)
 {
-    PyInterpreterState *mainInterpreterState;
-    PyThreadState *myThreadState;
+	PyInterpreterState *mainInterpreterState;
+	PyThreadState *myThreadState;
 
-    PyEval_AcquireLock();
-    mainInterpreterState = mainThreadState->interp;
-    myThreadState = PyThreadState_New(mainInterpreterState);
-    PyThreadState_Swap(myThreadState);
-    PyEval_ReleaseLock();
-
-    Py_Finalize();
-    PyEval_ReleaseLock();
-    return SWITCH_STATUS_SUCCESS;
+	PyEval_AcquireLock();
+	mainInterpreterState = mainThreadState->interp;
+	myThreadState = PyThreadState_New(mainInterpreterState);
+	PyThreadState_Swap(myThreadState);
+	PyEval_ReleaseLock();
+
+	Py_Finalize();
+	PyEval_ReleaseLock();
+	return SWITCH_STATUS_SUCCESS;
 
 }
 

Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp	Tue May 27 00:54:52 2008
@@ -12,22 +12,35 @@
 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
 
 #ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
-    T *tt;
-public:
-    SwigValueWrapper() : tt(0) { }
-    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
-    SwigValueWrapper(const T& t) : tt(new T(t)) { }
-    ~SwigValueWrapper() { delete tt; } 
-    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
-    operator T&() const { return *tt; }
-    T *operator&() { return tt; }
-private:
-    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+template < typename T > class SwigValueWrapper {
+	T *tt;
+  public:
+  SwigValueWrapper():tt(0) {
+	}
+	SwigValueWrapper(const SwigValueWrapper < T > &rhs):tt(new T(*rhs.tt)) {
+	}
+	SwigValueWrapper(const T & t):tt(new T(t)) {
+	}
+	~SwigValueWrapper() {
+		delete tt;
+	}
+	SwigValueWrapper & operator=(const T & t) {
+		delete tt;
+		tt = new T(t);
+		return *this;
+	}
+	operator  T & () const {
+		return *tt;
+	} T *operator&() {
+		return tt;
+	}
+  private:
+	SwigValueWrapper & operator=(const SwigValueWrapper < T > &rhs);
 };
 
-template <typename T> T SwigValueInit() {
-  return T();
+template < typename T > T SwigValueInit()
+{
+	return T();
 }
 #endif
 
@@ -62,14 +75,14 @@
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
@@ -77,7 +90,7 @@
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -120,7 +133,7 @@
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -268,10 +281,10 @@
 
 
  */
-#define SWIG_OK                    (0) 
+#define SWIG_OK                    (0)
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -298,16 +311,18 @@
 #  ifndef SWIG_TypeRank
 #    define SWIG_TypeRank             unsigned long
 #  endif
-#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#  ifndef SWIG_MAXCASTRANK		/* Default cast allowed */
 #    define SWIG_MAXCASTRANK          (2)
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
-  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+SWIGINTERNINLINE int SWIG_AddCast(int r)
+{
+	return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+SWIGINTERNINLINE int SWIG_CheckState(int r)
+{
+	return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
 }
 #else /* no cast-rank mode */
 #  define SWIG_AddCast
@@ -323,38 +338,38 @@
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *, int *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
+	typedef void *(*swig_converter_func) (void *, int *);
+	typedef struct swig_type_info *(*swig_dycast_func) (void **);
 
 /* Structure to store information on one type */
-typedef struct swig_type_info {
-  const char             *name;			/* mangled name of this type */
-  const char             *str;			/* human readable name of this type */
-  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
-  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
-  void                   *clientdata;		/* language specific type data */
-  int                    owndata;		/* flag if the structure owns the clientdata */
-} swig_type_info;
+	typedef struct swig_type_info {
+		const char *name;		/* mangled name of this type */
+		const char *str;		/* human readable name of this type */
+		swig_dycast_func dcast;	/* dynamic cast function down a hierarchy */
+		struct swig_cast_info *cast;	/* linked list of types that can cast into this type */
+		void *clientdata;		/* language specific type data */
+		int owndata;			/* flag if the structure owns the clientdata */
+	} swig_type_info;
 
 /* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
-  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
-  swig_converter_func     converter;		/* function to cast the void pointers */
-  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
-  struct swig_cast_info  *prev;			/* pointer to the previous cast */
-} swig_cast_info;
+	typedef struct swig_cast_info {
+		swig_type_info *type;	/* pointer to type that is equivalent to this type */
+		swig_converter_func converter;	/* function to cast the void pointers */
+		struct swig_cast_info *next;	/* pointer to next cast in linked list */
+		struct swig_cast_info *prev;	/* pointer to the previous cast */
+	} swig_cast_info;
 
 /* Structure used to store module information
  * Each module generates one structure like this, and the runtime collects
  * all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
-  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
-  size_t                 size;		        /* Number of types in this module */
-  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
-  swig_type_info         **type_initial;	/* Array of initially generated type structures */
-  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
-  void                    *clientdata;		/* Language specific module data */
-} swig_module_info;
+	typedef struct swig_module_info {
+		swig_type_info **types;	/* Array of pointers to swig_type_info structures that are in this module */
+		size_t size;			/* Number of types in this module */
+		struct swig_module_info *next;	/* Pointer to next element in circularly linked list */
+		swig_type_info **type_initial;	/* Array of initially generated type structures */
+		swig_cast_info **cast_initial;	/* Array of initially generated casting structures */
+		void *clientdata;		/* Language specific module data */
+	} swig_module_info;
 
 /* 
   Compare two type names skipping the space characters, therefore
@@ -363,54 +378,56 @@
   Return 0 when the two name types are equivalent, as in
   strncmp, but skipping ' '.
 */
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
-		  const char *f2, const char *l2) {
-  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
-    while ((*f1 == ' ') && (f1 != l1)) ++f1;
-    while ((*f2 == ' ') && (f2 != l2)) ++f2;
-    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
-  }
-  return (int)((l1 - f1) - (l2 - f2));
-}
+	SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) {
+		for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
+			while ((*f1 == ' ') && (f1 != l1))
+				++f1;
+			while ((*f2 == ' ') && (f2 != l2))
+				++f2;
+			if (*f1 != *f2)
+				return (*f1 > *f2) ? 1 : -1;
+		} return (int) ((l1 - f1) - (l2 - f2));
+	}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if not equal, 1 if equal
 */
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
+	SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) {
+		int equiv = 0;
+		const char *te = tb + strlen(tb);
+		const char *ne = nb;
+		while (!equiv && *ne) {
+			for (nb = ne; *ne; ++ne) {
+				if (*ne == '|')
+					break;
+			}
+			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+			if (*ne)
+				++ne;
+		}
+		return equiv;
+	}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
+	SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) {
+		int equiv = 0;
+		const char *te = tb + strlen(tb);
+		const char *ne = nb;
+		while (!equiv && *ne) {
+			for (nb = ne; *ne; ++ne) {
+				if (*ne == '|')
+					break;
+			}
+			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+			if (*ne)
+				++ne;
+		}
+		return equiv;
+	}
 
 
 /* think of this as a c++ template<> or a scheme macro */
@@ -438,94 +455,89 @@
 /*
   Check the typename
 */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
+	SWIGRUNTIME swig_cast_info *SWIG_TypeCheck(const char *c, swig_type_info * ty) {
+		SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+	}
 
 /* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
-  SWIG_TypeCheck_Template(iter->type == from, into);
-}
+	SWIGRUNTIME swig_cast_info *SWIG_TypeCheckStruct(swig_type_info * from, swig_type_info * into) {
+		SWIG_TypeCheck_Template(iter->type == from, into);
+	}
 
 /*
   Cast a pointer up an inheritance hierarchy
 */
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
-}
+	SWIGRUNTIMEINLINE void *SWIG_TypeCast(swig_cast_info * ty, void *ptr, int *newmemory) {
+		return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter) (ptr, newmemory);
+	}
 
 /* 
    Dynamic pointer casting. Down an inheritance hierarchy
 */
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
-  swig_type_info *lastty = ty;
-  if (!ty || !ty->dcast) return ty;
-  while (ty && (ty->dcast)) {
-    ty = (*ty->dcast)(ptr);
-    if (ty) lastty = ty;
-  }
-  return lastty;
-}
+	SWIGRUNTIME swig_type_info *SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
+		swig_type_info *lastty = ty;
+		if (!ty || !ty->dcast)
+			return ty;
+		while (ty && (ty->dcast)) {
+			ty = (*ty->dcast) (ptr);
+			if (ty)
+				lastty = ty;
+		}
+		return lastty;
+	}
 
 /*
   Return the name associated with this type
 */
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
-  return ty->name;
-}
+	SWIGRUNTIMEINLINE const char *SWIG_TypeName(const swig_type_info * ty) {
+		return ty->name;
+	}
 
 /*
   Return the pretty name associated with this type,
   that is an unmangled type name in a form presentable to the user.
 */
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
-  /* The "str" field contains the equivalent pretty names of the
-     type, separated by vertical-bar characters.  We choose
-     to print the last name, as it is often (?) the most
-     specific. */
-  if (!type) return NULL;
-  if (type->str != NULL) {
-    const char *last_name = type->str;
-    const char *s;
-    for (s = type->str; *s; s++)
-      if (*s == '|') last_name = s+1;
-    return last_name;
-  }
-  else
-    return type->name;
-}
+	SWIGRUNTIME const char *SWIG_TypePrettyName(const swig_type_info * type) {
+		/* The "str" field contains the equivalent pretty names of the
+		   type, separated by vertical-bar characters.  We choose
+		   to print the last name, as it is often (?) the most
+		   specific. */
+		if (!type)
+			return NULL;
+		if (type->str != NULL) {
+			const char *last_name = type->str;
+			const char *s;
+			for (s = type->str; *s; s++)
+				if (*s == '|')
+					last_name = s + 1;
+			return last_name;
+		} else
+			return type->name;
+	}
 
 /* 
    Set the clientdata field for a type
 */
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
-  swig_cast_info *cast = ti->cast;
-  /* if (ti->clientdata == clientdata) return; */
-  ti->clientdata = clientdata;
-  
-  while (cast) {
-    if (!cast->converter) {
-      swig_type_info *tc = cast->type;
-      if (!tc->clientdata) {
-	SWIG_TypeClientData(tc, clientdata);
-      }
-    }    
-    cast = cast->next;
-  }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
-  SWIG_TypeClientData(ti, clientdata);
-  ti->owndata = 1;
-}
-  
+	SWIGRUNTIME void SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
+		swig_cast_info *cast = ti->cast;
+		/* if (ti->clientdata == clientdata) return; */
+		ti->clientdata = clientdata;
+
+		while (cast) {
+			if (!cast->converter) {
+				swig_type_info *tc = cast->type;
+				if (!tc->clientdata) {
+					SWIG_TypeClientData(tc, clientdata);
+				}
+			}
+			cast = cast->next;
+		}
+	}
+	SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info * ti, void *clientdata) {
+		SWIG_TypeClientData(ti, clientdata);
+		ti->owndata = 1;
+	}
+
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
@@ -534,41 +546,38 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
-		            const char *name) {
-  swig_module_info *iter = start;
-  do {
-    if (iter->size) {
-      register size_t l = 0;
-      register size_t r = iter->size - 1;
-      do {
-	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-	register size_t i = (l + r) >> 1; 
-	const char *iname = iter->types[i]->name;
-	if (iname) {
-	  register int compare = strcmp(name, iname);
-	  if (compare == 0) {	    
-	    return iter->types[i];
-	  } else if (compare < 0) {
-	    if (i) {
-	      r = i - 1;
-	    } else {
-	      break;
-	    }
-	  } else if (compare > 0) {
-	    l = i + 1;
-	  }
-	} else {
-	  break; /* should never happen */
+	SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+		swig_module_info *iter = start;
+		do {
+			if (iter->size) {
+				register size_t l = 0;
+				register size_t r = iter->size - 1;
+				do {
+					/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+					register size_t i = (l + r) >> 1;
+					const char *iname = iter->types[i]->name;
+					if (iname) {
+						register int compare = strcmp(name, iname);
+						if (compare == 0) {
+							return iter->types[i];
+						} else if (compare < 0) {
+							if (i) {
+								r = i - 1;
+							} else {
+								break;
+							}
+						} else if (compare > 0) {
+							l = i + 1;
+						}
+					} else {
+						break;	/* should never happen */
+					}
+				} while (l <= r);
+			}
+			iter = iter->next;
+		} while (iter != end);
+		return 0;
 	}
-      } while (l <= r);
-    }
-    iter = iter->next;
-  } while (iter != end);
-  return 0;
-}
 
 /*
   Search for a swig_type_info structure for either a mangled name or a human readable name.
@@ -579,148 +588,142 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
-		     const char *name) {
-  /* STEP 1: Search the name field using binary search */
-  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
-  if (ret) {
-    return ret;
-  } else {
-    /* STEP 2: If the type hasn't been found, do a complete search
-       of the str field (the human readable name) */
-    swig_module_info *iter = start;
-    do {
-      register size_t i = 0;
-      for (; i < iter->size; ++i) {
-	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
-	  return iter->types[i];
-      }
-      iter = iter->next;
-    } while (iter != end);
-  }
-  
-  /* neither found a match */
-  return 0;
-}
+	SWIGRUNTIME swig_type_info *SWIG_TypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+		/* STEP 1: Search the name field using binary search */
+		swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+		if (ret) {
+			return ret;
+		} else {
+			/* STEP 2: If the type hasn't been found, do a complete search
+			   of the str field (the human readable name) */
+			swig_module_info *iter = start;
+			do {
+				register size_t i = 0;
+				for (; i < iter->size; ++i) {
+					if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+						return iter->types[i];
+				}
+				iter = iter->next;
+			} while (iter != end);
+		}
+
+		/* neither found a match */
+		return 0;
+	}
 
 /* 
    Pack binary data into a string
 */
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
-  static const char hex[17] = "0123456789abcdef";
-  register const unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu =  u + sz;
-  for (; u != eu; ++u) {
-    register unsigned char uu = *u;
-    *(c++) = hex[(uu & 0xf0) >> 4];
-    *(c++) = hex[uu & 0xf];
-  }
-  return c;
-}
+	SWIGRUNTIME char *SWIG_PackData(char *c, void *ptr, size_t sz) {
+		static const char hex[17] = "0123456789abcdef";
+		register const unsigned char *u = (unsigned char *) ptr;
+		register const unsigned char *eu = u + sz;
+		for (; u != eu; ++u) {
+			register unsigned char uu = *u;
+			*(c++) = hex[(uu & 0xf0) >> 4];
+			*(c++) = hex[uu & 0xf];
+		}
+		return c;
+	}
 
 /* 
    Unpack binary data from a string
 */
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
-  register unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu = u + sz;
-  for (; u != eu; ++u) {
-    register char d = *(c++);
-    register unsigned char uu;
-    if ((d >= '0') && (d <= '9'))
-      uu = ((d - '0') << 4);
-    else if ((d >= 'a') && (d <= 'f'))
-      uu = ((d - ('a'-10)) << 4);
-    else 
-      return (char *) 0;
-    d = *(c++);
-    if ((d >= '0') && (d <= '9'))
-      uu |= (d - '0');
-    else if ((d >= 'a') && (d <= 'f'))
-      uu |= (d - ('a'-10));
-    else 
-      return (char *) 0;
-    *u = uu;
-  }
-  return c;
-}
+	SWIGRUNTIME const char *SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+		register unsigned char *u = (unsigned char *) ptr;
+		register const unsigned char *eu = u + sz;
+		for (; u != eu; ++u) {
+			register char d = *(c++);
+			register unsigned char uu;
+			if ((d >= '0') && (d <= '9'))
+				uu = ((d - '0') << 4);
+			else if ((d >= 'a') && (d <= 'f'))
+				uu = ((d - ('a' - 10)) << 4);
+			else
+				return (char *) 0;
+			d = *(c++);
+			if ((d >= '0') && (d <= '9'))
+				uu |= (d - '0');
+			else if ((d >= 'a') && (d <= 'f'))
+				uu |= (d - ('a' - 10));
+			else
+				return (char *) 0;
+			*u = uu;
+		}
+		return c;
+	}
 
 /* 
    Pack 'void *' into a string buffer.
 */
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
-  char *r = buff;
-  if ((2*sizeof(void *) + 2) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,&ptr,sizeof(void *));
-  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
-  strcpy(r,name);
-  return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      *ptr = (void *) 0;
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
+	SWIGRUNTIME char *SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+		char *r = buff;
+		if ((2 * sizeof(void *) + 2) > bsz)
+			return 0;
+		*(r++) = '_';
+		r = SWIG_PackData(r, &ptr, sizeof(void *));
+		if (strlen(name) + 1 > (bsz - (r - buff)))
+			return 0;
+		strcpy(r, name);
+		return buff;
+	}
 
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
-  char *r = buff;
-  size_t lname = (name ? strlen(name) : 0);
-  if ((2*sz + 2 + lname) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,ptr,sz);
-  if (lname) {
-    strncpy(r,name,lname+1);
-  } else {
-    *r = 0;
-  }
-  return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      memset(ptr,0,sz);
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sz);
-}
+	SWIGRUNTIME const char *SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+		if (*c != '_') {
+			if (strcmp(c, "NULL") == 0) {
+				*ptr = (void *) 0;
+				return name;
+			} else {
+				return 0;
+			}
+		}
+		return SWIG_UnpackData(++c, ptr, sizeof(void *));
+	}
+
+	SWIGRUNTIME char *SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+		char *r = buff;
+		size_t lname = (name ? strlen(name) : 0);
+		if ((2 * sz + 2 + lname) > bsz)
+			return 0;
+		*(r++) = '_';
+		r = SWIG_PackData(r, ptr, sz);
+		if (lname) {
+			strncpy(r, name, lname + 1);
+		} else {
+			*r = 0;
+		}
+		return buff;
+	}
+
+	SWIGRUNTIME const char *SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+		if (*c != '_') {
+			if (strcmp(c, "NULL") == 0) {
+				memset(ptr, 0, sz);
+				return name;
+			} else {
+				return 0;
+			}
+		}
+		return SWIG_UnpackData(++c, ptr, sz);
+	}
 
 #ifdef __cplusplus
 }
 #endif
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
@@ -742,15 +745,15 @@
 # define SWIG_PYBUFFER_SIZE 1024
 #endif
 
-static PyObject *
-PyString_FromFormat(const char *fmt, ...) {
-  va_list ap;
-  char buf[SWIG_PYBUFFER_SIZE * 2];
-  int res;
-  va_start(ap, fmt);
-  res = vsnprintf(buf, sizeof(buf), fmt, ap);
-  va_end(ap);
-  return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
+static PyObject *PyString_FromFormat(const char *fmt, ...)
+{
+	va_list ap;
+	char buf[SWIG_PYBUFFER_SIZE * 2];
+	int res;
+	va_start(ap, fmt);
+	res = vsnprintf(buf, sizeof(buf), fmt, ap);
+	va_end(ap);
+	return (res < 0 || res >= (int) sizeof(buf)) ? 0 : PyString_FromString(buf);
 }
 #endif
 
@@ -799,9 +802,9 @@
 static
 PyObject *PyBool_FromLong(long ok)
 {
-  PyObject *result = ok ? Py_True : Py_False;
-  Py_INCREF(result);
-  return result;
+	PyObject *result = ok ? Py_True : Py_False;
+	Py_INCREF(result);
+	return result;
 }
 #endif
 
@@ -818,68 +821,68 @@
  * error manipulation
  * ----------------------------------------------------------------------------- */
 
-SWIGRUNTIME PyObject*
-SWIG_Python_ErrorType(int code) {
-  PyObject* type = 0;
-  switch(code) {
-  case SWIG_MemoryError:
-    type = PyExc_MemoryError;
-    break;
-  case SWIG_IOError:
-    type = PyExc_IOError;
-    break;
-  case SWIG_RuntimeError:
-    type = PyExc_RuntimeError;
-    break;
-  case SWIG_IndexError:
-    type = PyExc_IndexError;
-    break;
-  case SWIG_TypeError:
-    type = PyExc_TypeError;
-    break;
-  case SWIG_DivisionByZero:
-    type = PyExc_ZeroDivisionError;
-    break;
-  case SWIG_OverflowError:
-    type = PyExc_OverflowError;
-    break;
-  case SWIG_SyntaxError:
-    type = PyExc_SyntaxError;
-    break;
-  case SWIG_ValueError:
-    type = PyExc_ValueError;
-    break;
-  case SWIG_SystemError:
-    type = PyExc_SystemError;
-    break;
-  case SWIG_AttributeError:
-    type = PyExc_AttributeError;
-    break;
-  default:
-    type = PyExc_RuntimeError;
-  }
-  return type;
+SWIGRUNTIME PyObject *SWIG_Python_ErrorType(int code)
+{
+	PyObject *type = 0;
+	switch (code) {
+	case SWIG_MemoryError:
+		type = PyExc_MemoryError;
+		break;
+	case SWIG_IOError:
+		type = PyExc_IOError;
+		break;
+	case SWIG_RuntimeError:
+		type = PyExc_RuntimeError;
+		break;
+	case SWIG_IndexError:
+		type = PyExc_IndexError;
+		break;
+	case SWIG_TypeError:
+		type = PyExc_TypeError;
+		break;
+	case SWIG_DivisionByZero:
+		type = PyExc_ZeroDivisionError;
+		break;
+	case SWIG_OverflowError:
+		type = PyExc_OverflowError;
+		break;
+	case SWIG_SyntaxError:
+		type = PyExc_SyntaxError;
+		break;
+	case SWIG_ValueError:
+		type = PyExc_ValueError;
+		break;
+	case SWIG_SystemError:
+		type = PyExc_SystemError;
+		break;
+	case SWIG_AttributeError:
+		type = PyExc_AttributeError;
+		break;
+	default:
+		type = PyExc_RuntimeError;
+	}
+	return type;
 }
 
 
-SWIGRUNTIME void
-SWIG_Python_AddErrorMsg(const char* mesg)
-{
-  PyObject *type = 0;
-  PyObject *value = 0;
-  PyObject *traceback = 0;
-
-  if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
-  if (value) {
-    PyObject *old_str = PyObject_Str(value);
-    PyErr_Clear();
-    Py_XINCREF(type);
-    PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
-    Py_DECREF(old_str);
-    Py_DECREF(value);
-  } else {
-    PyErr_SetString(PyExc_RuntimeError, mesg);
-  }
+SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char *mesg)
+{
+	PyObject *type = 0;
+	PyObject *value = 0;
+	PyObject *traceback = 0;
+
+	if (PyErr_Occurred())
+		PyErr_Fetch(&type, &value, &traceback);
+	if (value) {
+		PyObject *old_str = PyObject_Str(value);
+		PyErr_Clear();
+		Py_XINCREF(type);
+		PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+		Py_DECREF(old_str);
+		Py_DECREF(value);
+	} else {
+		PyErr_SetString(PyExc_RuntimeError, mesg);
+	}
 }
 
 
@@ -889,33 +892,48 @@
 #    undef SWIG_PYTHON_THREADS
 #  endif
 #endif
-#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
+#if defined(SWIG_PYTHON_THREADS)	/* Threading support is enabled */
 #  if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
-#    if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
+#    if (PY_VERSION_HEX >= 0x02030000)	/* For 2.3 or later, use the PyGILState calls */
 #      define SWIG_PYTHON_USE_GIL
 #    endif
 #  endif
-#  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
+#  if defined(SWIG_PYTHON_USE_GIL)	/* Use PyGILState threads calls */
 #    ifndef SWIG_PYTHON_INITIALIZE_THREADS
-#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads() 
+#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads()
 #    endif
-#    ifdef __cplusplus /* C++ code */
-       class SWIG_Python_Thread_Block {
-         bool status;
-         PyGILState_STATE state;
-       public:
-         void end() { if (status) { PyGILState_Release(state); status = false;} }
-         SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
-         ~SWIG_Python_Thread_Block() { end(); }
-       };
-       class SWIG_Python_Thread_Allow {
-         bool status;
-         PyThreadState *save;
-       public:
-         void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
-         SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
-         ~SWIG_Python_Thread_Allow() { end(); }
-       };
+#    ifdef __cplusplus			/* C++ code */
+class SWIG_Python_Thread_Block {
+	bool status;
+	PyGILState_STATE state;
+  public:
+	void end() {
+		if (status) {
+			PyGILState_Release(state);
+			status = false;
+		}
+	} SWIG_Python_Thread_Block():status(true), state(PyGILState_Ensure()) {
+	}
+	~SWIG_Python_Thread_Block() {
+		end();
+	}
+};
+class SWIG_Python_Thread_Allow {
+	bool status;
+	PyThreadState *save;
+  public:
+	void end() {
+		if (status) {
+			PyEval_RestoreThread(save);
+			status = false;
+		}
+	} SWIG_Python_Thread_Allow():status(true), save(PyEval_SaveThread()) {
+	}
+	~SWIG_Python_Thread_Allow() {
+		end();
+	}
+};
+
 #      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   SWIG_Python_Thread_Block _swig_thread_block
 #      define SWIG_PYTHON_THREAD_END_BLOCK     _swig_thread_block.end()
 #      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   SWIG_Python_Thread_Allow _swig_thread_allow
@@ -926,7 +944,7 @@
 #      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   PyThreadState *_swig_thread_allow = PyEval_SaveThread()
 #      define SWIG_PYTHON_THREAD_END_ALLOW     PyEval_RestoreThread(_swig_thread_allow)
 #    endif
-#  else /* Old thread way, not implemented, user must provide it */
+#  else	/* Old thread way, not implemented, user must provide it */
 #    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
 #      define SWIG_PYTHON_INITIALIZE_THREADS
 #    endif
@@ -958,31 +976,26 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-} /* cc-mode */
+}								/* cc-mode */
 #endif
 #endif
-
 /* -----------------------------------------------------------------------------
  * Constant declarations
- * ----------------------------------------------------------------------------- */
-
-/* Constant Types */
+ * ----------------------------------------------------------------------------- *//* Constant Types */
 #define SWIG_PY_POINTER 4
 #define SWIG_PY_BINARY  5
-
-/* Constant information structure */
-typedef struct swig_const_info {
-  int type;
-  char *name;
-  long lvalue;
-  double dvalue;
-  void   *pvalue;
-  swig_type_info **ptype;
+/* Constant information structure */ typedef struct swig_const_info {
+	int type;
+	char *name;
+	long lvalue;
+	double dvalue;
+	void *pvalue;
+	swig_type_info **ptype;
 } swig_const_info;
 
 #ifdef __cplusplus
 #if 0
-{ /* cc-mode */
+{								/* cc-mode */
 #endif
 }
 #endif
@@ -1007,7 +1020,7 @@
 #define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
 #define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(ptr, type, flags)
-#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty) 
+#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty)
 #define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
 #define swig_owntype                                    int
 
@@ -1034,125 +1047,121 @@
 #define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
 #define SWIG_NewClientData(obj)                         PySwigClientData_New(obj)
 
-#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
-#define SWIG_SetErrorMsg                        	SWIG_Python_SetErrorMsg				   
-#define SWIG_ErrorType(code)                    	SWIG_Python_ErrorType(code)                        
-#define SWIG_Error(code, msg)            		SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
-#define SWIG_fail                        		goto fail					   
+#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj
+#define SWIG_SetErrorMsg                        	SWIG_Python_SetErrorMsg
+#define SWIG_ErrorType(code)                    	SWIG_Python_ErrorType(code)
+#define SWIG_Error(code, msg)            		SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail
 
 
 /* Runtime API implementation */
 
 /* Error manipulation */
 
-SWIGINTERN void 
-SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
-  SWIG_PYTHON_THREAD_BEGIN_BLOCK; 
-  PyErr_SetObject(errtype, obj);
-  Py_DECREF(obj);
-  SWIG_PYTHON_THREAD_END_BLOCK;
+SWIGINTERN void SWIG_Python_SetErrorObj(PyObject * errtype, PyObject * obj)
+{
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+	PyErr_SetObject(errtype, obj);
+	Py_DECREF(obj);
+	SWIG_PYTHON_THREAD_END_BLOCK;
 }
 
-SWIGINTERN void 
-SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
-  SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-  PyErr_SetString(errtype, (char *) msg);
-  SWIG_PYTHON_THREAD_END_BLOCK;
+SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject * errtype, const char *msg)
+{
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+	PyErr_SetString(errtype, (char *) msg);
+	SWIG_PYTHON_THREAD_END_BLOCK;
 }
 
 #define SWIG_Python_Raise(obj, type, desc)  SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
 
 /* Set a constant value */
 
-SWIGINTERN void
-SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
-  PyDict_SetItemString(d, (char*) name, obj);
-  Py_DECREF(obj);                            
+SWIGINTERN void SWIG_Python_SetConstant(PyObject * d, const char *name, PyObject * obj)
+{
+	PyDict_SetItemString(d, (char *) name, obj);
+	Py_DECREF(obj);
 }
 
 /* Append a value to the result obj */
 
-SWIGINTERN PyObject*
-SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
+SWIGINTERN PyObject *SWIG_Python_AppendOutput(PyObject * result, PyObject * obj)
+{
 #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
-  if (!result) {
-    result = obj;
-  } else if (result == Py_None) {
-    Py_DECREF(result);
-    result = obj;
-  } else {
-    if (!PyList_Check(result)) {
-      PyObject *o2 = result;
-      result = PyList_New(1);
-      PyList_SetItem(result, 0, o2);
-    }
-    PyList_Append(result,obj);
-    Py_DECREF(obj);
-  }
-  return result;
+	if (!result) {
+		result = obj;
+	} else if (result == Py_None) {
+		Py_DECREF(result);
+		result = obj;
+	} else {
+		if (!PyList_Check(result)) {
+			PyObject *o2 = result;
+			result = PyList_New(1);
+			PyList_SetItem(result, 0, o2);
+		}
+		PyList_Append(result, obj);
+		Py_DECREF(obj);
+	}
+	return result;
 #else
-  PyObject*   o2;
-  PyObject*   o3;
-  if (!result) {
-    result = obj;
-  } else if (result == Py_None) {
-    Py_DECREF(result);
-    result = obj;
-  } else {
-    if (!PyTuple_Check(result)) {
-      o2 = result;
-      result = PyTuple_New(1);
-      PyTuple_SET_ITEM(result, 0, o2);
-    }
-    o3 = PyTuple_New(1);
-    PyTuple_SET_ITEM(o3, 0, obj);
-    o2 = result;
-    result = PySequence_Concat(o2, o3);
-    Py_DECREF(o2);
-    Py_DECREF(o3);
-  }
-  return result;
+	PyObject *o2;
+	PyObject *o3;
+	if (!result) {
+		result = obj;
+	} else if (result == Py_None) {
+		Py_DECREF(result);
+		result = obj;
+	} else {
+		if (!PyTuple_Check(result)) {
+			o2 = result;
+			result = PyTuple_New(1);
+			PyTuple_SET_ITEM(result, 0, o2);
+		}
+		o3 = PyTuple_New(1);
+		PyTuple_SET_ITEM(o3, 0, obj);
+		o2 = result;
+		result = PySequence_Concat(o2, o3);
+		Py_DECREF(o2);
+		Py_DECREF(o3);
+	}
+	return result;
 #endif
 }
 
 /* Unpack the argument tuple */
 
-SWIGINTERN int
-SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
+SWIGINTERN int SWIG_Python_UnpackTuple(PyObject * args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject ** objs)
 {
-  if (!args) {
-    if (!min && !max) {
-      return 1;
-    } else {
-      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
-		   name, (min == max ? "" : "at least "), (int)min);
-      return 0;
-    }
-  }  
-  if (!PyTuple_Check(args)) {
-    PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
-    return 0;
-  } else {
-    register Py_ssize_t l = PyTuple_GET_SIZE(args);
-    if (l < min) {
-      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
-		   name, (min == max ? "" : "at least "), (int)min, (int)l);
-      return 0;
-    } else if (l > max) {
-      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
-		   name, (min == max ? "" : "at most "), (int)max, (int)l);
-      return 0;
-    } else {
-      register int i;
-      for (i = 0; i < l; ++i) {
-	objs[i] = PyTuple_GET_ITEM(args, i);
-      }
-      for (; l < max; ++l) {
-	objs[l] = 0;
-      }
-      return i + 1;
-    }    
-  }
+	if (!args) {
+		if (!min && !max) {
+			return 1;
+		} else {
+			PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int) min);
+			return 0;
+		}
+	}
+	if (!PyTuple_Check(args)) {
+		PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
+		return 0;
+	} else {
+		register Py_ssize_t l = PyTuple_GET_SIZE(args);
+		if (l < min) {
+			PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int) min, (int) l);
+			return 0;
+		} else if (l > max) {
+			PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int) max, (int) l);
+			return 0;
+		} else {
+			register int i;
+			for (i = 0; i < l; ++i) {
+				objs[i] = PyTuple_GET_ITEM(args, i);
+			}
+			for (; l < max; ++l) {
+				objs[l] = 0;
+			}
+			return i + 1;
+		}
+	}
 }
 
 /* A functor is a function object with one single object argument */
@@ -1185,10 +1194,9 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-} /* cc-mode */
+}								/* cc-mode */
 #endif
 #endif
-
 /*  How to access Py_None */
 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 #  ifndef SWIG_PYTHON_NO_BUILD_NONE
@@ -1197,520 +1205,494 @@
 #    endif
 #  endif
 #endif
-
 #ifdef SWIG_PYTHON_BUILD_NONE
 #  ifdef Py_None
 #   undef Py_None
 #   define Py_None SWIG_Py_None()
 #  endif
-SWIGRUNTIMEINLINE PyObject * 
-_SWIG_Py_None(void)
+SWIGRUNTIMEINLINE PyObject *_SWIG_Py_None(void)
 {
-  PyObject *none = Py_BuildValue((char*)"");
-  Py_DECREF(none);
-  return none;
+	PyObject *none = Py_BuildValue((char *) "");
+	Py_DECREF(none);
+	return none;
 }
-SWIGRUNTIME PyObject * 
-SWIG_Py_None(void)
+SWIGRUNTIME PyObject *SWIG_Py_None(void)
 {
-  static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
-  return none;
+	static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
+	return none;
 }
 #endif
 
 /* The python void return value */
 
-SWIGRUNTIMEINLINE PyObject * 
-SWIG_Py_Void(void)
+SWIGRUNTIMEINLINE PyObject *SWIG_Py_Void(void)
 {
-  PyObject *none = Py_None;
-  Py_INCREF(none);
-  return none;
+	PyObject *none = Py_None;
+	Py_INCREF(none);
+	return none;
 }
 
 /* PySwigClientData */
 
 typedef struct {
-  PyObject *klass;
-  PyObject *newraw;
-  PyObject *newargs;
-  PyObject *destroy;
-  int delargs;
-  int implicitconv;
+	PyObject *klass;
+	PyObject *newraw;
+	PyObject *newargs;
+	PyObject *destroy;
+	int delargs;
+	int implicitconv;
 } PySwigClientData;
 
-SWIGRUNTIMEINLINE int 
-SWIG_Python_CheckImplicit(swig_type_info *ty)
+SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info * ty)
 {
-  PySwigClientData *data = (PySwigClientData *)ty->clientdata;
-  return data ? data->implicitconv : 0;
+	PySwigClientData *data = (PySwigClientData *) ty->clientdata;
+	return data ? data->implicitconv : 0;
 }
 
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Python_ExceptionType(swig_type_info *desc) {
-  PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
-  PyObject *klass = data ? data->klass : 0;
-  return (klass ? klass : PyExc_RuntimeError);
+SWIGRUNTIMEINLINE PyObject *SWIG_Python_ExceptionType(swig_type_info * desc)
+{
+	PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
+	PyObject *klass = data ? data->klass : 0;
+	return (klass ? klass : PyExc_RuntimeError);
 }
 
 
-SWIGRUNTIME PySwigClientData * 
-PySwigClientData_New(PyObject* obj)
-{
-  if (!obj) {
-    return 0;
-  } else {
-    PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
-    /* the klass element */
-    data->klass = obj;
-    Py_INCREF(data->klass);
-    /* the newraw method and newargs arguments used to create a new raw instance */
-    if (PyClass_Check(obj)) {
-      data->newraw = 0;
-      data->newargs = obj;
-      Py_INCREF(obj);
-    } else {
+SWIGRUNTIME PySwigClientData *PySwigClientData_New(PyObject * obj)
+{
+	if (!obj) {
+		return 0;
+	} else {
+		PySwigClientData *data = (PySwigClientData *) malloc(sizeof(PySwigClientData));
+		/* the klass element */
+		data->klass = obj;
+		Py_INCREF(data->klass);
+		/* the newraw method and newargs arguments used to create a new raw instance */
+		if (PyClass_Check(obj)) {
+			data->newraw = 0;
+			data->newargs = obj;
+			Py_INCREF(obj);
+		} else {
 #if (PY_VERSION_HEX < 0x02020000)
-      data->newraw = 0;
+			data->newraw = 0;
 #else
-      data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
+			data->newraw = PyObject_GetAttrString(data->klass, (char *) "__new__");
 #endif
-      if (data->newraw) {
-	Py_INCREF(data->newraw);
-	data->newargs = PyTuple_New(1);
-	PyTuple_SetItem(data->newargs, 0, obj);
-      } else {
-	data->newargs = obj;
-      }
-      Py_INCREF(data->newargs);
-    }
-    /* the destroy method, aka as the C++ delete method */
-    data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
-    if (PyErr_Occurred()) {
-      PyErr_Clear();
-      data->destroy = 0;
-    }
-    if (data->destroy) {
-      int flags;
-      Py_INCREF(data->destroy);
-      flags = PyCFunction_GET_FLAGS(data->destroy);
+			if (data->newraw) {
+				Py_INCREF(data->newraw);
+				data->newargs = PyTuple_New(1);
+				PyTuple_SetItem(data->newargs, 0, obj);
+			} else {
+				data->newargs = obj;
+			}
+			Py_INCREF(data->newargs);
+		}
+		/* the destroy method, aka as the C++ delete method */
+		data->destroy = PyObject_GetAttrString(data->klass, (char *) "__swig_destroy__");
+		if (PyErr_Occurred()) {
+			PyErr_Clear();
+			data->destroy = 0;
+		}
+		if (data->destroy) {
+			int flags;
+			Py_INCREF(data->destroy);
+			flags = PyCFunction_GET_FLAGS(data->destroy);
 #ifdef METH_O
-      data->delargs = !(flags & (METH_O));
+			data->delargs = !(flags & (METH_O));
 #else
-      data->delargs = 0;
+			data->delargs = 0;
 #endif
-    } else {
-      data->delargs = 0;
-    }
-    data->implicitconv = 0;
-    return data;
-  }
+		} else {
+			data->delargs = 0;
+		}
+		data->implicitconv = 0;
+		return data;
+	}
 }
 
-SWIGRUNTIME void 
-PySwigClientData_Del(PySwigClientData* data)
+SWIGRUNTIME void PySwigClientData_Del(PySwigClientData * data)
 {
-  Py_XDECREF(data->newraw);
-  Py_XDECREF(data->newargs);
-  Py_XDECREF(data->destroy);
+	Py_XDECREF(data->newraw);
+	Py_XDECREF(data->newargs);
+	Py_XDECREF(data->destroy);
 }
 
 /* =============== PySwigObject =====================*/
 
 typedef struct {
-  PyObject_HEAD
-  void *ptr;
-  swig_type_info *ty;
-  int own;
-  PyObject *next;
+	PyObject_HEAD void *ptr;
+	swig_type_info *ty;
+	int own;
+	PyObject *next;
 } PySwigObject;
 
-SWIGRUNTIME PyObject *
-PySwigObject_long(PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_long(PySwigObject * v)
 {
-  return PyLong_FromVoidPtr(v->ptr);
+	return PyLong_FromVoidPtr(v->ptr);
 }
 
-SWIGRUNTIME PyObject *
-PySwigObject_format(const char* fmt, PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_format(const char *fmt, PySwigObject * v)
 {
-  PyObject *res = NULL;
-  PyObject *args = PyTuple_New(1);
-  if (args) {
-    if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
-      PyObject *ofmt = PyString_FromString(fmt);
-      if (ofmt) {
-	res = PyString_Format(ofmt,args);
-	Py_DECREF(ofmt);
-      }
-      Py_DECREF(args);
-    }
-  }
-  return res;
+	PyObject *res = NULL;
+	PyObject *args = PyTuple_New(1);
+	if (args) {
+		if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
+			PyObject *ofmt = PyString_FromString(fmt);
+			if (ofmt) {
+				res = PyString_Format(ofmt, args);
+				Py_DECREF(ofmt);
+			}
+			Py_DECREF(args);
+		}
+	}
+	return res;
 }
 
-SWIGRUNTIME PyObject *
-PySwigObject_oct(PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_oct(PySwigObject * v)
 {
-  return PySwigObject_format("%o",v);
+	return PySwigObject_format("%o", v);
 }
 
-SWIGRUNTIME PyObject *
-PySwigObject_hex(PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_hex(PySwigObject * v)
 {
-  return PySwigObject_format("%x",v);
+	return PySwigObject_format("%x", v);
 }
 
 SWIGRUNTIME PyObject *
 #ifdef METH_NOARGS
-PySwigObject_repr(PySwigObject *v)
+PySwigObject_repr(PySwigObject * v)
 #else
-PySwigObject_repr(PySwigObject *v, PyObject *args)
+PySwigObject_repr(PySwigObject * v, PyObject * args)
 #endif
 {
-  const char *name = SWIG_TypePrettyName(v->ty);
-  PyObject *hex = PySwigObject_hex(v);    
-  PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
-  Py_DECREF(hex);
-  if (v->next) {
+	const char *name = SWIG_TypePrettyName(v->ty);
+	PyObject *hex = PySwigObject_hex(v);
+	PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
+	Py_DECREF(hex);
+	if (v->next) {
 #ifdef METH_NOARGS
-    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
+		PyObject *nrep = PySwigObject_repr((PySwigObject *) v->next);
 #else
-    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
+		PyObject *nrep = PySwigObject_repr((PySwigObject *) v->next, args);
 #endif
-    PyString_ConcatAndDel(&repr,nrep);
-  }
-  return repr;  
+		PyString_ConcatAndDel(&repr, nrep);
+	}
+	return repr;
 }
 
-SWIGRUNTIME int
-PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+SWIGRUNTIME int PySwigObject_print(PySwigObject * v, FILE * fp, int SWIGUNUSEDPARM(flags))
 {
 #ifdef METH_NOARGS
-  PyObject *repr = PySwigObject_repr(v);
+	PyObject *repr = PySwigObject_repr(v);
 #else
-  PyObject *repr = PySwigObject_repr(v, NULL);
+	PyObject *repr = PySwigObject_repr(v, NULL);
 #endif
-  if (repr) {
-    fputs(PyString_AsString(repr), fp);
-    Py_DECREF(repr);
-    return 0; 
-  } else {
-    return 1; 
-  }
+	if (repr) {
+		fputs(PyString_AsString(repr), fp);
+		Py_DECREF(repr);
+		return 0;
+	} else {
+		return 1;
+	}
 }
 
-SWIGRUNTIME PyObject *
-PySwigObject_str(PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_str(PySwigObject * v)
 {
-  char result[SWIG_BUFFER_SIZE];
-  return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
-    PyString_FromString(result) : 0;
+	char result[SWIG_BUFFER_SIZE];
+	return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? PyString_FromString(result) : 0;
 }
 
-SWIGRUNTIME int
-PySwigObject_compare(PySwigObject *v, PySwigObject *w)
+SWIGRUNTIME int PySwigObject_compare(PySwigObject * v, PySwigObject * w)
 {
-  void *i = v->ptr;
-  void *j = w->ptr;
-  return (i < j) ? -1 : ((i > j) ? 1 : 0);
+	void *i = v->ptr;
+	void *j = w->ptr;
+	return (i < j) ? -1 : ((i > j) ? 1 : 0);
 }
 
-SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
+SWIGRUNTIME PyTypeObject *_PySwigObject_type(void);
 
-SWIGRUNTIME PyTypeObject*
-PySwigObject_type(void) {
-  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
-  return type;
+SWIGRUNTIME PyTypeObject *PySwigObject_type(void)
+{
+	static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
+	return type;
 }
 
-SWIGRUNTIMEINLINE int
-PySwigObject_Check(PyObject *op) {
-  return ((op)->ob_type == PySwigObject_type())
-    || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
+SWIGRUNTIMEINLINE int PySwigObject_Check(PyObject * op)
+{
+	return ((op)->ob_type == PySwigObject_type())
+		|| (strcmp((op)->ob_type->tp_name, "PySwigObject") == 0);
 }
 
-SWIGRUNTIME PyObject *
-PySwigObject_New(void *ptr, swig_type_info *ty, int own);
+SWIGRUNTIME PyObject *PySwigObject_New(void *ptr, swig_type_info * ty, int own);
 
-SWIGRUNTIME void
-PySwigObject_dealloc(PyObject *v)
+SWIGRUNTIME void PySwigObject_dealloc(PyObject * v)
 {
-  PySwigObject *sobj = (PySwigObject *) v;
-  PyObject *next = sobj->next;
-  if (sobj->own == SWIG_POINTER_OWN) {
-    swig_type_info *ty = sobj->ty;
-    PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
-    PyObject *destroy = data ? data->destroy : 0;
-    if (destroy) {
-      /* destroy is always a VARARGS method */
-      PyObject *res;
-      if (data->delargs) {
-	/* we need to create a temporal object to carry the destroy operation */
-	PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
-	res = SWIG_Python_CallFunctor(destroy, tmp);
-	Py_DECREF(tmp);
-      } else {
-	PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
-	PyObject *mself = PyCFunction_GET_SELF(destroy);
-	res = ((*meth)(mself, v));
-      }
-      Py_XDECREF(res);
-    } 
+	PySwigObject *sobj = (PySwigObject *) v;
+	PyObject *next = sobj->next;
+	if (sobj->own == SWIG_POINTER_OWN) {
+		swig_type_info *ty = sobj->ty;
+		PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+		PyObject *destroy = data ? data->destroy : 0;
+		if (destroy) {
+			/* destroy is always a VARARGS method */
+			PyObject *res;
+			if (data->delargs) {
+				/* we need to create a temporal object to carry the destroy operation */
+				PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
+				res = SWIG_Python_CallFunctor(destroy, tmp);
+				Py_DECREF(tmp);
+			} else {
+				PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
+				PyObject *mself = PyCFunction_GET_SELF(destroy);
+				res = ((*meth) (mself, v));
+			}
+			Py_XDECREF(res);
+		}
 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
-    else {
-      const char *name = SWIG_TypePrettyName(ty);
-      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
-    }
+		else {
+			const char *name = SWIG_TypePrettyName(ty);
+			printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
+		}
 #endif
-  } 
-  Py_XDECREF(next);
-  PyObject_DEL(v);
+	}
+	Py_XDECREF(next);
+	PyObject_DEL(v);
 }
 
-SWIGRUNTIME PyObject* 
-PySwigObject_append(PyObject* v, PyObject* next)
+SWIGRUNTIME PyObject *PySwigObject_append(PyObject * v, PyObject * next)
 {
-  PySwigObject *sobj = (PySwigObject *) v;
+	PySwigObject *sobj = (PySwigObject *) v;
 #ifndef METH_O
-  PyObject *tmp = 0;
-  if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
-  next = tmp;
-#endif
-  if (!PySwigObject_Check(next)) {
-    return NULL;
-  }
-  sobj->next = next;
-  Py_INCREF(next);
-  return SWIG_Py_Void();
+	PyObject *tmp = 0;
+	if (!PyArg_ParseTuple(next, (char *) "O:append", &tmp))
+		return NULL;
+	next = tmp;
+#endif
+	if (!PySwigObject_Check(next)) {
+		return NULL;
+	}
+	sobj->next = next;
+	Py_INCREF(next);
+	return SWIG_Py_Void();
 }
 
-SWIGRUNTIME PyObject* 
+SWIGRUNTIME PyObject *
 #ifdef METH_NOARGS
-PySwigObject_next(PyObject* v)
+PySwigObject_next(PyObject * v)
 #else
-PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+PySwigObject_next(PyObject * v, PyObject * SWIGUNUSEDPARM(args))
 #endif
 {
-  PySwigObject *sobj = (PySwigObject *) v;
-  if (sobj->next) {    
-    Py_INCREF(sobj->next);
-    return sobj->next;
-  } else {
-    return SWIG_Py_Void();
-  }
+	PySwigObject *sobj = (PySwigObject *) v;
+	if (sobj->next) {
+		Py_INCREF(sobj->next);
+		return sobj->next;
+	} else {
+		return SWIG_Py_Void();
+	}
 }
 
-SWIGINTERN PyObject*
+SWIGINTERN PyObject *
 #ifdef METH_NOARGS
-PySwigObject_disown(PyObject *v)
+PySwigObject_disown(PyObject * v)
 #else
-PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+PySwigObject_disown(PyObject * v, PyObject * SWIGUNUSEDPARM(args))
 #endif
 {
-  PySwigObject *sobj = (PySwigObject *)v;
-  sobj->own = 0;
-  return SWIG_Py_Void();
+	PySwigObject *sobj = (PySwigObject *) v;
+	sobj->own = 0;
+	return SWIG_Py_Void();
 }
 
-SWIGINTERN PyObject*
+SWIGINTERN PyObject *
 #ifdef METH_NOARGS
-PySwigObject_acquire(PyObject *v)
+PySwigObject_acquire(PyObject * v)
 #else
-PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+PySwigObject_acquire(PyObject * v, PyObject * SWIGUNUSEDPARM(args))
 #endif
 {
-  PySwigObject *sobj = (PySwigObject *)v;
-  sobj->own = SWIG_POINTER_OWN;
-  return SWIG_Py_Void();
+	PySwigObject *sobj = (PySwigObject *) v;
+	sobj->own = SWIG_POINTER_OWN;
+	return SWIG_Py_Void();
 }
 
-SWIGINTERN PyObject*
-PySwigObject_own(PyObject *v, PyObject *args)
+SWIGINTERN PyObject *PySwigObject_own(PyObject * v, PyObject * args)
 {
-  PyObject *val = 0;
+	PyObject *val = 0;
 #if (PY_VERSION_HEX < 0x02020000)
-  if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
+	if (!PyArg_ParseTuple(args, (char *) "|O:own", &val))
 #else
-  if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 
+	if (!PyArg_UnpackTuple(args, (char *) "own", 0, 1, &val))
 #endif
-    {
-      return NULL;
-    } 
-  else
-    {
-      PySwigObject *sobj = (PySwigObject *)v;
-      PyObject *obj = PyBool_FromLong(sobj->own);
-      if (val) {
-#ifdef METH_NOARGS
-	if (PyObject_IsTrue(val)) {
-	  PySwigObject_acquire(v);
+	{
+		return NULL;
 	} else {
-	  PySwigObject_disown(v);
-	}
+		PySwigObject *sobj = (PySwigObject *) v;
+		PyObject *obj = PyBool_FromLong(sobj->own);
+		if (val) {
+#ifdef METH_NOARGS
+			if (PyObject_IsTrue(val)) {
+				PySwigObject_acquire(v);
+			} else {
+				PySwigObject_disown(v);
+			}
 #else
-	if (PyObject_IsTrue(val)) {
-	  PySwigObject_acquire(v,args);
-	} else {
-	  PySwigObject_disown(v,args);
-	}
+			if (PyObject_IsTrue(val)) {
+				PySwigObject_acquire(v, args);
+			} else {
+				PySwigObject_disown(v, args);
+			}
 #endif
-      } 
-      return obj;
-    }
+		}
+		return obj;
+	}
 }
 
 #ifdef METH_O
-static PyMethodDef
-swigobject_methods[] = {
-  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
-  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
-  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
-  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_O,       (char *)"appends another 'this' object"},
-  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
-  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
-  {0, 0, 0, 0}  
+static PyMethodDef swigobject_methods[] = {
+	{(char *) "disown", (PyCFunction) PySwigObject_disown, METH_NOARGS, (char *) "releases ownership of the pointer"},
+	{(char *) "acquire", (PyCFunction) PySwigObject_acquire, METH_NOARGS, (char *) "aquires ownership of the pointer"},
+	{(char *) "own", (PyCFunction) PySwigObject_own, METH_VARARGS, (char *) "returns/sets ownership of the pointer"},
+	{(char *) "append", (PyCFunction) PySwigObject_append, METH_O, (char *) "appends another 'this' object"},
+	{(char *) "next", (PyCFunction) PySwigObject_next, METH_NOARGS, (char *) "returns the next 'this' object"},
+	{(char *) "__repr__", (PyCFunction) PySwigObject_repr, METH_NOARGS, (char *) "returns object representation"},
+	{0, 0, 0, 0}
 };
 #else
-static PyMethodDef
-swigobject_methods[] = {
-  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
-  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
-  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
-  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
-  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
-  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
-  {0, 0, 0, 0}  
+static PyMethodDef swigobject_methods[] = {
+	{(char *) "disown", (PyCFunction) PySwigObject_disown, METH_VARARGS, (char *) "releases ownership of the pointer"},
+	{(char *) "acquire", (PyCFunction) PySwigObject_acquire, METH_VARARGS, (char *) "aquires ownership of the pointer"},
+	{(char *) "own", (PyCFunction) PySwigObject_own, METH_VARARGS, (char *) "returns/sets ownership of the pointer"},
+	{(char *) "append", (PyCFunction) PySwigObject_append, METH_VARARGS, (char *) "appends another 'this' object"},
+	{(char *) "next", (PyCFunction) PySwigObject_next, METH_VARARGS, (char *) "returns the next 'this' object"},
+	{(char *) "__repr__", (PyCFunction) PySwigObject_repr, METH_VARARGS, (char *) "returns object representation"},
+	{0, 0, 0, 0}
 };
 #endif
 
 #if PY_VERSION_HEX < 0x02020000
-SWIGINTERN PyObject *
-PySwigObject_getattr(PySwigObject *sobj,char *name)
+SWIGINTERN PyObject *PySwigObject_getattr(PySwigObject * sobj, char *name)
 {
-  return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
+	return Py_FindMethod(swigobject_methods, (PyObject *) sobj, name);
 }
 #endif
 
-SWIGRUNTIME PyTypeObject*
-_PySwigObject_type(void) {
-  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
-  
-  static PyNumberMethods PySwigObject_as_number = {
-    (binaryfunc)0, /*nb_add*/
-    (binaryfunc)0, /*nb_subtract*/
-    (binaryfunc)0, /*nb_multiply*/
-    (binaryfunc)0, /*nb_divide*/
-    (binaryfunc)0, /*nb_remainder*/
-    (binaryfunc)0, /*nb_divmod*/
-    (ternaryfunc)0,/*nb_power*/
-    (unaryfunc)0,  /*nb_negative*/
-    (unaryfunc)0,  /*nb_positive*/
-    (unaryfunc)0,  /*nb_absolute*/
-    (inquiry)0,    /*nb_nonzero*/
-    0,		   /*nb_invert*/
-    0,		   /*nb_lshift*/
-    0,		   /*nb_rshift*/
-    0,		   /*nb_and*/
-    0,		   /*nb_xor*/
-    0,		   /*nb_or*/
-    (coercion)0,   /*nb_coerce*/
-    (unaryfunc)PySwigObject_long, /*nb_int*/
-    (unaryfunc)PySwigObject_long, /*nb_long*/
-    (unaryfunc)0,                 /*nb_float*/
-    (unaryfunc)PySwigObject_oct,  /*nb_oct*/
-    (unaryfunc)PySwigObject_hex,  /*nb_hex*/
-#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
-#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
-    0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
-#endif
-  };
-
-  static PyTypeObject pyswigobject_type;  
-  static int type_init = 0;
-  if (!type_init) {
-    const PyTypeObject tmp
-      = {
-	PyObject_HEAD_INIT(NULL)
-	0,				    /* ob_size */
-	(char *)"PySwigObject",		    /* tp_name */
-	sizeof(PySwigObject),		    /* tp_basicsize */
-	0,			            /* tp_itemsize */
-	(destructor)PySwigObject_dealloc,   /* tp_dealloc */
-	(printfunc)PySwigObject_print,	    /* tp_print */
+SWIGRUNTIME PyTypeObject *_PySwigObject_type(void)
+{
+	static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
+
+	static PyNumberMethods PySwigObject_as_number = {
+		(binaryfunc) 0,			/*nb_add */
+		(binaryfunc) 0,			/*nb_subtract */
+		(binaryfunc) 0,			/*nb_multiply */
+		(binaryfunc) 0,			/*nb_divide */
+		(binaryfunc) 0,			/*nb_remainder */
+		(binaryfunc) 0,			/*nb_divmod */
+		(ternaryfunc) 0,		/*nb_power */
+		(unaryfunc) 0,			/*nb_negative */
+		(unaryfunc) 0,			/*nb_positive */
+		(unaryfunc) 0,			/*nb_absolute */
+		(inquiry) 0,			/*nb_nonzero */
+		0,						/*nb_invert */
+		0,						/*nb_lshift */
+		0,						/*nb_rshift */
+		0,						/*nb_and */
+		0,						/*nb_xor */
+		0,						/*nb_or */
+		(coercion) 0,			/*nb_coerce */
+		(unaryfunc) PySwigObject_long,	/*nb_int */
+		(unaryfunc) PySwigObject_long,	/*nb_long */
+		(unaryfunc) 0,			/*nb_float */
+		(unaryfunc) PySwigObject_oct,	/*nb_oct */
+		(unaryfunc) PySwigObject_hex,	/*nb_hex */
+#if PY_VERSION_HEX >= 0x02050000	/* 2.5.0 */
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0	/* nb_inplace_add -> nb_index */
+#elif PY_VERSION_HEX >= 0x02020000	/* 2.2.0 */
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0	/* nb_inplace_add -> nb_inplace_true_divide */
+#elif PY_VERSION_HEX >= 0x02000000	/* 2.0.0 */
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0	/* nb_inplace_add -> nb_inplace_or */
+#endif
+	};
+
+	static PyTypeObject pyswigobject_type;
+	static int type_init = 0;
+	if (!type_init) {
+		const PyTypeObject tmp = {
+			PyObject_HEAD_INIT(NULL)
+				0,				/* ob_size */
+			(char *) "PySwigObject",	/* tp_name */
+			sizeof(PySwigObject),	/* tp_basicsize */
+			0,					/* tp_itemsize */
+			(destructor) PySwigObject_dealloc,	/* tp_dealloc */
+			(printfunc) PySwigObject_print,	/* tp_print */
 #if PY_VERSION_HEX < 0x02020000
-	(getattrfunc)PySwigObject_getattr,  /* tp_getattr */ 
+			(getattrfunc) PySwigObject_getattr,	/* tp_getattr */
 #else
-	(getattrfunc)0,			    /* tp_getattr */ 
+			(getattrfunc) 0,	/* tp_getattr */
 #endif
-	(setattrfunc)0,			    /* tp_setattr */ 
-	(cmpfunc)PySwigObject_compare,	    /* tp_compare */ 
-	(reprfunc)PySwigObject_repr,	    /* tp_repr */    
-	&PySwigObject_as_number,	    /* tp_as_number */
-	0,				    /* tp_as_sequence */
-	0,				    /* tp_as_mapping */
-	(hashfunc)0,			    /* tp_hash */
-	(ternaryfunc)0,			    /* tp_call */
-	(reprfunc)PySwigObject_str,	    /* tp_str */
-	PyObject_GenericGetAttr,            /* tp_getattro */
-	0,				    /* tp_setattro */
-	0,		                    /* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT,	            /* tp_flags */
-	swigobject_doc, 	            /* tp_doc */        
-	0,                                  /* tp_traverse */
-	0,                                  /* tp_clear */
-	0,                                  /* tp_richcompare */
-	0,                                  /* tp_weaklistoffset */
+			(setattrfunc) 0,	/* tp_setattr */
+			(cmpfunc) PySwigObject_compare,	/* tp_compare */
+			(reprfunc) PySwigObject_repr,	/* tp_repr */
+			&PySwigObject_as_number,	/* tp_as_number */
+			0,					/* tp_as_sequence */
+			0,					/* tp_as_mapping */
+			(hashfunc) 0,		/* tp_hash */
+			(ternaryfunc) 0,	/* tp_call */
+			(reprfunc) PySwigObject_str,	/* tp_str */
+			PyObject_GenericGetAttr,	/* tp_getattro */
+			0,					/* tp_setattro */
+			0,					/* tp_as_buffer */
+			Py_TPFLAGS_DEFAULT,	/* tp_flags */
+			swigobject_doc,		/* tp_doc */
+			0,					/* tp_traverse */
+			0,					/* tp_clear */
+			0,					/* tp_richcompare */
+			0,					/* tp_weaklistoffset */
 #if PY_VERSION_HEX >= 0x02020000
-	0,                                  /* tp_iter */
-	0,                                  /* tp_iternext */
-	swigobject_methods,		    /* tp_methods */ 
-	0,			            /* tp_members */
-	0,				    /* tp_getset */	    	
-	0,			            /* tp_base */	        
-	0,				    /* tp_dict */	    	
-	0,				    /* tp_descr_get */  	
-	0,				    /* tp_descr_set */  	
-	0,				    /* tp_dictoffset */ 	
-	0,				    /* tp_init */	    	
-	0,				    /* tp_alloc */	    	
-	0,			            /* tp_new */	    	
-	0,	                            /* tp_free */	   
-        0,                                  /* tp_is_gc */  
-	0,				    /* tp_bases */   
-	0,				    /* tp_mro */
-	0,				    /* tp_cache */   
- 	0,				    /* tp_subclasses */
-	0,				    /* tp_weaklist */
+			0,					/* tp_iter */
+			0,					/* tp_iternext */
+			swigobject_methods,	/* tp_methods */
+			0,					/* tp_members */
+			0,					/* tp_getset */
+			0,					/* tp_base */
+			0,					/* tp_dict */
+			0,					/* tp_descr_get */
+			0,					/* tp_descr_set */
+			0,					/* tp_dictoffset */
+			0,					/* tp_init */
+			0,					/* tp_alloc */
+			0,					/* tp_new */
+			0,					/* tp_free */
+			0,					/* tp_is_gc */
+			0,					/* tp_bases */
+			0,					/* tp_mro */
+			0,					/* tp_cache */
+			0,					/* tp_subclasses */
+			0,					/* tp_weaklist */
 #endif
 #if PY_VERSION_HEX >= 0x02030000
-	0,                                  /* tp_del */
+			0,					/* tp_del */
 #endif
 #ifdef COUNT_ALLOCS
-	0,0,0,0                             /* tp_alloc -> tp_next */
+			0, 0, 0, 0			/* tp_alloc -> tp_next */
 #endif
-      };
-    pyswigobject_type = tmp;
-    pyswigobject_type.ob_type = &PyType_Type;
-    type_init = 1;
-  }
-  return &pyswigobject_type;
+		};
+		pyswigobject_type = tmp;
+		pyswigobject_type.ob_type = &PyType_Type;
+		type_init = 1;
+	}
+	return &pyswigobject_type;
 }
 
-SWIGRUNTIME PyObject *
-PySwigObject_New(void *ptr, swig_type_info *ty, int own)
+SWIGRUNTIME PyObject *PySwigObject_New(void *ptr, swig_type_info * ty, int own)
 {
-  PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
-  if (sobj) {
-    sobj->ptr  = ptr;
-    sobj->ty   = ty;
-    sobj->own  = own;
-    sobj->next = 0;
-  }
-  return (PyObject *)sobj;
+	PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
+	if (sobj) {
+		sobj->ptr = ptr;
+		sobj->ty = ty;
+		sobj->own = own;
+		sobj->next = 0;
+	}
+	return (PyObject *) sobj;
 }
 
 /* -----------------------------------------------------------------------------
@@ -1718,404 +1700,402 @@
  * ----------------------------------------------------------------------------- */
 
 typedef struct {
-  PyObject_HEAD
-  void *pack;
-  swig_type_info *ty;
-  size_t size;
+	PyObject_HEAD void *pack;
+	swig_type_info *ty;
+	size_t size;
 } PySwigPacked;
 
-SWIGRUNTIME int
-PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+SWIGRUNTIME int PySwigPacked_print(PySwigPacked * v, FILE * fp, int SWIGUNUSEDPARM(flags))
 {
-  char result[SWIG_BUFFER_SIZE];
-  fputs("<Swig Packed ", fp); 
-  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
-    fputs("at ", fp); 
-    fputs(result, fp); 
-  }
-  fputs(v->ty->name,fp); 
-  fputs(">", fp);
-  return 0; 
+	char result[SWIG_BUFFER_SIZE];
+	fputs("<Swig Packed ", fp);
+	if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+		fputs("at ", fp);
+		fputs(result, fp);
+	}
+	fputs(v->ty->name, fp);
+	fputs(">", fp);
+	return 0;
 }
-  
-SWIGRUNTIME PyObject *
-PySwigPacked_repr(PySwigPacked *v)
+
+SWIGRUNTIME PyObject *PySwigPacked_repr(PySwigPacked * v)
 {
-  char result[SWIG_BUFFER_SIZE];
-  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
-    return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
-  } else {
-    return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
-  }  
+	char result[SWIG_BUFFER_SIZE];
+	if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+		return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
+	} else {
+		return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
+	}
 }
 
-SWIGRUNTIME PyObject *
-PySwigPacked_str(PySwigPacked *v)
+SWIGRUNTIME PyObject *PySwigPacked_str(PySwigPacked * v)
+{
+	char result[SWIG_BUFFER_SIZE];
+	if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+		return PyString_FromFormat("%s%s", result, v->ty->name);
+	} else {
+		return PyString_FromString(v->ty->name);
+	}
+}
+
+SWIGRUNTIME int PySwigPacked_compare(PySwigPacked * v, PySwigPacked * w)
+{
+	size_t i = v->size;
+	size_t j = w->size;
+	int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
+	return s ? s : strncmp((char *) v->pack, (char *) w->pack, 2 * v->size);
+}
+
+SWIGRUNTIME PyTypeObject *_PySwigPacked_type(void);
+
+SWIGRUNTIME PyTypeObject *PySwigPacked_type(void)
 {
-  char result[SWIG_BUFFER_SIZE];
-  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
-    return PyString_FromFormat("%s%s", result, v->ty->name);
-  } else {
-    return PyString_FromString(v->ty->name);
-  }  
-}
-
-SWIGRUNTIME int
-PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
-{
-  size_t i = v->size;
-  size_t j = w->size;
-  int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
-  return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
-}
-
-SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
-
-SWIGRUNTIME PyTypeObject*
-PySwigPacked_type(void) {
-  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
-  return type;
-}
-
-SWIGRUNTIMEINLINE int
-PySwigPacked_Check(PyObject *op) {
-  return ((op)->ob_type == _PySwigPacked_type()) 
-    || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
-}
-
-SWIGRUNTIME void
-PySwigPacked_dealloc(PyObject *v)
-{
-  if (PySwigPacked_Check(v)) {
-    PySwigPacked *sobj = (PySwigPacked *) v;
-    free(sobj->pack);
-  }
-  PyObject_DEL(v);
-}
-
-SWIGRUNTIME PyTypeObject*
-_PySwigPacked_type(void) {
-  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
-  static PyTypeObject pyswigpacked_type;
-  static int type_init = 0;  
-  if (!type_init) {
-    const PyTypeObject tmp
-      = {
-	PyObject_HEAD_INIT(NULL)
-	0,				    /* ob_size */	
-	(char *)"PySwigPacked",		    /* tp_name */	
-	sizeof(PySwigPacked),		    /* tp_basicsize */	
-	0,				    /* tp_itemsize */	
-	(destructor)PySwigPacked_dealloc,   /* tp_dealloc */	
-	(printfunc)PySwigPacked_print,	    /* tp_print */   	
-	(getattrfunc)0,			    /* tp_getattr */ 	
-	(setattrfunc)0,			    /* tp_setattr */ 	
-	(cmpfunc)PySwigPacked_compare,	    /* tp_compare */ 	
-	(reprfunc)PySwigPacked_repr,	    /* tp_repr */    	
-	0,	                            /* tp_as_number */	
-	0,				    /* tp_as_sequence */
-	0,				    /* tp_as_mapping */	
-	(hashfunc)0,			    /* tp_hash */	
-	(ternaryfunc)0,			    /* tp_call */	
-	(reprfunc)PySwigPacked_str,	    /* tp_str */	
-	PyObject_GenericGetAttr,            /* tp_getattro */
-	0,				    /* tp_setattro */
-	0,		                    /* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT,	            /* tp_flags */
-	swigpacked_doc, 	            /* tp_doc */
-	0,                                  /* tp_traverse */
-	0,                                  /* tp_clear */
-	0,                                  /* tp_richcompare */
-	0,                                  /* tp_weaklistoffset */
+	static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
+	return type;
+}
+
+SWIGRUNTIMEINLINE int PySwigPacked_Check(PyObject * op)
+{
+	return ((op)->ob_type == _PySwigPacked_type())
+		|| (strcmp((op)->ob_type->tp_name, "PySwigPacked") == 0);
+}
+
+SWIGRUNTIME void PySwigPacked_dealloc(PyObject * v)
+{
+	if (PySwigPacked_Check(v)) {
+		PySwigPacked *sobj = (PySwigPacked *) v;
+		free(sobj->pack);
+	}
+	PyObject_DEL(v);
+}
+
+SWIGRUNTIME PyTypeObject *_PySwigPacked_type(void)
+{
+	static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
+	static PyTypeObject pyswigpacked_type;
+	static int type_init = 0;
+	if (!type_init) {
+		const PyTypeObject tmp = {
+			PyObject_HEAD_INIT(NULL)
+				0,				/* ob_size */
+			(char *) "PySwigPacked",	/* tp_name */
+			sizeof(PySwigPacked),	/* tp_basicsize */
+			0,					/* tp_itemsize */
+			(destructor) PySwigPacked_dealloc,	/* tp_dealloc */
+			(printfunc) PySwigPacked_print,	/* tp_print */
+			(getattrfunc) 0,	/* tp_getattr */
+			(setattrfunc) 0,	/* tp_setattr */
+			(cmpfunc) PySwigPacked_compare,	/* tp_compare */
+			(reprfunc) PySwigPacked_repr,	/* tp_repr */
+			0,					/* tp_as_number */
+			0,					/* tp_as_sequence */
+			0,					/* tp_as_mapping */
+			(hashfunc) 0,		/* tp_hash */
+			(ternaryfunc) 0,	/* tp_call */
+			(reprfunc) PySwigPacked_str,	/* tp_str */
+			PyObject_GenericGetAttr,	/* tp_getattro */
+			0,					/* tp_setattro */
+			0,					/* tp_as_buffer */
+			Py_TPFLAGS_DEFAULT,	/* tp_flags */
+			swigpacked_doc,		/* tp_doc */
+			0,					/* tp_traverse */
+			0,					/* tp_clear */
+			0,					/* tp_richcompare */
+			0,					/* tp_weaklistoffset */
 #if PY_VERSION_HEX >= 0x02020000
-	0,                                  /* tp_iter */
-	0,                                  /* tp_iternext */
-	0,		                    /* tp_methods */ 
-	0,			            /* tp_members */
-	0,				    /* tp_getset */	    	
-	0,			            /* tp_base */	        
-	0,				    /* tp_dict */	    	
-	0,				    /* tp_descr_get */  	
-	0,				    /* tp_descr_set */  	
-	0,				    /* tp_dictoffset */ 	
-	0,				    /* tp_init */	    	
-	0,				    /* tp_alloc */	    	
-	0,			            /* tp_new */	    	
-	0, 	                            /* tp_free */	   
-        0,                                  /* tp_is_gc */  
-	0,				    /* tp_bases */   
-	0,				    /* tp_mro */
-	0,				    /* tp_cache */   
- 	0,				    /* tp_subclasses */
-	0,				    /* tp_weaklist */
+			0,					/* tp_iter */
+			0,					/* tp_iternext */
+			0,					/* tp_methods */
+			0,					/* tp_members */
+			0,					/* tp_getset */
+			0,					/* tp_base */
+			0,					/* tp_dict */
+			0,					/* tp_descr_get */
+			0,					/* tp_descr_set */
+			0,					/* tp_dictoffset */
+			0,					/* tp_init */
+			0,					/* tp_alloc */
+			0,					/* tp_new */
+			0,					/* tp_free */
+			0,					/* tp_is_gc */
+			0,					/* tp_bases */
+			0,					/* tp_mro */
+			0,					/* tp_cache */
+			0,					/* tp_subclasses */
+			0,					/* tp_weaklist */
 #endif
 #if PY_VERSION_HEX >= 0x02030000
-	0,                                  /* tp_del */
+			0,					/* tp_del */
 #endif
 #ifdef COUNT_ALLOCS
-	0,0,0,0                             /* tp_alloc -> tp_next */
+			0, 0, 0, 0			/* tp_alloc -> tp_next */
 #endif
-      };
-    pyswigpacked_type = tmp;
-    pyswigpacked_type.ob_type = &PyType_Type;
-    type_init = 1;
-  }
-  return &pyswigpacked_type;
+		};
+		pyswigpacked_type = tmp;
+		pyswigpacked_type.ob_type = &PyType_Type;
+		type_init = 1;
+	}
+	return &pyswigpacked_type;
 }
 
-SWIGRUNTIME PyObject *
-PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
+SWIGRUNTIME PyObject *PySwigPacked_New(void *ptr, size_t size, swig_type_info * ty)
 {
-  PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
-  if (sobj) {
-    void *pack = malloc(size);
-    if (pack) {
-      memcpy(pack, ptr, size);
-      sobj->pack = pack;
-      sobj->ty   = ty;
-      sobj->size = size;
-    } else {
-      PyObject_DEL((PyObject *) sobj);
-      sobj = 0;
-    }
-  }
-  return (PyObject *) sobj;
+	PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
+	if (sobj) {
+		void *pack = malloc(size);
+		if (pack) {
+			memcpy(pack, ptr, size);
+			sobj->pack = pack;
+			sobj->ty = ty;
+			sobj->size = size;
+		} else {
+			PyObject_DEL((PyObject *) sobj);
+			sobj = 0;
+		}
+	}
+	return (PyObject *) sobj;
 }
 
-SWIGRUNTIME swig_type_info *
-PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
+SWIGRUNTIME swig_type_info *PySwigPacked_UnpackData(PyObject * obj, void *ptr, size_t size)
 {
-  if (PySwigPacked_Check(obj)) {
-    PySwigPacked *sobj = (PySwigPacked *)obj;
-    if (sobj->size != size) return 0;
-    memcpy(ptr, sobj->pack, size);
-    return sobj->ty;
-  } else {
-    return 0;
-  }
+	if (PySwigPacked_Check(obj)) {
+		PySwigPacked *sobj = (PySwigPacked *) obj;
+		if (sobj->size != size)
+			return 0;
+		memcpy(ptr, sobj->pack, size);
+		return sobj->ty;
+	} else {
+		return 0;
+	}
 }
 
 /* -----------------------------------------------------------------------------
  * pointers/data manipulation
  * ----------------------------------------------------------------------------- */
 
-SWIGRUNTIMEINLINE PyObject *
-_SWIG_This(void)
+SWIGRUNTIMEINLINE PyObject *_SWIG_This(void)
 {
-  return PyString_FromString("this");
+	return PyString_FromString("this");
 }
 
-SWIGRUNTIME PyObject *
-SWIG_This(void)
+SWIGRUNTIME PyObject *SWIG_This(void)
 {
-  static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
-  return swig_this;
+	static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
+	return swig_this;
 }
 
 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
 
-SWIGRUNTIME PySwigObject *
-SWIG_Python_GetSwigThis(PyObject *pyobj) 
+SWIGRUNTIME PySwigObject *SWIG_Python_GetSwigThis(PyObject * pyobj)
 {
-  if (PySwigObject_Check(pyobj)) {
-    return (PySwigObject *) pyobj;
-  } else {
-    PyObject *obj = 0;
+	if (PySwigObject_Check(pyobj)) {
+		return (PySwigObject *) pyobj;
+	} else {
+		PyObject *obj = 0;
 #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
-    if (PyInstance_Check(pyobj)) {
-      obj = _PyInstance_Lookup(pyobj, SWIG_This());      
-    } else {
-      PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
-      if (dictptr != NULL) {
-	PyObject *dict = *dictptr;
-	obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
-      } else {
+		if (PyInstance_Check(pyobj)) {
+			obj = _PyInstance_Lookup(pyobj, SWIG_This());
+		} else {
+			PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
+			if (dictptr != NULL) {
+				PyObject *dict = *dictptr;
+				obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
+			} else {
 #ifdef PyWeakref_CheckProxy
-	if (PyWeakref_CheckProxy(pyobj)) {
-	  PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
-	  return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
-	}
-#endif
-	obj = PyObject_GetAttr(pyobj,SWIG_This());
-	if (obj) {
-	  Py_DECREF(obj);
-	} else {
-	  if (PyErr_Occurred()) PyErr_Clear();
-	  return 0;
-	}
-      }
-    }
+				if (PyWeakref_CheckProxy(pyobj)) {
+					PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
+					return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
+				}
+#endif
+				obj = PyObject_GetAttr(pyobj, SWIG_This());
+				if (obj) {
+					Py_DECREF(obj);
+				} else {
+					if (PyErr_Occurred())
+						PyErr_Clear();
+					return 0;
+				}
+			}
+		}
 #else
-    obj = PyObject_GetAttr(pyobj,SWIG_This());
-    if (obj) {
-      Py_DECREF(obj);
-    } else {
-      if (PyErr_Occurred()) PyErr_Clear();
-      return 0;
-    }
+		obj = PyObject_GetAttr(pyobj, SWIG_This());
+		if (obj) {
+			Py_DECREF(obj);
+		} else {
+			if (PyErr_Occurred())
+				PyErr_Clear();
+			return 0;
+		}
 #endif
-    if (obj && !PySwigObject_Check(obj)) {
-      /* a PyObject is called 'this', try to get the 'real this'
-	 PySwigObject from it */ 
-      return SWIG_Python_GetSwigThis(obj);
-    }
-    return (PySwigObject *)obj;
-  }
+		if (obj && !PySwigObject_Check(obj)) {
+			/* a PyObject is called 'this', try to get the 'real this'
+			   PySwigObject from it */
+			return SWIG_Python_GetSwigThis(obj);
+		}
+		return (PySwigObject *) obj;
+	}
 }
 
 /* Acquire a pointer value */
 
-SWIGRUNTIME int
-SWIG_Python_AcquirePtr(PyObject *obj, int own) {
-  if (own == SWIG_POINTER_OWN) {
-    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
-    if (sobj) {
-      int oldown = sobj->own;
-      sobj->own = own;
-      return oldown;
-    }
-  }
-  return 0;
+SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject * obj, int own)
+{
+	if (own == SWIG_POINTER_OWN) {
+		PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+		if (sobj) {
+			int oldown = sobj->own;
+			sobj->own = own;
+			return oldown;
+		}
+	}
+	return 0;
 }
 
 /* Convert a pointer value */
 
-SWIGRUNTIME int
-SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
-  if (!obj) return SWIG_ERROR;
-  if (obj == Py_None) {
-    if (ptr) *ptr = 0;
-    return SWIG_OK;
-  } else {
-    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
-    if (own)
-      *own = 0;
-    while (sobj) {
-      void *vptr = sobj->ptr;
-      if (ty) {
-	swig_type_info *to = sobj->ty;
-	if (to == ty) {
-	  /* no type cast needed */
-	  if (ptr) *ptr = vptr;
-	  break;
+SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject * obj, void **ptr, swig_type_info * ty, int flags, int *own)
+{
+	if (!obj)
+		return SWIG_ERROR;
+	if (obj == Py_None) {
+		if (ptr)
+			*ptr = 0;
+		return SWIG_OK;
 	} else {
-	  swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
-	  if (!tc) {
-	    sobj = (PySwigObject *)sobj->next;
-	  } else {
-	    if (ptr) {
-              int newmemory = 0;
-              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
-              if (newmemory == SWIG_CAST_NEW_MEMORY) {
-                assert(own);
-                if (own)
-                  *own = *own | SWIG_CAST_NEW_MEMORY;
-              }
-            }
-	    break;
-	  }
-	}
-      } else {
-	if (ptr) *ptr = vptr;
-	break;
-      }
-    }
-    if (sobj) {
-      if (own)
-        *own = *own | sobj->own;
-      if (flags & SWIG_POINTER_DISOWN) {
-	sobj->own = 0;
-      }
-      return SWIG_OK;
-    } else {
-      int res = SWIG_ERROR;
-      if (flags & SWIG_POINTER_IMPLICIT_CONV) {
-	PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
-	if (data && !data->implicitconv) {
-	  PyObject *klass = data->klass;
-	  if (klass) {
-	    PyObject *impconv;
-	    data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
-	    impconv = SWIG_Python_CallFunctor(klass, obj);
-	    data->implicitconv = 0;
-	    if (PyErr_Occurred()) {
-	      PyErr_Clear();
-	      impconv = 0;
-	    }
-	    if (impconv) {
-	      PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
-	      if (iobj) {
-		void *vptr;
-		res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
-		if (SWIG_IsOK(res)) {
-		  if (ptr) {
-		    *ptr = vptr;
-		    /* transfer the ownership to 'ptr' */
-		    iobj->own = 0;
-		    res = SWIG_AddCast(res);
-		    res = SWIG_AddNewMask(res);
-		  } else {
-		    res = SWIG_AddCast(res);		    
-		  }
-		}
-	      }
-	      Py_DECREF(impconv);
-	    }
-	  }
+		PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+		if (own)
+			*own = 0;
+		while (sobj) {
+			void *vptr = sobj->ptr;
+			if (ty) {
+				swig_type_info *to = sobj->ty;
+				if (to == ty) {
+					/* no type cast needed */
+					if (ptr)
+						*ptr = vptr;
+					break;
+				} else {
+					swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
+					if (!tc) {
+						sobj = (PySwigObject *) sobj->next;
+					} else {
+						if (ptr) {
+							int newmemory = 0;
+							*ptr = SWIG_TypeCast(tc, vptr, &newmemory);
+							if (newmemory == SWIG_CAST_NEW_MEMORY) {
+								assert(own);
+								if (own)
+									*own = *own | SWIG_CAST_NEW_MEMORY;
+							}
+						}
+						break;
+					}
+				}
+			} else {
+				if (ptr)
+					*ptr = vptr;
+				break;
+			}
+		}
+		if (sobj) {
+			if (own)
+				*own = *own | sobj->own;
+			if (flags & SWIG_POINTER_DISOWN) {
+				sobj->own = 0;
+			}
+			return SWIG_OK;
+		} else {
+			int res = SWIG_ERROR;
+			if (flags & SWIG_POINTER_IMPLICIT_CONV) {
+				PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+				if (data && !data->implicitconv) {
+					PyObject *klass = data->klass;
+					if (klass) {
+						PyObject *impconv;
+						data->implicitconv = 1;	/* avoid recursion and call 'explicit' constructors */
+						impconv = SWIG_Python_CallFunctor(klass, obj);
+						data->implicitconv = 0;
+						if (PyErr_Occurred()) {
+							PyErr_Clear();
+							impconv = 0;
+						}
+						if (impconv) {
+							PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
+							if (iobj) {
+								void *vptr;
+								res = SWIG_Python_ConvertPtrAndOwn((PyObject *) iobj, &vptr, ty, 0, 0);
+								if (SWIG_IsOK(res)) {
+									if (ptr) {
+										*ptr = vptr;
+										/* transfer the ownership to 'ptr' */
+										iobj->own = 0;
+										res = SWIG_AddCast(res);
+										res = SWIG_AddNewMask(res);
+									} else {
+										res = SWIG_AddCast(res);
+									}
+								}
+							}
+							Py_DECREF(impconv);
+						}
+					}
+				}
+			}
+			return res;
+		}
 	}
-      }
-      return res;
-    }
-  }
 }
 
 /* Convert a function ptr value */
 
-SWIGRUNTIME int
-SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
-  if (!PyCFunction_Check(obj)) {
-    return SWIG_ConvertPtr(obj, ptr, ty, 0);
-  } else {
-    void *vptr = 0;
-    
-    /* here we get the method pointer for callbacks */
-    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
-    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
-    if (desc) {
-      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
-      if (!desc) return SWIG_ERROR;
-    }
-    if (ty) {
-      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
-      if (tc) {
-        int newmemory = 0;
-        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
-        assert(!newmemory); /* newmemory handling not yet implemented */
-      } else {
-        return SWIG_ERROR;
-      }
-    } else {
-      *ptr = vptr;
-    }
-    return SWIG_OK;
-  }
+SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject * obj, void **ptr, swig_type_info * ty)
+{
+	if (!PyCFunction_Check(obj)) {
+		return SWIG_ConvertPtr(obj, ptr, ty, 0);
+	} else {
+		void *vptr = 0;
+
+		/* here we get the method pointer for callbacks */
+		const char *doc = (((PyCFunctionObject *) obj)->m_ml->ml_doc);
+		const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
+		if (desc) {
+			desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
+			if (!desc)
+				return SWIG_ERROR;
+		}
+		if (ty) {
+			swig_cast_info *tc = SWIG_TypeCheck(desc, ty);
+			if (tc) {
+				int newmemory = 0;
+				*ptr = SWIG_TypeCast(tc, vptr, &newmemory);
+				assert(!newmemory);	/* newmemory handling not yet implemented */
+			} else {
+				return SWIG_ERROR;
+			}
+		} else {
+			*ptr = vptr;
+		}
+		return SWIG_OK;
+	}
 }
 
 /* Convert a packed value value */
 
-SWIGRUNTIME int
-SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
-  swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
-  if (!to) return SWIG_ERROR;
-  if (ty) {
-    if (to != ty) {
-      /* check type cast? */
-      swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
-      if (!tc) return SWIG_ERROR;
-    }
-  }
-  return SWIG_OK;
-}  
+SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject * obj, void *ptr, size_t sz, swig_type_info * ty)
+{
+	swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
+	if (!to)
+		return SWIG_ERROR;
+	if (ty) {
+		if (to != ty) {
+			/* check type cast? */
+			swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
+			if (!tc)
+				return SWIG_ERROR;
+		}
+	}
+	return SWIG_OK;
+}
 
 /* -----------------------------------------------------------------------------
  * Create a new pointer object
@@ -2126,133 +2106,131 @@
   'this' attribute.
 */
 
-SWIGRUNTIME PyObject* 
-SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
+SWIGRUNTIME PyObject *SWIG_Python_NewShadowInstance(PySwigClientData * data, PyObject * swig_this)
 {
 #if (PY_VERSION_HEX >= 0x02020000)
-  PyObject *inst = 0;
-  PyObject *newraw = data->newraw;
-  if (newraw) {
-    inst = PyObject_Call(newraw, data->newargs, NULL);
-    if (inst) {
+	PyObject *inst = 0;
+	PyObject *newraw = data->newraw;
+	if (newraw) {
+		inst = PyObject_Call(newraw, data->newargs, NULL);
+		if (inst) {
 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
-      PyObject **dictptr = _PyObject_GetDictPtr(inst);
-      if (dictptr != NULL) {
-	PyObject *dict = *dictptr;
-	if (dict == NULL) {
-	  dict = PyDict_New();
-	  *dictptr = dict;
-	  PyDict_SetItem(dict, SWIG_This(), swig_this);
-	}
-      }
+			PyObject **dictptr = _PyObject_GetDictPtr(inst);
+			if (dictptr != NULL) {
+				PyObject *dict = *dictptr;
+				if (dict == NULL) {
+					dict = PyDict_New();
+					*dictptr = dict;
+					PyDict_SetItem(dict, SWIG_This(), swig_this);
+				}
+			}
 #else
-      PyObject *key = SWIG_This();
-      PyObject_SetAttr(inst, key, swig_this);
+			PyObject *key = SWIG_This();
+			PyObject_SetAttr(inst, key, swig_this);
 #endif
-    }
-  } else {
-    PyObject *dict = PyDict_New();
-    PyDict_SetItem(dict, SWIG_This(), swig_this);
-    inst = PyInstance_NewRaw(data->newargs, dict);
-    Py_DECREF(dict);
-  }
-  return inst;
+		}
+	} else {
+		PyObject *dict = PyDict_New();
+		PyDict_SetItem(dict, SWIG_This(), swig_this);
+		inst = PyInstance_NewRaw(data->newargs, dict);
+		Py_DECREF(dict);
+	}
+	return inst;
 #else
 #if (PY_VERSION_HEX >= 0x02010000)
-  PyObject *inst;
-  PyObject *dict = PyDict_New();
-  PyDict_SetItem(dict, SWIG_This(), swig_this);
-  inst = PyInstance_NewRaw(data->newargs, dict);
-  Py_DECREF(dict);
-  return (PyObject *) inst;
+	PyObject *inst;
+	PyObject *dict = PyDict_New();
+	PyDict_SetItem(dict, SWIG_This(), swig_this);
+	inst = PyInstance_NewRaw(data->newargs, dict);
+	Py_DECREF(dict);
+	return (PyObject *) inst;
 #else
-  PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
-  if (inst == NULL) {
-    return NULL;
-  }
-  inst->in_class = (PyClassObject *)data->newargs;
-  Py_INCREF(inst->in_class);
-  inst->in_dict = PyDict_New();
-  if (inst->in_dict == NULL) {
-    Py_DECREF(inst);
-    return NULL;
-  }
+	PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
+	if (inst == NULL) {
+		return NULL;
+	}
+	inst->in_class = (PyClassObject *) data->newargs;
+	Py_INCREF(inst->in_class);
+	inst->in_dict = PyDict_New();
+	if (inst->in_dict == NULL) {
+		Py_DECREF(inst);
+		return NULL;
+	}
 #ifdef Py_TPFLAGS_HAVE_WEAKREFS
-  inst->in_weakreflist = NULL;
+	inst->in_weakreflist = NULL;
 #endif
 #ifdef Py_TPFLAGS_GC
-  PyObject_GC_Init(inst);
+	PyObject_GC_Init(inst);
 #endif
-  PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
-  return (PyObject *) inst;
+	PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
+	return (PyObject *) inst;
 #endif
 #endif
 }
 
-SWIGRUNTIME void
-SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
+SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject * inst, PyObject * swig_this)
 {
- PyObject *dict;
+	PyObject *dict;
 #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
- PyObject **dictptr = _PyObject_GetDictPtr(inst);
- if (dictptr != NULL) {
-   dict = *dictptr;
-   if (dict == NULL) {
-     dict = PyDict_New();
-     *dictptr = dict;
-   }
-   PyDict_SetItem(dict, SWIG_This(), swig_this);
-   return;
- }
-#endif
- dict = PyObject_GetAttrString(inst, (char*)"__dict__");
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- Py_DECREF(dict);
-} 
+	PyObject **dictptr = _PyObject_GetDictPtr(inst);
+	if (dictptr != NULL) {
+		dict = *dictptr;
+		if (dict == NULL) {
+			dict = PyDict_New();
+			*dictptr = dict;
+		}
+		PyDict_SetItem(dict, SWIG_This(), swig_this);
+		return;
+	}
+#endif
+	dict = PyObject_GetAttrString(inst, (char *) "__dict__");
+	PyDict_SetItem(dict, SWIG_This(), swig_this);
+	Py_DECREF(dict);
+}
 
 
-SWIGINTERN PyObject *
-SWIG_Python_InitShadowInstance(PyObject *args) {
-  PyObject *obj[2];
-  if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
-    return NULL;
-  } else {
-    PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
-    if (sthis) {
-      PySwigObject_append((PyObject*) sthis, obj[1]);
-    } else {
-      SWIG_Python_SetSwigThis(obj[0], obj[1]);
-    }
-    return SWIG_Py_Void();
-  }
+SWIGINTERN PyObject *SWIG_Python_InitShadowInstance(PyObject * args)
+{
+	PyObject *obj[2];
+	if (!SWIG_Python_UnpackTuple(args, (char *) "swiginit", 2, 2, obj)) {
+		return NULL;
+	} else {
+		PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
+		if (sthis) {
+			PySwigObject_append((PyObject *) sthis, obj[1]);
+		} else {
+			SWIG_Python_SetSwigThis(obj[0], obj[1]);
+		}
+		return SWIG_Py_Void();
+	}
 }
 
 /* Create a new pointer object */
 
-SWIGRUNTIME PyObject *
-SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
-  if (!ptr) {
-    return SWIG_Py_Void();
-  } else {
-    int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
-    PyObject *robj = PySwigObject_New(ptr, type, own);
-    PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
-    if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
-      PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
-      if (inst) {
-	Py_DECREF(robj);
-	robj = inst;
-      }
-    }
-    return robj;
-  }
+SWIGRUNTIME PyObject *SWIG_Python_NewPointerObj(void *ptr, swig_type_info * type, int flags)
+{
+	if (!ptr) {
+		return SWIG_Py_Void();
+	} else {
+		int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
+		PyObject *robj = PySwigObject_New(ptr, type, own);
+		PySwigClientData *clientdata = type ? (PySwigClientData *) (type->clientdata) : 0;
+		if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
+			PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
+			if (inst) {
+				Py_DECREF(robj);
+				robj = inst;
+			}
+		}
+		return robj;
+	}
 }
 
 /* Create a new packed object */
 
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
-  return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
+SWIGRUNTIMEINLINE PyObject *SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info * type)
+{
+	return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
 }
 
 /* -----------------------------------------------------------------------------*
@@ -2263,114 +2241,108 @@
 void *SWIG_ReturnGlobalTypeList(void *);
 #endif
 
-SWIGRUNTIME swig_module_info *
-SWIG_Python_GetModule(void) {
-  static void *type_pointer = (void *)0;
-  /* first check if module already created */
-  if (!type_pointer) {
+SWIGRUNTIME swig_module_info *SWIG_Python_GetModule(void)
+{
+	static void *type_pointer = (void *) 0;
+	/* first check if module already created */
+	if (!type_pointer) {
 #ifdef SWIG_LINK_RUNTIME
-    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
+		type_pointer = SWIG_ReturnGlobalTypeList((void *) 0);
 #else
-    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
-				    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
-    if (PyErr_Occurred()) {
-      PyErr_Clear();
-      type_pointer = (void *)0;
-    }
+		type_pointer = PyCObject_Import((char *) "swig_runtime_data" SWIG_RUNTIME_VERSION, (char *) "type_pointer" SWIG_TYPE_TABLE_NAME);
+		if (PyErr_Occurred()) {
+			PyErr_Clear();
+			type_pointer = (void *) 0;
+		}
 #endif
-  }
-  return (swig_module_info *) type_pointer;
+	}
+	return (swig_module_info *) type_pointer;
 }
 
 #if PY_MAJOR_VERSION < 2
 /* PyModule_AddObject function was introduced in Python 2.0.  The following function
    is copied out of Python/modsupport.c in python version 2.3.4 */
-SWIGINTERN int
-PyModule_AddObject(PyObject *m, char *name, PyObject *o)
+SWIGINTERN int PyModule_AddObject(PyObject * m, char *name, PyObject * o)
 {
-  PyObject *dict;
-  if (!PyModule_Check(m)) {
-    PyErr_SetString(PyExc_TypeError,
-		    "PyModule_AddObject() needs module as first arg");
-    return SWIG_ERROR;
-  }
-  if (!o) {
-    PyErr_SetString(PyExc_TypeError,
-		    "PyModule_AddObject() needs non-NULL value");
-    return SWIG_ERROR;
-  }
-  
-  dict = PyModule_GetDict(m);
-  if (dict == NULL) {
-    /* Internal error -- modules must have a dict! */
-    PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
-		 PyModule_GetName(m));
-    return SWIG_ERROR;
-  }
-  if (PyDict_SetItemString(dict, name, o))
-    return SWIG_ERROR;
-  Py_DECREF(o);
-  return SWIG_OK;
+	PyObject *dict;
+	if (!PyModule_Check(m)) {
+		PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg");
+		return SWIG_ERROR;
+	}
+	if (!o) {
+		PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value");
+		return SWIG_ERROR;
+	}
+
+	dict = PyModule_GetDict(m);
+	if (dict == NULL) {
+		/* Internal error -- modules must have a dict! */
+		PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m));
+		return SWIG_ERROR;
+	}
+	if (PyDict_SetItemString(dict, name, o))
+		return SWIG_ERROR;
+	Py_DECREF(o);
+	return SWIG_OK;
 }
 #endif
 
-SWIGRUNTIME void
-SWIG_Python_DestroyModule(void *vptr)
-{
-  swig_module_info *swig_module = (swig_module_info *) vptr;
-  swig_type_info **types = swig_module->types;
-  size_t i;
-  for (i =0; i < swig_module->size; ++i) {
-    swig_type_info *ty = types[i];
-    if (ty->owndata) {
-      PySwigClientData *data = (PySwigClientData *) ty->clientdata;
-      if (data) PySwigClientData_Del(data);
-    }
-  }
-  Py_DECREF(SWIG_This());
+SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr)
+{
+	swig_module_info *swig_module = (swig_module_info *) vptr;
+	swig_type_info **types = swig_module->types;
+	size_t i;
+	for (i = 0; i < swig_module->size; ++i) {
+		swig_type_info *ty = types[i];
+		if (ty->owndata) {
+			PySwigClientData *data = (PySwigClientData *) ty->clientdata;
+			if (data)
+				PySwigClientData_Del(data);
+		}
+	}
+	Py_DECREF(SWIG_This());
 }
 
-SWIGRUNTIME void
-SWIG_Python_SetModule(swig_module_info *swig_module) {
-  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
-
-  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
-				   swig_empty_runtime_method_table);
-  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
-  if (pointer && module) {
-    PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
-  } else {
-    Py_XDECREF(pointer);
-  }
+SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info * swig_module)
+{
+	static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };	/* Sentinel */
+
+	PyObject *module = Py_InitModule((char *) "swig_runtime_data" SWIG_RUNTIME_VERSION,
+									 swig_empty_runtime_method_table);
+	PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
+	if (pointer && module) {
+		PyModule_AddObject(module, (char *) "type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
+	} else {
+		Py_XDECREF(pointer);
+	}
 }
 
 /* The python cached type query */
-SWIGRUNTIME PyObject *
-SWIG_Python_TypeCache(void) {
-  static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
-  return cache;
-}
-
-SWIGRUNTIME swig_type_info *
-SWIG_Python_TypeQuery(const char *type)
-{
-  PyObject *cache = SWIG_Python_TypeCache();
-  PyObject *key = PyString_FromString(type); 
-  PyObject *obj = PyDict_GetItem(cache, key);
-  swig_type_info *descriptor;
-  if (obj) {
-    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
-  } else {
-    swig_module_info *swig_module = SWIG_Python_GetModule();
-    descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
-    if (descriptor) {
-      obj = PyCObject_FromVoidPtr(descriptor, NULL);
-      PyDict_SetItem(cache, key, obj);
-      Py_DECREF(obj);
-    }
-  }
-  Py_DECREF(key);
-  return descriptor;
+SWIGRUNTIME PyObject *SWIG_Python_TypeCache(void)
+{
+	static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
+	return cache;
+}
+
+SWIGRUNTIME swig_type_info *SWIG_Python_TypeQuery(const char *type)
+{
+	PyObject *cache = SWIG_Python_TypeCache();
+	PyObject *key = PyString_FromString(type);
+	PyObject *obj = PyDict_GetItem(cache, key);
+	swig_type_info *descriptor;
+	if (obj) {
+		descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
+	} else {
+		swig_module_info *swig_module = SWIG_Python_GetModule();
+		descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
+		if (descriptor) {
+			obj = PyCObject_FromVoidPtr(descriptor, NULL);
+			PyDict_SetItem(cache, key, obj);
+			Py_DECREF(obj);
+		}
+	}
+	Py_DECREF(key);
+	return descriptor;
 }
 
 /* 
@@ -2380,116 +2352,109 @@
 #define SWIG_arg_fail(arg)      SWIG_Python_ArgFail(arg)
 #define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)
 
-SWIGRUNTIME int
-SWIG_Python_AddErrMesg(const char* mesg, int infront)
+SWIGRUNTIME int SWIG_Python_AddErrMesg(const char *mesg, int infront)
 {
-  if (PyErr_Occurred()) {
-    PyObject *type = 0;
-    PyObject *value = 0;
-    PyObject *traceback = 0;
-    PyErr_Fetch(&type, &value, &traceback);
-    if (value) {
-      PyObject *old_str = PyObject_Str(value);
-      Py_XINCREF(type);
-      PyErr_Clear();
-      if (infront) {
-	PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
-      } else {
-	PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
-      }
-      Py_DECREF(old_str);
-    }
-    return 1;
-  } else {
-    return 0;
-  }
+	if (PyErr_Occurred()) {
+		PyObject *type = 0;
+		PyObject *value = 0;
+		PyObject *traceback = 0;
+		PyErr_Fetch(&type, &value, &traceback);
+		if (value) {
+			PyObject *old_str = PyObject_Str(value);
+			Py_XINCREF(type);
+			PyErr_Clear();
+			if (infront) {
+				PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
+			} else {
+				PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+			}
+			Py_DECREF(old_str);
+		}
+		return 1;
+	} else {
+		return 0;
+	}
 }
-  
-SWIGRUNTIME int
-SWIG_Python_ArgFail(int argnum)
+
+SWIGRUNTIME int SWIG_Python_ArgFail(int argnum)
 {
-  if (PyErr_Occurred()) {
-    /* add information about failing argument */
-    char mesg[256];
-    PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
-    return SWIG_Python_AddErrMesg(mesg, 1);
-  } else {
-    return 0;
-  }
+	if (PyErr_Occurred()) {
+		/* add information about failing argument */
+		char mesg[256];
+		PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
+		return SWIG_Python_AddErrMesg(mesg, 1);
+	} else {
+		return 0;
+	}
 }
 
-SWIGRUNTIMEINLINE const char *
-PySwigObject_GetDesc(PyObject *self)
+SWIGRUNTIMEINLINE const char *PySwigObject_GetDesc(PyObject * self)
 {
-  PySwigObject *v = (PySwigObject *)self;
-  swig_type_info *ty = v ? v->ty : 0;
-  return ty ? ty->str : (char*)"";
+	PySwigObject *v = (PySwigObject *) self;
+	swig_type_info *ty = v ? v->ty : 0;
+	return ty ? ty->str : (char *) "";
 }
 
-SWIGRUNTIME void
-SWIG_Python_TypeError(const char *type, PyObject *obj)
+SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject * obj)
 {
-  if (type) {
+	if (type) {
 #if defined(SWIG_COBJECT_TYPES)
-    if (obj && PySwigObject_Check(obj)) {
-      const char *otype = (const char *) PySwigObject_GetDesc(obj);
-      if (otype) {
-	PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
-		     type, otype);
-	return;
-      }
-    } else 
-#endif      
-    {
-      const char *otype = (obj ? obj->ob_type->tp_name : 0); 
-      if (otype) {
-	PyObject *str = PyObject_Str(obj);
-	const char *cstr = str ? PyString_AsString(str) : 0;
-	if (cstr) {
-	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
-		       type, otype, cstr);
+		if (obj && PySwigObject_Check(obj)) {
+			const char *otype = (const char *) PySwigObject_GetDesc(obj);
+			if (otype) {
+				PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received", type, otype);
+				return;
+			}
+		} else
+#endif
+		{
+			const char *otype = (obj ? obj->ob_type->tp_name : 0);
+			if (otype) {
+				PyObject *str = PyObject_Str(obj);
+				const char *cstr = str ? PyString_AsString(str) : 0;
+				if (cstr) {
+					PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr);
+				} else {
+					PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype);
+				}
+				Py_XDECREF(str);
+				return;
+			}
+		}
+		PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
 	} else {
-	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
-		       type, otype);
+		PyErr_Format(PyExc_TypeError, "unexpected type is received");
 	}
-	Py_XDECREF(str);
-	return;
-      }
-    }   
-    PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
-  } else {
-    PyErr_Format(PyExc_TypeError, "unexpected type is received");
-  }
 }
 
 
 /* Convert a pointer value, signal an exception on a type mismatch */
-SWIGRUNTIME void *
-SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
-  void *result;
-  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
-    PyErr_Clear();
-    if (flags & SWIG_POINTER_EXCEPTION) {
-      SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
-      SWIG_Python_ArgFail(argnum);
-    }
-  }
-  return result;
+SWIGRUNTIME void *SWIG_Python_MustGetPtr(PyObject * obj, swig_type_info * ty, int argnum, int flags)
+{
+	void *result;
+	if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
+		PyErr_Clear();
+		if (flags & SWIG_POINTER_EXCEPTION) {
+			SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
+			SWIG_Python_ArgFail(argnum);
+		}
+	}
+	return result;
 }
 
 
 #ifdef __cplusplus
 #if 0
-{ /* cc-mode */
+{								/* cc-mode */
 #endif
 }
 #endif
 
 
 
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
 
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
 
 
 
@@ -2516,7 +2481,8 @@
 #define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
 #define SWIGTYPE_p_void swig_types[19]
 static swig_type_info *swig_types[21];
-static swig_module_info swig_module = {swig_types, 20, 0, 0, 0, 0};
+static swig_module_info swig_module = { swig_types, 20, 0, 0, 0, 0 };
+
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -2535,76 +2501,59 @@
 
 #define SWIG_name    "_freeswitch"
 
-#define SWIGVERSION 0x010335 
+#define SWIGVERSION 0x010335
 #define SWIG_VERSION SWIGVERSION
 
 
-#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
 
 
 #include <stdexcept>
 
 
 namespace swig {
-  class PyObject_ptr {
-  protected:
-    PyObject *_obj;
+	class PyObject_ptr {
+	  protected:
+		PyObject * _obj;
+
+	  public:
+		PyObject_ptr():_obj(0) {
+		} PyObject_ptr(const PyObject_ptr & item):_obj(item._obj) {
+			Py_XINCREF(_obj);
+	  } PyObject_ptr(PyObject * obj, bool initial_ref = true):_obj(obj) {
+			if (initial_ref) {
+				Py_XINCREF(_obj);
+			}
+		}
 
-  public:
-    PyObject_ptr() :_obj(0)
-    {
-    }
+		PyObject_ptr & operator=(const PyObject_ptr & item) {
+			Py_XINCREF(item._obj);
+			Py_XDECREF(_obj);
+			_obj = item._obj;
+			return *this;
+		}
 
-    PyObject_ptr(const PyObject_ptr& item) : _obj(item._obj)
-    {
-      Py_XINCREF(_obj);      
-    }
-    
-    PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
-    {
-      if (initial_ref) {
-        Py_XINCREF(_obj);
-      }
-    }
-    
-    PyObject_ptr & operator=(const PyObject_ptr& item) 
-    {
-      Py_XINCREF(item._obj);
-      Py_XDECREF(_obj);
-      _obj = item._obj;
-      return *this;      
-    }
-    
-    ~PyObject_ptr() 
-    {
-      Py_XDECREF(_obj);
-    }
-    
-    operator PyObject *() const
-    {
-      return _obj;
-    }
+		~PyObject_ptr() {
+			Py_XDECREF(_obj);
+		}
 
-    PyObject *operator->() const
-    {
-      return _obj;
-    }
-  };
+		operator  PyObject *() const {
+			return _obj;
+		} PyObject *operator->() const {
+			return _obj;
+	}};
 }
 
 
 namespace swig {
-  struct PyObject_var : PyObject_ptr {
-    PyObject_var(PyObject* obj = 0) : PyObject_ptr(obj, false) { }
-    
-    PyObject_var & operator = (PyObject* obj)
-    {
-      Py_XDECREF(_obj);
-      _obj = obj;
-      return *this;      
-    }
-  };
+	struct PyObject_var:PyObject_ptr {
+	  PyObject_var(PyObject * obj = 0):PyObject_ptr(obj, false) {
+		} PyObject_var & operator =(PyObject * obj) {
+			Py_XDECREF(_obj);
+			_obj = obj;
+			return *this;
+	}};
 }
 
 
@@ -2612,68 +2561,70 @@
 #include "freeswitch_python.h"
 
 
-SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
+SWIGINTERN swig_type_info *SWIG_pchar_descriptor(void)
 {
-  static int init = 0;
-  static swig_type_info* info = 0;
-  if (!init) {
-    info = SWIG_TypeQuery("_p_char");
-    init = 1;
-  }
-  return info;
+	static int init = 0;
+	static swig_type_info *info = 0;
+	if (!init) {
+		info = SWIG_TypeQuery("_p_char");
+		init = 1;
+	}
+	return info;
 }
 
 
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
-{
-  if (PyString_Check(obj)) {
-    char *cstr; Py_ssize_t len;
-    PyString_AsStringAndSize(obj, &cstr, &len);
-    if (cptr)  {
-      if (alloc) {
-	/* 
-	   In python the user should not be able to modify the inner
-	   string representation. To warranty that, if you define
-	   SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
-	   buffer is always returned.
-
-	   The default behavior is just to return the pointer value,
-	   so, be careful.
-	*/ 
+SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject * obj, char **cptr, size_t *psize, int *alloc)
+{
+	if (PyString_Check(obj)) {
+		char *cstr;
+		Py_ssize_t len;
+		PyString_AsStringAndSize(obj, &cstr, &len);
+		if (cptr) {
+			if (alloc) {
+				/* 
+				   In python the user should not be able to modify the inner
+				   string representation. To warranty that, if you define
+				   SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
+				   buffer is always returned.
+
+				   The default behavior is just to return the pointer value,
+				   so, be careful.
+				 */
 #if defined(SWIG_PYTHON_SAFE_CSTRINGS)
-	if (*alloc != SWIG_OLDOBJ) 
+				if (*alloc != SWIG_OLDOBJ)
 #else
-	if (*alloc == SWIG_NEWOBJ) 
+				if (*alloc == SWIG_NEWOBJ)
 #endif
-	  {
-	    *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1)));
-	    *alloc = SWIG_NEWOBJ;
-	  }
-	else {
-	  *cptr = cstr;
-	  *alloc = SWIG_OLDOBJ;
+				{
+					*cptr = reinterpret_cast < char *>(memcpy((new char[len + 1]), cstr, sizeof(char) * (len + 1)));
+					*alloc = SWIG_NEWOBJ;
+				} else {
+					*cptr = cstr;
+					*alloc = SWIG_OLDOBJ;
+				}
+			} else {
+				*cptr = PyString_AsString(obj);
+			}
+		}
+		if (psize)
+			*psize = len + 1;
+		return SWIG_OK;
+	} else {
+		swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
+		if (pchar_descriptor) {
+			void *vptr = 0;
+			if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+				if (cptr)
+					*cptr = (char *) vptr;
+				if (psize)
+					*psize = vptr ? (strlen((char *) vptr) + 1) : 0;
+				if (alloc)
+					*alloc = SWIG_OLDOBJ;
+				return SWIG_OK;
+			}
+		}
 	}
-      } else {
-	*cptr = PyString_AsString(obj);
-      }
-    }
-    if (psize) *psize = len + 1;
-    return SWIG_OK;
-  } else {
-    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
-    if (pchar_descriptor) {
-      void* vptr = 0;
-      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
-	if (cptr) *cptr = (char *) vptr;
-	if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
-	if (alloc) *alloc = SWIG_OLDOBJ;
-	return SWIG_OK;
-      }
-    }
-  }
-  return SWIG_TypeError;
+	return SWIG_TypeError;
 }
 
 
@@ -2690,47 +2641,51 @@
 #endif
 
 
-SWIGINTERN int
-SWIG_AsVal_double (PyObject *obj, double *val)
+SWIGINTERN int SWIG_AsVal_double(PyObject * obj, double *val)
 {
-  int res = SWIG_TypeError;
-  if (PyFloat_Check(obj)) {
-    if (val) *val = PyFloat_AsDouble(obj);
-    return SWIG_OK;
-  } else if (PyInt_Check(obj)) {
-    if (val) *val = PyInt_AsLong(obj);
-    return SWIG_OK;
-  } else if (PyLong_Check(obj)) {
-    double v = PyLong_AsDouble(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_OK;
-    } else {
-      PyErr_Clear();
-    }
-  }
+	int res = SWIG_TypeError;
+	if (PyFloat_Check(obj)) {
+		if (val)
+			*val = PyFloat_AsDouble(obj);
+		return SWIG_OK;
+	} else if (PyInt_Check(obj)) {
+		if (val)
+			*val = PyInt_AsLong(obj);
+		return SWIG_OK;
+	} else if (PyLong_Check(obj)) {
+		double v = PyLong_AsDouble(obj);
+		if (!PyErr_Occurred()) {
+			if (val)
+				*val = v;
+			return SWIG_OK;
+		} else {
+			PyErr_Clear();
+		}
+	}
 #ifdef SWIG_PYTHON_CAST_MODE
-  {
-    int dispatch = 0;
-    double d = PyFloat_AsDouble(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = d;
-      return SWIG_AddCast(SWIG_OK);
-    } else {
-      PyErr_Clear();
-    }
-    if (!dispatch) {
-      long v = PyLong_AsLong(obj);
-      if (!PyErr_Occurred()) {
-	if (val) *val = v;
-	return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
-      } else {
-	PyErr_Clear();
-      }
-    }
-  }
+	{
+		int dispatch = 0;
+		double d = PyFloat_AsDouble(obj);
+		if (!PyErr_Occurred()) {
+			if (val)
+				*val = d;
+			return SWIG_AddCast(SWIG_OK);
+		} else {
+			PyErr_Clear();
+		}
+		if (!dispatch) {
+			long v = PyLong_AsLong(obj);
+			if (!PyErr_Occurred()) {
+				if (val)
+					*val = v;
+				return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
+			} else {
+				PyErr_Clear();
+			}
+		}
+	}
 #endif
-  return res;
+	return res;
 }
 
 
@@ -2740,5130 +2695,5461 @@
 #include <math.h>
 
 
-SWIGINTERNINLINE int
-SWIG_CanCastAsInteger(double *d, double min, double max) {
-  double x = *d;
-  if ((min <= x && x <= max)) {
-   double fx = floor(x);
-   double cx = ceil(x);
-   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
-   if ((errno == EDOM) || (errno == ERANGE)) {
-     errno = 0;
-   } else {
-     double summ, reps, diff;
-     if (rd < x) {
-       diff = x - rd;
-     } else if (rd > x) {
-       diff = rd - x;
-     } else {
-       return 1;
-     }
-     summ = rd + x;
-     reps = diff/summ;
-     if (reps < 8*DBL_EPSILON) {
-       *d = rd;
-       return 1;
-     }
-   }
-  }
-  return 0;
+SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max)
+{
+	double x = *d;
+	if ((min <= x && x <= max)) {
+		double fx = floor(x);
+		double cx = ceil(x);
+		double rd = ((x - fx) < 0.5) ? fx : cx;	/* simple rint */
+		if ((errno == EDOM) || (errno == ERANGE)) {
+			errno = 0;
+		} else {
+			double summ, reps, diff;
+			if (rd < x) {
+				diff = x - rd;
+			} else if (rd > x) {
+				diff = rd - x;
+			} else {
+				return 1;
+			}
+			summ = rd + x;
+			reps = diff / summ;
+			if (reps < 8 * DBL_EPSILON) {
+				*d = rd;
+				return 1;
+			}
+		}
+	}
+	return 0;
 }
 
 
-SWIGINTERN int
-SWIG_AsVal_long (PyObject *obj, long* val)
-{
-  if (PyInt_Check(obj)) {
-    if (val) *val = PyInt_AsLong(obj);
-    return SWIG_OK;
-  } else if (PyLong_Check(obj)) {
-    long v = PyLong_AsLong(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_OK;
-    } else {
-      PyErr_Clear();
-    }
-  }
+SWIGINTERN int SWIG_AsVal_long(PyObject * obj, long *val)
+{
+	if (PyInt_Check(obj)) {
+		if (val)
+			*val = PyInt_AsLong(obj);
+		return SWIG_OK;
+	} else if (PyLong_Check(obj)) {
+		long v = PyLong_AsLong(obj);
+		if (!PyErr_Occurred()) {
+			if (val)
+				*val = v;
+			return SWIG_OK;
+		} else {
+			PyErr_Clear();
+		}
+	}
 #ifdef SWIG_PYTHON_CAST_MODE
-  {
-    int dispatch = 0;
-    long v = PyInt_AsLong(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_AddCast(SWIG_OK);
-    } else {
-      PyErr_Clear();
-    }
-    if (!dispatch) {
-      double d;
-      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
-      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
-	if (val) *val = (long)(d);
-	return res;
-      }
-    }
-  }
+	{
+		int dispatch = 0;
+		long v = PyInt_AsLong(obj);
+		if (!PyErr_Occurred()) {
+			if (val)
+				*val = v;
+			return SWIG_AddCast(SWIG_OK);
+		} else {
+			PyErr_Clear();
+		}
+		if (!dispatch) {
+			double d;
+			int res = SWIG_AddCast(SWIG_AsVal_double(obj, &d));
+			if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+				if (val)
+					*val = (long) (d);
+				return res;
+			}
+		}
+	}
 #endif
-  return SWIG_TypeError;
+	return SWIG_TypeError;
 }
 
 
-SWIGINTERN int
-SWIG_AsVal_int (PyObject * obj, int *val)
+SWIGINTERN int SWIG_AsVal_int(PyObject * obj, int *val)
 {
-  long v;
-  int res = SWIG_AsVal_long (obj, &v);
-  if (SWIG_IsOK(res)) {
-    if ((v < INT_MIN || v > INT_MAX)) {
-      return SWIG_OverflowError;
-    } else {
-      if (val) *val = static_cast< int >(v);
-    }
-  }  
-  return res;
+	long v;
+	int res = SWIG_AsVal_long(obj, &v);
+	if (SWIG_IsOK(res)) {
+		if ((v < INT_MIN || v > INT_MAX)) {
+			return SWIG_OverflowError;
+		} else {
+			if (val)
+				*val = static_cast < int >(v);
+		}
+	}
+	return res;
 }
 
 
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+SWIGINTERNINLINE PyObject *SWIG_FromCharPtrAndSize(const char *carray, size_t size)
 {
-  if (carray) {
-    if (size > INT_MAX) {
-      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
-      return pchar_descriptor ? 
-	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
-    } else {
-      return PyString_FromStringAndSize(carray, static_cast< int >(size));
-    }
-  } else {
-    return SWIG_Py_Void();
-  }
+	if (carray) {
+		if (size > INT_MAX) {
+			swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
+			return pchar_descriptor ? SWIG_NewPointerObj(const_cast < char *>(carray), pchar_descriptor, 0) : SWIG_Py_Void();
+		} else {
+			return PyString_FromStringAndSize(carray, static_cast < int >(size));
+		}
+	} else {
+		return SWIG_Py_Void();
+	}
 }
 
 
-SWIGINTERNINLINE PyObject * 
-SWIG_FromCharPtr(const char *cptr)
-{ 
-  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+SWIGINTERNINLINE PyObject *SWIG_FromCharPtr(const char *cptr)
+{
+	return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
 }
 
 
-  #define SWIG_From_long   PyInt_FromLong 
+#define SWIG_From_long   PyInt_FromLong
 
 
-SWIGINTERNINLINE PyObject *
-SWIG_From_int  (int value)
-{    
-  return SWIG_From_long  (value);
+SWIGINTERNINLINE PyObject *SWIG_From_int(int value)
+{
+	return SWIG_From_long(value);
 }
 
 
-SWIGINTERNINLINE PyObject*
-  SWIG_From_bool  (bool value)
+SWIGINTERNINLINE PyObject *SWIG_From_bool(bool value)
 {
-  return PyBool_FromLong(value ? 1 : 0);
+	return PyBool_FromLong(value ? 1 : 0);
 }
 
 
-SWIGINTERN int
-SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) 
+SWIGINTERN int SWIG_AsVal_unsigned_SS_long(PyObject * obj, unsigned long *val)
 {
-  if (PyInt_Check(obj)) {
-    long v = PyInt_AsLong(obj);
-    if (v >= 0) {
-      if (val) *val = v;
-      return SWIG_OK;
-    } else {
-      return SWIG_OverflowError;
-    }
-  } else if (PyLong_Check(obj)) {
-    unsigned long v = PyLong_AsUnsignedLong(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_OK;
-    } else {
-      PyErr_Clear();
-    }
-  }
+	if (PyInt_Check(obj)) {
+		long v = PyInt_AsLong(obj);
+		if (v >= 0) {
+			if (val)
+				*val = v;
+			return SWIG_OK;
+		} else {
+			return SWIG_OverflowError;
+		}
+	} else if (PyLong_Check(obj)) {
+		unsigned long v = PyLong_AsUnsignedLong(obj);
+		if (!PyErr_Occurred()) {
+			if (val)
+				*val = v;
+			return SWIG_OK;
+		} else {
+			PyErr_Clear();
+		}
+	}
 #ifdef SWIG_PYTHON_CAST_MODE
-  {
-    int dispatch = 0;
-    unsigned long v = PyLong_AsUnsignedLong(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_AddCast(SWIG_OK);
-    } else {
-      PyErr_Clear();
-    }
-    if (!dispatch) {
-      double d;
-      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
-      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
-	if (val) *val = (unsigned long)(d);
-	return res;
-      }
-    }
-  }
+	{
+		int dispatch = 0;
+		unsigned long v = PyLong_AsUnsignedLong(obj);
+		if (!PyErr_Occurred()) {
+			if (val)
+				*val = v;
+			return SWIG_AddCast(SWIG_OK);
+		} else {
+			PyErr_Clear();
+		}
+		if (!dispatch) {
+			double d;
+			int res = SWIG_AddCast(SWIG_AsVal_double(obj, &d));
+			if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+				if (val)
+					*val = (unsigned long) (d);
+				return res;
+			}
+		}
+	}
 #endif
-  return SWIG_TypeError;
+	return SWIG_TypeError;
 }
 
 
-SWIGINTERN int
-SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
+SWIGINTERN int SWIG_AsVal_unsigned_SS_int(PyObject * obj, unsigned int *val)
 {
-  unsigned long v;
-  int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
-  if (SWIG_IsOK(res)) {
-    if ((v > UINT_MAX)) {
-      return SWIG_OverflowError;
-    } else {
-      if (val) *val = static_cast< unsigned int >(v);
-    }
-  }  
-  return res;
+	unsigned long v;
+	int res = SWIG_AsVal_unsigned_SS_long(obj, &v);
+	if (SWIG_IsOK(res)) {
+		if ((v > UINT_MAX)) {
+			return SWIG_OverflowError;
+		} else {
+			if (val)
+				*val = static_cast < unsigned int >(v);
+		}
+	}
+	return res;
 }
 
 
-SWIGINTERNINLINE PyObject* 
-SWIG_From_unsigned_SS_long  (unsigned long value)
+SWIGINTERNINLINE PyObject *SWIG_From_unsigned_SS_long(unsigned long value)
 {
-  return (value > LONG_MAX) ?
-    PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value)); 
+	return (value > LONG_MAX) ? PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast < long >(value));
 }
 
 
-SWIGINTERNINLINE PyObject *
-SWIG_From_unsigned_SS_int  (unsigned int value)
-{    
-  return SWIG_From_unsigned_SS_long  (value);
+SWIGINTERNINLINE PyObject *SWIG_From_unsigned_SS_int(unsigned int value)
+{
+	return SWIG_From_unsigned_SS_long(value);
 }
 
 
-SWIGINTERN int
-SWIG_AsVal_bool (PyObject *obj, bool *val)
+SWIGINTERN int SWIG_AsVal_bool(PyObject * obj, bool * val)
 {
-  int r = PyObject_IsTrue(obj);
-  if (r == -1)
-    return SWIG_ERROR;
-  if (val) *val = r ? true : false;
-  return SWIG_OK;
+	int r = PyObject_IsTrue(obj);
+	if (r == -1)
+		return SWIG_ERROR;
+	if (val)
+		*val = r ? true : false;
+	return SWIG_OK;
 }
 
 #ifdef __cplusplus
 extern "C" {
 #endif
-SWIGINTERN PyObject *_wrap_consoleLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int res1 ;
-  char *buf1 = 0 ;
-  int alloc1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:consoleLog",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1"" of type '" "char *""'");
-  }
-  arg1 = reinterpret_cast< char * >(buf1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  consoleLog(arg1,arg2);
-  resultobj = SWIG_Py_Void();
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_consoleLog(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		char *arg1 = (char *) 0;
+		char *arg2 = (char *) 0;
+		int res1;
+		char *buf1 = 0;
+		int alloc1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if       (!PyArg_ParseTuple(args, (char *) "OO:consoleLog", &obj0, &obj1))
+			         SWIG_fail;
+		         res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+		if       (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1" " of type '" "char *" "'");
+		}
+		arg1 = reinterpret_cast < char *>(buf1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		consoleLog(arg1, arg2);
+		resultobj = SWIG_Py_Void();
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_consoleCleanLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  char *arg1 = (char *) 0 ;
-  int res1 ;
-  char *buf1 = 0 ;
-  int alloc1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:consoleCleanLog",&obj0)) SWIG_fail;
-  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1"" of type '" "char *""'");
-  }
-  arg1 = reinterpret_cast< char * >(buf1);
-  consoleCleanLog(arg1);
-  resultobj = SWIG_Py_Void();
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  return resultobj;
-fail:
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  int arg9 ;
-  int arg10 ;
-  int arg11 ;
-  int arg12 ;
-  int arg13 ;
-  IVRMenu *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  int res4 ;
-  char *buf4 = 0 ;
-  int alloc4 = 0 ;
-  int res5 ;
-  char *buf5 = 0 ;
-  int alloc5 = 0 ;
-  int res6 ;
-  char *buf6 = 0 ;
-  int alloc6 = 0 ;
-  int res7 ;
-  char *buf7 = 0 ;
-  int alloc7 = 0 ;
-  int res8 ;
-  char *buf8 = 0 ;
-  int alloc8 = 0 ;
-  int val9 ;
-  int ecode9 = 0 ;
-  int val10 ;
-  int ecode10 = 0 ;
-  int val11 ;
-  int ecode11 = 0 ;
-  int val12 ;
-  int ecode12 = 0 ;
-  int val13 ;
-  int ecode13 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  PyObject * obj5 = 0 ;
-  PyObject * obj6 = 0 ;
-  PyObject * obj7 = 0 ;
-  PyObject * obj8 = 0 ;
-  PyObject * obj9 = 0 ;
-  PyObject * obj10 = 0 ;
-  PyObject * obj11 = 0 ;
-  PyObject * obj12 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); 
-  }
-  arg1 = reinterpret_cast< IVRMenu * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3"" of type '" "char const *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-  if (!SWIG_IsOK(res4)) {
-    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4"" of type '" "char const *""'");
-  }
-  arg4 = reinterpret_cast< char * >(buf4);
-  res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
-  if (!SWIG_IsOK(res5)) {
-    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5"" of type '" "char const *""'");
-  }
-  arg5 = reinterpret_cast< char * >(buf5);
-  res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
-  if (!SWIG_IsOK(res6)) {
-    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6"" of type '" "char const *""'");
-  }
-  arg6 = reinterpret_cast< char * >(buf6);
-  res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
-  if (!SWIG_IsOK(res7)) {
-    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7"" of type '" "char const *""'");
-  }
-  arg7 = reinterpret_cast< char * >(buf7);
-  res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
-  if (!SWIG_IsOK(res8)) {
-    SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
-  }
-  arg8 = reinterpret_cast< char * >(buf8);
-  ecode9 = SWIG_AsVal_int(obj8, &val9);
-  if (!SWIG_IsOK(ecode9)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
-  } 
-  arg9 = static_cast< int >(val9);
-  ecode10 = SWIG_AsVal_int(obj9, &val10);
-  if (!SWIG_IsOK(ecode10)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
-  } 
-  arg10 = static_cast< int >(val10);
-  ecode11 = SWIG_AsVal_int(obj10, &val11);
-  if (!SWIG_IsOK(ecode11)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
-  } 
-  arg11 = static_cast< int >(val11);
-  ecode12 = SWIG_AsVal_int(obj11, &val12);
-  if (!SWIG_IsOK(ecode12)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'");
-  } 
-  arg12 = static_cast< int >(val12);
-  ecode13 = SWIG_AsVal_int(obj12, &val13);
-  if (!SWIG_IsOK(ecode13)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
-  } 
-  arg13 = static_cast< int >(val13);
-  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW |  0 );
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
-  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
-  if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
-  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
-  if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_delete_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_IVRMenu",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); 
-  }
-  arg1 = reinterpret_cast< IVRMenu * >(argp1);
-  delete arg1;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_consoleCleanLog(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		char *arg1 = (char *) 0;
+		int res1;
+		char *buf1 = 0;
+		int alloc1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:consoleCleanLog", &obj0))
+			SWIG_fail;
+		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1" " of type '" "char *" "'");
+		}
+		arg1 = reinterpret_cast < char *>(buf1);
+		consoleCleanLog(arg1);
+		resultobj = SWIG_Py_Void();
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		return resultobj;
+	  fail:
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_IVRMenu_bindAction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  int res4 ;
-  char *buf4 = 0 ;
-  int alloc4 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOO:IVRMenu_bindAction",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1"" of type '" "IVRMenu *""'"); 
-  }
-  arg1 = reinterpret_cast< IVRMenu * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3"" of type '" "char const *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-  if (!SWIG_IsOK(res4)) {
-    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4"" of type '" "char const *""'");
-  }
-  arg4 = reinterpret_cast< char * >(buf4);
-  (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		IVRMenu *arg1 = (IVRMenu *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+		char *arg5 = (char *) 0;
+		char *arg6 = (char *) 0;
+		char *arg7 = (char *) 0;
+		char *arg8 = (char *) 0;
+		int arg9;
+		int arg10;
+		int arg11;
+		int arg12;
+		int arg13;
+		IVRMenu *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		int res4;
+		char *buf4 = 0;
+		int alloc4 = 0;
+		int res5;
+		char *buf5 = 0;
+		int alloc5 = 0;
+		int res6;
+		char *buf6 = 0;
+		int alloc6 = 0;
+		int res7;
+		char *buf7 = 0;
+		int alloc7 = 0;
+		int res8;
+		char *buf8 = 0;
+		int alloc8 = 0;
+		int val9;
+		int ecode9 = 0;
+		int val10;
+		int ecode10 = 0;
+		int val11;
+		int ecode11 = 0;
+		int val12;
+		int ecode12 = 0;
+		int val13;
+		int ecode13 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+		PyObject *obj4 = 0;
+		PyObject *obj5 = 0;
+		PyObject *obj6 = 0;
+		PyObject *obj7 = 0;
+		PyObject *obj8 = 0;
+		PyObject *obj9 = 0;
+		PyObject *obj10 = 0;
+		PyObject *obj11 = 0;
+		PyObject *obj12 = 0;
+
+		if (!PyArg_ParseTuple
+			(args, (char *) "OOOOOOOOOOOOO:new_IVRMenu", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5, &obj6, &obj7, &obj8, &obj9, &obj10, &obj11, &obj12))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
+		}
+		arg1 = reinterpret_cast < IVRMenu * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3" " of type '" "char const *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+		if (!SWIG_IsOK(res4)) {
+			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4" " of type '" "char const *" "'");
+		}
+		arg4 = reinterpret_cast < char *>(buf4);
+		res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
+		if (!SWIG_IsOK(res5)) {
+			SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5" " of type '" "char const *" "'");
+		}
+		arg5 = reinterpret_cast < char *>(buf5);
+		res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+		if (!SWIG_IsOK(res6)) {
+			SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6" " of type '" "char const *" "'");
+		}
+		arg6 = reinterpret_cast < char *>(buf6);
+		res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
+		if (!SWIG_IsOK(res7)) {
+			SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7" " of type '" "char const *" "'");
+		}
+		arg7 = reinterpret_cast < char *>(buf7);
+		res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
+		if (!SWIG_IsOK(res8)) {
+			SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8" " of type '" "char const *" "'");
+		}
+		arg8 = reinterpret_cast < char *>(buf8);
+		ecode9 = SWIG_AsVal_int(obj8, &val9);
+		if (!SWIG_IsOK(ecode9)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9" " of type '" "int" "'");
+		}
+		arg9 = static_cast < int >(val9);
+		ecode10 = SWIG_AsVal_int(obj9, &val10);
+		if (!SWIG_IsOK(ecode10)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10" " of type '" "int" "'");
+		}
+		arg10 = static_cast < int >(val10);
+		ecode11 = SWIG_AsVal_int(obj10, &val11);
+		if (!SWIG_IsOK(ecode11)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11" " of type '" "int" "'");
+		}
+		arg11 = static_cast < int >(val11);
+		ecode12 = SWIG_AsVal_int(obj11, &val12);
+		if (!SWIG_IsOK(ecode12)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12" " of type '" "int" "'");
+		}
+		arg12 = static_cast < int >(val12);
+		ecode13 = SWIG_AsVal_int(obj12, &val13);
+		if (!SWIG_IsOK(ecode13)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13" " of type '" "int" "'");
+		}
+		arg13 = static_cast < int >(val13);
+		result =
+			(IVRMenu *) new IVRMenu(arg1, (char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5, (char const *) arg6,
+									(char const *) arg7, (char const *) arg8, arg9, arg10, arg11, arg12, arg13);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW | 0);
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		if (alloc5 == SWIG_NEWOBJ)
+			delete[]buf5;
+		if (alloc6 == SWIG_NEWOBJ)
+			delete[]buf6;
+		if (alloc7 == SWIG_NEWOBJ)
+			delete[]buf7;
+		if (alloc8 == SWIG_NEWOBJ)
+			delete[]buf8;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		if (alloc5 == SWIG_NEWOBJ)
+			delete[]buf5;
+		if (alloc6 == SWIG_NEWOBJ)
+			delete[]buf6;
+		if (alloc7 == SWIG_NEWOBJ)
+			delete[]buf7;
+		if (alloc8 == SWIG_NEWOBJ)
+			delete[]buf8;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_IVRMenu_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  CoreSession *arg2 = (CoreSession *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:IVRMenu_execute",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1"" of type '" "IVRMenu *""'"); 
-  }
-  arg1 = reinterpret_cast< IVRMenu * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2"" of type '" "CoreSession *""'"); 
-  }
-  arg2 = reinterpret_cast< CoreSession * >(argp2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3"" of type '" "char const *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->execute(arg2,(char const *)arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_delete_IVRMenu(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		IVRMenu *arg1 = (IVRMenu *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:delete_IVRMenu", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
+		}
+		arg1 = reinterpret_cast < IVRMenu * >(argp1);
+		delete arg1;
 
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *IVRMenu_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_IVRMenu, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_new_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  API *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)":new_API")) SWIG_fail;
-  result = (API *)new API();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_IVRMenu_bindAction(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		IVRMenu *arg1 = (IVRMenu *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		int res4;
+		char *buf4 = 0;
+		int alloc4 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOO:IVRMenu_bindAction", &obj0, &obj1, &obj2, &obj3))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1" " of type '" "IVRMenu *" "'");
+		}
+		arg1 = reinterpret_cast < IVRMenu * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3" " of type '" "char const *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+		if (!SWIG_IsOK(res4)) {
+			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4" " of type '" "char const *" "'");
+		}
+		arg4 = reinterpret_cast < char *>(buf4);
+		(arg1)->bindAction(arg2, (char const *) arg3, (char const *) arg4);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_delete_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  API *arg1 = (API *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_API",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1"" of type '" "API *""'"); 
-  }
-  arg1 = reinterpret_cast< API * >(argp1);
-  delete arg1;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_IVRMenu_execute(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		IVRMenu *arg1 = (IVRMenu *) 0;
+		CoreSession *arg2 = (CoreSession *) 0;
+		char *arg3 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:IVRMenu_execute", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1" " of type '" "IVRMenu *" "'");
+		}
+		arg1 = reinterpret_cast < IVRMenu * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2" " of type '" "CoreSession *" "'");
+		}
+		arg2 = reinterpret_cast < CoreSession * >(argp2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3" " of type '" "char const *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		(arg1)->execute(arg2, (char const *) arg3);
+		resultobj = SWIG_Py_Void();
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_API_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  API *arg1 = (API *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:API_execute",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1"" of type '" "API *""'"); 
-  }
-  arg1 = reinterpret_cast< API * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3"" of type '" "char const *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *IVRMenu_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *obj;
+		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+			return NULL;
+		SWIG_TypeNewClientData(SWIGTYPE_p_IVRMenu, SWIG_NewClientData(obj));
+		return SWIG_Py_Void();
+	}
 
-SWIGINTERN PyObject *_wrap_API_executeString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  API *arg1 = (API *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:API_executeString",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1"" of type '" "API *""'"); 
-  }
-  arg1 = reinterpret_cast< API * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (char *)(arg1)->executeString((char const *)arg2);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_new_API(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		API *result = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) ":new_API"))
+			SWIG_fail;
+		result = (API *) new API();
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_POINTER_NEW | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *API_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_input_callback_state_t_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_function_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-  }
-  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2"" of type '" "void *""'"); 
-  }
-  if (arg1) (arg1)->function = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_delete_API(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		API *arg1 = (API *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:delete_API", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1" " of type '" "API *" "'");
+		}
+		arg1 = reinterpret_cast < API * >(argp1);
+		delete arg1;
 
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_input_callback_state_t_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_function_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-  }
-  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-  result = (void *) ((arg1)->function);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_API_execute(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		API *arg1 = (API *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:API_execute", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_API, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1" " of type '" "API *" "'");
+		}
+		arg1 = reinterpret_cast < API * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3" " of type '" "char const *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		result = (char *) (arg1)->execute((char const *) arg2, (char const *) arg3);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_threadState_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-  }
-  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2"" of type '" "void *""'"); 
-  }
-  if (arg1) (arg1)->threadState = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_API_executeString(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		API *arg1 = (API *) 0;
+		char *arg2 = (char *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:API_executeString", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_API, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1" " of type '" "API *" "'");
+		}
+		arg1 = reinterpret_cast < API * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (char *) (arg1)->executeString((char const *) arg2);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_threadState_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-  }
-  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-  result = (void *) ((arg1)->threadState);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *API_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *obj;
+		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+			return NULL;
+		SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj));
+		return SWIG_Py_Void();
+	}
 
-SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_extra_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-  }
-  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2"" of type '" "void *""'"); 
-  }
-  if (arg1) (arg1)->extra = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_input_callback_state_t_function_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *arg2 = (void *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_function_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "input_callback_state_t_function_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+		}
+		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2" " of type '" "void *" "'");
+		}
+		if (arg1)
+			(arg1)->function = arg2;
 
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_extra_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-  }
-  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-  result = (void *) ((arg1)->extra);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_input_callback_state_t_function_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_function_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "input_callback_state_t_function_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+		}
+		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+		result = (void *) ((arg1)->function);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_funcargs_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-  }
-  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  if (arg1->funcargs) delete[] arg1->funcargs;
-  if (arg2) {
-    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
-    arg1->funcargs = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
-  } else {
-    arg1->funcargs = 0;
-  }
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *arg2 = (void *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_threadState_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "input_callback_state_t_threadState_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+		}
+		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2" " of type '" "void *" "'");
+		}
+		if (arg1)
+			(arg1)->threadState = arg2;
 
-SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_funcargs_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-  }
-  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-  result = (char *) ((arg1)->funcargs);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_new_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)":new_input_callback_state_t")) SWIG_fail;
-  result = (input_callback_state_t *)new input_callback_state_t();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_threadState_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "input_callback_state_t_threadState_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+		}
+		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+		result = (void *) ((arg1)->threadState);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_delete_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_input_callback_state_t",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state_t" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
-  }
-  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
-  delete arg1;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *arg2 = (void *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_extra_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "input_callback_state_t_extra_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+		}
+		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2" " of type '" "void *" "'");
+		}
+		if (arg1)
+			(arg1)->extra = arg2;
 
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
 
-SWIGINTERN PyObject *_wrap_new_Stream__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Stream *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)":new_Stream")) SWIG_fail;
-  result = (Stream *)new Stream();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_extra_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "input_callback_state_t_extra_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+		}
+		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+		result = (void *) ((arg1)->extra);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_new_Stream__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
-  Stream *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:new_Stream",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_stream_handle_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1"" of type '" "switch_stream_handle_t *""'"); 
-  }
-  arg1 = reinterpret_cast< switch_stream_handle_t * >(argp1);
-  result = (Stream *)new Stream(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		char *arg2 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_funcargs_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "input_callback_state_t_funcargs_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+		}
+		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		if (arg1->funcargs)
+			delete[]arg1->funcargs;
+		if (arg2) {
+			size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+			arg1->funcargs = (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+		} else {
+			arg1->funcargs = 0;
+		}
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_new_Stream(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[2];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 0) {
-    return _wrap_new_Stream__SWIG_0(self, args);
-  }
-  if (argc == 1) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_Stream__SWIG_1(self, args);
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Stream'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    Stream()\n"
-    "    Stream(switch_stream_handle_t *)\n");
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_funcargs_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "input_callback_state_t_funcargs_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+		}
+		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+		result = (char *) ((arg1)->funcargs);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_delete_Stream(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Stream *arg1 = (Stream *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_Stream",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1"" of type '" "Stream *""'"); 
-  }
-  arg1 = reinterpret_cast< Stream * >(argp1);
-  delete arg1;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_new_input_callback_state_t(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *result = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) ":new_input_callback_state_t"))
+			SWIG_fail;
+		result = (input_callback_state_t *) new input_callback_state_t();
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_Stream_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Stream *arg1 = (Stream *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:Stream_write",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1"" of type '" "Stream *""'"); 
-  }
-  arg1 = reinterpret_cast< Stream * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  (arg1)->write((char const *)arg2);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_delete_input_callback_state_t(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:delete_input_callback_state_t", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "delete_input_callback_state_t" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+		}
+		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+		delete arg1;
 
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Stream_get_data(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Stream *arg1 = (Stream *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Stream_get_data",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1"" of type '" "Stream *""'"); 
-  }
-  arg1 = reinterpret_cast< Stream * >(argp1);
-  result = (char *)(arg1)->get_data();
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *obj;
+		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+			return NULL;
+		SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
+		return SWIG_Py_Void();
+	}
 
-SWIGINTERN PyObject *Stream_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_Stream, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_Event_event_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:Event_event_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2"" of type '" "switch_event_t *""'"); 
-  }
-  arg2 = reinterpret_cast< switch_event_t * >(argp2);
-  if (arg1) (arg1)->event = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_new_Stream__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Stream *result = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) ":new_Stream"))
+			SWIG_fail;
+		result = (Stream *) new Stream();
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_Event_event_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  switch_event_t *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Event_event_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  result = (switch_event_t *) ((arg1)->event);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_new_Stream__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0;
+		Stream *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:new_Stream", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_stream_handle_t, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1" " of type '" "switch_stream_handle_t *" "'");
+		}
+		arg1 = reinterpret_cast < switch_stream_handle_t *>(argp1);
+		result = (Stream *) new Stream(arg1);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_Event_serialized_string_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:Event_serialized_string_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  if (arg1->serialized_string) delete[] arg1->serialized_string;
-  if (arg2) {
-    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
-    arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
-  } else {
-    arg1->serialized_string = 0;
-  }
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_new_Stream(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[2];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 0) {
+			return _wrap_new_Stream__SWIG_0(self, args);
+		}
+		if (argc == 1) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				return _wrap_new_Stream__SWIG_1(self, args);
+			}
+		}
 
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'new_Stream'.\n"
+						 "  Possible C/C++ prototypes are:\n" "    Stream()\n" "    Stream(switch_stream_handle_t *)\n");
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_serialized_string_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Event_serialized_string_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  result = (char *) ((arg1)->serialized_string);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_delete_Stream(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Stream *arg1 = (Stream *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:delete_Stream", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1" " of type '" "Stream *" "'");
+		}
+		arg1 = reinterpret_cast < Stream * >(argp1);
+		delete arg1;
 
-SWIGINTERN PyObject *_wrap_Event_mine_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  int arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:Event_mine_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  if (arg1) (arg1)->mine = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_Event_mine_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Event_mine_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  result = (int) ((arg1)->mine);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_Stream_write(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Stream *arg1 = (Stream *) 0;
+		char *arg2 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:Stream_write", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Stream, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1" " of type '" "Stream *" "'");
+		}
+		arg1 = reinterpret_cast < Stream * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		(arg1)->write((char const *) arg2);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_new_Event__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  Event *result = 0 ;
-  int res1 ;
-  char *buf1 = 0 ;
-  int alloc1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:new_Event",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
-  }
-  arg1 = reinterpret_cast< char * >(buf1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (Event *)new Event((char const *)arg1,(char const *)arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW |  0 );
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_Stream_get_data(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Stream *arg1 = (Stream *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:Stream_get_data", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Stream, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1" " of type '" "Stream *" "'");
+		}
+		arg1 = reinterpret_cast < Stream * >(argp1);
+		result = (char *) (arg1)->get_data();
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_new_Event__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  char *arg1 = (char *) 0 ;
-  Event *result = 0 ;
-  int res1 ;
-  char *buf1 = 0 ;
-  int alloc1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:new_Event",&obj0)) SWIG_fail;
-  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
-  }
-  arg1 = reinterpret_cast< char * >(buf1);
-  result = (Event *)new Event((char const *)arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW |  0 );
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  return resultobj;
-fail:
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  return NULL;
-}
+	SWIGINTERN PyObject *Stream_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *obj;
+		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+			return NULL;
+		SWIG_TypeNewClientData(SWIGTYPE_p_Stream, SWIG_NewClientData(obj));
+		return SWIG_Py_Void();
+	}
 
+	SWIGINTERN PyObject *_wrap_Event_event_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		switch_event_t *arg2 = (switch_event_t *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:Event_event_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2" " of type '" "switch_event_t *" "'");
+		}
+		arg2 = reinterpret_cast < switch_event_t *>(argp2);
+		if (arg1)
+			(arg1)->event = arg2;
+
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_new_Event__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  int arg2 ;
-  Event *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:new_Event",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_event_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'"); 
-  }
-  arg1 = reinterpret_cast< switch_event_t * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  result = (Event *)new Event(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_event_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		switch_event_t *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:Event_event_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		result = (switch_event_t *) ((arg1)->event);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_new_Event__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  Event *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:new_Event",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_event_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'"); 
-  }
-  arg1 = reinterpret_cast< switch_event_t * >(argp1);
-  result = (Event *)new Event(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_serialized_string_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:Event_serialized_string_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		if (arg1->serialized_string)
+			delete[]arg1->serialized_string;
+		if (arg2) {
+			size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+			arg1->serialized_string =
+				(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+		} else {
+			arg1->serialized_string = 0;
+		}
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_new_Event(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 1) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_Event__SWIG_3(self, args);
-    }
-  }
-  if (argc == 1) {
-    int _v;
-    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_Event__SWIG_1(self, args);
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_new_Event__SWIG_2(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_new_Event__SWIG_0(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Event'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    Event(char const *,char const *)\n"
-    "    Event(char const *)\n"
-    "    Event(switch_event_t *,int)\n"
-    "    Event(switch_event_t *)\n");
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_serialized_string_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:Event_serialized_string_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		result = (char *) ((arg1)->serialized_string);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_delete_Event(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_Event",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  delete arg1;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_mine_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		int arg2;
+		void *argp1 = 0;
+		int res1 = 0;
+		int val2;
+		int ecode2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:Event_mine_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		ecode2 = SWIG_AsVal_int(obj1, &val2);
+		if (!SWIG_IsOK(ecode2)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2" " of type '" "int" "'");
+		}
+		arg2 = static_cast < int >(val2);
+		if (arg1)
+			(arg1)->mine = arg2;
+
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:Event_serialize",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (char *)(arg1)->serialize((char const *)arg2);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_mine_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:Event_mine_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		result = (int) ((arg1)->mine);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Event_serialize",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  result = (char *)(arg1)->serialize();
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_new_Event__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		char *arg1 = (char *) 0;
+		char *arg2 = (char *) 0;
+		Event *result = 0;
+		int res1;
+		char *buf1 = 0;
+		int alloc1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:new_Event", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
+		}
+		arg1 = reinterpret_cast < char *>(buf1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (Event *) new Event((char const *) arg1, (char const *) arg2);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_serialize(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 1) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_Event_serialize__SWIG_1(self, args);
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_Event_serialize__SWIG_0(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_serialize'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    serialize(Event *,char const *)\n"
-    "    serialize(Event *)\n");
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_new_Event__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		char *arg1 = (char *) 0;
+		Event *result = 0;
+		int res1;
+		char *buf1 = 0;
+		int alloc1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:new_Event", &obj0))
+			SWIG_fail;
+		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
+		}
+		arg1 = reinterpret_cast < char *>(buf1);
+		result = (Event *) new Event((char const *) arg1);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		return resultobj;
+	  fail:
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  switch_priority_t arg2 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:Event_setPriority",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  {
-    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_priority_t,  0  | 0);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'"); 
-    }  
-    if (!argp2) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'");
-    } else {
-      switch_priority_t * temp = reinterpret_cast< switch_priority_t * >(argp2);
-      arg2 = *temp;
-      if (SWIG_IsNewObj(res2)) delete temp;
-    }
-  }
-  result = (bool)(arg1)->setPriority(arg2);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_new_Event__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		switch_event_t *arg1 = (switch_event_t *) 0;
+		int arg2;
+		Event *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int val2;
+		int ecode2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:new_Event", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
+		}
+		arg1 = reinterpret_cast < switch_event_t *>(argp1);
+		ecode2 = SWIG_AsVal_int(obj1, &val2);
+		if (!SWIG_IsOK(ecode2)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2" " of type '" "int" "'");
+		}
+		arg2 = static_cast < int >(val2);
+		result = (Event *) new Event(arg1, arg2);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Event_setPriority",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  result = (bool)(arg1)->setPriority();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_new_Event__SWIG_3(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		switch_event_t *arg1 = (switch_event_t *) 0;
+		Event *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:new_Event", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
+		}
+		arg1 = reinterpret_cast < switch_event_t *>(argp1);
+		result = (Event *) new Event(arg1);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_setPriority(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 1) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_Event_setPriority__SWIG_1(self, args);
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_switch_priority_t, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_Event_setPriority__SWIG_0(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_setPriority'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    setPriority(Event *,switch_priority_t)\n"
-    "    setPriority(Event *)\n");
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_new_Event(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[3];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 1) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				return _wrap_new_Event__SWIG_3(self, args);
+			}
+		}
+		if (argc == 1) {
+			int _v;
+			int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				return _wrap_new_Event__SWIG_1(self, args);
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				{
+					int res = SWIG_AsVal_int(argv[1], NULL);
+					_v = SWIG_CheckState(res);
+				}
+				if (_v) {
+					return _wrap_new_Event__SWIG_2(self, args);
+				}
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					return _wrap_new_Event__SWIG_0(self, args);
+				}
+			}
+		}
 
-SWIGINTERN PyObject *_wrap_Event_getHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:Event_getHeader",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (char *)(arg1)->getHeader(arg2);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'new_Event'.\n"
+						 "  Possible C/C++ prototypes are:\n"
+						 "    Event(char const *,char const *)\n"
+						 "    Event(char const *)\n" "    Event(switch_event_t *,int)\n" "    Event(switch_event_t *)\n");
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_Event_getBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Event_getBody",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  result = (char *)(arg1)->getBody();
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_delete_Event(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:delete_Event", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		delete arg1;
 
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_getType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Event_getType",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  result = (char *)(arg1)->getType();
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:Event_serialize", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (char *) (arg1)->serialize((char const *) arg2);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_addBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:Event_addBody",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (bool)(arg1)->addBody((char const *)arg2);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:Event_serialize", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		result = (char *) (arg1)->serialize();
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_Event_addHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:Event_addHeader",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3"" of type '" "char const *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_serialize(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[3];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 1) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				return _wrap_Event_serialize__SWIG_1(self, args);
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					return _wrap_Event_serialize__SWIG_0(self, args);
+				}
+			}
+		}
 
-SWIGINTERN PyObject *_wrap_Event_delHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:Event_delHeader",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (bool)(arg1)->delHeader((char const *)arg2);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'Event_serialize'.\n"
+						 "  Possible C/C++ prototypes are:\n" "    serialize(Event *,char const *)\n" "    serialize(Event *)\n");
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_Event_fire(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  Event *arg1 = (Event *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:Event_fire",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1"" of type '" "Event *""'"); 
-  }
-  arg1 = reinterpret_cast< Event * >(argp1);
-  result = (bool)(arg1)->fire();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		switch_priority_t arg2;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2;
+		int res2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:Event_setPriority", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		{
+			res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_priority_t, 0 | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t" "'");
+			}
+			if (!argp2) {
+				SWIG_exception_fail(SWIG_ValueError,
+									"invalid null reference " "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t" "'");
+			} else {
+				switch_priority_t *temp = reinterpret_cast < switch_priority_t *>(argp2);
+				arg2 = *temp;
+				if (SWIG_IsNewObj(res2))
+					delete temp;
+			}
+		}
+		result = (bool) (arg1)->setPriority(arg2);
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *Event_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_Event, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_CoreSession",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  delete arg1;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:Event_setPriority", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		result = (bool) (arg1)->setPriority();
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_session_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_session_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_session_set" "', argument " "2"" of type '" "switch_core_session_t *""'"); 
-  }
-  arg2 = reinterpret_cast< switch_core_session_t * >(argp2);
-  if (arg1) (arg1)->session = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_Event_setPriority(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[3];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 1) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				return _wrap_Event_setPriority__SWIG_1(self, args);
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_switch_priority_t, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					return _wrap_Event_setPriority__SWIG_0(self, args);
+				}
+			}
+		}
 
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'Event_setPriority'.\n"
+						 "  Possible C/C++ prototypes are:\n" "    setPriority(Event *,switch_priority_t)\n" "    setPriority(Event *)\n");
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_session_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_core_session_t *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_session_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (switch_core_session_t *) ((arg1)->session);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_getHeader(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:Event_getHeader", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (char *) (arg1)->getHeader(arg2);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_channel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_channel_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2"" of type '" "switch_channel_t *""'"); 
-  }
-  arg2 = reinterpret_cast< switch_channel_t * >(argp2);
-  if (arg1) (arg1)->channel = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_getBody(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:Event_getBody", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		result = (char *) (arg1)->getBody();
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_channel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_t *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_channel_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (switch_channel_t *) ((arg1)->channel);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_getType(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:Event_getType", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		result = (char *) (arg1)->getType();
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_flags_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  unsigned int arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  unsigned int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_flags_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2"" of type '" "unsigned int""'");
-  } 
-  arg2 = static_cast< unsigned int >(val2);
-  if (arg1) (arg1)->flags = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_addBody(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:Event_addBody", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (bool) (arg1)->addBody((char const *) arg2);
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_flags_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  unsigned int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flags_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (unsigned int) ((arg1)->flags);
-  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_addHeader(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:Event_addHeader", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3" " of type '" "char const *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		result = (bool) (arg1)->addHeader((char const *) arg2, (char const *) arg3);
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_allocated_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_allocated_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  if (arg1) (arg1)->allocated = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_delHeader(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		char *arg2 = (char *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:Event_delHeader", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (bool) (arg1)->delHeader((char const *) arg2);
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_allocated_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_allocated_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (int) ((arg1)->allocated);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_Event_fire(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		Event *arg1 = (Event *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:Event_fire", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1" " of type '" "Event *" "'");
+		}
+		arg1 = reinterpret_cast < Event * >(argp1);
+		result = (bool) (arg1)->fire();
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_cb_state_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  input_callback_state *arg2 = (input_callback_state *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_cb_state_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_input_callback_state, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_cb_state_set" "', argument " "2"" of type '" "input_callback_state *""'"); 
-  }
-  arg2 = reinterpret_cast< input_callback_state * >(argp2);
-  if (arg1) (arg1)->cb_state = *arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *Event_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *obj;
+		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+			return NULL;
+		SWIG_TypeNewClientData(SWIGTYPE_p_Event, SWIG_NewClientData(obj));
+		return SWIG_Py_Void();
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_cb_state_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  input_callback_state *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_cb_state_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (input_callback_state *)& ((arg1)->cb_state);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:delete_CoreSession", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		delete arg1;
 
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_hook_state_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_state_t arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_hook_state_set",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  {
-    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_state_t,  0  | 0);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'"); 
-    }  
-    if (!argp2) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'");
-    } else {
-      switch_channel_state_t * temp = reinterpret_cast< switch_channel_state_t * >(argp2);
-      arg2 = *temp;
-      if (SWIG_IsNewObj(res2)) delete temp;
-    }
-  }
-  if (arg1) (arg1)->hook_state = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_session_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_core_session_t *arg2 = (switch_core_session_t *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_session_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2),
+								"in method '" "CoreSession_session_set" "', argument " "2" " of type '" "switch_core_session_t *" "'");
+		}
+		arg2 = reinterpret_cast < switch_core_session_t *>(argp2);
+		if (arg1)
+			(arg1)->session = arg2;
+
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_hook_state_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_state_t result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_hook_state_get",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result =  ((arg1)->hook_state);
-  resultobj = SWIG_NewPointerObj((new switch_channel_state_t(static_cast< const switch_channel_state_t& >(result))), SWIGTYPE_p_switch_channel_state_t, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_session_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_core_session_t *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_session_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (switch_core_session_t *) ((arg1)->session);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_answer",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (int)(arg1)->answer();
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_channel_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_channel_t *arg2 = (switch_channel_t *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_channel_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2" " of type '" "switch_channel_t *" "'");
+		}
+		arg2 = reinterpret_cast < switch_channel_t *>(argp2);
+		if (arg1)
+			(arg1)->channel = arg2;
+
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_preAnswer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_preAnswer",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (int)(arg1)->preAnswer();
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_channel_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_channel_t *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_channel_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (switch_channel_t *) ((arg1)->channel);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_hangup",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  (arg1)->hangup(arg2);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_flags_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		unsigned int arg2;
+		void *argp1 = 0;
+		int res1 = 0;
+		unsigned int val2;
+		int ecode2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_flags_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
+		if (!SWIG_IsOK(ecode2)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2" " of type '" "unsigned int" "'");
+		}
+		arg2 = static_cast < unsigned int >(val2);
+		if (arg1)
+			(arg1)->flags = arg2;
+
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_hangup",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  (arg1)->hangup();
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_flags_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		unsigned int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_flags_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (unsigned int) ((arg1)->flags);
+		resultobj = SWIG_From_unsigned_SS_int(static_cast < unsigned int >(result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_hangup(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 1) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_CoreSession_hangup__SWIG_1(self, args);
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_CoreSession_hangup__SWIG_0(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    hangup(CoreSession *,char *)\n"
-    "    hangup(CoreSession *)\n");
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_allocated_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+		void *argp1 = 0;
+		int res1 = 0;
+		int val2;
+		int ecode2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_allocated_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		ecode2 = SWIG_AsVal_int(obj1, &val2);
+		if (!SWIG_IsOK(ecode2)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2" " of type '" "int" "'");
+		}
+		arg2 = static_cast < int >(val2);
+		if (arg1)
+			(arg1)->allocated = arg2;
+
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_setVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setVariable",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->setVariable(arg2,arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_allocated_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_allocated_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (int) ((arg1)->allocated);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_setPrivate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = (void *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setPrivate",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3"" of type '" "void *""'"); 
-  }
-  (arg1)->setPrivate(arg2,arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_cb_state_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		input_callback_state *arg2 = (input_callback_state *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_cb_state_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_input_callback_state, 0 | 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2),
+								"in method '" "CoreSession_cb_state_set" "', argument " "2" " of type '" "input_callback_state *" "'");
+		}
+		arg2 = reinterpret_cast < input_callback_state * >(argp2);
+		if (arg1)
+			(arg1)->cb_state = *arg2;
+
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_getPrivate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getPrivate",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (void *)(arg1)->getPrivate(arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_cb_state_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		input_callback_state *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_cb_state_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (input_callback_state *) & ((arg1)->cb_state);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_getVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getVariable",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (char *)(arg1)->getVariable(arg2);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_hook_state_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_channel_state_t arg2;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2;
+		int res2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_hook_state_set", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		{
+			res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_state_t, 0 | 0);
+			if (!SWIG_IsOK(res2)) {
+				SWIG_exception_fail(SWIG_ArgError(res2),
+									"in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '" "switch_channel_state_t" "'");
+			}
+			if (!argp2) {
+				SWIG_exception_fail(SWIG_ValueError,
+									"invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '"
+									"switch_channel_state_t" "'");
+			} else {
+				switch_channel_state_t *temp = reinterpret_cast < switch_channel_state_t *>(argp2);
+				arg2 = *temp;
+				if (SWIG_IsNewObj(res2))
+					delete temp;
+			}
+		}
+		if (arg1)
+			(arg1)->hook_state = arg2;
 
-SWIGINTERN PyObject *_wrap_CoreSession_process_callback_result(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_process_callback_result",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_process_callback_result" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (arg1)->process_callback_result(arg2);
-  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_say(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  int res4 ;
-  char *buf4 = 0 ;
-  int alloc4 = 0 ;
-  int res5 ;
-  char *buf5 = 0 ;
-  int alloc5 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_say",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-  if (!SWIG_IsOK(res4)) {
-    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
-  }
-  arg4 = reinterpret_cast< char * >(buf4);
-  res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
-  if (!SWIG_IsOK(res5)) {
-    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
-  }
-  arg5 = reinterpret_cast< char * >(buf5);
-  (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_hook_state_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_channel_state_t result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_hook_state_get", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = ((arg1)->hook_state);
+		resultobj =
+			SWIG_NewPointerObj((new switch_channel_state_t (static_cast < const switch_channel_state_t &>(result))), SWIGTYPE_p_switch_channel_state_t,
+							   SWIG_POINTER_OWN | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  int res4 ;
-  char *buf4 = 0 ;
-  int alloc4 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-  if (!SWIG_IsOK(res4)) {
-    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
-  }
-  arg4 = reinterpret_cast< char * >(buf4);
-  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_answer", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (int) (arg1)->answer();
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_preAnswer(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_preAnswer", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (int) (arg1)->preAnswer();
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sayPhrase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  (arg1)->sayPhrase((char const *)arg2);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_hangup", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		(arg1)->hangup(arg2);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[5];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_CoreSession_sayPhrase__SWIG_2(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_CoreSession_sayPhrase__SWIG_1(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
-          _v = SWIG_CheckState(res);
-          if (_v) {
-            return _wrap_CoreSession_sayPhrase__SWIG_0(self, args);
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_sayPhrase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    sayPhrase(CoreSession *,char const *,char const *,char const *)\n"
-    "    sayPhrase(CoreSession *,char const *,char const *)\n"
-    "    sayPhrase(CoreSession *,char const *)\n");
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_hangup", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		(arg1)->hangup();
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int arg4 ;
-  int arg5 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  int val4 ;
-  int ecode4 = 0 ;
-  int val5 ;
-  int ecode5 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_recordFile",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  ecode3 = SWIG_AsVal_int(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
-  } 
-  arg3 = static_cast< int >(val3);
-  ecode4 = SWIG_AsVal_int(obj3, &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
-  } 
-  arg4 = static_cast< int >(val4);
-  ecode5 = SWIG_AsVal_int(obj4, &val5);
-  if (!SWIG_IsOK(ecode5)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5"" of type '" "int""'");
-  } 
-  arg5 = static_cast< int >(val5);
-  result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_hangup(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[3];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 1) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				return _wrap_CoreSession_hangup__SWIG_1(self, args);
+			}
+		}
+		if (argc == 2) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					return _wrap_CoreSession_hangup__SWIG_0(self, args);
+				}
+			}
+		}
 
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n"
+						 "  Possible C/C++ prototypes are:\n" "    hangup(CoreSession *,char *)\n" "    hangup(CoreSession *)\n");
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int arg4 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  int val4 ;
-  int ecode4 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_recordFile",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  ecode3 = SWIG_AsVal_int(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
-  } 
-  arg3 = static_cast< int >(val3);
-  ecode4 = SWIG_AsVal_int(obj3, &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
-  } 
-  arg4 = static_cast< int >(val4);
-  result = (int)(arg1)->recordFile(arg2,arg3,arg4);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_setVariable(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setVariable", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		(arg1)->setVariable(arg2, arg3);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_recordFile",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  ecode3 = SWIG_AsVal_int(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
-  } 
-  arg3 = static_cast< int >(val3);
-  result = (int)(arg1)->recordFile(arg2,arg3);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_setPrivate(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		void *arg3 = (void *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setPrivate", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&arg3), 0, 0);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3" " of type '" "void *" "'");
+		}
+		(arg1)->setPrivate(arg2, arg3);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_recordFile",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (int)(arg1)->recordFile(arg2);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_getPrivate(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		void *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_getPrivate", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (void *) (arg1)->getPrivate(arg2);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[6];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 5); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_CoreSession_recordFile__SWIG_3(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        {
-          int res = SWIG_AsVal_int(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_CoreSession_recordFile__SWIG_2(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        {
-          int res = SWIG_AsVal_int(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          {
-            int res = SWIG_AsVal_int(argv[3], NULL);
-            _v = SWIG_CheckState(res);
-          }
-          if (_v) {
-            return _wrap_CoreSession_recordFile__SWIG_1(self, args);
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        {
-          int res = SWIG_AsVal_int(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          {
-            int res = SWIG_AsVal_int(argv[3], NULL);
-            _v = SWIG_CheckState(res);
-          }
-          if (_v) {
-            {
-              int res = SWIG_AsVal_int(argv[4], NULL);
-              _v = SWIG_CheckState(res);
-            }
-            if (_v) {
-              return _wrap_CoreSession_recordFile__SWIG_0(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    recordFile(CoreSession *,char *,int,int,int)\n"
-    "    recordFile(CoreSession *,char *,int,int)\n"
-    "    recordFile(CoreSession *,char *,int)\n"
-    "    recordFile(CoreSession *,char *)\n");
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_getVariable(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_getVariable", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (char *) (arg1)->getVariable(arg2);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_setCallerData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setCallerData",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->setCallerData(arg2,arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_process_callback_result(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		switch_status_t result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_process_callback_result", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1),
+								"in method '" "CoreSession_process_callback_result" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (arg1)->process_callback_result(arg2);
+		resultobj =
+			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  CoreSession *arg2 = (CoreSession *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  int val4 ;
-  int ecode4 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_originate",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'"); 
-  }
-  arg2 = reinterpret_cast< CoreSession * >(argp2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  ecode4 = SWIG_AsVal_int(obj3, &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4"" of type '" "int""'");
-  } 
-  arg4 = static_cast< int >(val4);
-  result = (int)(arg1)->originate(arg2,arg3,arg4);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_say(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+		char *arg5 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		int res4;
+		char *buf4 = 0;
+		int alloc4 = 0;
+		int res5;
+		char *buf5 = 0;
+		int alloc5 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+		PyObject *obj4 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOOO:CoreSession_say", &obj0, &obj1, &obj2, &obj3, &obj4))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3" " of type '" "char const *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+		if (!SWIG_IsOK(res4)) {
+			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4" " of type '" "char const *" "'");
+		}
+		arg4 = reinterpret_cast < char *>(buf4);
+		res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
+		if (!SWIG_IsOK(res5)) {
+			SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5" " of type '" "char const *" "'");
+		}
+		arg5 = reinterpret_cast < char *>(buf5);
+		(arg1)->say((char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		if (alloc5 == SWIG_NEWOBJ)
+			delete[]buf5;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		if (alloc5 == SWIG_NEWOBJ)
+			delete[]buf5;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  CoreSession *arg2 = (CoreSession *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_originate",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'"); 
-  }
-  arg2 = reinterpret_cast< CoreSession * >(argp2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  result = (int)(arg1)->originate(arg2,arg3);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		int res4;
+		char *buf4 = 0;
+		int alloc4 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_sayPhrase", &obj0, &obj1, &obj2, &obj3))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+		if (!SWIG_IsOK(res4)) {
+			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4" " of type '" "char const *" "'");
+		}
+		arg4 = reinterpret_cast < char *>(buf4);
+		(arg1)->sayPhrase((char const *) arg2, (char const *) arg3, (char const *) arg4);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_originate(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[5];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 3) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      void *vptr = 0;
-      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_CoreSession_originate__SWIG_1(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      void *vptr = 0;
-      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          {
-            int res = SWIG_AsVal_int(argv[3], NULL);
-            _v = SWIG_CheckState(res);
-          }
-          if (_v) {
-            return _wrap_CoreSession_originate__SWIG_0(self, args);
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_originate'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    originate(CoreSession *,CoreSession *,char *,int)\n"
-    "    originate(CoreSession *,CoreSession *,char *)\n");
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_sayPhrase", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		(arg1)->sayPhrase((char const *) arg2, (char const *) arg3);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  void *arg2 = (void *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setDTMFCallback",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "void *""'"); 
-  }
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->setDTMFCallback(arg2,arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_sayPhrase", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		(arg1)->sayPhrase((char const *) arg2);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_speak(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_speak",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (int)(arg1)->speak(arg2);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[5];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 4); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 2) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					return _wrap_CoreSession_sayPhrase__SWIG_2(self, args);
+				}
+			}
+		}
+		if (argc == 3) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+					if (_v) {
+						return _wrap_CoreSession_sayPhrase__SWIG_1(self, args);
+					}
+				}
+			}
+		}
+		if (argc == 4) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+					if (_v) {
+						int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
+						_v = SWIG_CheckState(res);
+						if (_v) {
+							return _wrap_CoreSession_sayPhrase__SWIG_0(self, args);
+						}
+					}
+				}
+			}
+		}
 
-SWIGINTERN PyObject *_wrap_CoreSession_set_tts_parms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_set_tts_parms",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->set_tts_parms(arg2,arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_sayPhrase'.\n"
+						 "  Possible C/C++ prototypes are:\n"
+						 "    sayPhrase(CoreSession *,char const *,char const *,char const *)\n"
+						 "    sayPhrase(CoreSession *,char const *,char const *)\n" "    sayPhrase(CoreSession *,char const *)\n");
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_collectDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_collectDigits",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  result = (int)(arg1)->collectDigits(arg2);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int arg3;
+		int arg4;
+		int arg5;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int val3;
+		int ecode3 = 0;
+		int val4;
+		int ecode4 = 0;
+		int val5;
+		int ecode5 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+		PyObject *obj4 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOOO:CoreSession_recordFile", &obj0, &obj1, &obj2, &obj3, &obj4))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		ecode3 = SWIG_AsVal_int(obj2, &val3);
+		if (!SWIG_IsOK(ecode3)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+		}
+		arg3 = static_cast < int >(val3);
+		ecode4 = SWIG_AsVal_int(obj3, &val4);
+		if (!SWIG_IsOK(ecode4)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
+		}
+		arg4 = static_cast < int >(val4);
+		ecode5 = SWIG_AsVal_int(obj4, &val5);
+		if (!SWIG_IsOK(ecode5)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5" " of type '" "int" "'");
+		}
+		arg5 = static_cast < int >(val5);
+		result = (int) (arg1)->recordFile(arg2, arg3, arg4, arg5);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  int val4 ;
-  int ecode4 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  ecode4 = SWIG_AsVal_int(obj3, &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
-  } 
-  arg4 = static_cast< int >(val4);
-  result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int arg3;
+		int arg4;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int val3;
+		int ecode3 = 0;
+		int val4;
+		int ecode4 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_recordFile", &obj0, &obj1, &obj2, &obj3))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		ecode3 = SWIG_AsVal_int(obj2, &val3);
+		if (!SWIG_IsOK(ecode3)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+		}
+		arg3 = static_cast < int >(val3);
+		ecode4 = SWIG_AsVal_int(obj3, &val4);
+		if (!SWIG_IsOK(ecode4)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
+		}
+		arg4 = static_cast < int >(val4);
+		result = (int) (arg1)->recordFile(arg2, arg3, arg4);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_transfer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  int res4 ;
-  char *buf4 = 0 ;
-  int alloc4 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_transfer",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-  if (!SWIG_IsOK(res4)) {
-    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'");
-  }
-  arg4 = reinterpret_cast< char * >(buf4);
-  result = (int)(arg1)->transfer(arg2,arg3,arg4);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int arg3 ;
-  char *arg4 = (char *) 0 ;
-  int arg5 ;
-  char *arg6 = (char *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  int res4 ;
-  char *buf4 = 0 ;
-  int alloc4 = 0 ;
-  int val5 ;
-  int ecode5 = 0 ;
-  int res6 ;
-  char *buf6 = 0 ;
-  int alloc6 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  PyObject * obj5 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:CoreSession_read",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  ecode3 = SWIG_AsVal_int(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3"" of type '" "int""'");
-  } 
-  arg3 = static_cast< int >(val3);
-  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-  if (!SWIG_IsOK(res4)) {
-    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4"" of type '" "char const *""'");
-  }
-  arg4 = reinterpret_cast< char * >(buf4);
-  ecode5 = SWIG_AsVal_int(obj4, &val5);
-  if (!SWIG_IsOK(ecode5)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5"" of type '" "int""'");
-  } 
-  arg5 = static_cast< int >(val5);
-  res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
-  if (!SWIG_IsOK(res6)) {
-    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6"" of type '" "char const *""'");
-  }
-  arg6 = reinterpret_cast< char * >(buf6);
-  result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-  return resultobj;
-fail:
-  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int arg3 ;
-  int arg4 ;
-  int arg5 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  char *arg9 = (char *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  int val4 ;
-  int ecode4 = 0 ;
-  int val5 ;
-  int ecode5 = 0 ;
-  int res6 ;
-  char *buf6 = 0 ;
-  int alloc6 = 0 ;
-  int res7 ;
-  char *buf7 = 0 ;
-  int alloc7 = 0 ;
-  int res8 ;
-  char *buf8 = 0 ;
-  int alloc8 = 0 ;
-  int res9 ;
-  char *buf9 = 0 ;
-  int alloc9 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  PyObject * obj5 = 0 ;
-  PyObject * obj6 = 0 ;
-  PyObject * obj7 = 0 ;
-  PyObject * obj8 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:CoreSession_playAndGetDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  ecode3 = SWIG_AsVal_int(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3"" of type '" "int""'");
-  } 
-  arg3 = static_cast< int >(val3);
-  ecode4 = SWIG_AsVal_int(obj3, &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4"" of type '" "int""'");
-  } 
-  arg4 = static_cast< int >(val4);
-  ecode5 = SWIG_AsVal_int(obj4, &val5);
-  if (!SWIG_IsOK(ecode5)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5"" of type '" "int""'");
-  } 
-  arg5 = static_cast< int >(val5);
-  res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
-  if (!SWIG_IsOK(res6)) {
-    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'");
-  }
-  arg6 = reinterpret_cast< char * >(buf6);
-  res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
-  if (!SWIG_IsOK(res7)) {
-    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'");
-  }
-  arg7 = reinterpret_cast< char * >(buf7);
-  res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
-  if (!SWIG_IsOK(res8)) {
-    SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
-  }
-  arg8 = reinterpret_cast< char * >(buf8);
-  res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9);
-  if (!SWIG_IsOK(res9)) {
-    SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *""'");
-  }
-  arg9 = reinterpret_cast< char * >(buf9);
-  result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
-  if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-  if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
-  return resultobj;
-fail:
-  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
-  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
-  if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-  if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_streamFile",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  ecode3 = SWIG_AsVal_int(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3"" of type '" "int""'");
-  } 
-  arg3 = static_cast< int >(val3);
-  result = (int)(arg1)->streamFile(arg2,arg3);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int arg3;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int val3;
+		int ecode3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_recordFile", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		ecode3 = SWIG_AsVal_int(obj2, &val3);
+		if (!SWIG_IsOK(ecode3)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+		}
+		arg3 = static_cast < int >(val3);
+		result = (int) (arg1)->recordFile(arg2, arg3);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_streamFile",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  result = (int)(arg1)->streamFile(arg2);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_3(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_recordFile", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (int) (arg1)->recordFile(arg2);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_streamFile(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[4];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_CoreSession_streamFile__SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        {
-          int res = SWIG_AsVal_int(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_CoreSession_streamFile__SWIG_0(self, args);
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    streamFile(CoreSession *,char *,int)\n"
-    "    streamFile(CoreSession *,char *)\n");
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_recordFile(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[6];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 5); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 2) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					return _wrap_CoreSession_recordFile__SWIG_3(self, args);
+				}
+			}
+		}
+		if (argc == 3) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					{
+						int res = SWIG_AsVal_int(argv[2], NULL);
+						_v = SWIG_CheckState(res);
+					}
+					if (_v) {
+						return _wrap_CoreSession_recordFile__SWIG_2(self, args);
+					}
+				}
+			}
+		}
+		if (argc == 4) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					{
+						int res = SWIG_AsVal_int(argv[2], NULL);
+						_v = SWIG_CheckState(res);
+					}
+					if (_v) {
+						{
+							int res = SWIG_AsVal_int(argv[3], NULL);
+							_v = SWIG_CheckState(res);
+						}
+						if (_v) {
+							return _wrap_CoreSession_recordFile__SWIG_1(self, args);
+						}
+					}
+				}
+			}
+		}
+		if (argc == 5) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					{
+						int res = SWIG_AsVal_int(argv[2], NULL);
+						_v = SWIG_CheckState(res);
+					}
+					if (_v) {
+						{
+							int res = SWIG_AsVal_int(argv[3], NULL);
+							_v = SWIG_CheckState(res);
+						}
+						if (_v) {
+							{
+								int res = SWIG_AsVal_int(argv[4], NULL);
+								_v = SWIG_CheckState(res);
+							}
+							if (_v) {
+								return _wrap_CoreSession_recordFile__SWIG_0(self, args);
+							}
+						}
+					}
+				}
+			}
+		}
 
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n"
+						 "  Possible C/C++ prototypes are:\n"
+						 "    recordFile(CoreSession *,char *,int,int,int)\n"
+						 "    recordFile(CoreSession *,char *,int,int)\n"
+						 "    recordFile(CoreSession *,char *,int)\n" "    recordFile(CoreSession *,char *)\n");
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_flushEvents(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flushEvents",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (int)(arg1)->flushEvents();
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_setCallerData(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setCallerData", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		(arg1)->setCallerData(arg2, arg3);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_flushDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flushDigits",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (int)(arg1)->flushDigits();
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		CoreSession *arg2 = (CoreSession *) 0;
+		char *arg3 = (char *) 0;
+		int arg4;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		int val4;
+		int ecode4 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_originate", &obj0, &obj1, &obj2, &obj3))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
+		}
+		arg2 = reinterpret_cast < CoreSession * >(argp2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		ecode4 = SWIG_AsVal_int(obj3, &val4);
+		if (!SWIG_IsOK(ecode4)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4" " of type '" "int" "'");
+		}
+		arg4 = static_cast < int >(val4);
+		result = (int) (arg1)->originate(arg2, arg3, arg4);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_setAutoHangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool arg2 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  bool val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setAutoHangup",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  ecode2 = SWIG_AsVal_bool(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2"" of type '" "bool""'");
-  } 
-  arg2 = static_cast< bool >(val2);
-  result = (int)(arg1)->setAutoHangup(arg2);
-  resultobj = SWIG_From_int(static_cast< int >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		CoreSession *arg2 = (CoreSession *) 0;
+		char *arg3 = (char *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_originate", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
+		}
+		arg2 = reinterpret_cast < CoreSession * >(argp2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		result = (int) (arg1)->originate(arg2, arg3);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_setHangupHook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  void *arg2 = (void *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setHangupHook",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2"" of type '" "void *""'"); 
-  }
-  (arg1)->setHangupHook(arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_CoreSession_originate(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[5];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 4); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 3) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				void *vptr = 0;
+				int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+					if (_v) {
+						return _wrap_CoreSession_originate__SWIG_1(self, args);
+					}
+				}
+			}
+		}
+		if (argc == 4) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				void *vptr = 0;
+				int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+					if (_v) {
+						{
+							int res = SWIG_AsVal_int(argv[3], NULL);
+							_v = SWIG_CheckState(res);
+						}
+						if (_v) {
+							return _wrap_CoreSession_originate__SWIG_0(self, args);
+						}
+					}
+				}
+			}
+		}
 
-SWIGINTERN PyObject *_wrap_CoreSession_ready(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_ready",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (bool)(arg1)->ready();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_originate'.\n"
+						 "  Possible C/C++ prototypes are:\n"
+						 "    originate(CoreSession *,CoreSession *,char *,int)\n" "    originate(CoreSession *,CoreSession *,char *)\n");
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_execute",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->execute(arg2,arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		void *arg2 = (void *) 0;
+		char *arg3 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setDTMFCallback", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2" " of type '" "void *" "'");
+		}
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		(arg1)->setDTMFCallback(arg2, arg3);
+		resultobj = SWIG_Py_Void();
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_execute",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  (arg1)->execute(arg2);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_speak(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_speak", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (int) (arg1)->speak(arg2);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[4];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_CoreSession_execute__SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_CoreSession_execute__SWIG_0(self, args);
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_execute'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    execute(CoreSession *,char *,char *)\n"
-    "    execute(CoreSession *,char *)\n");
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_set_tts_parms(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_set_tts_parms", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		(arg1)->set_tts_parms(arg2, arg3);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  Event *arg2 = (Event *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sendEvent",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2"" of type '" "Event *""'"); 
-  }
-  arg2 = reinterpret_cast< Event * >(argp2);
-  (arg1)->sendEvent(arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_collectDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int val2;
+		int ecode2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_collectDigits", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		ecode2 = SWIG_AsVal_int(obj1, &val2);
+		if (!SWIG_IsOK(ecode2)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2" " of type '" "int" "'");
+		}
+		arg2 = static_cast < int >(val2);
+		result = (int) (arg1)->collectDigits(arg2);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+		char *arg3 = (char *) 0;
+		int arg4;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int val2;
+		int ecode2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		int val4;
+		int ecode4 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_getDigits", &obj0, &obj1, &obj2, &obj3))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		ecode2 = SWIG_AsVal_int(obj1, &val2);
+		if (!SWIG_IsOK(ecode2)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2" " of type '" "int" "'");
+		}
+		arg2 = static_cast < int >(val2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		ecode4 = SWIG_AsVal_int(obj3, &val4);
+		if (!SWIG_IsOK(ecode4)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4" " of type '" "int" "'");
+		}
+		arg4 = static_cast < int >(val4);
+		result = (char *) (arg1)->getDigits(arg2, arg3, arg4);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_transfer(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		char *arg4 = (char *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		int res4;
+		char *buf4 = 0;
+		int alloc4 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_transfer", &obj0, &obj1, &obj2, &obj3))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+		if (!SWIG_IsOK(res4)) {
+			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4" " of type '" "char *" "'");
+		}
+		arg4 = reinterpret_cast < char *>(buf4);
+		result = (int) (arg1)->transfer(arg2, arg3, arg4);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+		int arg3;
+		char *arg4 = (char *) 0;
+		int arg5;
+		char *arg6 = (char *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int val2;
+		int ecode2 = 0;
+		int val3;
+		int ecode3 = 0;
+		int res4;
+		char *buf4 = 0;
+		int alloc4 = 0;
+		int val5;
+		int ecode5 = 0;
+		int res6;
+		char *buf6 = 0;
+		int alloc6 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+		PyObject *obj4 = 0;
+		PyObject *obj5 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOOOO:CoreSession_read", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		ecode2 = SWIG_AsVal_int(obj1, &val2);
+		if (!SWIG_IsOK(ecode2)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2" " of type '" "int" "'");
+		}
+		arg2 = static_cast < int >(val2);
+		ecode3 = SWIG_AsVal_int(obj2, &val3);
+		if (!SWIG_IsOK(ecode3)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3" " of type '" "int" "'");
+		}
+		arg3 = static_cast < int >(val3);
+		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+		if (!SWIG_IsOK(res4)) {
+			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4" " of type '" "char const *" "'");
+		}
+		arg4 = reinterpret_cast < char *>(buf4);
+		ecode5 = SWIG_AsVal_int(obj4, &val5);
+		if (!SWIG_IsOK(ecode5)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5" " of type '" "int" "'");
+		}
+		arg5 = static_cast < int >(val5);
+		res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+		if (!SWIG_IsOK(res6)) {
+			SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6" " of type '" "char const *" "'");
+		}
+		arg6 = reinterpret_cast < char *>(buf6);
+		result = (char *) (arg1)->read(arg2, arg3, (char const *) arg4, arg5, (char const *) arg6);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		if (alloc6 == SWIG_NEWOBJ)
+			delete[]buf6;
+		return resultobj;
+	  fail:
+		if (alloc4 == SWIG_NEWOBJ)
+			delete[]buf4;
+		if (alloc6 == SWIG_NEWOBJ)
+			delete[]buf6;
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int arg2;
+		int arg3;
+		int arg4;
+		int arg5;
+		char *arg6 = (char *) 0;
+		char *arg7 = (char *) 0;
+		char *arg8 = (char *) 0;
+		char *arg9 = (char *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int val2;
+		int ecode2 = 0;
+		int val3;
+		int ecode3 = 0;
+		int val4;
+		int ecode4 = 0;
+		int val5;
+		int ecode5 = 0;
+		int res6;
+		char *buf6 = 0;
+		int alloc6 = 0;
+		int res7;
+		char *buf7 = 0;
+		int alloc7 = 0;
+		int res8;
+		char *buf8 = 0;
+		int alloc8 = 0;
+		int res9;
+		char *buf9 = 0;
+		int alloc9 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+		PyObject *obj4 = 0;
+		PyObject *obj5 = 0;
+		PyObject *obj6 = 0;
+		PyObject *obj7 = 0;
+		PyObject *obj8 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOOOOOOO:CoreSession_playAndGetDigits", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5, &obj6, &obj7, &obj8))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		ecode2 = SWIG_AsVal_int(obj1, &val2);
+		if (!SWIG_IsOK(ecode2)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2" " of type '" "int" "'");
+		}
+		arg2 = static_cast < int >(val2);
+		ecode3 = SWIG_AsVal_int(obj2, &val3);
+		if (!SWIG_IsOK(ecode3)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3" " of type '" "int" "'");
+		}
+		arg3 = static_cast < int >(val3);
+		ecode4 = SWIG_AsVal_int(obj3, &val4);
+		if (!SWIG_IsOK(ecode4)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4" " of type '" "int" "'");
+		}
+		arg4 = static_cast < int >(val4);
+		ecode5 = SWIG_AsVal_int(obj4, &val5);
+		if (!SWIG_IsOK(ecode5)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5" " of type '" "int" "'");
+		}
+		arg5 = static_cast < int >(val5);
+		res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+		if (!SWIG_IsOK(res6)) {
+			SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6" " of type '" "char *" "'");
+		}
+		arg6 = reinterpret_cast < char *>(buf6);
+		res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
+		if (!SWIG_IsOK(res7)) {
+			SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7" " of type '" "char *" "'");
+		}
+		arg7 = reinterpret_cast < char *>(buf7);
+		res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
+		if (!SWIG_IsOK(res8)) {
+			SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8" " of type '" "char *" "'");
+		}
+		arg8 = reinterpret_cast < char *>(buf8);
+		res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9);
+		if (!SWIG_IsOK(res9)) {
+			SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9" " of type '" "char *" "'");
+		}
+		arg9 = reinterpret_cast < char *>(buf9);
+		result = (char *) (arg1)->playAndGetDigits(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		if (alloc6 == SWIG_NEWOBJ)
+			delete[]buf6;
+		if (alloc7 == SWIG_NEWOBJ)
+			delete[]buf7;
+		if (alloc8 == SWIG_NEWOBJ)
+			delete[]buf8;
+		if (alloc9 == SWIG_NEWOBJ)
+			delete[]buf9;
+		return resultobj;
+	  fail:
+		if (alloc6 == SWIG_NEWOBJ)
+			delete[]buf6;
+		if (alloc7 == SWIG_NEWOBJ)
+			delete[]buf7;
+		if (alloc8 == SWIG_NEWOBJ)
+			delete[]buf8;
+		if (alloc9 == SWIG_NEWOBJ)
+			delete[]buf9;
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int arg3;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int val3;
+		int ecode3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_streamFile", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		ecode3 = SWIG_AsVal_int(obj2, &val3);
+		if (!SWIG_IsOK(ecode3)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3" " of type '" "int" "'");
+		}
+		arg3 = static_cast < int >(val3);
+		result = (int) (arg1)->streamFile(arg2, arg3);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_streamFile", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		result = (int) (arg1)->streamFile(arg2);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_streamFile(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[4];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 2) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					return _wrap_CoreSession_streamFile__SWIG_1(self, args);
+				}
+			}
+		}
+		if (argc == 3) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					{
+						int res = SWIG_AsVal_int(argv[2], NULL);
+						_v = SWIG_CheckState(res);
+					}
+					if (_v) {
+						return _wrap_CoreSession_streamFile__SWIG_0(self, args);
+					}
+				}
+			}
+		}
+
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n"
+						 "  Possible C/C++ prototypes are:\n" "    streamFile(CoreSession *,char *,int)\n" "    streamFile(CoreSession *,char *)\n");
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_flushEvents(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_flushEvents", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (int) (arg1)->flushEvents();
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_flushDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_flushDigits", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (int) (arg1)->flushDigits();
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_setAutoHangup(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		bool arg2;
+		int result;
+		void *argp1 = 0;
+		int res1 = 0;
+		bool val2;
+		int ecode2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_setAutoHangup", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		ecode2 = SWIG_AsVal_bool(obj1, &val2);
+		if (!SWIG_IsOK(ecode2)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2" " of type '" "bool" "'");
+		}
+		arg2 = static_cast < bool > (val2);
+		result = (int) (arg1)->setAutoHangup(arg2);
+		resultobj = SWIG_From_int(static_cast < int >(result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_setHangupHook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		void *arg2 = (void *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_setHangupHook", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2" " of type '" "void *" "'");
+		}
+		(arg1)->setHangupHook(arg2);
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_ready(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_ready", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (bool) (arg1)->ready();
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		char *arg3 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_execute", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		(arg1)->execute(arg2, arg3);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *arg2 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_execute", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		(arg1)->execute(arg2);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[4];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 2) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					return _wrap_CoreSession_execute__SWIG_1(self, args);
+				}
+			}
+		}
+		if (argc == 3) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+				_v = SWIG_CheckState(res);
+				if (_v) {
+					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+					_v = SWIG_CheckState(res);
+					if (_v) {
+						return _wrap_CoreSession_execute__SWIG_0(self, args);
+					}
+				}
+			}
+		}
+
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_execute'.\n"
+						 "  Possible C/C++ prototypes are:\n" "    execute(CoreSession *,char *,char *)\n" "    execute(CoreSession *,char *)\n");
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_sendEvent(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		Event *arg2 = (Event *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_sendEvent", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2" " of type '" "Event *" "'");
+		}
+		arg2 = reinterpret_cast < Event * >(argp2);
+		(arg1)->sendEvent(arg2);
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_setEventData(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		Event *arg2 = (Event *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_setEventData", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Event, 0 | 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2" " of type '" "Event *" "'");
+		}
+		arg2 = reinterpret_cast < Event * >(argp2);
+		(arg1)->setEventData(arg2);
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_getXMLCDR(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_getXMLCDR", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (char *) (arg1)->getXMLCDR();
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
+
+
+	SWIGINTERN PyObject *_wrap_CoreSession_begin_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_begin_allow_threads", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (bool) (arg1)->begin_allow_threads();
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_setEventData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  Event *arg2 = (Event *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setEventData",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2"" of type '" "Event *""'"); 
-  }
-  arg2 = reinterpret_cast< Event * >(argp2);
-  (arg1)->setEventData(arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_end_allow_threads", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (bool) (arg1)->end_allow_threads();
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_getXMLCDR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_getXMLCDR",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (char *)(arg1)->getXMLCDR();
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_get_uuid(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		char *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_get_uuid", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1" " of type '" "CoreSession const *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		result = (char *) ((CoreSession const *) arg1)->get_uuid();
+		resultobj = SWIG_FromCharPtr((const char *) result);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_begin_allow_threads",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (bool)(arg1)->begin_allow_threads();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_get_cb_args(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		switch_input_args_t *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_get_cb_args", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1" " of type '" "CoreSession const *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		{
+			switch_input_args_t const &_result_ref = ((CoreSession const *) arg1)->get_cb_args();
+			result = (switch_input_args_t *) &_result_ref;
+		}
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_end_allow_threads",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (bool)(arg1)->end_allow_threads();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_check_hangup_hook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_check_hangup_hook", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		(arg1)->check_hangup_hook();
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_get_uuid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_uuid",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1"" of type '" "CoreSession const *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  result = (char *)((CoreSession const *)arg1)->get_uuid();
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_CoreSession_run_dtmf_callback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = (CoreSession *) 0;
+		void *arg2 = (void *) 0;
+		switch_input_type_t arg3;
+		switch_status_t result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		void *argp3;
+		int res3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_run_dtmf_callback", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1" " of type '" "CoreSession *" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+		}
+		{
+			res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3),
+									"in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+			}
+			if (!argp3) {
+				SWIG_exception_fail(SWIG_ValueError,
+									"invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '"
+									"switch_input_type_t" "'");
+			} else {
+				switch_input_type_t *temp = reinterpret_cast < switch_input_type_t *>(argp3);
+				arg3 = *temp;
+				if (SWIG_IsNewObj(res3))
+					delete temp;
+			}
+		}
+		result = (arg1)->run_dtmf_callback(arg2, arg3);
+		resultobj =
+			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_get_cb_args(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_input_args_t *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_cb_args",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1"" of type '" "CoreSession const *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  {
-    switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
-    result = (switch_input_args_t *) &_result_ref;
-  }
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *CoreSession_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *obj;
+		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+			return NULL;
+		SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
+		return SWIG_Py_Void();
+	}
 
+	SWIGINTERN PyObject *_wrap_console_log(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		char *arg1 = (char *) 0;
+		char *arg2 = (char *) 0;
+		int res1;
+		char *buf1 = 0;
+		int alloc1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:console_log", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1" " of type '" "char *" "'");
+		}
+		arg1 = reinterpret_cast < char *>(buf1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		console_log(arg1, arg2);
+		resultobj = SWIG_Py_Void();
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_check_hangup_hook",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  (arg1)->check_hangup_hook();
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_console_clean_log(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		char *arg1 = (char *) 0;
+		int res1;
+		char *buf1 = 0;
+		int alloc1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:console_clean_log", &obj0))
+			SWIG_fail;
+		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1" " of type '" "char *" "'");
+		}
+		arg1 = reinterpret_cast < char *>(buf1);
+		console_clean_log(arg1);
+		resultobj = SWIG_Py_Void();
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		return resultobj;
+	  fail:
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_CoreSession_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_input_type_t arg3 ;
-  switch_status_t result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  void *argp3 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_run_dtmf_callback",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1"" of type '" "CoreSession *""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
-  }
-  {
-    res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t,  0  | 0);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
-    }  
-    if (!argp3) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
-    } else {
-      switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
-      arg3 = *temp;
-      if (SWIG_IsNewObj(res3)) delete temp;
-    }
-  }
-  result = (arg1)->run_dtmf_callback(arg2,arg3);
-  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_bridge(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		CoreSession *arg1 = 0;
+		CoreSession *arg2 = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		void *argp2 = 0;
+		int res2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:bridge", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
+		}
+		if (!argp1) {
+			SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
+		}
+		arg1 = reinterpret_cast < CoreSession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
+		}
+		if (!argp2) {
+			SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
+		}
+		arg2 = reinterpret_cast < CoreSession * >(argp2);
+		bridge(*arg1, *arg2);
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_console_log(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int res1 ;
-  char *buf1 = 0 ;
-  int alloc1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:console_log",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1"" of type '" "char *""'");
-  }
-  arg1 = reinterpret_cast< char * >(buf1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  console_log(arg1,arg2);
-  resultobj = SWIG_Py_Void();
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_hanguphook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+		switch_status_t result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:hanguphook", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+		}
+		arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+		result = hanguphook(arg1);
+		resultobj =
+			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_console_clean_log(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  char *arg1 = (char *) 0 ;
-  int res1 ;
-  char *buf1 = 0 ;
-  int alloc1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:console_clean_log",&obj0)) SWIG_fail;
-  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1"" of type '" "char *""'");
-  }
-  arg1 = reinterpret_cast< char * >(buf1);
-  console_clean_log(arg1);
-  resultobj = SWIG_Py_Void();
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  return resultobj;
-fail:
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_dtmf_callback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+		void *arg2 = (void *) 0;
+		switch_input_type_t arg3;
+		void *arg4 = (void *) 0;
+		unsigned int arg5;
+		switch_status_t result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		void *argp3;
+		int res3 = 0;
+		int res4;
+		unsigned int val5;
+		int ecode5 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+		PyObject *obj3 = 0;
+		PyObject *obj4 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOOOO:dtmf_callback", &obj0, &obj1, &obj2, &obj3, &obj4))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+		}
+		arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+		}
+		{
+			res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+			}
+			if (!argp3) {
+				SWIG_exception_fail(SWIG_ValueError,
+									"invalid null reference " "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+			} else {
+				switch_input_type_t *temp = reinterpret_cast < switch_input_type_t *>(argp3);
+				arg3 = *temp;
+				if (SWIG_IsNewObj(res3))
+					delete temp;
+			}
+		}
+		res4 = SWIG_ConvertPtr(obj3, SWIG_as_voidptrptr(&arg4), 0, 0);
+		if (!SWIG_IsOK(res4)) {
+			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4" " of type '" "void *" "'");
+		}
+		ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
+		if (!SWIG_IsOK(ecode5)) {
+			SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5" " of type '" "unsigned int" "'");
+		}
+		arg5 = static_cast < unsigned int >(val5);
+		result = dtmf_callback(arg1, arg2, arg3, arg4, arg5);
+		resultobj =
+			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_bridge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  CoreSession *arg1 = 0 ;
-  CoreSession *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:bridge",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession,  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); 
-  }
-  arg1 = reinterpret_cast< CoreSession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession,  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); 
-  }
-  if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); 
-  }
-  arg2 = reinterpret_cast< CoreSession * >(argp2);
-  bridge(*arg1,*arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		PySession *result = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) ":new_PySession"))
+			SWIG_fail;
+		result = (PySession *) new PySession();
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_hanguphook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:hanguphook",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
-  }
-  arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
-  result = hanguphook(arg1);
-  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_new_PySession__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		char *arg1 = (char *) 0;
+		PySession *result = 0;
+		int res1;
+		char *buf1 = 0;
+		int alloc1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:new_PySession", &obj0))
+			SWIG_fail;
+		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1" " of type '" "char *" "'");
+		}
+		arg1 = reinterpret_cast < char *>(buf1);
+		result = (PySession *) new PySession(arg1);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0);
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		return resultobj;
+	  fail:
+		if (alloc1 == SWIG_NEWOBJ)
+			delete[]buf1;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_input_type_t arg3 ;
-  void *arg4 = (void *) 0 ;
-  unsigned int arg5 ;
-  switch_status_t result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  void *argp3 ;
-  int res3 = 0 ;
-  int res4 ;
-  unsigned int val5 ;
-  int ecode5 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:dtmf_callback",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
-  }
-  arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
-  }
-  {
-    res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t,  0  | 0);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
-    }  
-    if (!argp3) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
-    } else {
-      switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
-      arg3 = *temp;
-      if (SWIG_IsNewObj(res3)) delete temp;
-    }
-  }
-  res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0);
-  if (!SWIG_IsOK(res4)) {
-    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4"" of type '" "void *""'"); 
-  }
-  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
-  if (!SWIG_IsOK(ecode5)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5"" of type '" "unsigned int""'");
-  } 
-  arg5 = static_cast< unsigned int >(val5);
-  result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_new_PySession__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+		PySession *result = 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:new_PySession", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+		}
+		arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+		result = (PySession *) new PySession(arg1);
+		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)":new_PySession")) SWIG_fail;
-  result = (PySession *)new PySession();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_new_PySession(PyObject * self, PyObject * args) {
+		int argc;
+		PyObject *argv[2];
+		int ii;
+
+		if (!PyTuple_Check(args))
+			SWIG_fail;
+		argc = (int) PyObject_Length(args);
+		for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+			argv[ii] = PyTuple_GET_ITEM(args, ii);
+		}
+		if (argc == 0) {
+			return _wrap_new_PySession__SWIG_0(self, args);
+		}
+		if (argc == 1) {
+			int _v;
+			void *vptr = 0;
+			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				return _wrap_new_PySession__SWIG_2(self, args);
+			}
+		}
+		if (argc == 1) {
+			int _v;
+			int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+			_v = SWIG_CheckState(res);
+			if (_v) {
+				return _wrap_new_PySession__SWIG_1(self, args);
+			}
+		}
 
-SWIGINTERN PyObject *_wrap_new_PySession__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  char *arg1 = (char *) 0 ;
-  PySession *result = 0 ;
-  int res1 ;
-  char *buf1 = 0 ;
-  int alloc1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:new_PySession",&obj0)) SWIG_fail;
-  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1"" of type '" "char *""'");
-  }
-  arg1 = reinterpret_cast< char * >(buf1);
-  result = (PySession *)new PySession(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW |  0 );
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  return resultobj;
-fail:
-  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-  return NULL;
-}
+	  fail:
+		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'new_PySession'.\n"
+						 "  Possible C/C++ prototypes are:\n" "    PySession()\n" "    PySession(char *)\n" "    PySession(switch_core_session_t *)\n");
+		return NULL;
+	}
 
 
-SWIGINTERN PyObject *_wrap_new_PySession__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  PySession *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:new_PySession",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
-  }
-  arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
-  result = (PySession *)new PySession(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
+	SWIGINTERN PyObject *_wrap_delete_PySession(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		PySession *arg1 = (PySession *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:delete_PySession", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, SWIG_POINTER_DISOWN | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PySession" "', argument " "1" " of type '" "PySession *" "'");
+		}
+		arg1 = reinterpret_cast < PySession * >(argp1);
+		delete arg1;
 
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_new_PySession(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[2];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 0) {
-    return _wrap_new_PySession__SWIG_0(self, args);
-  }
-  if (argc == 1) {
-    int _v;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_PySession__SWIG_2(self, args);
-    }
-  }
-  if (argc == 1) {
-    int _v;
-    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_PySession__SWIG_1(self, args);
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    PySession()\n"
-    "    PySession(char *)\n"
-    "    PySession(switch_core_session_t *)\n");
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_PySession_setDTMFCallback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		PySession *arg1 = (PySession *) 0;
+		PyObject *arg2 = (PyObject *) 0;
+		char *arg3 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res3;
+		char *buf3 = 0;
+		int alloc3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:PySession_setDTMFCallback", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setDTMFCallback" "', argument " "1" " of type '" "PySession *" "'");
+		}
+		arg1 = reinterpret_cast < PySession * >(argp1);
+		arg2 = obj1;
+		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+		if (!SWIG_IsOK(res3)) {
+			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_setDTMFCallback" "', argument " "3" " of type '" "char *" "'");
+		}
+		arg3 = reinterpret_cast < char *>(buf3);
+		(arg1)->setDTMFCallback(arg2, arg3);
+		resultobj = SWIG_Py_Void();
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return resultobj;
+	  fail:
+		if (alloc3 == SWIG_NEWOBJ)
+			delete[]buf3;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_delete_PySession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_PySession",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PySession" "', argument " "1"" of type '" "PySession *""'"); 
-  }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  delete arg1;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_PySession_setHangupHook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		PySession *arg1 = (PySession *) 0;
+		PyObject *arg2 = (PyObject *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:PySession_setHangupHook", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setHangupHook" "', argument " "1" " of type '" "PySession *" "'");
+		}
+		arg1 = reinterpret_cast < PySession * >(argp1);
+		arg2 = obj1;
+		(arg1)->setHangupHook(arg2);
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_PySession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  PyObject *arg2 = (PyObject *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:PySession_setDTMFCallback",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setDTMFCallback" "', argument " "1"" of type '" "PySession *""'"); 
-  }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  arg2 = obj1;
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->setDTMFCallback(arg2,arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return resultobj;
-fail:
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_PySession_check_hangup_hook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		PySession *arg1 = (PySession *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:PySession_check_hangup_hook", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_check_hangup_hook" "', argument " "1" " of type '" "PySession *" "'");
+		}
+		arg1 = reinterpret_cast < PySession * >(argp1);
+		(arg1)->check_hangup_hook();
+		resultobj = SWIG_Py_Void();
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_PySession_setHangupHook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  PyObject *arg2 = (PyObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:PySession_setHangupHook",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setHangupHook" "', argument " "1"" of type '" "PySession *""'"); 
-  }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  arg2 = obj1;
-  (arg1)->setHangupHook(arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_PySession_hangup(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		PySession *arg1 = (PySession *) 0;
+		char *arg2 = (char *) 0;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		char *buf2 = 0;
+		int alloc2 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OO:PySession_hangup", &obj0, &obj1))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_hangup" "', argument " "1" " of type '" "PySession *" "'");
+		}
+		arg1 = reinterpret_cast < PySession * >(argp1);
+		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_hangup" "', argument " "2" " of type '" "char *" "'");
+		}
+		arg2 = reinterpret_cast < char *>(buf2);
+		(arg1)->hangup(arg2);
+		resultobj = SWIG_Py_Void();
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return resultobj;
+	  fail:
+		if (alloc2 == SWIG_NEWOBJ)
+			delete[]buf2;
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_PySession_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:PySession_check_hangup_hook",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_check_hangup_hook" "', argument " "1"" of type '" "PySession *""'"); 
-  }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  (arg1)->check_hangup_hook();
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_PySession_begin_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		PySession *arg1 = (PySession *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:PySession_begin_allow_threads", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_begin_allow_threads" "', argument " "1" " of type '" "PySession *" "'");
+		}
+		arg1 = reinterpret_cast < PySession * >(argp1);
+		result = (bool) (arg1)->begin_allow_threads();
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_PySession_hangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:PySession_hangup",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_hangup" "', argument " "1"" of type '" "PySession *""'"); 
-  }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_hangup" "', argument " "2"" of type '" "char *""'");
-  }
-  arg2 = reinterpret_cast< char * >(buf2);
-  (arg1)->hangup(arg2);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_PySession_end_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		PySession *arg1 = (PySession *) 0;
+		bool result;
+		void *argp1 = 0;
+		int res1 = 0;
+		PyObject *obj0 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "O:PySession_end_allow_threads", &obj0))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_end_allow_threads" "', argument " "1" " of type '" "PySession *" "'");
+		}
+		arg1 = reinterpret_cast < PySession * >(argp1);
+		result = (bool) (arg1)->end_allow_threads();
+		resultobj = SWIG_From_bool(static_cast < bool > (result));
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_PySession_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:PySession_begin_allow_threads",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_begin_allow_threads" "', argument " "1"" of type '" "PySession *""'"); 
-  }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  result = (bool)(arg1)->begin_allow_threads();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *_wrap_PySession_run_dtmf_callback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *resultobj = 0;
+		PySession *arg1 = (PySession *) 0;
+		void *arg2 = (void *) 0;
+		switch_input_type_t arg3;
+		switch_status_t result;
+		void *argp1 = 0;
+		int res1 = 0;
+		int res2;
+		void *argp3;
+		int res3 = 0;
+		PyObject *obj0 = 0;
+		PyObject *obj1 = 0;
+		PyObject *obj2 = 0;
+
+		if (!PyArg_ParseTuple(args, (char *) "OOO:PySession_run_dtmf_callback", &obj0, &obj1, &obj2))
+			SWIG_fail;
+		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+		if (!SWIG_IsOK(res1)) {
+			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_run_dtmf_callback" "', argument " "1" " of type '" "PySession *" "'");
+		}
+		arg1 = reinterpret_cast < PySession * >(argp1);
+		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+		if (!SWIG_IsOK(res2)) {
+			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+		}
+		{
+			res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
+			if (!SWIG_IsOK(res3)) {
+				SWIG_exception_fail(SWIG_ArgError(res3),
+									"in method '" "PySession_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+			}
+			if (!argp3) {
+				SWIG_exception_fail(SWIG_ValueError,
+									"invalid null reference " "in method '" "PySession_run_dtmf_callback" "', argument " "3" " of type '"
+									"switch_input_type_t" "'");
+			} else {
+				switch_input_type_t *temp = reinterpret_cast < switch_input_type_t *>(argp3);
+				arg3 = *temp;
+				if (SWIG_IsNewObj(res3))
+					delete temp;
+			}
+		}
+		result = (arg1)->run_dtmf_callback(arg2, arg3);
+		resultobj =
+			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+		return resultobj;
+	  fail:
+		return NULL;
+	}
 
-SWIGINTERN PyObject *_wrap_PySession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:PySession_end_allow_threads",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_end_allow_threads" "', argument " "1"" of type '" "PySession *""'"); 
-  }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  result = (bool)(arg1)->end_allow_threads();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
 
+	SWIGINTERN PyObject *PySession_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+		PyObject *obj;
+		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+			return NULL;
+		SWIG_TypeNewClientData(SWIGTYPE_p_PySession, SWIG_NewClientData(obj));
+		return SWIG_Py_Void();
+	}
 
-SWIGINTERN PyObject *_wrap_PySession_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_input_type_t arg3 ;
-  switch_status_t result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  void *argp3 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:PySession_run_dtmf_callback",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_run_dtmf_callback" "', argument " "1"" of type '" "PySession *""'"); 
-  }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
-  }
-  {
-    res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t,  0  | 0);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
-    }  
-    if (!argp3) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
-    } else {
-      switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
-      arg3 = *temp;
-      if (SWIG_IsNewObj(res3)) delete temp;
-    }
-  }
-  result = (arg1)->run_dtmf_callback(arg2,arg3);
-  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *PySession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_PySession, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
-
-static PyMethodDef SwigMethods[] = {
-	 { (char *)"consoleLog", _wrap_consoleLog, METH_VARARGS, NULL},
-	 { (char *)"consoleCleanLog", _wrap_consoleCleanLog, METH_VARARGS, NULL},
-	 { (char *)"new_IVRMenu", _wrap_new_IVRMenu, METH_VARARGS, NULL},
-	 { (char *)"delete_IVRMenu", _wrap_delete_IVRMenu, METH_VARARGS, NULL},
-	 { (char *)"IVRMenu_bindAction", _wrap_IVRMenu_bindAction, METH_VARARGS, NULL},
-	 { (char *)"IVRMenu_execute", _wrap_IVRMenu_execute, METH_VARARGS, NULL},
-	 { (char *)"IVRMenu_swigregister", IVRMenu_swigregister, METH_VARARGS, NULL},
-	 { (char *)"new_API", _wrap_new_API, METH_VARARGS, NULL},
-	 { (char *)"delete_API", _wrap_delete_API, METH_VARARGS, NULL},
-	 { (char *)"API_execute", _wrap_API_execute, METH_VARARGS, NULL},
-	 { (char *)"API_executeString", _wrap_API_executeString, METH_VARARGS, NULL},
-	 { (char *)"API_swigregister", API_swigregister, METH_VARARGS, NULL},
-	 { (char *)"input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL},
-	 { (char *)"input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL},
-	 { (char *)"input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set, METH_VARARGS, NULL},
-	 { (char *)"input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get, METH_VARARGS, NULL},
-	 { (char *)"input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set, METH_VARARGS, NULL},
-	 { (char *)"input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get, METH_VARARGS, NULL},
-	 { (char *)"input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set, METH_VARARGS, NULL},
-	 { (char *)"input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get, METH_VARARGS, NULL},
-	 { (char *)"new_input_callback_state_t", _wrap_new_input_callback_state_t, METH_VARARGS, NULL},
-	 { (char *)"delete_input_callback_state_t", _wrap_delete_input_callback_state_t, METH_VARARGS, NULL},
-	 { (char *)"input_callback_state_t_swigregister", input_callback_state_t_swigregister, METH_VARARGS, NULL},
-	 { (char *)"new_Stream", _wrap_new_Stream, METH_VARARGS, NULL},
-	 { (char *)"delete_Stream", _wrap_delete_Stream, METH_VARARGS, NULL},
-	 { (char *)"Stream_write", _wrap_Stream_write, METH_VARARGS, NULL},
-	 { (char *)"Stream_get_data", _wrap_Stream_get_data, METH_VARARGS, NULL},
-	 { (char *)"Stream_swigregister", Stream_swigregister, METH_VARARGS, NULL},
-	 { (char *)"Event_event_set", _wrap_Event_event_set, METH_VARARGS, NULL},
-	 { (char *)"Event_event_get", _wrap_Event_event_get, METH_VARARGS, NULL},
-	 { (char *)"Event_serialized_string_set", _wrap_Event_serialized_string_set, METH_VARARGS, NULL},
-	 { (char *)"Event_serialized_string_get", _wrap_Event_serialized_string_get, METH_VARARGS, NULL},
-	 { (char *)"Event_mine_set", _wrap_Event_mine_set, METH_VARARGS, NULL},
-	 { (char *)"Event_mine_get", _wrap_Event_mine_get, METH_VARARGS, NULL},
-	 { (char *)"new_Event", _wrap_new_Event, METH_VARARGS, NULL},
-	 { (char *)"delete_Event", _wrap_delete_Event, METH_VARARGS, NULL},
-	 { (char *)"Event_serialize", _wrap_Event_serialize, METH_VARARGS, NULL},
-	 { (char *)"Event_setPriority", _wrap_Event_setPriority, METH_VARARGS, NULL},
-	 { (char *)"Event_getHeader", _wrap_Event_getHeader, METH_VARARGS, NULL},
-	 { (char *)"Event_getBody", _wrap_Event_getBody, METH_VARARGS, NULL},
-	 { (char *)"Event_getType", _wrap_Event_getType, METH_VARARGS, NULL},
-	 { (char *)"Event_addBody", _wrap_Event_addBody, METH_VARARGS, NULL},
-	 { (char *)"Event_addHeader", _wrap_Event_addHeader, METH_VARARGS, NULL},
-	 { (char *)"Event_delHeader", _wrap_Event_delHeader, METH_VARARGS, NULL},
-	 { (char *)"Event_fire", _wrap_Event_fire, METH_VARARGS, NULL},
-	 { (char *)"Event_swigregister", Event_swigregister, METH_VARARGS, NULL},
-	 { (char *)"delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_session_get", _wrap_CoreSession_session_get, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_channel_set", _wrap_CoreSession_channel_set, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_channel_get", _wrap_CoreSession_channel_get, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_flags_set", _wrap_CoreSession_flags_set, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_flags_get", _wrap_CoreSession_flags_get, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_allocated_set", _wrap_CoreSession_allocated_set, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_allocated_get", _wrap_CoreSession_allocated_get, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_answer", _wrap_CoreSession_answer, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_preAnswer", _wrap_CoreSession_preAnswer, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_setVariable", _wrap_CoreSession_setVariable, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_setPrivate", _wrap_CoreSession_setPrivate, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_getPrivate", _wrap_CoreSession_getPrivate, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_say", _wrap_CoreSession_say, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_collectDigits", _wrap_CoreSession_collectDigits, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_getDigits", _wrap_CoreSession_getDigits, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_transfer", _wrap_CoreSession_transfer, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_read", _wrap_CoreSession_read, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_streamFile", _wrap_CoreSession_streamFile, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_flushEvents", _wrap_CoreSession_flushEvents, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_flushDigits", _wrap_CoreSession_flushDigits, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_ready", _wrap_CoreSession_ready, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_sendEvent", _wrap_CoreSession_sendEvent, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_setEventData", _wrap_CoreSession_setEventData, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_get_uuid", _wrap_CoreSession_get_uuid, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback, METH_VARARGS, NULL},
-	 { (char *)"CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL},
-	 { (char *)"console_log", _wrap_console_log, METH_VARARGS, NULL},
-	 { (char *)"console_clean_log", _wrap_console_clean_log, METH_VARARGS, NULL},
-	 { (char *)"bridge", _wrap_bridge, METH_VARARGS, NULL},
-	 { (char *)"hanguphook", _wrap_hanguphook, METH_VARARGS, NULL},
-	 { (char *)"dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL},
-	 { (char *)"new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
-	 { (char *)"delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
-	 { (char *)"PySession_setDTMFCallback", _wrap_PySession_setDTMFCallback, METH_VARARGS, NULL},
-	 { (char *)"PySession_setHangupHook", _wrap_PySession_setHangupHook, METH_VARARGS, NULL},
-	 { (char *)"PySession_check_hangup_hook", _wrap_PySession_check_hangup_hook, METH_VARARGS, NULL},
-	 { (char *)"PySession_hangup", _wrap_PySession_hangup, METH_VARARGS, NULL},
-	 { (char *)"PySession_begin_allow_threads", _wrap_PySession_begin_allow_threads, METH_VARARGS, NULL},
-	 { (char *)"PySession_end_allow_threads", _wrap_PySession_end_allow_threads, METH_VARARGS, NULL},
-	 { (char *)"PySession_run_dtmf_callback", _wrap_PySession_run_dtmf_callback, METH_VARARGS, NULL},
-	 { (char *)"PySession_swigregister", PySession_swigregister, METH_VARARGS, NULL},
-	 { NULL, NULL, 0, NULL }
-};
+	static PyMethodDef SwigMethods[] = {
+		{(char *) "consoleLog", _wrap_consoleLog, METH_VARARGS, NULL},
+		{(char *) "consoleCleanLog", _wrap_consoleCleanLog, METH_VARARGS, NULL},
+		{(char *) "new_IVRMenu", _wrap_new_IVRMenu, METH_VARARGS, NULL},
+		{(char *) "delete_IVRMenu", _wrap_delete_IVRMenu, METH_VARARGS, NULL},
+		{(char *) "IVRMenu_bindAction", _wrap_IVRMenu_bindAction, METH_VARARGS, NULL},
+		{(char *) "IVRMenu_execute", _wrap_IVRMenu_execute, METH_VARARGS, NULL},
+		{(char *) "IVRMenu_swigregister", IVRMenu_swigregister, METH_VARARGS, NULL},
+		{(char *) "new_API", _wrap_new_API, METH_VARARGS, NULL},
+		{(char *) "delete_API", _wrap_delete_API, METH_VARARGS, NULL},
+		{(char *) "API_execute", _wrap_API_execute, METH_VARARGS, NULL},
+		{(char *) "API_executeString", _wrap_API_executeString, METH_VARARGS, NULL},
+		{(char *) "API_swigregister", API_swigregister, METH_VARARGS, NULL},
+		{(char *) "input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL},
+		{(char *) "input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL},
+		{(char *) "input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set, METH_VARARGS, NULL},
+		{(char *) "input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get, METH_VARARGS, NULL},
+		{(char *) "input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set, METH_VARARGS, NULL},
+		{(char *) "input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get, METH_VARARGS, NULL},
+		{(char *) "input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set, METH_VARARGS, NULL},
+		{(char *) "input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get, METH_VARARGS, NULL},
+		{(char *) "new_input_callback_state_t", _wrap_new_input_callback_state_t, METH_VARARGS, NULL},
+		{(char *) "delete_input_callback_state_t", _wrap_delete_input_callback_state_t, METH_VARARGS, NULL},
+		{(char *) "input_callback_state_t_swigregister", input_callback_state_t_swigregister, METH_VARARGS, NULL},
+		{(char *) "new_Stream", _wrap_new_Stream, METH_VARARGS, NULL},
+		{(char *) "delete_Stream", _wrap_delete_Stream, METH_VARARGS, NULL},
+		{(char *) "Stream_write", _wrap_Stream_write, METH_VARARGS, NULL},
+		{(char *) "Stream_get_data", _wrap_Stream_get_data, METH_VARARGS, NULL},
+		{(char *) "Stream_swigregister", Stream_swigregister, METH_VARARGS, NULL},
+		{(char *) "Event_event_set", _wrap_Event_event_set, METH_VARARGS, NULL},
+		{(char *) "Event_event_get", _wrap_Event_event_get, METH_VARARGS, NULL},
+		{(char *) "Event_serialized_string_set", _wrap_Event_serialized_string_set, METH_VARARGS, NULL},
+		{(char *) "Event_serialized_string_get", _wrap_Event_serialized_string_get, METH_VARARGS, NULL},
+		{(char *) "Event_mine_set", _wrap_Event_mine_set, METH_VARARGS, NULL},
+		{(char *) "Event_mine_get", _wrap_Event_mine_get, METH_VARARGS, NULL},
+		{(char *) "new_Event", _wrap_new_Event, METH_VARARGS, NULL},
+		{(char *) "delete_Event", _wrap_delete_Event, METH_VARARGS, NULL},
+		{(char *) "Event_serialize", _wrap_Event_serialize, METH_VARARGS, NULL},
+		{(char *) "Event_setPriority", _wrap_Event_setPriority, METH_VARARGS, NULL},
+		{(char *) "Event_getHeader", _wrap_Event_getHeader, METH_VARARGS, NULL},
+		{(char *) "Event_getBody", _wrap_Event_getBody, METH_VARARGS, NULL},
+		{(char *) "Event_getType", _wrap_Event_getType, METH_VARARGS, NULL},
+		{(char *) "Event_addBody", _wrap_Event_addBody, METH_VARARGS, NULL},
+		{(char *) "Event_addHeader", _wrap_Event_addHeader, METH_VARARGS, NULL},
+		{(char *) "Event_delHeader", _wrap_Event_delHeader, METH_VARARGS, NULL},
+		{(char *) "Event_fire", _wrap_Event_fire, METH_VARARGS, NULL},
+		{(char *) "Event_swigregister", Event_swigregister, METH_VARARGS, NULL},
+		{(char *) "delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL},
+		{(char *) "CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL},
+		{(char *) "CoreSession_session_get", _wrap_CoreSession_session_get, METH_VARARGS, NULL},
+		{(char *) "CoreSession_channel_set", _wrap_CoreSession_channel_set, METH_VARARGS, NULL},
+		{(char *) "CoreSession_channel_get", _wrap_CoreSession_channel_get, METH_VARARGS, NULL},
+		{(char *) "CoreSession_flags_set", _wrap_CoreSession_flags_set, METH_VARARGS, NULL},
+		{(char *) "CoreSession_flags_get", _wrap_CoreSession_flags_get, METH_VARARGS, NULL},
+		{(char *) "CoreSession_allocated_set", _wrap_CoreSession_allocated_set, METH_VARARGS, NULL},
+		{(char *) "CoreSession_allocated_get", _wrap_CoreSession_allocated_get, METH_VARARGS, NULL},
+		{(char *) "CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set, METH_VARARGS, NULL},
+		{(char *) "CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get, METH_VARARGS, NULL},
+		{(char *) "CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set, METH_VARARGS, NULL},
+		{(char *) "CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get, METH_VARARGS, NULL},
+		{(char *) "CoreSession_answer", _wrap_CoreSession_answer, METH_VARARGS, NULL},
+		{(char *) "CoreSession_preAnswer", _wrap_CoreSession_preAnswer, METH_VARARGS, NULL},
+		{(char *) "CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL},
+		{(char *) "CoreSession_setVariable", _wrap_CoreSession_setVariable, METH_VARARGS, NULL},
+		{(char *) "CoreSession_setPrivate", _wrap_CoreSession_setPrivate, METH_VARARGS, NULL},
+		{(char *) "CoreSession_getPrivate", _wrap_CoreSession_getPrivate, METH_VARARGS, NULL},
+		{(char *) "CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
+		{(char *) "CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result, METH_VARARGS, NULL},
+		{(char *) "CoreSession_say", _wrap_CoreSession_say, METH_VARARGS, NULL},
+		{(char *) "CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase, METH_VARARGS, NULL},
+		{(char *) "CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
+		{(char *) "CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
+		{(char *) "CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
+		{(char *) "CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
+		{(char *) "CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
+		{(char *) "CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL},
+		{(char *) "CoreSession_collectDigits", _wrap_CoreSession_collectDigits, METH_VARARGS, NULL},
+		{(char *) "CoreSession_getDigits", _wrap_CoreSession_getDigits, METH_VARARGS, NULL},
+		{(char *) "CoreSession_transfer", _wrap_CoreSession_transfer, METH_VARARGS, NULL},
+		{(char *) "CoreSession_read", _wrap_CoreSession_read, METH_VARARGS, NULL},
+		{(char *) "CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits, METH_VARARGS, NULL},
+		{(char *) "CoreSession_streamFile", _wrap_CoreSession_streamFile, METH_VARARGS, NULL},
+		{(char *) "CoreSession_flushEvents", _wrap_CoreSession_flushEvents, METH_VARARGS, NULL},
+		{(char *) "CoreSession_flushDigits", _wrap_CoreSession_flushDigits, METH_VARARGS, NULL},
+		{(char *) "CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup, METH_VARARGS, NULL},
+		{(char *) "CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook, METH_VARARGS, NULL},
+		{(char *) "CoreSession_ready", _wrap_CoreSession_ready, METH_VARARGS, NULL},
+		{(char *) "CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL},
+		{(char *) "CoreSession_sendEvent", _wrap_CoreSession_sendEvent, METH_VARARGS, NULL},
+		{(char *) "CoreSession_setEventData", _wrap_CoreSession_setEventData, METH_VARARGS, NULL},
+		{(char *) "CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR, METH_VARARGS, NULL},
+		{(char *) "CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads, METH_VARARGS, NULL},
+		{(char *) "CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads, METH_VARARGS, NULL},
+		{(char *) "CoreSession_get_uuid", _wrap_CoreSession_get_uuid, METH_VARARGS, NULL},
+		{(char *) "CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args, METH_VARARGS, NULL},
+		{(char *) "CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook, METH_VARARGS, NULL},
+		{(char *) "CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback, METH_VARARGS, NULL},
+		{(char *) "CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL},
+		{(char *) "console_log", _wrap_console_log, METH_VARARGS, NULL},
+		{(char *) "console_clean_log", _wrap_console_clean_log, METH_VARARGS, NULL},
+		{(char *) "bridge", _wrap_bridge, METH_VARARGS, NULL},
+		{(char *) "hanguphook", _wrap_hanguphook, METH_VARARGS, NULL},
+		{(char *) "dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL},
+		{(char *) "new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
+		{(char *) "delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
+		{(char *) "PySession_setDTMFCallback", _wrap_PySession_setDTMFCallback, METH_VARARGS, NULL},
+		{(char *) "PySession_setHangupHook", _wrap_PySession_setHangupHook, METH_VARARGS, NULL},
+		{(char *) "PySession_check_hangup_hook", _wrap_PySession_check_hangup_hook, METH_VARARGS, NULL},
+		{(char *) "PySession_hangup", _wrap_PySession_hangup, METH_VARARGS, NULL},
+		{(char *) "PySession_begin_allow_threads", _wrap_PySession_begin_allow_threads, METH_VARARGS, NULL},
+		{(char *) "PySession_end_allow_threads", _wrap_PySession_end_allow_threads, METH_VARARGS, NULL},
+		{(char *) "PySession_run_dtmf_callback", _wrap_PySession_run_dtmf_callback, METH_VARARGS, NULL},
+		{(char *) "PySession_swigregister", PySession_swigregister, METH_VARARGS, NULL},
+		{NULL, NULL, 0, NULL}
+	};
 
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
-static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) {
-    return (void *)((CoreSession *)  ((PySession *) x));
-}
-static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_PySession = {"_p_PySession", "PySession *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_swap_state_t = {"_p_swap_state_t", "enum swap_state_t *|swap_state_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
-
-static swig_type_info *swig_type_initial[] = {
-  &_swigt__p_API,
-  &_swigt__p_CoreSession,
-  &_swigt__p_Event,
-  &_swigt__p_IVRMenu,
-  &_swigt__p_PySession,
-  &_swigt__p_Stream,
-  &_swigt__p_char,
-  &_swigt__p_input_callback_state,
-  &_swigt__p_session_flag_t,
-  &_swigt__p_swap_state_t,
-  &_swigt__p_switch_channel_state_t,
-  &_swigt__p_switch_channel_t,
-  &_swigt__p_switch_core_session_t,
-  &_swigt__p_switch_event_t,
-  &_swigt__p_switch_input_args_t,
-  &_swigt__p_switch_input_type_t,
-  &_swigt__p_switch_priority_t,
-  &_swigt__p_switch_status_t,
-  &_swigt__p_switch_stream_handle_t,
-  &_swigt__p_void,
-};
-
-static swig_cast_info _swigc__p_API[] = {  {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_PySession, _p_PySessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Event[] = {  {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_IVRMenu[] = {  {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_PySession[] = {  {&_swigt__p_PySession, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Stream[] = {  {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_input_callback_state[] = {  {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_session_flag_t[] = {  {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_swap_state_t[] = {  {&_swigt__p_swap_state_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_state_t[] = {  {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_t[] = {  {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_core_session_t[] = {  {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_event_t[] = {  {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_args_t[] = {  {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_type_t[] = {  {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_priority_t[] = {  {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_status_t[] = {  {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_stream_handle_t[] = {  {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
-
-static swig_cast_info *swig_cast_initial[] = {
-  _swigc__p_API,
-  _swigc__p_CoreSession,
-  _swigc__p_Event,
-  _swigc__p_IVRMenu,
-  _swigc__p_PySession,
-  _swigc__p_Stream,
-  _swigc__p_char,
-  _swigc__p_input_callback_state,
-  _swigc__p_session_flag_t,
-  _swigc__p_swap_state_t,
-  _swigc__p_switch_channel_state_t,
-  _swigc__p_switch_channel_t,
-  _swigc__p_switch_core_session_t,
-  _swigc__p_switch_event_t,
-  _swigc__p_switch_input_args_t,
-  _swigc__p_switch_input_type_t,
-  _swigc__p_switch_priority_t,
-  _swigc__p_switch_status_t,
-  _swigc__p_switch_stream_handle_t,
-  _swigc__p_void,
-};
+	static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) {
+		return (void *) ((CoreSession *) ((PySession *) x));
+	}
+	static swig_type_info _swigt__p_API = { "_p_API", "API *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_CoreSession = { "_p_CoreSession", "CoreSession *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_Event = { "_p_Event", "Event *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_IVRMenu = { "_p_IVRMenu", "IVRMenu *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_PySession = { "_p_PySession", "PySession *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_Stream = { "_p_Stream", "Stream *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_char = { "_p_char", "char *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_input_callback_state =
+		{ "_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_session_flag_t = { "_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_swap_state_t = { "_p_swap_state_t", "enum swap_state_t *|swap_state_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_event_t = { "_p_switch_event_t", "switch_event_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_input_args_t = { "_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_input_type_t = { "_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_priority_t = { "_p_switch_priority_t", "switch_priority_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_status_t = { "_p_switch_status_t", "switch_status_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_switch_stream_handle_t = { "_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void *) 0, 0 };
+	static swig_type_info _swigt__p_void = { "_p_void", "void *", 0, 0, (void *) 0, 0 };
+
+	static swig_type_info *swig_type_initial[] = {
+		&_swigt__p_API,
+		&_swigt__p_CoreSession,
+		&_swigt__p_Event,
+		&_swigt__p_IVRMenu,
+		&_swigt__p_PySession,
+		&_swigt__p_Stream,
+		&_swigt__p_char,
+		&_swigt__p_input_callback_state,
+		&_swigt__p_session_flag_t,
+		&_swigt__p_swap_state_t,
+		&_swigt__p_switch_channel_state_t,
+		&_swigt__p_switch_channel_t,
+		&_swigt__p_switch_core_session_t,
+		&_swigt__p_switch_event_t,
+		&_swigt__p_switch_input_args_t,
+		&_swigt__p_switch_input_type_t,
+		&_swigt__p_switch_priority_t,
+		&_swigt__p_switch_status_t,
+		&_swigt__p_switch_stream_handle_t,
+		&_swigt__p_void,
+	};
+
+	static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_CoreSession[] =
+		{ {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PySession, _p_PySessionTo_p_CoreSession, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_PySession[] = { {&_swigt__p_PySession, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_swap_state_t[] = { {&_swigt__p_swap_state_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
+	static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0}, {0, 0, 0, 0} };
+
+	static swig_cast_info *swig_cast_initial[] = {
+		_swigc__p_API,
+		_swigc__p_CoreSession,
+		_swigc__p_Event,
+		_swigc__p_IVRMenu,
+		_swigc__p_PySession,
+		_swigc__p_Stream,
+		_swigc__p_char,
+		_swigc__p_input_callback_state,
+		_swigc__p_session_flag_t,
+		_swigc__p_swap_state_t,
+		_swigc__p_switch_channel_state_t,
+		_swigc__p_switch_channel_t,
+		_swigc__p_switch_core_session_t,
+		_swigc__p_switch_event_t,
+		_swigc__p_switch_input_args_t,
+		_swigc__p_switch_input_type_t,
+		_swigc__p_switch_priority_t,
+		_swigc__p_switch_status_t,
+		_swigc__p_switch_stream_handle_t,
+		_swigc__p_void,
+	};
 
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
 
-static swig_const_info swig_const_table[] = {
-{0, 0, 0, 0.0, 0, 0}};
+	static swig_const_info swig_const_table[] = {
+		{0, 0, 0, 0.0, 0, 0}
+	};
 
 #ifdef __cplusplus
 }
@@ -7912,160 +8198,162 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-} /* c-mode */
+}								/* c-mode */
 #endif
 #endif
-
 #if 0
 #define SWIGRUNTIME_DEBUG
 #endif
+SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
+{
+	size_t i;
+	swig_module_info *module_head, *iter;
+	int found, init;
+
+	clientdata = clientdata;
+
+	/* check to see if the circular list has been setup, if not, set it up */
+	if (swig_module.next == 0) {
+		/* Initialize the swig_module */
+		swig_module.type_initial = swig_type_initial;
+		swig_module.cast_initial = swig_cast_initial;
+		swig_module.next = &swig_module;
+		init = 1;
+	} else {
+		init = 0;
+	}
 
+	/* Try and load any already created modules */
+	module_head = SWIG_GetModule(clientdata);
+	if (!module_head) {
+		/* This is the first module loaded for this interpreter */
+		/* so set the swig module into the interpreter */
+		SWIG_SetModule(clientdata, &swig_module);
+		module_head = &swig_module;
+	} else {
+		/* the interpreter has loaded a SWIG module, but has it loaded this one? */
+		found = 0;
+		iter = module_head;
+		do {
+			if (iter == &swig_module) {
+				found = 1;
+				break;
+			}
+			iter = iter->next;
+		} while (iter != module_head);
+
+		/* if the is found in the list, then all is done and we may leave */
+		if (found)
+			return;
+		/* otherwise we must add out module into the list */
+		swig_module.next = module_head->next;
+		module_head->next = &swig_module;
+	}
 
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
-  size_t i;
-  swig_module_info *module_head, *iter;
-  int found, init;
-  
-  clientdata = clientdata;
-  
-  /* check to see if the circular list has been setup, if not, set it up */
-  if (swig_module.next==0) {
-    /* Initialize the swig_module */
-    swig_module.type_initial = swig_type_initial;
-    swig_module.cast_initial = swig_cast_initial;
-    swig_module.next = &swig_module;
-    init = 1;
-  } else {
-    init = 0;
-  }
-  
-  /* Try and load any already created modules */
-  module_head = SWIG_GetModule(clientdata);
-  if (!module_head) {
-    /* This is the first module loaded for this interpreter */
-    /* so set the swig module into the interpreter */
-    SWIG_SetModule(clientdata, &swig_module);
-    module_head = &swig_module;
-  } else {
-    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
-    found=0;
-    iter=module_head;
-    do {
-      if (iter==&swig_module) {
-        found=1;
-        break;
-      }
-      iter=iter->next;
-    } while (iter!= module_head);
-    
-    /* if the is found in the list, then all is done and we may leave */
-    if (found) return;
-    /* otherwise we must add out module into the list */
-    swig_module.next = module_head->next;
-    module_head->next = &swig_module;
-  }
-  
-  /* When multiple interpeters are used, a module could have already been initialized in
-       a different interpreter, but not yet have a pointer in this interpreter.
-       In this case, we do not want to continue adding types... everything should be
-       set up already */
-  if (init == 0) return;
-  
-  /* Now work on filling in swig_module.types */
+	/* When multiple interpeters are used, a module could have already been initialized in
+	   a different interpreter, but not yet have a pointer in this interpreter.
+	   In this case, we do not want to continue adding types... everything should be
+	   set up already */
+	if (init == 0)
+		return;
+
+	/* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
-  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+	printf("SWIG_InitializeModule: size %d\n", swig_module.size);
 #endif
-  for (i = 0; i < swig_module.size; ++i) {
-    swig_type_info *type = 0;
-    swig_type_info *ret;
-    swig_cast_info *cast;
-    
+	for (i = 0; i < swig_module.size; ++i) {
+		swig_type_info *type = 0;
+		swig_type_info *ret;
+		swig_cast_info *cast;
+
 #ifdef SWIGRUNTIME_DEBUG
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
 #endif
-    
-    /* if there is another module already loaded */
-    if (swig_module.next != &swig_module) {
-      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
-    }
-    if (type) {
-      /* Overwrite clientdata field */
+
+		/* if there is another module already loaded */
+		if (swig_module.next != &swig_module) {
+			type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+		}
+		if (type) {
+			/* Overwrite clientdata field */
 #ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: found type %s\n", type->name);
+			printf("SWIG_InitializeModule: found type %s\n", type->name);
 #endif
-      if (swig_module.type_initial[i]->clientdata) {
-        type->clientdata = swig_module.type_initial[i]->clientdata;
+			if (swig_module.type_initial[i]->clientdata) {
+				type->clientdata = swig_module.type_initial[i]->clientdata;
 #ifdef SWIGRUNTIME_DEBUG
-        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+				printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
 #endif
-      }
-    } else {
-      type = swig_module.type_initial[i];
-    }
-    
-    /* Insert casting types */
-    cast = swig_module.cast_initial[i];
-    while (cast->type) {
-      /* Don't need to add information already in the list */
-      ret = 0;
+			}
+		} else {
+			type = swig_module.type_initial[i];
+		}
+
+		/* Insert casting types */
+		cast = swig_module.cast_initial[i];
+		while (cast->type) {
+			/* Don't need to add information already in the list */
+			ret = 0;
 #ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+			printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
 #endif
-      if (swig_module.next != &swig_module) {
-        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+			if (swig_module.next != &swig_module) {
+				ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
 #ifdef SWIGRUNTIME_DEBUG
-        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+				if (ret)
+					printf("SWIG_InitializeModule: found cast %s\n", ret->name);
 #endif
-      }
-      if (ret) {
-        if (type == swig_module.type_initial[i]) {
+			}
+			if (ret) {
+				if (type == swig_module.type_initial[i]) {
 #ifdef SWIGRUNTIME_DEBUG
-          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+					printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
 #endif
-          cast->type = ret;
-          ret = 0;
-        } else {
-          /* Check for casting already in the list */
-          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+					cast->type = ret;
+					ret = 0;
+				} else {
+					/* Check for casting already in the list */
+					swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
 #ifdef SWIGRUNTIME_DEBUG
-          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+					if (ocast)
+						printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
 #endif
-          if (!ocast) ret = 0;
-        }
-      }
-      
-      if (!ret) {
+					if (!ocast)
+						ret = 0;
+				}
+			}
+
+			if (!ret) {
 #ifdef SWIGRUNTIME_DEBUG
-        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+				printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
 #endif
-        if (type->cast) {
-          type->cast->prev = cast;
-          cast->next = type->cast;
-        }
-        type->cast = cast;
-      }
-      cast++;
-    }
-    /* Set entry in modules->types array equal to the type */
-    swig_module.types[i] = type;
-  }
-  swig_module.types[i] = 0;
-  
+				if (type->cast) {
+					type->cast->prev = cast;
+					cast->next = type->cast;
+				}
+				type->cast = cast;
+			}
+			cast++;
+		}
+		/* Set entry in modules->types array equal to the type */
+		swig_module.types[i] = type;
+	}
+	swig_module.types[i] = 0;
+
 #ifdef SWIGRUNTIME_DEBUG
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
-  for (i = 0; i < swig_module.size; ++i) {
-    int j = 0;
-    swig_cast_info *cast = swig_module.cast_initial[i];
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-    while (cast->type) {
-      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
-      cast++;
-      ++j;
-    }
-    printf("---- Total casts: %d\n",j);
-  }
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
+	printf("**** SWIG_InitializeModule: Cast List ******\n");
+	for (i = 0; i < swig_module.size; ++i) {
+		int j = 0;
+		swig_cast_info *cast = swig_module.cast_initial[i];
+		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+		while (cast->type) {
+			printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+			cast++;
+			++j;
+		}
+		printf("---- Total casts: %d\n", j);
+	}
+	printf("**** SWIG_InitializeModule: Cast List ******\n");
 #endif
 }
 
@@ -8074,33 +8362,34 @@
 * of equivalent types.  It is like calling
 * SWIG_TypeClientData(type, clientdata) a second time.
 */
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
-  size_t i;
-  swig_cast_info *equiv;
-  static int init_run = 0;
-  
-  if (init_run) return;
-  init_run = 1;
-  
-  for (i = 0; i < swig_module.size; i++) {
-    if (swig_module.types[i]->clientdata) {
-      equiv = swig_module.types[i]->cast;
-      while (equiv) {
-        if (!equiv->converter) {
-          if (equiv->type && !equiv->type->clientdata)
-          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
-        }
-        equiv = equiv->next;
-      }
-    }
-  }
+SWIGRUNTIME void SWIG_PropagateClientData(void)
+{
+	size_t i;
+	swig_cast_info *equiv;
+	static int init_run = 0;
+
+	if (init_run)
+		return;
+	init_run = 1;
+
+	for (i = 0; i < swig_module.size; i++) {
+		if (swig_module.types[i]->clientdata) {
+			equiv = swig_module.types[i]->cast;
+			while (equiv) {
+				if (!equiv->converter) {
+					if (equiv->type && !equiv->type->clientdata)
+						SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+				}
+				equiv = equiv->next;
+			}
+		}
+	}
 }
 
 #ifdef __cplusplus
 #if 0
 {
-  /* c-mode */
+	/* c-mode */
 #endif
 }
 #endif
@@ -8110,258 +8399,240 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-  
-  /* Python-specific SWIG API */
+
+	/* Python-specific SWIG API */
 #define SWIG_newvarlink()                             SWIG_Python_newvarlink()
 #define SWIG_addvarlink(p, name, get_attr, set_attr)  SWIG_Python_addvarlink(p, name, get_attr, set_attr)
 #define SWIG_InstallConstants(d, constants)           SWIG_Python_InstallConstants(d, constants)
-  
-  /* -----------------------------------------------------------------------------
-   * global variable support code.
-   * ----------------------------------------------------------------------------- */
-  
-  typedef struct swig_globalvar {
-    char       *name;                  /* Name of global variable */
-    PyObject *(*get_attr)(void);       /* Return the current value */
-    int       (*set_attr)(PyObject *); /* Set the value */
-    struct swig_globalvar *next;
-  } swig_globalvar;
-  
-  typedef struct swig_varlinkobject {
-    PyObject_HEAD
-    swig_globalvar *vars;
-  } swig_varlinkobject;
-  
-  SWIGINTERN PyObject *
-  swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
-    return PyString_FromString("<Swig global variables>");
-  }
-  
-  SWIGINTERN PyObject *
-  swig_varlink_str(swig_varlinkobject *v) {
-    PyObject *str = PyString_FromString("(");
-    swig_globalvar  *var;
-    for (var = v->vars; var; var=var->next) {
-      PyString_ConcatAndDel(&str,PyString_FromString(var->name));
-      if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
-    }
-    PyString_ConcatAndDel(&str,PyString_FromString(")"));
-    return str;
-  }
-  
-  SWIGINTERN int
-  swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
-    PyObject *str = swig_varlink_str(v);
-    fprintf(fp,"Swig global variables ");
-    fprintf(fp,"%s\n", PyString_AsString(str));
-    Py_DECREF(str);
-    return 0;
-  }
-  
-  SWIGINTERN void
-  swig_varlink_dealloc(swig_varlinkobject *v) {
-    swig_globalvar *var = v->vars;
-    while (var) {
-      swig_globalvar *n = var->next;
-      free(var->name);
-      free(var);
-      var = n;
-    }
-  }
-  
-  SWIGINTERN PyObject *
-  swig_varlink_getattr(swig_varlinkobject *v, char *n) {
-    PyObject *res = NULL;
-    swig_globalvar *var = v->vars;
-    while (var) {
-      if (strcmp(var->name,n) == 0) {
-        res = (*var->get_attr)();
-        break;
-      }
-      var = var->next;
-    }
-    if (res == NULL && !PyErr_Occurred()) {
-      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
-    }
-    return res;
-  }
-  
-  SWIGINTERN int
-  swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
-    int res = 1;
-    swig_globalvar *var = v->vars;
-    while (var) {
-      if (strcmp(var->name,n) == 0) {
-        res = (*var->set_attr)(p);
-        break;
-      }
-      var = var->next;
-    }
-    if (res == 1 && !PyErr_Occurred()) {
-      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
-    }
-    return res;
-  }
-  
-  SWIGINTERN PyTypeObject*
-  swig_varlink_type(void) {
-    static char varlink__doc__[] = "Swig var link object";
-    static PyTypeObject varlink_type;
-    static int type_init = 0;  
-    if (!type_init) {
-      const PyTypeObject tmp
-      = {
-        PyObject_HEAD_INIT(NULL)
-        0,                                  /* Number of items in variable part (ob_size) */
-        (char *)"swigvarlink",              /* Type name (tp_name) */
-        sizeof(swig_varlinkobject),         /* Basic size (tp_basicsize) */
-        0,                                  /* Itemsize (tp_itemsize) */
-        (destructor) swig_varlink_dealloc,   /* Deallocator (tp_dealloc) */ 
-        (printfunc) swig_varlink_print,     /* Print (tp_print) */
-        (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
-        (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
-        0,                                  /* tp_compare */
-        (reprfunc) swig_varlink_repr,       /* tp_repr */
-        0,                                  /* tp_as_number */
-        0,                                  /* tp_as_sequence */
-        0,                                  /* tp_as_mapping */
-        0,                                  /* tp_hash */
-        0,                                  /* tp_call */
-        (reprfunc)swig_varlink_str,        /* tp_str */
-        0,                                  /* tp_getattro */
-        0,                                  /* tp_setattro */
-        0,                                  /* tp_as_buffer */
-        0,                                  /* tp_flags */
-        varlink__doc__,                     /* tp_doc */
-        0,                                  /* tp_traverse */
-        0,                                  /* tp_clear */
-        0,                                  /* tp_richcompare */
-        0,                                  /* tp_weaklistoffset */
+
+	/* -----------------------------------------------------------------------------
+	 * global variable support code.
+	 * ----------------------------------------------------------------------------- */
+
+	typedef struct swig_globalvar {
+		char *name;				/* Name of global variable */
+		PyObject *(*get_attr) (void);	/* Return the current value */
+		int (*set_attr) (PyObject *);	/* Set the value */
+		struct swig_globalvar *next;
+	} swig_globalvar;
+
+	typedef struct swig_varlinkobject {
+		PyObject_HEAD swig_globalvar * vars;
+	} swig_varlinkobject;
+
+	SWIGINTERN PyObject *swig_varlink_repr(swig_varlinkobject * SWIGUNUSEDPARM(v)) {
+		return PyString_FromString("<Swig global variables>");
+	} SWIGINTERN PyObject *swig_varlink_str(swig_varlinkobject * v) {
+		PyObject *str = PyString_FromString("(");
+		swig_globalvar *var;
+		for (var = v->vars; var; var = var->next) {
+			PyString_ConcatAndDel(&str, PyString_FromString(var->name));
+			if (var->next)
+				PyString_ConcatAndDel(&str, PyString_FromString(", "));
+		}
+		PyString_ConcatAndDel(&str, PyString_FromString(")"));
+		return str;
+	}
+
+	SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int SWIGUNUSEDPARM(flags)) {
+		PyObject *str = swig_varlink_str(v);
+		fprintf(fp, "Swig global variables ");
+		fprintf(fp, "%s\n", PyString_AsString(str));
+		Py_DECREF(str);
+		return 0;
+	}
+
+	SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject * v) {
+		swig_globalvar *var = v->vars;
+		while (var) {
+			swig_globalvar *n = var->next;
+			free(var->name);
+			free(var);
+			var = n;
+		}
+	}
+
+	SWIGINTERN PyObject *swig_varlink_getattr(swig_varlinkobject * v, char *n) {
+		PyObject *res = NULL;
+		swig_globalvar *var = v->vars;
+		while (var) {
+			if (strcmp(var->name, n) == 0) {
+				res = (*var->get_attr) ();
+				break;
+			}
+			var = var->next;
+		}
+		if (res == NULL && !PyErr_Occurred()) {
+			PyErr_SetString(PyExc_NameError, "Unknown C global variable");
+		}
+		return res;
+	}
+
+	SWIGINTERN int swig_varlink_setattr(swig_varlinkobject * v, char *n, PyObject * p) {
+		int res = 1;
+		swig_globalvar *var = v->vars;
+		while (var) {
+			if (strcmp(var->name, n) == 0) {
+				res = (*var->set_attr) (p);
+				break;
+			}
+			var = var->next;
+		}
+		if (res == 1 && !PyErr_Occurred()) {
+			PyErr_SetString(PyExc_NameError, "Unknown C global variable");
+		}
+		return res;
+	}
+
+	SWIGINTERN PyTypeObject *swig_varlink_type(void) {
+		static char varlink__doc__[] = "Swig var link object";
+		static PyTypeObject varlink_type;
+		static int type_init = 0;
+		if (!type_init) {
+			const PyTypeObject tmp = {
+				PyObject_HEAD_INIT(NULL)
+					0,			/* Number of items in variable part (ob_size) */
+				(char *) "swigvarlink",	/* Type name (tp_name) */
+				sizeof(swig_varlinkobject),	/* Basic size (tp_basicsize) */
+				0,				/* Itemsize (tp_itemsize) */
+				(destructor) swig_varlink_dealloc,	/* Deallocator (tp_dealloc) */
+				(printfunc) swig_varlink_print,	/* Print (tp_print) */
+				(getattrfunc) swig_varlink_getattr,	/* get attr (tp_getattr) */
+				(setattrfunc) swig_varlink_setattr,	/* Set attr (tp_setattr) */
+				0,				/* tp_compare */
+				(reprfunc) swig_varlink_repr,	/* tp_repr */
+				0,				/* tp_as_number */
+				0,				/* tp_as_sequence */
+				0,				/* tp_as_mapping */
+				0,				/* tp_hash */
+				0,				/* tp_call */
+				(reprfunc) swig_varlink_str,	/* tp_str */
+				0,				/* tp_getattro */
+				0,				/* tp_setattro */
+				0,				/* tp_as_buffer */
+				0,				/* tp_flags */
+				varlink__doc__,	/* tp_doc */
+				0,				/* tp_traverse */
+				0,				/* tp_clear */
+				0,				/* tp_richcompare */
+				0,				/* tp_weaklistoffset */
 #if PY_VERSION_HEX >= 0x02020000
-        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
+				0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* tp_iter -> tp_weaklist */
 #endif
 #if PY_VERSION_HEX >= 0x02030000
-        0,                                  /* tp_del */
+				0,				/* tp_del */
 #endif
 #ifdef COUNT_ALLOCS
-        0,0,0,0                             /* tp_alloc -> tp_next */
+				0, 0, 0, 0		/* tp_alloc -> tp_next */
 #endif
-      };
-      varlink_type = tmp;
-      varlink_type.ob_type = &PyType_Type;
-      type_init = 1;
-    }
-    return &varlink_type;
-  }
-  
-  /* Create a variable linking object for use later */
-  SWIGINTERN PyObject *
-  SWIG_Python_newvarlink(void) {
-    swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
-    if (result) {
-      result->vars = 0;
-    }
-    return ((PyObject*) result);
-  }
-  
-  SWIGINTERN void 
-  SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
-    swig_varlinkobject *v = (swig_varlinkobject *) p;
-    swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
-    if (gv) {
-      size_t size = strlen(name)+1;
-      gv->name = (char *)malloc(size);
-      if (gv->name) {
-        strncpy(gv->name,name,size);
-        gv->get_attr = get_attr;
-        gv->set_attr = set_attr;
-        gv->next = v->vars;
-      }
-    }
-    v->vars = gv;
-  }
-  
-  SWIGINTERN PyObject *
-  SWIG_globals(void) {
-    static PyObject *_SWIG_globals = 0; 
-    if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();  
-    return _SWIG_globals;
-  }
-  
-  /* -----------------------------------------------------------------------------
-   * constants/methods manipulation
-   * ----------------------------------------------------------------------------- */
-  
-  /* Install Constants */
-  SWIGINTERN void
-  SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
-    PyObject *obj = 0;
-    size_t i;
-    for (i = 0; constants[i].type; ++i) {
-      switch(constants[i].type) {
-      case SWIG_PY_POINTER:
-        obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
-        break;
-      case SWIG_PY_BINARY:
-        obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
-        break;
-      default:
-        obj = 0;
-        break;
-      }
-      if (obj) {
-        PyDict_SetItemString(d, constants[i].name, obj);
-        Py_DECREF(obj);
-      }
-    }
-  }
-  
-  /* -----------------------------------------------------------------------------*/
-  /* Fix SwigMethods to carry the callback ptrs when needed */
-  /* -----------------------------------------------------------------------------*/
-  
-  SWIGINTERN void
-  SWIG_Python_FixMethods(PyMethodDef *methods,
-    swig_const_info *const_table,
-    swig_type_info **types,
-    swig_type_info **types_initial) {
-    size_t i;
-    for (i = 0; methods[i].ml_name; ++i) {
-      const char *c = methods[i].ml_doc;
-      if (c && (c = strstr(c, "swig_ptr: "))) {
-        int j;
-        swig_const_info *ci = 0;
-        const char *name = c + 10;
-        for (j = 0; const_table[j].type; ++j) {
-          if (strncmp(const_table[j].name, name, 
-              strlen(const_table[j].name)) == 0) {
-            ci = &(const_table[j]);
-            break;
-          }
-        }
-        if (ci) {
-          size_t shift = (ci->ptype) - types;
-          swig_type_info *ty = types_initial[shift];
-          size_t ldoc = (c - methods[i].ml_doc);
-          size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
-          char *ndoc = (char*)malloc(ldoc + lptr + 10);
-          if (ndoc) {
-            char *buff = ndoc;
-            void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
-            if (ptr) {
-              strncpy(buff, methods[i].ml_doc, ldoc);
-              buff += ldoc;
-              strncpy(buff, "swig_ptr: ", 10);
-              buff += 10;
-              SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
-              methods[i].ml_doc = ndoc;
-            }
-          }
-        }
-      }
-    }
-  } 
-  
+			};
+			varlink_type = tmp;
+			varlink_type.ob_type = &PyType_Type;
+			type_init = 1;
+		}
+		return &varlink_type;
+	}
+
+	/* Create a variable linking object for use later */
+	SWIGINTERN PyObject *SWIG_Python_newvarlink(void) {
+		swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
+		if (result) {
+			result->vars = 0;
+		}
+		return ((PyObject *) result);
+	}
+
+	SWIGINTERN void SWIG_Python_addvarlink(PyObject * p, char *name, PyObject * (*get_attr) (void), int (*set_attr) (PyObject * p)) {
+		swig_varlinkobject *v = (swig_varlinkobject *) p;
+		swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
+		if (gv) {
+			size_t size = strlen(name) + 1;
+			gv->name = (char *) malloc(size);
+			if (gv->name) {
+				strncpy(gv->name, name, size);
+				gv->get_attr = get_attr;
+				gv->set_attr = set_attr;
+				gv->next = v->vars;
+			}
+		}
+		v->vars = gv;
+	}
+
+	SWIGINTERN PyObject *SWIG_globals(void) {
+		static PyObject *_SWIG_globals = 0;
+		if (!_SWIG_globals)
+			_SWIG_globals = SWIG_newvarlink();
+		return _SWIG_globals;
+	}
+
+	/* -----------------------------------------------------------------------------
+	 * constants/methods manipulation
+	 * ----------------------------------------------------------------------------- */
+
+	/* Install Constants */
+	SWIGINTERN void SWIG_Python_InstallConstants(PyObject * d, swig_const_info constants[]) {
+		PyObject *obj = 0;
+		size_t i;
+		for (i = 0; constants[i].type; ++i) {
+			switch (constants[i].type) {
+			case SWIG_PY_POINTER:
+				obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype, 0);
+				break;
+			case SWIG_PY_BINARY:
+				obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
+				break;
+			default:
+				obj = 0;
+				break;
+			}
+			if (obj) {
+				PyDict_SetItemString(d, constants[i].name, obj);
+				Py_DECREF(obj);
+			}
+		}
+	}
+
+	/* ----------------------------------------------------------------------------- */
+	/* Fix SwigMethods to carry the callback ptrs when needed */
+	/* ----------------------------------------------------------------------------- */
+
+	SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef * methods, swig_const_info * const_table, swig_type_info ** types, swig_type_info ** types_initial) {
+		size_t i;
+		for (i = 0; methods[i].ml_name; ++i) {
+			const char *c = methods[i].ml_doc;
+			if (c && (c = strstr(c, "swig_ptr: "))) {
+				int j;
+				swig_const_info *ci = 0;
+				const char *name = c + 10;
+				for (j = 0; const_table[j].type; ++j) {
+					if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) {
+						ci = &(const_table[j]);
+						break;
+					}
+				}
+				if (ci) {
+					size_t shift = (ci->ptype) - types;
+					swig_type_info *ty = types_initial[shift];
+					size_t ldoc = (c - methods[i].ml_doc);
+					size_t lptr = strlen(ty->name) + 2 * sizeof(void *) + 2;
+					char *ndoc = (char *) malloc(ldoc + lptr + 10);
+					if (ndoc) {
+						char *buff = ndoc;
+						void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
+						if (ptr) {
+							strncpy(buff, methods[i].ml_doc, ldoc);
+							buff += ldoc;
+							strncpy(buff, "swig_ptr: ", 10);
+							buff += 10;
+							SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
+							methods[i].ml_doc = ndoc;
+						}
+					}
+				}
+			}
+		}
+	}
+
 #ifdef __cplusplus
 }
 #endif
@@ -8373,23 +8644,23 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-SWIGEXPORT void SWIG_init(void) {
-  PyObject *m, *d;
-  
-  /* Fix SwigMethods to carry the callback ptrs when needed */
-  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
-  
-  m = Py_InitModule((char *) SWIG_name, SwigMethods);
-  d = PyModule_GetDict(m);
-  
-  SWIG_InitializeModule(0);
-  SWIG_InstallConstants(d,swig_const_table);
-  
-  
-  SWIG_Python_SetConstant(d, "S_HUP",SWIG_From_int(static_cast< int >(S_HUP)));
-  SWIG_Python_SetConstant(d, "S_FREE",SWIG_From_int(static_cast< int >(S_FREE)));
-  SWIG_Python_SetConstant(d, "S_RDLOCK",SWIG_From_int(static_cast< int >(S_RDLOCK)));
-  SWIG_Python_SetConstant(d, "S_SWAPPED_IN",SWIG_From_int(static_cast< int >(S_SWAPPED_IN)));
-  SWIG_Python_SetConstant(d, "S_SWAPPED_OUT",SWIG_From_int(static_cast< int >(S_SWAPPED_OUT)));
-}
+       SWIGEXPORT void SWIG_init(void)
+{
+	PyObject *m, *d;
+
+	/* Fix SwigMethods to carry the callback ptrs when needed */
+	SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
 
+	m = Py_InitModule((char *) SWIG_name, SwigMethods);
+	d = PyModule_GetDict(m);
+
+	SWIG_InitializeModule(0);
+	SWIG_InstallConstants(d, swig_const_table);
+
+
+	SWIG_Python_SetConstant(d, "S_HUP", SWIG_From_int(static_cast < int >(S_HUP)));
+	SWIG_Python_SetConstant(d, "S_FREE", SWIG_From_int(static_cast < int >(S_FREE)));
+	SWIG_Python_SetConstant(d, "S_RDLOCK", SWIG_From_int(static_cast < int >(S_RDLOCK)));
+	SWIG_Python_SetConstant(d, "S_SWAPPED_IN", SWIG_From_int(static_cast < int >(S_SWAPPED_IN)));
+	SWIG_Python_SetConstant(d, "S_SWAPPED_OUT", SWIG_From_int(static_cast < int >(S_SWAPPED_OUT)));
+}

Modified: freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c	Tue May 27 00:54:52 2008
@@ -571,7 +571,7 @@
  *     type checking.
  *
  * Author : David Beazley (beazley at cs.uchicago.edu)
-																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																													   ************************************************************************//* Common SWIG API */
+																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																													   ************************************************************************//* Common SWIG API */
 #define SWIG_ConvertPtr(obj, pp, type, flags)    SWIG_Python_ConvertPtr(obj, pp, type, flags)
 #define SWIG_NewPointerObj(p, type, flags)       SWIG_Python_NewPointerObj(p, type, flags)
 #define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)
@@ -583,11 +583,11 @@
 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
 /* -----------------------------------------------------------------------------
  * Pointer declarations
-																																																																																																																																																																																																																																																																																																																																								  																																																																																																																																																																				  																																																																																		  																																									  																				    * ----------------------------------------------------------------------------- *//*
-																																																																																																																																																																																																																																																																																																																																								     Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
-																																																																																																																																																																																																																																																																																																																																								     C/C++ pointers in the python side. Very useful for debugging, but
-																																																																																																																																																																																																																																																																																																																																								     not always safe.
-																																																																																																																																																																																																																																																																																																																																								   */
+																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																  																																																																																																																																																																																																																																																																																																																																								  																																																																																																																																																																				  																																																																																		  																																									  																				    * ----------------------------------------------------------------------------- *//*
+																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																     Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
+																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																     C/C++ pointers in the python side. Very useful for debugging, but
+																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																     not always safe.
+																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																   */
 #if !defined(SWIG_NO_COBJECT_TYPES) && !defined(SWIG_COBJECT_TYPES)
 #  define SWIG_COBJECT_TYPES
 #endif
@@ -1538,8 +1538,7 @@
 		         resultobj = Py_None;
 		         return resultobj;
 		         fail:return NULL;
-	}
-	static PyObject *_wrap_fs_core_init(PyObject * self, PyObject * args) {
+	} static PyObject *_wrap_fs_core_init(PyObject * self, PyObject * args) {
 		PyObject *resultobj = NULL;
 		char *arg1 = (char *) 0;
 		int result;
@@ -2683,8 +2682,7 @@
 	SWIGINTERN PyObject *swig_varlink_repr(swig_varlinkobject * v) {
 		v = v;
 		return PyString_FromString("<Swig global variables>");
-	}
-	SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int flags) {
+	} SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int flags) {
 		swig_globalvar *var;
 		flags = flags;
 		fprintf(fp, "Swig global variables { ");

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Tue May 27 00:54:52 2008
@@ -184,7 +184,7 @@
 	return JS_TRUE;
 }
 
-static JSBool request_add_header(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool request_add_header(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct request_obj *ro = JS_GetPrivate(cx, obj);
 
@@ -226,7 +226,7 @@
 	return JS_TRUE;
 }
 
-static JSBool request_dump_env(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool request_dump_env(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct request_obj *ro = JS_GetPrivate(cx, obj);
 	char *how = "text";
@@ -244,10 +244,10 @@
 		switch_xml_t xml;
 		char *xmlstr;
 		if ((xml = switch_event_xmlize(ro->stream->param_event, SWITCH_VA_NONE))) {
-            xmlstr = switch_xml_toxml(xml, SWITCH_FALSE);
+			xmlstr = switch_xml_toxml(xml, SWITCH_FALSE);
 			*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, xmlstr));
 			return JS_TRUE;
-        } 
+		}
 	} else {
 		char *buf;
 		switch_event_serialize(ro->stream->param_event, &buf, SWITCH_TRUE);
@@ -264,7 +264,7 @@
 
 static void request_destroy(JSContext * cx, JSObject * obj)
 {
-	
+
 }
 
 enum request_tinyid {
@@ -284,7 +284,7 @@
 	{0}
 };
 
-static JSBool request_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+static JSBool request_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	JSBool res = JS_TRUE;
 	struct request_obj *ro = JS_GetPrivate(cx, obj);
@@ -320,12 +320,11 @@
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, request_destroy, NULL, NULL, NULL, NULL
 };
 
-static JSObject *new_request(JSContext *cx, JSObject *obj, struct request_obj *ro)
+static JSObject *new_request(JSContext * cx, JSObject * obj, struct request_obj *ro)
 {
 	JSObject *Request;
 	if ((Request = JS_DefineObject(cx, obj, "request", &request_class, NULL, 0))) {
-		if ((JS_SetPrivate(cx, Request, ro) &&
-			 JS_DefineProperties(cx, Request, request_props) && JS_DefineFunctions(cx, Request, request_methods))) {
+		if ((JS_SetPrivate(cx, Request, ro) && JS_DefineProperties(cx, Request, request_props) && JS_DefineFunctions(cx, Request, request_methods))) {
 			return Request;
 		}
 	}
@@ -375,12 +374,12 @@
 	char *string, *regex_string;
 
 	if (argc > 1) {
-        string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
-        regex_string = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+		string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		regex_string = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
 		switch_regex_safe_free(pcre_obj->re);
 		switch_safe_free(pcre_obj->string);
 		pcre_obj->string = strdup(string);
-		pcre_obj->proceed = switch_regex_perform(pcre_obj->string, regex_string, &pcre_obj->re, pcre_obj->ovector, 
+		pcre_obj->proceed = switch_regex_perform(pcre_obj->string, regex_string, &pcre_obj->re, pcre_obj->ovector,
 												 sizeof(pcre_obj->ovector) / sizeof(pcre_obj->ovector[0]));
 		*rval = BOOLEAN_TO_JSVAL(pcre_obj->proceed ? JS_TRUE : JS_FALSE);
 	} else {
@@ -401,10 +400,10 @@
 		eval_some_js("~throw new Error(\"REGEX is not compiled or has no matches\");", cx, obj, rval);
 		return JS_FALSE;
 	}
-	
+
 	if (argc > 0) {
 		uint32_t len;
-        subst_string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		subst_string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		len = (uint32_t) (strlen(pcre_obj->string) + strlen(subst_string) + 10);
 		substituted = malloc(len);
 		switch_assert(substituted != NULL);
@@ -841,7 +840,7 @@
 
 	case DTMF_DURATION:
 		{
-			*vp = INT_TO_JSVAL((int)dtmf->duration);
+			*vp = INT_TO_JSVAL((int) dtmf->duration);
 		}
 		break;
 	}
@@ -1097,10 +1096,10 @@
 	uintN argc = 0;
 	jsval argv[4];
 	JSObject *Event = NULL;
-	jsval nval , *rval = &nval; 
+	jsval nval, *rval = &nval;
 	JSContext *cx = cb_state->cx;
 	JSObject *obj = cb_state->obj;
-	
+
 	METHOD_SANITY_CHECK();
 
 	jss->stack_depth++;
@@ -1126,10 +1125,10 @@
 			return SWITCH_STATUS_FALSE;
 		}
 		break;
-	case SWITCH_INPUT_TYPE_DTMF: 
+	case SWITCH_INPUT_TYPE_DTMF:
 		{
 			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
-			
+
 			if (dtmf) {
 				if ((Event = new_js_dtmf(dtmf, "_XX_DTMF_XX_", cb_state->cx, cb_state->obj))) {
 					argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cb_state->cx, "dtmf"));
@@ -1624,7 +1623,7 @@
 	switch_input_args_t args = { 0 };
 	const char *prebuf;
 	char posbuf[35] = "";
-	
+
 	METHOD_SANITY_CHECK();
 	channel = switch_core_session_get_channel(jss->session);
 	CHANNEL_SANITY_CHECK();
@@ -1660,13 +1659,13 @@
 		JS_ValueToInt32(cx, argv[3], &samps);
 		fh.samples = samps;
 	}
-	
-    if ((prebuf = switch_channel_get_variable(channel, "stream_prebuffer"))) {
-        int maybe = atoi(prebuf);
-        if (maybe > 0) {
-            fh.prebuf = maybe;
-        }
-    }
+
+	if ((prebuf = switch_channel_get_variable(channel, "stream_prebuffer"))) {
+		int maybe = atoi(prebuf);
+		if (maybe > 0) {
+			fh.prebuf = maybe;
+		}
+	}
 
 	cb_state.extra = &fh;
 	cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -1825,7 +1824,7 @@
 	if (jss->speech && strcasecmp(jss->speech->sh.name, tts_name)) {
 		destroy_speech_engine(jss);
 	}
-	
+
 	if (jss->speech) {
 		switch_core_speech_text_param_tts(&jss->speech->sh, "voice", voice_name);
 	} else {
@@ -1861,7 +1860,7 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
-	
+
 	switch_core_speech_flush_tts(&jss->speech->sh);
 	switch_ivr_speak_text_handle(jss->session, &jss->speech->sh, &jss->speech->codec, NULL, text, &args);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
@@ -2174,12 +2173,11 @@
 	CHANNEL_SANITY_CHECK();
 
 	if (argc > 1) {
-		if(JSVAL_IS_INT(argv[0])) {
+		if (JSVAL_IS_INT(argv[0])) {
 			int32 i = 0;
 			JS_ValueToInt32(cx, argv[0], &i);
 			cause = i;
-		}
-		else {
+		} else {
 			cause_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 			cause = switch_channel_str2cause(cause_name);
 		}
@@ -2204,7 +2202,7 @@
 	JSObject *obj;
 	switch_size_t buffer_size;
 	switch_size_t data_len;
-	char* buffer;
+	char *buffer;
 };
 
 static size_t hash_callback(void *ptr, size_t size, size_t nmemb, void *data)
@@ -2257,7 +2255,7 @@
 	register unsigned int realsize = (unsigned int) (size * nmemb);
 	struct config_data *config_data = data;
 
-	if ((write(config_data->fd, ptr, realsize) != (int)realsize)) {
+	if ((write(config_data->fd, ptr, realsize) != (int) realsize)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to write all bytes!\n");
 	}
 	return realsize;
@@ -2412,7 +2410,7 @@
 			*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, config_data.buffer));
 		} else {
 			char errmsg[256];
-			switch_snprintf(errmsg, 256, "~throw new Error(\"Curl returned error %u.\");", (unsigned)code);
+			switch_snprintf(errmsg, 256, "~throw new Error(\"Curl returned error %u.\");", (unsigned) code);
 			eval_some_js(errmsg, cx, obj, rval);
 		}
 
@@ -2593,7 +2591,7 @@
 		*jss = malloc(sizeof(**jss));
 		switch_assert(*jss);
 		memset(*jss, 0, sizeof(**jss));
-		
+
 		(*jss)->session = session;
 		(*jss)->flags = flags;
 		(*jss)->cx = cx;
@@ -2628,7 +2626,7 @@
 	jss->cx = cx;
 	jss->obj = obj;
 	JS_SetPrivate(cx, obj, jss);
-	
+
 	if (argc > 0) {
 		char *uuid = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		if (uuid) {
@@ -2649,7 +2647,7 @@
 		char *var, *val, **toset = NULL;
 		var = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		val = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
-		
+
 		if (!strcasecmp(var, "dialplan")) {
 			toset = &jss->dialplan;
 		} else if (!strcasecmp(var, "username")) {
@@ -2670,15 +2668,15 @@
 			toset = &jss->destination_number;
 		} else if (!strcasecmp(var, "context")) {
 			toset = &jss->context;
-		} 
-		
+		}
+
 		if (toset) {
 			switch_safe_free(*toset);
 			*toset = strdup(val);
 		}
 
 	}
-	
+
 	return JS_TRUE;
 }
 
@@ -2727,14 +2725,22 @@
 			}
 		}
 
-		if (!switch_strlen_zero(jss->dialplan)) dialplan = jss->dialplan;
-		if (!switch_strlen_zero(jss->caller_id_name)) cid_name = jss->caller_id_name;
-		if (!switch_strlen_zero(jss->caller_id_number)) cid_num = jss->caller_id_number;
-		if (!switch_strlen_zero(jss->ani)) ani = jss->ani;
-		if (!switch_strlen_zero(jss->aniii)) aniii = jss->aniii;
-		if (!switch_strlen_zero(jss->rdnis)) rdnis = jss->rdnis;
-		if (!switch_strlen_zero(jss->context)) context = jss->context;
-		if (!switch_strlen_zero(jss->username)) username = jss->username;
+		if (!switch_strlen_zero(jss->dialplan))
+			dialplan = jss->dialplan;
+		if (!switch_strlen_zero(jss->caller_id_name))
+			cid_name = jss->caller_id_name;
+		if (!switch_strlen_zero(jss->caller_id_number))
+			cid_num = jss->caller_id_number;
+		if (!switch_strlen_zero(jss->ani))
+			ani = jss->ani;
+		if (!switch_strlen_zero(jss->aniii))
+			aniii = jss->aniii;
+		if (!switch_strlen_zero(jss->rdnis))
+			rdnis = jss->rdnis;
+		if (!switch_strlen_zero(jss->context))
+			context = jss->context;
+		if (!switch_strlen_zero(jss->username))
+			username = jss->username;
 
 		dest = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
 
@@ -2747,16 +2753,15 @@
 			tmp = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
 			if (!switch_strlen_zero(tmp)) {
 				to = tmp;
-			}	
+			}
 		}
-		
+
 		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
 			return JS_FALSE;
 		}
 
-		caller_profile = switch_caller_profile_new(pool,username, dialplan, cid_name, cid_num, network_addr,
-												   ani, aniii, rdnis, modname, context, dest);
+		caller_profile = switch_caller_profile_new(pool, username, dialplan, cid_name, cid_num, network_addr, ani, aniii, rdnis, modname, context, dest);
 
 		saveDepth = JS_SuspendRequest(cx);
 		status = switch_ivr_originate(session, &peer_session, &jss->cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile, SOF_NONE);
@@ -2766,7 +2771,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot Create Outgoing Channel! [%s]\n", dest);
 			goto done;
 		}
-		
+
 		jss->session = peer_session;
 		switch_set_flag(jss, S_HUP);
 		*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
@@ -2783,21 +2788,21 @@
 static void session_destroy(JSContext * cx, JSObject * obj)
 {
 	struct js_session *jss;
-	
+
 	if (cx && obj) {
 		if ((jss = JS_GetPrivate(cx, obj))) {
 			JS_SetPrivate(cx, obj, NULL);
 			if (jss->speech && *jss->speech->sh.name) {
 				destroy_speech_engine(jss);
 			}
-			
+
 			if (jss->session) {
 				switch_core_session_t *session = jss->session;
 				switch_channel_t *channel = switch_core_session_get_channel(session);
-				
+
 				switch_channel_set_private(channel, "jss", NULL);
 				switch_core_event_hook_remove_state_change(session, hanguphook);
-				
+
 				if (switch_test_flag(jss, S_HUP)) {
 					switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 				}
@@ -2816,7 +2821,7 @@
 			}
 
 			free(jss);
-			
+
 		}
 	}
 
@@ -3025,7 +3030,7 @@
 static JSBool js_exit(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	char *supplied_error, code_buf[256] = "";
-	
+
 	if (argc > 0 && (supplied_error = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) {
 		switch_snprintf(code_buf, sizeof(code_buf), "~throw new Error(\"%s\");", supplied_error);
 		eval_some_js(code_buf, cx, obj, rval);
@@ -3078,7 +3083,7 @@
 	char *var_name = NULL, *val = NULL;
 	if (argc > 1) {
 		var_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
-		val =  JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+		val = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
 		switch_core_set_variable(var_name, val);
 		return JS_TRUE;
 	}
@@ -3153,7 +3158,7 @@
 		if (argc > 1) {
 			arg = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
 		}
-		
+
 		if (argc > 2) {
 			JSObject *session_obj;
 			struct js_session *jss;
@@ -3384,7 +3389,7 @@
 	js_parse_and_execute(session, data, NULL);
 }
 
-static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread_t *thread, void *obj)
 {
 	char *input_code = obj;
 
@@ -3419,17 +3424,17 @@
 
 SWITCH_STANDARD_API(jsapi_function)
 {
-	struct request_obj ro = {0};
+	struct request_obj ro = { 0 };
 	char *path_info = NULL;
 
-    if (stream->param_event) {
+	if (stream->param_event) {
 		path_info = switch_event_get_header(stream->param_event, "http-path-info");
 	}
 
 	if (switch_strlen_zero(cmd) && path_info) {
 		cmd = path_info;
 	}
-	
+
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "USAGE: %s\n", jsapi_interface.syntax);
 		return SWITCH_STATUS_SUCCESS;
@@ -3456,14 +3461,14 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static void  message_query_handler(switch_event_t *event)
+static void message_query_handler(switch_event_t *event)
 {
 	char *account = switch_event_get_header(event, "message-account");
 
 	if (account) {
 		char *path, *cmd;
 
-		path  = switch_mprintf("%s%smwi.js", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
+		path = switch_mprintf("%s%smwi.js", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
 		switch_assert(path != NULL);
 
 		if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
@@ -3497,7 +3502,8 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_API(api_interface, "jsrun", "run a script", launch_async, "jsrun <script> [additional_vars [...]]");
 	SWITCH_ADD_API(api_interface, "jsapi", "execute an api call", jsapi_function, "jsapi <script> [additional_vars [...]]");
-	SWITCH_ADD_APP(app_interface, "javascript", "Launch JS ivr", "Run a javascript ivr on a channel", js_dp_function, "<script> [additional_vars [...]]", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "javascript", "Launch JS ivr", "Run a javascript ivr on a channel", js_dp_function, "<script> [additional_vars [...]]",
+				   SAF_SUPPORT_NOMEDIA);
 
 	curl_global_init(CURL_GLOBAL_ALL);
 

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	Tue May 27 00:54:52 2008
@@ -73,10 +73,10 @@
 	return JS_FALSE;
 }
 
-static JSBool db_close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool db_close(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct db_obj *dbo = JS_GetPrivate(cx, obj);
-	
+
 	if (dbo) {
 		if (dbo->stmt) {
 			switch_core_db_finalize(dbo->stmt);
@@ -91,7 +91,7 @@
 	return JS_TRUE;
 }
 
-static void db_destroy(JSContext *cx, JSObject *obj)
+static void db_destroy(JSContext * cx, JSObject * obj)
 {
 	struct db_obj *dbo = JS_GetPrivate(cx, obj);
 
@@ -215,7 +215,7 @@
 	}
 	for (x = 0; x < colcount; x++) {
 		switch_snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"",
-				 (char *) switch_core_db_column_name(dbo->stmt, x), (char *) switch_core_db_column_text(dbo->stmt, x));
+						(char *) switch_core_db_column_name(dbo->stmt, x), (char *) switch_core_db_column_text(dbo->stmt, x));
 
 		eval_some_js(code, dbo->cx, dbo->obj, rval);
 		if (*rval == JS_FALSE) {
@@ -275,7 +275,7 @@
 };
 
 
-static JSBool db_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval *vp)
+static JSBool db_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
 
@@ -332,7 +332,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	*module_interface = &DB_module_interface;
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	Tue May 27 00:54:52 2008
@@ -41,7 +41,7 @@
 	JSFunction *function;
 	JSObject *user_data;
 	jsrefcount saveDepth;
-	jsval ret;	
+	jsval ret;
 };
 
 
@@ -51,21 +51,21 @@
 	struct curl_obj *co = data;
 	uintN argc = 0;
 	jsval argv[4];
-	
+
 
 	if (!co) {
 		return 0;
 	}
 	if (co->function) {
 		char *ret;
-		argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(co->cx, (char *)ptr));
+		argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(co->cx, (char *) ptr));
 		if (co->user_data) {
 			argv[argc++] = OBJECT_TO_JSVAL(co->user_data);
 		}
 		JS_ResumeRequest(co->cx, co->saveDepth);
 		JS_CallFunction(co->cx, co->obj, co->function, argc, argv, &co->ret);
 		co->saveDepth = JS_SuspendRequest(co->cx);
-		
+
 		if ((ret = JS_GetStringBytes(JS_ValueToString(co->cx, co->ret)))) {
 			if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) {
 				return realsize;
@@ -81,7 +81,7 @@
 
 /* Curl Object */
 /*********************************************************************************/
-static JSBool curl_construct(JSContext *cx, JSObject *obj, uintN argc, jsval * argv, jsval * rval)
+static JSBool curl_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct curl_obj *co = NULL;
 
@@ -98,14 +98,14 @@
 	return JS_TRUE;
 }
 
-static void curl_destroy(JSContext *cx, JSObject *obj)
+static void curl_destroy(JSContext * cx, JSObject * obj)
 {
 	struct curl_obj *co = JS_GetPrivate(cx, obj);
 	switch_safe_free(co);
 	JS_SetPrivate(cx, obj, NULL);
 }
 
-static JSBool curl_run(JSContext *cx, JSObject *obj, uintN argc, jsval * argv, jsval * rval)
+static JSBool curl_run(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct curl_obj *co = JS_GetPrivate(cx, obj);
 	char *method = NULL, *url, *cred = NULL;
@@ -127,11 +127,11 @@
 		curl_easy_setopt(co->curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
 	}
 	headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
-		
+
 	if (argc > 2) {
 		data = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
 	}
-		
+
 	if (argc > 3) {
 		co->function = JS_ValueToFunction(cx, argv[3]);
 	}
@@ -148,7 +148,7 @@
 		}
 	}
 
-		
+
 	curl_easy_setopt(co->curl_handle, CURLOPT_HTTPHEADER, headers);
 
 	url_p = url;
@@ -164,7 +164,7 @@
 		url_p = durl;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Running: method: [%s] url: [%s] data: [%s] cred=[%s] cb: [%s]\n", 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Running: method: [%s] url: [%s] data: [%s] cred=[%s] cb: [%s]\n",
 					  method, url_p, data, switch_str_nil(cred), co->function ? "yes" : "no");
 
 	curl_easy_setopt(co->curl_handle, CURLOPT_URL, url_p);
@@ -172,7 +172,7 @@
 	curl_easy_setopt(co->curl_handle, CURLOPT_WRITEDATA, (void *) co);
 
 	curl_easy_setopt(co->curl_handle, CURLOPT_USERAGENT, "freeswitch-spidermonkey-curl/1.0");
-	
+
 	co->saveDepth = JS_SuspendRequest(cx);
 	curl_easy_perform(co->curl_handle);
 
@@ -183,7 +183,7 @@
 	co->function = NULL;
 	JS_ResumeRequest(cx, co->saveDepth);
 	switch_safe_free(durl);
-	
+
 
 	return JS_TRUE;
 }
@@ -198,7 +198,7 @@
 	{0}
 };
 
-static JSBool curl_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval * vp)
+static JSBool curl_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	JSBool res = JS_TRUE;
 	return res;
@@ -212,7 +212,7 @@
 };
 
 
-switch_status_t curl_load(JSContext *cx, JSObject *obj)
+switch_status_t curl_load(JSContext * cx, JSObject * obj)
 {
 	JS_InitClass(cx, obj, NULL, &curl_class, curl_construct, 3, curl_props, curl_methods, curl_props, curl_methods);
 	return SWITCH_STATUS_SUCCESS;
@@ -225,7 +225,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	curl_global_init(CURL_GLOBAL_ALL);
 	*module_interface = &curl_module_interface;

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	Tue May 27 00:54:52 2008
@@ -42,7 +42,7 @@
 	SQLCHAR *code;
 	int32 codelen;
 };
-typedef struct odbc_obj  odbc_obj_t;
+typedef struct odbc_obj odbc_obj_t;
 
 static odbc_obj_t *new_odbc_obj(char *dsn, char *username, char *password)
 {
@@ -56,7 +56,7 @@
 	if (!(new_obj->handle = switch_odbc_handle_new(dsn, username, password))) {
 		goto err;
 	}
-	
+
 	return new_obj;
 
   err:
@@ -72,29 +72,30 @@
 
 switch_odbc_status_t odbc_obj_connect(odbc_obj_t *obj)
 {
-	
+
 	return switch_odbc_handle_connect(obj->handle);
 }
 
-static void destroy_odbc_obj(odbc_obj_t ** objp)
+static void destroy_odbc_obj(odbc_obj_t **objp)
 {
 	odbc_obj_t *obj = *objp;
-    if (obj == NULL) return;
+	if (obj == NULL)
+		return;
 	if (obj->stmt) {
 		SQLFreeHandle(SQL_HANDLE_STMT, obj->stmt);
 	}
-    if (obj->handle) {
-    	switch_odbc_handle_destroy(&obj->handle);
-    }
-    switch_safe_free(obj->colbuf);
-    switch_safe_free(obj->code);
+	if (obj->handle) {
+		switch_odbc_handle_destroy(&obj->handle);
+	}
+	switch_safe_free(obj->colbuf);
+	switch_safe_free(obj->code);
 	switch_safe_free(obj);
 }
 
 
 /* ODBC Object */
 /*********************************************************************************/
-static JSBool odbc_construct(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	odbc_obj_t *odbc_obj = NULL;
 	char *dsn, *username, *password;
@@ -156,16 +157,17 @@
 
 static void odbc_destroy(JSContext * cx, JSObject * obj)
 {
-    odbc_obj_t *odbc_obj;
-	if (obj == NULL) return;
+	odbc_obj_t *odbc_obj;
+	if (obj == NULL)
+		return;
 	odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
 	if (odbc_obj) {
 		destroy_odbc_obj(&odbc_obj);
-	    JS_SetPrivate(cx, obj, NULL);
-    }
+		JS_SetPrivate(cx, obj, NULL);
+	}
 }
 
-static JSBool odbc_connect(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_connect(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
 	JSBool tf = JS_TRUE;
@@ -183,7 +185,7 @@
 	return JS_TRUE;
 }
 
-static JSBool odbc_execute(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_execute(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
 	char *sql;
@@ -217,7 +219,7 @@
 	return JS_TRUE;
 }
 
-static JSBool odbc_exec(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_exec(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
 	char *sql;
@@ -253,7 +255,7 @@
 	return JS_TRUE;
 }
 
-static JSBool odbc_num_rows(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_num_rows(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
 
@@ -277,7 +279,7 @@
 }
 
 
-static JSBool odbc_next_row(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_next_row(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
 	int result = 0;
@@ -285,8 +287,8 @@
 
 	if (switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
-        goto done;
-    }
+		goto done;
+	}
 
 
 	if (odbc_obj->stmt) {
@@ -345,7 +347,7 @@
 }
 
 
-static JSBool odbc_get_data(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_get_data(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 
 	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
@@ -353,8 +355,8 @@
 
 	if (switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
-        goto done;
-    }
+		goto done;
+	}
 
 	if (odbc_obj->stmt) {
 		SQLSMALLINT c = 0, x = 0;
@@ -374,7 +376,7 @@
 				SQLCHAR name[1024] = "";
 				SQLCHAR *data = odbc_obj->colbuf;
 				SQLCHAR *esc = NULL;
-				
+
 				SQLDescribeCol(odbc_obj->stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
 				SQLGetData(odbc_obj->stmt, x, SQL_C_CHAR, odbc_obj->colbuf, odbc_obj->cblen, NULL);
 
@@ -407,10 +409,10 @@
 
 }
 
-static JSBool odbc_close(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_close(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
-     odbc_destroy(cx, obj);
-     return JS_TRUE;
+	odbc_destroy(cx, obj);
+	return JS_TRUE;
 }
 
 enum odbc_tinyid {
@@ -425,17 +427,17 @@
 	{"numRows", odbc_num_rows, 1},
 	{"nextRow", odbc_next_row, 1},
 	{"getData", odbc_get_data, 1},
-    {"close", odbc_close, 1},
+	{"close", odbc_close, 1},
 	{0}
 };
 
 
 static JSPropertySpec odbc_props[] = {
-	{"name", odbc_NAME, JSPROP_READONLY|JSPROP_PERMANENT}, 
+	{"name", odbc_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
 	{0}
 };
 
-static JSBool odbc_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval *vp)
+static JSBool odbc_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
 
@@ -446,11 +448,11 @@
 	return JS_TRUE;
 }
 
-static JSBool odbc_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval *vp)
+static JSBool odbc_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	int param;
 	char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
-	
+
 	/* numbers are our props anything else is a method */
 	if (name[0] >= 48 && name[0] <= 57) {
 		param = atoi(name);
@@ -483,7 +485,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	*module_interface = &odbc_module_interface;
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c	Tue May 27 00:54:52 2008
@@ -93,7 +93,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	*module_interface = &skel_module_interface;
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c	Tue May 27 00:54:52 2008
@@ -34,7 +34,7 @@
 struct js_socket_obj {
 	switch_socket_t *socket;
 	switch_memory_pool_t *pool;
-	char* read_buffer;
+	char *read_buffer;
 	switch_size_t buffer_size;
 	int state;
 };
@@ -44,20 +44,18 @@
 /*********************************************************************************/
 static JSBool socket_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
-	js_socket_obj_t* js_socket_obj = 0;
+	js_socket_obj_t *js_socket_obj = 0;
 	switch_memory_pool_t *pool;
 	switch_socket_t *socket;
 	switch_status_t ret;
 
 	switch_core_new_memory_pool(&pool);
 	ret = switch_socket_create(&socket, AF_INET, SOCK_STREAM, SWITCH_PROTO_TCP, pool);
-	if (ret != SWITCH_STATUS_SUCCESS)
-	{
+	if (ret != SWITCH_STATUS_SUCCESS) {
 		switch_core_destroy_memory_pool(&pool);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Failed to create socket, reason: %d.\n", ret);
 		return JS_FALSE;
 	}
-
 	// allocate information needed by JS to be able to write to the log.
 	// (needed since multitple js sessions can write to the same log)
 	js_socket_obj = switch_core_alloc(pool, sizeof(js_socket_obj_t));
@@ -73,8 +71,7 @@
 	if (socket == NULL)
 		return;
 
-	if (socket->socket != 0)
-	{
+	if (socket->socket != 0) {
 		switch_socket_shutdown(socket->socket, SWITCH_SHUTDOWN_READWRITE);
 		switch_socket_close(socket->socket);
 		switch_core_destroy_memory_pool(&socket->pool);
@@ -84,14 +81,12 @@
 static JSBool socket_connect(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
-	if (socket == NULL)
-	{
+	if (socket == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
 		return JS_FALSE;
 	}
 
-	if (argc == 2)
-	{
+	if (argc == 2) {
 		char *host = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		int32 port;
 		switch_sockaddr_t *addr;
@@ -99,21 +94,18 @@
 
 		JS_ValueToInt32(cx, argv[1], &port);
 
-		ret = switch_sockaddr_info_get(&addr, host, AF_INET, (switch_port_t)port, 0, socket->pool);
-		if (ret != SWITCH_STATUS_SUCCESS)
-		{
+		ret = switch_sockaddr_info_get(&addr, host, AF_INET, (switch_port_t) port, 0, socket->pool);
+		if (ret != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_sockaddr_info_get failed: %d.\n", ret);
 			return JS_FALSE;
 		}
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Connecting to: %s:%d.\n", host, port);
 		ret = switch_socket_connect(socket->socket, addr);
-		if (ret != SWITCH_STATUS_SUCCESS)
-		{
+		if (ret != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_connect failed: %d.\n", ret);
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
-		}
-		else
+		} else
 			*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
 
 	}
@@ -124,23 +116,19 @@
 static JSBool socket_send(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
-	if (socket == NULL)
-	{
+	if (socket == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
 		return JS_FALSE;
 	}
 
-	if (argc == 1)
-	{
+	if (argc == 1) {
 		char *buffer = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		switch_size_t len = strlen(buffer);
 		switch_status_t ret = switch_socket_send(socket->socket, buffer, &len);
-		if (ret != SWITCH_STATUS_SUCCESS)
-		{
+		if (ret != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_send failed: %d.\n", ret);
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
-		}
-		else
+		} else
 			*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
 	}
 
@@ -150,35 +138,29 @@
 static JSBool socket_read_bytes(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
-	if (socket == NULL)
-	{
+	if (socket == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
 		return JS_FALSE;
 	}
 
-	if (argc == 1)
-	{
+	if (argc == 1) {
 		int32 bytes_to_read;
 		switch_status_t ret;
 		switch_size_t len;
 
 		JS_ValueToInt32(cx, argv[0], &bytes_to_read);
-		len = (switch_size_t)bytes_to_read;
+		len = (switch_size_t) bytes_to_read;
 
-		if (socket->buffer_size < len)
-		{
-			socket->read_buffer = switch_core_alloc(socket->pool, len+1);
+		if (socket->buffer_size < len) {
+			socket->read_buffer = switch_core_alloc(socket->pool, len + 1);
 			socket->buffer_size = bytes_to_read + 1;
 		}
 
 		ret = switch_socket_recv(socket->socket, socket->read_buffer, &len);
-		if (ret != SWITCH_STATUS_SUCCESS)
-		{
+		if (ret != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_send failed: %d.\n", ret);
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
-		}
-		else
-		{
+		} else {
 			socket->read_buffer[len] = 0;
 			*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, socket->read_buffer));
 		}
@@ -190,15 +172,13 @@
 static JSBool socket_read(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
-	if (socket == NULL)
-	{
+	if (socket == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
 		return JS_FALSE;
 	}
 
-	if (argc >= 0)
-	{
-		char* delimiter = "\n";
+	if (argc >= 0) {
+		char *delimiter = "\n";
 		switch_status_t ret = SWITCH_STATUS_FALSE;
 		switch_size_t len = 1;
 		switch_size_t total_length = 0;
@@ -212,8 +192,7 @@
 		if (socket->read_buffer == 0)
 			socket->read_buffer = switch_core_alloc(socket->pool, socket->buffer_size);
 
-		while (can_run == TRUE)
-		{
+		while (can_run == TRUE) {
 			ret = switch_socket_recv(socket->socket, tempbuf, &len);
 			if (ret != SWITCH_STATUS_SUCCESS)
 				break;
@@ -223,13 +202,11 @@
 				break;
 			else if (tempbuf[0] == '\r' && delimiter[0] == '\n')
 				continue;
-			else
-			{
+			else {
 				// Buffer is full, let's increase it.
-				if (total_length == socket->buffer_size - 1)
-				{
+				if (total_length == socket->buffer_size - 1) {
 					switch_size_t new_size = socket->buffer_size + 4196;
-					char* new_buffer = switch_core_alloc(socket->pool, socket->buffer_size);
+					char *new_buffer = switch_core_alloc(socket->pool, socket->buffer_size);
 					memcpy(new_buffer, socket->read_buffer, total_length);
 					socket->buffer_size = new_size;
 					socket->read_buffer = new_buffer;
@@ -238,13 +215,10 @@
 				++total_length;
 			}
 		}
-		if (ret != SWITCH_STATUS_SUCCESS)
-		{
+		if (ret != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "socket receive failed: %d.\n", ret);
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
-		}
-		else
-		{
+		} else {
 			socket->read_buffer[total_length] = 0;
 			*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, socket->read_buffer));
 		}
@@ -256,8 +230,7 @@
 static JSBool socket_close(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
-	if (socket == NULL)
-	{
+	if (socket == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
 		return JS_FALSE;
 	}
@@ -290,7 +263,7 @@
 static JSBool socket_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	JSBool res = JS_TRUE;
-//	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
+//  js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
 	char *name;
 	int param = 0;
 
@@ -335,7 +308,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	*module_interface = &socket_module_interface;
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	Tue May 27 00:54:52 2008
@@ -56,7 +56,7 @@
 };
 
 
-static int teletone_handler(teletone_generation_session_t * ts, teletone_tone_map_t * map)
+static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
 {
 	struct teletone_obj *tto = ts->user_data;
 	int wrote;
@@ -249,7 +249,7 @@
 			if (switch_test_flag(tto, TTF_DTMF)) {
 				char dtmf[128];
 				char *ret;
-				
+
 				if (switch_channel_has_dtmf(channel)) {
 					uintN aargc = 0;
 					jsval aargv[4];
@@ -345,7 +345,7 @@
 	/*.next */ NULL
 };
 
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
 {
 	*module_interface = &teletone_module_interface;
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/loggers/mod_console/mod_console.c
==============================================================================
--- freeswitch/trunk/src/mod/loggers/mod_console/mod_console.c	(original)
+++ freeswitch/trunk/src/mod/loggers/mod_console/mod_console.c	Tue May 27 00:54:52 2008
@@ -84,14 +84,14 @@
 	} else {
 		m = switch_log_str2mask(val);
 	}
-	
+
 	if (!strcasecmp(var, "all")) {
 		all_level |= m;
 		return;
 	}
 
 	del_mapping(var);
-	switch_core_hash_insert(log_hash, var, (void *)(intptr_t) m);
+	switch_core_hash_insert(log_hash, var, (void *) (intptr_t) m);
 }
 
 static switch_status_t config_logger(void)
@@ -149,7 +149,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static int can_write(FILE *handle, int ms)
+static int can_write(FILE * handle, int ms)
 {
 #ifndef WIN32
 	int aok = 1;
@@ -166,14 +166,14 @@
 	FD_SET(fd, &can_write);
 	to.tv_sec = sec;
 	to.tv_usec = usec;
-	if (select(fd+1, NULL, &can_write, NULL, &to) > 0) {
+	if (select(fd + 1, NULL, &can_write, NULL, &to) > 0) {
 		aok = FD_ISSET(fd, &can_write);
 	} else {
 		aok = 0;
 	}
-			
+
 	return aok;
-#else 
+#else
 	return 1;
 #endif
 }
@@ -182,11 +182,10 @@
 static switch_status_t switch_console_logger(const switch_log_node_t *node, switch_log_level_t level)
 {
 	FILE *handle;
-	
+
 	if (!RUNNING) {
 		return SWITCH_STATUS_SUCCESS;
 	}
-
 #if 0
 	if (failed_write) {
 		if ((handle = switch_core_data_channel(SWITCH_CHANNEL_ID_LOG))) {
@@ -197,7 +196,7 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s", msg);
 #else
 				if (COLORIZE) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s%s",  COLORS[1], msg, SWITCH_SEQ_DEFAULT_COLOR);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s%s", COLORS[1], msg, SWITCH_SEQ_DEFAULT_COLOR);
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s", msg);
 				}
@@ -213,11 +212,11 @@
 	}
 
 	if ((handle = switch_core_data_channel(SWITCH_CHANNEL_ID_LOG))) {
-        size_t mask = 0;
-        size_t ok = 0;
-		
-        ok = switch_log_check_mask(all_level, level);
-        
+		size_t mask = 0;
+		size_t ok = 0;
+
+		ok = switch_log_check_mask(all_level, level);
+
 		if (log_hash) {
 			if (!ok) {
 				mask = (size_t) switch_core_hash_find(log_hash, node->file);
@@ -233,7 +232,7 @@
 		if (ok) {
 #ifndef WIN32
 			int aok = can_write(handle, 10000);
-			
+
 			if (!aok) {
 				//hard_log_level = 0;
 				//failed_write++;
@@ -261,18 +260,18 @@
 SWITCH_STANDARD_API(console_api_function)
 {
 	int argc;
-    char *mydata = NULL, *argv[3];
+	char *mydata = NULL, *argv[3];
 	const char *err = NULL;
 
 	if (!cmd) {
 		err = "bad args";
-        goto end;
-    }
+		goto end;
+	}
+
+	mydata = strdup(cmd);
+	assert(mydata);
 
-    mydata = strdup(cmd);
-    assert(mydata);
-	
-    argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+	argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 
 	if (argc > 0) {
 
@@ -283,7 +282,7 @@
 
 		if (!strcasecmp(argv[0], "loglevel")) {
 			int level = hard_log_level;
-			
+
 			if (argc > 1) {
 				if (*argv[1] > 47 && *argv[1] < 58) {
 					level = atoi(argv[1]);
@@ -296,26 +295,26 @@
 				stream->write_function(stream, "-ERR syntax error, console log level not set!\n");
 			} else {
 				hard_log_level = level;
-				stream->write_function(stream,  "+OK console log level set to %s\n", switch_log_level2str(hard_log_level));
+				stream->write_function(stream, "+OK console log level set to %s\n", switch_log_level2str(hard_log_level));
 			}
 			goto end;
 		} else if (!strcasecmp(argv[0], "colorize")) {
 			if (argc > 1) {
 				COLORIZE = switch_true(argv[1]);
 			}
-			stream->write_function(stream,  "+OK console color %s\n", COLORIZE ? "enabled" : "disabled");
+			stream->write_function(stream, "+OK console color %s\n", COLORIZE ? "enabled" : "disabled");
 			goto end;
 		}
-		
+
 		err = "invalid command";
 
 	}
 
 
- end:
-	
+  end:
+
 	if (err) {
-		stream->write_function(stream,  "-Error %s\n", err);
+		stream->write_function(stream, "-Error %s\n", err);
 	}
 
 
@@ -328,10 +327,10 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_console_load)
 {
 	switch_api_interface_t *api_interface;
-	
+
 
 	module_pool = pool;
-	
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 

Modified: freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c
==============================================================================
--- freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c	(original)
+++ freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c	Tue May 27 00:54:52 2008
@@ -36,9 +36,9 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_logfile_shutdown);
 SWITCH_MODULE_DEFINITION(mod_logfile, mod_logfile_load, mod_logfile_shutdown, NULL);
 
-#define DEFAULT_LIMIT	 0xA00000 /* About 10 MB */
+#define DEFAULT_LIMIT	 0xA00000	/* About 10 MB */
 #define WARM_FUZZY_OFFSET 256
-#define MAX_ROT 4096 /* why not */
+#define MAX_ROT 4096			/* why not */
 
 static switch_memory_pool_t *module_pool = NULL;
 static switch_hash_t *profile_hash = NULL;
@@ -50,12 +50,12 @@
 
 struct logfile_profile {
 	char *name;
-	switch_size_t log_size;	  /* keep the log size in check for rotation */
-	switch_size_t roll_size;  /* the size that we want to rotate the file at */
+	switch_size_t log_size;		/* keep the log size in check for rotation */
+	switch_size_t roll_size;	/* the size that we want to rotate the file at */
 	char *logfile;
 	switch_file_t *log_afd;
-    switch_hash_t *log_hash;
-    uint32_t all_level;
+	switch_hash_t *log_hash;
+	uint32_t all_level;
 };
 
 typedef struct logfile_profile logfile_profile_t;
@@ -76,7 +76,7 @@
 		return;
 	}
 
-	switch_core_hash_insert(profile->log_hash, var, (void *)(intptr_t) switch_log_str2mask(val));
+	switch_core_hash_insert(profile->log_hash, var, (void *) (intptr_t) switch_log_str2mask(val));
 }
 
 static switch_status_t mod_logfile_rotate(logfile_profile_t *profile);
@@ -92,7 +92,7 @@
 	flags |= SWITCH_FOPEN_WRITE;
 	flags |= SWITCH_FOPEN_APPEND;
 
-	stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD|SWITCH_FPROT_UWRITE, module_pool);
+	stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, module_pool);
 	if (stat != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -136,15 +136,15 @@
 	}
 
 
-	p = malloc(strlen(profile->logfile)+WARM_FUZZY_OFFSET);
+	p = malloc(strlen(profile->logfile) + WARM_FUZZY_OFFSET);
 	switch_assert(p);
 
-	memset(p, '\0', strlen(profile->logfile)+WARM_FUZZY_OFFSET);
+	memset(p, '\0', strlen(profile->logfile) + WARM_FUZZY_OFFSET);
 
 	switch_core_new_memory_pool(&pool);
 
-	for (i=1; i < MAX_ROT; i++) {
-		sprintf((char *)p, "%s.%s.%i", profile->logfile, date, i);
+	for (i = 1; i < MAX_ROT; i++) {
+		sprintf((char *) p, "%s.%s.%i", profile->logfile, date, i);
 		if (switch_file_exists(p, pool) == SWITCH_STATUS_SUCCESS) {
 			continue;
 		}
@@ -152,9 +152,9 @@
 		switch_file_close(profile->log_afd);
 		switch_file_rename(profile->logfile, p, pool);
 		if ((status = mod_logfile_openlogfile(profile, SWITCH_FALSE)) != SWITCH_STATUS_SUCCESS) {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Rotating Log!\n");
-            goto end;
-        }
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Rotating Log!\n");
+			goto end;
+		}
 		break;
 	}
 
@@ -164,7 +164,7 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New log started.\n");
 
-end:
+  end:
 
 	switch_mutex_unlock(globals.mutex);
 
@@ -175,7 +175,7 @@
 static switch_status_t mod_logfile_raw_write(logfile_profile_t *profile, char *log_data)
 {
 	switch_size_t len;
-    switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	len = strlen(log_data);
 
 	if (len <= 0 || !profile->log_afd) {
@@ -187,96 +187,96 @@
 	if (switch_file_write(profile->log_afd, log_data, &len) != SWITCH_STATUS_SUCCESS) {
 		switch_file_close(profile->log_afd);
 		if ((status = mod_logfile_openlogfile(profile, SWITCH_TRUE)) == SWITCH_STATUS_SUCCESS) {
-            len = strlen(log_data);
-            switch_file_write(profile->log_afd, log_data, &len);
-        }
+			len = strlen(log_data);
+			switch_file_write(profile->log_afd, log_data, &len);
+		}
 	}
 
 	switch_mutex_unlock(globals.mutex);
 
-    if (status == SWITCH_STATUS_SUCCESS) {
-        profile->log_size += len;
+	if (status == SWITCH_STATUS_SUCCESS) {
+		profile->log_size += len;
 
-        if (profile->roll_size && profile->log_size >= profile->roll_size) {
-            mod_logfile_rotate(profile);
-        }
-    }
+		if (profile->roll_size && profile->log_size >= profile->roll_size) {
+			mod_logfile_rotate(profile);
+		}
+	}
 
 	return status;
 }
 
 static switch_status_t process_node(const switch_log_node_t *node, switch_log_level_t level)
 {
-    switch_hash_index_t *hi;
+	switch_hash_index_t *hi;
 	void *val;
 	const void *var;
 	logfile_profile_t *profile;
-    
-    for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
-        size_t mask = 0;
-        size_t ok = 0;
-    
-        switch_hash_this(hi, &var, NULL, &val);
-        profile = val;
-        
-        ok = switch_log_check_mask(profile->all_level, level);
-        
-        if (!ok) {
-            mask = (size_t) switch_core_hash_find(profile->log_hash, node->file);
-            ok = switch_log_check_mask(mask, level);
-        }
-
-        if (!ok) {
-            mask = (size_t) switch_core_hash_find(profile->log_hash, node->func);
-            ok = switch_log_check_mask(mask, level);
-        }
-
-        if (ok) {
-            mod_logfile_raw_write(profile, node->data);
-        }
 
-    }
+	for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
+		size_t mask = 0;
+		size_t ok = 0;
+
+		switch_hash_this(hi, &var, NULL, &val);
+		profile = val;
+
+		ok = switch_log_check_mask(profile->all_level, level);
+
+		if (!ok) {
+			mask = (size_t) switch_core_hash_find(profile->log_hash, node->file);
+			ok = switch_log_check_mask(mask, level);
+		}
+
+		if (!ok) {
+			mask = (size_t) switch_core_hash_find(profile->log_hash, node->func);
+			ok = switch_log_check_mask(mask, level);
+		}
+
+		if (ok) {
+			mod_logfile_raw_write(profile, node->data);
+		}
+
+	}
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t mod_logfile_logger(const switch_log_node_t *node, switch_log_level_t level)
 {
-    return process_node(node, level);
+	return process_node(node, level);
 }
 
 static switch_status_t load_profile(switch_xml_t xml)
 {
 	switch_xml_t param, settings;
-    char *name = (char *) switch_xml_attr_soft(xml, "name");
-    logfile_profile_t *new_profile;
+	char *name = (char *) switch_xml_attr_soft(xml, "name");
+	logfile_profile_t *new_profile;
+
+	new_profile = switch_core_alloc(module_pool, sizeof(*new_profile));
+	memset(new_profile, 0, sizeof(*new_profile));
+	switch_core_hash_init(&(new_profile->log_hash), module_pool);
+	new_profile->name = switch_core_strdup(module_pool, switch_str_nil(name));
+
 
-    new_profile = switch_core_alloc(module_pool, sizeof(*new_profile));
-    memset(new_profile, 0, sizeof(*new_profile));
-    switch_core_hash_init(&(new_profile->log_hash), module_pool);
-    new_profile->name = switch_core_strdup(module_pool, switch_str_nil(name));
-    
-    
 	if ((settings = switch_xml_child(xml, "settings"))) {
-        for (param = switch_xml_child(settings, "param"); param; param = param->next) {
-            char *var = (char *) switch_xml_attr_soft(param, "name");
-            char *val = (char *) switch_xml_attr_soft(param, "value");
-            if (!strcmp(var, "logfile")) {
-                new_profile->logfile = strdup(val);
-            } else if (!strcmp(var, "rollover")) {
-                new_profile->roll_size = atoi(val);
-                if (new_profile->roll_size < 0) {
-                    new_profile->roll_size = 0;
-                }
-            }
-        }
-    }
+		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+			char *var = (char *) switch_xml_attr_soft(param, "name");
+			char *val = (char *) switch_xml_attr_soft(param, "value");
+			if (!strcmp(var, "logfile")) {
+				new_profile->logfile = strdup(val);
+			} else if (!strcmp(var, "rollover")) {
+				new_profile->roll_size = atoi(val);
+				if (new_profile->roll_size < 0) {
+					new_profile->roll_size = 0;
+				}
+			}
+		}
+	}
 
 	if ((settings = switch_xml_child(xml, "mappings"))) {
 		for (param = switch_xml_child(settings, "map"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
 			char *val = (char *) switch_xml_attr_soft(param, "value");
-            
+
 			add_mapping(new_profile, var, val);
 		}
 	}
@@ -286,40 +286,40 @@
 		switch_snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
 		new_profile->logfile = strdup(logfile);
 	}
-    
-    if (mod_logfile_openlogfile(new_profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
-        return SWITCH_STATUS_GENERR;
-    }
 
-    switch_core_hash_insert(profile_hash, new_profile->name, (void *) new_profile);
-    return SWITCH_STATUS_SUCCESS;
+	if (mod_logfile_openlogfile(new_profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_GENERR;
+	}
+
+	switch_core_hash_insert(profile_hash, new_profile->name, (void *) new_profile);
+	return SWITCH_STATUS_SUCCESS;
 }
 
 
 static void event_handler(switch_event_t *event)
 {
 	const char *sig = switch_event_get_header(event, "Trapped-Signal");
-    switch_hash_index_t *hi;
+	switch_hash_index_t *hi;
 	void *val;
 	const void *var;
 	logfile_profile_t *profile;
 
 	if (sig && !strcmp(sig, "HUP")) {
 		if (globals.rotate) {
-		    for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
-		        switch_hash_this(hi, &var, NULL, &val);
+			for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
+				switch_hash_this(hi, &var, NULL, &val);
 				profile = val;
 				mod_logfile_rotate(profile);
 			}
 		} else {
 			switch_mutex_lock(globals.mutex);
-		    for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
-		        switch_hash_this(hi, &var, NULL, &val);
+			for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
+				switch_hash_this(hi, &var, NULL, &val);
 				profile = val;
 				switch_file_close(profile->log_afd);
 				if (mod_logfile_openlogfile(profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Re-opening Log!\n");
-                }
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Re-opening Log!\n");
+				}
 			}
 			switch_mutex_unlock(globals.mutex);
 		}
@@ -364,11 +364,11 @@
 
 		if ((profiles = switch_xml_child(cfg, "profiles"))) {
 			for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
-                if (load_profile(xprofile) != SWITCH_STATUS_SUCCESS) {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.");
-                }
-            }
-        }
+				if (load_profile(xprofile) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.");
+				}
+			}
+		}
 
 		switch_xml_free(xml);
 	}

Modified: freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c
==============================================================================
--- freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c	(original)
+++ freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c	Tue May 27 00:54:52 2008
@@ -54,16 +54,16 @@
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_format, globals.format);
 
 static switch_loadable_module_interface_t console_module_interface = {
-    /*.module_name */ modname,
-    /*.endpoint_interface */ NULL,
-    /*.timer_interface */ NULL,
-    /*.dialplan_interface */ NULL,
-    /*.codec_interface */ NULL,
-    /*.application_interface */ NULL,
-    /*.api_interface */ NULL,
-    /*.file_interface */ NULL,
-    /*.speech_interface */ NULL,
-    /*.directory_interface */ NULL
+	/*.module_name */ modname,
+	/*.endpoint_interface */ NULL,
+	/*.timer_interface */ NULL,
+	/*.dialplan_interface */ NULL,
+	/*.codec_interface */ NULL,
+	/*.application_interface */ NULL,
+	/*.api_interface */ NULL,
+	/*.file_interface */ NULL,
+	/*.speech_interface */ NULL,
+	/*.directory_interface */ NULL
 };
 
 static switch_status_t mod_syslog_logger(const switch_log_node_t *node, switch_log_level_t level)
@@ -72,30 +72,30 @@
 	int syslog_level;
 
 	switch (level) {
-		case SWITCH_LOG_DEBUG:
-			syslog_level = LOG_DEBUG;
-			break;
-		case SWITCH_LOG_INFO:
-			syslog_level = LOG_INFO;
-			break;
-		case SWITCH_LOG_NOTICE:
-			syslog_level = LOG_NOTICE;
-			break;
-		case SWITCH_LOG_WARNING:
-			syslog_level = LOG_WARNING;
-			break;
-		case SWITCH_LOG_ERROR:
-			syslog_level = LOG_ERR;
-			break;
-		case SWITCH_LOG_CRIT:
-			syslog_level = LOG_CRIT;
-			break;
-		case SWITCH_LOG_ALERT:
-			syslog_level = LOG_ALERT;
-			break;
-		default:
-			syslog_level = LOG_NOTICE;
-			break;
+	case SWITCH_LOG_DEBUG:
+		syslog_level = LOG_DEBUG;
+		break;
+	case SWITCH_LOG_INFO:
+		syslog_level = LOG_INFO;
+		break;
+	case SWITCH_LOG_NOTICE:
+		syslog_level = LOG_NOTICE;
+		break;
+	case SWITCH_LOG_WARNING:
+		syslog_level = LOG_WARNING;
+		break;
+	case SWITCH_LOG_ERROR:
+		syslog_level = LOG_ERR;
+		break;
+	case SWITCH_LOG_CRIT:
+		syslog_level = LOG_CRIT;
+		break;
+	case SWITCH_LOG_ALERT:
+		syslog_level = LOG_ALERT;
+		break;
+	default:
+		syslog_level = LOG_NOTICE;
+		break;
 	}
 
 	if (!switch_strlen_zero(message)) {

Modified: freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c	(original)
+++ freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c	Tue May 27 00:54:52 2008
@@ -196,8 +196,8 @@
 	if (in != 0) {
 		for (x = 8; x >= 0; x--) {
 			int num = (int) pow(10, x);
-			if ((places[(uint32_t)x] = in / num)) {
-				in -= places[(uint32_t)x] * num;
+			if ((places[(uint32_t) x] = in / num)) {
+				in -= places[(uint32_t) x] * num;
 			}
 		}
 

Modified: freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c	(original)
+++ freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c	Tue May 27 00:54:52 2008
@@ -185,8 +185,8 @@
 	if (in != 0) {
 		for (x = 8; x >= 0; x--) {
 			int num = (int) pow(10, x);
-			if ((places[(uint32_t)x] = in / num)) {
-				in -= places[(uint32_t)x] * num;
+			if ((places[(uint32_t) x] = in / num)) {
+				in -= places[(uint32_t) x] * num;
 			}
 		}
 

Modified: freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c	(original)
+++ freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c	Tue May 27 00:54:52 2008
@@ -185,8 +185,8 @@
 	if (in != 0) {
 		for (x = 8; x >= 0; x--) {
 			int num = (int) pow(10, x);
-			if ((places[(uint32_t)x] = in / num)) {
-				in -= places[(uint32_t)x] * num;
+			if ((places[(uint32_t) x] = in / num)) {
+				in -= places[(uint32_t) x] * num;
 			}
 		}
 

Modified: freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c	(original)
+++ freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c	Tue May 27 00:54:52 2008
@@ -185,8 +185,8 @@
 	if (in != 0) {
 		for (x = 8; x >= 0; x--) {
 			int num = (int) pow(10, x);
-			if ((places[(uint32_t)x] = in / num)) {
-				in -= places[(uint32_t)x] * num;
+			if ((places[(uint32_t) x] = in / num)) {
+				in -= places[(uint32_t) x] * num;
 			}
 		}
 

Modified: freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c	(original)
+++ freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c	Tue May 27 00:54:52 2008
@@ -185,8 +185,8 @@
 	if (in != 0) {
 		for (x = 8; x >= 0; x--) {
 			int num = (int) pow(10, x);
-			if ((places[(uint32_t)x] = in / num)) {
-				in -= places[(uint32_t)x] * num;
+			if ((places[(uint32_t) x] = in / num)) {
+				in -= places[(uint32_t) x] * num;
 			}
 		}
 

Modified: freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c	(original)
+++ freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c	Tue May 27 00:54:52 2008
@@ -185,8 +185,8 @@
 	if (in != 0) {
 		for (x = 8; x >= 0; x--) {
 			int num = (int) pow(10, x);
-			if ((places[(uint32_t)x] = in / num)) {
-				in -= places[(uint32_t)x] * num;
+			if ((places[(uint32_t) x] = in / num)) {
+				in -= places[(uint32_t) x] * num;
 			}
 		}
 

Modified: freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c	(original)
+++ freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c	Tue May 27 00:54:52 2008
@@ -185,8 +185,8 @@
 	if (in != 0) {
 		for (x = 8; x >= 0; x--) {
 			int num = (int) pow(10, x);
-			if ((places[(uint32_t)x] = in / num)) {
-				in -= places[(uint32_t)x] * num;
+			if ((places[(uint32_t) x] = in / num)) {
+				in -= places[(uint32_t) x] * num;
 			}
 		}
 

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	Tue May 27 00:54:52 2008
@@ -99,10 +99,7 @@
 	}
 
 	if (!switch_strlen_zero(logdir)) {
-		if ((path = switch_mprintf("%s%s%s.cdr.xml", 
-								   logdir, 
-								   SWITCH_PATH_SEPARATOR,
-								   switch_core_session_get_uuid(session)))) {
+		if ((path = switch_mprintf("%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)))) {
 			if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
 				int wrote;
 				wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
@@ -124,7 +121,7 @@
 	/* try to post it to the web server */
 	if (!switch_strlen_zero(globals.url)) {
 		curl_handle = curl_easy_init();
-		
+
 		if (globals.encode) {
 			switch_size_t need_bytes = strlen(xml_text) * 3;
 
@@ -136,14 +133,14 @@
 				switch_url_encode(xml_text, xml_text_escaped, need_bytes);
 			} else {
 				headers = curl_slist_append(headers, "Content-Type: application/x-www-form-base64-encoded");
-				switch_b64_encode((unsigned char *)xml_text, need_bytes / 3, (unsigned char *)xml_text_escaped, need_bytes);
+				switch_b64_encode((unsigned char *) xml_text, need_bytes / 3, (unsigned char *) xml_text_escaped, need_bytes);
 			}
 			switch_safe_free(xml_text);
 			xml_text = xml_text_escaped;
 		} else {
 			headers = curl_slist_append(headers, "Content-Type: application/x-www-form-plaintext");
 		}
-		
+
 		if (!(curl_xml_text = switch_mprintf("cdr=%s", xml_text))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 			goto error;
@@ -165,15 +162,15 @@
 			slist = curl_slist_append(slist, "Expect:");
 			curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
 		}
-		
+
 		if (globals.ignore_cacert_check) {
 			curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
 		}
 
 		/* these were used for testing, optionally they may be enabled if someone desires
-		curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
-		curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
-		*/
+		   curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
+		   curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
+		 */
 
 		for (cur_try = 0; cur_try < globals.retries; cur_try++) {
 			if (cur_try > 0) {
@@ -184,7 +181,7 @@
 			if (httpRes == 200) {
 				goto success;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n",httpRes, globals.url);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n", httpRes, globals.url);
 			}
 		}
 		curl_easy_cleanup(curl_handle);
@@ -197,10 +194,7 @@
 		/* if we are here the web post failed for some reason */
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n");
 
-		if ((path = switch_mprintf("%s%s%s.cdr.xml", 
-								   globals.err_log_dir, 
-								   SWITCH_PATH_SEPARATOR,
-								   switch_core_session_get_uuid(session)))) {
+		if ((path = switch_mprintf("%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)))) {
 			if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
 				int wrote;
 				wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
@@ -218,11 +212,11 @@
 		}
 	}
 
-success:
+  success:
 	status = SWITCH_STATUS_SUCCESS;
 
-error:
-	if (curl_handle) {	
+  error:
+	if (curl_handle) {
 		curl_easy_cleanup(curl_handle);
 	}
 	if (headers) {
@@ -259,7 +253,7 @@
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-	memset(&globals,0,sizeof(globals));
+	memset(&globals, 0, sizeof(globals));
 	globals.log_b = 1;
 	globals.disable100continue = 0;
 
@@ -294,32 +288,22 @@
 				globals.retries = (uint32_t) atoi(val);
 			} else if (!strcasecmp(var, "log-dir")) {
 				if (switch_strlen_zero(val)) {
-					globals.log_dir = switch_mprintf("%s%sxml_cdr", 
-													 SWITCH_GLOBAL_dirs.log_dir,
-													 SWITCH_PATH_SEPARATOR);
+					globals.log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
 				} else {
 					if (switch_is_file_path(val)) {
 						globals.log_dir = strdup(val);
 					} else {
-						globals.log_dir = switch_mprintf("%s%s%s", 
-														 SWITCH_GLOBAL_dirs.log_dir, 
-														 SWITCH_PATH_SEPARATOR,
-														 val);
+						globals.log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
 					}
 				}
 			} else if (!strcasecmp(var, "err-log-dir")) {
 				if (switch_strlen_zero(val)) {
-					globals.err_log_dir = switch_mprintf("%s%sxml_cdr", 
-														 SWITCH_GLOBAL_dirs.log_dir,
-														 SWITCH_PATH_SEPARATOR);
+					globals.err_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
 				} else {
 					if (switch_is_file_path(val)) {
 						globals.err_log_dir = strdup(val);
 					} else {
-						globals.err_log_dir = switch_mprintf("%s%s%s", 
-															 SWITCH_GLOBAL_dirs.log_dir, 
-															 SWITCH_PATH_SEPARATOR,
-															 val);
+						globals.err_log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
 					}
 				}
 			} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
@@ -330,9 +314,7 @@
 				if (!switch_strlen_zero(globals.log_dir)) {
 					globals.err_log_dir = strdup(globals.log_dir);
 				} else {
-					globals.err_log_dir = switch_mprintf("%s%sxml_cdr", 
-														 SWITCH_GLOBAL_dirs.log_dir,
-														 SWITCH_PATH_SEPARATOR);
+					globals.err_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
 				}
 			}
 		}
@@ -342,7 +324,7 @@
 		globals.retries = 0;
 	}
 
-	if (globals.retries && globals.delay<=0) {
+	if (globals.retries && globals.delay <= 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "retries set but delay 0 setting to 5000ms\n");
 		globals.delay = 5000;
 	}
@@ -355,9 +337,9 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_cdr_shutdown)
 {
-	
-	globals.shutdown=1;
-    return SWITCH_STATUS_SUCCESS;
+
+	globals.shutdown = 1;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 /* For Emacs:

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	Tue May 27 00:54:52 2008
@@ -43,8 +43,8 @@
 	char *cred;
 	int disable100continue;
 	uint32_t ignore_cacert_check;
-	switch_hash_t* vars_map;
-	switch_memory_pool_t* vars_map_pool;
+	switch_hash_t *vars_map;
+	switch_memory_pool_t *vars_map_pool;
 };
 
 static int keep_files_around = 0;
@@ -78,7 +78,7 @@
 	stream->write_function(stream, "OK\n");
 	return SWITCH_STATUS_SUCCESS;
 
-usage:
+  usage:
 	stream->write_function(stream, "USAGE: %s\n", XML_CURL_SYNTAX);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -89,7 +89,7 @@
 	struct config_data *config_data = data;
 	int x;
 	x = write(config_data->fd, ptr, realsize);
-	if ( x != (int)realsize) {
+	if (x != (int) realsize) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write! %d out of %d\n", x, realsize);
 	}
 	return x;
@@ -130,13 +130,9 @@
 	}
 
 	switch_snprintf(basic_data, sizeof(basic_data), "hostname=%s&section=%s&tag_name=%s&key_name=%s&key_value=%s",
-					hostname,
-					section,
-					switch_str_nil(tag_name),
-					switch_str_nil(key_name),
-					switch_str_nil(key_value));
+					hostname, section, switch_str_nil(tag_name), switch_str_nil(key_name), switch_str_nil(key_value));
 
-	data = switch_event_build_param_string(params, basic_data,binding->vars_map);
+	data = switch_event_build_param_string(params, basic_data, binding->vars_map);
 	switch_assert(data);
 
 	switch_uuid_get(&uuid);
@@ -166,8 +162,8 @@
 		curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0");
 
 		if (binding->disable100continue) {
-			slist = curl_slist_append(slist, "Expect:"); 
-			curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist); 
+			slist = curl_slist_append(slist, "Expect:");
+			curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
 		}
 
 		if (binding->ignore_cacert_check) {
@@ -206,6 +202,7 @@
 
 	return xml;
 }
+
 #define ENABLE_PARAM_VALUE "enabled"
 static switch_status_t do_config(void)
 {
@@ -214,9 +211,9 @@
 	xml_binding_t *binding = NULL;
 	int x = 0;
 	int need_vars_map = 0;
-	switch_hash_t* vars_map = NULL;
-	switch_memory_pool_t* vars_map_pool = NULL;
-	
+	switch_hash_t *vars_map = NULL;
+	switch_memory_pool_t *vars_map_pool = NULL;
+
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
 		return SWITCH_STATUS_TERM;
@@ -249,29 +246,29 @@
 				disable100continue = 1;
 			} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
 				ignore_cacert_check = 1;
-			} else if(!strcasecmp(var, "enable-post-var")) {
+			} else if (!strcasecmp(var, "enable-post-var")) {
 				if (!vars_map && need_vars_map == 0) {
-				    if (switch_core_new_memory_pool(&vars_map_pool) != SWITCH_STATUS_SUCCESS) {
-					need_vars_map = -1;
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant create memory pool!\n");
-					continue;
-				    }
-	
-				    if (switch_core_hash_init(&vars_map,vars_map_pool) != SWITCH_STATUS_SUCCESS) {
-					need_vars_map = -1;
-					switch_core_destroy_memory_pool(&vars_map_pool);
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant init params hash!\n");
-					continue;
-				    }
-				    need_vars_map = 1;
+					if (switch_core_new_memory_pool(&vars_map_pool) != SWITCH_STATUS_SUCCESS) {
+						need_vars_map = -1;
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant create memory pool!\n");
+						continue;
+					}
+
+					if (switch_core_hash_init(&vars_map, vars_map_pool) != SWITCH_STATUS_SUCCESS) {
+						need_vars_map = -1;
+						switch_core_destroy_memory_pool(&vars_map_pool);
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant init params hash!\n");
+						continue;
+					}
+					need_vars_map = 1;
 				}
-				
+
 				if (vars_map && val)
-				    if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant add %s to params hash!\n",val);
-				    }
-				
-		        }	
+					if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant add %s to params hash!\n", val);
+					}
+
+			}
 		}
 
 		if (!url) {
@@ -296,7 +293,7 @@
 
 		binding->disable100continue = disable100continue;
 		binding->ignore_cacert_check = ignore_cacert_check;
-		
+
 		binding->vars_map = vars_map;
 		binding->vars_map_pool = vars_map_pool;
 
@@ -307,7 +304,7 @@
 		binding = NULL;
 	}
 
- done:
+  done:
 	switch_xml_free(xml);
 
 	return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	Tue May 27 00:54:52 2008
@@ -96,17 +96,15 @@
 	}
 
 	if (!strcasecmp(cmd, "debug_on")) {
-	}
-	else if (!strcasecmp(cmd, "debug_off")) {
-	}
-	else {
+	} else if (!strcasecmp(cmd, "debug_off")) {
+	} else {
 		goto usage;
 	}
 
 	stream->write_function(stream, "OK\n");
 	return SWITCH_STATUS_SUCCESS;
 
-usage:
+  usage:
 	stream->write_function(stream, "USAGE: %s\n", XML_LDAP_SYNTAX);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -144,11 +142,10 @@
 			ldap->val = ldap_first_attribute(ldap->ld, ldap->entry, &ldap->berval);
 			do {
 				if (strstr(ldap->val, "value")) {
-					if (strstr(ldap->val, ldap->key) && strcmp(ldap->val, ldap->key) ) {
+					if (strstr(ldap->val, ldap->key) && strcmp(ldap->val, ldap->key)) {
 						if (!strcmp(ldap->key, "param")) {
 							params = switch_xml_add_child_d(asdf, "params", loff++);
-						}
-						else if (!strcmp(ldap->key, "variable")) {
+						} else if (!strcmp(ldap->key, "variable")) {
 							variables = switch_xml_add_child_d(asdf, "variables", loff++);
 						}
 
@@ -162,8 +159,7 @@
 										param = switch_xml_add_child_d(params, "param", loff++);
 										switch_xml_set_attr_d(param, "name", ldap->keyvals[i]);
 										switch_xml_set_attr_d(param, "value", ldap->valvals[i]);
-									}
-									else if (!strcmp(ldap->key, "variable")) {
+									} else if (!strcmp(ldap->key, "variable")) {
 										variable = switch_xml_add_child_d(variables, "variable", loff++);
 										switch_xml_set_attr_d(variable, "name", ldap->keyvals[i]);
 										switch_xml_set_attr_d(variable, "value", ldap->valvals[i]);
@@ -177,9 +173,9 @@
 								if (ldap->valvals) {
 									ldap_value_free(ldap->valvals);
 								}
-							}
-							else {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "seems the values %d and %d are not the same??\n",ldap_count_values(ldap->valvals), ldap_count_values(ldap->keyvals));
+							} else {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "seems the values %d and %d are not the same??\n",
+												  ldap_count_values(ldap->valvals), ldap_count_values(ldap->keyvals));
 							}
 						}
 					}
@@ -200,7 +196,7 @@
 				ber_free(ldap->berval, 0);
 			}
 
-			ldap->key = ldap_next_attribute(ldap->ld, ldap->entry, ldap->berkey );
+			ldap->key = ldap_next_attribute(ldap->ld, ldap->entry, ldap->berkey);
 
 		} while (ldap->key != NULL);
 
@@ -212,9 +208,10 @@
 }
 
 
-static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t	*params, void *user_data)
+static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
+									void *user_data)
 {
-	xml_binding_t *binding = (xml_binding_t *)user_data;
+	xml_binding_t *binding = (xml_binding_t *) user_data;
 	switch_event_header_t *hi;
 
 	switch_xml_t xml = NULL, sub = NULL;
@@ -222,7 +219,7 @@
 	struct ldap_c ldap_connection;
 	struct ldap_c *ldap = &ldap_connection;
 
-	int auth_method     = LDAP_AUTH_SIMPLE;
+	int auth_method = LDAP_AUTH_SIMPLE;
 	int desired_version = LDAP_VERSION3;
 	xml_ldap_query_type_t query_type;
 	char *dir_exten = NULL, *dir_domain = NULL;
@@ -237,16 +234,13 @@
 		return NULL;
 	}
 
-	if (!strcmp(section,"configuration")) {
+	if (!strcmp(section, "configuration")) {
 		query_type = XML_LDAP_CONFIG;
-	}
-	else if (!strcmp(section,"directory")) {
+	} else if (!strcmp(section, "directory")) {
 		query_type = XML_LDAP_DIRECTORY;
-	}
-	else if (!strcmp(section,"dialplan")) {
+	} else if (!strcmp(section, "dialplan")) {
 		query_type = XML_LDAP_DIALPLAN;
-	}
-	else if (!strcmp(section,"phrases")) {
+	} else if (!strcmp(section, "phrases")) {
 		query_type = XML_LDAP_PHRASE;
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid section\n");
@@ -256,15 +250,14 @@
 	if (params) {
 		if ((hi = params->headers)) {
 			for (; hi; hi = hi->next) {
-				switch(query_type) {
+				switch (query_type) {
 				case XML_LDAP_CONFIG:
 					break;
 
 				case XML_LDAP_DIRECTORY:
-					if (!strcmp(hi->name,"user")) {
+					if (!strcmp(hi->name, "user")) {
 						dir_exten = strdup(hi->value);
-					}
-					else if (!strcmp(hi->name,"domain")) {
+					} else if (!strcmp(hi->name, "domain")) {
 						dir_domain = strdup(hi->value);
 					}
 					break;
@@ -274,7 +267,7 @@
 					break;
 				}
 			}
-			switch(query_type) {
+			switch (query_type) {
 			case XML_LDAP_CONFIG:
 				break;
 
@@ -282,7 +275,7 @@
 				if (dir_exten && dir_domain) {
 					if ((xml = switch_xml_new("directory"))) {
 						switch_xml_set_attr_d(xml, "type", "freeswitch/xml");
-						
+
 						if ((sub = switch_xml_add_child_d(xml, "section", off++))) {
 							switch_xml_set_attr_d(sub, "name", "directory");
 						}
@@ -290,21 +283,23 @@
 						if ((sub = switch_xml_add_child_d(sub, "domain", off++))) {
 							switch_xml_set_attr_d(sub, "name", dir_domain);
 						}
-						
+
 						if ((sub = switch_xml_add_child_d(sub, "user", off++))) {
 							switch_xml_set_attr_d(sub, "id", dir_exten);
 						}
 					}
 
 					search_base = switch_mprintf(binding->queryfmt, dir_exten, dir_domain, binding->ldap_base);
-						
+
 					free(dir_exten);
 					dir_exten = NULL;
 
 					free(dir_domain);
 					dir_domain = NULL;
 				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "something bad happened during the query construction phase likely exten(%s) or domain(%s) is null\n", dir_exten, dir_domain);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+									  "something bad happened during the query construction phase likely exten(%s) or domain(%s) is null\n", dir_exten,
+									  dir_domain);
 					goto cleanup;
 				}
 				break;
@@ -325,8 +320,7 @@
 			case XML_LDAP_PHRASE:
 				break;
 			}
-		}
-		else {
+		} else {
 			goto cleanup;
 		}
 	}
@@ -359,7 +353,7 @@
 		goto cleanup;
 	}
 
-cleanup:
+  cleanup:
 	if (ldap->msg) {
 		ldap_msgfree(ldap->msg);
 	}
@@ -409,28 +403,25 @@
 				if (val) {
 					binding->queryfmt = strdup(val);
 				}
-			}
-			else if (!strcasecmp(var, "base")) {
+			} else if (!strcasecmp(var, "base")) {
 				binding->ldap_base = strdup(val);
-			}
-			else if (!strcasecmp(var, "binddn")) {
+			} else if (!strcasecmp(var, "binddn")) {
 				binding->binddn = strdup(val);
-			}
-			else if (!strcasecmp(var, "bindpass")) {
+			} else if (!strcasecmp(var, "bindpass")) {
 				binding->bindpass = strdup(val);
-			}
-			else if (!strcasecmp(var, "host")) {
+			} else if (!strcasecmp(var, "host")) {
 				binding->host = strdup(val);
 			}
 		}
 
 		if (!binding->ldap_base || !binding->binddn || !binding->bindpass || !binding->queryfmt) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must define \"base\", \"binddn\", \"bindpass\", and \"queryfmt\" in mod_xml_ldap.conf.xml\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+							  "You must define \"base\", \"binddn\", \"bindpass\", and \"queryfmt\" in mod_xml_ldap.conf.xml\n");
 			continue;
 		}
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
-				switch_strlen_zero(bname) ? "N/A" : bname, binding->ldap_base, binding->bindings ? binding->bindings : "all");
+						  switch_strlen_zero(bname) ? "N/A" : bname, binding->ldap_base, binding->bindings ? binding->bindings : "all");
 
 		switch_xml_bind_search_function(xml_ldap_search, switch_xml_parse_section_string(bname), binding);
 
@@ -438,7 +429,7 @@
 		binding = NULL;
 	}
 
-done:
+  done:
 	switch_xml_free(xml);
 
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	Tue May 27 00:54:52 2008
@@ -48,7 +48,7 @@
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_xml_rpc_runtime);
 SWITCH_MODULE_DEFINITION(mod_xml_rpc, mod_xml_rpc_load, mod_xml_rpc_shutdown, mod_xml_rpc_runtime);
 
-static abyss_bool HTTPWrite(TSession *s,char *buffer,uint32_t len);
+static abyss_bool HTTPWrite(TSession * s, char *buffer, uint32_t len);
 
 static struct {
 	uint16_t port;
@@ -122,8 +122,8 @@
 {
 	TSession *r = handle->data;
 
-	return HTTPWrite(r, (char *)data, (uint32_t) datalen) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
-	
+	return HTTPWrite(r, (char *) data, (uint32_t) datalen) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+
 }
 
 static switch_status_t http_stream_write(switch_stream_handle_t *handle, const char *fmt, ...)
@@ -146,11 +146,11 @@
 	return ret ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
 }
 
-static abyss_bool http_directory_auth(TSession *r, char *domain_name) 
+static abyss_bool http_directory_auth(TSession * r, char *domain_name)
 {
-    char *p;
+	char *p;
 	char *x;
-    char z[256], t[80];
+	char z[256], t[80];
 	char user[512];
 	char *pass;
 	const char *mypass1 = NULL, *mypass2 = NULL;
@@ -159,27 +159,27 @@
 	int at = 0;
 	switch_event_t *params = NULL;
 
-    p = RequestHeaderValue(r, "authorization");
+	p = RequestHeaderValue(r, "authorization");
 
-    if (p) {
-        NextToken((const char ** const)&p);
-        x = GetToken(&p);
-        if (x) {
-            if (!strcasecmp(x, "basic")) {
+	if (p) {
+		NextToken((const char **const) &p);
+		x = GetToken(&p);
+		if (x) {
+			if (!strcasecmp(x, "basic")) {
 
 
-                NextToken((const char ** const)&p);
+				NextToken((const char **const) &p);
 				switch_b64_decode(p, user, sizeof(user));
 				if ((pass = strchr(user, ':'))) {
 					*pass++ = '\0';
 				}
-				
+
 				if (!domain_name) {
 					if ((domain_name = strchr(user, '@'))) {
 						*domain_name++ = '\0';
 						at++;
 					} else {
-						domain_name = (char *)r->requestInfo.host;
+						domain_name = (char *) r->requestInfo.host;
 						if (!strncasecmp(domain_name, "www.", 3)) {
 							domain_name += 4;
 						}
@@ -189,15 +189,15 @@
 				if (!domain_name) {
 					goto fail;
 				}
-				
+
 				switch_snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass);
 				Base64Encode(z, t);
-				
+
 				if (!strcmp(p, t)) {
-					r->requestInfo.user=strdup(user);
+					r->requestInfo.user = strdup(user);
 					goto authed;
 				}
-				
+
 				switch_event_create(&params, SWITCH_EVENT_MESSAGE);
 				switch_assert(params);
 				switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", "check");
@@ -207,41 +207,41 @@
 					goto fail;
 				}
 
-				switch_event_destroy(&params);				
+				switch_event_destroy(&params);
 				box = switch_xml_attr_soft(x_user, "mailbox");
-				
-                for (x_param = switch_xml_child(x_domain, "param"); x_param; x_param = x_param->next) {
-                    const char *var = switch_xml_attr_soft(x_param, "name");
-                    const char *val = switch_xml_attr_soft(x_param, "value");
-					
-                    if (!strcasecmp(var, "password")) {
-                        mypass1 = val;
-                    } else if (!strcasecmp(var, "vm-password")) {
-                        mypass2 = val;
-                    } else if (!strncasecmp(var, "http-", 5)) {
-						ResponseAddField(r, (char *)var, (char *)val);
-                    } 
+
+				for (x_param = switch_xml_child(x_domain, "param"); x_param; x_param = x_param->next) {
+					const char *var = switch_xml_attr_soft(x_param, "name");
+					const char *val = switch_xml_attr_soft(x_param, "value");
+
+					if (!strcasecmp(var, "password")) {
+						mypass1 = val;
+					} else if (!strcasecmp(var, "vm-password")) {
+						mypass2 = val;
+					} else if (!strncasecmp(var, "http-", 5)) {
+						ResponseAddField(r, (char *) var, (char *) val);
+					}
 				}
 
 				if (!(x_params = switch_xml_child(x_user, "params"))) {
 					goto authed;
-                }
-				
-                for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-                    const char *var = switch_xml_attr_soft(x_param, "name");
-                    const char *val = switch_xml_attr_soft(x_param, "value");
-                    
-                    if (!strcasecmp(var, "password")) {
-                        mypass1 = val;
-                    } else if (!strcasecmp(var, "vm-password")) {
-                        mypass2 = val;
-                    } else if (!strncasecmp(var, "http-", 5)) {
-						ResponseAddField(r, (char *)var, (char *)val);
-                    } 
 				}
-				
+
+				for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+					const char *var = switch_xml_attr_soft(x_param, "name");
+					const char *val = switch_xml_attr_soft(x_param, "value");
+
+					if (!strcasecmp(var, "password")) {
+						mypass1 = val;
+					} else if (!strcasecmp(var, "vm-password")) {
+						mypass2 = val;
+					} else if (!strncasecmp(var, "http-", 5)) {
+						ResponseAddField(r, (char *) var, (char *) val);
+					}
+				}
+
 				if (!(mypass1 && mypass2)) {
-					r->requestInfo.user=strdup(user);
+					r->requestInfo.user = strdup(user);
 					goto authed;
 				} else {
 					if (mypass1) {
@@ -251,9 +251,9 @@
 							switch_snprintf(z, sizeof(z), "%s:%s", user, mypass1);
 						}
 						Base64Encode(z, t);
-				
+
 						if (!strcmp(p, t)) {
-							r->requestInfo.user=strdup(box ? box : user);
+							r->requestInfo.user = strdup(box ? box : user);
 							goto authed;
 						}
 					}
@@ -265,9 +265,9 @@
 							switch_snprintf(z, sizeof(z), "%s:%s", user, mypass2);
 						}
 						Base64Encode(z, t);
-				
+
 						if (!strcmp(p, t)) {
-							r->requestInfo.user=strdup(box ? box : user);
+							r->requestInfo.user = strdup(box ? box : user);
 							goto authed;
 						}
 					}
@@ -280,13 +280,13 @@
 								switch_snprintf(z, sizeof(z), "%s:%s", box, mypass1);
 							}
 							Base64Encode(z, t);
-					
+
 							if (!strcmp(p, t)) {
-								r->requestInfo.user=strdup(box);
+								r->requestInfo.user = strdup(box);
 								goto authed;
 							}
 						}
-					
+
 						if (mypass2) {
 							if (at) {
 								switch_snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass2);
@@ -295,9 +295,9 @@
 							}
 
 							Base64Encode(z, t);
-					
+
 							if (!strcmp(p, t)) {
-								r->requestInfo.user=strdup(box);
+								r->requestInfo.user = strdup(box);
 								goto authed;
 							}
 						}
@@ -305,30 +305,30 @@
 				}
 				goto fail;
 
-			authed:
-				
+			  authed:
+
 				ResponseAddField(r, "freeswitch-user", r->requestInfo.user);
 				ResponseAddField(r, "freeswitch-domain", domain_name);
-				
+
 				if (x_domain_root) {
 					switch_xml_free(x_domain_root);
 				}
-				
+
 				return TRUE;
-            }
-        }
-    }
+			}
+		}
+	}
 
- fail:
+  fail:
 
 	if (x_domain_root) {
 		switch_xml_free(x_domain_root);
 	}
 
-    switch_snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
-    ResponseAddField(r, "WWW-Authenticate", z);
-    ResponseStatus(r, 401);
-    return FALSE;
+	switch_snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
+	ResponseAddField(r, "WWW-Authenticate", z);
+	ResponseStatus(r, 401);
+	return FALSE;
 }
 
 abyss_bool auth_hook(TSession * r)
@@ -339,7 +339,7 @@
 	if (!strncmp(r->requestInfo.uri, "/domains/", 9)) {
 		domain_name = strdup(r->requestInfo.uri + 9);
 		switch_assert(domain_name);
-		
+
 		if ((e = strchr(domain_name, '/'))) {
 			*e++ = '\0';
 		}
@@ -354,36 +354,27 @@
 		free(domain_name);
 	} else {
 		char tmp[512];
-		const char *list[2] = {"index.html", "index.txt"};
+		const char *list[2] = { "index.html", "index.txt" };
 		int x;
 
 		if (!strncmp(r->requestInfo.uri, "/pub", 4)) {
-			char *p = (char *)r->requestInfo.uri;
+			char *p = (char *) r->requestInfo.uri;
 			char *new_uri = p + 4;
 			if (!new_uri) {
 				new_uri = "/";
 			}
 
-			switch_snprintf(tmp, sizeof(tmp), "%s%s", 
-					 SWITCH_GLOBAL_dirs.htdocs_dir, 
-					 new_uri
-					 );
+			switch_snprintf(tmp, sizeof(tmp), "%s%s", SWITCH_GLOBAL_dirs.htdocs_dir, new_uri);
 
 			if (switch_directory_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) {
 				for (x = 0; x < 2; x++) {
-					switch_snprintf(tmp, sizeof(tmp), "%s%s%s%s", 
-							 SWITCH_GLOBAL_dirs.htdocs_dir, 
-							 new_uri,
-							 end_of(new_uri) == *SWITCH_PATH_SEPARATOR ? "" : SWITCH_PATH_SEPARATOR,
-							 list[x]
-							 );
-				
+					switch_snprintf(tmp, sizeof(tmp), "%s%s%s%s",
+									SWITCH_GLOBAL_dirs.htdocs_dir, new_uri, end_of(new_uri) == *SWITCH_PATH_SEPARATOR ? "" : SWITCH_PATH_SEPARATOR, list[x]
+						);
+
 					if (switch_file_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) {
-						switch_snprintf(tmp, sizeof(tmp), "%s%s%s", 
-								 new_uri,
-								 end_of(new_uri) == '/' ? "" : "/",
-								 list[x]
-								 );
+						switch_snprintf(tmp, sizeof(tmp), "%s%s%s", new_uri, end_of(new_uri) == '/' ? "" : "/", list[x]
+							);
 						new_uri = tmp;
 						break;
 					}
@@ -403,36 +394,34 @@
 }
 
 
-static abyss_bool HTTPWrite(TSession *s,char *buffer,uint32_t len)
+static abyss_bool HTTPWrite(TSession * s, char *buffer, uint32_t len)
 {
-    if (s->chunkedwrite && s->chunkedwritemode)
-		{
-			char t[16];
+	if (s->chunkedwrite && s->chunkedwritemode) {
+		char t[16];
 
-			if (ConnWrite(s->conn,t,sprintf(t,"%x"CRLF,len)))
-				if (ConnWrite(s->conn,buffer,len))
-					return ConnWrite(s->conn,CRLF,2);
+		if (ConnWrite(s->conn, t, sprintf(t, "%x" CRLF, len)))
+			if (ConnWrite(s->conn, buffer, len))
+				return ConnWrite(s->conn, CRLF, 2);
 
-			return FALSE;
-		}
+		return FALSE;
+	}
 
-    return ConnWrite(s->conn,buffer,len);
+	return ConnWrite(s->conn, buffer, len);
 }
 
-static abyss_bool HTTPWriteEnd(TSession *s)
+static abyss_bool HTTPWriteEnd(TSession * s)
 {
-    if (!s->chunkedwritemode)
-        return TRUE;
+	if (!s->chunkedwritemode)
+		return TRUE;
 
-    if (s->chunkedwrite)
-		{
-			/* May be one day trailer dumping will be added */
-			s->chunkedwritemode=FALSE;
-			return ConnWrite(s->conn,"0"CRLF CRLF,5);
-		}
+	if (s->chunkedwrite) {
+		/* May be one day trailer dumping will be added */
+		s->chunkedwritemode = FALSE;
+		return ConnWrite(s->conn, "0" CRLF CRLF, 5);
+	}
 
-    s->requestInfo.keepalive=FALSE;
-    return TRUE;
+	s->requestInfo.keepalive = FALSE;
+	return TRUE;
 }
 
 abyss_bool handler_hook(TSession * r)
@@ -471,8 +460,8 @@
 		*path_info++ = '\0';
 	}
 
-	for (i=0;i<r->response_headers.size;i++) {
-		ti=&r->response_headers.item[i];
+	for (i = 0; i < r->response_headers.size; i++) {
+		ti = &r->response_headers.item[i];
 		if (!strcasecmp(ti->name, "freeswitch-user")) {
 			fs_user = ti->value;
 		} else if (!strcasecmp(ti->name, "freeswitch-domain")) {
@@ -481,14 +470,14 @@
 			int argc, x;
 			char *argv[256] = { 0 };
 			j++;
-			
+
 			if (!strcasecmp(ti->value, "any")) {
 				auth++;
 			}
 
 			dup = strdup(ti->value);
 			argc = switch_separate_string(dup, ',', argv, (sizeof(argv) / sizeof(argv[0])));
-			
+
 			for (x = 0; x < argc; x++) {
 				if (!strcasecmp(command, argv[x])) {
 					auth++;
@@ -502,13 +491,12 @@
 	} else {
 		if (!j) {
 			auth = 0;
-		} 
+		}
 	}
-	
+
 	if (auth) {
 		goto auth;
 	}
-
 	//unauth:
 	ResponseStatus(r, 403);
 	ResponseError(r);
@@ -517,11 +505,11 @@
 	ret = TRUE;
 	goto end;
 
- auth:
+  auth:
 
 	if (switch_event_create(&stream.param_event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
-		const char * const content_length = RequestHeaderValue(r, "content-length");
-			
+		const char *const content_length = RequestHeaderValue(r, "content-length");
+
 		if (fs_user)
 			switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "FreeSWITCH-User", "%s", fs_user);
 		if (fs_domain)
@@ -548,14 +536,14 @@
 		if (r->requestInfo.query || content_length) {
 			char *q, *qd;
 			char *next;
-			char *query = (char *)r->requestInfo.query;
+			char *query = (char *) r->requestInfo.query;
 			char *name, *val;
 			char qbuf[8192] = "";
-			
+
 			if (r->requestInfo.method == m_post && content_length) {
 				int len = atoi(content_length);
 				int qlen = 0;
-				
+
 				if (len > 0) {
 					int succeeded;
 					char *qp = qbuf;
@@ -567,11 +555,11 @@
 						}
 
 						qlen += blen;
-						
-						if ( qlen > sizeof(qbuf) ) {
+
+						if (qlen > sizeof(qbuf)) {
 							break;
 						}
-						
+
 						memcpy(qp, r->conn->buffer + r->conn->bufferpos, blen);
 						qp += blen;
 
@@ -579,7 +567,7 @@
 							break;
 						}
 					} while ((succeeded = ConnRead(r->conn, 2000)));
-					
+
 					query = qbuf;
 				}
 			}
@@ -614,14 +602,13 @@
 					}
 					q = next;
 				} while (q != NULL);
-			
+
 				free(qd);
 			}
 		}
 	}
-
 	//ResponseChunked(r);
-	
+
 	//ResponseContentType(r, mime);
 	//ResponseWrite(r);
 
@@ -631,7 +618,7 @@
 
 	/* generation of the date field */
 	{
-		const char * dateValue;
+		const char *dateValue;
 
 		DateToString(r->date, &dateValue);
 
@@ -640,25 +627,25 @@
 		}
 	}
 
-	
+
 	/* Generation of the server field */
-	ResponseAddField(r,"Server", "FreeSWITCH-" SWITCH_VERSION_FULL "-mod_xml_rpc");
+	ResponseAddField(r, "Server", "FreeSWITCH-" SWITCH_VERSION_FULL "-mod_xml_rpc");
 
 	if (html) {
 		ResponseAddField(r, "Content-Type", "text/html");
 	}
 
-	for (i=0;i<r->response_headers.size;i++) {
-		ti=&r->response_headers.item[i];
-		ConnWrite(r->conn, ti->name, (uint32_t)strlen(ti->name));
-		ConnWrite(r->conn,": ",2);
-		ConnWrite(r->conn, ti->value, (uint32_t)strlen(ti->value));
-		ConnWrite(r->conn,CRLF,2);
+	for (i = 0; i < r->response_headers.size; i++) {
+		ti = &r->response_headers.item[i];
+		ConnWrite(r->conn, ti->name, (uint32_t) strlen(ti->name));
+		ConnWrite(r->conn, ": ", 2);
+		ConnWrite(r->conn, ti->value, (uint32_t) strlen(ti->value));
+		ConnWrite(r->conn, CRLF, 2);
 	}
-	
+
 	switch_snprintf(buf, sizeof(buf), "Connection: close\r\n");
 	ConnWrite(r->conn, buf, (uint32_t) strlen(buf));
-	
+
 	if (html) {
 		ConnWrite(r->conn, "\r\n", 2);
 	}
@@ -671,10 +658,10 @@
 	} else {
 		ResponseStatus(r, 404);
 		ResponseError(r);
-	} 
-	
+	}
+
 	//SocketClose(&(r->conn->socket));
-	
+
 	HTTPWriteEnd(r);
 	//if(r->conn->channelP)
 	//ConnKill(r->conn);
@@ -683,7 +670,7 @@
 	//ChannelDestroy(r->conn->channelP);
 	r->requestInfo.keepalive = 0;
 
- end:
+  end:
 
 	return ret;
 }
@@ -710,7 +697,7 @@
 		val = xmlrpc_build_value(envP, "s", "ERROR!");
 	}
 
- done:
+  done:
 	/* xmlrpc-c requires us to free memory it malloced from xmlrpc_decompose_value */
 	switch_safe_free(command);
 	switch_safe_free(arg);
@@ -765,7 +752,7 @@
 	/* Return our result. */
 	val = xmlrpc_build_value(envP, "s", buf);
 
- done:
+  done:
 	/* xmlrpc-c requires us to free memory it malloced from xmlrpc_decompose_value */
 	switch_safe_free(oid);
 	switch_safe_free(s_action);
@@ -795,7 +782,7 @@
 
 	MIMETypeInit();
 	MIMETypeAdd("text/html", "html");
-	for(hi = switch_core_mime_index(); hi; hi = switch_hash_next(hi)) {
+	for (hi = switch_core_mime_index(); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, &var, NULL, &val);
 		if (var && val) {
 			MIMETypeAdd((char *) val, (char *) var);
@@ -831,10 +818,10 @@
 	//globals.abyssServer.running = 0;
 	//shutdown(globals.abyssServer.listensock, 2);
 	ServerTerminate(&globals.abyssServer);
-	while(globals.running) {
+	while (globals.running) {
 		switch_yield(100000);
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 



More information about the Freeswitch-svn mailing list