Revision
15258
Author
gmaruzz
Date
2009-10-28 06:16:50 -0500 (Wed, 28 Oct 2009)

Log Message

gsmopen: shut compiler warnings, allow the SMS sending in TEXT mode, while we change the code for receiving to PDU mode

Modified Paths

Diff

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp (15257 => 15258)


--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp	2009-10-27 22:04:44 UTC (rev 15257)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp	2009-10-28 11:16:50 UTC (rev 15258)
@@ -1,5 +1,5 @@
 #include "gsmopen.h"
-#include <iostream.h>
+//#include <iostream.h>
 #include <gsmlib/gsm_sms.h>
 
 using namespace std;
@@ -302,9 +302,9 @@
 	if (res) {
 		DEBUGA_GSMOPEN("AT+CMGF? failed, continue\n", GSMOPEN_P_LOG);
 	}
-	res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0");	//TODO: support phones that only accept pdu mode
+	res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=1");	//TODO: support phones that only accept pdu mode
 	if (res) {
-		ERRORA("Error setting SMS sending mode to TEXT on the cellphone\n", GSMOPEN_P_LOG);
+		ERRORA("Error setting SMS sending mode to PDU on the cellphone\n", GSMOPEN_P_LOG);
 		return RESULT_FAILURE;
 	}
 	/* what is the Charset of SMSs? */
@@ -2909,6 +2909,7 @@
 	//char *stringp = NULL;
 	//int found = 0;
 	int failed = 0;
+		int err = 0;
 
 	//strncpy(rdest, idest, sizeof(rdest) - 1);
 	DEBUGA_GSMOPEN("GSMopenSendsms: dest=%s text=%s\n", GSMOPEN_P_LOG, dest, text);
