Revision
15032
Author
gmaruzz
Date
2009-10-01 09:22:00 -0500 (Thu, 01 Oct 2009)

Log Message

celliax: configuration from XML, almost finished

Modified Paths

Diff

Modified: freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c (15031 => 15032)


--- freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c	2009-10-01 11:21:59 UTC (rev 15031)
+++ freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c	2009-10-01 14:22:00 UTC (rev 15032)
@@ -1219,25 +1219,28 @@
 			char *sms_receiving_program= "/usr/local/bin/ciapalo";
 			char *alsacname= "plughw:1";
 			char *alsapname= "plughw:1";
+			char *at_early_audio ="0";
+			char *at_after_preinit_pause="500000";
+			char *at_initial_pause="500000";
+			char *at_has_clcc="0";
+			char *at_has_ecam="0";
+			char *alsa_period_size="160";
+			char *alsa_periods_in_buffer="4";
+			char *celliax_sound_rate="8000";
+			char *alsa_play_is_mono="1";
+			char *alsa_capture_is_mono="1";
+			char *capture_boost="5";
+			char *playback_boost="10";
 
-			uint32_t interface_id = 0, to = 0, max = 0;
-			uint32_t controldevice_speed = B115200;
-			uint32_t controldevprotocol = PROTOCOL_AT;
-			uint32_t running =1;
-			uint32_t at_early_audio =0;
-			uint32_t at_after_preinit_pause=500000;
-			uint32_t at_initial_pause=500000;
-			uint32_t at_has_clcc=0;
-			uint32_t at_has_ecam=0;
-			uint32_t alsa_period_size=160;
-			uint32_t alsa_periods_in_buffer=4;
-			uint32_t celliax_sound_rate=8000;
-			uint32_t alsa_play_is_mono=1;
-			uint32_t alsa_capture_is_mono=1;
-			uint32_t capture_boost=5;
-			uint32_t playback_boost=10;
+			uint32_t interface_id = 0;
+			//uint32_t to=0;
+			//uint32_t max=0;
+			uint32_t controldevice_speed = B115200; //FIXME TODO
+			uint32_t controldevprotocol = PROTOCOL_AT; //FIXME TODO
+			uint32_t running =1; //FIXME TODO
 
 
+
 			tech_pvt = NULL;
 
 			for (param = switch_xml_child(myinterface, "param"); param; param = param->next) {
@@ -1373,25 +1376,33 @@
 				} else if (!strcasecmp(var, "alsapname")) {
 					alsapname = val;
 
-#ifdef NOT_NUMBERS_NOW
-					interface_id 
-						controldevice_speed 
-						controldevprotocol 
-						at_early_audio 
-						at_after_preinit_pause
-						at_initial_pause
-						at_has_clcc
-						at_has_ecam
-						alsa_period_size
-						alsa_periods_in_buffer
-						celliax_sound_rate
-						alsa_play_is_mono
-						alsa_capture_is_mono
-						capture_boost
-						playback_boost
-#endif// NOT_NUMBERS_NOW
 
+				} else if (!strcasecmp(var, "at_early_audio")) {
+					at_early_audio = val;
+				} else if (!strcasecmp(var, "at_after_preinit_pause")) {
+					at_after_preinit_pause = val;
+				} else if (!strcasecmp(var, "at_initial_pause")) {
+					at_initial_pause = val;
+				} else if (!strcasecmp(var, "at_has_clcc")) {
+					at_has_clcc = val;
+				} else if (!strcasecmp(var, "at_has_ecam")) {
+					at_has_ecam = val;
+				} else if (!strcasecmp(var, "alsa_period_size")) {
+					alsa_period_size = val;
+				} else if (!strcasecmp(var, "alsa_periods_in_buffer")) {
+					alsa_periods_in_buffer = val;
+				} else if (!strcasecmp(var, "celliax_sound_rate")) {
+					celliax_sound_rate = val;
+				} else if (!strcasecmp(var, "alsa_play_is_mono")) {
+					alsa_play_is_mono = val;
+				} else if (!strcasecmp(var, "alsa_capture_is_mono")) {
+					alsa_capture_is_mono = val;
+				} else if (!strcasecmp(var, "capture_boost")) {
+					capture_boost = val;
+				} else if (!strcasecmp(var, "playback_boost")) {
+					playback_boost = val;
 
+
 				}
 
 			}
@@ -1411,26 +1422,70 @@
 				ERRORA("interface missing REQUIRED param 'id'\n", CELLIAX_P_LOG);
 				continue;
 			}
+
 			if (switch_is_number(id)) {
 				interface_id = atoi(id);
-				DEBUGA_CELLIAX("interface_id=%d\n", CELLIAX_P_LOG, interface_id);
 			} else {
 				ERRORA("interface param 'id' MUST be a number, now id='%s'\n", CELLIAX_P_LOG, id);
 				continue;
 			}
 