@@ -2923,13 +2924,18 @@
 	}
 
 	if (tech_pvt->controldevprotocol == PROTOCOL_AT) {
-		int err = 0;
 		char smscommand[16000];
 		memset(smscommand, '\0', sizeof(smscommand));
 
 		PUSHA_UNLOCKA(&tech_pvt->controldev_lock);
 		LOKKA(tech_pvt->controldev_lock);
 
+			err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=1");
+			if (err) {
+				ERRORA("AT+CMGF=1 (set message sending to TEXT (as opposed to PDU)  do not got OK from the phone\n", GSMOPEN_P_LOG);
+			}
+
+
 		if (tech_pvt->no_ucs2) {
 			sprintf(smscommand, "AT+CMGS=\"%s\"", dest);	//TODO: support phones that only accept pdu mode
 		} else {
@@ -3040,6 +3046,12 @@
 		POPPA_UNLOCKA(&tech_pvt->controldev_lock);
 	}
 
+			err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0");
+			if (err) {
+				ERRORA("AT+CMGF=1 (set message sending to PDU (as opposed to TEXT)  do not got OK from the phone\n", GSMOPEN_P_LOG);
+			}
+
+
 	DEBUGA_GSMOPEN("FINISH\n", GSMOPEN_P_LOG);
 	if (failed)
 		return -1;

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp (15257 => 15258)


--- freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp	2009-10-27 22:04:44 UTC (rev 15257)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp	2009-10-28 11:16:50 UTC (rev 15258)
@@ -101,7 +101,7 @@
 #define SOFT_RELOAD 1
 /* END: Changes heres */
 
-char *interface_status[] = {	/* should match GSMOPEN_STATE_xxx in gsmopen.h */
+const char *interface_status[] = {	/* should match GSMOPEN_STATE_xxx in gsmopen.h */
 	"IDLE",
 	"DOWN",
 	"RING",
@@ -115,7 +115,7 @@
 	"HANG_RQ",
 	"PREANSW"
 };
-char *phone_callflow[] = {		/* should match CALLFLOW_XXX in gsmopen.h */
+const char *phone_callflow[] = {		/* should match CALLFLOW_XXX in gsmopen.h */
 	"CALL_IDLE",
 	"CALL_DOWN",
 	"INCOMING_RNG",
@@ -934,7 +934,7 @@
 	switch_assert(tech_pvt != NULL);
 
 	if (!body) {
-		body = "";
+		body = (char *)"";
 	}
 
 	WARNINGA("event: |||%s|||\n", GSMOPEN_P_LOG, body);
@@ -1107,7 +1107,7 @@
 
 static switch_status_t load_config(int reload_type)
 {
-	char *cf = "gsmopen.conf";
+	const char *cf = "gsmopen.conf";
 	switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface;
 	private_t *tech_pvt = NULL;
 
@@ -1153,82 +1153,82 @@
 		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";
+			const char *context = "default";
+			const char *dialplan = "XML";
+			const char *destination = "5000";
+			const 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";
+			const 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";
-			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 *gsmopen_sound_rate = "8000";
-			char *alsa_play_is_mono = "1";
-			char *alsa_capture_is_mono = "1";
-			char *capture_boost = "5";
-			char *playback_boost = "10";
+			const char *at_dial_pre_number = "ATD";
+			const char *at_dial_post_number = ";";
+			const char *at_dial_expect = "OK";
+			const char *at_hangup = "ATH";
+			const char *at_hangup_expect = "OK";
+			const char *at_answer = "ATA";
+			const char *at_answer_expect = "OK";
+			const char *at_send_dtmf = "AT+VTS";
+			const char *at_preinit_1 = "";
+			const char *at_preinit_1_expect = "";
+			const char *at_preinit_2 = "";
+			const char *at_preinit_2_expect = "";
+			const char *at_preinit_3 = "";
+			const char *at_preinit_3_expect = "";
+			const char *at_preinit_4 = "";
+			const char *at_preinit_4_expect = "";
+			const char *at_preinit_5 = "";
+			const char *at_preinit_5_expect = "";
+			const char *at_postinit_1 = "at+cmic=0,9";
+			const char *at_postinit_1_expect = "OK";
+			const char *at_postinit_2 = "AT+CKPD=\"EEE\"";
+			const char *at_postinit_2_expect = "OK";
+			const char *at_postinit_3 = "AT+CSSN=1,0";
+			const char *at_postinit_3_expect = "OK";
+			const char *at_postinit_4 = "at+sidet=0";
+			const char *at_postinit_4_expect = "OK";
+			const char *at_postinit_5 = "at+clvl=99";
+			const char *at_postinit_5_expect = "OK";
+			const char *at_query_battchg = "AT+CBC";
+			const char *at_query_battchg_expect = "OK";
+			const char *at_query_signal = "AT+CSQ";
+			const char *at_query_signal_expect = "OK";
+			const char *at_call_idle = "+MCST: 1";
+			const char *at_call_incoming = "+MCST: 2";
+			const char *at_call_active = "+CSSI: 7";
+			const char *at_call_failed = "+MCST: 65";
+			const char *at_call_calling = "+CSSI: 1";
+			const char *at_indicator_noservice_string = "CIEV: 2;0";
+			const char *at_indicator_nosignal_string = "CIEV: 5;0";
+			const char *at_indicator_lowsignal_string = "CIEV: 5;1";
+			const char *at_indicator_lowbattchg_string = "CIEV: 0;1";
+			const char *at_indicator_nobattchg_string = "CIEV: 0;0";
+			const char *at_indicator_callactive_string = "CIEV: 3;1";
+			const char *at_indicator_nocallactive_string = "CIEV: 3;0";
+			const char *at_indicator_nocallsetup_string = "CIEV: 6;0";
+			const char *at_indicator_callsetupincoming_string = "CIEV: 6;1";
+			const char *at_indicator_callsetupoutgoing_string = "CIEV: 6;2";
+			const char *at_indicator_callsetupremoteringing_string = "CIEV: 6;3";
+			//const char *sms_receiving_program = "/usr/local/bin/ciapalo";
+			const char *alsacname = "plughw:1";
+			const char *alsapname = "plughw:1";
+			const char *at_early_audio = "0";
+			const char *at_after_preinit_pause = "500000";
+			const char *at_initial_pause = "500000";
+			const char *at_has_clcc = "0";
+			const char *at_has_ecam = "0";
+			const char *alsa_period_size = "160";
+			const char *alsa_periods_in_buffer = "4";
+			const char *gsmopen_sound_rate = "8000";
+			const char *alsa_play_is_mono = "1";
+			const char *alsa_capture_is_mono = "1";
+			const char *capture_boost = "5";
+			const char *playback_boost = "10";
 
 			uint32_t interface_id = 0;
 			uint32_t controldevice_speed = B115200;	//FIXME TODO
@@ -1615,8 +1615,8 @@
 		return SWITCH_STATUS_FALSE;
 
 	}
-				gsmopen_store_boost("5", &globals.GSMOPEN_INTERFACES[interface_id].capture_boost);	//FIXME
-				gsmopen_store_boost("10", &globals.GSMOPEN_INTERFACES[interface_id].playback_boost);	//FIXME
+				gsmopen_store_boost((char *)"5", &globals.GSMOPEN_INTERFACES[interface_id].capture_boost);	//FIXME
+				gsmopen_store_boost((char *)"10", &globals.GSMOPEN_INTERFACES[interface_id].playback_boost);	//FIXME
 
 				switch_sleep(100000);
 				switch_threadattr_create(&gsmopen_api_thread_attr, gsmopen_module_pool);