-			if (!name) {
-				WARNINGA("interface missing param 'name', not nice, but works\n", CELLIAX_P_LOG);
+			if(!switch_is_number(at_early_audio)) {
+				ERRORA("interface param 'at_early_audio' MUST be a number, now at_early_audio='%s'\n", CELLIAX_P_LOG, at_early_audio);
+				continue;
 			}
-
-			if (digit_timeout) {
-				to = atoi(digit_timeout);
+			if(!switch_is_number(at_after_preinit_pause)) {
+				ERRORA("interface param 'at_after_preinit_pause' MUST be a number, now at_after_preinit_pause='%s'\n", CELLIAX_P_LOG, at_after_preinit_pause);
+				continue;
 			}
-
-			if (max_digits) {
-				max = atoi(max_digits);
+			if(!switch_is_number(at_initial_pause)) {
+				ERRORA("interface param 'at_initial_pause' MUST be a number, now at_initial_pause='%s'\n", CELLIAX_P_LOG, at_initial_pause);
+				continue;
 			}
+			if(!switch_is_number(at_has_clcc)) {
+				ERRORA("interface param 'at_has_clcc' MUST be a number, now at_has_clcc='%s'\n", CELLIAX_P_LOG, at_has_clcc);
+				continue;
+			}
+			if(!switch_is_number(at_has_ecam)) {
+				ERRORA("interface param 'at_has_ecam' MUST be a number, now at_has_ecam='%s'\n", CELLIAX_P_LOG, at_has_ecam);
+				continue;
+			}
+			if(!switch_is_number(alsa_period_size)) {
+				ERRORA("interface param 'alsa_period_size' MUST be a number, now alsa_period_size='%s'\n", CELLIAX_P_LOG, alsa_period_size);
+				continue;
+			}
+			if(!switch_is_number(alsa_periods_in_buffer)) {
+				ERRORA("interface param 'alsa_periods_in_buffer' MUST be a number, now alsa_periods_in_buffer='%s'\n", CELLIAX_P_LOG, alsa_periods_in_buffer);
+				continue;
+			}
+			if(!switch_is_number(celliax_sound_rate)) {
+				ERRORA("interface param 'celliax_sound_rate' MUST be a number, now celliax_sound_rate='%s'\n", CELLIAX_P_LOG, celliax_sound_rate);
+				continue;
+			}
+			if(!switch_is_number(alsa_play_is_mono)) {
+				ERRORA("interface param 'alsa_play_is_mono' MUST be a number, now alsa_play_is_mono='%s'\n", CELLIAX_P_LOG, alsa_play_is_mono);
+				continue;
+			}
+			if(!switch_is_number(alsa_capture_is_mono)) {
+				ERRORA("interface param 'alsa_capture_is_mono' MUST be a number, now alsa_capture_is_mono='%s'\n", CELLIAX_P_LOG, alsa_capture_is_mono);
+				continue;
+			}
+			if(!switch_is_number(capture_boost)) {
+				ERRORA("interface param 'capture_boost' MUST be a number, now capture_boost='%s'\n", CELLIAX_P_LOG, capture_boost);
+				continue;
+			}
+			if(!switch_is_number(playback_boost)) {
+				ERRORA("interface param 'playback_boost' MUST be a number, now playback_boost='%s'\n", CELLIAX_P_LOG, playback_boost);
+				continue;
+			}
 
+
+
+
+
+
+
+
 			if (name) {
 				DEBUGA_CELLIAX("name=%s\n", CELLIAX_P_LOG, name);
 			}
@@ -1512,108 +1567,35 @@
 				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsacname, alsacname);
 				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsapname, alsapname);
 
+				globals.CELLIAX_INTERFACES[interface_id].at_early_audio = atoi(at_early_audio);
+				globals.CELLIAX_INTERFACES[interface_id].at_after_preinit_pause = atoi(at_after_preinit_pause);
+				globals.CELLIAX_INTERFACES[interface_id].at_initial_pause = atoi(at_initial_pause);
+				globals.CELLIAX_INTERFACES[interface_id].at_has_clcc = atoi(at_has_clcc);
+				globals.CELLIAX_INTERFACES[interface_id].at_has_ecam = atoi(at_has_ecam);
+				globals.CELLIAX_INTERFACES[interface_id].alsa_period_size = atoi(alsa_period_size);
+				globals.CELLIAX_INTERFACES[interface_id].alsa_periods_in_buffer = atoi(alsa_periods_in_buffer);
+				globals.CELLIAX_INTERFACES[interface_id].celliax_sound_rate = atoi(celliax_sound_rate);
+				globals.CELLIAX_INTERFACES[interface_id].alsa_play_is_mono = atoi(alsa_play_is_mono);
+				globals.CELLIAX_INTERFACES[interface_id].alsa_capture_is_mono = atoi(alsa_capture_is_mono);
+				globals.CELLIAX_INTERFACES[interface_id].capture_boost = atoi(capture_boost);
+				globals.CELLIAX_INTERFACES[interface_id].playback_boost = atoi(playback_boost);
 
-#ifdef NOTDEF
-				if (name) {
-					switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, name);
-				} else {
-					switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, "N/A");
-				}
-				DEBUGA_CELLIAX("CONFIGURING interface_id=%d name=%s\n", CELLIAX_P_LOG, interface_id, name);
 
-				switch_mutex_init(&globals.CELLIAX_INTERFACES[interface_id].controldev_lock, SWITCH_MUTEX_NESTED, celliax_module_pool);
 
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].interface_id, id);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].context, context);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].dialplan, dialplan);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].destination, destination);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].controldevice_name, controldevice_name);
-
 				globals.CELLIAX_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
 				globals.CELLIAX_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
-				globals.CELLIAX_INTERFACES[interface_id].running = 1;
-				globals.CELLIAX_INTERFACES[interface_id].at_early_audio = 0;
-				globals.CELLIAX_INTERFACES[interface_id].at_after_preinit_pause = 500000;
-				globals.CELLIAX_INTERFACES[interface_id].at_initial_pause = 500000;
-				globals.CELLIAX_INTERFACES[interface_id].at_has_clcc = 0;
-				globals.CELLIAX_INTERFACES[interface_id].at_has_ecam = 0;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_period_size = 160;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_periods_in_buffer = 4;
-				globals.CELLIAX_INTERFACES[interface_id].celliax_sound_rate = 8000;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_play_is_mono = 1;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_capture_is_mono = 1;
-				globals.CELLIAX_INTERFACES[interface_id].capture_boost = 0;
-				globals.CELLIAX_INTERFACES[interface_id].playback_boost = 0;
-
-
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_pre_number, "ATD");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_post_number, ";");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup, "ATH");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer, "ATA");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_send_dtmf, "AT+VTS");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1, "at+cmic=0,9");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2, "AT+CKPD=\"EEE\"");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3, "AT+CSSN=1,0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4, "at+sidet=0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5, "at+clvl=99");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg, "AT+CBC");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal, "AT+CSQ");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_idle, "+MCST: 1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_incoming, "+MCST: 2");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_active, "+CSSI: 7");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_failed, "+MCST: 65");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_calling, "+CSSI: 1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_noservice_string, "CIEV: 2;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nosignal_string, "CIEV: 5;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowsignal_string, "CIEV: 5;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowbattchg_string, "CIEV: 0;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nobattchg_string, "CIEV: 0;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callactive_string, "CIEV: 3;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallactive_string, "CIEV: 3;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallsetup_string, "CIEV: 6;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupincoming_string, "CIEV: 6;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupoutgoing_string, "CIEV: 6;2");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string, "CIEV: 6;3");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].sms_receiving_program, "/usr/local/bin/ciapalo");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsacname, "plughw:1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsapname, "plughw:1");
-#endif//NOTDEF
-
-
-				globals.CELLIAX_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
-				globals.CELLIAX_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
-				globals.CELLIAX_INTERFACES[interface_id].at_early_audio = at_early_audio;
-				globals.CELLIAX_INTERFACES[interface_id].at_after_preinit_pause = at_after_preinit_pause;
-				globals.CELLIAX_INTERFACES[interface_id].at_initial_pause = at_initial_pause;
-				globals.CELLIAX_INTERFACES[interface_id].at_has_clcc = at_has_clcc;
-				globals.CELLIAX_INTERFACES[interface_id].at_has_ecam = at_has_ecam;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_period_size = alsa_period_size;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_periods_in_buffer = alsa_periods_in_buffer;
-				globals.CELLIAX_INTERFACES[interface_id].celliax_sound_rate = celliax_sound_rate;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_play_is_mono = alsa_play_is_mono;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_capture_is_mono = alsa_capture_is_mono;
-				globals.CELLIAX_INTERFACES[interface_id].capture_boost = capture_boost;
-				globals.CELLIAX_INTERFACES[interface_id].playback_boost = playback_boost;
+				//globals.CELLIAX_INTERFACES[interface_id].at_early_audio = at_early_audio;
+				//globals.CELLIAX_INTERFACES[interface_id].at_after_preinit_pause = at_after_preinit_pause;
+				//globals.CELLIAX_INTERFACES[interface_id].at_initial_pause = at_initial_pause;
+				//globals.CELLIAX_INTERFACES[interface_id].at_has_clcc = at_has_clcc;
+				//globals.CELLIAX_INTERFACES[interface_id].at_has_ecam = at_has_ecam;
+				//globals.CELLIAX_INTERFACES[interface_id].alsa_period_size = alsa_period_size;
+				//globals.CELLIAX_INTERFACES[interface_id].alsa_periods_in_buffer = alsa_periods_in_buffer;
+				//globals.CELLIAX_INTERFACES[interface_id].celliax_sound_rate = celliax_sound_rate;
+				//globals.CELLIAX_INTERFACES[interface_id].alsa_play_is_mono = alsa_play_is_mono;
+				//globals.CELLIAX_INTERFACES[interface_id].alsa_capture_is_mono = alsa_capture_is_mono;
+				//globals.CELLIAX_INTERFACES[interface_id].capture_boost = capture_boost;
+				//globals.CELLIAX_INTERFACES[interface_id].playback_boost = playback_boost;
 				globals.CELLIAX_INTERFACES[interface_id].running = running; //FIXME
 
 				celliax_store_boost("5", &globals.CELLIAX_INTERFACES[interface_id].capture_boost); //FIXME
@@ -1700,1139 +1682,7 @@
 
 	return SWITCH_STATUS_SUCCESS;
 }
-#ifdef NOTDEF
-				} else if (!strcasecmp(var, "context")) {
-					context = val;
-				} else if (!strcasecmp(var, "dialplan")) {
-					dialplan = val;
-				} else if (!strcasecmp(var, "destination")) {
-					destination = val;
-				} else if (!strcasecmp(var, "dial-regex")) {
-					dial_regex = val;
-				} else if (!strcasecmp(var, "enable-callerid")) {
-					enable_callerid = val;
-				} else if (!strcasecmp(var, "fail-dial-regex")) {
-					fail_dial_regex = val;
-				} else if (!strcasecmp(var, "hold-music")) {
-					hold_music = val;
-				} else if (!strcasecmp(var, "max_digits") || !strcasecmp(var, "max-digits")) {
-					max_digits = val;
-				} else if (!strcasecmp(var, "hotline")) {
-					hotline = val;
 
-
-			id 
-			name 
-			context 
-			dialplan 
-			destination 
-			controldevice_name 
-			digit_timeout 
-			max_digits 
-			hotline 
-			dial_regex 
-			hold_music 
-			fail_dial_regex 
-			enable_callerid 
-
-
-			at_dial_pre_number
-			at_dial_post_number
-			at_dial_expect
-			at_hangup
-			at_hangup_expect
-			at_answer
-			at_answer_expect
-			at_send_dtmf
-			at_preinit_1
-			at_preinit_1_expect
-			at_preinit_2
-			at_preinit_2_expect
-			at_preinit_3
-			at_preinit_3_expect
-			at_preinit_4
-			at_preinit_4_expect
-			at_preinit_5
-			at_preinit_5_expect
-			at_postinit_1
-			at_postinit_1_expect
-			at_postinit_2
-			at_postinit_2_expect
-			at_postinit_3
-			at_postinit_3_expect
-			at_postinit_4
-			at_postinit_4_expect
-			at_postinit_5
-			at_postinit_5_expect
-			at_query_battchg
-			at_query_battchg_expect
-			at_query_signal
-			at_query_signal_expect
-			at_call_idle
-			at_call_incoming
-			at_call_active
-			at_call_failed
-			at_call_calling
-			at_indicator_noservice_string
-			at_indicator_nosignal_string
-			at_indicator_lowsignal_string
-			at_indicator_lowbattchg_string
-			at_indicator_nobattchg_string
-			at_indicator_callactive_string
-			at_indicator_nocallactive_string
-			at_indicator_nocallsetup_string
-			at_indicator_callsetupincoming_string
-			at_indicator_callsetupoutgoing_string
-			at_indicator_callsetupremoteringing_string
-			sms_receiving_program
-			alsacname
-			alsapname
-
-			interface_id 
-			controldevice_speed 
-			controldevprotocol 
-			at_early_audio 
-			at_after_preinit_pause
-			at_initial_pause
-			at_has_clcc
-			at_has_ecam
-			alsa_period_size
-			alsa_periods_in_buffer
-			celliax_sound_rate
-			alsa_play_is_mono
-			alsa_capture_is_mono
-			capture_boost
-			playback_boost
-
-
-#endif //NOTDEF
-
-
-#ifdef NEW_OLD
-static switch_status_t load_config(int reload_type)
-/* END: Changes heres */
-{
-	char *cf = "celliax.conf";
-	switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface;
-	private_t *tech_pvt = NULL;
-
-	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, celliax_module_pool);
-	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
-		ERRORA("open of %s failed\n", CELLIAX_P_LOG, cf);
-		running = 0;
-		switch_xml_free(xml);
-		return SWITCH_STATUS_TERM;
-	}
-
-	switch_mutex_lock(globals.mutex);
-	if ((global_settings = switch_xml_child(cfg, "global_settings"))) {
-		for (param = switch_xml_child(global_settings, "param"); param; param = param->next) {
-			char *var = (char *) switch_xml_attr_soft(param, "name");
-			char *val = (char *) switch_xml_attr_soft(param, "value");
-
-			if (!strcasecmp(var, "debug")) {
-				DEBUGA_CELLIAX("globals.debug=%d\n", CELLIAX_P_LOG, globals.debug);
-				globals.debug = atoi(val);
-				DEBUGA_CELLIAX("globals.debug=%d\n", CELLIAX_P_LOG, globals.debug);
-			} else if (!strcasecmp(var, "hold-music")) {
-				switch_set_string(globals.hold_music, val);
-				DEBUGA_CELLIAX("globals.hold_music=%s\n", CELLIAX_P_LOG, globals.hold_music);
-			} else if (!strcmp(var, "dialplan")) {
-				set_global_dialplan(val);
-				DEBUGA_CELLIAX("globals.dialplan=%s\n", CELLIAX_P_LOG, globals.dialplan);
-			} else if (!strcmp(var, "destination")) {
-				set_global_destination(val);
-				DEBUGA_CELLIAX("globals.destination=%s\n", CELLIAX_P_LOG, globals.destination);
-			} else if (!strcmp(var, "context")) {
-				set_global_context(val);
-				DEBUGA_CELLIAX("globals.context=%s\n", CELLIAX_P_LOG, globals.context);
-
-			}
-
-		}
-	}
-
-	if ((interfaces = switch_xml_child(cfg, "per_interface_settings"))) {
-		int i = 0;
-
-		for (myinterface = switch_xml_child(interfaces, "interface"); myinterface; myinterface = myinterface->next) {
-			char *id = (char *) switch_xml_attr(myinterface, "id");
-			char *name = (char *) switch_xml_attr(myinterface, "name");
-			char *context = "default";
-			char *dialplan = "XML";
-			char *destination = "5000";
-			char *controldevice_name = "/dev/ttyACM0";
-			char *digit_timeout = NULL;
-			char *max_digits = NULL;
-			char *hotline = NULL;
-			char *dial_regex = NULL;
-			char *hold_music = NULL;
-			char *fail_dial_regex = NULL;
-			char *enable_callerid = "true";
-
-
-			char *at_dial_pre_number= "ATD";
-			char *at_dial_post_number= ";";
-			char *at_dial_expect= "OK";
-			char *at_hangup= "ATH";
-			char *at_hangup_expect= "OK";
-			char *at_answer= "ATA";
-			char *at_answer_expect= "OK";
-			char *at_send_dtmf= "AT+VTS";
-			char *at_preinit_1= "";
-			char *at_preinit_1_expect= "";
-			char *at_preinit_2= "";
-			char *at_preinit_2_expect= "";
-			char *at_preinit_3= "";
-			char *at_preinit_3_expect= "";
-			char *at_preinit_4= "";
-			char *at_preinit_4_expect= "";
-			char *at_preinit_5= "";
-			char *at_preinit_5_expect= "";
-			char *at_postinit_1= "at+cmic=0,9";
-			char *at_postinit_1_expect= "OK";
-			char *at_postinit_2= "AT+CKPD=\"EEE\"";
-			char *at_postinit_2_expect= "OK";
-			char *at_postinit_3= "AT+CSSN=1,0";
-			char *at_postinit_3_expect= "OK";
-			char *at_postinit_4= "at+sidet=0";
-			char *at_postinit_4_expect= "OK";
-			char *at_postinit_5= "at+clvl=99";
-			char *at_postinit_5_expect= "OK";
-			char *at_query_battchg= "AT+CBC";
-			char *at_query_battchg_expect= "OK";
-			char *at_query_signal= "AT+CSQ";
-			char *at_query_signal_expect= "OK";
-			char *at_call_idle= "+MCST: 1";
-			char *at_call_incoming= "+MCST: 2";
-			char *at_call_active= "+CSSI: 7";
-			char *at_call_failed= "+MCST: 65";
-			char *at_call_calling= "+CSSI: 1";
-			char *at_indicator_noservice_string= "CIEV: 2;0";
-			char *at_indicator_nosignal_string= "CIEV: 5;0";
-			char *at_indicator_lowsignal_string= "CIEV: 5;1";
-			char *at_indicator_lowbattchg_string= "CIEV: 0;1";
-			char *at_indicator_nobattchg_string= "CIEV: 0;0";
-			char *at_indicator_callactive_string= "CIEV: 3;1";
-			char *at_indicator_nocallactive_string= "CIEV: 3;0";
-			char *at_indicator_nocallsetup_string= "CIEV: 6;0";
-			char *at_indicator_callsetupincoming_string= "CIEV: 6;1";
-			char *at_indicator_callsetupoutgoing_string= "CIEV: 6;2";
-			char *at_indicator_callsetupremoteringing_string= "CIEV: 6;3";
-			char *sms_receiving_program= "/usr/local/bin/ciapalo";
-			char *alsacname= "plughw:1";
-			char *alsapname= "plughw:1";
-
-			uint32_t interface_id = 0, to = 0, max = 0;
-			uint32_t controldevice_speed = B115200;
-			uint32_t controldevprotocol = PROTOCOL_AT;
-#ifdef NOT_NUMBERS_NOW
-			uint32_t running =1;
-			uint32_t at_early_audio =0;
-			uint32_t at_after_preinit_pause=500000;
-			uint32_t at_initial_pause=500000;
-			uint32_t at_has_clcc=0;
-			uint32_t at_has_ecam=0;
-			uint32_t alsa_period_size=160;
-			uint32_t alsa_periods_in_buffer=4;
-			uint32_t celliax_sound_rate=8000;
-			uint32_t alsa_play_is_mono=1;
-			uint32_t alsa_capture_is_mono=1;
-			uint32_t capture_boost=5;
-			uint32_t playback_boost=10;
-#endif// NOT_NUMBERS_NOW
-
-
-			tech_pvt = NULL;
-
-			for (param = switch_xml_child(myinterface, "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, "id")) {
-					id = val;
-				} else if (!strcasecmp(var, "name")) {
-					name = val;
-				} else if (!strcasecmp(var, "context")) {
-					context = val;
-				} else if (!strcasecmp(var, "dialplan")) {
-					dialplan = val;
-				} else if (!strcasecmp(var, "destination")) {
-					destination = val;
-				} else if (!strcasecmp(var, "controldevice_name")) {
-					controldevice_name = val;
-				} else if (!strcasecmp(var, "digit_timeout")) {
-					digit_timeout = val;
-				} else if (!strcasecmp(var, "max_digits")) {
-					max_digits = val;
-				} else if (!strcasecmp(var, "hotline")) {
-					hotline = val;
-				} else if (!strcasecmp(var, "dial_regex")) {
-					dial_regex = val;
-				} else if (!strcasecmp(var, "hold_music")) {
-					hold_music = val;
-				} else if (!strcasecmp(var, "fail_dial_regex")) {
-					fail_dial_regex = val;
-				} else if (!strcasecmp(var, "enable_callerid")) {
-					enable_callerid = val;
-				} else if (!strcasecmp(var, "at_dial_pre_number")) {
-					at_dial_pre_number = val;
-				} else if (!strcasecmp(var, "at_dial_post_number")) {
-					at_dial_post_number = val;
-				} else if (!strcasecmp(var, "at_dial_expect")) {
-					at_dial_expect = val;
-				} else if (!strcasecmp(var, "at_hangup")) {
-					at_hangup = val;
-				} else if (!strcasecmp(var, "at_hangup_expect")) {
-					at_hangup_expect = val;
-				} else if (!strcasecmp(var, "at_answer")) {
-					at_answer = val;
-				} else if (!strcasecmp(var, "at_answer_expect")) {
-					at_answer_expect = val;
-				} else if (!strcasecmp(var, "at_send_dtmf")) {
-					at_send_dtmf = val;
-				} else if (!strcasecmp(var, "at_preinit_1")) {
-					at_preinit_1 = val;
-				} else if (!strcasecmp(var, "at_preinit_1_expect")) {
-					at_preinit_1_expect = val;
-				} else if (!strcasecmp(var, "at_preinit_2")) {
-					at_preinit_2 = val;
-				} else if (!strcasecmp(var, "at_preinit_2_expect")) {
-					at_preinit_2_expect = val;
-				} else if (!strcasecmp(var, "at_preinit_3")) {
-					at_preinit_3 = val;
-				} else if (!strcasecmp(var, "at_preinit_3_expect")) {
-					at_preinit_3_expect = val;
-				} else if (!strcasecmp(var, "at_preinit_4")) {
-					at_preinit_4 = val;
-				} else if (!strcasecmp(var, "at_preinit_4_expect")) {
-					at_preinit_4_expect = val;
-				} else if (!strcasecmp(var, "at_preinit_5")) {
-					at_preinit_5 = val;
-				} else if (!strcasecmp(var, "at_preinit_5_expect")) {
-					at_preinit_5_expect = val;
-				} else if (!strcasecmp(var, "at_postinit_1")) {
-					at_postinit_1 = val;
-				} else if (!strcasecmp(var, "at_postinit_1_expect")) {
-					at_postinit_1_expect = val;
-				} else if (!strcasecmp(var, "at_postinit_2")) {
-					at_postinit_2 = val;
-				} else if (!strcasecmp(var, "at_postinit_2_expect")) {
-					at_postinit_2_expect = val;
-				} else if (!strcasecmp(var, "at_postinit_3")) {
-					at_postinit_3 = val;
-				} else if (!strcasecmp(var, "at_postinit_3_expect")) {
-					at_postinit_3_expect = val;
-				} else if (!strcasecmp(var, "at_postinit_4")) {
-					at_postinit_4 = val;
-				} else if (!strcasecmp(var, "at_postinit_4_expect")) {
-					at_postinit_4_expect = val;
-				} else if (!strcasecmp(var, "at_postinit_5")) {
-					at_postinit_5 = val;
-				} else if (!strcasecmp(var, "at_postinit_5_expect")) {
-					at_postinit_5_expect = val;
-				} else if (!strcasecmp(var, "at_query_battchg")) {
-					at_query_battchg = val;
-				} else if (!strcasecmp(var, "at_query_battchg_expect")) {
-					at_query_battchg_expect = val;
-				} else if (!strcasecmp(var, "at_query_signal")) {
-					at_query_signal = val;
-				} else if (!strcasecmp(var, "at_query_signal_expect")) {
-					at_query_signal_expect = val;
-				} else if (!strcasecmp(var, "at_call_idle")) {
-					at_call_idle = val;
-				} else if (!strcasecmp(var, "at_call_incoming")) {
-					at_call_incoming = val;
-				} else if (!strcasecmp(var, "at_call_active")) {
-					at_call_active = val;
-				} else if (!strcasecmp(var, "at_call_failed")) {
-					at_call_failed = val;
-				} else if (!strcasecmp(var, "at_call_calling")) {
-					at_call_calling = val;
-				} else if (!strcasecmp(var, "at_indicator_noservice_string")) {
-					at_indicator_noservice_string = val;
-				} else if (!strcasecmp(var, "at_indicator_nosignal_string")) {
-					at_indicator_nosignal_string = val;
-				} else if (!strcasecmp(var, "at_indicator_lowsignal_string")) {
-					at_indicator_lowsignal_string = val;
-				} else if (!strcasecmp(var, "at_indicator_lowbattchg_string")) {
-					at_indicator_lowbattchg_string = val;
-				} else if (!strcasecmp(var, "at_indicator_nobattchg_string")) {
-					at_indicator_nobattchg_string = val;
-				} else if (!strcasecmp(var, "at_indicator_callactive_string")) {
-					at_indicator_callactive_string = val;
-				} else if (!strcasecmp(var, "at_indicator_nocallactive_string")) {
-					at_indicator_nocallactive_string = val;
-				} else if (!strcasecmp(var, "at_indicator_nocallsetup_string")) {
-					at_indicator_nocallsetup_string = val;
-				} else if (!strcasecmp(var, "at_indicator_callsetupincoming_string")) {
-					at_indicator_callsetupincoming_string = val;
-				} else if (!strcasecmp(var, "at_indicator_callsetupoutgoing_string")) {
-					at_indicator_callsetupoutgoing_string = val;
-				} else if (!strcasecmp(var, "at_indicator_callsetupremoteringing_string")) {
-					at_indicator_callsetupremoteringing_string = val;
-				} else if (!strcasecmp(var, "sms_receiving_program")) {
-					sms_receiving_program = val;
-				} else if (!strcasecmp(var, "alsacname")) {
-					alsacname = val;
-				} else if (!strcasecmp(var, "alsapname")) {
-					alsapname = val;
-
-#ifdef NOT_NUMBERS_NOW
-					interface_id 
-						controldevice_speed 
-						controldevprotocol 
-						at_early_audio 
-						at_after_preinit_pause
-						at_initial_pause
-						at_has_clcc
-						at_has_ecam
-						alsa_period_size
-						alsa_periods_in_buffer
-						celliax_sound_rate
-						alsa_play_is_mono
-						alsa_capture_is_mono
-						capture_boost
-						playback_boost
-#endif// NOT_NUMBERS_NOW
-
-
-				}
-
-			}
-
-			/* BEGIN: Changes here */
-			if (reload_type == SOFT_RELOAD) {
-				char the_interface[256];
-				sprintf(the_interface, "#%s", name);
-
-				if (interface_exists(the_interface) == SWITCH_STATUS_SUCCESS) {
-					continue;
-				}
-			}
-			/* END: Changes here */
-
-			if (!id) {
-				ERRORA("interface missing REQUIRED param 'id'\n", CELLIAX_P_LOG);
-				continue;
-			}
-			if (switch_is_number(id)) {
-				interface_id = atoi(id);
-				DEBUGA_CELLIAX("interface_id=%d\n", CELLIAX_P_LOG, interface_id);
-			} else {
-				ERRORA("interface param 'id' MUST be a number, now id='%s'\n", CELLIAX_P_LOG, id);
-				continue;
-			}
-
-			if (!name) {
-				WARNINGA("interface missing param 'name', not nice, but works\n", CELLIAX_P_LOG);
-			}
-
-			if (!controldevice_name) {
-				controldevice_name = "/dev/ttyACM0";
-			}
-
-			if (digit_timeout) {
-				to = atoi(digit_timeout);
-			}
-
-			if (max_digits) {
-				max = atoi(max_digits);
-			}
-
-			if (name) {
-				DEBUGA_CELLIAX("name=%s\n", CELLIAX_P_LOG, name);
-			}
-			if (interface_id && interface_id < CELLIAX_MAX_INTERFACES) {
-				private_t newconf;
-				switch_threadattr_t *celliax_api_thread_attr = NULL;
-
-				memset(&newconf, '\0', sizeof(newconf));
-				globals.CELLIAX_INTERFACES[interface_id] = newconf;
-
-
-				tech_pvt = &globals.CELLIAX_INTERFACES[interface_id];
-
-				if (name) {
-					switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, name);
-				} else {
-					switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, "N/A");
-				}
-				DEBUGA_CELLIAX("CONFIGURING interface_id=%d name=%s\n", CELLIAX_P_LOG, interface_id, name);
-
-				switch_mutex_init(&globals.CELLIAX_INTERFACES[interface_id].controldev_lock, SWITCH_MUTEX_NESTED, celliax_module_pool);
-
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].interface_id, id);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].context, context);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].dialplan, dialplan);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].destination, destination);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].controldevice_name, controldevice_name);
-
-				globals.CELLIAX_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
-				globals.CELLIAX_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
-				globals.CELLIAX_INTERFACES[interface_id].running = 1;
-				globals.CELLIAX_INTERFACES[interface_id].at_early_audio = 0;
-				globals.CELLIAX_INTERFACES[interface_id].at_after_preinit_pause = 500000;
-				globals.CELLIAX_INTERFACES[interface_id].at_initial_pause = 500000;
-				globals.CELLIAX_INTERFACES[interface_id].at_has_clcc = 0;
-				globals.CELLIAX_INTERFACES[interface_id].at_has_ecam = 0;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_period_size = 160;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_periods_in_buffer = 4;
-				globals.CELLIAX_INTERFACES[interface_id].celliax_sound_rate = 8000;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_play_is_mono = 1;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_capture_is_mono = 1;
-				globals.CELLIAX_INTERFACES[interface_id].capture_boost = 0;
-				globals.CELLIAX_INTERFACES[interface_id].playback_boost = 0;
-
-
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_pre_number, "ATD");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_post_number, ";");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup, "ATH");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer, "ATA");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_send_dtmf, "AT+VTS");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1, "at+cmic=0,9");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2, "AT+CKPD=\"EEE\"");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3, "AT+CSSN=1,0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4, "at+sidet=0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5, "at+clvl=99");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg, "AT+CBC");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal, "AT+CSQ");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_idle, "+MCST: 1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_incoming, "+MCST: 2");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_active, "+CSSI: 7");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_failed, "+MCST: 65");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_calling, "+CSSI: 1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_noservice_string, "CIEV: 2;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nosignal_string, "CIEV: 5;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowsignal_string, "CIEV: 5;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowbattchg_string, "CIEV: 0;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nobattchg_string, "CIEV: 0;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callactive_string, "CIEV: 3;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallactive_string, "CIEV: 3;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallsetup_string, "CIEV: 6;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupincoming_string, "CIEV: 6;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupoutgoing_string, "CIEV: 6;2");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string, "CIEV: 6;3");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].sms_receiving_program, "/usr/local/bin/ciapalo");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsacname, "plughw:1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsapname, "plughw:1");
-
-				celliax_store_boost("5", &globals.CELLIAX_INTERFACES[interface_id].capture_boost); //FIXME
-				celliax_store_boost("10", &globals.CELLIAX_INTERFACES[interface_id].playback_boost); //FIXME
-
-
-				DEBUGA_CELLIAX("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].name=%s\n",
-						CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].name);
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].dialplan=%s\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].dialplan);
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].destination=%s\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].destination);
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].context=%s\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].context);
-				WARNINGA("STARTING interface_id=%d\n", CELLIAX_P_LOG, interface_id);
-
-				int res = 0;
-
-				/* init the serial port */
-				if (globals.CELLIAX_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
-					globals.CELLIAX_INTERFACES[interface_id].controldevfd =
-						celliax_serial_init(&globals.CELLIAX_INTERFACES[interface_id], globals.CELLIAX_INTERFACES[interface_id].controldevice_speed);
-					if (globals.CELLIAX_INTERFACES[interface_id].controldevfd < 1) {
-						ERRORA("celliax_serial_init failed\n", CELLIAX_P_LOG);
-						return SWITCH_STATUS_FALSE;
-						//celliax_sound_shutdown(tmp);
-						//if (tmp)
-						//free(tmp);
-						//return NULL;
-					}
-				}
-
-				/* config the phone/modem on the serial port */
-				if (globals.CELLIAX_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
-					//int res;
-					res = celliax_serial_config(&globals.CELLIAX_INTERFACES[interface_id]);
-					if (res) {
-						ERRORA("celliax_serial_config failed\n", CELLIAX_P_LOG);
-						return SWITCH_STATUS_FALSE;
-						//celliax_sound_shutdown(tmp);
-						//if (tmp)
-						//free(tmp);
-						//return NULL;
-					}
-				}
-
-
-				switch_sleep(100000);
-				switch_threadattr_create(&celliax_api_thread_attr, celliax_module_pool);
-				switch_threadattr_stacksize_set(celliax_api_thread_attr, SWITCH_THREAD_STACKSIZE);
-				switch_thread_create(&globals.CELLIAX_INTERFACES[interface_id].celliax_api_thread, celliax_api_thread_attr, celliax_do_celliaxapi_thread,
-						&globals.CELLIAX_INTERFACES[interface_id], celliax_module_pool);
-
-				switch_sleep(100000);
-
-			} else {
-				ERRORA("interface id %d is higher than CELLIAX_MAX_INTERFACES (%d)\n", CELLIAX_P_LOG, interface_id, CELLIAX_MAX_INTERFACES);
-				continue;
-			}
-
-		}
-
-		for (i = 0; i < CELLIAX_MAX_INTERFACES; i++) {
-			if (strlen(globals.CELLIAX_INTERFACES[i].name)) {
-				/* How many real intterfaces */
-				globals.real_interfaces = i + 1;
-
-				tech_pvt = &globals.CELLIAX_INTERFACES[i];
-
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].interface_id=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].interface_id);
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].name=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].name);
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].context=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].context);
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].dialplan=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].dialplan);
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].destination=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].destination);
-			}
-		}
-	}
-
-	switch_mutex_unlock(globals.mutex);
-	switch_xml_free(xml);
-
-	return SWITCH_STATUS_SUCCESS;
-}
-#endif// NEW_OLD
-#ifdef NOTDEF
-				} else if (!strcasecmp(var, "context")) {
-					context = val;
-				} else if (!strcasecmp(var, "dialplan")) {
-					dialplan = val;
-				} else if (!strcasecmp(var, "destination")) {
-					destination = val;
-				} else if (!strcasecmp(var, "dial-regex")) {
-					dial_regex = val;
-				} else if (!strcasecmp(var, "enable-callerid")) {
-					enable_callerid = val;
-				} else if (!strcasecmp(var, "fail-dial-regex")) {
-					fail_dial_regex = val;
-				} else if (!strcasecmp(var, "hold-music")) {
-					hold_music = val;
-				} else if (!strcasecmp(var, "max_digits") || !strcasecmp(var, "max-digits")) {
-					max_digits = val;
-				} else if (!strcasecmp(var, "hotline")) {
-					hotline = val;
-
-
-			id 
-			name 
-			context 
-			dialplan 
-			destination 
-			controldevice_name 
-			digit_timeout 
-			max_digits 
-			hotline 
-			dial_regex 
-			hold_music 
-			fail_dial_regex 
-			enable_callerid 
-
-
-			at_dial_pre_number
-			at_dial_post_number
-			at_dial_expect
-			at_hangup
-			at_hangup_expect
-			at_answer
-			at_answer_expect
-			at_send_dtmf
-			at_preinit_1
-			at_preinit_1_expect
-			at_preinit_2
-			at_preinit_2_expect
-			at_preinit_3
-			at_preinit_3_expect
-			at_preinit_4
-			at_preinit_4_expect
-			at_preinit_5
-			at_preinit_5_expect
-			at_postinit_1
-			at_postinit_1_expect
-			at_postinit_2
-			at_postinit_2_expect
-			at_postinit_3
-			at_postinit_3_expect
-			at_postinit_4
-			at_postinit_4_expect
-			at_postinit_5
-			at_postinit_5_expect
-			at_query_battchg
-			at_query_battchg_expect
-			at_query_signal
-			at_query_signal_expect
-			at_call_idle
-			at_call_incoming
-			at_call_active
-			at_call_failed
-			at_call_calling
-			at_indicator_noservice_string
-			at_indicator_nosignal_string
-			at_indicator_lowsignal_string
-			at_indicator_lowbattchg_string
-			at_indicator_nobattchg_string
-			at_indicator_callactive_string
-			at_indicator_nocallactive_string
-			at_indicator_nocallsetup_string
-			at_indicator_callsetupincoming_string
-			at_indicator_callsetupoutgoing_string
-			at_indicator_callsetupremoteringing_string
-			sms_receiving_program
-			alsacname
-			alsapname
-
-			interface_id 
-			controldevice_speed 
-			controldevprotocol 
-			at_early_audio 
-			at_after_preinit_pause
-			at_initial_pause
-			at_has_clcc
-			at_has_ecam
-			alsa_period_size
-			alsa_periods_in_buffer
-			celliax_sound_rate
-			alsa_play_is_mono
-			alsa_capture_is_mono
-			capture_boost
-			playback_boost
-
-
-#endif //NOTDEF
-
-#ifdef WANT_OLD
-static switch_status_t load_config(int reload_type)
-/* END: Changes heres */
-{
-	char *cf = "celliax.conf";
-	switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface;
-	private_t *tech_pvt = NULL;
-
-	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, celliax_module_pool);
-	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
-		ERRORA("open of %s failed\n", CELLIAX_P_LOG, cf);
-		running = 0;
-		switch_xml_free(xml);
-		return SWITCH_STATUS_TERM;
-	}
-
-	switch_mutex_lock(globals.mutex);
-	if ((global_settings = switch_xml_child(cfg, "global_settings"))) {
-		for (param = switch_xml_child(global_settings, "param"); param; param = param->next) {
-			char *var = (char *) switch_xml_attr_soft(param, "name");
-			char *val = (char *) switch_xml_attr_soft(param, "value");
-
-			if (!strcasecmp(var, "debug")) {
-				DEBUGA_CELLIAX("globals.debug=%d\n", CELLIAX_P_LOG, globals.debug);
-				globals.debug = atoi(val);
-				DEBUGA_CELLIAX("globals.debug=%d\n", CELLIAX_P_LOG, globals.debug);
-			} else if (!strcasecmp(var, "hold-music")) {
-				switch_set_string(globals.hold_music, val);
-				DEBUGA_CELLIAX("globals.hold_music=%s\n", CELLIAX_P_LOG, globals.hold_music);
-			} else if (!strcmp(var, "dialplan")) {
-				set_global_dialplan(val);
-				DEBUGA_CELLIAX("globals.dialplan=%s\n", CELLIAX_P_LOG, globals.dialplan);
-			} else if (!strcmp(var, "destination")) {
-				set_global_destination(val);
-				DEBUGA_CELLIAX("globals.destination=%s\n", CELLIAX_P_LOG, globals.destination);
-			} else if (!strcmp(var, "context")) {
-				set_global_context(val);
-				DEBUGA_CELLIAX("globals.context=%s\n", CELLIAX_P_LOG, globals.context);
-
-/*
-			} else if (!strcmp(var, "port")) {
-				globals.port = atoi(val);
-				DEBUGA_CELLIAX("globals.port=%d\n", CELLIAX_P_LOG, globals.port);
-			} else if (!strcmp(var, "codec-master")) {
-				if (!strcasecmp(val, "us")) {
-					switch_set_flag(&globals, GFLAG_MY_CODEC_PREFS);
-				}
-				DEBUGA_CELLIAX("codec-master globals.debug=%d\n", CELLIAX_P_LOG, globals.debug);
-			} else if (!strcmp(var, "codec-prefs")) {
-				set_global_codec_string(val);
-				DEBUGA_CELLIAX("globals.codec_string=%s\n", CELLIAX_P_LOG, globals.codec_string);
-				globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
-			} else if (!strcmp(var, "codec-rates")) {
-				set_global_codec_rates_string(val);
-				DEBUGA_CELLIAX("globals.codec_rates_string=%s\n", CELLIAX_P_LOG, globals.codec_rates_string);
-				globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
-*/
-			}
-
-		}
-	}
-
-	if ((interfaces = switch_xml_child(cfg, "per_interface_settings"))) {
-		int i = 0;
-
-		for (myinterface = switch_xml_child(interfaces, "interface"); myinterface; myinterface = myinterface->next) {
-			char *id = (char *) switch_xml_attr(myinterface, "id");
-			char *name = (char *) switch_xml_attr(myinterface, "name");
-			char *context = "default";
-			char *dialplan = "XML";
-			char *destination = "5000";
-			char *controldevice_name = "/dev/ttyACM0";
-			char *digit_timeout = NULL;
-			char *max_digits = NULL;
-			char *hotline = NULL;
-			char *dial_regex = NULL;
-			char *hold_music = NULL;
-			char *fail_dial_regex = NULL;
-			char *enable_callerid = "true";
-			//char *X11_display = NULL;
-			//char *tcp_cli_port = NULL;
-			//char *tcp_srv_port = NULL;
-			//char *celliax_user = NULL;
-
-			uint32_t interface_id = 0, to = 0, max = 0;
-			uint32_t controldevice_speed = B115200;
-			int controldevprotocol = PROTOCOL_AT;
-
-			tech_pvt = NULL;
-
-			for (param = switch_xml_child(myinterface, "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, "controldevice_name")) {
-					controldevice_name = val;
-				} else if (!strcasecmp(var, "digit_timeout") || !strcasecmp(var, "digit-timeout")) {
-					digit_timeout = val;
-				} else if (!strcasecmp(var, "context")) {
-					context = val;
-				} else if (!strcasecmp(var, "dialplan")) {
-					dialplan = val;
-				} else if (!strcasecmp(var, "destination")) {
-					destination = val;
-				} else if (!strcasecmp(var, "dial-regex")) {
-					dial_regex = val;
-				} else if (!strcasecmp(var, "enable-callerid")) {
-					enable_callerid = val;
-				} else if (!strcasecmp(var, "fail-dial-regex")) {
-					fail_dial_regex = val;
-				} else if (!strcasecmp(var, "hold-music")) {
-					hold_music = val;
-/*
-				} else if (!strcasecmp(var, "celliax_user")) {
-					celliax_user = val;
-				} else if (!strcasecmp(var, "tcp_cli_port")) {
-					tcp_cli_port = val;
-				} else if (!strcasecmp(var, "tcp_srv_port")) {
-					tcp_srv_port = val;
-				} else if (!strcasecmp(var, "X11-display") || !strcasecmp(var, "X11_display")) {
-					X11_display = val;
-*/
-				} else if (!strcasecmp(var, "max_digits") || !strcasecmp(var, "max-digits")) {
-					max_digits = val;
-				} else if (!strcasecmp(var, "hotline")) {
-					hotline = val;
-				}
-
-			}
-/*
-			if (!celliax_user) {
-				ERRORA("interface missing REQUIRED param 'celliax_user'\n", CELLIAX_P_LOG);
-				continue;
-			}
-*/
-
-			/* BEGIN: Changes here */
-			if (reload_type == SOFT_RELOAD) {
-				char the_interface[256];
-				sprintf(the_interface, "#%s", name);
-
-				if (interface_exists(the_interface) == SWITCH_STATUS_SUCCESS) {
-					continue;
-				}
-			}
-			/* END: Changes here */
-
-/*
-			if (!X11_display) {
-				ERRORA("interface missing REQUIRED param 'X11_display'\n", CELLIAX_P_LOG);
-				continue;
-			}
-			if (!tcp_cli_port) {
-				ERRORA("interface missing REQUIRED param 'tcp_cli_port'\n", CELLIAX_P_LOG);
-				continue;
-			}
-
-			if (!tcp_srv_port) {
-				ERRORA("interface missing REQUIRED param 'tcp_srv_port'\n", CELLIAX_P_LOG);
-				continue;
-			}
-*/
-			if (!id) {
-				ERRORA("interface missing REQUIRED param 'id'\n", CELLIAX_P_LOG);
-				continue;
-			}
-			if (switch_is_number(id)) {
-				interface_id = atoi(id);
-				DEBUGA_CELLIAX("interface_id=%d\n", CELLIAX_P_LOG, interface_id);
-			} else {
-				ERRORA("interface param 'id' MUST be a number, now id='%s'\n", CELLIAX_P_LOG, id);
-				continue;
-			}
-
-			if (!name) {
-				WARNINGA("interface missing param 'name', not nice, but works\n", CELLIAX_P_LOG);
-			}
-
-			if (!controldevice_name) {
-				controldevice_name = "/dev/ttyACM0";
-			}
-
-			if (digit_timeout) {
-				to = atoi(digit_timeout);
-			}
-
-			if (max_digits) {
-				max = atoi(max_digits);
-			}
-
-			if (name) {
-				DEBUGA_CELLIAX("name=%s\n", CELLIAX_P_LOG, name);
-			}
-			if (interface_id && interface_id < CELLIAX_MAX_INTERFACES) {
-				private_t newconf;
-				switch_threadattr_t *celliax_api_thread_attr = NULL;
-				//switch_threadattr_t *celliax_signaling_thread_attr = NULL;
-
-				memset(&newconf, '\0', sizeof(newconf));
-				globals.CELLIAX_INTERFACES[interface_id] = newconf;
-				globals.CELLIAX_INTERFACES[interface_id].running = 1;
-
-
-				tech_pvt = &globals.CELLIAX_INTERFACES[interface_id];
-
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].interface_id, id);
-				if (name) {
-					switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, name);
-				} else {
-					switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, "N/A");
-				}
-				DEBUGA_CELLIAX("CONFIGURING interface_id=%d\n", CELLIAX_P_LOG, interface_id);
-#if 0
-#ifdef WIN32
-				globals.CELLIAX_INTERFACES[interface_id].tcp_cli_port = (unsigned short) atoi(tcp_cli_port);
-				globals.CELLIAX_INTERFACES[interface_id].tcp_srv_port = (unsigned short) atoi(tcp_srv_port);
-#else /* WIN32 */
-				globals.CELLIAX_INTERFACES[interface_id].tcp_cli_port = atoi(tcp_cli_port);
-				globals.CELLIAX_INTERFACES[interface_id].tcp_srv_port = atoi(tcp_srv_port);
-#endif /* WIN32 */
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].X11_display, X11_display);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].celliax_user, celliax_user);
-#endif //0
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].context, context);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].dialplan, dialplan);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].destination, destination);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].context, context);
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].controldevice_name, controldevice_name);
-				globals.CELLIAX_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
-				globals.CELLIAX_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
-
-
-				switch_mutex_init(&globals.CELLIAX_INTERFACES[interface_id].controldev_lock, SWITCH_MUTEX_NESTED, celliax_module_pool);
-/*********************/
-				//at_dial_pre_number = "AT+CKPD=\"";
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_pre_number, "ATD");
-				//.at_dial_post_number = "S\"";
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_post_number, ";");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_expect, "OK");
-				globals.CELLIAX_INTERFACES[interface_id].at_early_audio = 0;
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup, "ATH");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer, "ATA");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_send_dtmf, "AT+VTS");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4_expect, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5, "");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5_expect, "");
-				globals.CELLIAX_INTERFACES[interface_id].at_after_preinit_pause = 500000;
-				globals.CELLIAX_INTERFACES[interface_id].at_initial_pause = 500000;
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1, "at+cmic=0,9");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2, "AT+CKPD=\"EEE\"");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3, "AT+CSSN=1,0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4, "at+sidet=0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5, "at+clvl=99");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg, "AT+CBC");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal, "AT+CSQ");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal_expect, "OK");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_idle, "+MCST: 1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_incoming, "+MCST: 2");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_active, "+CSSI: 7");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_failed, "+MCST: 65");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_calling, "+CSSI: 1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_noservice_string, "CIEV: 2;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nosignal_string, "CIEV: 5;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowsignal_string, "CIEV: 5;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowbattchg_string, "CIEV: 0;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nobattchg_string, "CIEV: 0;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callactive_string, "CIEV: 3;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallactive_string, "CIEV: 3;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallsetup_string, "CIEV: 6;0");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupincoming_string, "CIEV: 6;1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupoutgoing_string, "CIEV: 6;2");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string, "CIEV: 6;3");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].sms_receiving_program, "/usr/local/bin/ciapalo");
-				globals.CELLIAX_INTERFACES[interface_id].at_has_clcc = 0;
-				globals.CELLIAX_INTERFACES[interface_id].at_has_ecam = 0;
-
-				globals.CELLIAX_INTERFACES[interface_id].alsa_period_size = 160;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_periods_in_buffer = 4;
-				globals.CELLIAX_INTERFACES[interface_id].celliax_sound_rate = 8000;
-
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsacname, "plughw:1");
-				switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsapname, "plughw:1");
-
-
-				globals.CELLIAX_INTERFACES[interface_id].alsa_play_is_mono = 1;
-				globals.CELLIAX_INTERFACES[interface_id].alsa_capture_is_mono = 1;
-
-
-				globals.CELLIAX_INTERFACES[interface_id].capture_boost = 0;
-				globals.CELLIAX_INTERFACES[interface_id].playback_boost = 0;
-
-				celliax_store_boost("5", &globals.CELLIAX_INTERFACES[interface_id].capture_boost);
-				celliax_store_boost("10", &globals.CELLIAX_INTERFACES[interface_id].playback_boost);
-/*********************/
-/*
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].X11_display=%s\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].X11_display);
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].celliax_user=%s\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].celliax_user);
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].tcp_cli_port=%d\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].tcp_cli_port);
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].tcp_srv_port=%d\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].tcp_srv_port);
-*/
-				DEBUGA_CELLIAX("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].name=%s\n",
-							   CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].name);
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].dialplan=%s\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].dialplan);
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].destination=%s\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].destination);
-				DEBUGA_CELLIAX
-					("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].context=%s\n",
-					 CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].context);
-				WARNINGA("STARTING interface_id=%d\n", CELLIAX_P_LOG, interface_id);
-
-				int res = 0;
-
-				/* init the serial port */
-				if (globals.CELLIAX_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
-					globals.CELLIAX_INTERFACES[interface_id].controldevfd =
-						celliax_serial_init(&globals.CELLIAX_INTERFACES[interface_id], globals.CELLIAX_INTERFACES[interface_id].controldevice_speed);
-					if (globals.CELLIAX_INTERFACES[interface_id].controldevfd < 1) {
-						ERRORA("celliax_serial_init failed\n", CELLIAX_P_LOG);
-						return SWITCH_STATUS_FALSE;
-						//celliax_sound_shutdown(tmp);
-						//if (tmp)
-						//free(tmp);
-						//return NULL;
-					}
-				}
-
-				/* config the phone/modem on the serial port */
-				if (globals.CELLIAX_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
-					//int res;
-					res = celliax_serial_config(&globals.CELLIAX_INTERFACES[interface_id]);
-					if (res) {
-						ERRORA("celliax_serial_config failed\n", CELLIAX_P_LOG);
-						return SWITCH_STATUS_FALSE;
-						//celliax_sound_shutdown(tmp);
-						//if (tmp)
-						//free(tmp);
-						//return NULL;
-					}
-				}
-
-
-				switch_sleep(100000);
-				switch_threadattr_create(&celliax_api_thread_attr, celliax_module_pool);
-				switch_threadattr_stacksize_set(celliax_api_thread_attr, SWITCH_THREAD_STACKSIZE);
-				switch_thread_create(&globals.CELLIAX_INTERFACES[interface_id].celliax_api_thread, celliax_api_thread_attr, celliax_do_celliaxapi_thread,
-									 &globals.CELLIAX_INTERFACES[interface_id], celliax_module_pool);
-
-				switch_sleep(100000);
-
-			} else {
-				ERRORA("interface id %d is higher than CELLIAX_MAX_INTERFACES (%d)\n", CELLIAX_P_LOG, interface_id, CELLIAX_MAX_INTERFACES);
-				continue;
-			}
-
-		}
-
-		for (i = 0; i < CELLIAX_MAX_INTERFACES; i++) {
-			if (strlen(globals.CELLIAX_INTERFACES[i].name)) {
-				/* How many real intterfaces */
-				globals.real_interfaces = i + 1;
-
-				tech_pvt = &globals.CELLIAX_INTERFACES[i];
-
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].interface_id=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].interface_id);
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].name=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].name);
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].context=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].context);
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].dialplan=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].dialplan);
-				DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].destination=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].destination);
-			}
-		}
-	}
-
-	switch_mutex_unlock(globals.mutex);
-	switch_xml_free(xml);
-
-	return SWITCH_STATUS_SUCCESS;
-}
-#endif //WANT_OLD
 static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint)
 {
 	char *user, *host, *f_user = NULL, *f_host = NULL, *f_resource = NULL;